> > I'm able to reproduce this kind of behaviour on an ASUS M2N-SLI
> > mainboard when trying to boot from an external USB DVD writer
> > device.  In my case the Solaris GRUB optical boot media is readable
> > just fine; It's the BIOS that starts reporting read errors for reads from
> > the USB optical device, at the point when the /boot/grub/menu.lst file
> > should be read.  With a few hacks added to the GRUB boot code I'm
> > able to work around that BIOS bug...
> 
> Have you tried feeding that code back into Sun as a
> contribution? I.e., I'm hitting the same problem
> right now. Not a corrupted disk, but an inablility to
> read from an external USB drive.

No, not yet.

Here are my notes and the fix that I've used:
=====================================================

- snv_50 installation dvd

- ASUS M2N-SLI deluxe mainboard

  BIOS Version:
  Vendor: Phoenix Technologies, LTD
  Version String: ASUS M2N-SLI DELUXE ACPI BIOS Revision 0202
  Release Date: 05/15/2006
    
- ATAPI DVD Writer device, in an external USB2.0 enclosure
  Vendor: HL-DT-ST Product: DVDRAM GSA-4082B Revision: A201

- USB DVD selected as boot device in the "F8" boot menu

snv_50 starts loading GRUB from the USB DVD device, but
fails the open of the /boot/grub/menu.lst file on the
USB DVD, and enters GRUB command line mode.

Any attempt to read files from the USB DVD (e.g. cat /<TAB>)
fails with "Error 25: Disk read error".

========================================================================

Real mode INT13 calls, traced (with a slighly modified) QEMU.

These traces show that Solaris GRUB 0.95 is the only one
that uses an INT13 function 0x41 installation check with the
bios 0xe0 device (el-torito cdrom boot device).


In addition, Solaris GRUB 0.95 is the only one that resets the
system system with an int13, function 0.


int 13, Solaris grub booting from cd:
=====================================

R   250: v=13 e=0000 i=1 cpl=0 IP=0000:7ce9 SP=0000:1fd8 AX=426e DX=00e0 
extended read
R   252: v=13 e=0000 i=1 cpl=0 IP=0000:7ce9 SP=0000:1fd8 AX=4200 DX=00e0 
extended read
R   254: v=13 e=0000 i=1 cpl=0 IP=0000:7ce9 SP=0000:1fd8 AX=4200 DX=00e0 
extended read
R   256: v=13 e=0000 i=1 cpl=0 IP=0000:7ce9 SP=0000:1fd8 AX=4200 DX=00e0 
extended read
R   260: v=13 e=0000 i=1 cpl=0 IP=0000:8292 SP=0000:1ff0 AX=0000 DX=00e0 reset 
disk system
R   269: v=13 e=0000 i=1 cpl=0 IP=0000:8967 SP=0000:1ff4 AX=4100 DX=0080 
installation check (HDD)
R   270: v=13 e=0000 i=1 cpl=0 IP=0000:899b SP=0000:1ff4 AX=0800 DX=0080 get 
drive param (HDD)
R   277: v=13 e=0000 i=1 cpl=0 IP=0000:8967 SP=0000:1ff4 AX=4100 DX=00e0 
installation check <<<<
R   278: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4b01 DX=7fe0 cdrom, 
get status
R   279: v=13 e=0000 i=1 cpl=0 IP=0000:8967 SP=0000:1ff4 AX=4100 DX=00e0 
installation check <<<<
R   280: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4b01 DX=7ce0 cdrom, 
get status
R   281: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=00e0 
extended read
R   282: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=00e0 
extended read
R   283: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=02e0 
extended read
R   284: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=8ee0 
extended read
R   285: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=ade0 
extended read
R   286: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=02e0 
extended read
R   287: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=8ee0 
extended read
R   288: v=13 e=0000 i=1 cpl=0 IP=0000:88e9 SP=0000:1ff4 AX=4200 DX=ade0 
extended read

int 13, w2k booting from cd:
============================

