FreeBSD kernel amd64 PCI device code
vga_pci.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/rman.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <compat/x86bios/x86bios.h>
Include dependency graph for vga_pci.c:

Go to the source code of this file.

Data Structures

struct  vga_resource
 
struct  vga_pci_softc
 

Functions

 __FBSDID ("$FreeBSD$")
 
 SYSCTL_DECL (_hw_pci)
 
static struct vga_resourcelookup_res (struct vga_pci_softc *sc, int rid)
 
static struct resource * vga_pci_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 int vga_pci_release_resource (device_t dev, device_t child, int type, int rid, struct resource *r)
 
 SYSCTL_INT (_hw_pci, OID_AUTO, default_vgapci_unit, CTLFLAG_RDTUN, &vga_pci_default_unit, -1, "Default VGA-compatible display")
 
int vga_pci_is_boot_display (device_t dev)
 
static void vga_pci_reset (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)
 
static int vga_pci_probe (device_t dev)
 
static int vga_pci_attach (device_t dev)
 
static int vga_pci_suspend (device_t dev)
 
static int vga_pci_detach (device_t dev)
 
static int vga_pci_resume (device_t dev)
 
static int vga_pci_read_ivar (device_t dev, device_t child, int which, uintptr_t *result)
 
static int vga_pci_write_ivar (device_t dev, device_t child, int which, uintptr_t value)
 
