vesa.c (47678) | vesa.c (48104) |
---|---|
1/*- 2 * Copyright (c) 1998 Kazutaka YOKOTA and Michael Smith 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Kazutaka YOKOTA and Michael Smith 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $Id: vesa.c,v 1.23 1999/05/09 15:57:52 peter Exp $ | 26 * $Id: vesa.c,v 1.24 1999/06/01 18:20:18 jlemon Exp $ |
27 */ 28 29#include "vga.h" 30#include "opt_vga.h" 31#include "opt_vesa.h" 32#include "opt_fb.h" 33 34#ifdef VGA_NO_MODE_CHANGE 35#undef VESA 36#endif 37 38#if (NVGA > 0 && defined(VESA)) || defined(KLD_MODULE) 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/module.h> 44#include <sys/malloc.h> | 27 */ 28 29#include "vga.h" 30#include "opt_vga.h" 31#include "opt_vesa.h" 32#include "opt_fb.h" 33 34#ifdef VGA_NO_MODE_CHANGE 35#undef VESA 36#endif 37 38#if (NVGA > 0 && defined(VESA)) || defined(KLD_MODULE) 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/module.h> 44#include <sys/malloc.h> |
45#include <sys/fbio.h> 46 |
|
45#include <vm/vm.h> | 47#include <vm/vm.h> |
48#include <vm/vm_extern.h> 49#include <vm/vm_kern.h> |
|
46#include <vm/pmap.h> 47 | 50#include <vm/pmap.h> 51 |
48#include <machine/console.h> | |
49#include <machine/md_var.h> 50#include <machine/vm86.h> 51#include <machine/pc/bios.h> 52#include <machine/pc/vesa.h> 53 54#include <dev/fb/fbreg.h> 55#include <dev/fb/vgareg.h> 56 --- 13 unchanged lines hidden (view full) --- 70#define V_STATE_SIG 0x61736576 71 u_char regs[1]; 72}; 73typedef struct adp_state adp_state_t; 74 75/* VESA video adapter */ 76static video_adapter_t *vesa_adp = NULL; 77static int vesa_state_buf_size = 0; | 52#include <machine/md_var.h> 53#include <machine/vm86.h> 54#include <machine/pc/bios.h> 55#include <machine/pc/vesa.h> 56 57#include <dev/fb/fbreg.h> 58#include <dev/fb/vgareg.h> 59 --- 13 unchanged lines hidden (view full) --- 73#define V_STATE_SIG 0x61736576 74 u_char regs[1]; 75}; 76typedef struct adp_state adp_state_t; 77 78/* VESA video adapter */ 79static video_adapter_t *vesa_adp = NULL; 80static int vesa_state_buf_size = 0; |
78#if 0 79static void *vesa_state_buf = NULL; 80#endif | |
81 82/* VESA functions */ 83static int vesa_nop(void); | 81 82/* VESA functions */ 83static int vesa_nop(void); |
84static int vesa_error(void); |
|
84static vi_probe_t vesa_probe; 85static vi_init_t vesa_init; 86static vi_get_info_t vesa_get_info; 87static vi_query_mode_t vesa_query_mode; 88static vi_set_mode_t vesa_set_mode; 89static vi_save_font_t vesa_save_font; 90static vi_load_font_t vesa_load_font; 91static vi_show_font_t vesa_show_font; 92static vi_save_palette_t vesa_save_palette; 93static vi_load_palette_t vesa_load_palette; 94static vi_set_border_t vesa_set_border; 95static vi_save_state_t vesa_save_state; 96static vi_load_state_t vesa_load_state; 97static vi_set_win_org_t vesa_set_origin; 98static vi_read_hw_cursor_t vesa_read_hw_cursor; 99static vi_set_hw_cursor_t vesa_set_hw_cursor; 100static vi_set_hw_cursor_shape_t vesa_set_hw_cursor_shape; | 85static vi_probe_t vesa_probe; 86static vi_init_t vesa_init; 87static vi_get_info_t vesa_get_info; 88static vi_query_mode_t vesa_query_mode; 89static vi_set_mode_t vesa_set_mode; 90static vi_save_font_t vesa_save_font; 91static vi_load_font_t vesa_load_font; 92static vi_show_font_t vesa_show_font; 93static vi_save_palette_t vesa_save_palette; 94static vi_load_palette_t vesa_load_palette; 95static vi_set_border_t vesa_set_border; 96static vi_save_state_t vesa_save_state; 97static vi_load_state_t vesa_load_state; 98static vi_set_win_org_t vesa_set_origin; 99static vi_read_hw_cursor_t vesa_read_hw_cursor; 100static vi_set_hw_cursor_t vesa_set_hw_cursor; 101static vi_set_hw_cursor_shape_t vesa_set_hw_cursor_shape; |
102static vi_blank_display_t vesa_blank_display; |
|
101static vi_mmap_t vesa_mmap; | 103static vi_mmap_t vesa_mmap; |
104static vi_ioctl_t vesa_ioctl; 105static vi_clear_t vesa_clear; 106static vi_fill_rect_t vesa_fill_rect; 107static vi_bitblt_t vesa_bitblt; |
|
102static vi_diag_t vesa_diag; | 108static vi_diag_t vesa_diag; |
109static int vesa_bios_info(int level); |
|
103static struct vm86context vesa_vmcontext; 104 105static video_switch_t vesavidsw = { 106 vesa_probe, 107 vesa_init, 108 vesa_get_info, 109 vesa_query_mode, 110 vesa_set_mode, --- 4 unchanged lines hidden (view full) --- 115 vesa_load_palette, 116 vesa_set_border, 117 vesa_save_state, 118 vesa_load_state, 119 vesa_set_origin, 120 vesa_read_hw_cursor, 121 vesa_set_hw_cursor, 122 vesa_set_hw_cursor_shape, | 110static struct vm86context vesa_vmcontext; 111 112static video_switch_t vesavidsw = { 113 vesa_probe, 114 vesa_init, 115 vesa_get_info, 116 vesa_query_mode, 117 vesa_set_mode, --- 4 unchanged lines hidden (view full) --- 122 vesa_load_palette, 123 vesa_set_border, 124 vesa_save_state, 125 vesa_load_state, 126 vesa_set_origin, 127 vesa_read_hw_cursor, 128 vesa_set_hw_cursor, 129 vesa_set_hw_cursor_shape, |
123 (vi_blank_display_t *)vesa_nop, | 130 vesa_blank_display, |
124 vesa_mmap, | 131 vesa_mmap, |
132 vesa_ioctl, 133 vesa_clear, 134 vesa_fill_rect, 135 vesa_bitblt, 136 vesa_error, 137 vesa_error, |
|
125 vesa_diag, 126}; 127 128static video_switch_t *prevvidsw; 129 130/* VESA BIOS video modes */ 131#define VESA_MAXMODES 64 132#define EOT (-1) 133#define NA (-2) 134 | 138 vesa_diag, 139}; 140 141static video_switch_t *prevvidsw; 142 143/* VESA BIOS video modes */ 144#define VESA_MAXMODES 64 145#define EOT (-1) 146#define NA (-2) 147 |
135static video_info_t vesa_vmode[VESA_MAXMODES + 1] = { 136 { EOT, }, 137}; | 148#define MODE_TABLE_DELTA 8 |
138 | 149 |
150static int vesa_vmode_max = 0; 151static video_info_t vesa_vmode_empty = { EOT }; 152static video_info_t *vesa_vmode = &vesa_vmode_empty; 153 |
|
139static int vesa_init_done = FALSE; 140static int has_vesa_bios = FALSE; 141static struct vesa_info *vesa_adp_info = NULL; 142static u_int16_t *vesa_vmodetab = NULL; 143static char *vesa_oemstr = NULL; 144static char *vesa_venderstr = NULL; 145static char *vesa_prodstr = NULL; 146static char *vesa_revstr = NULL; 147 148/* local macros and functions */ 149#define BIOS_SADDRTOLADDR(p) ((((p) & 0xffff0000) >> 12) + ((p) & 0x0000ffff)) 150 151static int int10_set_mode(int mode); 152static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode); 153static int vesa_bios_set_mode(int mode); 154static int vesa_bios_get_dac(void); 155static int vesa_bios_set_dac(int bits); 156static int vesa_bios_save_palette(int start, int colors, u_char *palette, 157 int bits); | 154static int vesa_init_done = FALSE; 155static int has_vesa_bios = FALSE; 156static struct vesa_info *vesa_adp_info = NULL; 157static u_int16_t *vesa_vmodetab = NULL; 158static char *vesa_oemstr = NULL; 159static char *vesa_venderstr = NULL; 160static char *vesa_prodstr = NULL; 161static char *vesa_revstr = NULL; 162 163/* local macros and functions */ 164#define BIOS_SADDRTOLADDR(p) ((((p) & 0xffff0000) >> 12) + ((p) & 0x0000ffff)) 165 166static int int10_set_mode(int mode); 167static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode); 168static int vesa_bios_set_mode(int mode); 169static int vesa_bios_get_dac(void); 170static int vesa_bios_set_dac(int bits); 171static int vesa_bios_save_palette(int start, int colors, u_char *palette, 172 int bits); |
173static int vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, 174 u_char *b, int bits); |
|
158static int vesa_bios_load_palette(int start, int colors, u_char *palette, 159 int bits); | 175static int vesa_bios_load_palette(int start, int colors, u_char *palette, 176 int bits); |
177static int vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, 178 u_char *b, int bits); |
|
160#define STATE_SIZE 0 161#define STATE_SAVE 1 162#define STATE_LOAD 2 163#define STATE_HW (1<<0) 164#define STATE_DATA (1<<1) 165#define STATE_DAC (1<<2) 166#define STATE_REG (1<<3) 167#define STATE_MOST (STATE_HW | STATE_DATA | STATE_REG) 168#define STATE_ALL (STATE_HW | STATE_DATA | STATE_DAC | STATE_REG) 169static int vesa_bios_state_buf_size(void); 170static int vesa_bios_save_restore(int code, void *p, size_t size); 171static int vesa_bios_get_line_length(void); | 179#define STATE_SIZE 0 180#define STATE_SAVE 1 181#define STATE_LOAD 2 182#define STATE_HW (1<<0) 183#define STATE_DATA (1<<1) 184#define STATE_DAC (1<<2) 185#define STATE_REG (1<<3) 186#define STATE_MOST (STATE_HW | STATE_DATA | STATE_REG) 187#define STATE_ALL (STATE_HW | STATE_DATA | STATE_DAC | STATE_REG) 188static int vesa_bios_state_buf_size(void); 189static int vesa_bios_save_restore(int code, void *p, size_t size); 190static int vesa_bios_get_line_length(void); |
191static int vesa_bios_set_line_length(int pixel); 192static int vesa_bios_get_start(int *x, int *y); 193static int vesa_bios_set_start(int x, int y); |
|
172static int vesa_map_gen_mode_num(int type, int color, int mode); 173static int vesa_translate_flags(u_int16_t vflags); | 194static int vesa_map_gen_mode_num(int type, int color, int mode); 195static int vesa_translate_flags(u_int16_t vflags); |
196static int vesa_translate_mmodel(u_int8_t vmodel); |
|
174static void *vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, 175 u_char *buf); 176static int vesa_bios_init(void); 177static void vesa_clear_modes(video_info_t *info, int color); | 197static void *vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, 198 u_char *buf); 199static int vesa_bios_init(void); 200static void vesa_clear_modes(video_info_t *info, int color); |
201static vm_offset_t vesa_map_buffer(u_int paddr, size_t size); 202static void vesa_unmap_buffer(vm_offset_t vaddr, size_t size); |
|
178 | 203 |
204static int vesa_get_origin(video_adapter_t *adp, off_t *offset); 205 |
|
179static void 180dump_buffer(u_char *buf, size_t len) 181{ 182 int i; 183 184 for(i = 0; i < len;) { 185 printf("%02x ", buf[i]); 186 if ((++i % 16) == 0) --- 102 unchanged lines hidden (view full) --- 289 palette[i*3] = p[i*4 + 2] << bits; 290 palette[i*3 + 1] = p[i*4 + 1] << bits; 291 palette[i*3 + 2] = p[i*4] << bits; 292 } 293 return 0; 294} 295 296static int | 206static void 207dump_buffer(u_char *buf, size_t len) 208{ 209 int i; 210 211 for(i = 0; i < len;) { 212 printf("%02x ", buf[i]); 213 if ((++i % 16) == 0) --- 102 unchanged lines hidden (view full) --- 316 palette[i*3] = p[i*4 + 2] << bits; 317 palette[i*3 + 1] = p[i*4 + 1] << bits; 318 palette[i*3 + 2] = p[i*4] << bits; 319 } 320 return 0; 321} 322 323static int |
324vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, 325 int bits) 326{ 327 struct vm86frame vmf; 328 u_char *p; 329 int err; 330 int i; 331 332 bzero(&vmf, sizeof(vmf)); 333 vmf.vmf_eax = 0x4f09; 334 vmf.vmf_ebx = 1; /* get primary palette data */ 335 vmf.vmf_ecx = colors; 336 vmf.vmf_edx = start; 337 p = (u_char *)vm86_getpage(&vesa_vmcontext, 1); 338 vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di); 339 340 err = vm86_datacall(0x10, &vmf, &vesa_vmcontext); 341 if ((err != 0) || (vmf.vmf_eax != 0x4f)) 342 return 1; 343 344 bits = 8 - bits; 345 for (i = 0; i < colors; ++i) { 346 r[i] = p[i*4 + 2] << bits; 347 g[i] = p[i*4 + 1] << bits; 348 b[i] = p[i*4] << bits; 349 } 350 return 0; 351} 352 353static int |
|
297vesa_bios_load_palette(int start, int colors, u_char *palette, int bits) 298{ 299 struct vm86frame vmf; 300 u_char *p; 301 int err; 302 int i; 303 304 p = (u_char *)vm86_getpage(&vesa_vmcontext, 1); --- 12 unchanged lines hidden (view full) --- 317 vmf.vmf_edx = start; 318 vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di); 319 320 err = vm86_datacall(0x10, &vmf, &vesa_vmcontext); 321 return ((err != 0) || (vmf.vmf_eax != 0x4f)); 322} 323 324static int | 354vesa_bios_load_palette(int start, int colors, u_char *palette, int bits) 355{ 356 struct vm86frame vmf; 357 u_char *p; 358 int err; 359 int i; 360 361 p = (u_char *)vm86_getpage(&vesa_vmcontext, 1); --- 12 unchanged lines hidden (view full) --- 374 vmf.vmf_edx = start; 375 vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di); 376 377 err = vm86_datacall(0x10, &vmf, &vesa_vmcontext); 378 return ((err != 0) || (vmf.vmf_eax != 0x4f)); 379} 380 381static int |
382vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, 383 int bits) 384{ 385 struct vm86frame vmf; 386 u_char *p; 387 int err; 388 int i; 389 390 p = (u_char *)vm86_getpage(&vesa_vmcontext, 1); 391 bits = 8 - bits; 392 for (i = 0; i < colors; ++i) { 393 p[i*4] = b[i] >> bits; 394 p[i*4 + 1] = g[i] >> bits; 395 p[i*4 + 2] = r[i] >> bits; 396 p[i*4 + 3] = 0; 397 } 398 399 bzero(&vmf, sizeof(vmf)); 400 vmf.vmf_eax = 0x4f09; 401 vmf.vmf_ebx = 0; /* set primary palette data */ 402 vmf.vmf_ecx = colors; 403 vmf.vmf_edx = start; 404 vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di); 405 406 err = vm86_datacall(0x10, &vmf, &vesa_vmcontext); 407 return ((err != 0) || (vmf.vmf_eax != 0x4f)); 408} 409 410static int |
|
325vesa_bios_state_buf_size(void) 326{ 327 struct vm86frame vmf; 328 int err; 329 330 bzero(&vmf, sizeof(vmf)); 331 vmf.vmf_eax = 0x4f04; 332 vmf.vmf_ecx = STATE_MOST; --- 33 unchanged lines hidden (view full) --- 366 vmf.vmf_eax = 0x4f06; 367 vmf.vmf_ebx = 1; /* get scan line length */ 368 err = vm86_intcall(0x10, &vmf); 369 if ((err != 0) || (vmf.vmf_eax != 0x4f)) 370 return -1; 371 return vmf.vmf_bx; /* line length in bytes */ 372} 373 | 411vesa_bios_state_buf_size(void) 412{ 413 struct vm86frame vmf; 414 int err; 415 416 bzero(&vmf, sizeof(vmf)); 417 vmf.vmf_eax = 0x4f04; 418 vmf.vmf_ecx = STATE_MOST; --- 33 unchanged lines hidden (view full) --- 452 vmf.vmf_eax = 0x4f06; 453 vmf.vmf_ebx = 1; /* get scan line length */ 454 err = vm86_intcall(0x10, &vmf); 455 if ((err != 0) || (vmf.vmf_eax != 0x4f)) 456 return -1; 457 return vmf.vmf_bx; /* line length in bytes */ 458} 459 |
460static int 461vesa_bios_set_line_length(int pixel) 462{ 463 struct vm86frame vmf; 464 int err; 465 466 bzero(&vmf, sizeof(vmf)); 467 vmf.vmf_eax = 0x4f06; 468 vmf.vmf_ebx = 0; /* set scan line length in pixel */ 469 vmf.vmf_ecx = pixel; 470 err = vm86_intcall(0x10, &vmf); 471#if VESA_DEBUG > 1 472 printf("bx:%d, cx:%d, dx:%d\n", vmf.vmf_bx, vmf.vmf_cx, vmf.vmf_dx); 473#endif 474 return ((err != 0) || (vmf.vmf_eax != 0x4f)); 475} 476 477static int 478vesa_bios_get_start(int *x, int *y) 479{ 480 struct vm86frame vmf; 481 int err; 482 483 bzero(&vmf, sizeof(vmf)); 484 vmf.vmf_eax = 0x4f07; 485 vmf.vmf_ebx = 1; /* get display start */ 486 err = vm86_intcall(0x10, &vmf); 487 if ((err != 0) || (vmf.vmf_eax != 0x4f)) 488 return 1; 489 *x = vmf.vmf_cx; 490 *y = vmf.vmf_dx; 491 return 0; 492} 493 494static int 495vesa_bios_set_start(int x, int y) 496{ 497 struct vm86frame vmf; 498 int err; 499 500 bzero(&vmf, sizeof(vmf)); 501 vmf.vmf_eax = 0x4f07; 502 vmf.vmf_ebx = 0x80; /* set display start */ 503 vmf.vmf_edx = y; 504 vmf.vmf_ecx = x; 505 err = vm86_intcall(0x10, &vmf); 506 return ((err != 0) || (vmf.vmf_eax != 0x4f)); 507} 508 |
|
374/* map a generic video mode to a known mode */ 375static int 376vesa_map_gen_mode_num(int type, int color, int mode) 377{ 378 static struct { 379 int from; 380 int to; 381 } mode_map[] = { --- 28 unchanged lines hidden (view full) --- 410 411 for (flags = 0, i = 0; i < sizeof(ftable)/sizeof(ftable[0]); ++i) { 412 flags |= (vflags & ftable[i].mask) ? 413 ftable[i].set : ftable[i].reset; 414 } 415 return flags; 416} 417 | 509/* map a generic video mode to a known mode */ 510static int 511vesa_map_gen_mode_num(int type, int color, int mode) 512{ 513 static struct { 514 int from; 515 int to; 516 } mode_map[] = { --- 28 unchanged lines hidden (view full) --- 545 546 for (flags = 0, i = 0; i < sizeof(ftable)/sizeof(ftable[0]); ++i) { 547 flags |= (vflags & ftable[i].mask) ? 548 ftable[i].set : ftable[i].reset; 549 } 550 return flags; 551} 552 |
553static int 554vesa_translate_mmodel(u_int8_t vmodel) 555{ 556 static struct { 557 u_int8_t vmodel; 558 int mmodel; 559 } mtable[] = { 560 { V_MMTEXT, V_INFO_MM_TEXT }, 561 { V_MMCGA, V_INFO_MM_CGA }, 562 { V_MMHGC, V_INFO_MM_HGC }, 563 { V_MMEGA, V_INFO_MM_PLANAR }, 564 { V_MMPACKED, V_INFO_MM_PACKED }, 565 { V_MMDIRCOLOR, V_INFO_MM_DIRECT }, 566 }; 567 int i; 568 569 for (i = 0; mtable[i].mmodel >= 0; ++i) { 570 if (mtable[i].vmodel == vmodel) 571 return mtable[i].mmodel; 572 } 573 return V_INFO_MM_OTHER; 574} 575 |
|
418static void 419*vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, u_char *buf) 420{ 421 if (p == 0) 422 return NULL; 423 if (((p >> 16) == seg) && ((p & 0xffff) >= off)) 424 return (void *)(buf + ((p & 0xffff) - off)); 425 else { 426 p = BIOS_SADDRTOLADDR(p); 427 return (void *)BIOS_PADDRTOVADDR(p); 428 } 429} 430 431static int 432vesa_bios_init(void) 433{ 434 static u_char buf[512]; 435 struct vm86frame vmf; 436 struct vesa_mode vmode; | 576static void 577*vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, u_char *buf) 578{ 579 if (p == 0) 580 return NULL; 581 if (((p >> 16) == seg) && ((p & 0xffff) >= off)) 582 return (void *)(buf + ((p & 0xffff) - off)); 583 else { 584 p = BIOS_SADDRTOLADDR(p); 585 return (void *)BIOS_PADDRTOVADDR(p); 586 } 587} 588 589static int 590vesa_bios_init(void) 591{ 592 static u_char buf[512]; 593 struct vm86frame vmf; 594 struct vesa_mode vmode; |
595 video_info_t *p; |
|
437 u_char *vmbuf; 438 int modes; 439 int err; 440 int i; 441 442 if (vesa_init_done) 443 return 0; 444 445 has_vesa_bios = FALSE; 446 vesa_adp_info = NULL; | 596 u_char *vmbuf; 597 int modes; 598 int err; 599 int i; 600 601 if (vesa_init_done) 602 return 0; 603 604 has_vesa_bios = FALSE; 605 vesa_adp_info = NULL; |
606 vesa_vmode_max = 0; |
|
447 vesa_vmode[0].vi_mode = EOT; 448 449 vmbuf = (u_char *)vm86_addpage(&vesa_vmcontext, 1, 0); 450 bzero(&vmf, sizeof(vmf)); /* paranoia */ 451 bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */ 452 vmf.vmf_eax = 0x4f00; 453 vm86_getptr(&vesa_vmcontext, (vm_offset_t)vmbuf, &vmf.vmf_es, &vmf.vmf_di); 454 455 err = vm86_datacall(0x10, &vmf, &vesa_vmcontext); 456 if ((err != 0) || (vmf.vmf_eax != 0x4f) || bcmp("VESA", vmbuf, 4)) 457 return 1; 458 bcopy(vmbuf, buf, sizeof(buf)); 459 vesa_adp_info = (struct vesa_info *)buf; 460 if (bootverbose) { 461 printf("VESA: information block\n"); 462 dump_buffer(buf, 64); 463 } 464 if (vesa_adp_info->v_flags & V_NONVGA) 465 return 1; | 607 vesa_vmode[0].vi_mode = EOT; 608 609 vmbuf = (u_char *)vm86_addpage(&vesa_vmcontext, 1, 0); 610 bzero(&vmf, sizeof(vmf)); /* paranoia */ 611 bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */ 612 vmf.vmf_eax = 0x4f00; 613 vm86_getptr(&vesa_vmcontext, (vm_offset_t)vmbuf, &vmf.vmf_es, &vmf.vmf_di); 614 615 err = vm86_datacall(0x10, &vmf, &vesa_vmcontext); 616 if ((err != 0) || (vmf.vmf_eax != 0x4f) || bcmp("VESA", vmbuf, 4)) 617 return 1; 618 bcopy(vmbuf, buf, sizeof(buf)); 619 vesa_adp_info = (struct vesa_info *)buf; 620 if (bootverbose) { 621 printf("VESA: information block\n"); 622 dump_buffer(buf, 64); 623 } 624 if (vesa_adp_info->v_flags & V_NONVGA) 625 return 1; |
626 if (vesa_adp_info->v_version < 0x0102) { 627 printf("VESA: VBE version %d.%d is not supported; " 628 "version 1.2 or later is required.\n", 629 ((vesa_adp_info->v_version & 0xf000) >> 12) * 10 630 + ((vesa_adp_info->v_version & 0x0f00) >> 8), 631 ((vesa_adp_info->v_version & 0x00f0) >> 4) * 10 632 + (vesa_adp_info->v_version & 0x000f)); 633 return 1; 634 } |
|
466 467 /* fix string ptrs */ 468 vesa_oemstr = (char *)vesa_fix_ptr(vesa_adp_info->v_oemstr, 469 vmf.vmf_es, vmf.vmf_di, buf); 470 if (vesa_adp_info->v_version >= 0x0200) { 471 vesa_venderstr = 472 (char *)vesa_fix_ptr(vesa_adp_info->v_venderstr, 473 vmf.vmf_es, vmf.vmf_di, buf); 474 vesa_prodstr = 475 (char *)vesa_fix_ptr(vesa_adp_info->v_prodstr, 476 vmf.vmf_es, vmf.vmf_di, buf); 477 vesa_revstr = 478 (char *)vesa_fix_ptr(vesa_adp_info->v_revstr, 479 vmf.vmf_es, vmf.vmf_di, buf); 480 } 481 482 /* obtain video mode information */ | 635 636 /* fix string ptrs */ 637 vesa_oemstr = (char *)vesa_fix_ptr(vesa_adp_info->v_oemstr, 638 vmf.vmf_es, vmf.vmf_di, buf); 639 if (vesa_adp_info->v_version >= 0x0200) { 640 vesa_venderstr = 641 (char *)vesa_fix_ptr(vesa_adp_info->v_venderstr, 642 vmf.vmf_es, vmf.vmf_di, buf); 643 vesa_prodstr = 644 (char *)vesa_fix_ptr(vesa_adp_info->v_prodstr, 645 vmf.vmf_es, vmf.vmf_di, buf); 646 vesa_revstr = 647 (char *)vesa_fix_ptr(vesa_adp_info->v_revstr, 648 vmf.vmf_es, vmf.vmf_di, buf); 649 } 650 651 /* obtain video mode information */ |
483 vesa_vmode[0].vi_mode = EOT; | |
484 vesa_vmodetab = (u_int16_t *)vesa_fix_ptr(vesa_adp_info->v_modetable, 485 vmf.vmf_es, vmf.vmf_di, buf); 486 if (vesa_vmodetab == NULL) 487 return 1; 488 for (i = 0, modes = 0; 489 (i < (M_VESA_MODE_MAX - M_VESA_BASE + 1)) 490 && (vesa_vmodetab[i] != 0xffff); ++i) { | 652 vesa_vmodetab = (u_int16_t *)vesa_fix_ptr(vesa_adp_info->v_modetable, 653 vmf.vmf_es, vmf.vmf_di, buf); 654 if (vesa_vmodetab == NULL) 655 return 1; 656 for (i = 0, modes = 0; 657 (i < (M_VESA_MODE_MAX - M_VESA_BASE + 1)) 658 && (vesa_vmodetab[i] != 0xffff); ++i) { |
491 if (modes >= VESA_MAXMODES) 492 break; | |
493 if (vesa_bios_get_mode(vesa_vmodetab[i], &vmode)) 494 continue; 495 496 /* reject unsupported modes */ 497#if 0 498 if ((vmode.v_modeattr & (V_MODESUPP | V_MODEOPTINFO 499 | V_MODENONVGA)) 500 != (V_MODESUPP | V_MODEOPTINFO)) 501 continue; 502#else 503 if ((vmode.v_modeattr & (V_MODEOPTINFO | V_MODENONVGA)) 504 != (V_MODEOPTINFO)) 505 continue; 506#endif 507 | 659 if (vesa_bios_get_mode(vesa_vmodetab[i], &vmode)) 660 continue; 661 662 /* reject unsupported modes */ 663#if 0 664 if ((vmode.v_modeattr & (V_MODESUPP | V_MODEOPTINFO 665 | V_MODENONVGA)) 666 != (V_MODESUPP | V_MODEOPTINFO)) 667 continue; 668#else 669 if ((vmode.v_modeattr & (V_MODEOPTINFO | V_MODENONVGA)) 670 != (V_MODEOPTINFO)) 671 continue; 672#endif 673 |
674 /* expand the array if necessary */ 675 if (modes >= vesa_vmode_max) { 676 vesa_vmode_max += MODE_TABLE_DELTA; 677 p = malloc(sizeof(*vesa_vmode)*(vesa_vmode_max + 1), 678 M_DEVBUF, M_WAITOK); 679#if VESA_DEBUG > 1 680 printf("vesa_bios_init(): modes:%d, vesa_mode_max:%d\n", 681 modes, vesa_mode_max); 682#endif 683 if (modes > 0) { 684 bcopy(vesa_vmode, p, sizeof(*vesa_vmode)*modes); 685 free(vesa_vmode, M_DEVBUF); 686 } 687 vesa_vmode = p; 688 } 689 |
|
508 /* copy some fields */ 509 bzero(&vesa_vmode[modes], sizeof(vesa_vmode[modes])); 510 vesa_vmode[modes].vi_mode = vesa_vmodetab[i]; 511 vesa_vmode[modes].vi_width = vmode.v_width; 512 vesa_vmode[modes].vi_height = vmode.v_height; 513 vesa_vmode[modes].vi_depth = vmode.v_bpp; 514 vesa_vmode[modes].vi_planes = vmode.v_planes; 515 vesa_vmode[modes].vi_cwidth = vmode.v_cwidth; 516 vesa_vmode[modes].vi_cheight = vmode.v_cheight; 517 vesa_vmode[modes].vi_window = (u_int)vmode.v_waseg << 4; 518 /* XXX window B */ 519 vesa_vmode[modes].vi_window_size = vmode.v_wsize*1024; 520 vesa_vmode[modes].vi_window_gran = vmode.v_wgran*1024; | 690 /* copy some fields */ 691 bzero(&vesa_vmode[modes], sizeof(vesa_vmode[modes])); 692 vesa_vmode[modes].vi_mode = vesa_vmodetab[i]; 693 vesa_vmode[modes].vi_width = vmode.v_width; 694 vesa_vmode[modes].vi_height = vmode.v_height; 695 vesa_vmode[modes].vi_depth = vmode.v_bpp; 696 vesa_vmode[modes].vi_planes = vmode.v_planes; 697 vesa_vmode[modes].vi_cwidth = vmode.v_cwidth; 698 vesa_vmode[modes].vi_cheight = vmode.v_cheight; 699 vesa_vmode[modes].vi_window = (u_int)vmode.v_waseg << 4; 700 /* XXX window B */ 701 vesa_vmode[modes].vi_window_size = vmode.v_wsize*1024; 702 vesa_vmode[modes].vi_window_gran = vmode.v_wgran*1024; |
521 vesa_vmode[modes].vi_buffer = vmode.v_lfb; | 703 if (vmode.v_modeattr & V_MODELFB) 704 vesa_vmode[modes].vi_buffer = vmode.v_lfb; 705 else 706 vesa_vmode[modes].vi_buffer = 0; |
522 /* XXX */ | 707 /* XXX */ |
708 vesa_vmode[modes].vi_buffer_size 709 = vesa_adp_info->v_memsize*64*1024; 710#if 0 |
|
523 if (vmode.v_offscreen > vmode.v_lfb) 524 vesa_vmode[modes].vi_buffer_size | 711 if (vmode.v_offscreen > vmode.v_lfb) 712 vesa_vmode[modes].vi_buffer_size |
525 = vmode.v_offscreen - vmode.v_lfb; | 713 = vmode.v_offscreen + vmode.v_offscreensize*1024 714 - vmode.v_lfb; |
526 else | 715 else |
527 vesa_vmode[modes].vi_buffer_size = vmode.v_offscreen; 528 /* pixel format, memory model... */ 529 | 716 vesa_vmode[modes].vi_buffer_size 717 = vmode.v_offscreen + vmode.v_offscreensize*1024 718#endif 719 vesa_vmode[modes].vi_mem_model 720 = vesa_translate_mmodel(vmode.v_memmodel); 721 vesa_vmode[modes].vi_pixel_fields[0] = 0; 722 vesa_vmode[modes].vi_pixel_fields[1] = 0; 723 vesa_vmode[modes].vi_pixel_fields[2] = 0; 724 vesa_vmode[modes].vi_pixel_fields[3] = 0; 725 vesa_vmode[modes].vi_pixel_fsizes[0] = 0; 726 vesa_vmode[modes].vi_pixel_fsizes[1] = 0; 727 vesa_vmode[modes].vi_pixel_fsizes[2] = 0; 728 vesa_vmode[modes].vi_pixel_fsizes[3] = 0; 729 if (vesa_vmode[modes].vi_mem_model == V_INFO_MM_PACKED) { 730 vesa_vmode[modes].vi_pixel_size = (vmode.v_bpp + 7)/8; 731 } else if (vesa_vmode[modes].vi_mem_model == V_INFO_MM_DIRECT) { 732 vesa_vmode[modes].vi_pixel_size = (vmode.v_bpp + 7)/8; 733 vesa_vmode[modes].vi_pixel_fields[0] 734 = vmode.v_redfieldpos; 735 vesa_vmode[modes].vi_pixel_fields[1] 736 = vmode.v_greenfieldpos; 737 vesa_vmode[modes].vi_pixel_fields[2] 738 = vmode.v_bluefieldpos; 739 vesa_vmode[modes].vi_pixel_fields[3] 740 = vmode.v_resfieldpos; 741 vesa_vmode[modes].vi_pixel_fsizes[0] 742 = vmode.v_redmasksize; 743 vesa_vmode[modes].vi_pixel_fsizes[1] 744 = vmode.v_greenmasksize; 745 vesa_vmode[modes].vi_pixel_fsizes[2] 746 = vmode.v_bluemasksize; 747 vesa_vmode[modes].vi_pixel_fsizes[3] 748 = vmode.v_resmasksize; 749 } else { 750 vesa_vmode[modes].vi_pixel_size = 0; 751 } 752 |
530 vesa_vmode[modes].vi_flags 531 = vesa_translate_flags(vmode.v_modeattr) | V_INFO_VESA; 532 ++modes; 533 } 534 vesa_vmode[modes].vi_mode = EOT; 535 if (bootverbose) 536 printf("VESA: %d mode(s) found\n", modes); 537 --- 6 unchanged lines hidden (view full) --- 544{ 545 while (info->vi_mode != EOT) { 546 if ((info->vi_flags & V_INFO_COLOR) != color) 547 info->vi_mode = NA; 548 ++info; 549 } 550} 551 | 753 vesa_vmode[modes].vi_flags 754 = vesa_translate_flags(vmode.v_modeattr) | V_INFO_VESA; 755 ++modes; 756 } 757 vesa_vmode[modes].vi_mode = EOT; 758 if (bootverbose) 759 printf("VESA: %d mode(s) found\n", modes); 760 --- 6 unchanged lines hidden (view full) --- 767{ 768 while (info->vi_mode != EOT) { 769 if ((info->vi_flags & V_INFO_COLOR) != color) 770 info->vi_mode = NA; 771 ++info; 772 } 773} 774 |
775static vm_offset_t 776vesa_map_buffer(u_int paddr, size_t size) 777{ 778 vm_offset_t vaddr; 779 u_int off; 780 781 off = paddr - trunc_page(paddr); 782 vaddr = (vm_offset_t)pmap_mapdev(paddr - off, size + off); 783#if VESA_DEBUG > 1 784 printf("vesa_map_buffer: paddr:%x vaddr:%x size:%x off:%x\n", 785 paddr, vaddr, size, off); 786#endif 787 return (vaddr + off); 788} 789 790static void 791vesa_unmap_buffer(vm_offset_t vaddr, size_t size) 792{ 793#if VESA_DEBUG > 1 794 printf("vesa_unmap_buffer: vaddr:%x size:%x\n", vaddr, size); 795#endif 796 kmem_free(kernel_map, vaddr, size); 797} 798 |
|
552/* entry points */ 553 554static int 555vesa_configure(int flags) 556{ 557 video_adapter_t *adp; 558 int adapters; 559 int error; --- 59 unchanged lines hidden (view full) --- 619 620static int 621vesa_nop(void) 622{ 623 return 0; 624} 625 626static int | 799/* entry points */ 800 801static int 802vesa_configure(int flags) 803{ 804 video_adapter_t *adp; 805 int adapters; 806 int error; --- 59 unchanged lines hidden (view full) --- 866 867static int 868vesa_nop(void) 869{ 870 return 0; 871} 872 873static int |
874vesa_error(void) 875{ 876 return 1; 877} 878 879static int |
|
627vesa_probe(int unit, video_adapter_t **adpp, void *arg, int flags) 628{ 629 return (*prevvidsw->probe)(unit, adpp, arg, flags); 630} 631 632static int 633vesa_init(int unit, video_adapter_t *adp, int flags) 634{ --- 61 unchanged lines hidden (view full) --- 696 } 697 return -1; 698} 699 700static int 701vesa_set_mode(video_adapter_t *adp, int mode) 702{ 703 video_info_t info; | 880vesa_probe(int unit, video_adapter_t **adpp, void *arg, int flags) 881{ 882 return (*prevvidsw->probe)(unit, adpp, arg, flags); 883} 884 885static int 886vesa_init(int unit, video_adapter_t *adp, int flags) 887{ --- 61 unchanged lines hidden (view full) --- 949 } 950 return -1; 951} 952 953static int 954vesa_set_mode(video_adapter_t *adp, int mode) 955{ 956 video_info_t info; |
704 size_t len; | 957 int len; |
705 706 if (adp != vesa_adp) 707 return (*prevvidsw->set_mode)(adp, mode); 708 | 958 959 if (adp != vesa_adp) 960 return (*prevvidsw->set_mode)(adp, mode); 961 |
709 mode = vesa_map_gen_mode_num(vesa_adp->va_type, 710 vesa_adp->va_flags & V_ADP_COLOR, mode); | 962 mode = vesa_map_gen_mode_num(adp->va_type, 963 adp->va_flags & V_ADP_COLOR, mode); |
711#if VESA_DEBUG > 0 712 printf("VESA: set_mode(): %d(%x) -> %d(%x)\n", | 964#if VESA_DEBUG > 0 965 printf("VESA: set_mode(): %d(%x) -> %d(%x)\n", |
713 vesa_adp->va_mode, vesa_adp->va_mode, mode, mode); | 966 adp->va_mode, adp->va_mode, mode, mode); |
714#endif 715 /* 716 * If the current mode is a VESA mode and the new mode is not, | 967#endif 968 /* 969 * If the current mode is a VESA mode and the new mode is not, |
717 * restore the state of the adapter first, so that non-standard, 718 * extended SVGA registers are set to the state compatible with 719 * the standard VGA modes. Otherwise (*prevvidsw->set_mode)() 720 * may not be able to set up the new mode correctly. | 970 * restore the state of the adapter first by setting one of the 971 * standard VGA mode, so that non-standard, extended SVGA registers 972 * are set to the state compatible with the standard VGA modes. 973 * Otherwise (*prevvidsw->set_mode)() may not be able to set up 974 * the new mode correctly. |
721 */ | 975 */ |
722 if (VESA_MODE(vesa_adp->va_mode)) { | 976 if (VESA_MODE(adp->va_mode)) { |
723 if ((*prevvidsw->get_info)(adp, mode, &info) == 0) { | 977 if ((*prevvidsw->get_info)(adp, mode, &info) == 0) { |
724 int10_set_mode(vesa_adp->va_initial_bios_mode); 725#if 0 726 /* assert(vesa_state_buf != NULL); */ 727 if ((vesa_state_buf == NULL) 728 || vesa_load_state(adp, vesa_state_buf)) 729 return 1; 730 free(vesa_state_buf, M_DEVBUF); 731 vesa_state_buf = NULL; 732#if VESA_DEBUG > 0 733 printf("VESA: restored\n"); 734#endif 735#endif /* 0 */ | 978 int10_set_mode(adp->va_initial_bios_mode); 979 if (adp->va_info.vi_flags & V_INFO_LINEAR) 980 vesa_unmap_buffer(adp->va_buffer, 981 vesa_adp_info->v_memsize*64*1024); 982 /* 983 * Once (*prevvidsw->get_info)() succeeded, 984 * (*prevvidsw->set_mode)() below won't fail... 985 */ |
736 } | 986 } |
737 /* 738 * once (*prevvidsw->get_info)() succeeded, 739 * (*prevvidsw->set_mode)() below won't fail... 740 */ | |
741 } 742 743 /* we may not need to handle this mode after all... */ 744 if ((*prevvidsw->set_mode)(adp, mode) == 0) 745 return 0; 746 747 /* is the new mode supported? */ 748 if (vesa_get_info(adp, mode, &info)) 749 return 1; 750 /* assert(VESA_MODE(mode)); */ 751 752#if VESA_DEBUG > 0 753 printf("VESA: about to set a VESA mode...\n"); 754#endif | 987 } 988 989 /* we may not need to handle this mode after all... */ 990 if ((*prevvidsw->set_mode)(adp, mode) == 0) 991 return 0; 992 993 /* is the new mode supported? */ 994 if (vesa_get_info(adp, mode, &info)) 995 return 1; 996 /* assert(VESA_MODE(mode)); */ 997 998#if VESA_DEBUG > 0 999 printf("VESA: about to set a VESA mode...\n"); 1000#endif |
755 /* 756 * If the current mode is not a VESA mode, save the current state 757 * so that the adapter state can be restored later when a non-VESA 758 * mode is to be set up. See above. 759 */ 760#if 0 761 if (!VESA_MODE(vesa_adp->va_mode) && (vesa_state_buf == NULL)) { 762 len = vesa_save_state(adp, NULL, 0); 763 vesa_state_buf = malloc(len, M_DEVBUF, M_WAITOK); 764 if (vesa_save_state(adp, vesa_state_buf, len)) { 765#if VESA_DEBUG > 0 766 printf("VESA: state save failed! (len=%d)\n", len); 767#endif 768 free(vesa_state_buf, M_DEVBUF); 769 vesa_state_buf = NULL; 770 return 1; 771 } 772#if VESA_DEBUG > 0 773 printf("VESA: saved (len=%d)\n", len); 774 dump_buffer(vesa_state_buf, len); 775#endif 776 } 777#endif /* 0 */ | 1001 /* don't use the linear frame buffer for text modes. XXX */ 1002 if (!(info.vi_flags & V_INFO_GRAPHICS)) 1003 info.vi_flags &= ~V_INFO_LINEAR; |
778 | 1004 |
779 if (vesa_bios_set_mode(mode)) | 1005 if (vesa_bios_set_mode(mode | ((info.vi_flags & V_INFO_LINEAR) ? 0x4000 : 0))) |
780 return 1; 781 | 1006 return 1; 1007 |
1008 if (adp->va_info.vi_flags & V_INFO_LINEAR) 1009 vesa_unmap_buffer(adp->va_buffer, 1010 vesa_adp_info->v_memsize*64*1024); 1011 |
|
782#if VESA_DEBUG > 0 783 printf("VESA: mode set!\n"); 784#endif 785 vesa_adp->va_mode = mode; 786 vesa_adp->va_flags &= ~V_ADP_COLOR; 787 vesa_adp->va_flags |= 788 (info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0; 789 vesa_adp->va_crtc_addr = 790 (vesa_adp->va_flags & V_ADP_COLOR) ? COLOR_CRTC : MONO_CRTC; | 1012#if VESA_DEBUG > 0 1013 printf("VESA: mode set!\n"); 1014#endif 1015 vesa_adp->va_mode = mode; 1016 vesa_adp->va_flags &= ~V_ADP_COLOR; 1017 vesa_adp->va_flags |= 1018 (info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0; 1019 vesa_adp->va_crtc_addr = 1020 (vesa_adp->va_flags & V_ADP_COLOR) ? COLOR_CRTC : MONO_CRTC; |
791 vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window); 792 vesa_adp->va_window_size = info.vi_window_size; 793 vesa_adp->va_window_gran = info.vi_window_gran; 794 if (info.vi_buffer_size == 0) { 795 vesa_adp->va_buffer = 0; 796 vesa_adp->va_buffer_size = 0; | 1021 if (info.vi_flags & V_INFO_LINEAR) { 1022#if VESA_DEBUG > 1 1023 printf("VESA: setting up LFB\n"); 1024#endif 1025 vesa_adp->va_buffer = 1026 vesa_map_buffer(info.vi_buffer, 1027 vesa_adp_info->v_memsize*64*1024); 1028 vesa_adp->va_buffer_size = info.vi_buffer_size; 1029 vesa_adp->va_window = vesa_adp->va_buffer; 1030 vesa_adp->va_window_size = info.vi_buffer_size/info.vi_planes; 1031 vesa_adp->va_window_gran = info.vi_buffer_size/info.vi_planes; |
797 } else { | 1032 } else { |
798 vesa_adp->va_buffer = BIOS_PADDRTOVADDR(info.vi_buffer); | 1033 vesa_adp->va_buffer = 0; |
799 vesa_adp->va_buffer_size = info.vi_buffer_size; | 1034 vesa_adp->va_buffer_size = info.vi_buffer_size; |
1035 vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window); 1036 vesa_adp->va_window_size = info.vi_window_size; 1037 vesa_adp->va_window_gran = info.vi_window_gran; |
|
800 } | 1038 } |
1039 vesa_adp->va_window_orig = 0; |
|
801 len = vesa_bios_get_line_length(); 802 if (len > 0) { 803 vesa_adp->va_line_width = len; 804 } else if (info.vi_flags & V_INFO_GRAPHICS) { 805 switch (info.vi_depth/info.vi_planes) { 806 case 1: 807 vesa_adp->va_line_width = info.vi_width/8; 808 break; --- 6 unchanged lines hidden (view full) --- 815 case 8: 816 default: /* shouldn't happen */ 817 vesa_adp->va_line_width = info.vi_width; 818 break; 819 } 820 } else { 821 vesa_adp->va_line_width = info.vi_width; 822 } | 1040 len = vesa_bios_get_line_length(); 1041 if (len > 0) { 1042 vesa_adp->va_line_width = len; 1043 } else if (info.vi_flags & V_INFO_GRAPHICS) { 1044 switch (info.vi_depth/info.vi_planes) { 1045 case 1: 1046 vesa_adp->va_line_width = info.vi_width/8; 1047 break; --- 6 unchanged lines hidden (view full) --- 1054 case 8: 1055 default: /* shouldn't happen */ 1056 vesa_adp->va_line_width = info.vi_width; 1057 break; 1058 } 1059 } else { 1060 vesa_adp->va_line_width = info.vi_width; 1061 } |
1062 vesa_adp->va_disp_start.x = 0; 1063 vesa_adp->va_disp_start.y = 0; |
|
823#if VESA_DEBUG > 0 824 printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d\n", 825 info.vi_width, len, vesa_adp->va_line_width); 826#endif 827 bcopy(&info, &vesa_adp->va_info, sizeof(vesa_adp->va_info)); 828 829 /* move hardware cursor out of the way */ 830 (*vidsw[vesa_adp->va_index]->set_hw_cursor)(vesa_adp, -1, -1); --- 91 unchanged lines hidden (view full) --- 922 if ((adp != vesa_adp) || (((adp_state_t *)p)->sig != V_STATE_SIG)) 923 return (*prevvidsw->load_state)(adp, p); 924 925 return vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs, 926 vesa_state_buf_size); 927} 928 929static int | 1064#if VESA_DEBUG > 0 1065 printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d\n", 1066 info.vi_width, len, vesa_adp->va_line_width); 1067#endif 1068 bcopy(&info, &vesa_adp->va_info, sizeof(vesa_adp->va_info)); 1069 1070 /* move hardware cursor out of the way */ 1071 (*vidsw[vesa_adp->va_index]->set_hw_cursor)(vesa_adp, -1, -1); --- 91 unchanged lines hidden (view full) --- 1163 if ((adp != vesa_adp) || (((adp_state_t *)p)->sig != V_STATE_SIG)) 1164 return (*prevvidsw->load_state)(adp, p); 1165 1166 return vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs, 1167 vesa_state_buf_size); 1168} 1169 1170static int |
1171vesa_get_origin(video_adapter_t *adp, off_t *offset) 1172{ 1173 struct vm86frame vmf; 1174 int err; 1175 1176 bzero(&vmf, sizeof(vmf)); 1177 vmf.vmf_eax = 0x4f05; 1178 vmf.vmf_ebx = 0x10; /* WINDOW_A, XXX */ 1179 err = vm86_intcall(0x10, &vmf); 1180 if ((err != 0) || (vmf.vmf_eax != 0x4f)) 1181 return 1; 1182 *offset = vmf.vmf_dx*adp->va_window_gran; 1183 return 0; 1184} 1185 1186static int |
|
930vesa_set_origin(video_adapter_t *adp, off_t offset) 931{ 932 struct vm86frame vmf; 933 int err; 934 935 /* 936 * This function should return as quickly as possible to 937 * maintain good performance of the system. For this reason, 938 * error checking is kept minimal and let the VESA BIOS to 939 * detect error. 940 */ 941 if (adp != vesa_adp) 942 return (*prevvidsw->set_win_org)(adp, offset); 943 | 1187vesa_set_origin(video_adapter_t *adp, off_t offset) 1188{ 1189 struct vm86frame vmf; 1190 int err; 1191 1192 /* 1193 * This function should return as quickly as possible to 1194 * maintain good performance of the system. For this reason, 1195 * error checking is kept minimal and let the VESA BIOS to 1196 * detect error. 1197 */ 1198 if (adp != vesa_adp) 1199 return (*prevvidsw->set_win_org)(adp, offset); 1200 |
944 if (vesa_adp->va_window_gran == 0) | 1201 /* if this is a linear frame buffer, do nothing */ 1202 if (adp->va_info.vi_flags & V_INFO_LINEAR) 1203 return 0; 1204 /* XXX */ 1205 if (adp->va_window_gran == 0) |
945 return 1; | 1206 return 1; |
1207 |
|
946 bzero(&vmf, sizeof(vmf)); 947 vmf.vmf_eax = 0x4f05; 948 vmf.vmf_ebx = 0; /* WINDOW_A, XXX */ | 1208 bzero(&vmf, sizeof(vmf)); 1209 vmf.vmf_eax = 0x4f05; 1210 vmf.vmf_ebx = 0; /* WINDOW_A, XXX */ |
949 vmf.vmf_edx = offset/vesa_adp->va_window_gran; | 1211 vmf.vmf_edx = offset/adp->va_window_gran; |
950 err = vm86_intcall(0x10, &vmf); 951 if ((err != 0) || (vmf.vmf_eax != 0x4f)) 952 return 1; 953 bzero(&vmf, sizeof(vmf)); 954 vmf.vmf_eax = 0x4f05; 955 vmf.vmf_ebx = 1; /* WINDOW_B, XXX */ | 1212 err = vm86_intcall(0x10, &vmf); 1213 if ((err != 0) || (vmf.vmf_eax != 0x4f)) 1214 return 1; 1215 bzero(&vmf, sizeof(vmf)); 1216 vmf.vmf_eax = 0x4f05; 1217 vmf.vmf_ebx = 1; /* WINDOW_B, XXX */ |
956 vmf.vmf_edx = offset/vesa_adp->va_window_gran; | 1218 vmf.vmf_edx = offset/adp->va_window_gran; |
957 err = vm86_intcall(0x10, &vmf); | 1219 err = vm86_intcall(0x10, &vmf); |
1220 adp->va_window_orig = (offset/adp->va_window_gran)*adp->va_window_gran; |
|
958 return 0; /* XXX */ 959} 960 961static int 962vesa_read_hw_cursor(video_adapter_t *adp, int *col, int *row) 963{ 964 return (*prevvidsw->read_hw_cursor)(adp, col, row); 965} --- 8 unchanged lines hidden (view full) --- 974vesa_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, 975 int celsize, int blink) 976{ 977 return (*prevvidsw->set_hw_cursor_shape)(adp, base, height, celsize, 978 blink); 979} 980 981static int | 1221 return 0; /* XXX */ 1222} 1223 1224static int 1225vesa_read_hw_cursor(video_adapter_t *adp, int *col, int *row) 1226{ 1227 return (*prevvidsw->read_hw_cursor)(adp, col, row); 1228} --- 8 unchanged lines hidden (view full) --- 1237vesa_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, 1238 int celsize, int blink) 1239{ 1240 return (*prevvidsw->set_hw_cursor_shape)(adp, base, height, celsize, 1241 blink); 1242} 1243 1244static int |
982vesa_mmap(video_adapter_t *adp, vm_offset_t offset) | 1245vesa_blank_display(video_adapter_t *adp, int mode) |
983{ | 1246{ |
984 return (*prevvidsw->mmap)(adp, offset); | 1247 /* XXX: use VESA DPMS */ 1248 return (*prevvidsw->blank_display)(adp, mode); |
985} 986 987static int | 1249} 1250 1251static int |
988vesa_diag(video_adapter_t *adp, int level) | 1252vesa_mmap(video_adapter_t *adp, vm_offset_t offset, int prot) |
989{ | 1253{ |
990#if VESA_DEBUG > 1 991 struct vesa_mode vmode; 992 int i; | 1254#if VESA_DEBUG > 0 1255 printf("vesa_mmap(): window:0x%x, buffer:0x%x, offset:0x%x\n", 1256 adp->va_info.vi_window, adp->va_info.vi_buffer, offset); |
993#endif 994 | 1257#endif 1258 |
995 if (adp != vesa_adp) | 1259 if ((adp == vesa_adp) && (adp->va_info.vi_flags & V_INFO_LINEAR)) { 1260 /* va_window_size == va_buffer_size/vi_planes */ 1261 /* XXX: is this correct? */ 1262 if (offset > adp->va_window_size - PAGE_SIZE) 1263 return -1; 1264#ifdef __i386__ 1265 return i386_btop(adp->va_info.vi_buffer + offset); 1266#endif 1267#ifdef __alpha__ /* XXX */ 1268 return alpha_btop(adp->va_info.vi_buffer + offset); 1269#endif 1270 } else { 1271 return (*prevvidsw->mmap)(adp, offset, prot); 1272 } 1273} 1274 1275static int 1276vesa_clear(video_adapter_t *adp) 1277{ 1278 return (*prevvidsw->clear)(adp); 1279} 1280 1281static int 1282vesa_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) 1283{ 1284 return (*prevvidsw->fill_rect)(adp, val, x, y, cx, cy); 1285} 1286 1287static int 1288vesa_bitblt(video_adapter_t *adp,...) 1289{ 1290 /* FIXME */ 1291 return 1; 1292} 1293 1294static int 1295get_palette(video_adapter_t *adp, int base, int count, 1296 u_char *red, u_char *green, u_char *blue, u_char *trans) 1297{ 1298 u_char *r; 1299 u_char *g; 1300 u_char *b; 1301 int bits; 1302 int error; 1303 1304 if ((base < 0) || (base >= 256) || (base + count > 256)) |
996 return 1; | 1305 return 1; |
1306 if (!(vesa_adp_info->v_flags & V_DAC8) || !VESA_MODE(adp->va_mode)) 1307 return 1; |
|
997 | 1308 |
998#ifndef KLD_MODULE | 1309 bits = vesa_bios_get_dac(); 1310 if (bits <= 6) 1311 return 1; 1312 1313 r = malloc(count*3, M_DEVBUF, M_WAITOK); 1314 g = r + count; 1315 b = g + count; 1316 error = vesa_bios_save_palette2(base, count, r, g, b, bits); 1317 if (error == 0) { 1318 copyout(r, red, count); 1319 copyout(g, green, count); 1320 copyout(b, blue, count); 1321 if (trans != NULL) { 1322 bzero(r, count); 1323 copyout(r, trans, count); 1324 } 1325 } 1326 free(r, M_DEVBUF); 1327 1328 /* if error && bits != 6 at this point, we are in in trouble... XXX */ 1329 return error; 1330} 1331 1332static int 1333set_palette(video_adapter_t *adp, int base, int count, 1334 u_char *red, u_char *green, u_char *blue, u_char *trans) 1335{ 1336 return 1; 1337#if notyet 1338 u_char *r; 1339 u_char *g; 1340 u_char *b; 1341 int bits; 1342 int error; 1343 1344 if ((base < 0) || (base >= 256) || (base + count > 256)) 1345 return 1; 1346 if (!(vesa_adp_info->v_flags & V_DAC8) || !VESA_MODE(adp->va_mode) 1347 || ((bits = vesa_bios_set_dac(8)) <= 6)) 1348 return 1; 1349 1350 r = malloc(count*3, M_DEVBUF, M_WAITOK); 1351 g = r + count; 1352 b = g + count; 1353 copyin(red, r, count); 1354 copyin(green, g, count); 1355 copyin(blue, b, count); 1356 1357 error = vesa_bios_load_palette2(base, count, r, g, b, bits); 1358 free(r, M_DEVBUF); 1359 if (error == 0) 1360 return 0; 1361 1362 /* if the following call fails, we are in trouble... XXX */ 1363 vesa_bios_set_dac(6); 1364 return 1; 1365#endif /* notyet */ 1366} 1367 1368static int 1369vesa_ioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) 1370{ 1371 if (adp != vesa_adp) 1372 return (*prevvidsw->ioctl)(adp, cmd, arg); 1373 1374 switch (cmd) { 1375 case FBIO_SETWINORG: /* set frame buffer window origin */ 1376 return (vesa_set_origin(adp, *(off_t *)arg) ? ENODEV : 0); 1377 1378 case FBIO_SETDISPSTART: /* set display start address */ 1379 if (vesa_bios_set_start(((video_display_start_t *)arg)->x, 1380 ((video_display_start_t *)arg)->y)) 1381 return ENODEV; 1382 adp->va_disp_start.x = ((video_display_start_t *)arg)->x; 1383 adp->va_disp_start.y = ((video_display_start_t *)arg)->y; 1384 return 0; 1385 1386 case FBIO_SETLINEWIDTH: /* set line length in pixel */ 1387 if (vesa_bios_set_line_length(*(u_int *)arg)) 1388 return ENODEV; 1389 adp->va_line_width = (*(u_int *)arg + 7)/8; 1390 return 0; 1391 1392 case FBIO_GETPALETTE: /* get color palette */ 1393 if (get_palette(adp, ((video_color_palette_t *)arg)->index, 1394 ((video_color_palette_t *)arg)->count, 1395 ((video_color_palette_t *)arg)->red, 1396 ((video_color_palette_t *)arg)->green, 1397 ((video_color_palette_t *)arg)->blue, 1398 ((video_color_palette_t *)arg)->transparent)) 1399 return (*prevvidsw->ioctl)(adp, cmd, arg); 1400 return 0; 1401 1402 1403 case FBIO_SETPALETTE: /* set color palette */ 1404 if (set_palette(adp, ((video_color_palette_t *)arg)->index, 1405 ((video_color_palette_t *)arg)->count, 1406 ((video_color_palette_t *)arg)->red, 1407 ((video_color_palette_t *)arg)->green, 1408 ((video_color_palette_t *)arg)->blue, 1409 ((video_color_palette_t *)arg)->transparent)) 1410 return (*prevvidsw->ioctl)(adp, cmd, arg); 1411 return 0; 1412 1413 case FBIOGETCMAP: /* get color palette */ 1414 if (get_palette(adp, ((struct fbcmap *)arg)->index, 1415 ((struct fbcmap *)arg)->count, 1416 ((struct fbcmap *)arg)->red, 1417 ((struct fbcmap *)arg)->green, 1418 ((struct fbcmap *)arg)->blue, NULL)) 1419 return (*prevvidsw->ioctl)(adp, cmd, arg); 1420 return 0; 1421 1422 case FBIOPUTCMAP: /* set color palette */ 1423 if (set_palette(adp, ((struct fbcmap *)arg)->index, 1424 ((struct fbcmap *)arg)->count, 1425 ((struct fbcmap *)arg)->red, 1426 ((struct fbcmap *)arg)->green, 1427 ((struct fbcmap *)arg)->blue, NULL)) 1428 return (*prevvidsw->ioctl)(adp, cmd, arg); 1429 return 0; 1430 1431 default: 1432 return (*prevvidsw->ioctl)(adp, cmd, arg); 1433 } 1434} 1435 1436static int 1437vesa_diag(video_adapter_t *adp, int level) 1438{ 1439 int error; 1440 |
999 /* call the previous handler first */ | 1441 /* call the previous handler first */ |
1000 (*prevvidsw->diag)(adp, level); | 1442 error = (*prevvidsw->diag)(adp, level); 1443 if (error) 1444 return error; 1445 1446 if (adp != vesa_adp) 1447 return 1; 1448 1449 if (level <= 0) 1450 return 0; 1451 1452 return 0; 1453} 1454 1455static int 1456vesa_bios_info(int level) 1457{ 1458#if VESA_DEBUG > 1 1459 struct vesa_mode vmode; 1460 int i; |
1001#endif 1002 1003 /* general adapter information */ 1004 printf("VESA: v%d.%d, %dk memory, flags:0x%x, mode table:%p (%x)\n", 1005 ((vesa_adp_info->v_version & 0xf000) >> 12) * 10 1006 + ((vesa_adp_info->v_version & 0x0f00) >> 8), 1007 ((vesa_adp_info->v_version & 0x00f0) >> 4) * 10 1008 + (vesa_adp_info->v_version & 0x000f), 1009 vesa_adp_info->v_memsize * 64, vesa_adp_info->v_flags, 1010 vesa_vmodetab, vesa_adp_info->v_modetable); 1011 /* OEM string */ 1012 if (vesa_oemstr != NULL) 1013 printf("VESA: %s\n", vesa_oemstr); 1014 1015 if (level <= 0) 1016 return 0; 1017 1018 if (vesa_adp_info->v_version >= 0x0200) { | 1461#endif 1462 1463 /* general adapter information */ 1464 printf("VESA: v%d.%d, %dk memory, flags:0x%x, mode table:%p (%x)\n", 1465 ((vesa_adp_info->v_version & 0xf000) >> 12) * 10 1466 + ((vesa_adp_info->v_version & 0x0f00) >> 8), 1467 ((vesa_adp_info->v_version & 0x00f0) >> 4) * 10 1468 + (vesa_adp_info->v_version & 0x000f), 1469 vesa_adp_info->v_memsize * 64, vesa_adp_info->v_flags, 1470 vesa_vmodetab, vesa_adp_info->v_modetable); 1471 /* OEM string */ 1472 if (vesa_oemstr != NULL) 1473 printf("VESA: %s\n", vesa_oemstr); 1474 1475 if (level <= 0) 1476 return 0; 1477 1478 if (vesa_adp_info->v_version >= 0x0200) { |
1019 /* vendor name */ 1020 if (vesa_venderstr != NULL) 1021 printf("VESA: %s\n", vesa_venderstr); 1022 /* product name */ 1023 if (vesa_prodstr != NULL) 1024 printf("VESA: %s\n", vesa_prodstr); 1025 /* product revision */ 1026 if (vesa_revstr != NULL) 1027 printf("VESA: %s\n", vesa_revstr); | 1479 /* vender name, product name, product revision */ 1480 printf("VESA: %s %s %s\n", 1481 (vesa_venderstr != NULL) ? vesa_venderstr : "unknown", 1482 (vesa_prodstr != NULL) ? vesa_prodstr : "unknown", 1483 (vesa_revstr != NULL) ? vesa_revstr : "?"); |
1028 } 1029 1030#if VESA_DEBUG > 1 1031 /* mode information */ 1032 for (i = 0; 1033 (i < (M_VESA_MODE_MAX - M_VESA_BASE + 1)) 1034 && (vesa_vmodetab[i] != 0xffff); ++i) { 1035 if (vesa_bios_get_mode(vesa_vmodetab[i], &vmode)) --- 6 unchanged lines hidden (view full) --- 1042 if (vmode.v_modeattr & V_MODEGRAPHICS) { 1043 printf(", G %dx%dx%d %d, ", 1044 vmode.v_width, vmode.v_height, 1045 vmode.v_bpp, vmode.v_planes); 1046 } else { 1047 printf(", T %dx%d, ", 1048 vmode.v_width, vmode.v_height); 1049 } | 1484 } 1485 1486#if VESA_DEBUG > 1 1487 /* mode information */ 1488 for (i = 0; 1489 (i < (M_VESA_MODE_MAX - M_VESA_BASE + 1)) 1490 && (vesa_vmodetab[i] != 0xffff); ++i) { 1491 if (vesa_bios_get_mode(vesa_vmodetab[i], &vmode)) --- 6 unchanged lines hidden (view full) --- 1498 if (vmode.v_modeattr & V_MODEGRAPHICS) { 1499 printf(", G %dx%dx%d %d, ", 1500 vmode.v_width, vmode.v_height, 1501 vmode.v_bpp, vmode.v_planes); 1502 } else { 1503 printf(", T %dx%d, ", 1504 vmode.v_width, vmode.v_height); 1505 } |
1050 printf("font:%dx%d", | 1506 printf("font:%dx%d, ", |
1051 vmode.v_cwidth, vmode.v_cheight); | 1507 vmode.v_cwidth, vmode.v_cheight); |
1508 printf("pages:%d, mem:%d", 1509 vmode.v_ipages + 1, vmode.v_memmodel); |
|
1052 } 1053 if (vmode.v_modeattr & V_MODELFB) { | 1510 } 1511 if (vmode.v_modeattr & V_MODELFB) { |
1054 printf(", mem:%d, LFB:0x%x, off:0x%x", 1055 vmode.v_memmodel, vmode.v_lfb, 1056 vmode.v_offscreen); | 1512 printf("\nVESA: LFB:0x%x, off:0x%x, off_size:0x%x", 1513 vmode.v_lfb, vmode.v_offscreen, 1514 vmode.v_offscreensize*1024); |
1057 } 1058 printf("\n"); 1059 printf("VESA: window A:0x%x (%x), window B:0x%x (%x), ", 1060 vmode.v_waseg, vmode.v_waattr, 1061 vmode.v_wbseg, vmode.v_wbattr); 1062 printf("size:%dk, gran:%dk\n", 1063 vmode.v_wsize, vmode.v_wgran); 1064 } | 1515 } 1516 printf("\n"); 1517 printf("VESA: window A:0x%x (%x), window B:0x%x (%x), ", 1518 vmode.v_waseg, vmode.v_waattr, 1519 vmode.v_wbseg, vmode.v_wbattr); 1520 printf("size:%dk, gran:%dk\n", 1521 vmode.v_wsize, vmode.v_wgran); 1522 } |
1065#endif | 1523#endif /* VESA_DEBUG > 1 */ |
1066 1067 return 0; 1068} 1069 1070/* module loading */ 1071 1072static int 1073vesa_load(void) --- 5 unchanged lines hidden (view full) --- 1079 return 0; 1080 1081 /* locate a VGA adapter */ 1082 s = spltty(); 1083 vesa_adp = NULL; 1084 error = vesa_configure(0); 1085 splx(s); 1086 | 1524 1525 return 0; 1526} 1527 1528/* module loading */ 1529 1530static int 1531vesa_load(void) --- 5 unchanged lines hidden (view full) --- 1537 return 0; 1538 1539 /* locate a VGA adapter */ 1540 s = spltty(); 1541 vesa_adp = NULL; 1542 error = vesa_configure(0); 1543 splx(s); 1544 |
1087#ifdef KLD_MODULE | |
1088 if (error == 0) | 1545 if (error == 0) |
1089 vesa_diag(vesa_adp, bootverbose); 1090#endif | 1546 vesa_bios_info(bootverbose); |
1091 1092 return error; 1093} 1094 | 1547 1548 return error; 1549} 1550 |
1551#ifdef KLD_MODULE 1552 |
|
1095static int 1096vesa_unload(void) 1097{ 1098 u_char palette[256*3]; 1099 int error; 1100 int bits; 1101 int s; 1102 --- 22 unchanged lines hidden (view full) --- 1125 vidsw[vesa_adp->va_index] = prevvidsw; 1126 } 1127 } 1128 splx(s); 1129 1130 return error; 1131} 1132 | 1553static int 1554vesa_unload(void) 1555{ 1556 u_char palette[256*3]; 1557 int error; 1558 int bits; 1559 int s; 1560 --- 22 unchanged lines hidden (view full) --- 1583 vidsw[vesa_adp->va_index] = prevvidsw; 1584 } 1585 } 1586 splx(s); 1587 1588 return error; 1589} 1590 |
1591#endif /* KLD_MODULE */ 1592 |
|
1133static int 1134vesa_mod_event(module_t mod, int type, void *data) 1135{ 1136 switch (type) { 1137 case MOD_LOAD: 1138 return vesa_load(); 1139 case MOD_UNLOAD: | 1593static int 1594vesa_mod_event(module_t mod, int type, void *data) 1595{ 1596 switch (type) { 1597 case MOD_LOAD: 1598 return vesa_load(); 1599 case MOD_UNLOAD: |
1600#ifdef KLD_MODULE |
|
1140 return vesa_unload(); | 1601 return vesa_unload(); |
1602#else 1603 return EBUSY; 1604#endif |
|
1141 default: 1142 break; 1143 } 1144 return 0; 1145} 1146 1147static moduledata_t vesa_mod = { 1148 "vesa", 1149 vesa_mod_event, 1150 NULL, 1151}; 1152 1153DECLARE_MODULE(vesa, vesa_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); 1154 1155#endif /* (NVGA > 0 && VESA) || KLD_MODULE */ | 1605 default: 1606 break; 1607 } 1608 return 0; 1609} 1610 1611static moduledata_t vesa_mod = { 1612 "vesa", 1613 vesa_mod_event, 1614 NULL, 1615}; 1616 1617DECLARE_MODULE(vesa, vesa_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); 1618 1619#endif /* (NVGA > 0 && VESA) || KLD_MODULE */ |