aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-03-23 00:04:54 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-03-23 00:04:54 -0400
commitf888f8c55cefecc23e988440b44ff5f19aa99fb4 (patch)
tree9682bc87e9f0bae7fa7a5e5d13bad7cc049e31fb
parentaa7ddd79b054f9856f7eb99cbb24ae5f83e82e5f (diff)
downloadseabios-f888f8c55cefecc23e988440b44ff5f19aa99fb4.tar.gz
Move internal defs from ata.h to ata.c.
With -fwhole-program it is not necessary to put inline functions into headers. So, move the internal defs and code to ata.c.
-rw-r--r--src/ata.c50
-rw-r--r--src/ata.h50
2 files changed, 50 insertions, 50 deletions
diff --git a/src/ata.c b/src/ata.c
index cfe4b1ee..eba9972a 100644
--- a/src/ata.c
+++ b/src/ata.c
@@ -139,6 +139,24 @@ ata_reset(u16 device)
// 6 : no sectors left to write
// 7 : more sectors to write
+struct ata_pio_command {
+ void *far_buffer;
+ u8 biosid;
+
+ u8 feature;
+ u8 sector_count;
+ u8 lba_low;
+ u8 lba_mid;
+ u8 lba_high;
+ u8 device;
+ u8 command;
+
+ u8 sector_count2;
+ u8 lba_low2;
+ u8 lba_mid2;
+ u8 lba_high2;
+};
+
static int
send_cmd(struct ata_pio_command *cmd)
{
@@ -183,7 +201,7 @@ send_cmd(struct ata_pio_command *cmd)
return 0;
}
-int
+static int
ata_transfer(struct ata_pio_command *cmd)
{
DEBUGF("ata_transfer id=%d cmd=%d lba=%d count=%d buf=%p\n"
@@ -258,6 +276,36 @@ ata_transfer(struct ata_pio_command *cmd)
return 0;
}
+inline int
+ata_cmd_data(u16 biosid, u16 command, u32 lba, u16 count, void *far_buffer)
+{
+ u8 slave = biosid % 2;
+
+ struct ata_pio_command cmd;
+ cmd.far_buffer = far_buffer;
+ cmd.biosid = biosid;
+
+ if (count >= (1<<8) || lba + count >= (1<<28)) {
+ cmd.sector_count2 = count >> 8;
+ cmd.lba_low2 = lba >> 24;
+ cmd.lba_mid2 = 0;
+ cmd.lba_high2 = 0;
+
+ command |= 0x04;
+ lba &= 0xffffff;
+ }
+
+ cmd.feature = 0;
+ cmd.sector_count = count;
+ cmd.lba_low = lba;
+ cmd.lba_mid = lba >> 8;
+ cmd.lba_high = lba >> 16;
+ cmd.device = ((slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0)
+ | ((lba >> 24) & 0xf) | ATA_CB_DH_LBA);
+ cmd.command = command;
+ return ata_transfer(&cmd);
+}
+
// ---------------------------------------------------------------------------
// ATA/ATAPI driver : execute a packet command
// ---------------------------------------------------------------------------
diff --git a/src/ata.h b/src/ata.h
index 074ed555..5d430a00 100644
--- a/src/ata.h
+++ b/src/ata.h
@@ -11,61 +11,13 @@
#include "types.h" // u16
#include "atabits.h" // ATA_CB_DH_DEV1
-struct ata_pio_command {
- void *far_buffer;
- u8 biosid;
-
- u8 feature;
- u8 sector_count;
- u8 lba_low;
- u8 lba_mid;
- u8 lba_high;
- u8 device;
- u8 command;
-
- u8 sector_count2;
- u8 lba_low2;
- u8 lba_mid2;
- u8 lba_high2;
-};
-
// Function definitions
void ata_reset(u16 device);
-int ata_transfer(struct ata_pio_command *cmd);
+int ata_cmd_data(u16 biosid, u16 command, u32 lba, u16 count, void *far_buffer);
int ata_cmd_packet(u16 device, u8 *cmdbuf, u8 cmdlen
, u32 length, void *far_buffer);
int cdrom_read(u16 device, u32 lba, u32 count, void *far_buffer);
int cdrom_read_512(u16 device, u32 lba, u32 count, void *far_buffer);
void ata_detect();
-static inline int
-ata_cmd_data(u16 biosid, u16 command, u32 lba, u16 count, void *far_buffer)
-{
- u8 slave = biosid % 2;
-
- struct ata_pio_command cmd;
- cmd.far_buffer = far_buffer;
- cmd.biosid = biosid;
-
- if (count >= (1<<8) || lba + count >= (1<<28)) {
- cmd.sector_count2 = count >> 8;
- cmd.lba_low2 = lba >> 24;
- cmd.lba_mid2 = 0;
- cmd.lba_high2 = 0;
-
- command |= 0x04;
- lba &= 0xffffff;
- }
-
- cmd.feature = 0;
- cmd.sector_count = count;
- cmd.lba_low = lba;
- cmd.lba_mid = lba >> 8;
- cmd.lba_high = lba >> 16;
- cmd.device = ((slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0)
- | ((lba >> 24) & 0xf) | ATA_CB_DH_LBA);
- cmd.command = command;
- return ata_transfer(&cmd);
-}
-
#endif /* __ATA_H */