Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/powernv/opal_pci.c
Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | struct opalpci_softc { | ||||
int msi_base; /* Base XIVE number */ | int msi_base; /* Base XIVE number */ | ||||
int base_msi_irq; /* Base IRQ assigned by FreeBSD to this PIC */ | int base_msi_irq; /* Base IRQ assigned by FreeBSD to this PIC */ | ||||
uint64_t *tce; /* TCE table for 1:1 mapping */ | uint64_t *tce; /* TCE table for 1:1 mapping */ | ||||
struct resource *r_reg; | struct resource *r_reg; | ||||
}; | }; | ||||
static devclass_t opalpci_devclass; | static devclass_t opalpci_devclass; | ||||
DEFINE_CLASS_1(pcib, opalpci_driver, opalpci_methods, | DEFINE_CLASS_1(pcib, opalpci_driver, opalpci_methods, | ||||
sizeof(struct opalpci_softc), ofw_pci_driver); | sizeof(struct opalpci_softc), ofw_pcib_driver); | ||||
EARLY_DRIVER_MODULE(opalpci, ofwbus, opalpci_driver, opalpci_devclass, 0, 0, | EARLY_DRIVER_MODULE(opalpci, ofwbus, opalpci_driver, opalpci_devclass, 0, 0, | ||||
BUS_PASS_BUS); | BUS_PASS_BUS); | ||||
static int | static int | ||||
opalpci_probe(device_t dev) | opalpci_probe(device_t dev) | ||||
{ | { | ||||
const char *type; | const char *type; | ||||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | if (err != 0) { | ||||
device_printf(dev, "Failed to create DMA tag\n"); | device_printf(dev, "Failed to create DMA tag\n"); | ||||
return (err); | return (err); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* General OFW PCI attach | * General OFW PCI attach | ||||
*/ | */ | ||||
err = ofw_pci_init(dev); | err = ofw_pcib_init(dev); | ||||
if (err != 0) | if (err != 0) | ||||
return (err); | return (err); | ||||
/* | /* | ||||
* Unfreeze non-config-space PCI operations. Let this fail silently | * Unfreeze non-config-space PCI operations. Let this fail silently | ||||
* if e.g. there is no current freeze. | * if e.g. there is no current freeze. | ||||
*/ | */ | ||||
opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id, OPAL_PCI_DEFAULT_PE, | opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id, OPAL_PCI_DEFAULT_PE, | ||||
Show All 15 Lines | rp->pci_hi = OFW_PCI_PHYS_HI_SPACE_MEM64 | | ||||
OFW_PCI_PHYS_HI_PREFETCHABLE; | OFW_PCI_PHYS_HI_PREFETCHABLE; | ||||
rp->pci = ((uint64_t)m64window[0] << 32) | m64window[1]; | rp->pci = ((uint64_t)m64window[0] << 32) | m64window[1]; | ||||
rp->host = ((uint64_t)m64window[2] << 32) | m64window[3]; | rp->host = ((uint64_t)m64window[2] << 32) | m64window[3]; | ||||
rp->size = ((uint64_t)m64window[4] << 32) | m64window[5]; | rp->size = ((uint64_t)m64window[4] << 32) | m64window[5]; | ||||
rman_manage_region(&sc->ofw_sc.sc_mem_rman, rp->pci, | rman_manage_region(&sc->ofw_sc.sc_mem_rman, rp->pci, | ||||
rp->pci + rp->size - 1); | rp->pci + rp->size - 1); | ||||
} | } | ||||
return (ofw_pci_attach(dev)); | return (ofw_pcib_attach(dev)); | ||||
} | } | ||||
static uint32_t | static uint32_t | ||||
opalpci_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, | opalpci_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, | ||||
int width) | int width) | ||||
{ | { | ||||
struct opalpci_softc *sc; | struct opalpci_softc *sc; | ||||
uint64_t config_addr; | uint64_t config_addr; | ||||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |