FreeBSD kernel amd64 PCI device code
pcivar.h File Reference
#include <sys/queue.h>
#include <sys/_eventhandler.h>
Include dependency graph for pcivar.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pcicfg_bridge
 
struct  pcicfg_pp
 
struct  pci_map
 
struct  vpd_readonly
 
struct  vpd_write
 
struct  pcicfg_vpd
 
struct  pcicfg_msi
 
struct  msix_vector
 
struct  msix_table_entry
 
struct  pcicfg_msix
 
struct  pcicfg_ht
 
struct  pcicfg_pcie
 
struct  pcicfg_pcix
 
struct  pcicfg_vf
 
struct  pci_ea_entry
 
struct  pcicfg_ea
 
struct  pcicfg
 
struct  pcih1cfgregs
 
struct  pcih2cfgregs
 
struct  pci_device_table
 

Macros

#define PCI_MAXMAPS_0   6 /* max. no. of memory/port maps */
 
#define PCI_MAXMAPS_1   2 /* max. no. of maps for PCI to PCI bridge */
 
#define PCI_MAXMAPS_2   1 /* max. no. of maps for CardBus bridge */
 
#define PCICFG_VF   0x0001 /* Device is an SR-IOV Virtual Function */
 
#define PCI_DEV(v, d)
 
#define PCI_SUBDEV(sv, sd)
 
#define PCI_CLASS(x)    .match_flag_class = 1, .class_id = (x)
 
#define PCI_SUBCLASS(x)    .match_flag_subclass = 1, .subclass = (x)
 
#define PCI_REVID(x)    .match_flag_revid = 1, .revid = (x)
 
#define PCI_DESCR(x)    .descr = (x)
 
#define PCI_PNP_STR
 
#define PCI_PNP_INFO(table)
 
#define PCI_MATCH(child, table)    pci_match_device(child, (table), nitems(table));
 
#define VGA_PCI_BIOS_SHADOW_ADDR   0xC0000
 
#define VGA_PCI_BIOS_SHADOW_SIZE   131072
 

Typedefs

typedef uint64_t pci_addr_t
 
typedef struct pcicfg pcicfgregs
 
typedef void(* pci_event_fn) (void *arg, device_t dev)
 

Functions

const struct pci_device_tablepci_match_device (device_t child, const struct pci_device_table *id, size_t nelt)
 
 STAILQ_HEAD (devlist, pci_devinfo)
 
struct pci_mappci_find_bar (device_t dev, int reg)
 
int pci_bar_enabled (device_t dev, struct pci_map *pm)
 
struct pcicfg_vpdpci_fetch_vpd_list (device_t dev)
 
int vga_pci_is_boot_display (device_t dev)
 
void * vga_pci_map_bios (device_t dev, size_t *size)
 
void vga_pci_unmap_bios (device_t dev, void *bios)
 
int vga_pci_repost (device_t dev)
 
 EVENTHANDLER_DECLARE (pci_add_device, pci_event_fn)
 
 EVENTHANDLER_DECLARE (pci_delete_device, pci_event_fn)
 

Variables

uint32_t pci_numdevs
 
int pci_enable_aspm
 
struct cdevsw pcicdev
 
struct devlist pci_devq
 
uint32_t pci_generation
 

Macro Definition Documentation

◆ PCI_CLASS

#define PCI_CLASS (   x)     .match_flag_class = 1, .class_id = (x)

Definition at line 309 of file pcivar.h.

◆ PCI_DESCR

#define PCI_DESCR (   x)     .descr = (x)

Definition at line 315 of file pcivar.h.

◆ PCI_DEV

#define PCI_DEV (   v,
 
)
Value:
.match_flag_vendor = 1, .vendor = (v), \
.match_flag_device = 1, .device = (d)

Definition at line 303 of file pcivar.h.

◆ PCI_MATCH

#define PCI_MATCH (   child,
  table 
)     pci_match_device(child, (table), nitems(table));

Definition at line 326 of file pcivar.h.

◆ PCI_MAXMAPS_0

#define PCI_MAXMAPS_0   6 /* max. no. of memory/port maps */

Definition at line 38 of file pcivar.h.

◆ PCI_MAXMAPS_1

#define PCI_MAXMAPS_1   2 /* max. no. of maps for PCI to PCI bridge */

Definition at line 39 of file pcivar.h.

◆ PCI_MAXMAPS_2

#define PCI_MAXMAPS_2   1 /* max. no. of maps for CardBus bridge */

Definition at line 40 of file pcivar.h.

◆ PCI_PNP_INFO

#define PCI_PNP_INFO (   table)
Value:
MODULE_PNP_INFO(PCI_PNP_STR, pci, table, table, \
sizeof(table) / sizeof(table[0]))
INTERFACE pci
Definition: pci_if.m:32
#define PCI_PNP_STR
Definition: pcivar.h:317

