summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-07-14 07:04:17 +0000
committerimp <imp@FreeBSD.org>2004-07-14 07:04:17 +0000
commita352301884703dcd04a47696c9d515832e64f6f7 (patch)
tree1a08be0dbcbf39e81709144c669d14e172c65401
parent9f832c00ba2aa24eade0b2ef01b987cd24e8c55b (diff)
downloadFreeBSD-src-a352301884703dcd04a47696c9d515832e64f6f7.zip
FreeBSD-src-a352301884703dcd04a47696c9d515832e64f6f7.tar.gz
Remove fdc_alloc_resources, which should have happened in last commit.
-rw-r--r--sys/dev/fdc/fdc.c144
-rw-r--r--sys/dev/fdc/fdc_isa.c1
2 files changed, 2 insertions, 143 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index c549ebc..331ea5f 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -511,143 +511,6 @@ fd_read_status(fdc_p fdc)
return ret;
}
-int
-fdc_alloc_resources(struct fdc_data *fdc)
-{
- device_t dev;
- int ispnp, ispcmcia, nports;
-
- dev = fdc->fdc_dev;
- ispnp = (fdc->flags & FDC_ISPNP) != 0;
- ispcmcia = (fdc->flags & FDC_ISPCMCIA) != 0;
- fdc->rid_ioport = fdc->rid_irq = fdc->rid_drq = 0;
- fdc->res_ioport = fdc->res_irq = fdc->res_drq = 0;
- fdc->rid_ctl = 1;
-
- /*
- * On standard ISA, we don't just use an 8 port range
- * (e.g. 0x3f0-0x3f7) since that covers an IDE control
- * register at 0x3f6.
- *
- * Isn't PC hardware wonderful.
- *
- * The Y-E Data PCMCIA FDC doesn't have this problem, it
- * uses the register with offset 6 for pseudo-DMA, and the
- * one with offset 7 as control register.
- */
- nports = ispcmcia ? 8 : (ispnp ? 1 : 6);
-
- /*
- * Some ACPI BIOSen have _CRS objects for the floppy device that
- * split the I/O port resource into several resources. We detect
- * this case by checking if there are more than 2 IOPORT resources.
- * If so, we use the resource with the smallest start address as
- * the port RID and the largest start address as the control RID.
- */
- if (bus_get_resource_count(dev, SYS_RES_IOPORT, 2) != 0) {
- u_long min_start, max_start, tmp;
- int i;
-
- /* Find the min/max start addresses and their RIDs. */
- max_start = 0ul;
- min_start = ~0ul;
- for (i = 0; bus_get_resource_count(dev, SYS_RES_IOPORT, i) > 0;
- i++) {
- tmp = bus_get_resource_start(dev, SYS_RES_IOPORT, i);
- KASSERT(tmp != 0, ("bogus resource"));
- if (tmp < min_start) {
- min_start = tmp;
- fdc->rid_ioport = i;
- }
- if (tmp > max_start) {
- max_start = tmp;
- fdc->rid_ctl = i;
- }
- }
- if (min_start + 7 != max_start) {
- device_printf(dev, "I/O to control range incorrect\n");
- return (ENXIO);
- }
- }
-
- fdc->res_ioport = bus_alloc_resource(dev, SYS_RES_IOPORT,
- &fdc->rid_ioport, 0ul, ~0ul,
- nports, RF_ACTIVE);
- if (fdc->res_ioport == 0) {
- device_printf(dev, "cannot reserve I/O port range (%d ports)\n",
- nports);
- return ENXIO;
- }
- fdc->portt = rman_get_bustag(fdc->res_ioport);
- fdc->porth = rman_get_bushandle(fdc->res_ioport);
-
- if (!ispcmcia) {
- /*
- * Some BIOSen report the device at 0x3f2-0x3f5,0x3f7
- * and some at 0x3f0-0x3f5,0x3f7. We detect the former
- * by checking the size and adjust the port address
- * accordingly.
- */
- if (bus_get_resource_count(dev, SYS_RES_IOPORT, 0) == 4)
- fdc->port_off = -2;
-
- /*
- * Register the control port range as rid 1 if it
- * isn't there already. Most PnP BIOSen will have
- * already done this but non-PnP configurations don't.
- *
- * And some (!!) report 0x3f2-0x3f5 and completely
- * leave out the control register! It seems that some
- * non-antique controller chips have a different
- * method of programming the transfer speed which
- * doesn't require the control register, but it's
- * mighty bogus as the chip still responds to the
- * address for the control register.
- */
- if (bus_get_resource_count(dev, SYS_RES_IOPORT, 1) == 0) {
- u_long ctlstart;
-
- /* Find the control port, usually 0x3f7 */
- ctlstart = rman_get_start(fdc->res_ioport) +
- fdc->port_off + 7;
-
- bus_set_resource(dev, SYS_RES_IOPORT, 1, ctlstart, 1);
- }
-
- /*
- * Now (finally!) allocate the control port.
- */
- fdc->res_ctl = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
- &fdc->rid_ctl, RF_ACTIVE);
- if (fdc->res_ctl == 0) {
- device_printf(dev,
- "cannot reserve control I/O port range (control port)\n");
- return ENXIO;
- }
- fdc->ctlt = rman_get_bustag(fdc->res_ctl);
- fdc->ctlh = rman_get_bushandle(fdc->res_ctl);
- }
-
- fdc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &fdc->rid_irq,
- RF_ACTIVE | RF_SHAREABLE);
- if (fdc->res_irq == 0) {
- device_printf(dev, "cannot reserve interrupt line\n");
- return ENXIO;
- }
-
- if ((fdc->flags & FDC_NODMA) == 0) {
- fdc->res_drq = bus_alloc_resource_any(dev, SYS_RES_DRQ,
- &fdc->rid_drq, RF_ACTIVE | RF_SHAREABLE);
- if (fdc->res_drq == 0) {
- device_printf(dev, "cannot reserve DMA request line\n");
- fdc->flags |= FDC_NODMA;
- } else
- fdc->dmachan = rman_get_start(fdc->res_drq);
- }
-
- return 0;
-}
-
void
fdc_release_resources(struct fdc_data *fdc)
{
@@ -796,15 +659,10 @@ fdc_attach(device_t dev)
{
struct fdc_data *fdc;
const char *name, *dname;
- int i, error, dunit;
+ int i, dunit, error;
fdc = device_get_softc(dev);
fdc->fdc_dev = dev;
- error = fdc_alloc_resources(fdc);
- if (error) {
- device_printf(dev, "cannot re-acquire resources\n");
- return error;
- }
error = BUS_SETUP_INTR(device_get_parent(dev), dev, fdc->res_irq,
INTR_TYPE_BIO | INTR_ENTROPY, fdc_intr, fdc,
&fdc->fdc_intr);
diff --git a/sys/dev/fdc/fdc_isa.c b/sys/dev/fdc/fdc_isa.c
index 8be3aad..b14c990 100644
--- a/sys/dev/fdc/fdc_isa.c
+++ b/sys/dev/fdc/fdc_isa.c
@@ -67,6 +67,7 @@ fdc_isa_alloc_resources(device_t dev, struct fdc_data *fdc)
int ispnp, nports;
ispnp = (fdc->flags & FDC_ISPNP) != 0;
+ fdc->fdc_dev = dev;
fdc->rid_ioport = 0;
fdc->rid_irq = 0;
fdc->rid_drq = 0;
OpenPOWER on IntegriCloud