biosdisk.c (104621) | biosdisk.c (108650) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/boot/pc98/libpc98/biosdisk.c 104621 2002-10-07 15:26:10Z nyan $ | 26 * $FreeBSD: head/sys/boot/pc98/libpc98/biosdisk.c 108650 2003-01-04 08:50:48Z nyan $ |
27 */ 28 29/* 30 * BIOS disk device handling. 31 * 32 * Ideas and algorithms from: 33 * 34 * - NetBSD libi386/biosdisk.c --- 43 unchanged lines hidden (view full) --- 78#define BD_MODEEDD1 0x0001 79#define BD_MODEEDD3 0x0002 80#define BD_MODEMASK 0x0003 81#define BD_FLOPPY 0x0004 82#define BD_LABELOK 0x0008 83#define BD_PARTTABOK 0x0010 84 struct disklabel od_disklabel; 85 int od_nslices; /* slice count */ | 27 */ 28 29/* 30 * BIOS disk device handling. 31 * 32 * Ideas and algorithms from: 33 * 34 * - NetBSD libi386/biosdisk.c --- 43 unchanged lines hidden (view full) --- 78#define BD_MODEEDD1 0x0001 79#define BD_MODEEDD3 0x0002 80#define BD_MODEMASK 0x0003 81#define BD_FLOPPY 0x0004 82#define BD_LABELOK 0x0008 83#define BD_PARTTABOK 0x0010 84 struct disklabel od_disklabel; 85 int od_nslices; /* slice count */ |
86 struct dos_partition od_slicetab[MAX_SLICES]; | 86 struct pc98_partition od_slicetab[MAX_SLICES]; |
87}; 88 89/* 90 * List of BIOS devices, translation from disk unit number to 91 * BIOS unit number. 92 */ 93static struct bdinfo 94{ --- 9 unchanged lines hidden (view full) --- 104static int bd_getgeom(struct open_disk *od); 105static int bd_read(struct open_disk *od, daddr_t dblk, int blks, 106 caddr_t dest); 107static int bd_write(struct open_disk *od, daddr_t dblk, int blks, 108 caddr_t dest); 109 110static int bd_int13probe(struct bdinfo *bd); 111 | 87}; 88 89/* 90 * List of BIOS devices, translation from disk unit number to 91 * BIOS unit number. 92 */ 93static struct bdinfo 94{ --- 9 unchanged lines hidden (view full) --- 104static int bd_getgeom(struct open_disk *od); 105static int bd_read(struct open_disk *od, daddr_t dblk, int blks, 106 caddr_t dest); 107static int bd_write(struct open_disk *od, daddr_t dblk, int blks, 108 caddr_t dest); 109 110static int bd_int13probe(struct bdinfo *bd); 111 |
112static void bd_printslice(struct open_disk *od, struct dos_partition *dp, | 112static void bd_printslice(struct open_disk *od, struct pc98_partition *dp, |
113 char *prefix, int verbose); 114static void bd_printbsdslice(struct open_disk *od, daddr_t offset, 115 char *prefix, int verbose); 116 117static int bd_init(void); 118static int bd_strategy(void *devdata, int flag, daddr_t dblk, 119 size_t size, char *buf, size_t *rsize); 120static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, --- 172 unchanged lines hidden (view full) --- 293 */ 294static void 295bd_print(int verbose) 296{ 297 int i, j; 298 char line[80]; 299 struct i386_devdesc dev; 300 struct open_disk *od; | 113 char *prefix, int verbose); 114static void bd_printbsdslice(struct open_disk *od, daddr_t offset, 115 char *prefix, int verbose); 116 117static int bd_init(void); 118static int bd_strategy(void *devdata, int flag, daddr_t dblk, 119 size_t size, char *buf, size_t *rsize); 120static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, --- 172 unchanged lines hidden (view full) --- 293 */ 294static void 295bd_print(int verbose) 296{ 297 int i, j; 298 char line[80]; 299 struct i386_devdesc dev; 300 struct open_disk *od; |
301 struct dos_partition *dptr; | 301 struct pc98_partition *dptr; |
302 303 for (i = 0; i < nbdinfo; i++) { 304#ifdef PC98 305 sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); 306#else 307 sprintf(line, " disk%d: BIOS drive %c:\n", i, 308 (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit) : ('C' + bdinfo[i].bd_unit - 0x80)); 309#endif --- 208 unchanged lines hidden (view full) --- 518 ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; 519 DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); 520 return(0); 521} 522 523static int 524bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) 525{ | 302 303 for (i = 0; i < nbdinfo; i++) { 304#ifdef PC98 305 sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); 306#else 307 sprintf(line, " disk%d: BIOS drive %c:\n", i, 308 (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit) : ('C' + bdinfo[i].bd_unit - 0x80)); 309#endif --- 208 unchanged lines hidden (view full) --- 518 ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; 519 DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); 520 return(0); 521} 522 523static int 524bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) 525{ |
526 struct dos_partition *dptr; | 526 struct pc98_partition *dptr; |
527 struct disklabel *lp; 528 struct open_disk *od; 529 int sector, slice, i; 530 int error; 531 char buf[BUFSIZE]; 532 533 if (dev->d_kind.biosdisk.unit >= nbdinfo) { 534 DEBUG("attempt to open nonexistent disk"); --- 65 unchanged lines hidden (view full) --- 600 goto out; 601 } 602#endif 603 604 /* 605 * copy the partition table, then pick up any extended partitions. 606 */ 607 bcopy(buf + DOSPARTOFF, &od->od_slicetab, | 527 struct disklabel *lp; 528 struct open_disk *od; 529 int sector, slice, i; 530 int error; 531 char buf[BUFSIZE]; 532 533 if (dev->d_kind.biosdisk.unit >= nbdinfo) { 534 DEBUG("attempt to open nonexistent disk"); --- 65 unchanged lines hidden (view full) --- 600 goto out; 601 } 602#endif 603 604 /* 605 * copy the partition table, then pick up any extended partitions. 606 */ 607 bcopy(buf + DOSPARTOFF, &od->od_slicetab, |
608 sizeof(struct dos_partition) * NDOSPART); | 608 sizeof(struct pc98_partition) * NDOSPART); |
609#ifdef PC98 610 od->od_nslices = NDOSPART; /* extended slices start here */ 611#else 612 od->od_nslices = 4; /* extended slices start here */ 613 for (i = 0; i < NDOSPART; i++) 614 bd_checkextended(od, i); 615#endif 616 od->od_flags |= BD_PARTTABOK; --- 188 unchanged lines hidden (view full) --- 805#define PREF_NONE 7 806 807/* 808 * slicelimit is in the range 0 .. NDOSPART 809 */ 810static int 811bd_bestslice(struct open_disk *od) 812{ | 609#ifdef PC98 610 od->od_nslices = NDOSPART; /* extended slices start here */ 611#else 612 od->od_nslices = 4; /* extended slices start here */ 613 for (i = 0; i < NDOSPART; i++) 614 bd_checkextended(od, i); 615#endif 616 od->od_flags |= BD_PARTTABOK; --- 188 unchanged lines hidden (view full) --- 805#define PREF_NONE 7 806 807/* 808 * slicelimit is in the range 0 .. NDOSPART 809 */ 810static int 811bd_bestslice(struct open_disk *od) 812{ |
813 struct dos_partition *dp; | 813 struct pc98_partition *dp; |
814 int pref, preflevel; 815 int i, prefslice; 816 817 prefslice = 0; 818 preflevel = PREF_NONE; 819 820 dp = &od->od_slicetab[0]; 821 for (i = 0; i < od->od_nslices; i++, dp++) { --- 710 unchanged lines hidden --- | 814 int pref, preflevel; 815 int i, prefslice; 816 817 prefslice = 0; 818 preflevel = PREF_NONE; 819 820 dp = &od->od_slicetab[0]; 821 for (i = 0; i < od->od_nslices; i++, dp++) { --- 710 unchanged lines hidden --- |