R   235: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7be0 AX=4200 DX=00e0 
extended read
R   236: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   237: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   238: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   239: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   240: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   241: v=13 e=0000 i=1 cpl=0 IP=2000:001a SP=0000:7bdc AX=0201 DX=0080 read 
sector (HDD)
R   242: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bda AX=4200 DX=00e0 
extended read
R   243: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   244: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   245: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   246: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   247: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4201 DX=00e0 
extended read
R   250: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4201 DX=00e0 
extended read
R   251: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4201 DX=00e0 
extended read
R   252: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4201 DX=00e0 
extended read
R   272: v=13 e=0000 i=1 cpl=0 IP=2000:0f40 SP=22ac:7fe8 AX=4b01 DX=ffe0 cdrom, 
get status
R   273: v=13 e=0000 i=1 cpl=0 IP=2000:061f SP=22ac:7fdc AX=0800 DX=0080 get 
drive param (HDD)
R   278: v=13 e=0000 i=1 cpl=0 IP=2000:06f3 SP=22ac:7fda AX=4200 DX=00e0 
extended read
R   279: v=13 e=0000 i=1 cpl=0 IP=2000:06f3 SP=22ac:7fda AX=4200 DX=00e0 
extended read
R   280: v=13 e=0000 i=1 cpl=0 IP=2000:06f3 SP=22ac:7fda AX=4200 DX=00e0 
extended read
R   281: v=13 e=0000 i=1 cpl=0 IP=2000:06f3 SP=22ac:7fda AX=4200 DX=00e0 
extended read
R   282: v=13 e=0000 i=1 cpl=0 IP=2000:06f3 SP=22ac:7fda AX=4200 DX=00e0 
extended read

int 13, win xp booting from cd:         (identical, when compared to win2k)
===============================

R   239: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7be0 AX=4200 DX=00e0 
extended read
R   242: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   243: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   248: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   251: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   254: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   257: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bd4 AX=4200 DX=00e0 
extended read
R   260: v=13 e=0000 i=1 cpl=0 IP=2000:001a SP=0000:7bdc AX=0201 DX=0080 read 
sector (HDD)
R   261: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bda AX=4200 DX=00e0 
extended read
R   264: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   267: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   270: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   273: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   276: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4200 DX=00e0 
extended read
R   279: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4202 DX=00e0 
extended read
R   284: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4202 DX=00e0 
extended read
R   287: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4202 DX=00e0 
extended read
R   292: v=13 e=0000 i=1 cpl=0 IP=07c0:034c SP=0000:7bce AX=4202 DX=00e0 
extended read
R   313: v=13 e=0000 i=1 cpl=0 IP=2000:0e2c SP=22f3:7fe8 AX=4b01 DX=ffe0 cdrom, 
get status
R   314: v=13 e=0000 i=1 cpl=0 IP=2000:063b SP=22f3:7fdc AX=0800 DX=0080 get 
drive param (HDD)
R   319: v=13 e=0000 i=1 cpl=0 IP=2000:070f SP=22f3:7fda AX=4200 DX=00e0 
extended read
R   322: v=13 e=0000 i=1 cpl=0 IP=2000:070f SP=22f3:7fda AX=4200 DX=00e0 
extended read
...

int 13, knoppix 3.6 booting from cd:    (isolinux boot code?)
====================================

R   272: v=13 e=0000 i=1 cpl=0 IP=0000:7ca3 SP=0000:7c00 AX=4b01 DX=00e0 cdrom, 
get status
R   273: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bd8 AX=4231 DX=00e0 
extended read
R   398: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bd8 AX=4210 DX=00e0 
extended read
R   399: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7ba4 AX=421d DX=08e0 
extended read
R   400: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bac AX=4221 DX=08e0 
extended read
R   401: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7baa AX=4222 DX=08e0 
extended read
R   402: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bc4 AX=4235 DX=02e0 
extended read
R   403: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7ba4 AX=4222 DX=08e0 
extended read
R   404: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bca AX=422f DX=00e0 
extended read
R   405: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7ba4 AX=4222 DX=08e0 
extended read
R   407: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bc4 AX=422c DX=00e0 
extended read
R   410: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7b96 AX=4222 DX=08e0 
extended read
R   415: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7b96 AX=42f2 DX=9be0 
extended read
R   424: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7b90 AX=42f6 DX=03e0 
extended read
R 32865: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7baa AX=4222 DX=08e0 
extended read
R 32891: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bcc AX=4237 DX=02e0 
extended read
R 32931: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bbc AX=4247 DX=ffe0 
extended read
R 32938: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bbc AX=4267 DX=ffe0 
extended read
R 32947: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bbc AX=4287 DX=ffe0 
extended read
R 32952: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bbc AX=42a7 DX=ffe0 
extended read
R 32959: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bbc AX=42c7 DX=ffe0 
extended read
R 32966: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bbc AX=42e7 DX=ffe0 
extended read
R 32971: v=13 e=0000 i=1 cpl=0 IP=0000:7dd5 SP=0000:7bbc AX=4207 DX=ffe0 
extended read


