Give Host-PCI bridge drivers their own pcib_alloc_msi() and
pcib_alloc_msix() methods instead of using the method from the generic PCI-PCI bridge driver as the PCI-PCI methods will be gaining some PCI-PCI specific logic soon.
This commit is contained in:
parent
fde45e231a
commit
8964299ac8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=165128
@ -72,6 +72,27 @@ mptable_hostb_attach(device_t dev)
|
||||
return (bus_generic_attach(dev));
|
||||
}
|
||||
|
||||
/* Pass MSI alloc requests up to the nexus. */
|
||||
static int
|
||||
mptable_hostb_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
|
||||
int *irqs)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
|
||||
irqs));
|
||||
}
|
||||
|
||||
static int
|
||||
mptable_hostb_alloc_msix(device_t pcib, device_t dev, int index, int *irq)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, index, irq));
|
||||
}
|
||||
|
||||
static device_method_t mptable_hostb_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, mptable_hostb_probe),
|
||||
@ -96,9 +117,9 @@ static device_method_t mptable_hostb_methods[] = {
|
||||
DEVMETHOD(pcib_read_config, legacy_pcib_read_config),
|
||||
DEVMETHOD(pcib_write_config, legacy_pcib_write_config),
|
||||
DEVMETHOD(pcib_route_interrupt, mptable_pci_route_interrupt),
|
||||
DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_alloc_msi, mptable_hostb_alloc_msi),
|
||||
DEVMETHOD(pcib_release_msi, pcib_release_msi),
|
||||
DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_alloc_msix, mptable_hostb_alloc_msix),
|
||||
DEVMETHOD(pcib_release_msix, pcib_release_msix),
|
||||
|
||||
{ 0, 0 }
|
||||
@ -165,4 +186,3 @@ static devclass_t pcib_devclass;
|
||||
DEFINE_CLASS_0(pcib, mptable_pcib_driver, mptable_pcib_pci_methods,
|
||||
sizeof(struct pcib_softc));
|
||||
DRIVER_MODULE(mptable_pcib, pci, mptable_pcib_driver, pcib_devclass, 0, 0);
|
||||
|
||||
|
@ -81,6 +81,28 @@ legacy_pcib_route_interrupt(device_t pcib, device_t dev, int pin)
|
||||
return (PCI_INVALID_IRQ);
|
||||
}
|
||||
|
||||
/* Pass MSI alloc requests up to the nexus. */
|
||||
|
||||
static int
|
||||
legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
|
||||
int *irqs)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
|
||||
irqs));
|
||||
}
|
||||
|
||||
static int
|
||||
legacy_pcib_alloc_msix(device_t pcib, device_t dev, int index, int *irq)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, index, irq));
|
||||
}
|
||||
|
||||
static const char *
|
||||
legacy_pcib_is_host_bridge(int bus, int slot, int func,
|
||||
uint32_t id, uint8_t class, uint8_t subclass,
|
||||
@ -322,9 +344,9 @@ static device_method_t legacy_pcib_methods[] = {
|
||||
DEVMETHOD(pcib_read_config, legacy_pcib_read_config),
|
||||
DEVMETHOD(pcib_write_config, legacy_pcib_write_config),
|
||||
DEVMETHOD(pcib_route_interrupt, legacy_pcib_route_interrupt),
|
||||
DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_alloc_msi, legacy_pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_release_msi, pcib_release_msi),
|
||||
DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_alloc_msix, legacy_pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_release_msix, pcib_release_msix),
|
||||
|
||||
{ 0, 0 }
|
||||
|
@ -74,6 +74,10 @@ static void acpi_pcib_write_config(device_t dev, int bus, int slot,
|
||||
int func, int reg, uint32_t data, int bytes);
|
||||
static int acpi_pcib_acpi_route_interrupt(device_t pcib,
|
||||
device_t dev, int pin);
|
||||
static int acpi_pcib_alloc_msi(device_t pcib, device_t dev,
|
||||
int count, int maxcount, int *irqs);
|
||||
static int acpi_pcib_alloc_msix(device_t pcib, device_t dev,
|
||||
int index, int *irq);
|
||||
static struct resource *acpi_pcib_acpi_alloc_resource(device_t dev,
|
||||
device_t child, int type, int *rid,
|
||||
u_long start, u_long end, u_long count,
|
||||
@ -103,9 +107,9 @@ static device_method_t acpi_pcib_acpi_methods[] = {
|
||||
DEVMETHOD(pcib_read_config, acpi_pcib_read_config),
|
||||
DEVMETHOD(pcib_write_config, acpi_pcib_write_config),
|
||||
DEVMETHOD(pcib_route_interrupt, acpi_pcib_acpi_route_interrupt),
|
||||
DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_alloc_msi, acpi_pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_release_msi, pcib_release_msi),
|
||||
DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_alloc_msix, acpi_pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_release_msix, pcib_release_msix),
|
||||
|
||||
{0, 0}
|
||||
@ -306,6 +310,26 @@ acpi_pcib_acpi_route_interrupt(device_t pcib, device_t dev, int pin)
|
||||
return (acpi_pcib_route_interrupt(pcib, dev, pin, &sc->ap_prt));
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
|
||||
int *irqs)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
|
||||
irqs));
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_pcib_alloc_msix(device_t pcib, device_t dev, int index, int *irq)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, index, irq));
|
||||
}
|
||||
|
||||
static u_long acpi_host_mem_start = 0x80000000;
|
||||
TUNABLE_ULONG("hw.acpi.host_mem_start", &acpi_host_mem_start);
|
||||
|
||||
|
@ -72,6 +72,27 @@ mptable_hostb_attach(device_t dev)
|
||||
return (bus_generic_attach(dev));
|
||||
}
|
||||
|
||||
/* Pass MSI alloc requests up to the nexus. */
|
||||
static int
|
||||
mptable_hostb_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
|
||||
int *irqs)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
|
||||
irqs));
|
||||
}
|
||||
|
||||
static int
|
||||
mptable_hostb_alloc_msix(device_t pcib, device_t dev, int index, int *irq)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, index, irq));
|
||||
}
|
||||
|
||||
static device_method_t mptable_hostb_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, mptable_hostb_probe),
|
||||
@ -96,9 +117,9 @@ static device_method_t mptable_hostb_methods[] = {
|
||||
DEVMETHOD(pcib_read_config, legacy_pcib_read_config),
|
||||
DEVMETHOD(pcib_write_config, legacy_pcib_write_config),
|
||||
DEVMETHOD(pcib_route_interrupt, mptable_pci_route_interrupt),
|
||||
DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_alloc_msi, mptable_hostb_alloc_msi),
|
||||
DEVMETHOD(pcib_release_msi, pcib_release_msi),
|
||||
DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_alloc_msix, mptable_hostb_alloc_msix),
|
||||
DEVMETHOD(pcib_release_msix, pcib_release_msix),
|
||||
|
||||
{ 0, 0 }
|
||||
@ -165,4 +186,3 @@ static devclass_t pcib_devclass;
|
||||
DEFINE_CLASS_0(pcib, mptable_pcib_driver, mptable_pcib_pci_methods,
|
||||
sizeof(struct pcib_softc));
|
||||
DRIVER_MODULE(mptable_pcib, pci, mptable_pcib_driver, pcib_devclass, 0, 0);
|
||||
|
||||
|
@ -77,6 +77,28 @@ legacy_pcib_write_config(device_t dev, int bus, int slot, int func,
|
||||
pci_cfgregwrite(bus, slot, func, reg, data, bytes);
|
||||
}
|
||||
|
||||
/* Pass MSI alloc requests up to the nexus. */
|
||||
|
||||
static int
|
||||
legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
|
||||
int *irqs)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
|
||||
irqs));
|
||||
}
|
||||
|
||||
static int
|
||||
legacy_pcib_alloc_msix(device_t pcib, device_t dev, int index, int *irq)
|
||||
{
|
||||
device_t bus;
|
||||
|
||||
bus = device_get_parent(pcib);
|
||||
return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, index, irq));
|
||||
}
|
||||
|
||||
static const char *
|
||||
legacy_pcib_is_host_bridge(int bus, int slot, int func,
|
||||
uint32_t id, uint8_t class, uint8_t subclass,
|
||||
@ -534,9 +556,9 @@ static device_method_t legacy_pcib_methods[] = {
|
||||
DEVMETHOD(pcib_read_config, legacy_pcib_read_config),
|
||||
DEVMETHOD(pcib_write_config, legacy_pcib_write_config),
|
||||
DEVMETHOD(pcib_route_interrupt, pcibios_pcib_route_interrupt),
|
||||
DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_alloc_msi, legacy_pcib_alloc_msi),
|
||||
DEVMETHOD(pcib_release_msi, pcib_release_msi),
|
||||
DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_alloc_msix, legacy_pcib_alloc_msix),
|
||||
DEVMETHOD(pcib_release_msix, pcib_release_msix),
|
||||
|
||||
{ 0, 0 }
|
||||
|
Loading…
Reference in New Issue
Block a user