From 74beeca71037ece785a6ab50b7e806296b6f4240 Mon Sep 17 00:00:00 2001 From: augustss Date: Tue, 25 Apr 2000 09:20:54 +0000 Subject: [PATCH] Move the size of the mapped bus_space region into the bus independent softc. --- sys/dev/cardbus/ohci_cardbus.c | 11 +++++------ sys/dev/pci/ohci_pci.c | 15 +++++++-------- sys/dev/pci/uhci_pci.c | 15 +++++++-------- sys/dev/usb/ohcivar.h | 3 ++- sys/dev/usb/uhcivar.h | 3 ++- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/sys/dev/cardbus/ohci_cardbus.c b/sys/dev/cardbus/ohci_cardbus.c index b6def62d3f09..0bf04b6f3019 100644 --- a/sys/dev/cardbus/ohci_cardbus.c +++ b/sys/dev/cardbus/ohci_cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ohci_cardbus.c,v 1.5 2000/03/07 00:32:52 mycroft Exp $ */ +/* $NetBSD: ohci_cardbus.c,v 1.6 2000/04/25 09:20:54 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -77,7 +77,6 @@ struct ohci_cardbus_softc { cardbus_chipset_tag_t sc_cc; cardbus_function_tag_t sc_cf; cardbus_devfunc_t sc_ct; - bus_size_t sc_size; void *sc_ih; /* interrupt vectoring */ }; @@ -130,7 +129,7 @@ ohci_cardbus_attach(parent, self, aux) /* Map I/O registers */ if (Cardbus_mapreg_map(ct, CARDBUS_CBMEM, CARDBUS_MAPREG_TYPE_MEM, 0, - &sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc_size)) { + &sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc.sc_size)) { printf("%s: can't map mem space\n", devname); return; } @@ -208,10 +207,10 @@ ohci_cardbus_detach(self, flags) cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih); sc->sc_ih = NULL; } - if (sc->sc_size) { + if (sc->sc.sc_size) { Cardbus_mapreg_unmap(ct, CARDBUS_CBMEM, sc->sc.iot, - sc->sc.ioh, sc->sc_size); - sc->sc_size = 0; + sc->sc.ioh, sc->sc.sc_size); + sc->sc.sc_size = 0; } return (0); } diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c index a1270900582b..750a2bcaa3ab 100644 --- a/sys/dev/pci/ohci_pci.c +++ b/sys/dev/pci/ohci_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ohci_pci.c,v 1.14 1999/10/12 11:21:24 augustss Exp $ */ +/* $NetBSD: ohci_pci.c,v 1.15 2000/04/25 09:20:55 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -70,7 +70,6 @@ int ohci_pci_detach __P((device_ptr_t, int)); struct ohci_pci_softc { ohci_softc_t sc; pci_chipset_tag_t sc_pc; - bus_size_t sc_size; void *sc_ih; /* interrupt vectoring */ }; @@ -117,7 +116,7 @@ ohci_pci_attach(parent, self, aux) /* Map I/O registers */ if (pci_mapreg_map(pa, PCI_CBMEM, PCI_MAPREG_TYPE_MEM, 0, - &sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc_size)) { + &sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc.sc_size)) { printf("%s: can't map mem space\n", devname); return; } @@ -183,13 +182,13 @@ ohci_pci_detach(self, flags) rv = ohci_detach(&sc->sc, flags); if (rv) return (rv); - if (sc->sc_ih) { + if (sc->sc_ih != NULL) { pci_intr_disestablish(sc->sc_pc, sc->sc_ih); - sc->sc_ih = 0; + sc->sc_ih = NULL; } - if (sc->sc_size) { - bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc_size); - sc->sc_size = 0; + if (sc->sc.sc_size) { + bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size); + sc->sc.sc_size = 0; } return (0); } diff --git a/sys/dev/pci/uhci_pci.c b/sys/dev/pci/uhci_pci.c index d70aadfbee6f..71bd451905d8 100644 --- a/sys/dev/pci/uhci_pci.c +++ b/sys/dev/pci/uhci_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci_pci.c,v 1.14 2000/01/25 11:26:06 augustss Exp $ */ +/* $NetBSD: uhci_pci.c,v 1.15 2000/04/25 09:20:55 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -63,7 +63,6 @@ int uhci_pci_detach __P((device_ptr_t, int)); struct uhci_pci_softc { uhci_softc_t sc; pci_chipset_tag_t sc_pc; - bus_size_t sc_size; void *sc_ih; /* interrupt vectoring */ }; @@ -110,7 +109,7 @@ uhci_pci_attach(parent, self, aux) /* Map I/O registers */ if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, - &sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc_size)) { + &sc->sc.iot, &sc->sc.ioh, NULL, &sc->sc.sc_size)) { printf("%s: can't map i/o space\n", devname); return; } @@ -197,13 +196,13 @@ uhci_pci_detach(self, flags) rv = uhci_detach(&sc->sc, flags); if (rv) return (rv); - if (sc->sc_ih) { + if (sc->sc_ih != NULL) { pci_intr_disestablish(sc->sc_pc, sc->sc_ih); - sc->sc_ih = 0; + sc->sc_ih = NULL; } - if (sc->sc_size) { - bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc_size); - sc->sc_size = 0; + if (sc->sc.sc_size) { + bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size); + sc->sc.sc_size = 0; } return (0); } diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h index b1d274572382..2a0ebab67d78 100644 --- a/sys/dev/usb/ohcivar.h +++ b/sys/dev/usb/ohcivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ohcivar.h,v 1.21 2000/03/29 01:46:27 augustss Exp $ */ +/* $NetBSD: ohcivar.h,v 1.22 2000/04/25 09:20:55 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -87,6 +87,7 @@ typedef struct ohci_softc { struct usbd_bus sc_bus; /* base device */ bus_space_tag_t iot; bus_space_handle_t ioh; + bus_size_t sc_size; usb_dma_t sc_hccadma; struct ohci_hcca *sc_hcca; diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h index 9d8859affdee..c4934f45da5b 100644 --- a/sys/dev/usb/uhcivar.h +++ b/sys/dev/usb/uhcivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: uhcivar.h,v 1.28 2000/04/06 23:44:21 augustss Exp $ */ +/* $NetBSD: uhcivar.h,v 1.29 2000/04/25 09:20:55 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */ /* @@ -134,6 +134,7 @@ typedef struct uhci_softc { struct usbd_bus sc_bus; /* base device */ bus_space_tag_t iot; bus_space_handle_t ioh; + bus_size_t sc_size; uhci_physaddr_t *sc_pframes; usb_dma_t sc_dma;