Suggested fix:
==============

- Do not use "int13 installation check" with the el-torito boot device.
- Do not reset the disk system
- Use the CARRY flag returned from int13 to detect errors

diff -ru ../opensolaris-20061030/usr/src/grub/grub-0.95/stage2/asm.S 
usr/src/grub/grub-0.95/stage2/asm.S
--- ../opensolaris-20061030/usr/src/grub/grub-0.95/stage2/asm.S 2006-11-02 
21:35:31.588023546 +0100
+++ usr/src/grub/grub-0.95/stage2/asm.S 2006-11-05 13:46:17.669873173 +0100
@@ -139,7 +139,7 @@
        ADDR32  movb    %dl, EXT_C(boot_drive)
 
        /* reset disk system (%ah = 0) */
-       int     $0x13
+       /* int  $0x13 */
 #endif
 
        /* transition to protected mode */
@@ -1103,7 +1103,11 @@
        movw    %bx, %ax
        movw    %cx, %ds
        int     $0x13           /* do the operation */
-       movb    %ah, %dl        /* save return value */
+       jnc     1f
+       movb    %ah, %dl        /* read/write ERROR, save return value */
+       jmp     2f
+1:     xorb    %dl, %dl        /* read/write OK, clear error return */
+2:     
        /* clear the data segment */
        xorw    %ax, %ax
        movw    %ax, %ds
diff -ru ../opensolaris-20061030/usr/src/grub/grub-0.95/stage2/bios.c 
usr/src/grub/grub-0.95/stage2/bios.c
--- ../opensolaris-20061030/usr/src/grub/grub-0.95/stage2/bios.c        
2006-11-02 21:35:31.589215650 +0100
+++ usr/src/grub/grub-0.95/stage2/bios.c        2006-11-05 14:39:02.134211447 
+0100
@@ -189,6 +189,10 @@
    * failure here, GRUB will run, but cannot see the boot drive,
    * not a very good situation. Defaulting to non-emulation mode
    * is a last-ditch effort.
+   *
+   * (XXX: This workaround isn't needed any more, if we avoid calling
+   * the int13_extensions installation check for the el-torito boot
+   * device. See comment in get_diskinfo())
    */
   if (drive >= 0x88 && drive == boot_drive)
     {
@@ -219,7 +223,43 @@
       int version;
       unsigned long total_sectors = 0;
       
-      version = check_int13_extensions (drive);
+      /*
+       * If this is the boot_drive, and the drive is an El-Torito
+       * emulated hard disc, avoid calling the int13_extensions
+       * installation check.
+       * 
+       * Several BIOS have issues with calling the
+       * int13_extensions installation check for an El-Torito
+       * emulated hard disc:
+       *
+       * o Toshiba Tecra S1
+       *   check_int13_extensions() fails and returns 0, but at the
+       *   same time, future int13 "bootable cdrom - get status"
+       *   (function 0x4b01) calls will start returning failures, too.
+       *   (For this reason we have a workaround for the Tecra S1
+       *   in get_cdinfo())
+       *
+       * o ASUS M2N-SLI (when booting from an USB CDROM device)
+       *   The int13_extensions installation check fails (version == 0);
+       *   the int13 "bootable cdrom - get status" is ok.
+       *   But reading from the El-Torito emulated hard disc
+       *   returns errors as soon as we have called int13_extensions
+       *   installation check for the El-Torito CD.
+       *
+       * In both cases, not calling the int13_extensions
+       * installation check for the El-Torito device avoids the
+       * issues.
+       *
+       * It seems that the Windows 2000/XP installation CD doesn't
+       * call int13 function 0x41 (int13 extensions installation
+       * check), so this might explain why BIOS developers don't
+       * notice that their int13 function 0x41 is broken for CDROM
+       * devices.
+       */
+      if (drive >= 0x88 && drive == boot_drive)
+       version = 0;
+      else
+       version = check_int13_extensions (drive);
 
       if (drive >= 0x88 || version)
        {
 
 
This message posted from opensolaris.org

Reply via email to