--- /usr/src/sys/dev/tdfx/tdfx_pci.c Sun Aug 6 18:10:58 2000 +++ tdfx_pci.c Sun Aug 6 18:25:54 2000 @@ -256,6 +256,8 @@ tdfx_info->addr1 = 0; tdfx_info->memrange2 = NULL; tdfx_info->piorange = NULL; + tdfx_info->pio0 = 0; + tdfx_info->pio0max = 0; } /* @@ -691,10 +693,16 @@ (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, piod->device); /* Restricts the access of ports other than those we use */ - if(((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) || - (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ)) && - (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max)) - return -EPERM; + if(tdfx_info->pio0 != 0) { + if(((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) || + (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ)) && + (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max)) + return -EPERM; + } else { + if((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) || + (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ)) + return -EPERM; + } /* All VGA STATUS REGS are byte registers, size should never be > 1 */ if(piod->size != 1) { @@ -717,12 +725,17 @@ struct tdfx_softc *tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, piod->device); /* Replace old switch w/ massive if(...) */ - /* Restricts the access of ports other than those we use */ - if(((piod->port != SC_INDEX) && (piod->port != SC_DATA) && - (piod->port != VGA_MISC_OUTPUT_READ)) /* Can't write VGA_ST_1C */ && - (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max)) - return -EPERM; - + if(tdfx_info->pio0 != 0) { + if(((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) || + (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ)) && + (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max)) + return -EPERM; + } else { + if((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) || + (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ)) + return -EPERM; + } + /* All VGA STATUS REGS are byte registers, size should never be > 1 */ if(piod->size != 1) { return -EINVAL;