static int vga_pci_setup_intr (device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
 
static int vga_pci_teardown_intr (device_t dev, device_t child, struct resource *irq, void *cookie)
 
static uint32_t vga_pci_read_config (device_t dev, device_t child, int reg, int width)
 
static void vga_pci_write_config (device_t dev, device_t child, int reg, uint32_t val, int width)
 
static int vga_pci_enable_busmaster (device_t dev, device_t child)
 
static int vga_pci_disable_busmaster (device_t dev, device_t child)
 
static int vga_pci_enable_io (device_t dev, device_t child, int space)
 
static int vga_pci_disable_io (device_t dev, device_t child, int space)
 
static int vga_pci_get_vpd_ident (device_t dev, device_t child, const char **identptr)
 
static int vga_pci_get_vpd_readonly (device_t dev, device_t child, const char *kw, const char **vptr)
 
static int vga_pci_set_powerstate (device_t dev, device_t child, int state)
 
static int vga_pci_get_powerstate (device_t dev, device_t child)
 
static int vga_pci_assign_interrupt (device_t dev, device_t child)
 
static int vga_pci_find_cap (device_t dev, device_t child, int capability, int *capreg)
 
static int vga_pci_find_next_cap (device_t dev, device_t child, int capability, int start, int *capreg)
 
static int vga_pci_find_extcap (device_t dev, device_t child, int capability, int *capreg)
 
static int vga_pci_find_next_extcap (device_t dev, device_t child, int capability, int start, int *capreg)
 
static int vga_pci_find_htcap (device_t dev, device_t child, int capability, int *capreg)
 
static int vga_pci_find_next_htcap (device_t dev, device_t child, int capability, int start, int *capreg)
 
static int vga_pci_alloc_msi (device_t dev, device_t child, int *count)
 
static int vga_pci_alloc_msix (device_t dev, device_t child, int *count)
 
static int vga_pci_remap_msix (device_t dev, device_t child, int count, const u_int *vectors)
 
static int vga_pci_release_msi (device_t dev, device_t child)
 
static int vga_pci_msi_count (device_t dev, device_t child)
 
static int vga_pci_msix_count (device_t dev, device_t child)
 
static bus_dma_tag_t vga_pci_get_dma_tag (device_t bus, device_t child)
 
 DRIVER_MODULE (vgapci, pci, vga_pci_driver, vga_devclass, 0, 0)
 
 MODULE_DEPEND (vgapci, x86bios, 1, 1, 1)
 

Variables

int vga_pci_default_unit = -1
 
static device_method_t vga_pci_methods []
 
static driver_t vga_pci_driver
 
static devclass_t vga_devclass
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( vgapci  ,
pci  ,
vga_pci_driver  ,
vga_devclass  ,
,
 
)

◆ lookup_res()

static struct vga_resource * lookup_res ( struct vga_pci_softc sc,
int  rid 
)
static

Definition at line 445 of file vga_pci.c.

References PCI_RID2BAR, PCIR_BIOS, PCIR_MAX_BAR_0, rid, vga_pci_softc::vga_bars, and vga_pci_softc::vga_bios.

Referenced by vga_pci_alloc_resource(), vga_pci_map_bios(), vga_pci_release_resource(), and vga_pci_unmap_bios().

Here is the caller graph for this function:

◆ MODULE_DEPEND()

MODULE_DEPEND ( vgapci  ,
x86bios  ,
,
,
 
)

◆ SYSCTL_DECL()

SYSCTL_DECL ( _hw_pci  )

◆ SYSCTL_INT()

SYSCTL_INT ( _hw_pci  ,
OID_AUTO  ,
default_vgapci_unit  ,
CTLFLAG_RDTUN  ,
vga_pci_default_unit,
1,
"Default VGA-compatible display"   
)

◆ vga_pci_alloc_msi()

static int vga_pci_alloc_msi ( device_t  dev,
device_t  child,
int *  count 
)
static

Definition at line 660 of file vga_pci.c.

References child, count, dev, and vga_pci_softc::vga_msi_child.

◆ vga_pci_alloc_msix()

static int vga_pci_alloc_msix ( device_t  dev,
device_t  child,
int *  count 
)
static

Definition at line 675 of file vga_pci.c.

References child, count, dev, and vga_pci_softc::vga_msi_child.

◆ vga_pci_alloc_resource()

static struct resource * vga_pci_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

Definition at line 458 of file vga_pci.c.

References count, dev, lookup_res(), rid, start, type, vga_resource::vr_refs, and vga_resource::vr_res.

Referenced by vga_pci_map_bios().

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

◆ vga_pci_assign_interrupt()

static int vga_pci_assign_interrupt ( device_t  dev,
device_t  child 
)
static

Definition at line 603 of file vga_pci.c.

References child, and dev.

◆ vga_pci_attach()

static int vga_pci_attach ( device_t  dev)
static

Definition at line 371 of file vga_pci.c.

References dev, and vga_pci_is_boot_display().

Here is the call graph for this function:

◆ vga_pci_detach()

static int vga_pci_detach ( device_t  dev)
static

Definition at line 395 of file vga_pci.c.

References dev.

◆ vga_pci_disable_busmaster()

static int vga_pci_disable_busmaster ( device_t  dev,
device_t  child 
)
static

Definition at line 545 of file vga_pci.c.

References dev.

◆ vga_pci_disable_io()

static int vga_pci_disable_io ( device_t  dev,
device_t  child,
int  space 
)
static

Definition at line 561 of file vga_pci.c.

References child, dev, and space.

◆ vga_pci_enable_busmaster()

static int vga_pci_enable_busmaster ( device_t  dev,
device_t  child 
)
static

Definition at line 538 of file vga_pci.c.

References dev.

◆ vga_pci_enable_io()

static int vga_pci_enable_io ( device_t  dev,
device_t  child,
int  space 
)
static

Definition at line 552 of file vga_pci.c.

References child, dev, and space.

◆ vga_pci_find_cap()

static int vga_pci_find_cap ( device_t  dev,
device_t  child,
int  capability,
int *  capreg 
)
static

Definition at line 612 of file vga_pci.c.

References capability, capreg, and dev.

◆ vga_pci_find_extcap()

static int vga_pci_find_extcap ( device_t  dev,
device_t  child,
int  capability,
int *  capreg 
)
static

Definition at line 628 of file vga_pci.c.

References capability, capreg, and dev.

◆ vga_pci_find_htcap()

static int vga_pci_find_htcap ( device_t  dev,
device_t  child,
int  capability,
int *  capreg 
)
static

Definition at line 644 of file vga_pci.c.

References capability, capreg, and dev.

◆ vga_pci_find_next_cap()

static int vga_pci_find_next_cap ( device_t  dev,
device_t  child,
int  capability,
int  start,
int *  capreg 
)
static

Definition at line 620 of file vga_pci.c.

References capability, capreg, dev, and start.

◆ vga_pci_find_next_extcap()

static int vga_pci_find_next_extcap ( device_t  dev,
device_t  child,
int  capability,
int  start,
int *  capreg 
)
static

Definition at line 636 of file vga_pci.c.

References capability, capreg, dev, and start.

◆ vga_pci_find_next_htcap()

static int vga_pci_find_next_htcap ( device_t  dev,
device_t  child,
int  capability,
int  start,
int *  capreg 
)
static

Definition at line 652 of file vga_pci.c.

References capability, capreg, dev, and start.

◆ vga_pci_get_dma_tag()

static bus_dma_tag_t vga_pci_get_dma_tag ( device_t  bus,
device_t  child 
)
static

Definition at line 731 of file vga_pci.c.

References bus.

◆ vga_pci_get_powerstate()

static int vga_pci_get_powerstate ( device_t  dev,
device_t  child 
)
static

Definition at line 594 of file vga_pci.c.

References child, and dev.

◆ vga_pci_get_vpd_ident()

static int vga_pci_get_vpd_ident ( device_t  dev,
device_t  child,
const char **  identptr 
)
static

Definition at line 570 of file vga_pci.c.

References dev, and identptr.

◆ vga_pci_get_vpd_readonly()

static int vga_pci_get_vpd_readonly ( device_t  dev,
device_t  child,
const char *  kw,
const char **  vptr 
)
static

Definition at line 577 of file vga_pci.c.

References dev, kw, and vptr.

◆ vga_pci_is_boot_display()

int vga_pci_is_boot_display ( device_t  dev)

◆ vga_pci_map_bios()

◆ vga_pci_msi_count()

static int vga_pci_msi_count ( device_t  dev,
device_t  child 
)
static

Definition at line 717 of file vga_pci.c.

References dev.

◆ vga_pci_msix_count()

static int vga_pci_msix_count ( device_t  dev,
device_t  child 
)
static

Definition at line 724 of file vga_pci.c.

References dev.

◆ vga_pci_probe()

static int vga_pci_probe ( device_t  dev)
static

Definition at line 349 of file vga_pci.c.

References dev, PCIC_DISPLAY, PCIC_OLD, PCIS_OLD_VGA, and vga_pci_is_boot_display().

Here is the call graph for this function:

◆ vga_pci_read_config()

static uint32_t vga_pci_read_config ( device_t  dev,
device_t  child,
int  reg,
int  width 
)
static

Definition at line 523 of file vga_pci.c.

References dev, reg, and width.

◆ vga_pci_read_ivar()

static int vga_pci_read_ivar ( device_t  dev,
device_t  child,
int  which,
uintptr_t *  result 
)
static

Definition at line 415 of file vga_pci.c.

References dev.

◆ vga_pci_release_msi()

static int vga_pci_release_msi ( device_t  dev,
device_t  child 
)
static

Definition at line 702 of file vga_pci.c.

References child, dev, and vga_pci_softc::vga_msi_child.

◆ vga_pci_release_resource()

static int vga_pci_release_resource ( device_t  dev,
device_t  child,
int  type,
int  rid,
struct resource *  r 
)
static

Definition at line 484 of file vga_pci.c.

References dev, lookup_res(), rid, type, vga_resource::vr_refs, and vga_resource::vr_res.

Referenced by vga_pci_map_bios(), and vga_pci_unmap_bios().

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

◆ vga_pci_remap_msix()

static int vga_pci_remap_msix ( device_t  dev,
device_t  child,
int  count,
const u_int *  vectors 
)
static

Definition at line 690 of file vga_pci.c.

References child, count, dev, vectors, and vga_pci_softc::vga_msi_child.

◆ 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_reset()

static void vga_pci_reset ( device_t  dev)
static

Definition at line 146 of file vga_pci.c.

References dev.

Referenced by vga_pci_map_bios().

Here is the caller graph for this function:

◆ vga_pci_resume()

static int vga_pci_resume ( device_t  dev)
static

Definition at line 406 of file vga_pci.c.

References dev.

◆ vga_pci_set_powerstate()

static int vga_pci_set_powerstate ( device_t  dev,
device_t  child,
int  state 
)
static

Definition at line 585 of file vga_pci.c.

References child, dev, and state.

◆ vga_pci_setup_intr()

static int vga_pci_setup_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
int  flags,
driver_filter_t *  filter,
driver_intr_t *  intr,
void *  arg,
void **  cookiep 
)
static

