Bochs/bochs/patches/patch.minix2-temp-fix
Christophe Bothamy 4112bc75de - add fix for minix2 not detecting the hard drives.
Use this patch to revert to the previous state in case of trouble.
2003-03-05 10:42:06 +00:00

72 lines
3.4 KiB
Plaintext

----------------------------------------------------------------------
Patch name: patch.mini2-temp-fic
Author: cbothamy
Date: Wed Mar 5 11:32:00 MET 2003
Status: applied to cvs, available in case we want to revert it
Detailed description:
This patch fixes the non detection of the hard drives by minix2.
The problem lies in the fact that real hardware handles ata registers
even for non existing drives (ie non present slave drives).
Minix2 uses this fact to detect ata controller by writing to the
cylinder register of the slave drive, and reading it back.
Bochs was returning 0 when the slave wes not present.
The patch attempt to fix this, but I'm expecting side effects with
other OSes, so this patch can be used to revert to the previous state.
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on Wed Mar 5 11:32:00 MET 2003
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: iodev/harddrv.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/harddrv.cc,v
retrieving revision 1.96
diff -u -r1.96 harddrv.cc
--- iodev/harddrv.cc 2 Mar 2003 23:59:10 -0000 1.96
+++ iodev/harddrv.cc 5 Mar 2003 10:31:33 -0000
@@ -76,6 +76,7 @@
#define BX_MASTER_IS_PRESENT(c) BX_DRIVE_IS_PRESENT((c),0)
#define BX_SLAVE_IS_PRESENT(c) BX_DRIVE_IS_PRESENT((c),1)
+#define BX_ANY_IS_PRESENT(c) (BX_DRIVE_IS_PRESENT((c),0) || BX_DRIVE_IS_PRESENT((c),1))
#define BX_SELECTED_CONTROLLER(c) (BX_CONTROLLER((c),BX_HD_THIS channels[(c)].drive_select))
#define BX_SELECTED_DRIVE(c) (BX_DRIVE((c),BX_HD_THIS channels[(c)].drive_select))
@@ -974,11 +975,17 @@
case 0x03: // sector number 0x1f3
value8 = (!BX_SELECTED_IS_PRESENT(channel)) ? 0 : BX_SELECTED_CONTROLLER(channel).sector_no;
goto return_value8;
- case 0x04: // cylinder low 0x1f4
- value8 = (!BX_SELECTED_IS_PRESENT(channel)) ? 0 : (BX_SELECTED_CONTROLLER(channel).cylinder_no & 0x00ff);
+ case 0x04: // cylinder low 0x1f4
+ // -- WARNING : On real hardware the controller registers are shared between drives.
+ // So we must respond even if the select device is not present. Some OS uses this fact
+ // to detect the disks.... minix2 for example
+ value8 = (!BX_ANY_IS_PRESENT(channel)) ? 0 : (BX_SELECTED_CONTROLLER(channel).cylinder_no & 0x00ff);
goto return_value8;
case 0x05: // cylinder high 0x1f5
- value8 = (!BX_SELECTED_IS_PRESENT(channel)) ? 0 : BX_SELECTED_CONTROLLER(channel).cylinder_no >> 8;
+ // -- WARNING : On real hardware the controller registers are shared between drives.
+ // So we must respond even if the select device is not present. Some OS uses this fact
+ // to detect the disks.... minix2 for example
+ value8 = (!BX_ANY_IS_PRESENT(channel)) ? 0 : BX_SELECTED_CONTROLLER(channel).cylinder_no >> 8;
goto return_value8;
case 0x06: // hard disk drive and head register 0x1f6
@@ -1000,7 +1007,7 @@
case 0x07: // Hard Disk Status 0x1f7
case 0x16: // Hard Disk Alternate Status 0x3f6
- if (!BX_SELECTED_IS_PRESENT(channel)) {
+ if (!BX_ANY_IS_PRESENT(channel)) {
// (mch) Just return zero for these registers
value8 = 0;
} else {