1
0
Fork 0

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup:
  [x86 setup] Don't rely on the VESA BIOS being register-clean
wifi-calibration
Linus Torvalds 2007-08-31 20:41:03 -07:00
commit 2f81eccbd7
1 changed files with 21 additions and 13 deletions

View File

@ -29,7 +29,7 @@ static void vesa_store_mode_params_graphics(void);
static int vesa_probe(void) static int vesa_probe(void)
{ {
#if defined(CONFIG_VIDEO_VESA) || defined(CONFIG_FIRMWARE_EDID) #if defined(CONFIG_VIDEO_VESA) || defined(CONFIG_FIRMWARE_EDID)
u16 ax; u16 ax, cx, di;
u16 mode; u16 mode;
addr_t mode_ptr; addr_t mode_ptr;
struct mode_info *mi; struct mode_info *mi;
@ -39,9 +39,11 @@ static int vesa_probe(void)
vginfo.signature = VBE2_MAGIC; vginfo.signature = VBE2_MAGIC;
/* Optimistically assume a VESA BIOS is register-clean... */
ax = 0x4f00; ax = 0x4f00;
asm("int $0x10" : "+a" (ax), "=m" (vginfo) : "D" (&vginfo)); di = (size_t)&vginfo;
asm(INT10
: "+a" (ax), "+D" (di), "=m" (vginfo)
: : "ebx", "ecx", "edx", "esi");
if (ax != 0x004f || if (ax != 0x004f ||
vginfo.signature != VESA_MAGIC || vginfo.signature != VESA_MAGIC ||
@ -64,9 +66,11 @@ static int vesa_probe(void)
memset(&vminfo, 0, sizeof vminfo); /* Just in case... */ memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
ax = 0x4f01; ax = 0x4f01;
asm("int $0x10" cx = mode;
: "+a" (ax), "=m" (vminfo) di = (size_t)&vminfo;
: "c" (mode), "D" (&vminfo)); asm(INT10
: "+a" (ax), "+c" (cx), "+D" (di), "=m" (vminfo)
: : "ebx", "edx", "esi");
if (ax != 0x004f) if (ax != 0x004f)
continue; continue;
@ -102,16 +106,18 @@ static int vesa_probe(void)
static int vesa_set_mode(struct mode_info *mode) static int vesa_set_mode(struct mode_info *mode)
{ {
u16 ax; u16 ax, bx, cx, di;
int is_graphic; int is_graphic;
u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA; u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA;
memset(&vminfo, 0, sizeof vminfo); /* Just in case... */ memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
ax = 0x4f01; ax = 0x4f01;
asm("int $0x10" cx = vesa_mode;
: "+a" (ax), "=m" (vminfo) di = (size_t)&vminfo;
: "c" (vesa_mode), "D" (&vminfo)); asm(INT10
: "+a" (ax), "+c" (cx), "+D" (di), "=m" (vminfo)
: : "ebx", "edx", "esi");
if (ax != 0x004f) if (ax != 0x004f)
return -1; return -1;
@ -129,9 +135,11 @@ static int vesa_set_mode(struct mode_info *mode)
ax = 0x4f02; ax = 0x4f02;
asm volatile("int $0x10" bx = vesa_mode;
: "+a" (ax) di = 0;
: "b" (vesa_mode), "D" (0)); asm volatile(INT10
: "+a" (ax), "+b" (bx), "+D" (di)
: : "ecx", "edx", "esi");
if (ax != 0x004f) if (ax != 0x004f)
return -1; return -1;