Skip to content

Commit cab3234

Browse files
boeckmannPerditionC
authored andcommitted
only use AH for EDD version detection, as AL is reserved...
...according to the spec
1 parent a5431d9 commit cab3234

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

kernel/initdisk.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -655,15 +655,17 @@ STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam, i
655655

656656
init_call_intr(0x13, &regs);
657657

658-
/* LBA not supported at all, or read, write, verify not supported */
659-
if (regs.b.x != 0xaa55 || (regs.flags & 0x01) || (regs.c.x & 1) == 0)
658+
if ((regs.flags & 0x01) || regs.b.x != 0xaa55 || (regs.c.x & 0x01) == 0)
660659
{
660+
/* error conditions:
661+
carry set or BX != 0xaa55 => no EDD spec compatible BIOS
662+
CX bit 1 clear => fixed disc access subset not supported */
661663
goto StandardBios;
662664
}
663665

664666
/* version 1.0, 2.0 have different verify */
665-
if (regs.a.x < 0x2100)
666-
LBA_WRITE_VERIFY = 0x4301; /* problematic if INT13 is hooked by
667+
if (regs.a.b.h < 0x21)
668+
LBA_WRITE_VERIFY = 0x4301; /* may be problematic if INT13 is hooked by
667669
different controllers / drivers */
668670

669671
/* query disk size and DMA handling, geometry is queried later by INT13,08 */
@@ -676,9 +678,9 @@ STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam, i
676678
regs.d.b.l = drive;
677679
init_call_intr(0x13, &regs);
678680

679-
/* error or DMA boundary errors not handled transparently */
680681
if (regs.flags & 0x01)
681682
{
683+
/* carry flag set indicates failed LBA disk parameter query */
682684
goto StandardBios;
683685
}
684686

@@ -719,11 +721,13 @@ STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam, i
719721

720722
if (lba_bios_parameters.information & 1)
721723
{
722-
driveParam->descflags |= DF_DMA_TRANSPARENT; /* DMA boundary errors are handled transparently */
724+
/* DMA boundary errors are handled transparently */
725+
driveParam->descflags |= DF_DMA_TRANSPARENT;
723726
}
724727

725-
StandardBios: /* old way to get parameters */
726-
if (firstPass && (InitKernelConfig.Verbose >= 1)) printf("Retrieving CHS values for drive\n");
728+
StandardBios: /* get disk geometry, and if LBA is not enabled, also size */
729+
if (firstPass && (InitKernelConfig.Verbose >= 1))
730+
printf("Retrieving CHS values for drive\n");
727731

728732
regs.a.b.h = 0x08;
729733
regs.d.b.l = drive;

0 commit comments

Comments
 (0)