diff options
author | marius <marius@FreeBSD.org> | 2005-12-03 19:52:20 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2005-12-03 19:52:20 +0000 |
commit | fefcedf8f8dba3274436a6a1367c7fd647135e9c (patch) | |
tree | c57d0002bd216fd03f38c90bb59a4bcf7c3401d3 /sys/sparc64/pci | |
parent | 8f06802ece34e3960249dabfb97fd8bfdd2f6712 (diff) | |
download | FreeBSD-src-fefcedf8f8dba3274436a6a1367c7fd647135e9c.zip FreeBSD-src-fefcedf8f8dba3274436a6a1367c7fd647135e9c.tar.gz |
- Move the declaration of struct upa_ranges and the UPA_RANGE_* macros
from sys/sparc64/include/ofw_upa.h to sys/sparc64/pci/ofw_pci.h and
rename them to struct ofw_pci_ranges and OFW_PCI_RANGE_* respectively.
This ranges struct only applies to host-PCI bridges but no to other
bridges found on UPA. At the same time it applies to all host-PCI
bridges regardless of whether the interconnection bus is Fireplane/
Safari, JBus or UPA.
- While here rename the PCI_CS_* macros in sys/sparc64/pci/ofw_pci.h
to OFW_PCI_CS_* in order to be consistent and change this header to
use uintXX_t instead of u_intXX_t.
Diffstat (limited to 'sys/sparc64/pci')
-rw-r--r-- | sys/sparc64/pci/ofw_pci.h | 30 | ||||
-rw-r--r-- | sys/sparc64/pci/psycho.c | 20 |
2 files changed, 34 insertions, 16 deletions
diff --git a/sys/sparc64/pci/ofw_pci.h b/sys/sparc64/pci/ofw_pci.h index f87f65a..6d102b0 100644 --- a/sys/sparc64/pci/ofw_pci.h +++ b/sys/sparc64/pci/ofw_pci.h @@ -36,16 +36,34 @@ #include <machine/ofw_bus.h> -typedef u_int32_t ofw_pci_intr_t; +typedef uint32_t ofw_pci_intr_t; #include "ofw_pci_if.h" /* PCI range child spaces. XXX: are these MI? */ -#define PCI_CS_CONFIG 0x00 -#define PCI_CS_IO 0x01 -#define PCI_CS_MEM32 0x02 -#define PCI_CS_MEM64 0x03 +#define OFW_PCI_CS_CONFIG 0x00 +#define OFW_PCI_CS_IO 0x01 +#define OFW_PCI_CS_MEM32 0x02 +#define OFW_PCI_CS_MEM64 0x03 -u_int8_t ofw_pci_alloc_busno(phandle_t); +struct ofw_pci_ranges { + uint32_t cspace; + uint32_t child_hi; + uint32_t child_lo; + uint32_t phys_hi; + uint32_t phys_lo; + uint32_t size_hi; + uint32_t size_lo; +}; + +#define OFW_PCI_RANGE_CHILD(r) \ + (((uint64_t)(r)->child_hi << 32) | (uint64_t)(r)->child_lo) +#define OFW_PCI_RANGE_PHYS(r) \ + (((uint64_t)(r)->phys_hi << 32) | (uint64_t)(r)->phys_lo) +#define OFW_PCI_RANGE_SIZE(r) \ + (((uint64_t)(r)->size_hi << 32) | (uint64_t)(r)->size_lo) +#define OFW_PCI_RANGE_CS(r) (((r)->cspace >> 24) & 0x03) + +uint8_t ofw_pci_alloc_busno(phandle_t); #endif /* ! _SPARC64_PCI_OFW_PCI_H_ */ diff --git a/sys/sparc64/pci/psycho.c b/sys/sparc64/pci/psycho.c index 387a4c3..322a058 100644 --- a/sys/sparc64/pci/psycho.c +++ b/sys/sparc64/pci/psycho.c @@ -287,7 +287,7 @@ psycho_attach(device_t dev) struct psycho_softc *sc; struct psycho_softc *osc = NULL; struct psycho_softc *asc; - struct upa_ranges *range; + struct ofw_pci_ranges *range; struct upa_regs *reg; const struct psycho_desc *desc; phandle_t node; @@ -417,7 +417,7 @@ psycho_attach(device_t dev) nrange = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range); /* - * Make sure that the expected ranges are present. The PCI_CS_MEM64 + * Make sure that the expected ranges are present. The OFW_PCI_CS_MEM64 * one is not currently used though. */ if (nrange != PSYCHO_NRANGE) @@ -429,10 +429,10 @@ psycho_attach(device_t dev) * memory and I/O handles. */ for (n = 0; n < PSYCHO_NRANGE; n++) { - i = UPA_RANGE_CS(&range[n]); + i = OFW_PCI_RANGE_CS(&range[n]); if (sc->sc_pci_bh[i] != 0) panic("%s: duplicate range for space %d", __func__, i); - sc->sc_pci_bh[i] = UPA_RANGE_PHYS(&range[n]); + sc->sc_pci_bh[i] = OFW_PCI_RANGE_PHYS(&range[n]); } free(range, M_OFWPROP); @@ -806,7 +806,7 @@ psycho_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, sc = device_get_softc(dev); offset = PSYCHO_CONF_OFF(bus, slot, func, reg); - bh = sc->sc_pci_bh[PCI_CS_CONFIG]; + bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; switch (width) { case 1: i = bus_space_peek_1(sc->sc_pci_cfgt, bh, offset, &byte); @@ -844,7 +844,7 @@ psycho_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, sc = device_get_softc(dev); offset = PSYCHO_CONF_OFF(bus, slot, func, reg); - bh = sc->sc_pci_bh[PCI_CS_CONFIG]; + bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; switch (width) { case 1: bus_space_write_1(sc->sc_pci_cfgt, bh, offset, val); @@ -1040,12 +1040,12 @@ psycho_alloc_resource(device_t bus, device_t child, int type, int *rid, case SYS_RES_MEMORY: rm = &sc->sc_pci_mem_rman; bt = sc->sc_pci_memt; - bh = sc->sc_pci_bh[PCI_CS_MEM32]; + bh = sc->sc_pci_bh[OFW_PCI_CS_MEM32]; break; case SYS_RES_IOPORT: rm = &sc->sc_pci_io_rman; bt = sc->sc_pci_iot; - bh = sc->sc_pci_bh[PCI_CS_IO]; + bh = sc->sc_pci_bh[OFW_PCI_CS_IO]; break; default: return (NULL); @@ -1150,10 +1150,10 @@ psycho_get_bus_handle(device_t dev, int type, bus_space_handle_t childhdl, switch (type) { case SYS_RES_IOPORT: *tag = sc->sc_pci_iot; - return (sc->sc_pci_bh[PCI_CS_IO] + childhdl); + return (sc->sc_pci_bh[OFW_PCI_CS_IO] + childhdl); case SYS_RES_MEMORY: *tag = sc->sc_pci_memt; - return (sc->sc_pci_bh[PCI_CS_MEM32] + childhdl); + return (sc->sc_pci_bh[OFW_PCI_CS_MEM32] + childhdl); default: panic("%s: illegal space (%d)\n", __func__, type); } |