Definition at line 429 of file vga_pci.c.

References dev, and irq.

◆ vga_pci_suspend()

static int vga_pci_suspend ( device_t  dev)
static

Definition at line 388 of file vga_pci.c.

References dev.

◆ vga_pci_teardown_intr()

static int vga_pci_teardown_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
void *  cookie 
)
static

Definition at line 438 of file vga_pci.c.

References dev, and irq.

◆ vga_pci_unmap_bios()

void vga_pci_unmap_bios ( device_t  dev,
void *  bios 
)

◆ vga_pci_write_config()

static void vga_pci_write_config ( device_t  dev,
device_t  child,
int  reg,
uint32_t  val,
int  width 
)
static

Definition at line 530 of file vga_pci.c.

References dev, reg, val, and width.

◆ vga_pci_write_ivar()

static int vga_pci_write_ivar ( device_t  dev,
device_t  child,
int  which,
uintptr_t  value 
)
static

Definition at line 422 of file vga_pci.c.

Variable Documentation

◆ vga_devclass

devclass_t vga_devclass
static

Definition at line 790 of file vga_pci.c.

◆ vga_pci_default_unit

int vga_pci_default_unit = -1

Definition at line 77 of file vga_pci.c.

Referenced by vga_pci_is_boot_display().

◆ vga_pci_driver

driver_t vga_pci_driver
static
Initial value:
= {
"vgapci",
sizeof(struct vga_pci_softc),
}
static device_method_t vga_pci_methods[]
Definition: vga_pci.c:737

Definition at line 784 of file vga_pci.c.

◆ vga_pci_methods

device_method_t vga_pci_methods[]
static

Definition at line 737 of file vga_pci.c.