From fd1cd0d4f8d6094239acbe03b5244ecfd90f4f8f Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Wed, 4 Sep 2024 18:56:57 -0600 Subject: [PATCH] [kernel] Move bios_disk_park_all to be PFPROC function --- elks/arch/i86/drivers/block/bios.c | 27 +++++++++++++-------------- elks/include/linuxmt/biosparm.h | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/elks/arch/i86/drivers/block/bios.c b/elks/arch/i86/drivers/block/bios.c index 65a3be4e3..97ff09954 100644 --- a/elks/arch/i86/drivers/block/bios.c +++ b/elks/arch/i86/drivers/block/bios.c @@ -223,21 +223,20 @@ int INITPROC bios_gethdinfo(struct drive_infot *drivep) { return ndrives; } -static void BFPROC bios_disk_park(struct drive_infot *drive) +void BFPROC bios_disk_park_all(void) { - /* int 13 AH=0xC supports only 10 bits for cyl */ - if (drive->cylinders > 1024 || drive->fdtype != -1) return; - BD_AX = 0x0C << 8; - BD_CX = ((drive->cylinders & 0xFF) << 8) | ((drive->cylinders & 0x300) >> 2) | 0x1; /* 0x1 = sector */ - BD_DX = bios_drive_map[drive - drive_info]; - call_bios(&bdt); -} - -void bios_disk_park_all(void) -{ - int i; - for (i = 0; i < NUM_DRIVES; ++i) - bios_disk_park(&drive_info[i]); + struct drive_infot *drivep; + unsigned int cyl; + + for (drivep = drive_info; drivep < &drive_info[NUM_DRIVES]; drivep++) { + if (drivep->fdtype != -1) /* hard drives only */ + continue; + cyl = drivep->cylinders - 1; /* expects zero-based cylinder */ + BD_AX = 0x0C << 8; + BD_CX = ((cyl & 0xFF) << 8) | ((cyl & 0x300) >> 2) | 1; /* 1 = sector */ + BD_DX = bios_drive_map[drivep - drive_info]; + call_bios(&bdt); + } } #endif diff --git a/elks/include/linuxmt/biosparm.h b/elks/include/linuxmt/biosparm.h index 7b8255f31..ed41ff693 100644 --- a/elks/include/linuxmt/biosparm.h +++ b/elks/include/linuxmt/biosparm.h @@ -87,6 +87,6 @@ void BFPROC bios_copy_ddpt(void); struct drive_infot; void BFPROC bios_switch_device98(int target, unsigned int device, struct drive_infot *drivep); -void bios_disk_park_all(void); +void BFPROC bios_disk_park_all(void); #endif