vesa.c (197444) | vesa.c (197466) |
---|---|
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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> | 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/fb/vesa.c 197444 2009-09-23 20:49:14Z jkim $"); | 28__FBSDID("$FreeBSD: head/sys/dev/fb/vesa.c 197466 2009-09-24 19:24:42Z jkim $"); |
29 30#include "opt_vga.h" 31#include "opt_vesa.h" 32 33#ifndef VGA_NO_MODE_CHANGE 34 35#include <sys/param.h> 36#include <sys/systm.h> --- 182 unchanged lines hidden (view full) --- 219static int 220int10_set_mode(int mode) 221{ 222 x86regs_t regs; 223 224 bzero(®s, sizeof(regs)); 225 regs.R_EAX = 0x0000 | mode; 226 | 29 30#include "opt_vga.h" 31#include "opt_vesa.h" 32 33#ifndef VGA_NO_MODE_CHANGE 34 35#include <sys/param.h> 36#include <sys/systm.h> --- 182 unchanged lines hidden (view full) --- 219static int 220int10_set_mode(int mode) 221{ 222 x86regs_t regs; 223 224 bzero(®s, sizeof(regs)); 225 regs.R_EAX = 0x0000 | mode; 226 |
227 x86biosCall(®s, 0x10); | 227 x86bios_intr(®s, 0x10); |
228 229 return 0; 230} 231 232/* VESA BIOS calls */ 233static int 234vesa_bios_get_mode(int mode, struct vesa_mode *vmode) 235{ 236 x86regs_t regs; 237 int offs; 238 u_char *buf; 239 240 bzero(®s, sizeof(regs)); 241 regs.R_EAX = 0x4f01; 242 regs.R_ECX = mode; 243 | 228 229 return 0; 230} 231 232/* VESA BIOS calls */ 233static int 234vesa_bios_get_mode(int mode, struct vesa_mode *vmode) 235{ 236 x86regs_t regs; 237 int offs; 238 u_char *buf; 239 240 bzero(®s, sizeof(regs)); 241 regs.R_EAX = 0x4f01; 242 regs.R_ECX = mode; 243 |
244 buf = (u_char *)x86biosAlloc(1, &offs); | 244 buf = (u_char *)x86bios_alloc(1, &offs); |
245 246 regs.R_ES = SEG_ADDR(offs); 247 regs.R_DI = SEG_OFF(offs); 248 | 245 246 regs.R_ES = SEG_ADDR(offs); 247 regs.R_DI = SEG_OFF(offs); 248 |
249 x86biosCall(®s, 0x10); | 249 x86bios_intr(®s, 0x10); |
250 251 if ((regs.R_AX & 0xff) != 0x4f) 252 { | 250 251 if ((regs.R_AX & 0xff) != 0x4f) 252 { |
253 x86biosFree(buf, 1); | 253 x86bios_free(buf, 1); |
254 return 1; 255 } 256 257 bcopy(buf, vmode, sizeof(*vmode)); | 254 return 1; 255 } 256 257 bcopy(buf, vmode, sizeof(*vmode)); |
258 x86biosFree(buf, 1); | 258 x86bios_free(buf, 1); |
259 260 return 0; 261} 262 263static int 264vesa_bios_set_mode(int mode) 265{ 266 x86regs_t regs; 267 268 bzero(®s, sizeof(regs)); 269 regs.R_EAX = 0x4f02; 270 regs.R_EBX = mode; 271 | 259 260 return 0; 261} 262 263static int 264vesa_bios_set_mode(int mode) 265{ 266 x86regs_t regs; 267 268 bzero(®s, sizeof(regs)); 269 regs.R_EAX = 0x4f02; 270 regs.R_EBX = mode; 271 |
272 x86biosCall(®s, 0x10); | 272 x86bios_intr(®s, 0x10); |
273 274 return ((regs.R_AX & 0xff) != 0x4f); 275} 276 277static int 278vesa_bios_get_dac(void) 279{ 280 x86regs_t regs; 281 282 bzero(®s, sizeof(regs)); 283 regs.R_EAX = 0x4f08; 284 regs.R_EBX = 1; 285 | 273 274 return ((regs.R_AX & 0xff) != 0x4f); 275} 276 277static int 278vesa_bios_get_dac(void) 279{ 280 x86regs_t regs; 281 282 bzero(®s, sizeof(regs)); 283 regs.R_EAX = 0x4f08; 284 regs.R_EBX = 1; 285 |
286 x86biosCall(®s, 0x10); | 286 x86bios_intr(®s, 0x10); |
287 288 if ((regs.R_AX & 0xff) != 0x4f) 289 return 6; 290 291 return ((regs.R_EBX >> 8) & 0x00ff); 292} 293 294static int 295vesa_bios_set_dac(int bits) 296{ 297 x86regs_t regs; 298 299 bzero(®s, sizeof(regs)); 300 regs.R_EAX = 0x4f08; 301 regs.R_EBX = (bits << 8); 302 | 287 288 if ((regs.R_AX & 0xff) != 0x4f) 289 return 6; 290 291 return ((regs.R_EBX >> 8) & 0x00ff); 292} 293 294static int 295vesa_bios_set_dac(int bits) 296{ 297 x86regs_t regs; 298 299 bzero(®s, sizeof(regs)); 300 regs.R_EAX = 0x4f08; 301 regs.R_EBX = (bits << 8); 302 |
303 x86biosCall(®s, 0x10); | 303 x86bios_intr(®s, 0x10); |
304 305 if ((regs.R_AX & 0xff) != 0x4f) 306 return 6; 307 308 return ((regs.R_EBX >> 8) & 0x00ff); 309} 310 311static int --- 5 unchanged lines hidden (view full) --- 317 int i; 318 319 bzero(®s, sizeof(regs)); 320 regs.R_EAX = 0x4f09; 321 regs.R_EBX = 1; 322 regs.R_ECX = colors; 323 regs.R_EDX = start; 324 | 304 305 if ((regs.R_AX & 0xff) != 0x4f) 306 return 6; 307 308 return ((regs.R_EBX >> 8) & 0x00ff); 309} 310 311static int --- 5 unchanged lines hidden (view full) --- 317 int i; 318 319 bzero(®s, sizeof(regs)); 320 regs.R_EAX = 0x4f09; 321 regs.R_EBX = 1; 322 regs.R_ECX = colors; 323 regs.R_EDX = start; 324 |
325 p = (u_char *)x86biosAlloc(1, &offs); | 325 p = (u_char *)x86bios_alloc(1, &offs); |
326 327 regs.R_ES = SEG_ADDR(offs); 328 regs.R_DI = SEG_OFF(offs); 329 | 326 327 regs.R_ES = SEG_ADDR(offs); 328 regs.R_DI = SEG_OFF(offs); 329 |
330 x86biosCall(®s, 0x10); | 330 x86bios_intr(®s, 0x10); |
331 332 if ((regs.R_AX & 0xff) != 0x4f) 333 { | 331 332 if ((regs.R_AX & 0xff) != 0x4f) 333 { |
334 x86biosFree(p, 1); | 334 x86bios_free(p, 1); |
335 return 1; 336 } 337 338 bits = 8 - bits; 339 for (i = 0; i < colors; ++i) { 340 palette[i*3] = p[i*4 + 2] << bits; 341 palette[i*3 + 1] = p[i*4 + 1] << bits; 342 palette[i*3 + 2] = p[i*4] << bits; 343 } 344 | 335 return 1; 336 } 337 338 bits = 8 - bits; 339 for (i = 0; i < colors; ++i) { 340 palette[i*3] = p[i*4 + 2] << bits; 341 palette[i*3 + 1] = p[i*4 + 1] << bits; 342 palette[i*3 + 2] = p[i*4] << bits; 343 } 344 |
345 x86biosFree(p, 1); | 345 x86bios_free(p, 1); |
346 return 0; 347} 348 349static int 350vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, 351 int bits) 352{ 353 x86regs_t regs; 354 int offs; 355 u_char *p; 356 int i; 357 358 bzero(®s, sizeof(regs)); 359 regs.R_EAX = 0x4f09; 360 regs.R_EBX = 1; 361 regs.R_ECX = colors; 362 regs.R_EDX = start; 363 | 346 return 0; 347} 348 349static int 350vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, 351 int bits) 352{ 353 x86regs_t regs; 354 int offs; 355 u_char *p; 356 int i; 357 358 bzero(®s, sizeof(regs)); 359 regs.R_EAX = 0x4f09; 360 regs.R_EBX = 1; 361 regs.R_ECX = colors; 362 regs.R_EDX = start; 363 |
364 p = (u_char *)x86biosAlloc(1, &offs); | 364 p = (u_char *)x86bios_alloc(1, &offs); |
365 366 regs.R_ES = SEG_ADDR(offs); 367 regs.R_DI = SEG_OFF(offs); 368 | 365 366 regs.R_ES = SEG_ADDR(offs); 367 regs.R_DI = SEG_OFF(offs); 368 |
369 x86biosCall(®s, 0x10); | 369 x86bios_intr(®s, 0x10); |
370 371 if ((regs.R_AX & 0xff) != 0x4f) 372 { | 370 371 if ((regs.R_AX & 0xff) != 0x4f) 372 { |
373 x86biosFree(p, 1); | 373 x86bios_free(p, 1); |
374 return 1; 375 } 376 377 bits = 8 - bits; 378 for (i = 0; i < colors; ++i) { 379 r[i] = p[i*4 + 2] << bits; 380 g[i] = p[i*4 + 1] << bits; 381 b[i] = p[i*4] << bits; 382 } 383 | 374 return 1; 375 } 376 377 bits = 8 - bits; 378 for (i = 0; i < colors; ++i) { 379 r[i] = p[i*4 + 2] << bits; 380 g[i] = p[i*4 + 1] << bits; 381 b[i] = p[i*4] << bits; 382 } 383 |
384 x86biosFree(p, 1); | 384 x86bios_free(p, 1); |
385 return 0; 386} 387 388static int 389vesa_bios_load_palette(int start, int colors, u_char *palette, int bits) 390{ 391 x86regs_t regs; 392 int offs; 393 u_char *p; 394 int i; 395 | 385 return 0; 386} 387 388static int 389vesa_bios_load_palette(int start, int colors, u_char *palette, int bits) 390{ 391 x86regs_t regs; 392 int offs; 393 u_char *p; 394 int i; 395 |
396 p = (u_char *)x86biosAlloc(1, &offs); | 396 p = (u_char *)x86bios_alloc(1, &offs); |
397 398 bits = 8 - bits; 399 for (i = 0; i < colors; ++i) { 400 p[i*4] = palette[i*3 + 2] >> bits; 401 p[i*4 + 1] = palette[i*3 + 1] >> bits; 402 p[i*4 + 2] = palette[i*3] >> bits; 403 p[i*4 + 3] = 0; 404 } 405 406 bzero(®s, sizeof(regs)); 407 regs.R_EAX = 0x4f09; 408 regs.R_EBX = 0; 409 regs.R_ECX = colors; 410 regs.R_EDX = start; 411 412 regs.R_ES = SEG_ADDR(offs); 413 regs.R_DI = SEG_OFF(offs); 414 | 397 398 bits = 8 - bits; 399 for (i = 0; i < colors; ++i) { 400 p[i*4] = palette[i*3 + 2] >> bits; 401 p[i*4 + 1] = palette[i*3 + 1] >> bits; 402 p[i*4 + 2] = palette[i*3] >> bits; 403 p[i*4 + 3] = 0; 404 } 405 406 bzero(®s, sizeof(regs)); 407 regs.R_EAX = 0x4f09; 408 regs.R_EBX = 0; 409 regs.R_ECX = colors; 410 regs.R_EDX = start; 411 412 regs.R_ES = SEG_ADDR(offs); 413 regs.R_DI = SEG_OFF(offs); 414 |
415 x86biosCall(®s, 0x10); | 415 x86bios_intr(®s, 0x10); |
416 | 416 |
417 x86biosFree(p, 1); | 417 x86bios_free(p, 1); |
418 419 return ((regs.R_AX & 0xff) != 0x4f); 420} 421 422#ifdef notyet 423static int 424vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, 425 int bits) 426{ 427 x86regs_t regs; 428 int offs; 429 u_char *p; 430 int i; 431 | 418 419 return ((regs.R_AX & 0xff) != 0x4f); 420} 421 422#ifdef notyet 423static int 424vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b, 425 int bits) 426{ 427 x86regs_t regs; 428 int offs; 429 u_char *p; 430 int i; 431 |
432 p = (u_char *)x86biosAlloc(1, &offs); | 432 p = (u_char *)x86bios_alloc(1, &offs); |
433 434 bits = 8 - bits; 435 for (i = 0; i < colors; ++i) { 436 p[i*4] = b[i] >> bits; 437 p[i*4 + 1] = g[i] >> bits; 438 p[i*4 + 2] = r[i] >> bits; 439 p[i*4 + 3] = 0; 440 } 441 442 bzero(®s, sizeof(regs)); 443 regs.R_EAX = 0x4f09; 444 regs.R_EBX = 0; 445 regs.R_ECX = colors; 446 regs.R_EDX = start; 447 448 regs.R_ES = SEG_ADDR(offs); 449 regs.R_DI = SEG_OFF(offs); 450 | 433 434 bits = 8 - bits; 435 for (i = 0; i < colors; ++i) { 436 p[i*4] = b[i] >> bits; 437 p[i*4 + 1] = g[i] >> bits; 438 p[i*4 + 2] = r[i] >> bits; 439 p[i*4 + 3] = 0; 440 } 441 442 bzero(®s, sizeof(regs)); 443 regs.R_EAX = 0x4f09; 444 regs.R_EBX = 0; 445 regs.R_ECX = colors; 446 regs.R_EDX = start; 447 448 regs.R_ES = SEG_ADDR(offs); 449 regs.R_DI = SEG_OFF(offs); 450 |
451 x86biosCall(®s, 0x10); | 451 x86bios_intr(®s, 0x10); |
452 | 452 |
453 x86biosFree(p, 1); | 453 x86bios_free(p, 1); |
454 455 return ((regs.R_AX & 0xff) != 0x4f); 456} 457#endif 458 459static int 460vesa_bios_state_buf_size(void) 461{ 462 x86regs_t regs; 463 464 bzero(®s, sizeof(regs)); 465 regs.R_EAX = 0x4f04; 466 regs.R_ECX = STATE_ALL; 467 regs.R_EDX = STATE_SIZE; 468 | 454 455 return ((regs.R_AX & 0xff) != 0x4f); 456} 457#endif 458 459static int 460vesa_bios_state_buf_size(void) 461{ 462 x86regs_t regs; 463 464 bzero(®s, sizeof(regs)); 465 regs.R_EAX = 0x4f04; 466 regs.R_ECX = STATE_ALL; 467 regs.R_EDX = STATE_SIZE; 468 |
469 x86biosCall(®s, 0x10); | 469 x86bios_intr(®s, 0x10); |
470 471 if ((regs.R_AX & 0xff) != 0x4f) 472 return 0; 473 474 return regs.R_BX * 64; 475} 476 477static int --- 6 unchanged lines hidden (view full) --- 484 if (size > VESA_BIOS_BUFSIZE) 485 return (1); 486 487 bzero(®s, sizeof(regs)); 488 regs.R_EAX = 0x4f04; 489 regs.R_ECX = STATE_ALL; 490 regs.R_EDX = code; 491 | 470 471 if ((regs.R_AX & 0xff) != 0x4f) 472 return 0; 473 474 return regs.R_BX * 64; 475} 476 477static int --- 6 unchanged lines hidden (view full) --- 484 if (size > VESA_BIOS_BUFSIZE) 485 return (1); 486 487 bzero(®s, sizeof(regs)); 488 regs.R_EAX = 0x4f04; 489 regs.R_ECX = STATE_ALL; 490 regs.R_EDX = code; 491 |
492 buf = (u_char *)x86biosAlloc(1, &offs); | 492 buf = (u_char *)x86bios_alloc(1, &offs); |
493 494 regs.R_ES = SEG_ADDR(offs); 495 regs.R_DI = SEG_OFF(offs); 496 497 bcopy(p, buf, size); 498 | 493 494 regs.R_ES = SEG_ADDR(offs); 495 regs.R_DI = SEG_OFF(offs); 496 497 bcopy(p, buf, size); 498 |
499 x86biosCall(®s, 0x10); | 499 x86bios_intr(®s, 0x10); |
500 501 bcopy(buf, p, size); 502 | 500 501 bcopy(buf, p, size); 502 |
503 x86biosFree(p, 1); | 503 x86bios_free(p, 1); |
504 505 return ((regs.R_AX & 0xff) != 0x4f); 506} 507 508static int 509vesa_bios_get_line_length(void) 510{ 511 x86regs_t regs; 512 513 bzero(®s, sizeof(regs)); 514 regs.R_EAX = 0x4f06; 515 regs.R_EBX = 1; 516 | 504 505 return ((regs.R_AX & 0xff) != 0x4f); 506} 507 508static int 509vesa_bios_get_line_length(void) 510{ 511 x86regs_t regs; 512 513 bzero(®s, sizeof(regs)); 514 regs.R_EAX = 0x4f06; 515 regs.R_EBX = 1; 516 |
517 x86biosCall(®s, 0x10); | 517 x86bios_intr(®s, 0x10); |
518 519 if ((regs.R_AX & 0xff) != 0x4f) 520 return -1; 521 522 return regs.R_BX; 523} 524 525static int 526vesa_bios_set_line_length(int pixel, int *bytes, int *lines) 527{ 528 x86regs_t regs; 529 530 bzero(®s, sizeof(regs)); 531 regs.R_EAX = 0x4f06; 532 regs.R_EBX = 0; 533 regs.R_ECX = pixel; 534 | 518 519 if ((regs.R_AX & 0xff) != 0x4f) 520 return -1; 521 522 return regs.R_BX; 523} 524 525static int 526vesa_bios_set_line_length(int pixel, int *bytes, int *lines) 527{ 528 x86regs_t regs; 529 530 bzero(®s, sizeof(regs)); 531 regs.R_EAX = 0x4f06; 532 regs.R_EBX = 0; 533 regs.R_ECX = pixel; 534 |
535 x86biosCall(®s, 0x10); | 535 x86bios_intr(®s, 0x10); |
536 537#if VESA_DEBUG > 1 538 printf("bx:%d, cx:%d, dx:%d\n", regs.R_BX, regs.R_CX, regs.R_DX); 539#endif 540 if ((regs.R_AX & 0xff) != 0x4f) 541 return -1; 542 543 if (bytes) --- 9 unchanged lines hidden (view full) --- 553vesa_bios_get_start(int *x, int *y) 554{ 555 x86regs_t regs; 556 557 bzero(®s, sizeof(regs)); 558 regs.R_EAX = 0x4f07; 559 regs.R_EBX = 1; 560 | 536 537#if VESA_DEBUG > 1 538 printf("bx:%d, cx:%d, dx:%d\n", regs.R_BX, regs.R_CX, regs.R_DX); 539#endif 540 if ((regs.R_AX & 0xff) != 0x4f) 541 return -1; 542 543 if (bytes) --- 9 unchanged lines hidden (view full) --- 553vesa_bios_get_start(int *x, int *y) 554{ 555 x86regs_t regs; 556 557 bzero(®s, sizeof(regs)); 558 regs.R_EAX = 0x4f07; 559 regs.R_EBX = 1; 560 |
561 x86biosCall(®s, 0x10); | 561 x86bios_intr(®s, 0x10); |
562 563 if ((regs.R_AX & 0xff) != 0x4f) 564 return -1; 565 566 *x = regs.R_CX; 567 *y = regs.R_DX; 568 569 return 0; --- 6 unchanged lines hidden (view full) --- 576 x86regs_t regs; 577 578 bzero(®s, sizeof(regs)); 579 regs.R_EAX = 0x4f07; 580 regs.R_EBX = 0x80; 581 regs.R_EDX = y; 582 regs.R_ECX = x; 583 | 562 563 if ((regs.R_AX & 0xff) != 0x4f) 564 return -1; 565 566 *x = regs.R_CX; 567 *y = regs.R_DX; 568 569 return 0; --- 6 unchanged lines hidden (view full) --- 576 x86regs_t regs; 577 578 bzero(®s, sizeof(regs)); 579 regs.R_EAX = 0x4f07; 580 regs.R_EBX = 0x80; 581 regs.R_EDX = y; 582 regs.R_ECX = x; 583 |
584 x86biosCall(®s, 0x10); | 584 x86bios_intr(®s, 0x10); |
585 586 return ((regs.R_AX & 0xff) != 0x4f); 587} 588 589/* map a generic video mode to a known mode */ 590static int 591vesa_map_gen_mode_num(int type, int color, int mode) 592{ --- 76 unchanged lines hidden (view full) --- 669 if (vesa_init_done) 670 return 0; 671 672 has_vesa_bios = FALSE; 673 vesa_adp_info = NULL; 674 vesa_vmode_max = 0; 675 vesa_vmode[0].vi_mode = EOT; 676 | 585 586 return ((regs.R_AX & 0xff) != 0x4f); 587} 588 589/* map a generic video mode to a known mode */ 590static int 591vesa_map_gen_mode_num(int type, int color, int mode) 592{ --- 76 unchanged lines hidden (view full) --- 669 if (vesa_init_done) 670 return 0; 671 672 has_vesa_bios = FALSE; 673 vesa_adp_info = NULL; 674 vesa_vmode_max = 0; 675 vesa_vmode[0].vi_mode = EOT; 676 |
677 vmbuf = (u_char *)x86biosAlloc(1, &offs); | 677 vmbuf = (u_char *)x86bios_alloc(1, &offs); |
678 bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */ 679 680 bzero(®s, sizeof(regs)); 681 regs.R_EAX = 0x4f00; 682 regs.R_ES = SEG_ADDR(offs); 683 regs.R_DI = SEG_OFF(offs); 684 | 678 bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */ 679 680 bzero(®s, sizeof(regs)); 681 regs.R_EAX = 0x4f00; 682 regs.R_ES = SEG_ADDR(offs); 683 regs.R_DI = SEG_OFF(offs); 684 |
685 x86biosCall(®s, 0x10); | 685 x86bios_intr(®s, 0x10); |
686 687 if (((regs.R_AX & 0xff) != 0x4f) || bcmp("VESA", vmbuf, 4)) 688 return 1; 689 690 bcopy(vmbuf, &buf, sizeof(buf)); 691 692 vesa_adp_info = &buf; 693 if (bootverbose) { --- 5 unchanged lines hidden (view full) --- 699 "version 1.2 or later is required.\n", 700 ((vesa_adp_info->v_version & 0xf000) >> 12) * 10 701 + ((vesa_adp_info->v_version & 0x0f00) >> 8), 702 ((vesa_adp_info->v_version & 0x00f0) >> 4) * 10 703 + (vesa_adp_info->v_version & 0x000f)); 704 return 1; 705 } 706 | 686 687 if (((regs.R_AX & 0xff) != 0x4f) || bcmp("VESA", vmbuf, 4)) 688 return 1; 689 690 bcopy(vmbuf, &buf, sizeof(buf)); 691 692 vesa_adp_info = &buf; 693 if (bootverbose) { --- 5 unchanged lines hidden (view full) --- 699 "version 1.2 or later is required.\n", 700 ((vesa_adp_info->v_version & 0xf000) >> 12) * 10 701 + ((vesa_adp_info->v_version & 0x0f00) >> 8), 702 ((vesa_adp_info->v_version & 0x00f0) >> 4) * 10 703 + (vesa_adp_info->v_version & 0x000f)); 704 return 1; 705 } 706 |
707 vesa_oemstr = (char *)x86biosOffs(FARP(vesa_adp_info->v_oemstr)); | 707 vesa_oemstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_oemstr)); |
708 709 is_via_cle266 = strcmp(vesa_oemstr, VESA_VIA_CLE266) == 0; 710 711 if (vesa_adp_info->v_version >= 0x0200) { | 708 709 is_via_cle266 = strcmp(vesa_oemstr, VESA_VIA_CLE266) == 0; 710 711 if (vesa_adp_info->v_version >= 0x0200) { |
712 vesa_venderstr = (char *)x86biosOffs(FARP(vesa_adp_info->v_venderstr)); 713 vesa_prodstr = (char *)x86biosOffs(FARP(vesa_adp_info->v_prodstr)); 714 vesa_revstr = (char *)x86biosOffs(FARP(vesa_adp_info->v_revstr)); | 712 vesa_venderstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_venderstr)); 713 vesa_prodstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_prodstr)); 714 vesa_revstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_revstr)); |
715 } 716 | 715 } 716 |
717 vesa_vmodetab = (uint16_t *)x86biosOffs(FARP(vesa_adp_info->v_modetable)); | 717 vesa_vmodetab = (uint16_t *)x86bios_offset(FARP(vesa_adp_info->v_modetable)); |
718 719 if (vesa_vmodetab == NULL) 720 return 1; 721 722 for (i = 0, modes = 0; 723 (i < (M_VESA_MODE_MAX - M_VESA_BASE + 1)) 724 && (vesa_vmodetab[i] != 0xffff); ++i) { 725 if (vesa_bios_get_mode(vesa_vmodetab[i], &vmode)) --- 110 unchanged lines hidden (view full) --- 836 } 837 838 vesa_vmode[modes].vi_flags 839 = vesa_translate_flags(vmode.v_modeattr) | V_INFO_VESA; 840 ++modes; 841 } 842 vesa_vmode[modes].vi_mode = EOT; 843 | 718 719 if (vesa_vmodetab == NULL) 720 return 1; 721 722 for (i = 0, modes = 0; 723 (i < (M_VESA_MODE_MAX - M_VESA_BASE + 1)) 724 && (vesa_vmodetab[i] != 0xffff); ++i) { 725 if (vesa_bios_get_mode(vesa_vmodetab[i], &vmode)) --- 110 unchanged lines hidden (view full) --- 836 } 837 838 vesa_vmode[modes].vi_flags 839 = vesa_translate_flags(vmode.v_modeattr) | V_INFO_VESA; 840 ++modes; 841 } 842 vesa_vmode[modes].vi_mode = EOT; 843 |
844 x86biosFree(vmbuf, 1); | 844 x86bios_free(vmbuf, 1); |
845 846 if (bootverbose) 847 printf("VESA: %d mode(s) found\n", modes); 848 849 has_vesa_bios = (modes > 0); 850 if (!has_vesa_bios) 851 return (1); 852 --- 424 unchanged lines hidden (view full) --- 1277vesa_get_origin(video_adapter_t *adp, off_t *offset) 1278{ 1279 x86regs_t regs; 1280 1281 bzero(®s, sizeof(regs)); 1282 regs.R_EAX = 0x4f05; 1283 regs.R_EBX = 0x10; 1284 | 845 846 if (bootverbose) 847 printf("VESA: %d mode(s) found\n", modes); 848 849 has_vesa_bios = (modes > 0); 850 if (!has_vesa_bios) 851 return (1); 852 --- 424 unchanged lines hidden (view full) --- 1277vesa_get_origin(video_adapter_t *adp, off_t *offset) 1278{ 1279 x86regs_t regs; 1280 1281 bzero(®s, sizeof(regs)); 1282 regs.R_EAX = 0x4f05; 1283 regs.R_EBX = 0x10; 1284 |
1285 x86biosCall(®s, 0x10); | 1285 x86bios_intr(®s, 0x10); |
1286 1287 if ((regs.R_AX & 0xff) != 0x4f) 1288 return 1; 1289 *offset = regs.DX * adp->va_window_gran; 1290 1291 return 0; 1292} 1293#endif --- 18 unchanged lines hidden (view full) --- 1312 /* XXX */ 1313 if (adp->va_window_gran == 0) 1314 return 1; 1315 1316 bzero(®s, sizeof(regs)); 1317 regs.R_EAX = 0x4f05; 1318 regs.R_EBX = 0; 1319 regs.R_EDX = offset / adp->va_window_gran; | 1286 1287 if ((regs.R_AX & 0xff) != 0x4f) 1288 return 1; 1289 *offset = regs.DX * adp->va_window_gran; 1290 1291 return 0; 1292} 1293#endif --- 18 unchanged lines hidden (view full) --- 1312 /* XXX */ 1313 if (adp->va_window_gran == 0) 1314 return 1; 1315 1316 bzero(®s, sizeof(regs)); 1317 regs.R_EAX = 0x4f05; 1318 regs.R_EBX = 0; 1319 regs.R_EDX = offset / adp->va_window_gran; |
1320 x86biosCall(®s, 0x10); | 1320 x86bios_intr(®s, 0x10); |
1321 1322 if ((regs.R_AX & 0xff) != 0x4f) 1323 return 1; 1324 1325 bzero(®s, sizeof(regs)); 1326 regs.R_EAX = 0x4f05; 1327 regs.R_EBX = 1; 1328 regs.R_EDX = offset / adp->va_window_gran; | 1321 1322 if ((regs.R_AX & 0xff) != 0x4f) 1323 return 1; 1324 1325 bzero(®s, sizeof(regs)); 1326 regs.R_EAX = 0x4f05; 1327 regs.R_EBX = 1; 1328 regs.R_EDX = offset / adp->va_window_gran; |
1329 x86biosCall(®s, 0x10); | 1329 x86bios_intr(®s, 0x10); |
1330 1331 adp->va_window_orig = (offset/adp->va_window_gran)*adp->va_window_gran; 1332 return 0; /* XXX */ 1333} 1334 1335static int 1336vesa_read_hw_cursor(video_adapter_t *adp, int *col, int *row) 1337{ --- 400 unchanged lines hidden --- | 1330 1331 adp->va_window_orig = (offset/adp->va_window_gran)*adp->va_window_gran; 1332 return 0; /* XXX */ 1333} 1334 1335static int 1336vesa_read_hw_cursor(video_adapter_t *adp, int *col, int *row) 1337{ --- 400 unchanged lines hidden --- |