vgapci: New vga_pci_repost() function
This can be used to restore the VGA mode after a KMS driver is unloaded. Differential Revision: https://reviews.freebsd.org/D687
This commit is contained in:
parent
f4b588d2fc
commit
a8e8986092
@ -591,5 +591,6 @@ struct pcicfg_vpd *pci_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);
|
||||
|
||||
#endif /* _PCIVAR_H_ */
|
||||
|
@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <compat/x86bios/x86bios.h> /* To re-POST the card. */
|
||||
|
||||
struct vga_resource {
|
||||
struct resource *vr_res;
|
||||
int vr_refs;
|
||||
@ -194,6 +196,36 @@ vga_pci_unmap_bios(device_t dev, void *bios)
|
||||
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
|
||||
vga_pci_probe(device_t dev)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user