aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/toshiba.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/toshiba.c')
-rw-r--r--drivers/char/toshiba.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 0c6f521abd0e..e2fb234dee40 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -355,14 +355,14 @@ static void tosh_set_fn_port(void)
355/* 355/*
356 * Get the machine identification number of the current model 356 * Get the machine identification number of the current model
357 */ 357 */
358static int tosh_get_machine_id(void) 358static int tosh_get_machine_id(void __iomem *bios)
359{ 359{
360 int id; 360 int id;
361 SMMRegisters regs; 361 SMMRegisters regs;
362 unsigned short bx,cx; 362 unsigned short bx,cx;
363 unsigned long address; 363 unsigned long address;
364 364
365 id = (0x100*(int) isa_readb(0xffffe))+((int) isa_readb(0xffffa)); 365 id = (0x100*(int) readb(bios+0xfffe))+((int) readb(bios+0xfffa));
366 366
367 /* do we have a SCTTable machine identication number on our hands */ 367 /* do we have a SCTTable machine identication number on our hands */
368 368
@@ -388,12 +388,12 @@ static int tosh_get_machine_id(void)
388 388
389 /* now twiddle with our pointer a bit */ 389 /* now twiddle with our pointer a bit */
390 390
391 address = 0x000f0000+bx; 391 address = bx;
392 cx = isa_readw(address); 392 cx = readw(bios + address);
393 address = 0x000f0009+bx+cx; 393 address = 9+bx+cx;
394 cx = isa_readw(address); 394 cx = readw(bios + address);
395 address = 0x000f000a+cx; 395 address = 0xa+cx;
396 cx = isa_readw(address); 396 cx = readw(bios + address);
397 397
398 /* now construct our machine identification number */ 398 /* now construct our machine identification number */
399 399
@@ -416,13 +416,18 @@ static int tosh_probe(void)
416 int i,major,minor,day,year,month,flag; 416 int i,major,minor,day,year,month,flag;
417 unsigned char signature[7] = { 0x54,0x4f,0x53,0x48,0x49,0x42,0x41 }; 417 unsigned char signature[7] = { 0x54,0x4f,0x53,0x48,0x49,0x42,0x41 };
418 SMMRegisters regs; 418 SMMRegisters regs;
419 void __iomem *bios = ioremap(0xf0000, 0x10000);
420
421 if (!bios)
422 return -ENOMEM;
419 423
420 /* extra sanity check for the string "TOSHIBA" in the BIOS because 424 /* extra sanity check for the string "TOSHIBA" in the BIOS because
421 some machines that are not Toshiba's pass the next test */ 425 some machines that are not Toshiba's pass the next test */
422 426
423 for (i=0;i<7;i++) { 427 for (i=0;i<7;i++) {
424 if (isa_readb(0xfe010+i)!=signature[i]) { 428 if (readb(bios+0xe010+i)!=signature[i]) {
425 printk("toshiba: not a supported Toshiba laptop\n"); 429 printk("toshiba: not a supported Toshiba laptop\n");
430 iounmap(bios);
426 return -ENODEV; 431 return -ENODEV;
427 } 432 }
428 } 433 }
@@ -438,6 +443,7 @@ static int tosh_probe(void)
438 443
439 if ((flag==1) || ((regs.eax & 0xff00)==0x8600)) { 444 if ((flag==1) || ((regs.eax & 0xff00)==0x8600)) {
440 printk("toshiba: not a supported Toshiba laptop\n"); 445 printk("toshiba: not a supported Toshiba laptop\n");
446 iounmap(bios);
441 return -ENODEV; 447 return -ENODEV;
442 } 448 }
443 449
@@ -447,19 +453,19 @@ static int tosh_probe(void)
447 453
448 /* next get the machine ID of the current laptop */ 454 /* next get the machine ID of the current laptop */
449 455
450 tosh_id = tosh_get_machine_id(); 456 tosh_id = tosh_get_machine_id(bios);
451 457
452 /* get the BIOS version */ 458 /* get the BIOS version */
453 459
454 major = isa_readb(0xfe009)-'0'; 460 major = readb(bios+0xe009)-'0';
455 minor = ((isa_readb(0xfe00b)-'0')*10)+(isa_readb(0xfe00c)-'0'); 461 minor = ((readb(bios+0xe00b)-'0')*10)+(readb(bios+0xe00c)-'0');
456 tosh_bios = (major*0x100)+minor; 462 tosh_bios = (major*0x100)+minor;
457 463
458 /* get the BIOS date */ 464 /* get the BIOS date */
459 465
460 day = ((isa_readb(0xffff5)-'0')*10)+(isa_readb(0xffff6)-'0'); 466 day = ((readb(bios+0xfff5)-'0')*10)+(readb(bios+0xfff6)-'0');
461 month = ((isa_readb(0xffff8)-'0')*10)+(isa_readb(0xffff9)-'0'); 467 month = ((readb(bios+0xfff8)-'0')*10)+(readb(bios+0xfff9)-'0');
462 year = ((isa_readb(0xffffb)-'0')*10)+(isa_readb(0xffffc)-'0'); 468 year = ((readb(bios+0xfffb)-'0')*10)+(readb(bios+0xfffc)-'0');
463 tosh_date = (((year-90) & 0x1f)<<10) | ((month & 0xf)<<6) 469 tosh_date = (((year-90) & 0x1f)<<10) | ((month & 0xf)<<6)
464 | ((day & 0x1f)<<1); 470 | ((day & 0x1f)<<1);
465 471
@@ -476,6 +482,8 @@ static int tosh_probe(void)
476 if ((tosh_id==0xfccb) || (tosh_id==0xfccc)) 482 if ((tosh_id==0xfccb) || (tosh_id==0xfccc))
477 tosh_fan = 1; 483 tosh_fan = 1;
478 484
485 iounmap(bios);
486
479 return 0; 487 return 0;
480} 488}
481 489