Lines 99-109
static uint32_t vesa_bios_offs;
Link Here
|
99 |
static uint32_t vesa_bios_int10; |
99 |
static uint32_t vesa_bios_int10; |
100 |
static size_t vesa_bios_size; |
100 |
static size_t vesa_bios_size; |
101 |
|
101 |
|
|
|
102 |
static uint16_t vesa_pci_vendor; |
103 |
#define VESA_VENDOR_NVIDIA 0x10de |
104 |
|
102 |
/* VESA video adapter */ |
105 |
/* VESA video adapter */ |
103 |
static video_adapter_t *vesa_adp; |
106 |
static video_adapter_t *vesa_adp; |
104 |
|
107 |
|
105 |
static SYSCTL_NODE(_debug, OID_AUTO, vesa, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, |
108 |
static SYSCTL_NODE(_debug, OID_AUTO, vesa, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, |
106 |
"VESA debugging"); |
109 |
"VESA debugging"); |
|
|
110 |
static int vesa_disable_post; |
111 |
SYSCTL_INT(_debug_vesa, OID_AUTO, disable_post, CTLFLAG_RDTUN, |
112 |
&vesa_disable_post, 0, "Do not try to POST video BIOS"); |
113 |
static int vesa_disable_save_state; |
114 |
SYSCTL_INT(_debug_vesa, OID_AUTO, disable_save_state, CTLFLAG_RDTUN, |
115 |
&vesa_disable_save_state, 0, "Do not save/restore video states"); |
107 |
static int vesa_shadow_rom; |
116 |
static int vesa_shadow_rom; |
108 |
SYSCTL_INT(_debug_vesa, OID_AUTO, shadow_rom, CTLFLAG_RDTUN, &vesa_shadow_rom, |
117 |
SYSCTL_INT(_debug_vesa, OID_AUTO, shadow_rom, CTLFLAG_RDTUN, &vesa_shadow_rom, |
109 |
0, "Enable video BIOS shadow"); |
118 |
0, "Enable video BIOS shadow"); |
Lines 246-265
int10_set_mode(int mode)
Link Here
|
246 |
return (0); |
255 |
return (0); |
247 |
} |
256 |
} |
248 |
|
257 |
|
249 |
static int |
258 |
static device_t |
250 |
vesa_bios_post(void) |
259 |
vesa_find_pci_device(void) |
251 |
{ |
260 |
{ |
252 |
x86regs_t regs; |
|
|
253 |
devclass_t dc; |
261 |
devclass_t dc; |
254 |
device_t *devs; |
262 |
device_t *devs; |
255 |
device_t dev; |
263 |
device_t dev; |
256 |
int count, i, is_pci; |
264 |
int count, i; |
257 |
|
|
|
258 |
if (x86bios_get_orm(vesa_bios_offs) == NULL) |
259 |
return (1); |
260 |
|
265 |
|
261 |
dev = NULL; |
266 |
dev = NULL; |
262 |
is_pci = 0; |
|
|
263 |
|
267 |
|
264 |
/* Find the matching PCI video controller. */ |
268 |
/* Find the matching PCI video controller. */ |
265 |
dc = devclass_find("vgapci"); |
269 |
dc = devclass_find("vgapci"); |
Lines 268-284
vesa_bios_post(void)
Link Here
|
268 |
if (device_get_flags(devs[i]) != 0 && |
272 |
if (device_get_flags(devs[i]) != 0 && |
269 |
x86bios_match_device(vesa_bios_offs, devs[i])) { |
273 |
x86bios_match_device(vesa_bios_offs, devs[i])) { |
270 |
dev = devs[i]; |
274 |
dev = devs[i]; |
271 |
is_pci = 1; |
|
|
272 |
break; |
275 |
break; |
273 |
} |
276 |
} |
274 |
free(devs, M_TEMP); |
277 |
free(devs, M_TEMP); |
275 |
} |
278 |
} |
|
|
279 |
if (dev != NULL && vesa_pci_vendor == 0) |
280 |
vesa_pci_vendor = pci_get_vendor(dev); |
281 |
return (dev); |
282 |
} |
283 |
|
284 |
static int |
285 |
vesa_bios_post(void) |
286 |
{ |
287 |
x86regs_t regs; |
288 |
devclass_t dc; |
289 |
device_t dev; |
290 |
int is_pci; |
291 |
|
292 |
if (vesa_disable_post != 0) |
293 |
return (1); |
294 |
|
295 |
if (x86bios_get_orm(vesa_bios_offs) == NULL) |
296 |
return (1); |
276 |
|
297 |
|
277 |
/* Try VGA if a PCI device is not found. */ |
298 |
dev = vesa_find_pci_device(); |
|
|
299 |
is_pci = dev != NULL; |
278 |
if (dev == NULL) { |
300 |
if (dev == NULL) { |
|
|
301 |
/* |
302 |
* Try VGA if a PCI device is not found. |
303 |
*/ |
279 |
dc = devclass_find(VGA_DRIVER_NAME); |
304 |
dc = devclass_find(VGA_DRIVER_NAME); |
280 |
if (dc != NULL) |
305 |
if (dc != NULL) |
281 |
dev = devclass_get_device(dc, 0); |
306 |
dev = devclass_get_device(dc, 0); |
|
|
307 |
} else { |
308 |
/* |
309 |
* XXX NVIDIA BIOS does not support BIOS POST. |
310 |
*/ |
311 |
if (vesa_pci_vendor == VESA_VENDOR_NVIDIA) |
312 |
return (1); |
282 |
} |
313 |
} |
283 |
|
314 |
|
284 |
if (bootverbose) |
315 |
if (bootverbose) |
Lines 1040-1049
vesa_bios_init(void)
Link Here
|
1040 |
|
1071 |
|
1041 |
x86bios_free(vmbuf, sizeof(*buf)); |
1072 |
x86bios_free(vmbuf, sizeof(*buf)); |
1042 |
|
1073 |
|
1043 |
/* Probe supported save/restore states. */ |
1074 |
if (vesa_disable_save_state == 0) { |
1044 |
for (i = 0; i < 4; i++) |
1075 |
/* |
1045 |
if (vesa_bios_state_buf_size(1 << i) > 0) |
1076 |
* XXX NVIDIA BIOS does not support save/restore states. |
1046 |
vesa_state |= 1 << i; |
1077 |
*/ |
|
|
1078 |
if (vesa_pci_vendor != VESA_VENDOR_NVIDIA) { |
1079 |
/* Probe supported save/restore states. */ |
1080 |
for (i = 0; i < 4; i++) |
1081 |
if (vesa_bios_state_buf_size(1 << i) > 0) |
1082 |
vesa_state |= 1 << i; |
1083 |
} |
1084 |
} |
1047 |
if (vesa_state != 0) |
1085 |
if (vesa_state != 0) |
1048 |
vesa_state_buf_size = vesa_bios_state_buf_size(vesa_state); |
1086 |
vesa_state_buf_size = vesa_bios_state_buf_size(vesa_state); |
1049 |
vesa_palette = x86bios_alloc(&vesa_palette_offs, |
1087 |
vesa_palette = x86bios_alloc(&vesa_palette_offs, |