FreeBSD Bugzilla – Attachment 223218 Details for
Bug 253733
vesa.ko: Invalid BIOS call when resuming from S3 suspend/sleep causes nvidia driver hang
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Disable POST and save/restore states on NVIDIA cards
vesa.diff (text/plain), 3.00 KB, created by
Jung-uk Kim
on 2021-03-12 19:50:19 UTC
(
hide
)
Description:
Disable POST and save/restore states on NVIDIA cards
Filename:
MIME Type:
Creator:
Jung-uk Kim
Created:
2021-03-12 19:50:19 UTC
Size:
3.00 KB
patch
obsolete
>diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c >index f1d75873f983..7fbbbfeebd84 100644 >--- a/sys/dev/fb/vesa.c >+++ b/sys/dev/fb/vesa.c >@@ -99,11 +99,20 @@ static uint32_t vesa_bios_offs; > static uint32_t vesa_bios_int10; > static size_t vesa_bios_size; > >+static uint16_t vesa_pci_vendor; >+#define VESA_VENDOR_NVIDIA 0x10de >+ > /* VESA video adapter */ > static video_adapter_t *vesa_adp; > > static SYSCTL_NODE(_debug, OID_AUTO, vesa, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, > "VESA debugging"); >+static int vesa_disable_post; >+SYSCTL_INT(_debug_vesa, OID_AUTO, disable_post, CTLFLAG_RDTUN, >+ &vesa_disable_post, 0, "Do not try to POST video BIOS"); >+static int vesa_disable_save_state; >+SYSCTL_INT(_debug_vesa, OID_AUTO, disable_save_state, CTLFLAG_RDTUN, >+ &vesa_disable_save_state, 0, "Do not save/restore video states"); > static int vesa_shadow_rom; > SYSCTL_INT(_debug_vesa, OID_AUTO, shadow_rom, CTLFLAG_RDTUN, &vesa_shadow_rom, > 0, "Enable video BIOS shadow"); >@@ -246,20 +255,15 @@ int10_set_mode(int mode) > return (0); > } > >-static int >-vesa_bios_post(void) >+static device_t >+vesa_find_pci_device(void) > { >- x86regs_t regs; > devclass_t dc; > device_t *devs; > device_t dev; >- int count, i, is_pci; >- >- if (x86bios_get_orm(vesa_bios_offs) == NULL) >- return (1); >+ int count, i; > > dev = NULL; >- is_pci = 0; > > /* Find the matching PCI video controller. */ > dc = devclass_find("vgapci"); >@@ -268,17 +272,44 @@ vesa_bios_post(void) > if (device_get_flags(devs[i]) != 0 && > x86bios_match_device(vesa_bios_offs, devs[i])) { > dev = devs[i]; >- is_pci = 1; > break; > } > free(devs, M_TEMP); > } >+ if (dev != NULL && vesa_pci_vendor == 0) >+ vesa_pci_vendor = pci_get_vendor(dev); >+ return (dev); >+} >+ >+static int >+vesa_bios_post(void) >+{ >+ x86regs_t regs; >+ devclass_t dc; >+ device_t dev; >+ int is_pci; >+ >+ if (vesa_disable_post != 0) >+ return (1); >+ >+ if (x86bios_get_orm(vesa_bios_offs) == NULL) >+ return (1); > >- /* Try VGA if a PCI device is not found. */ >+ dev = vesa_find_pci_device(); >+ is_pci = dev != NULL; > if (dev == NULL) { >+ /* >+ * Try VGA if a PCI device is not found. >+ */ > dc = devclass_find(VGA_DRIVER_NAME); > if (dc != NULL) > dev = devclass_get_device(dc, 0); >+ } else { >+ /* >+ * XXX NVIDIA BIOS does not support BIOS POST. >+ */ >+ if (vesa_pci_vendor == VESA_VENDOR_NVIDIA) >+ return (1); > } > > if (bootverbose) >@@ -1040,10 +1071,17 @@ vesa_bios_init(void) > > x86bios_free(vmbuf, sizeof(*buf)); > >- /* Probe supported save/restore states. */ >- for (i = 0; i < 4; i++) >- if (vesa_bios_state_buf_size(1 << i) > 0) >- vesa_state |= 1 << i; >+ if (vesa_disable_save_state == 0) { >+ /* >+ * XXX NVIDIA BIOS does not support save/restore states. >+ */ >+ if (vesa_pci_vendor != VESA_VENDOR_NVIDIA) { >+ /* Probe supported save/restore states. */ >+ for (i = 0; i < 4; i++) >+ if (vesa_bios_state_buf_size(1 << i) > 0) >+ vesa_state |= 1 << i; >+ } >+ } > if (vesa_state != 0) > vesa_state_buf_size = vesa_bios_state_buf_size(vesa_state); > vesa_palette = x86bios_alloc(&vesa_palette_offs,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 253733
: 223218