Commit d56fe0f6 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] PNPBIOS / floppy conflict.

The PNPBIOS driver and the floppy driver both fight over reservation
of the floppy port. This patch makes things friendly again.
As the comment suggests, this fix could be done better, but until
someone steps forward to fix this, this is the best we have.
parent bf1f4263
......@@ -129,6 +129,12 @@
* floppy controller (lingering task on list after module is gone... boom.)
*/
/*
* 2002/02/07 -- Anton Altaparmakov - Fix io ports reservation to correct range
* (0x3f2-0x3f5, 0x3f7). This fix is a bit of a hack but the proper fix
* requires many non-obvious changes in arch dependent code.
*/
#define FLOPPY_SANITY_CHECK
#undef FLOPPY_SILENT_DCL_CLEAR
......@@ -4248,7 +4254,7 @@ int __init floppy_init(void)
FDCS->rawcmd = 2;
if (user_reset_fdc(-1,FD_RESET_ALWAYS,0)){
/* free ioports reserved by floppy_grab_irq_and_dma() */
release_region(FDCS->address, 6);
release_region(FDCS->address+2, 4);
release_region(FDCS->address+7, 1);
FDCS->address = -1;
FDCS->version = FDC_NONE;
......@@ -4258,7 +4264,7 @@ int __init floppy_init(void)
FDCS->version = get_fdc_version();
if (FDCS->version == FDC_NONE){
/* free ioports reserved by floppy_grab_irq_and_dma() */
release_region(FDCS->address, 6);
release_region(FDCS->address+2, 4);
release_region(FDCS->address+7, 1);
FDCS->address = -1;
continue;
......@@ -4337,11 +4343,11 @@ static int floppy_grab_irq_and_dma(void)
for (fdc=0; fdc< N_FDC; fdc++){
if (FDCS->address != -1){
if (!request_region(FDCS->address, 6, "floppy")) {
DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address);
if (!request_region(FDCS->address+2, 4, "floppy")) {
DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + 2);
goto cleanup1;
}
if (!request_region(FDCS->address + 7, 1, "floppy DIR")) {
if (!request_region(FDCS->address+7, 1, "floppy DIR")) {
DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + 7);
goto cleanup2;
}
......@@ -4369,12 +4375,12 @@ static int floppy_grab_irq_and_dma(void)
irqdma_allocated = 1;
return 0;
cleanup2:
release_region(FDCS->address, 6);
release_region(FDCS->address + 2, 4);
cleanup1:
fd_free_irq();
fd_free_dma();
while(--fdc >= 0) {
release_region(FDCS->address, 6);
release_region(FDCS->address + 2, 4);
release_region(FDCS->address + 7, 1);
}
MOD_DEC_USE_COUNT;
......@@ -4441,7 +4447,7 @@ static void floppy_release_irq_and_dma(void)
old_fdc = fdc;
for (fdc = 0; fdc < N_FDC; fdc++)
if (FDCS->address != -1) {
release_region(FDCS->address, 6);
release_region(FDCS->address+2, 4);
release_region(FDCS->address+7, 1);
}
fdc = old_fdc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment