Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pci/vga_pci.c
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
#if defined(__amd64__) || defined(__i386__) | #if defined(__amd64__) || defined(__i386__) | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#endif | #endif | ||||
#include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <compat/x86bios/x86bios.h> /* To re-POST the card. */ | |||||
struct vga_resource { | struct vga_resource { | ||||
struct resource *vr_res; | struct resource *vr_res; | ||||
int vr_refs; | int vr_refs; | ||||
}; | }; | ||||
struct vga_pci_softc { | struct vga_pci_softc { | ||||
device_t vga_msi_child; /* Child driver using MSI. */ | device_t vga_msi_child; /* Child driver using MSI. */ | ||||
struct vga_resource vga_bars[PCIR_MAX_BAR_0 + 1]; | struct vga_resource vga_bars[PCIR_MAX_BAR_0 + 1]; | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | #endif | ||||
* the address we returned previously. | * the address we returned previously. | ||||
*/ | */ | ||||
vr = lookup_res(device_get_softc(dev), PCIR_BIOS); | vr = lookup_res(device_get_softc(dev), PCIR_BIOS); | ||||
KASSERT(vr->vr_res != NULL, ("vga_pci_unmap_bios: bios not mapped")); | KASSERT(vr->vr_res != NULL, ("vga_pci_unmap_bios: bios not mapped")); | ||||
KASSERT(rman_get_virtual(vr->vr_res) == bios, | KASSERT(rman_get_virtual(vr->vr_res) == bios, | ||||
("vga_pci_unmap_bios: mismatch")); | ("vga_pci_unmap_bios: mismatch")); | ||||
vga_pci_release_resource(dev, NULL, SYS_RES_MEMORY, PCIR_BIOS, | vga_pci_release_resource(dev, NULL, SYS_RES_MEMORY, PCIR_BIOS, | ||||
vr->vr_res); | vr->vr_res); | ||||
} | |||||
int | |||||
vga_pci_repost(device_t dev) | |||||
{ | |||||
#if defined(__amd64__) || defined(__i386__) | |||||
x86regs_t regs; | |||||
if (!vga_pci_is_boot_display(dev)) | |||||
return (EINVAL); | |||||
if (x86bios_get_orm(VGA_PCI_BIOS_SHADOW_ADDR) == NULL) | |||||
return (ENOTSUP); | |||||
x86bios_init_regs(®s); | |||||
regs.R_AH = pci_get_bus(dev); | |||||
regs.R_AL = (pci_get_slot(dev) << 3) | (pci_get_function(dev) & 0x07); | |||||
regs.R_DL = 0x80; | |||||
device_printf(dev, "REPOSTing\n"); | |||||
x86bios_call(®s, X86BIOS_PHYSTOSEG(VGA_PCI_BIOS_SHADOW_ADDR + 3), | |||||
X86BIOS_PHYSTOOFF(VGA_PCI_BIOS_SHADOW_ADDR + 3)); | |||||
x86bios_get_intr(0x10); | |||||
return (0); | |||||
#else | |||||
return (ENOTSUP); | |||||
#endif | |||||
} | } | ||||
static int | static int | ||||
vga_pci_probe(device_t dev) | vga_pci_probe(device_t dev) | ||||
{ | { | ||||
switch (pci_get_class(dev)) { | switch (pci_get_class(dev)) { | ||||
case PCIC_DISPLAY: | case PCIC_DISPLAY: | ||||
▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines |