Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pci/vga_pci.c
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | struct vga_pci_softc { | ||||
struct vga_resource vga_bars[PCIR_MAX_BAR_0 + 1]; | struct vga_resource vga_bars[PCIR_MAX_BAR_0 + 1]; | ||||
struct vga_resource vga_bios; | struct vga_resource vga_bios; | ||||
}; | }; | ||||
SYSCTL_DECL(_hw_pci); | SYSCTL_DECL(_hw_pci); | ||||
static struct vga_resource *lookup_res(struct vga_pci_softc *sc, int rid); | static struct vga_resource *lookup_res(struct vga_pci_softc *sc, int rid); | ||||
static struct resource *vga_pci_alloc_resource(device_t dev, device_t child, | static struct resource *vga_pci_alloc_resource(device_t dev, device_t child, | ||||
int type, int *rid, u_long start, u_long end, u_long count, u_int flags); | 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, | static int vga_pci_release_resource(device_t dev, device_t child, int type, | ||||
int rid, struct resource *r); | int rid, struct resource *r); | ||||
int vga_pci_default_unit = -1; | int vga_pci_default_unit = -1; | ||||
SYSCTL_INT(_hw_pci, OID_AUTO, default_vgapci_unit, CTLFLAG_RDTUN, | SYSCTL_INT(_hw_pci, OID_AUTO, default_vgapci_unit, CTLFLAG_RDTUN, | ||||
&vga_pci_default_unit, -1, "Default VGA-compatible display"); | &vga_pci_default_unit, -1, "Default VGA-compatible display"); | ||||
int | int | ||||
▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | lookup_res(struct vga_pci_softc *sc, int rid) | ||||
bar = PCI_RID2BAR(rid); | bar = PCI_RID2BAR(rid); | ||||
if (bar >= 0 && bar <= PCIR_MAX_BAR_0) | if (bar >= 0 && bar <= PCIR_MAX_BAR_0) | ||||
return (&sc->vga_bars[bar]); | return (&sc->vga_bars[bar]); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, | vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct vga_resource *vr; | struct vga_resource *vr; | ||||
switch (type) { | switch (type) { | ||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
/* | /* | ||||
* For BARs, we cache the resource so that we only allocate it | * For BARs, we cache the resource so that we only allocate it | ||||
▲ Show 20 Lines • Show All 299 Lines • Show Last 20 Lines |