Changeset View
Changeset View
Standalone View
Standalone View
head/sys/powerpc/powernv/opal_pci.c
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | static int opalpci_map_msi(device_t dev, device_t child, | ||||
int irq, uint64_t *addr, uint32_t *data); | int irq, uint64_t *addr, uint32_t *data); | ||||
static int opalpci_route_interrupt(device_t bus, device_t dev, int pin); | static int opalpci_route_interrupt(device_t bus, device_t dev, int pin); | ||||
/* | /* | ||||
* MSI PIC interface. | * MSI PIC interface. | ||||
*/ | */ | ||||
static void opalpic_pic_enable(device_t dev, u_int irq, u_int vector); | static void opalpic_pic_enable(device_t dev, u_int irq, u_int vector); | ||||
static void opalpic_pic_eoi(device_t dev, u_int irq); | static void opalpic_pic_eoi(device_t dev, u_int irq); | ||||
static void opalpic_pic_mask(device_t dev, u_int irq); | |||||
static void opalpic_pic_unmask(device_t dev, u_int irq); | |||||
/* | /* | ||||
* Commands | * Commands | ||||
*/ | */ | ||||
#define OPAL_M32_WINDOW_TYPE 1 | #define OPAL_M32_WINDOW_TYPE 1 | ||||
#define OPAL_M64_WINDOW_TYPE 2 | #define OPAL_M64_WINDOW_TYPE 2 | ||||
#define OPAL_IO_WINDOW_TYPE 3 | #define OPAL_IO_WINDOW_TYPE 3 | ||||
Show All 30 Lines | static device_method_t opalpci_methods[] = { | ||||
DEVMETHOD(pcib_alloc_msix, opalpci_alloc_msix), | DEVMETHOD(pcib_alloc_msix, opalpci_alloc_msix), | ||||
DEVMETHOD(pcib_release_msix, opalpci_release_msix), | DEVMETHOD(pcib_release_msix, opalpci_release_msix), | ||||
DEVMETHOD(pcib_map_msi, opalpci_map_msi), | DEVMETHOD(pcib_map_msi, opalpci_map_msi), | ||||
DEVMETHOD(pcib_route_interrupt, opalpci_route_interrupt), | DEVMETHOD(pcib_route_interrupt, opalpci_route_interrupt), | ||||
/* PIC interface for MSIs */ | /* PIC interface for MSIs */ | ||||
DEVMETHOD(pic_enable, opalpic_pic_enable), | DEVMETHOD(pic_enable, opalpic_pic_enable), | ||||
DEVMETHOD(pic_eoi, opalpic_pic_eoi), | DEVMETHOD(pic_eoi, opalpic_pic_eoi), | ||||
DEVMETHOD(pic_mask, opalpic_pic_mask), | |||||
DEVMETHOD(pic_unmask, opalpic_pic_unmask), | |||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
struct opalpci_softc { | struct opalpci_softc { | ||||
struct ofw_pci_softc ofw_sc; | struct ofw_pci_softc ofw_sc; | ||||
uint64_t phb_id; | uint64_t phb_id; | ||||
vmem_t *msi_vmem; | vmem_t *msi_vmem; | ||||
▲ Show 20 Lines • Show All 489 Lines • ▼ Show 20 Lines | if (bootverbose && err != 0) | ||||
device_printf(child, "OPAL MSI mapping error: %d\n", err); | device_printf(child, "OPAL MSI mapping error: %d\n", err); | ||||
return ((err == 0) ? 0 : ENXIO); | return ((err == 0) ? 0 : ENXIO); | ||||
} | } | ||||
static void | static void | ||||
opalpic_pic_enable(device_t dev, u_int irq, u_int vector) | opalpic_pic_enable(device_t dev, u_int irq, u_int vector) | ||||
{ | { | ||||
struct opalpci_softc *sc = device_get_softc(dev); | |||||
PIC_ENABLE(root_pic, irq, vector); | PIC_ENABLE(root_pic, irq, vector); | ||||
opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq); | |||||
} | } | ||||
static void opalpic_pic_eoi(device_t dev, u_int irq) | static void opalpic_pic_eoi(device_t dev, u_int irq) | ||||
{ | { | ||||
struct opalpci_softc *sc; | struct opalpci_softc *sc; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq); | opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq); | ||||
PIC_EOI(root_pic, irq); | PIC_EOI(root_pic, irq); | ||||
} | } | ||||
static void opalpic_pic_mask(device_t dev, u_int irq) | |||||
{ | |||||
PIC_MASK(root_pic, irq); | |||||
} | |||||
static void opalpic_pic_unmask(device_t dev, u_int irq) | |||||
{ | |||||
struct opalpci_softc *sc; | |||||
sc = device_get_softc(dev); | |||||
PIC_UNMASK(root_pic, irq); | |||||
opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq); | |||||
} | |||||