Clear PMMAllocs even if CONFIG_PMM not set.
[seabios.git] / src / ata.h
index ba2667c87f5e8b46531a41cdd96aa70f64780646..65d67b0b4282ecf9db2a1159c3ced84e53e63f38 100644 (file)
--- a/src/ata.h
+++ b/src/ata.h
@@ -1,24 +1,26 @@
-// Low level ATA disk definitions
-//
-// Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
-// Copyright (C) 2002  MandrakeSoft S.A.
-//
-// This file may be distributed under the terms of the GNU GPLv3 license.
-
 #ifndef __ATA_H
 #define __ATA_H
 
-#include "types.h" // u16
-
-// Function definitions
-void ata_reset(u16 device);
-u16 ata_cmd_data_in(u16 device, u16 command, u16 count, u16 cylinder
-                    , u16 head, u16 sector, u32 lba, u16 segment, u16 offset);
-u16 ata_cmd_data_out(u16 device, u16 command, u16 count, u16 cylinder
-                     , u16 head, u16 sector, u32 lba, u16 segment, u16 offset);
-u16 ata_cmd_packet(u16 device, u8 cmdlen, u16 cmdseg, u16 cmdoff, u16 header
-                   , u32 length, u8 inout, u16 bufseg, u16 bufoff);
-void ata_detect();
+#include "types.h" // u8
+#include "config.h" // CONFIG_MAX_ATA_INTERFACES
+
+struct ata_channel_s {
+    u16 iobase1;      // IO Base 1
+    u16 iobase2;      // IO Base 2
+    u16 pci_bdf;
+    u8  irq;          // IRQ
+};
+
+// ata.c
+extern struct ata_channel_s ATA_channels[CONFIG_MAX_ATA_INTERFACES];
+int cdrom_read(struct disk_op_s *op);
+int ata_cmd_packet(struct drive_s *drive_g, u8 *cmdbuf, u8 cmdlen
+                   , u32 length, void *buf_fl);
+void ata_setup();
+int process_ata_op(struct disk_op_s *op);
+int process_atapi_op(struct disk_op_s *op);
+void describe_ata(struct drive_s *drive_g);
+void describe_atapi(struct drive_s *drive_g);
 
 // Global defines -- ATA register and register bits.
 // command block & control block regs
@@ -128,33 +130,4 @@ void ata_detect();
 #define ATA_CMD_WRITE_SECTORS                0x30
 #define ATA_CMD_WRITE_VERIFY                 0x3C
 
-#define ATA_IFACE_NONE    0x00
-#define ATA_IFACE_ISA     0x00
-#define ATA_IFACE_PCI     0x01
-
-#define ATA_TYPE_NONE     0x00
-#define ATA_TYPE_UNKNOWN  0x01
-#define ATA_TYPE_ATA      0x02
-#define ATA_TYPE_ATAPI    0x03
-
-#define ATA_DEVICE_NONE  0x00
-#define ATA_DEVICE_HD    0xFF
-#define ATA_DEVICE_CDROM 0x05
-
-#define ATA_MODE_NONE    0x00
-#define ATA_MODE_PIO16   0x00
-#define ATA_MODE_PIO32   0x01
-#define ATA_MODE_ISADMA  0x02
-#define ATA_MODE_PCIDMA  0x03
-#define ATA_MODE_USEIRQ  0x10
-
-#define ATA_TRANSLATION_NONE  0
-#define ATA_TRANSLATION_LBA   1
-#define ATA_TRANSLATION_LARGE 2
-#define ATA_TRANSLATION_RECHS 3
-
-#define ATA_DATA_NO      0x00
-#define ATA_DATA_IN      0x01
-#define ATA_DATA_OUT     0x02
-
-#endif /* __ATA_H */
+#endif // ata.h