From 534e7194f80fc08577a369572c99e5e2aa304aaa Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 5 Oct 2004 07:18:11 +0000 Subject: [PATCH] Yet another case of resources: + * 9: 0x3f0-0x3f3,0x3f4-0x3f5,0x3f7 This requires only one change to support. Rather than keying on the size of the resource being 2, instead key off the end & 7 being 3. This covers the same cases that the size of 2 would catch, but also covers the new above case. In addition, I think it is clearer to use the end in preference to the size and start for case #8 as well. Turns two tests into one, and catches no other cases. Make minor commentary changes to deal with new case #9. # This change is specifically minimal to allow easy MFC. A more # extensive change will go into current once I've had a chance to test # it on a lot of hardware... --- sys/dev/fdc/fdc_isa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/fdc/fdc_isa.c b/sys/dev/fdc/fdc_isa.c index 0833fed464d..6700e751f38 100644 --- a/sys/dev/fdc/fdc_isa.c +++ b/sys/dev/fdc/fdc_isa.c @@ -82,6 +82,7 @@ fdc_isa_alloc_resources(device_t dev, struct fdc_data *fdc) * 6: 0x3f2-0x3f3,0x3f4-0x3f5,0x3f7 # becoming common * 7: 0x3f2-0x3f3,0x3f4-0x3f5 # rare * 8: 0x3f0-0x3f1,0x3f2-0x3f3,0x3f4-0x3f5,0x3f7 + * 9: 0x3f0-0x3f3,0x3f4-0x3f5,0x3f7 * * The following code is generic for any value of 0x3fx :-) */ @@ -99,8 +100,7 @@ again_ioport: nports); return (ENXIO); } - if ((rman_get_start(fdc->res_ioport) & 0x7) == 0 && - rman_get_size(fdc->res_ioport) == 2) { + if ((rman_get_end(fdc->res_ioport) & 0x7) == 1) { /* Case 8 */ bus_release_resource(dev, SYS_RES_IOPORT, fdc->rid_ioport, fdc->res_ioport); @@ -116,9 +116,9 @@ again_ioport: fdc->port_off = -(fdc->porth & 0x7); /* - * Deal with case 6, 7, and 8: FDSTS and FDSATA are in rid 1. + * Deal with case 6-9: FDSTS and FDDATA. */ - if (rman_get_size(fdc->res_ioport) == 2) { + if ((rman_get_end(fdc->res_ioport) & 0x7) == 3) { fdc->rid_sts = fdc->rid_ioport + 1; fdc->res_sts = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &fdc->rid_sts, RF_ACTIVE);