Move irq_enable/disable out of ata.c
authorKevin O'Connor <kevin@koconnor.net>
Thu, 13 Mar 2008 00:49:07 +0000 (20:49 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 13 Mar 2008 00:49:07 +0000 (20:49 -0400)
Move irq_enable into all callers - only disk.c had irqs disabled anyway.

src/ata.c
src/disk.c

index 2e44d41c36a8ea95c4d56641002ea733fe8840c5..cbd61d95b23e54527885b0d990c7b7c6963014e4 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -205,9 +205,6 @@ ata_transfer(struct ata_pio_command *cmd)
     u16 iobase2 = GET_EBDA(ata.channels[channel].iobase2);
     u8 mode     = GET_EBDA(ata.devices[biosid].mode);
     int iswrite = (cmd->command & ~0x40) == ATA_CMD_WRITE_SECTORS;
-
-    irq_enable();
-
     u8 current = 0;
     u16 count = cmd->sector_count;
     u8 status;
@@ -256,8 +253,6 @@ ata_transfer(struct ata_pio_command *cmd)
         return 4;
     }
 
-    irq_disable();
-
     // Enable interrupts
     outb(ATA_CB_DC_HD15, iobase2+ATA_CB_DC);
     return 0;
@@ -310,8 +305,6 @@ ata_cmd_packet(u16 biosid, u8 *cmdbuf, u8 cmdlen
     SET_EBDA(ata.trsfsectors,0);
     SET_EBDA(ata.trsfbytes,0L);
 
-    irq_enable();
-
     // Send command to device
     outsw_far(iobase1, MAKE_32_PTR(GET_SEG(SS), (u32)cmdbuf), cmdlen / 2);
 
index 9320c3c47da1953494b813666f687a10928e1d91..0ccbe42009368b3f4ed5883332e7d966f72fed36 100644 (file)
@@ -75,6 +75,8 @@ basic_access(struct bregs *regs, u8 device, u16 command)
     u16 segment = regs->es;
     u16 offset  = regs->bx;
 
+    irq_enable();
+
     u8 status;
     u32 lba;
     if (nph != nlh || npspt != nlspt) {
@@ -90,6 +92,8 @@ basic_access(struct bregs *regs, u8 device, u16 command)
                                   , MAKE_32_PTR(segment, offset));
     }
 
+    irq_disable();
+
     // Set nb of sector transferred
     regs->al = GET_EBDA(ata.trsfsectors);
 
@@ -146,8 +150,10 @@ emu_access(struct bregs *regs, u8 device, u16 command)
     u16 segment = regs->es;
     u16 offset  = regs->bx;
 
+    irq_enable();
     u8 status = cdrom_read(device, lba, count*512
                            , MAKE_32_PTR(segment, offset), before*512);
+    irq_disable();
     if (status != 0) {
         BX_INFO("int13_harddisk: function %02x, error %02x !\n",regs->ah,status);
         regs->al = 0;
@@ -190,6 +196,8 @@ extended_access(struct bregs *regs, u8 device, u16 command)
         return;
     }
 
+    irq_enable();
+
     u8 status;
     if (type == ATA_TYPE_ATA)
         status = ata_cmd_data(device, command, lba, count
@@ -198,6 +206,8 @@ extended_access(struct bregs *regs, u8 device, u16 command)
         status = cdrom_read(device, lba, count*2048
                             , MAKE_32_PTR(segment, offset), 0);
 
+    irq_disable();
+
     SET_INT13EXT(regs, count, GET_EBDA(ata.trsfsectors));
 
     if (status != 0) {