FreeBSD kernel amd64 PCI device code
|
#include <sys/cdefs.h>
#include "opt_pci.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/pciio.h>
#include <sys/rman.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pci_private.h>
#include <dev/pci/pcib_private.h>
#include "pcib_if.h"
Go to the source code of this file.
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | pcib_probe (device_t dev) |
static int | pcib_suspend (device_t dev) |
static int | pcib_resume (device_t dev) |
static int | pcib_power_for_sleep (device_t pcib, device_t dev, int *pstate) |
static int | pcib_ari_get_id (device_t pcib, device_t dev, enum pci_id_type type, uintptr_t *id) |
static uint32_t | pcib_read_config (device_t dev, u_int b, u_int s, u_int f, u_int reg, int width) |
static void | pcib_write_config (device_t dev, u_int b, u_int s, u_int f, u_int reg, uint32_t val, int width) |
static int | pcib_ari_maxslots (device_t dev) |
static int | pcib_ari_maxfuncs (device_t dev) |
static int | pcib_try_enable_ari (device_t pcib, device_t dev) |
static int | pcib_ari_enabled (device_t pcib) |
static void | pcib_ari_decode_rid (device_t pcib, uint16_t rid, int *bus, int *slot, int *func) |
static int | pcib_request_feature_default (device_t pcib, device_t dev, enum pci_feature feature) |
static int | pcib_reset_child (device_t dev, device_t child, int flags) |
DEFINE_CLASS_0 (pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc)) | |
EARLY_DRIVER_MODULE (pcib, pci, pcib_driver, pcib_devclass, NULL, NULL, BUS_PASS_BUS) | |
static int | pcib_is_prefetch_open (struct pcib_softc *sc) |
static int | pcib_is_nonprefetch_open (struct pcib_softc *sc) |
static int | pcib_is_io_open (struct pcib_softc *sc) |
static void | pcib_get_io_decode (struct pcib_softc *sc) |
static void | pcib_get_mem_decode (struct pcib_softc *sc) |
static void | pcib_set_io_decode (struct pcib_softc *sc) |
static void | pcib_set_mem_decode (struct pcib_softc *sc) |
static void | pcib_cfg_save (struct pcib_softc *sc) |
static void | pcib_cfg_restore (struct pcib_softc *sc) |
void | pcib_attach_common (device_t dev) |
int | pcib_attach_child (device_t dev) |
int | pcib_attach (device_t dev) |
int | pcib_detach (device_t dev) |
void | pcib_bridge_init (device_t dev) |
int | pcib_child_present (device_t dev, device_t child) |
int | pcib_read_ivar (device_t dev, device_t child, int which, uintptr_t *result) |
int | pcib_write_ivar (device_t dev, device_t child, int which, uintptr_t value) |
struct resource * | pcib_alloc_resource (device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) |
static __inline void | pcib_xlate_ari (device_t pcib, int bus, int *slot, int *func) |
static void | pcib_enable_ari (struct pcib_softc *sc, uint32_t pcie_pos) |
int | pcib_maxslots (device_t dev) |
int | pcib_route_interrupt (device_t pcib, device_t dev, int pin) |
int | pcib_alloc_msi (device_t pcib, device_t dev, int count, int maxcount, int *irqs) |
int | pcib_release_msi (device_t pcib, device_t dev, int count, int *irqs) |
int | pcib_alloc_msix (device_t pcib, device_t dev, int *irq) |
int | pcib_release_msix (device_t pcib, device_t dev, int irq) |
int | pcib_map_msi (device_t pcib, device_t dev, int irq, uint64_t *addr, uint32_t *data) |
int | pcib_request_feature_allow (device_t pcib, device_t dev, enum pci_feature feature) |
int | pcib_request_feature (device_t dev, enum pci_feature feature) |
Variables | |
static device_method_t | pcib_methods [] |
static devclass_t | pcib_devclass |
__FBSDID | ( | "$FreeBSD$" | ) |
DEFINE_CLASS_0 | ( | pcib | , |
pcib_driver | , | ||
pcib_methods | , | ||
sizeof(struct pcib_softc) | |||
) |
EARLY_DRIVER_MODULE | ( | pcib | , |
pci | , | ||
pcib_driver | , | ||
pcib_devclass | , | ||
NULL | , | ||
NULL | , | ||
BUS_PASS_BUS | |||
) |
int pcib_alloc_msi | ( | device_t | pcib, |
device_t | dev, | ||
int | count, | ||
int | maxcount, | ||
int * | irqs | ||
) |
Definition at line 2773 of file pci_pci.c.
References bus, count, dev, pcib_softc::flags, irqs, maxcount, pcib, and PCIB_DISABLE_MSI.
int pcib_alloc_msix | ( | device_t | pcib, |
device_t | dev, | ||
int * | irq | ||
) |
Definition at line 2797 of file pci_pci.c.
References bus, dev, pcib_softc::flags, irq, pcib, and PCIB_DISABLE_MSIX.
struct resource * pcib_alloc_resource | ( | device_t | dev, |
device_t | child, | ||
int | type, | ||
int * | rid, | ||
rman_res_t | start, | ||
rman_res_t | end, | ||
rman_res_t | count, | ||
u_int | flags | ||
) |
Definition at line 2439 of file pci_pci.c.
References pcib_softc::bridgectl, child, count, dev, pcib_softc::flags, pcib_softc::iobase, pcib_softc::iolimit, pcib_softc::membase, pcib_softc::memlimit, name, PCIB_BCR_VGA_ENABLE, pcib_is_io_open(), pcib_is_nonprefetch_open(), pcib_is_prefetch_open(), PCIB_SUBTRACTIVE, pcib_softc::pmembase, pcib_softc::pmemlimit, rid, start, and type.
|
static |
Definition at line 2677 of file pci_pci.c.
References bus, pcib_softc::flags, func, PCI_RID2BUS, PCI_RID2FUNC, PCI_RID2SLOT, pcib, PCIB_ENABLE_ARI, PCIE_ARI_RID2FUNC, PCIE_ARI_RID2SLOT, rid, and slot.
|
static |
Definition at line 2846 of file pci_pci.c.
References pcib_softc::flags, pcib, and PCIB_ENABLE_ARI.
|
static |
Definition at line 2856 of file pci_pci.c.
References bus, dev, pcib_softc::flags, func, PCI_ARI_RID, PCI_ID_RID, PCI_RID, pcib, PCIB_ENABLE_ARI, slot, and type.
|
static |
Definition at line 2664 of file pci_pci.c.
References dev, pcib_softc::flags, PCI_FUNCMAX, PCIB_ENABLE_ARI, and PCIE_ARI_FUNCMAX.
|
static |
Definition at line 2651 of file pci_pci.c.
References dev, pcib_softc::flags, PCIB_ENABLE_ARI, pcib_maxslots(), and PCIE_ARI_SLOTMAX.
int pcib_attach | ( | device_t | dev | ) |
Definition at line 1755 of file pci_pci.c.
References dev, pcib_attach_child(), and pcib_attach_common().
int pcib_attach_child | ( | device_t | dev | ) |
Definition at line 1733 of file pci_pci.c.
References pcib_softc::bus, pcib_softc::child, dev, and pcib_secbus::sec.
Referenced by pcib_attach().
void pcib_attach_common | ( | device_t | dev | ) |
Definition at line 1537 of file pci_pci.c.
References pcib_softc::bridgectl, pcib_softc::bus, dev, pcib_softc::dev, pcib_softc::domain, pcib_softc::flags, pcib_softc::iobase, pcib_softc::iolimit, pcib_softc::membase, pcib_softc::memlimit, pci_msi_device_blacklisted(), pci_msix_device_blacklisted(), PCIB_BCR_ISA_ENABLE, PCIB_BCR_VGA_ENABLE, pcib_cfg_save(), PCIB_DISABLE_MSI, PCIB_DISABLE_MSIX, PCIB_HOTPLUG, pcib_is_io_open(), pcib_is_nonprefetch_open(), pcib_is_prefetch_open(), PCIB_SUBTRACTIVE, PCIP_BRIDGE_PCI_SUBTRACTIVE, PCIR_BRIDGECTL_1, PCIR_PRIBUS_1, PCIR_PROGIF, PCIR_SECBUS_1, PCIR_SUBBUS_1, pcib_softc::pmembase, pcib_softc::pmemlimit, pcib_softc::pribus, pcib_secbus::sec, and pcib_secbus::sub.
Referenced by pcib_attach().
void pcib_bridge_init | ( | device_t | dev | ) |
Definition at line 1818 of file pci_pci.c.
References dev, PCIR_IOBASEH_1, PCIR_IOBASEL_1, PCIR_IOLIMITH_1, PCIR_IOLIMITL_1, PCIR_MEMBASE_1, PCIR_MEMLIMIT_1, PCIR_PMBASEH_1, PCIR_PMBASEL_1, PCIR_PMLIMITH_1, and PCIR_PMLIMITL_1.
|
static |
Definition at line 1505 of file pci_pci.c.
References pcib_softc::dev, pcib_set_io_decode(), pcib_set_mem_decode(), PCIM_CMD_MEMEN, PCIM_CMD_PORTEN, and PCIR_COMMAND.
Referenced by pcib_resume().
|
static |
Definition at line 1485 of file pci_pci.c.
References dev, pcib_softc::dev, pcib_get_io_decode(), pcib_get_mem_decode(), PCIM_CMD_MEMEN, PCIM_CMD_PORTEN, and PCIR_COMMAND.
Referenced by pcib_attach_common(), and pcib_suspend().
int pcib_child_present | ( | device_t | dev, |
device_t | child | ||
) |
Definition at line 1833 of file pci_pci.c.
References dev, pcib_softc::flags, and PCIB_HOTPLUG.
int pcib_detach | ( | device_t | dev | ) |
Definition at line 1763 of file pci_pci.c.
References pcib_softc::bus, dev, pcib_softc::flags, and PCIB_HOTPLUG.
|
static |
Definition at line 2614 of file pci_pci.c.
References pcib_softc::dev, pcib_softc::flags, PCIB_ENABLE_ARI, PCIEM_CTL2_ARI, and PCIER_DEVICE_CTL2.
Referenced by pcib_try_enable_ari().
|
static |
Definition at line 832 of file pci_pci.c.
References dev, pcib_softc::dev, pcib_softc::iobase, pcib_softc::iolimit, PCI_PPBIOBASE, PCI_PPBIOLIMIT, PCIM_BRIO_32, PCIM_BRIO_MASK, PCIR_IOBASEH_1, PCIR_IOBASEL_1, PCIR_IOLIMITH_1, and PCIR_IOLIMITL_1.
Referenced by pcib_cfg_save().
|
static |
Definition at line 858 of file pci_pci.c.
References dev, pcib_softc::dev, pcib_softc::membase, pcib_softc::memlimit, PCI_PPBMEMBASE, PCI_PPBMEMLIMIT, PCIM_BRPM_64, PCIM_BRPM_MASK, PCIR_MEMBASE_1, PCIR_MEMLIMIT_1, PCIR_PMBASEH_1, PCIR_PMBASEL_1, PCIR_PMLIMITH_1, PCIR_PMLIMITL_1, pcib_softc::pmembase, and pcib_softc::pmemlimit.
Referenced by pcib_cfg_save().
|
static |
Definition at line 823 of file pci_pci.c.
References pcib_softc::iobase, and pcib_softc::iolimit.
Referenced by pcib_alloc_resource(), and pcib_attach_common().
|
static |
Definition at line 814 of file pci_pci.c.
References pcib_softc::membase, and pcib_softc::memlimit.
Referenced by pcib_alloc_resource(), and pcib_attach_common().
|
static |
Definition at line 805 of file pci_pci.c.
References pcib_softc::pmembase, and pcib_softc::pmemlimit.
Referenced by pcib_alloc_resource(), and pcib_attach_common().
int pcib_map_msi | ( | device_t | pcib, |
device_t | dev, | ||
int | irq, | ||
uint64_t * | addr, | ||
uint32_t * | data | ||
) |
int pcib_maxslots | ( | device_t | dev | ) |
Definition at line 2629 of file pci_pci.c.
References dev, PCI_SLOTMAX, PCIEM_FLAGS_TYPE, PCIEM_TYPE_DOWNSTREAM_PORT, PCIEM_TYPE_ROOT_PORT, PCIER_FLAGS, PCIY_EXPRESS, and val.
Referenced by pcib_ari_maxslots().
|
static |
|
static |
Definition at line 1526 of file pci_pci.c.
References dev, PCIC_BRIDGE, and PCIS_BRIDGE_PCI.
|
static |
int pcib_read_ivar | ( | device_t | dev, |
device_t | child, | ||
int | which, | ||
uintptr_t * | result | ||
) |
Definition at line 1849 of file pci_pci.c.
References pcib_softc::bus, dev, pcib_softc::domain, and pcib_secbus::sec.
int pcib_release_msi | ( | device_t | pcib, |
device_t | dev, | ||
int | count, | ||
int * | irqs | ||
) |
int pcib_release_msix | ( | device_t | pcib, |
device_t | dev, | ||
int | irq | ||
) |
int pcib_request_feature | ( | device_t | dev, |
enum pci_feature | feature | ||
) |
int pcib_request_feature_allow | ( | device_t | pcib, |
device_t | dev, | ||
enum pci_feature | feature | ||
) |
Definition at line 2944 of file pci_pci.c.
References feature, PCI_FEATURE_AER, and PCI_FEATURE_HP.
|
static |
|
static |
Definition at line 2996 of file pci_pci.c.
References child, dev, pcie_link_reset(), PCIEM_TYPE_DOWNSTREAM_PORT, and PCIEM_TYPE_ROOT_PORT.
|
static |
Definition at line 1804 of file pci_pci.c.
References dev, pcib_cfg_restore(), and PCIR_COMMAND.
int pcib_route_interrupt | ( | device_t | pcib, |
device_t | dev, | ||
int | pin | ||
) |
|
static |
Definition at line 889 of file pci_pci.c.
References dev, pcib_softc::dev, pcib_softc::iobase, pcib_softc::iolimit, PCIR_IOBASEH_1, PCIR_IOBASEL_1, PCIR_IOLIMITH_1, and PCIR_IOLIMITL_1.
Referenced by pcib_cfg_restore().
|
static |
Definition at line 911 of file pci_pci.c.
References dev, pcib_softc::dev, pcib_softc::membase, pcib_softc::memlimit, PCIR_MEMBASE_1, PCIR_MEMLIMIT_1, PCIR_PMBASEH_1, PCIR_PMBASEL_1, PCIR_PMLIMITH_1, PCIR_PMLIMITL_1, pcib_softc::pmembase, and pcib_softc::pmemlimit.
Referenced by pcib_cfg_restore().
|
static |
Definition at line 1796 of file pci_pci.c.
References dev, and pcib_cfg_save().
|
static |
Definition at line 2891 of file pci_pci.c.
References dev, PCI_EXTCAP_VER, pcib, pcib_enable_ari(), PCIB_SUPPORTED_ARI_VER, PCIEM_CAP2_ARI, PCIER_DEVICE_CAP2, PCIY_EXPRESS, and PCIZ_ARI.
|
static |
int pcib_write_ivar | ( | device_t | dev, |
device_t | child, | ||
int | which, | ||
uintptr_t | value | ||
) |
|
static |
Definition at line 2597 of file pci_pci.c.
References pcib_softc::flags, func, pcib, PCIB_ENABLE_ARI, PCIE_ARI_FUNC, PCIE_ARI_SLOT, and slot.
Referenced by pcib_read_config(), and pcib_write_config().