From 9ec0f71c3598f42f4240bdc97d195e159718eeb8 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Sat, 3 Dec 2005 18:11:26 +0000 Subject: [PATCH] - Adhere style(9) (don't use function calls in initializers, use uintXX_t instead of u_intXX_t). - Use FBSDID. --- sys/sparc64/isa/ofw_isa.c | 9 +++++---- sys/sparc64/pci/apb.c | 13 +++++++------ sys/sparc64/pci/ofw_pci.c | 11 ++++++----- sys/sparc64/pci/ofw_pcib_subr.c | 32 +++++++++++++++++++------------- sys/sparc64/pci/ofw_pcibus.c | 4 +++- 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/sys/sparc64/isa/ofw_isa.c b/sys/sparc64/isa/ofw_isa.c index d3ae4d036941..41ce54812c09 100644 --- a/sys/sparc64/isa/ofw_isa.c +++ b/sys/sparc64/isa/ofw_isa.c @@ -27,10 +27,11 @@ * SUCH DAMAGE. * * from: NetBSD: ebus.c,v 1.26 2001/09/10 16:27:53 eeh Exp - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + /* * Helper functions which can be used in both ISA and EBus code. */ @@ -72,7 +73,7 @@ ofw_isa_range_map(struct isa_ranges *range, int nrange, u_long *start, u_long *end, int *which) { struct isa_ranges *r; - u_int64_t offs, cstart, cend; + uint64_t offs, cstart, cend; int i; for (i = 0; i < nrange; i++) { @@ -102,7 +103,7 @@ ofw_isa_route_intr(device_t bridge, phandle_t node, struct ofw_bus_iinfo *ii, ofw_isa_intr_t intr) { struct isa_regs reg; - u_int8_t maskbuf[sizeof(reg) + sizeof(intr)]; + uint8_t maskbuf[sizeof(reg) + sizeof(intr)]; device_t pbridge; ofw_isa_intr_t mintr; diff --git a/sys/sparc64/pci/apb.c b/sys/sparc64/pci/apb.c index 2dbe7d0d5d03..0e743b453042 100644 --- a/sys/sparc64/pci/apb.c +++ b/sys/sparc64/pci/apb.c @@ -29,10 +29,11 @@ * SUCH DAMAGE. * * from: FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.3 2000/12/13 - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + /* * Support for the Sun APB (Advanced PCI Bridge) PCI-PCI bridge. * This bridge does not fully comply to the PCI bridge specification, and is @@ -69,8 +70,8 @@ */ struct apb_softc { struct ofw_pcib_gen_softc sc_bsc; - u_int8_t sc_iomap; - u_int8_t sc_memmap; + uint8_t sc_iomap; + uint8_t sc_memmap; }; static device_probe_t apb_probe; @@ -143,7 +144,7 @@ apb_probe(device_t dev) } static void -apb_map_print(u_int8_t map, u_long scale) +apb_map_print(uint8_t map, u_long scale) { int i, first; @@ -157,7 +158,7 @@ apb_map_print(u_int8_t map, u_long scale) } static int -apb_checkrange(u_int8_t map, u_long scale, u_long start, u_long end) +apb_checkrange(uint8_t map, u_long scale, u_long start, u_long end) { int i, ei; diff --git a/sys/sparc64/pci/ofw_pci.c b/sys/sparc64/pci/ofw_pci.c index 764c362038ae..998b49871b95 100644 --- a/sys/sparc64/pci/ofw_pci.c +++ b/sys/sparc64/pci/ofw_pci.c @@ -27,10 +27,11 @@ * SUCH DAMAGE. * * from: NetBSD: psycho.c,v 1.35 2001/09/10 16:17:06 eeh Exp - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include "opt_ofw_pci.h" #include @@ -44,18 +45,18 @@ #include -static u_int8_t pci_bus_cnt; +static uint8_t pci_bus_cnt; static phandle_t *pci_bus_map; static int pci_bus_map_sz; #define PCI_BUS_MAP_INC 10 -u_int8_t +uint8_t ofw_pci_alloc_busno(phandle_t node) { phandle_t *om; int osz; - u_int8_t n; + uint8_t n; n = pci_bus_cnt++; /* Establish a mapping between bus numbers and device nodes. */ diff --git a/sys/sparc64/pci/ofw_pcib_subr.c b/sys/sparc64/pci/ofw_pcib_subr.c index b297d3402c95..80f6d5f95292 100644 --- a/sys/sparc64/pci/ofw_pcib_subr.c +++ b/sys/sparc64/pci/ofw_pcib_subr.c @@ -21,10 +21,11 @@ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include "opt_ofw_pci.h" #include @@ -50,9 +51,10 @@ void ofw_pcib_gen_setup(device_t bridge) { - struct ofw_pcib_gen_softc *sc = device_get_softc(bridge); + struct ofw_pcib_gen_softc *sc; u_int secbus; + sc = device_get_softc(bridge); sc->ops_pcib_sc.dev = bridge; sc->ops_node = ofw_bus_get_node(bridge); KASSERT(sc->ops_node != 0, @@ -78,18 +80,19 @@ ofw_pcib_gen_setup(device_t bridge) int ofw_pcib_gen_route_interrupt(device_t bridge, device_t dev, int intpin) { - struct ofw_pcib_gen_softc *sc = device_get_softc(bridge); - struct ofw_bus_iinfo *ii = &sc->ops_iinfo; + struct ofw_pcib_gen_softc *sc; + struct ofw_bus_iinfo *ii; struct ofw_pci_register reg; - device_t pbridge = device_get_parent(device_get_parent(bridge)); - phandle_t node = ofw_bus_get_node(dev); ofw_pci_intr_t pintr, mintr; - u_int8_t maskbuf[sizeof(reg) + sizeof(pintr)]; + uint8_t maskbuf[sizeof(reg) + sizeof(pintr)]; + sc = device_get_softc(bridge); + ii = &sc->ops_iinfo; if (ii->opi_imapsz > 0) { pintr = intpin; - if (ofw_bus_lookup_imap(node, ii, ®, sizeof(reg), &pintr, - sizeof(pintr), &mintr, sizeof(mintr), maskbuf)) { + if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), ii, ®, + sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), + maskbuf)) { /* * If we've found a mapping, return it and don't map * it again on higher levels - that causes problems @@ -105,22 +108,25 @@ ofw_pcib_gen_route_interrupt(device_t bridge, device_t dev, int intpin) return (pcib_route_interrupt(bridge, dev, intpin)); } /* Try at the parent. */ - return (PCIB_ROUTE_INTERRUPT(pbridge, bridge, intpin)); + return (PCIB_ROUTE_INTERRUPT(device_get_parent(bridge), bridge, + intpin)); } phandle_t ofw_pcib_gen_get_node(device_t bridge, device_t dev) { - struct ofw_pcib_gen_softc *sc = device_get_softc(bridge); + struct ofw_pcib_gen_softc *sc; + sc = device_get_softc(bridge); return (sc->ops_node); } void ofw_pcib_gen_adjust_busrange(device_t bridge, u_int subbus) { - struct ofw_pcib_gen_softc *sc = device_get_softc(bridge); + struct ofw_pcib_gen_softc *sc; + sc = device_get_softc(bridge); if (subbus > sc->ops_pcib_sc.subbus) { #ifdef OFW_PCI_DEBUG device_printf(bridge, diff --git a/sys/sparc64/pci/ofw_pcibus.c b/sys/sparc64/pci/ofw_pcibus.c index 6928de66d754..0ee245602502 100644 --- a/sys/sparc64/pci/ofw_pcibus.c +++ b/sys/sparc64/pci/ofw_pcibus.c @@ -200,12 +200,14 @@ ofw_pcibus_setup_device(device_t bridge, u_int busno, u_int slot, u_int func) static int ofw_pcibus_attach(device_t dev) { - device_t pcib = device_get_parent(dev); + device_t pcib; struct ofw_pci_register pcir; struct ofw_pcibus_devinfo *dinfo; phandle_t node, child; u_int slot, busno, func; + pcib = device_get_parent(dev); + /* * Ask the bridge for the bus number - in some cases, we need to * renumber buses, so the firmware information cannot be trusted.