Change license from GPLv3 to LGPLv3.
[seabios.git] / src / disk.h
index a8b4ed902ecbb34c462c752f1b63c555ae1e76fb..ea42cf88a5777160cda2a515361c6dec52c52d5d 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
 //
-// This file may be distributed under the terms of the GNU GPLv3 license.
+// This file may be distributed under the terms of the GNU LGPLv3 license.
 #ifndef __DISK_H
 #define __DISK_H
 
@@ -98,9 +98,25 @@ struct floppy_ext_dbt_s {
 
 // Helper function for setting up a return code.
 struct bregs;
-void __disk_ret(const char *fname, int lineno, struct bregs *regs, u8 code);
+void __disk_ret(struct bregs *regs, u32 linecode, const char *fname);
 #define disk_ret(regs, code) \
-    __disk_ret(__func__, __LINE__, (regs), (code))
+    __disk_ret((regs), (code) | (__LINE__ << 8), __func__)
+
+
+/****************************************************************
+ * Disk command request
+ ****************************************************************/
+
+struct disk_op_s {
+    u64 lba;
+    void *far_buffer;
+    u16 count;
+    u8 driveid;
+    u8 command;
+};
+
+#define CMD_CDROM_READ 1
+#define CMD_CDEMU_READ 2
 
 
 /****************************************************************
@@ -142,25 +158,10 @@ struct ata_s {
     struct ata_device_s  devices[CONFIG_MAX_ATA_DEVICES];
     //
     // map between bios hd/cd id and ata channels
-    u8 hdcount, cdcount;
+    u8 cdcount;
     u8 idmap[2][CONFIG_MAX_ATA_DEVICES];
 };
 
-// ElTorito Device Emulation data
-struct cdemu_s {
-    u8  media;
-    u8  emulated_drive;
-    u8  controller_index;
-    u16 device_spec;
-    u32 ilba;
-    u16 buffer_segment;
-    u16 load_segment;
-    u16 sector_count;
-
-    // Virtual device
-    struct chs_s  vdevice;
-};
-
 
 /****************************************************************
  * Function defs
@@ -168,6 +169,13 @@ struct cdemu_s {
 
 // ata.c
 extern struct ata_s ATA;
+int ata_cmd_data(struct disk_op_s *op);
+int cdrom_read(struct disk_op_s *op);
+int cdrom_read_512(struct disk_op_s *op);
+int ata_cmd_packet(int driveid, u8 *cmdbuf, u8 cmdlen
+                   , u32 length, void *far_buffer);
+void ata_reset(int driveid);
+void hard_drive_setup();
 
 // floppy.c
 extern struct floppy_ext_dbt_s diskette_param_table2;
@@ -180,12 +188,9 @@ void disk_13(struct bregs *regs, u8 device);
 void disk_13XX(struct bregs *regs, u8 device);
 
 // cdrom.c
-extern struct cdemu_s CDEMU;
-int cdrom_read_emu(u16 device, u32 lba, u32 count, void *far_buffer);
 void cdrom_13(struct bregs *regs, u8 device);
 void cdemu_13(struct bregs *regs);
 void cdemu_134b(struct bregs *regs);
 int cdrom_boot();
 
-
 #endif // disk.h