Date: Fri, 28 Apr 2000 12:23:29 +0900 From: Motomichi Matsuzaki <mzaki@e-mail.ne.jp> To: jhb@FreeBSD.org Cc: dcs@newsguy.com, FreeBSD-current@FreeBSD.org, mzaki@e-mail.ne.jp Subject: Re: Please test for 8G-OVER-Booting with /boot/loader Message-ID: <8666t2q572.wl@tkc.att.ne.jp> In-Reply-To: In your message of "Tue, 28 Mar 2000 06:46:27 -0500 (EST)" <200003281146.GAA87302@server.baldwin.cx> References: <38E067A8.10298DC@newsguy.com> <200003281146.GAA87302@server.baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Fri_Apr_28_12:23:29_2000-1 Content-Type: text/plain; charset=US-ASCII Hi At Tue, 28 Mar 2000 06:46:27 -0500 (EST), John Baldwin <jhb@FreeBSD.ORG> wrote: > >> Looks good to me, but I need to test it to make sure. I will also look > >> at seeing if I can squeeze the int 13 extension installation check into > >> boot1 and boot0 so that they will use packet mode automatically as well. > Oh, I remember. This just checks if the controller supports LBA. You also > need to check if the drive supports LBA. The problem is with older drives. > Hmm, I'll look around to see if you can ask the BIOS for drive capabilities. I have convinced that there are no widespread services to query whether drive supports LBA. So I changed my patch to use Packet I/F only when we need to access over 8GB. Please review and test following patch. Thanks. -- Motomichi Matsuzaki <mzaki@e-mail.ne.jp> Dept. of Biological Sciences, Grad. School of Science, Univ. of Tokyo, Japan --Multipart_Fri_Apr_28_12:23:29_2000-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="biosdisk.c.diff" Content-Transfer-Encoding: 7bit --- boot/i386/libi386/biosdisk.c.orig Wed Mar 29 06:03:28 2000 +++ boot/i386/libi386/biosdisk.c Fri Apr 28 11:59:22 2000 @@ -74,7 +74,7 @@ int od_flags; #define BD_MODEMASK 0x3 #define BD_MODEINT13 0x0 -#define BD_MODEEDD1 0x1 +#define BD_MODEPACKET 0x1 #define BD_MODEEDD3 0x2 #define BD_FLOPPY (1<<2) struct disklabel od_disklabel; @@ -166,13 +166,13 @@ bdinfo[nbdinfo].bd_unit = unit; bdinfo[nbdinfo].bd_flags = (unit < 0x80) ? BD_FLOPPY : 0; - /* XXX add EDD probes */ if (!bd_int13probe(&bdinfo[nbdinfo])) break; /* XXX we need "disk aliases" to make this simpler */ - printf("BIOS drive %c: is disk%d\n", - (unit < 0x80) ? ('A' + unit) : ('C' + unit - 0x80), nbdinfo); + printf("BIOS drive %c: is disk%d%s\n", + (unit < 0x80) ? ('A' + unit) : ('C' + unit - 0x80), nbdinfo, + (bdinfo[nbdinfo].bd_flags & BD_MODEPACKET) ? " (LBA)" : ""); nbdinfo++; } } @@ -180,7 +180,7 @@ } /* - * Try to detect a device supported by the legacy int13 BIOS + * Try to detect a device supported by the int13 BIOS */ static int @@ -197,6 +197,26 @@ ((v86.edx & 0xff) > (bd->bd_unit & 0x7f))) { /* unit # OK */ bd->bd_flags |= BD_MODEINT13; bd->bd_type = v86.ebx & 0xff; + + /* LBA support by Motomichi Matsuzaki <mzaki@e-mail.ne.jp> */ + + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x4100; + v86.ebx = 0x55AA; + v86.edx = bd->bd_unit; + v86int(); + + if (!(v86.efl & 0x1) && /* carry clear */ + (v86.ebx & 0xffff) == 0xAA55) { /* magic OK */ + if ((v86.eax & 0xf000) >= 0x3000) { + bd->bd_flags |= BD_MODEEDD3; /* meanless? */ + } + if (v86.ecx & 0x1) { + bd->bd_flags |= BD_MODEPACKET; /* packet access */ + } + } + return(1); } return(0); @@ -648,6 +668,15 @@ /* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */ #define FLOPPY_BOUNCEBUF 18 +struct lba_packet { + u_int8_t len; + u_int8_t rsrv; + u_int16_t blks; + u_int16_t offs; + u_int16_t seg; + u_int64_t blkno; +}; + static int bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) { @@ -709,25 +738,46 @@ v86.edx = od->od_unit; v86int(); } - - /* build request XXX support EDD requests too */ - v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x200 | x; - v86.ecx = ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec; - v86.edx = (hd << 8) | od->od_unit; - v86.es = VTOPSEG(xp); - v86.ebx = VTOPOFF(xp); - v86int(); + + /* build request */ + if (od->od_flags & BD_MODEPACKET && + (hd & ~0xff || cyl & ~0x3ff || sec & ~0x3f)) { + struct lba_packet pkt + = {sizeof(pkt), 0, x, VTOPOFF(xp), VTOPSEG(xp), dblk}; + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x4200; + v86.edx = od->od_unit; + v86.ds = VTOPSEG(&pkt); + v86.esi = VTOPOFF(&pkt); + v86int(); + } else { + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x200 | x; + v86.ecx = ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec; + v86.edx = (hd << 8) | od->od_unit; + v86.es = VTOPSEG(xp); + v86.ebx = VTOPOFF(xp); + v86int(); + } result = (v86.efl & 0x1); if (result == 0) break; } - DEBUG("%d sectors from %d/%d/%d to %p (0x%x) %s", x, cyl, hd, sec - 1, p, VTOP(p), result ? "failed" : "ok"); - /* BUG here, cannot use v86 in printf because putchar uses it too */ - DEBUG("ax = 0x%04x cx = 0x%04x dx = 0x%04x status 0x%x", - 0x200 | x, ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec, (hd << 8) | od->od_unit, (v86.eax >> 8) & 0xff); + if (od->od_flags & BD_MODEPACKET && + (hd & ~0xff || cyl & ~0x3ff || sec & ~0x3f)) { + DEBUG("%d sectors from linear %d to %p (0x%x) using LBA %s", + x, dblk, p, VTOP(p), result ? "failed" : "ok"); + } else { + DEBUG("%d sectors from %d/%d/%d to %p (0x%x) %s", + x, cyl, hd, sec - 1, p, VTOP(p), result ? "failed" : "ok"); + /* BUG here, cannot use v86 in printf because putchar uses it too */ + DEBUG("ax = 0x%04x cx = 0x%04x dx = 0x%04x status 0x%x", + 0x200 | x, ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec, + (hd << 8) | od->od_unit, (v86.eax >> 8) & 0xff); + } if (result) { if (bbuf != NULL) free(bbuf); --Multipart_Fri_Apr_28_12:23:29_2000-1-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8666t2q572.wl>