diff options
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/pci/macobio.c | 54 | ||||
-rw-r--r-- | sys/arch/macppc/pci/mpcpcibus.c | 277 | ||||
-rw-r--r-- | sys/arch/macppc/pci/pchb.c | 12 | ||||
-rw-r--r-- | sys/arch/macppc/pci/pci_addr_fixup.c | 94 | ||||
-rw-r--r-- | sys/arch/macppc/pci/pciide_machdep.c | 10 | ||||
-rw-r--r-- | sys/arch/macppc/pci/vgafb.c | 73 | ||||
-rw-r--r-- | sys/arch/macppc/pci/vgafb_pci.c | 65 |
7 files changed, 187 insertions, 398 deletions
diff --git a/sys/arch/macppc/pci/macobio.c b/sys/arch/macppc/pci/macobio.c index 8fd4a83fefe..99ccca2d9a1 100644 --- a/sys/arch/macppc/pci/macobio.c +++ b/sys/arch/macppc/pci/macobio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macobio.c,v 1.8 2003/05/12 09:00:31 tdeval Exp $ */ +/* $OpenBSD: macobio.c,v 1.9 2003/10/15 23:00:56 drahn Exp $ */ /* $NetBSD: obio.c,v 1.6 1999/05/01 10:36:08 tsubai Exp $ */ /*- @@ -49,6 +49,8 @@ void macobio_attach(struct device *, struct device *, void *); int macobio_match(struct device *, void *, void *); int macobio_print(void *, const char *); +void macobio_modem_power(int enable); + void *undef_mac_establish(void * lcv, int irq, int type, int level, int (*ih_fun)(void *), void *ih_arg, char *name); void mac_intr_disestab(void *lcp, void *arg); @@ -70,10 +72,7 @@ struct cfattach macobio_ca = { }; int -macobio_match(parent, cf, aux) - struct device *parent; - void *cf; - void *aux; +macobio_match(struct device *parent, void *cf, void *aux) { struct pci_attach_args *pa = aux; @@ -100,9 +99,7 @@ u_int32_t *heathrow_FCR = NULL; * Attach all the sub-devices we can find */ void -macobio_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +macobio_attach(struct device *parent, struct device *self, void *aux) { struct macobio_softc *sc = (struct macobio_softc *)self; struct pci_attach_args *pa = aux; @@ -138,7 +135,7 @@ macobio_attach(parent, self, aux) { /* always ??? */ heathrow_FCR = mapiodev(reg[2] + HEATHROW_FCR_OFFSET, - 4); + 4); } break; case PCI_PRODUCT_APPLE_KEYLARGO: @@ -148,10 +145,8 @@ macobio_attach(parent, self, aux) if (node == -1) node = OF_finddevice("/pci/mac-io"); if (OF_getprop(node, "assigned-addresses", reg, sizeof(reg)) - == (sizeof (reg[0]) * 5)) - { + == (sizeof (reg[0]) * 5)) sc->obiomem = mapiodev(reg[2], 0x100); - } break; default: @@ -218,9 +213,7 @@ macobio_attach(parent, self, aux) } int -macobio_print(aux, macobio) - void *aux; - const char *macobio; +macobio_print(void *aux, const char *macobio) { #ifdef MACOBIOVERBOSE struct confargs *ca = aux; @@ -238,23 +231,15 @@ macobio_print(aux, macobio) } void * -undef_mac_establish(lcv, irq, type, level, ih_fun, ih_arg, name) - void * lcv; - int irq; - int type; - int level; - int (*ih_fun)(void *); - void *ih_arg; - char *name; +undef_mac_establish(void * lcv, int irq, int type, int level, + int (*ih_fun)(void *), void *ih_arg, char *name) { printf("mac_intr_establish called, not yet inited\n"); return 0; } void -mac_intr_disestab(lcp, arg) - void *lcp; - void *arg; +mac_intr_disestab(void *lcp, void *arg) { printf("mac_intr_disestablish called, not yet inited\n"); } @@ -263,27 +248,18 @@ intr_establish_t *mac_intr_establish_func = undef_mac_establish; intr_disestablish_t *mac_intr_disestablish_func = mac_intr_disestab; void * -mac_intr_establish(lcv, irq, type, level, ih_fun, ih_arg, name) - void * lcv; - int irq; - int type; - int level; - int (*ih_fun)(void *); - void *ih_arg; - char *name; +mac_intr_establish(void * lcv, int irq, int type, int level, + int (*ih_fun)(void *), void *ih_arg, char *name) { return (*mac_intr_establish_func)(lcv, irq, type, level, ih_fun, - ih_arg, name); + ih_arg, name); } void -mac_intr_disestablish(lcp, arg) - void *lcp; - void *arg; +mac_intr_disestablish(void *lcp, void *arg) { (*mac_intr_disestablish_func)(lcp, arg); } -void macobio_modem_power(int enable); void macobio_modem_power(int enable) { diff --git a/sys/arch/macppc/pci/mpcpcibus.c b/sys/arch/macppc/pci/mpcpcibus.c index 8a6bedd0602..a35cffb688a 100644 --- a/sys/arch/macppc/pci/mpcpcibus.c +++ b/sys/arch/macppc/pci/mpcpcibus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpcpcibus.c,v 1.20 2003/06/09 16:34:21 deraadt Exp $ */ +/* $OpenBSD: mpcpcibus.c,v 1.21 2003/10/15 23:00:57 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -81,6 +81,8 @@ int of_ether_hw_addr(struct ppc_pci_chipset *, u_int8_t *); int find_node_intr (int parent, u_int32_t *addr, u_int32_t *intr); u_int32_t pci_iack(void); +void fix_node_irq(int node, struct pcibus_attach_args *pba); + struct cfattach mpcpcibr_ca = { sizeof(struct pcibr_softc), mpcpcibrmatch, mpcpcibrattach, }; @@ -138,9 +140,7 @@ struct powerpc_bus_dma_tag pci_bus_dma_tag = { */ #define TULIP_CRC32_POLY 0xEDB88320UL static __inline__ unsigned -srom_crc32( - const unsigned char *databuf, - size_t datalen) +srom_crc32(const unsigned char *databuf, size_t datalen) { u_int idx, bit, data, crc = 0xFFFFFFFFUL; @@ -151,9 +151,7 @@ srom_crc32( } int -mpcpcibrmatch(parent, match, aux) - struct device *parent; - void *match, *aux; +mpcpcibrmatch(struct device *parent, void *match, void *aux) { struct confargs *ca = aux; int found = 0; @@ -166,13 +164,9 @@ mpcpcibrmatch(parent, match, aux) return found; } -void fix_node_irq(int node, struct pcibus_attach_args *pba); - int pci_map_a = 0; void -mpcpcibrattach(parent, self, aux) - struct device *parent, *self; - void *aux; +mpcpcibrattach(struct device *parent, struct device *self, void *aux) { struct pcibr_softc *sc = (struct pcibr_softc *)self; struct confargs *ca = aux; @@ -198,10 +192,12 @@ mpcpcibrattach(parent, self, aux) if (err == 0) { switch (val) { /* supported ppc-pci bridges */ - case (PCI_VENDOR_MOT | ( PCI_PRODUCT_MOT_MPC105 <<16)): + case (PCI_VENDOR_MOT | + (PCI_PRODUCT_MOT_MPC105 <<16)): bridge = "MPC105"; break; - case (PCI_VENDOR_MOT | ( PCI_PRODUCT_MOT_MPC106 <<16)): + case (PCI_VENDOR_MOT | + (PCI_PRODUCT_MOT_MPC106 <<16)): bridge = "MPC106"; break; default: @@ -231,28 +227,24 @@ mpcpcibrattach(parent, self, aux) sc->sc_iobus_space.bus_base = MPC106_P_PCI_IO_SPACE; sc->sc_iobus_space.bus_reverse = 1; if ( bus_space_map(&(sc->sc_iobus_space), 0, NBPG, 0, - &lcp->ioh_cf8) != 0 ) - { + &lcp->ioh_cf8) != 0 ) panic("mpcpcibus: unable to map self"); - } + lcp->ioh_cfc = lcp->ioh_cf8; } else { sc->sc_membus_space.bus_base = - MPC106_P_PCI_MEM_SPACE_MAP_B; + MPC106_P_PCI_MEM_SPACE_MAP_B; sc->sc_membus_space.bus_reverse = 1; sc->sc_iobus_space.bus_base = - MPC106_P_PCI_IO_SPACE_MAP_B; + MPC106_P_PCI_IO_SPACE_MAP_B; sc->sc_iobus_space.bus_reverse = 1; if ( bus_space_map(&(sc->sc_iobus_space), 0xfec00000, - NBPG, 0, &lcp->ioh_cf8) != 0 ) - { + NBPG, 0, &lcp->ioh_cf8) != 0 ) panic("mpcpcibus: unable to map self"); - } + if ( bus_space_map(&(sc->sc_iobus_space), 0xfee00000, - NBPG, 0, &lcp->ioh_cfc) != 0 ) - { + NBPG, 0, &lcp->ioh_cfc) != 0 ) panic("mpcpcibus: unable to map self"); - } } lcp->lc_pc.pc_conf_v = lcp; @@ -276,11 +268,10 @@ mpcpcibrattach(parent, self, aux) printf(": %s, Revision 0x%x, ", bridge, mpc_cfg_read_1(lcp, MPC106_PCI_REVID)); - if (map == 1) { + if (map == 1) printf("Using Map A\n"); - } else { + else printf("Using Map B\n"); - } #if 0 /* Reset status */ mpc_cfg_write_2(lcp, MPC106_PCI_STAT, 0xff80); @@ -323,27 +314,25 @@ mpcpcibrattach(parent, self, aux) struct ranges_new *prange = (void *)&range_store; len=OF_getprop(ca->ca_node, "compatible", compat, - sizeof (compat)); + sizeof (compat)); if (len <= 0 ) { len=OF_getprop(ca->ca_node, "name", compat, sizeof (compat)); if (len <= 0) { printf(" compatible and name not" - " found\n"); + " found\n"); return; } compat[len] = 0; if (strcmp (compat, "bandit") != 0) { printf(" compatible not found and name" - " %s found\n", compat); + " %s found\n", compat); return; } } compat[len] = 0; if ((rangelen = OF_getprop(ca->ca_node, "ranges", - range_store, - sizeof (range_store))) <= 0) - { + range_store, sizeof (range_store))) <= 0) { printf("range lookup failed, node %x\n", ca->ca_node); } @@ -368,8 +357,7 @@ mpcpcibrattach(parent, self, aux) /* find io(config) base, flag == 0x01000000 */ found = 0; - for (i = 0; i < rangelen ; i++) - { + for (i = 0; i < rangelen ; i++) { if (prange[i].flags == 0x01000000) { /* find last? */ found = i; @@ -378,9 +366,9 @@ mpcpcibrattach(parent, self, aux) /* found the io space ranges */ if (prange[found].flags == 0x01000000) { sc->sc_iobus_space.bus_base = - prange[found].base; + prange[found].base; sc->sc_iobus_space.bus_size = - prange[found].size; + prange[found].size; } /* the mem space ranges @@ -393,8 +381,7 @@ mpcpcibrattach(parent, self, aux) * 0x80000000 * start with segment 1 not 0, 0 is config. */ - for (i = 0; i < rangelen ; i++) - { + for (i = 0; i < rangelen ; i++) { if (prange[i].flags == 0x02000000) { #if 0 printf("\nfound mem %x %x", @@ -404,10 +391,9 @@ mpcpcibrattach(parent, self, aux) if (base != 0) { if ((base + size) == - prange[i].base) - { - size += - prange[i].size; + prange[i].base) { + size += + prange[i].size; } else { base = prange[i].base; @@ -427,44 +413,38 @@ mpcpcibrattach(parent, self, aux) addr_offset = 0; for (i = 0; config_offsets[i].compat != NULL; i++) { if (strcmp(config_offsets[i].compat, compat) - == 0) - { + == 0) { addr_offset = config_offsets[i].addr; data_offset = config_offsets[i].data; lcp->config_type = - config_offsets[i].config_type; + config_offsets[i].config_type; break; } } if (addr_offset == 0) { printf("unable to find match for" - " compatible %s\n", compat); + " compatible %s\n", compat); return; } #ifdef DEBUG_FIXUP - printf(" mem base %x sz %x io base %x sz %x\n config addr %x" - " config data %x\n", - sc->sc_membus_space.bus_base, - sc->sc_membus_space.bus_size, - sc->sc_iobus_space.bus_base, - sc->sc_iobus_space.bus_size, - addr_offset, data_offset); + printf(" mem base %x sz %x io base %x sz %x\n" + " config addr %x config data %x\n", + sc->sc_membus_space.bus_base, + sc->sc_membus_space.bus_size, + sc->sc_iobus_space.bus_base, + sc->sc_iobus_space.bus_size, + addr_offset, data_offset); #endif - - if ( bus_space_map(&(sc->sc_iobus_space), addr_offset, NBPG, 0, &lcp->ioh_cf8) != 0 ) - { panic("mpcpcibus: unable to map self"); - } + if ( bus_space_map(&(sc->sc_iobus_space), data_offset, NBPG, 0, &lcp->ioh_cfc) != 0 ) - { panic("mpcpcibus: unable to map self"); - } - of_node = ca->ca_node; + of_node = ca->ca_node; lcp->node = ca->ca_node; lcp->lc_pc.pc_conf_v = lcp; @@ -486,7 +466,7 @@ mpcpcibrattach(parent, self, aux) lcp->lc_pc.pc_intr_disestablish = mpc_intr_disestablish; printf(": %s, Revision 0x%x\n", compat, - mpc_cfg_read_1(lcp, MPC106_PCI_REVID)); + mpc_cfg_read_1(lcp, MPC106_PCI_REVID)); pci_addr_fixup(sc, &lcp->lc_pc, 32); } @@ -499,7 +479,6 @@ mpcpcibrattach(parent, self, aux) pba.pba_dmat = &pci_bus_dma_tag; - pba.pba_busname = "pci"; pba.pba_iot = &sc->sc_iobus_space; pba.pba_memt = &sc->sc_membus_space; @@ -510,19 +489,18 @@ mpcpcibrattach(parent, self, aux) if (of_node != 0) { int nn; - for (node = OF_child(of_node); node; node = nn) - { + for (node = OF_child(of_node); node; node = nn) { char name[32]; int len; len = OF_getprop(node, "name", name, - sizeof(name)); + sizeof(name)); name[len] = 0; fix_node_irq(node, &pba); /* iterate section */ - if ((nn = OF_child(node)) != 0) { + if ((nn = OF_child(node)) != 0) continue; - } + while ((nn = OF_peer(node)) == 0) { node = OF_parent(node); if (node == of_node) { @@ -567,22 +545,22 @@ find_node_intr(int parent, u_int32_t *addr, u_int32_t *intr) if ((len == -1) || (mlen == -1)) goto nomap; + n_mlen = mlen/sizeof(u_int32_t); - for (i = 0; i < n_mlen; i++) { + for (i = 0; i < n_mlen; i++) maskedaddr[i] = addr[i] & imask[i]; - } + mp = map; /* calculate step size of interrupt-map * -- assumes that iparent will be same for all nodes */ iparent = mp[n_mlen]; step = 0; - for (i = (n_mlen)+1; i < len; i++) { + for (i = (n_mlen)+1; i < len; i++) if (mp[i] == iparent) { step = i - (n_mlen); break; } - } if (step == 0) { /* unable to determine step size */ return -1; @@ -599,9 +577,8 @@ find_node_intr(int parent, u_int32_t *addr, u_int32_t *intr) iparent = *mp1; /* recurse with new 'addr' */ return find_node_intr(iparent, &mp1[1], intr); - } else { + } else *intr = mp1[1]; - } return 1; } len -= step * sizeof(u_int32_t); @@ -612,9 +589,7 @@ nomap: } void -fix_node_irq(node, pba) - int node; - struct pcibus_attach_args *pba; +fix_node_irq(int node, struct pcibus_attach_args *pba) { struct { u_int32_t phys_hi, phys_mid, phys_lo; @@ -629,9 +604,8 @@ fix_node_irq(node, pba) pci_chipset_tag_t pc = pba->pba_pc; len = OF_getprop(node, "assigned-addresses", addr, sizeof(addr)); - if (len < sizeof(addr[0])) { + if (len < sizeof(addr[0])) return; - } /* if this node has a AAPL,interrupts property, firmware * has initialized the register correctly. @@ -651,8 +625,7 @@ fix_node_irq(node, pba) */ tag = pci_make_tag(pc, pcibus(addr[0].phys_hi), - pcidev(addr[0].phys_hi), - pcifunc(addr[0].phys_hi)); + pcidev(addr[0].phys_hi), pcifunc(addr[0].phys_hi)); intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG); intr &= ~PCI_INTERRUPT_LINE_MASK; @@ -661,9 +634,7 @@ fix_node_irq(node, pba) } static int -mpcpcibrprint(aux, pnp) - void *aux; - const char *pnp; +mpcpcibrprint(void *aux, const char *pnp) { struct pcibus_attach_args *pba = aux; @@ -679,8 +650,7 @@ mpcpcibrprint(aux, pnp) */ paddr_t -vtophys(pa) - paddr_t pa; +vtophys(paddr_t pa) { vaddr_t va = (vaddr_t) pa; @@ -693,9 +663,8 @@ vtophys(pa) } void -mpc_attach_hook(parent, self, pba) - struct device *parent, *self; - struct pcibus_attach_args *pba; +mpc_attach_hook(struct device *parent, struct device *self, + struct pcibus_attach_args *pba) { } @@ -738,18 +707,14 @@ of_ether_hw_addr(struct ppc_pci_chipset *lcpc, u_int8_t *oaddr) } int -mpc_ether_hw_addr(p, s) - struct ppc_pci_chipset *p; - u_int8_t *s; +mpc_ether_hw_addr(struct ppc_pci_chipset *p, u_int8_t *s) { printf("mpc_ether_hw_addr not supported\n"); return(0); } int -mpc_bus_maxdevs(cpv, busno) - void *cpv; - int busno; +mpc_bus_maxdevs(void *cpv, int busno) { return(32); } @@ -759,18 +724,13 @@ mpc_bus_maxdevs(cpv, busno) #define FNC_SHIFT 8 pcitag_t -mpc_make_tag(cpv, bus, dev, fnc) - void *cpv; - int bus, dev, fnc; +mpc_make_tag(void *cpv, int bus, int dev, int fnc) { return (bus << BUS_SHIFT) | (dev << DEVICE_SHIFT) | (fnc << FNC_SHIFT); } void -mpc_decompose_tag(cpv, tag, busp, devp, fncp) - void *cpv; - pcitag_t tag; - int *busp, *devp, *fncp; +mpc_decompose_tag(void *cpv, pcitag_t tag, int *busp, int *devp, int *fncp) { if (busp != NULL) *busp = (tag >> BUS_SHIFT) & 0xff; @@ -781,28 +741,19 @@ mpc_decompose_tag(cpv, tag, busp, devp, fncp) } u_int32_t -mpc_gen_config_reg(cpv, tag, offset) - void *cpv; - pcitag_t tag; - int offset; +mpc_gen_config_reg(void *cpv, pcitag_t tag, int offset) { struct pcibr_config *cp = cpv; unsigned int bus, dev, fcn; u_int32_t reg; - /* - static int spin = 0; - while (spin > 85); - spin++; - */ mpc_decompose_tag(cpv, tag, &bus, &dev, &fcn); if (cp->config_type & 1) { /* Config Mechanism #2 */ if (bus == 0) { - if (dev < 11) { + if (dev < 11) return 0xffffffff; - } /* * Need to do config type 0 operation * 1 << (11?+dev) | fcn << 8 | reg @@ -812,9 +763,8 @@ mpc_gen_config_reg(cpv, tag, offset) reg = 1 << (dev) | fcn << 8 | offset; } else { - if (dev > 15) { - return 0xffffffff; - } + if (dev > 15) + return 0xffffffff; /* * config type 1 */ @@ -833,10 +783,7 @@ mpc_gen_config_reg(cpv, tag, offset) /* #define DEBUG_CONFIG */ pcireg_t -mpc_conf_read(cpv, tag, offset) - void *cpv; - pcitag_t tag; - int offset; +mpc_conf_read(void *cpv, pcitag_t tag, int offset) { struct pcibr_config *cp = cpv; pcireg_t data; @@ -846,8 +793,6 @@ mpc_conf_read(cpv, tag, offset) faultbuf env; void *oldh; - - if (offset & 3 || offset < 0 || offset >= 0x100) { #ifdef DEBUG_CONFIG printf ("pci_conf_read: bad reg %x\n", offset); @@ -857,13 +802,11 @@ mpc_conf_read(cpv, tag, offset) reg = mpc_gen_config_reg(cpv, tag, offset); /* if invalid tag, return -1 */ - if (reg == 0xffffffff) { + if (reg == 0xffffffff) return(~0); - } - if ((cp->config_type & 2) && (offset & 0x04)) { + if ((cp->config_type & 2) && (offset & 0x04)) daddr += 4; - } s = splhigh(); @@ -898,11 +841,7 @@ mpc_conf_read(cpv, tag, offset) } void -mpc_conf_write(cpv, tag, offset, data) - void *cpv; - pcitag_t tag; - int offset; - pcireg_t data; +mpc_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data) { struct pcibr_config *cp = cpv; u_int32_t reg; @@ -912,12 +851,12 @@ mpc_conf_write(cpv, tag, offset, data) reg = mpc_gen_config_reg(cpv, tag, offset); /* if invalid tag, return ??? */ - if (reg == 0xffffffff) { + if (reg == 0xffffffff) return; - } - if ((cp->config_type & 2) && (offset & 0x04)) { + + if ((cp->config_type & 2) && (offset & 0x04)) daddr += 4; - } + #ifdef DEBUG_CONFIG { unsigned int bus, dev, fcn; @@ -943,19 +882,14 @@ mpc_conf_write(cpv, tag, offset, data) /*ARGSUSED*/ int -mpc_intr_map(lcv, bustag, buspin, line, ihp) - void *lcv; - pcitag_t bustag; - int buspin, line; - pci_intr_handle_t *ihp; +mpc_intr_map(void *lcv, pcitag_t bustag, int buspin, int line, + pci_intr_handle_t *ihp) { int error = 0; *ihp = -1; - if (buspin == 0) { - /* No IRQ used. */ - error = 1; - } + if (buspin == 0) + error = 1; /* No IRQ used. */ else if (buspin > 4) { printf("mpc_intr_map: bad interrupt pin %d\n", buspin); error = 1; @@ -967,9 +901,7 @@ mpc_intr_map(lcv, bustag, buspin, line, ihp) } const char * -mpc_intr_string(lcv, ih) - void *lcv; - pci_intr_handle_t ih; +mpc_intr_string(void *lcv, pci_intr_handle_t ih) { static char str[16]; @@ -978,29 +910,21 @@ mpc_intr_string(lcv, ih) } int -mpc_intr_line(lcv, ih) - void *lcv; - pci_intr_handle_t ih; +mpc_intr_line(void *lcv, pci_intr_handle_t ih) { return (ih); } void * -mpc_intr_establish(lcv, ih, level, func, arg, name) - void *lcv; - pci_intr_handle_t ih; - int level; - int (*func)(void *); - void *arg; - char *name; +mpc_intr_establish(void *lcv, pci_intr_handle_t ih, int level, + int (*func)(void *), void *arg, char *name) { return (*intr_establish_func)(lcv, ih, IST_LEVEL, level, func, arg, name); } void -mpc_intr_disestablish(lcv, cookie) - void *lcv, *cookie; +mpc_intr_disestablish(void *lcv, void *cookie) { /* XXX We should probably do something clever here.... later */ } @@ -1018,24 +942,17 @@ pci_iack() } void -mpc_cfg_write_1(cp, reg, val) - struct pcibr_config *cp; - u_int32_t reg; - u_int8_t val; +mpc_cfg_write_1(struct pcibr_config *cp, u_int32_t reg, u_int8_t val) { int s; s = splhigh(); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, - MPC106_REGOFFS(reg)); + bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, MPC106_REGOFFS(reg)); bus_space_write_1(cp->lc_iot, cp->ioh_cfc, 0, val); splx(s); } void -mpc_cfg_write_2(cp, reg, val) - struct pcibr_config *cp; - u_int32_t reg; - u_int16_t val; +mpc_cfg_write_2(struct pcibr_config *cp, u_int32_t reg, u_int16_t val) { int s; s = splhigh(); @@ -1045,10 +962,7 @@ mpc_cfg_write_2(cp, reg, val) } void -mpc_cfg_write_4(cp, reg, val) - struct pcibr_config *cp; - u_int32_t reg; - u_int32_t val; +mpc_cfg_write_4(struct pcibr_config *cp, u_int32_t reg, u_int32_t val) { int s; @@ -1059,9 +973,7 @@ mpc_cfg_write_4(cp, reg, val) } u_int8_t -mpc_cfg_read_1(cp, reg) - struct pcibr_config *cp; - u_int32_t reg; +mpc_cfg_read_1(struct pcibr_config *cp, u_int32_t reg) { u_int8_t _v_; @@ -1074,9 +986,7 @@ mpc_cfg_read_1(cp, reg) } u_int16_t -mpc_cfg_read_2(cp, reg) - struct pcibr_config *cp; - u_int32_t reg; +mpc_cfg_read_2(struct pcibr_config *cp, u_int32_t reg) { u_int16_t _v_; @@ -1089,9 +999,7 @@ mpc_cfg_read_2(cp, reg) } u_int32_t -mpc_cfg_read_4(cp, reg) - struct pcibr_config *cp; - u_int32_t reg; +mpc_cfg_read_4(struct pcibr_config *cp, u_int32_t reg) { u_int32_t _v_; @@ -1104,8 +1012,7 @@ mpc_cfg_read_4(cp, reg) } int -pci_intr_line(ih) - pci_intr_handle_t ih; +pci_intr_line(pci_intr_handle_t ih) { return (ih); } diff --git a/sys/arch/macppc/pci/pchb.c b/sys/arch/macppc/pci/pchb.c index b758aada142..3f9430052a7 100644 --- a/sys/arch/macppc/pci/pchb.c +++ b/sys/arch/macppc/pci/pchb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pchb.c,v 1.5 2003/04/27 11:22:52 ho Exp $ */ +/* $OpenBSD: pchb.c,v 1.6 2003/10/15 23:00:57 drahn Exp $ */ /* $NetBSD: pchb.c,v 1.4 2000/01/25 07:19:11 tsubai Exp $ */ /*- @@ -60,10 +60,7 @@ struct cfdriver pchb_cd = { }; int -pchbmatch(parent, cf, aux) - struct device *parent; - void *cf; - void *aux; +pchbmatch(struct device *parent, void *cf, void *aux) { struct pci_attach_args *pa = aux; @@ -103,11 +100,8 @@ pchbmatch(parent, cf, aux) /*ARGSUSED*/ void -pchbattach(parent, self, aux) - struct device *parent, *self; - void *aux; +pchbattach(struct device *parent, struct device *self, void *aux) { - printf("\n"); /* diff --git a/sys/arch/macppc/pci/pci_addr_fixup.c b/sys/arch/macppc/pci/pci_addr_fixup.c index 799fef14140..35bd835a64b 100644 --- a/sys/arch/macppc/pci/pci_addr_fixup.c +++ b/sys/arch/macppc/pci/pci_addr_fixup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_addr_fixup.c,v 1.6 2002/10/17 02:47:05 drahn Exp $ */ +/* $OpenBSD: pci_addr_fixup.c,v 1.7 2003/10/15 23:00:57 drahn Exp $ */ /* $NetBSD: pci_addr_fixup.c,v 1.7 2000/08/03 20:10:45 nathanw Exp $ */ /*- @@ -46,26 +46,26 @@ typedef int (*pciaddr_resource_manage_func_t)(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t, int, struct extent *, int, bus_addr_t *, bus_size_t); -void pciaddr_resource_manage(struct pcibr_softc *, +void pciaddr_resource_manage(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t, pciaddr_resource_manage_func_t); -void pciaddr_resource_reserve(struct pcibr_softc *, +void pciaddr_resource_reserve(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t); -int pciaddr_do_resource_reserve(struct pcibr_softc *, +int pciaddr_do_resource_reserve(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t, int, struct extent *, int, bus_addr_t *, bus_size_t); -void pciaddr_resource_allocate(struct pcibr_softc *, +void pciaddr_resource_allocate(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t); -int pciaddr_do_resource_allocate(struct pcibr_softc *, +int pciaddr_do_resource_allocate(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t, int, struct extent *, int, bus_addr_t *, bus_size_t); bus_addr_t pciaddr_ioaddr(u_int32_t); -void pciaddr_print_devid(pci_chipset_tag_t, pcitag_t); +void pciaddr_print_devid(pci_chipset_tag_t, pcitag_t); -int pciaddr_device_is_agp(pci_chipset_tag_t, pcitag_t); +int pciaddr_device_is_agp(pci_chipset_tag_t, pcitag_t); void pci_device_foreach(struct pcibr_softc *sc, pci_chipset_tag_t pc, - int maxbus, - void (*func)(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t)); + int maxbus, + void (*func)(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t)); #define PCIADDR_MEM_START 0x0 #define PCIADDR_MEM_END 0xffffffff @@ -80,10 +80,7 @@ int pcibr_flags = 0; printf x void -pci_addr_fixup(sc, pc, maxbus) - struct pcibr_softc *sc; - pci_chipset_tag_t pc; - int maxbus; +pci_addr_fixup(struct pcibr_softc *sc, pci_chipset_tag_t pc, int maxbus) { const char *verbose_header = "[%s]-----------------------\n" @@ -139,10 +136,8 @@ pci_addr_fixup(sc, pc, maxbus) } void -pciaddr_resource_reserve(sc, pc, tag) - struct pcibr_softc *sc; - pci_chipset_tag_t pc; - pcitag_t tag; +pciaddr_resource_reserve(struct pcibr_softc *sc, pci_chipset_tag_t pc, + pcitag_t tag) { if (pcibr_flags & PCIBR_VERBOSE) pciaddr_print_devid(pc, tag); @@ -150,10 +145,8 @@ pciaddr_resource_reserve(sc, pc, tag) } void -pciaddr_resource_allocate(sc, pc, tag) - struct pcibr_softc *sc; - pci_chipset_tag_t pc; - pcitag_t tag; +pciaddr_resource_allocate(struct pcibr_softc *sc, pci_chipset_tag_t pc, + pcitag_t tag) { if (pcibr_flags & PCIBR_VERBOSE) pciaddr_print_devid(pc, tag); @@ -161,11 +154,8 @@ pciaddr_resource_allocate(sc, pc, tag) } void -pciaddr_resource_manage(sc, pc, tag, func) - struct pcibr_softc *sc; - pci_chipset_tag_t pc; - pcitag_t tag; - pciaddr_resource_manage_func_t func; +pciaddr_resource_manage(struct pcibr_softc *sc, pci_chipset_tag_t pc, + pcitag_t tag, pciaddr_resource_manage_func_t func) { struct extent *ex; pcireg_t val, mask; @@ -256,14 +246,9 @@ pciaddr_resource_manage(sc, pc, tag, func) } int -pciaddr_do_resource_allocate(sc, pc, tag, mapreg, ex, type, addr, size) - struct pcibr_softc *sc; - pci_chipset_tag_t pc; - pcitag_t tag; - struct extent *ex; - int mapreg, type; - bus_addr_t *addr; - bus_size_t size; +pciaddr_do_resource_allocate(struct pcibr_softc *sc, pci_chipset_tag_t pc, + pcitag_t tag, int mapreg, struct extent *ex, int type, bus_addr_t *addr, + bus_size_t size) { bus_addr_t start; int error; @@ -291,8 +276,7 @@ pciaddr_do_resource_allocate(sc, pc, tag, mapreg, ex, type, addr, size) /* write new address to PCI device configuration header */ pci_conf_write(pc, tag, mapreg, *addr); /* check */ - if (pcibr_flags & PCIBR_VERBOSE) - { + if (pcibr_flags & PCIBR_VERBOSE) { printf("pci_addr_fixup: "); pciaddr_print_devid(pc, tag); } @@ -309,14 +293,9 @@ pciaddr_do_resource_allocate(sc, pc, tag, mapreg, ex, type, addr, size) } int -pciaddr_do_resource_reserve(sc, pc, tag, mapreg, ex, type, addr, size) - struct pcibr_softc *sc; - pci_chipset_tag_t pc; - pcitag_t tag; - struct extent *ex; - int type, mapreg; - bus_addr_t *addr; - bus_size_t size; +pciaddr_do_resource_reserve(struct pcibr_softc *sc, pci_chipset_tag_t pc, + pcitag_t tag, int mapreg, struct extent *ex, int type, bus_addr_t *addr, + bus_size_t size) { int error; @@ -334,8 +313,7 @@ pciaddr_do_resource_reserve(sc, pc, tag, mapreg, ex, type, addr, size) } bus_addr_t -pciaddr_ioaddr(val) - u_int32_t val; +pciaddr_ioaddr(u_int32_t val) { return ((PCI_MAPREG_TYPE(val) == PCI_MAPREG_TYPE_MEM) ? PCI_MAPREG_MEM_ADDR(val) @@ -343,9 +321,7 @@ pciaddr_ioaddr(val) } void -pciaddr_print_devid(pc, tag) - pci_chipset_tag_t pc; - pcitag_t tag; +pciaddr_print_devid(pci_chipset_tag_t pc, pcitag_t tag) { int bus, device, function; pcireg_t id; @@ -357,9 +333,7 @@ pciaddr_print_devid(pc, tag) } int -pciaddr_device_is_agp(pc, tag) - pci_chipset_tag_t pc; - pcitag_t tag; +pciaddr_device_is_agp(pci_chipset_tag_t pc, pcitag_t tag) { pcireg_t class, status, rval; int off; @@ -384,11 +358,8 @@ pciaddr_device_is_agp(pc, tag) struct extent * -pciaddr_search(mem_port, parent, startp, size) - int mem_port; - struct device *parent; - bus_addr_t *startp; - bus_size_t size; +pciaddr_search(int mem_port, struct device *parent, bus_addr_t *startp, + bus_size_t size) { struct pcibr_softc *sc; @@ -436,11 +407,8 @@ pciaddr_search(mem_port, parent, startp, size) void -pci_device_foreach(sc, pc, maxbus, func) - struct pcibr_softc *sc; - pci_chipset_tag_t pc; - int maxbus; - void (*func)(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t); +pci_device_foreach(struct pcibr_softc *sc, pci_chipset_tag_t pc, int maxbus, + void (*func)(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t)) { const struct pci_quirkdata *qd; int bus, device, function, maxdevs, nfuncs; diff --git a/sys/arch/macppc/pci/pciide_machdep.c b/sys/arch/macppc/pci/pciide_machdep.c index c1757dad19e..ae5a510d9c5 100644 --- a/sys/arch/macppc/pci/pciide_machdep.c +++ b/sys/arch/macppc/pci/pciide_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciide_machdep.c,v 1.2 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: pciide_machdep.c,v 1.3 2003/10/15 23:00:57 drahn Exp $ */ /* $NetBSD: pciide_machdep.c,v 1.2 1999/02/19 18:01:27 mycroft Exp $ */ /* @@ -53,12 +53,8 @@ #include <machine/autoconf.h> void * -pciide_machdep_compat_intr_establish(dev, pa, chan, func, arg) - struct device *dev; - struct pci_attach_args *pa; - int chan; - int (*func)(void *); - void *arg; +pciide_machdep_compat_intr_establish(struct device *dev, + struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { int irq; void *cookie; diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c index 3f0b981784b..ce1a057a557 100644 --- a/sys/arch/macppc/pci/vgafb.c +++ b/sys/arch/macppc/pci/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.20 2002/11/09 22:51:46 miod Exp $ */ +/* $OpenBSD: vgafb.c,v 1.21 2003/10/15 23:00:57 drahn Exp $ */ /* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ /* @@ -105,10 +105,9 @@ int vgafb_putcmap(struct vgafb_config *vc, struct wsdisplay_cmap *cm); * and attachment. */ int -vgafb_common_probe(iot, memt, iobase, iosize, membase, memsize, mmiobase, mmiosize) - bus_space_tag_t iot, memt; - u_int32_t iobase, membase, mmiobase; - size_t iosize, memsize, mmiosize; +vgafb_common_probe(bus_space_tag_t iot, bus_space_tag_t memt, u_int32_t iobase, + size_t iosize, u_int32_t membase, size_t memsize, u_int32_t mmiobase, + size_t mmiosize) { bus_space_handle_t ioh_b, ioh_c, ioh_d, memh, mmioh; int gotio_b, gotio_c, gotio_d, gotmem, gotmmio, rv; @@ -150,11 +149,9 @@ bad: } void -vgafb_common_setup(iot, memt, vc, iobase, iosize, membase, memsize, mmiobase, mmiosize) - bus_space_tag_t iot, memt; - struct vgafb_config *vc; - u_int32_t iobase, membase, mmiobase; - size_t iosize, memsize, mmiosize; +vgafb_common_setup(bus_space_tag_t iot, bus_space_tag_t memt, + struct vgafb_config *vc, u_int32_t iobase, size_t iosize, + u_int32_t membase, size_t memsize, u_int32_t mmiobase, size_t mmiosize) { vc->vc_iot = iot; vc->vc_memt = memt; @@ -168,10 +165,10 @@ vgafb_common_setup(iot, memt, vc, iobase, iosize, membase, memsize, mmiobase, mm if (bus_space_map(vc->vc_iot, iobase+0x3d0, 0x10, 0, &vc->vc_ioh_d)) panic("vgafb_common_setup: couldn't map io d"); } - if (mmiosize != 0) { - if (bus_space_map(vc->vc_memt, mmiobase, mmiosize, 0, &vc->vc_mmioh)) - panic("vgafb_common_setup: couldn't map mmio"); - } + if (mmiosize != 0) + if (bus_space_map(vc->vc_memt, mmiobase, mmiosize, 0, + &vc->vc_mmioh)) + panic("vgafb_common_setup: couldn't map mmio"); /* memsize should only be visible region for console */ memsize = cons_height * cons_linebytes; @@ -210,10 +207,8 @@ vgafb_restore_default_colors(struct vgafb_config *vc) } void -vgafb_wsdisplay_attach(parent, vc, console) - struct device *parent; - struct vgafb_config *vc; - int console; +vgafb_wsdisplay_attach(struct device *parent, struct vgafb_config *vc, + int console) { struct wsemuldisplaydev_attach_args aa; @@ -234,12 +229,7 @@ vgafb_wsdisplay_attach(parent, vc, console) } int -vgafb_ioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +vgafb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) { struct vgafb_config *vc = v; struct wsdisplay_fbinfo *wdf; @@ -274,9 +264,8 @@ vgafb_ioctl(v, cmd, data, flag, p) * the correct palette. */ - if (cons_depth == 8) { + if (cons_depth == 8) vgafb_restore_default_colors(vc); - } /* now that we have done our work, let the wscons * layer handle this ioctl @@ -341,10 +330,7 @@ vgafb_ioctl(v, cmd, data, flag, p) } paddr_t -vgafb_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +vgafb_mmap(void *v, off_t offset, int prot) { struct vgafb_config *vc = v; bus_space_handle_t h; @@ -396,8 +382,7 @@ vgafb_mmap(v, offset, prot) void -vgafb_cnprobe(cp) - struct consdev *cp; +vgafb_cnprobe(struct consdev *cp) { if (cons_displaytype != 1) { cp->cn_pri = CN_DEAD; @@ -408,10 +393,8 @@ vgafb_cnprobe(cp) } void -vgafb_cnattach(iot, memt, pc, bus, device, function) - void *pc; - bus_space_tag_t iot, memt; - int bus, device, function; +vgafb_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, void *pc, int bus, + int device, int function) { long defattr; @@ -443,10 +426,8 @@ struct { } vgafb_color[256]; void -vgafb_setcolor(vc, index, r, g, b) - struct vgafb_config *vc; - unsigned int index; - u_int8_t r, g, b; +vgafb_setcolor(struct vgafb_config *vc, unsigned int index, u_int8_t r, + u_int8_t g, u_int8_t b) { vc->vc_cmap_red[index] = r; vc->vc_cmap_green[index] = g; @@ -460,9 +441,7 @@ vgafb_setcolor(vc, index, r, g, b) } int -vgafb_getcmap(vc, cm) - struct vgafb_config *vc; - struct wsdisplay_cmap *cm; +vgafb_getcmap(struct vgafb_config *vc, struct wsdisplay_cmap *cm) { u_int index = cm->index; u_int count = cm->count; @@ -485,9 +464,7 @@ vgafb_getcmap(vc, cm) } int -vgafb_putcmap(vc, cm) - struct vgafb_config *vc; - struct wsdisplay_cmap *cm; +vgafb_putcmap(struct vgafb_config *vc, struct wsdisplay_cmap *cm) { u_int index = cm->index; u_int count = cm->count; @@ -521,9 +498,7 @@ vgafb_putcmap(vc, cm) } void -vgafb_burn(v, on, flags) - void *v; - u_int on, flags; +vgafb_burn(void *v, u_int on, u_int flags) { struct vgafb_config *vc = v; diff --git a/sys/arch/macppc/pci/vgafb_pci.c b/sys/arch/macppc/pci/vgafb_pci.c index cd8a4be1576..39691d458f0 100644 --- a/sys/arch/macppc/pci/vgafb_pci.c +++ b/sys/arch/macppc/pci/vgafb_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb_pci.c,v 1.12 2003/06/16 21:59:15 drahn Exp $ */ +/* $OpenBSD: vgafb_pci.c,v 1.13 2003/10/15 23:00:57 drahn Exp $ */ /* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */ /* @@ -89,12 +89,9 @@ struct vgafb_config vgafb_pci_console_vc; #endif int -vgafb_pci_probe(pa, id, ioaddr, iosize, memaddr, memsize, cacheable, mmioaddr, mmiosize) - struct pci_attach_args *pa; - int id; - u_int32_t *ioaddr, *iosize; - u_int32_t *memaddr, *memsize, *cacheable; - u_int32_t *mmioaddr, *mmiosize; +vgafb_pci_probe(struct pci_attach_args *pa, int id, u_int32_t *ioaddr, + u_int32_t *iosize, u_int32_t *memaddr, u_int32_t *memsize, + u_int32_t *cacheable, u_int32_t *mmioaddr, u_int32_t *mmiosize) { u_long addr; u_int32_t size, tcacheable; @@ -319,9 +316,7 @@ vgafb_pci_match(parent, match, aux) } void -vgafb_pci_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +vgafb_pci_attach(struct device *parent, struct device *self, void *aux) { struct pci_attach_args *pa = aux; struct vgafb_pci_softc *sc = (struct vgafb_pci_softc *)self; @@ -359,12 +354,12 @@ vgafb_pci_attach(parent, self, aux) sc->sc_pcitag = pa->pa_tag; - if (iosize == 0) { + if (iosize == 0) printf (", no io"); - } - if (mmiosize != 0) { + + if (mmiosize != 0) printf (", mmio"); - } + printf("\n"); vgafb_wsdisplay_attach(self, vc, console); @@ -372,13 +367,9 @@ vgafb_pci_attach(parent, self, aux) } void -vgafb_pci_console(iot, ioaddr, iosize, memt, memaddr, memsize, - pc, bus, device, function) - bus_space_tag_t iot, memt; - u_int32_t memaddr, memsize; - u_int32_t ioaddr, iosize; - pci_chipset_tag_t pc; - int bus, device, function; +vgafb_pci_console(bus_space_tag_t iot, u_int32_t ioaddr, u_int32_t iosize, + bus_space_tag_t memt, u_int32_t memaddr, u_int32_t memsize, + pci_chipset_tag_t pc, int bus, int device, int function) { struct vgafb_config *vc = &vgafb_pci_console_vc; u_int32_t mmioaddr; @@ -414,12 +405,7 @@ vgafb_pci_console(iot, ioaddr, iosize, memt, memaddr, memsize, } int -vgafbpciioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +vgafbpciioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) { struct vgafb_pci_softc *sc = v; @@ -427,10 +413,7 @@ vgafbpciioctl(v, cmd, data, flag, p) } paddr_t -vgafbpcimmap(v, offset, prot) - void *v; - off_t offset; - int prot; +vgafbpcimmap(void *v, off_t offset, int prot) { struct vgafb_pci_softc *sc = v; @@ -438,12 +421,8 @@ vgafbpcimmap(v, offset, prot) } int -vgafb_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; +vgafb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, + int *curxp, int *curyp, long *attrp) { struct vgafb_pci_softc *sc = v; long defattr; @@ -462,9 +441,7 @@ vgafb_alloc_screen(v, type, cookiep, curxp, curyp, attrp) } void -vgafb_free_screen(v, cookie) - void *v; - void *cookie; +vgafb_free_screen(void *v, void *cookie) { struct vgafb_pci_softc *sc = v; @@ -475,12 +452,8 @@ vgafb_free_screen(v, cookie) } int -vgafb_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; +vgafb_show_screen(void *v, void *cookie, int waitok, + void (*cb)(void *, int, int), void *cbarg) { return (0); |