Skip to content

Commit

Permalink
Merge pull request #1997 from ghaerr/park
Browse files Browse the repository at this point in the history
[kernel] Move bios_disk_park_all to be PFPROC function
  • Loading branch information
ghaerr authored Sep 5, 2024
2 parents 504a394 + fd1cd0d commit 295e9ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions elks/arch/i86/drivers/block/bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion elks/include/linuxmt/biosparm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 295e9ec

Please sign in to comment.