Definition at line 320 of file pcivar.h.

◆ PCI_PNP_STR

#define PCI_PNP_STR
Value:
"M16:mask;U16:vendor;U16:device;U16:subvendor;U16:subdevice;" \
"U16:class;U16:subclass;U16:revid;"

Definition at line 317 of file pcivar.h.

◆ PCI_REVID

#define PCI_REVID (   x)     .match_flag_revid = 1, .revid = (x)

Definition at line 313 of file pcivar.h.

◆ PCI_SUBCLASS

#define PCI_SUBCLASS (   x)     .match_flag_subclass = 1, .subclass = (x)

Definition at line 311 of file pcivar.h.

◆ PCI_SUBDEV

#define PCI_SUBDEV (   sv,
  sd 
)
Value:
.match_flag_subvendor = 1, .subvendor = (sv), \
.match_flag_subdevice = 1, .subdevice = (sd)

Definition at line 306 of file pcivar.h.

◆ PCICFG_VF

#define PCICFG_VF   0x0001 /* Device is an SR-IOV Virtual Function */

Definition at line 175 of file pcivar.h.

◆ VGA_PCI_BIOS_SHADOW_ADDR

#define VGA_PCI_BIOS_SHADOW_ADDR   0xC0000

Definition at line 718 of file pcivar.h.

◆ VGA_PCI_BIOS_SHADOW_SIZE

#define VGA_PCI_BIOS_SHADOW_SIZE   131072

Definition at line 719 of file pcivar.h.

Typedef Documentation

◆ pci_addr_t

typedef uint64_t pci_addr_t

Definition at line 42 of file pcivar.h.

◆ pci_event_fn

typedef void(* pci_event_fn) (void *arg, device_t dev)

Global eventhandlers invoked when PCI devices are added or removed from the system.

Definition at line 730 of file pcivar.h.

◆ pcicfgregs

typedef struct pcicfg pcicfgregs

Function Documentation

◆ EVENTHANDLER_DECLARE() [1/2]

EVENTHANDLER_DECLARE ( pci_add_device  ,
pci_event_fn   
)

◆ EVENTHANDLER_DECLARE() [2/2]

EVENTHANDLER_DECLARE ( pci_delete_device  ,
pci_event_fn   
)

◆ pci_bar_enabled()

int pci_bar_enabled ( device_t  dev,
struct pci_map pm 
)

◆ pci_fetch_vpd_list()

struct pcicfg_vpd * pci_fetch_vpd_list ( device_t  dev)

Definition at line 1429 of file pci.c.

References dev, pci_read_vpd(), pcicfg::vpd, pcicfg_vpd::vpd_cached, and pcicfg_vpd::vpd_reg.

Referenced by pci_list_vpd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_find_bar()

struct pci_map * pci_find_bar ( device_t  dev,
int  reg 
)

Definition at line 3162 of file pci.c.

References dev, pci_map::pm_reg, and reg.

Referenced by pci_activate_resource(), pci_add_map(), pci_bar_io(), pci_bar_mmap(), pci_deactivate_resource(), pci_ioctl(), pci_reserve_map(), and pci_vf_alloc_mem_resource().

Here is the caller graph for this function:

◆ pci_match_device()

const struct pci_device_table * pci_match_device ( device_t  child,
const struct pci_device_table id,
size_t  nelt 
)

◆ STAILQ_HEAD()

STAILQ_HEAD ( devlist  ,
pci_devinfo   
)

◆ vga_pci_is_boot_display()

int vga_pci_is_boot_display ( device_t  dev)

◆ vga_pci_map_bios()

◆ vga_pci_repost()

int vga_pci_repost ( device_t  dev)

Definition at line 319 of file vga_pci.c.

References dev, VGA_PCI_BIOS_SHADOW_ADDR, and vga_pci_is_boot_display().

Here is the call graph for this function:

◆ vga_pci_unmap_bios()

void vga_pci_unmap_bios ( device_t  dev,
void *  bios 
)

Variable Documentation

◆ pci_devq

◆ pci_enable_aspm

int pci_enable_aspm
extern

Definition at line 416 of file pci.c.

◆ pci_generation

uint32_t pci_generation
extern

Definition at line 335 of file pci.c.

Referenced by pci_fill_devinfo(), pci_freecfg(), pci_ioctl(), and pci_modevent().

◆ pci_numdevs

uint32_t pci_numdevs
extern

Definition at line 336 of file pci.c.

Referenced by pci_fill_devinfo(), pci_freecfg(), and pci_ioctl().

◆ pcicdev

struct cdevsw pcicdev
extern

Definition at line 119 of file pci_user.c.

Referenced by pci_modevent().