From owner-p4-projects@FreeBSD.ORG Thu Oct 26 21:59:04 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B164D16A4AB; Thu, 26 Oct 2006 21:59:04 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 88A1516A47E for ; Thu, 26 Oct 2006 21:59:04 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F47D43D60 for ; Thu, 26 Oct 2006 21:59:03 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9QLx3md038508 for ; Thu, 26 Oct 2006 21:59:03 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9QLx2Im038505 for perforce@freebsd.org; Thu, 26 Oct 2006 21:59:02 GMT (envelope-from marcel@freebsd.org) Date: Thu, 26 Oct 2006 21:59:02 GMT Message-Id: <200610262159.k9QLx2Im038505@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 108529 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2006 21:59:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=108529 Change 108529 by marcel@marcel_cluster on 2006/10/26 21:58:36 Add new common field d_unit to struct devdesc. This makes to possible for libefi to function without requiring architecture specific extensions. As such, libefi can be used on amd64, i386 and ia64 without enforcing identical struct devdesc definitions. Affected files ... .. //depot/projects/ia64/sys/boot/common/bootstrap.h#9 edit .. //depot/projects/ia64/sys/boot/i386/libi386/bioscd.c#8 edit .. //depot/projects/ia64/sys/boot/i386/libi386/biosdisk.c#13 edit .. //depot/projects/ia64/sys/boot/i386/libi386/bootinfo32.c#3 edit .. //depot/projects/ia64/sys/boot/i386/libi386/devicename.c#5 edit .. //depot/projects/ia64/sys/boot/i386/libi386/libi386.h#13 edit .. //depot/projects/ia64/sys/boot/i386/loader/main.c#13 edit .. //depot/projects/ia64/sys/boot/ofw/libofw/libofw.h#8 edit .. //depot/projects/ia64/sys/boot/pc98/libpc98/bioscd.c#2 edit .. //depot/projects/ia64/sys/boot/pc98/libpc98/biosdisk.c#12 edit .. //depot/projects/ia64/sys/boot/pc98/loader/main.c#11 edit Differences ... ==== //depot/projects/ia64/sys/boot/common/bootstrap.h#9 (text+ko) ==== @@ -43,6 +43,7 @@ #define DEVT_DISK 1 #define DEVT_NET 2 #define DEVT_CD 3 + int d_unit; }; /* Commands and return values; nonzero return sets command_errmsg != NULL */ ==== //depot/projects/ia64/sys/boot/i386/libi386/bioscd.c#8 (text+ko) ==== @@ -195,7 +195,7 @@ va_start(ap, f); dev = va_arg(ap, struct i386_devdesc *); va_end(ap); - if (dev->d_kind.bioscd.unit >= nbcinfo) { + if (dev->d_unit >= nbcinfo) { DEBUG("attempt to open nonexistent disk"); return(ENXIO); } @@ -230,7 +230,7 @@ if (rw != F_READ) return(EROFS); dev = (struct i386_devdesc *)devdata; - unit = dev->d_kind.bioscd.unit; + unit = dev->d_unit; blks = size / BIOSCD_SECSIZE; if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0) return (EINVAL); @@ -331,7 +331,7 @@ int major; int rootdev; - unit = dev->d_kind.bioscd.unit; + unit = dev->d_unit; biosdev = bc_unit2bios(unit); DEBUG("unit %d BIOS device %d", unit, biosdev); if (biosdev == -1) /* not a BIOS device */ ==== //depot/projects/ia64/sys/boot/i386/libi386/biosdisk.c#13 (text+ko) ==== @@ -251,7 +251,7 @@ pager_output(line); /* try to open the whole disk */ - dev.d_kind.biosdisk.unit = i; + dev.d_unit = i; dev.d_kind.biosdisk.slice = -1; dev.d_kind.biosdisk.partition = -1; @@ -454,7 +454,7 @@ int error; char buf[BUFSIZE]; - if (dev->d_kind.biosdisk.unit >= nbdinfo) { + if (dev->d_unit >= nbdinfo) { DEBUG("attempt to open nonexistent disk"); return(ENXIO); } @@ -466,14 +466,14 @@ } /* Look up BIOS unit number, intialise open_disk structure */ - od->od_dkunit = dev->d_kind.biosdisk.unit; + od->od_dkunit = dev->d_unit; od->od_unit = bdinfo[od->od_dkunit].bd_unit; od->od_flags = bdinfo[od->od_dkunit].bd_flags; od->od_boff = 0; od->od_nslices = 0; error = 0; DEBUG("open '%s', unit 0x%x slice %d partition %c", - i386_fmtdev(dev), dev->d_kind.biosdisk.unit, + i386_fmtdev(dev), dev->d_unit, dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition + 'a'); /* Get geometry for this open (removable device may have changed) */ @@ -1177,8 +1177,8 @@ char *nip, *cp; int unitofs = 0, i, unit; - biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit); - DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev); + biosdev = bd_unit2bios(dev->d_unit); + DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev); if (biosdev == -1) /* not a BIOS device */ return(-1); if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */ @@ -1186,7 +1186,7 @@ if (biosdev < 0x80) { /* floppy (or emulated floppy) or ATAPI device */ - if (bdinfo[dev->d_kind.biosdisk.unit].bd_type == DT_ATAPI) { + if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) { /* is an ATAPI disk */ major = WFDMAJOR; } else { ==== //depot/projects/ia64/sys/boot/i386/libi386/bootinfo32.c#3 (text+ko) ==== @@ -172,13 +172,13 @@ switch(rootdev->d_type) { case DEVT_CD: /* Pass in BIOS device number. */ - bi.bi_bios_dev = bc_unit2bios(rootdev->d_kind.bioscd.unit); + bi.bi_bios_dev = bc_unit2bios(rootdev->d_unit); bootdevnr = bc_getdev(rootdev); break; case DEVT_DISK: /* pass in the BIOS device number of the current disk */ - bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit); + bi.bi_bios_dev = bd_unit2bios(rootdev->d_unit); bootdevnr = bd_getdev(rootdev); break; ==== //depot/projects/ia64/sys/boot/i386/libi386/devicename.c#5 (text+ko) ==== @@ -142,7 +142,7 @@ goto fail; } - idev->d_kind.biosdisk.unit = unit; + idev->d_unit = unit; idev->d_kind.biosdisk.slice = slice; idev->d_kind.biosdisk.partition = partition; if (path != NULL) @@ -165,10 +165,7 @@ goto fail; } - if (dv->dv_type == DEVT_NET) - idev->d_kind.netif.unit = unit; - else - idev->d_kind.bioscd.unit = unit; + idev->d_unit = unit; if (path != NULL) *path = (*cp == 0) ? cp : cp + 1; break; @@ -205,12 +202,12 @@ break; case DEVT_CD: - sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.bioscd.unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; case DEVT_DISK: cp = buf; - cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.biosdisk.unit); + cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit); if (dev->d_kind.biosdisk.slice > 0) cp += sprintf(cp, "s%d", dev->d_kind.biosdisk.slice); if (dev->d_kind.biosdisk.partition >= 0) @@ -219,7 +216,7 @@ break; case DEVT_NET: - sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; } return(buf); ==== //depot/projects/ia64/sys/boot/i386/libi386/libi386.h#13 (text+ko) ==== @@ -36,24 +36,19 @@ { struct devsw *d_dev; int d_type; + int d_unit; union { struct { - int unit; + void *data; int slice; int partition; - void *data; } biosdisk; struct { - int unit; void *data; } bioscd; - struct - { - int unit; /* XXX net layer lives over these? */ - } netif; } d_kind; }; ==== //depot/projects/ia64/sys/boot/i386/loader/main.c#13 (text+ko) ==== @@ -201,11 +201,11 @@ if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) { /* we are booting from a CD with cdboot */ new_currdev.d_dev = &bioscd; - new_currdev.d_kind.bioscd.unit = bc_bios2unit(initial_bootdev); + new_currdev.d_unit = bc_bios2unit(initial_bootdev); } else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) { /* we are booting from pxeldr */ new_currdev.d_dev = &pxedisk; - new_currdev.d_kind.netif.unit = 0; + new_currdev.d_unit = 0; } else { /* we don't know what our boot device is */ new_currdev.d_kind.biosdisk.slice = -1; @@ -240,10 +240,10 @@ * which one we booted off of, just use disk0: as a reasonable default. */ if ((new_currdev.d_type == biosdisk.dv_type) && - ((new_currdev.d_kind.biosdisk.unit = bd_bios2unit(biosdev)) == -1)) { + ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) { printf("Can't work out which disk we are booting from.\n" "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); - new_currdev.d_kind.biosdisk.unit = 0; + new_currdev.d_unit = 0; } env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), i386_setcurrdev, env_nounset); ==== //depot/projects/ia64/sys/boot/ofw/libofw/libofw.h#8 (text+ko) ==== @@ -31,6 +31,7 @@ struct ofw_devdesc { struct devsw *d_dev; int d_type; + int d_unit; ihandle_t d_handle; char d_path[256]; }; ==== //depot/projects/ia64/sys/boot/pc98/libpc98/bioscd.c#2 (text) ==== @@ -192,7 +192,7 @@ va_start(ap, f); dev = va_arg(ap, struct i386_devdesc *); va_end(ap); - if (dev->d_kind.bioscd.unit >= nbcinfo) { + if (dev->d_unit >= nbcinfo) { DEBUG("attempt to open nonexistent disk"); return(ENXIO); } @@ -227,7 +227,7 @@ if (rw != F_READ) return(EROFS); dev = (struct i386_devdesc *)devdata; - unit = dev->d_kind.bioscd.unit; + unit = dev->d_unit; blks = size / BIOSCD_SECSIZE; if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0) return (EINVAL); @@ -321,7 +321,7 @@ int major; int rootdev; - unit = dev->d_kind.bioscd.unit; + unit = dev->d_unit; biosdev = bc_unit2bios(unit); DEBUG("unit %d BIOS device %d", unit, biosdev); if (biosdev == -1) /* not a BIOS device */ ==== //depot/projects/ia64/sys/boot/pc98/libpc98/biosdisk.c#12 (text+ko) ==== @@ -256,7 +256,7 @@ pager_output(line); /* try to open the whole disk */ - dev.d_kind.biosdisk.unit = i; + dev.d_unit = i; dev.d_kind.biosdisk.slice = -1; dev.d_kind.biosdisk.partition = -1; @@ -385,7 +385,7 @@ int error; char buf[BUFSIZE]; - if (dev->d_kind.biosdisk.unit >= nbdinfo) { + if (dev->d_unit >= nbdinfo) { DEBUG("attempt to open nonexistent disk"); return(ENXIO); } @@ -397,14 +397,14 @@ } /* Look up BIOS unit number, intialise open_disk structure */ - od->od_dkunit = dev->d_kind.biosdisk.unit; + od->od_dkunit = dev->d_unit; od->od_unit = bdinfo[od->od_dkunit].bd_unit; od->od_flags = bdinfo[od->od_dkunit].bd_flags; od->od_boff = 0; od->od_nslices = 0; error = 0; DEBUG("open '%s', unit 0x%x slice %d partition %c", - i386_fmtdev(dev), dev->d_kind.biosdisk.unit, + i386_fmtdev(dev), dev->d_unit, dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition + 'a'); /* Get geometry for this open (removable device may have changed) */ @@ -1058,8 +1058,8 @@ char *nip, *cp; int unitofs = 0, i, unit; - biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit); - DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev); + biosdev = bd_unit2bios(dev->d_unit); + DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev); if (biosdev == -1) /* not a BIOS device */ return(-1); if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */ @@ -1067,7 +1067,7 @@ if ((biosdev & 0xf0) == 0x90 || (biosdev & 0xf0) == 0x30) { /* floppy (or emulated floppy) or ATAPI device */ - if (bdinfo[dev->d_kind.biosdisk.unit].bd_type == DT_ATAPI) { + if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) { /* is an ATAPI disk */ major = WFDMAJOR; } else { @@ -1093,7 +1093,7 @@ } /* default root disk unit number */ if ((biosdev & 0xf0) == 0xa0) - unit = bdinfo[dev->d_kind.biosdisk.unit].bd_da_unit; + unit = bdinfo[dev->d_unit].bd_da_unit; else unit = biosdev & 0xf; ==== //depot/projects/ia64/sys/boot/pc98/loader/main.c#11 (text+ko) ==== @@ -193,11 +193,11 @@ if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) { /* we are booting from a CD with cdboot */ new_currdev.d_dev = &bioscd; - new_currdev.d_kind.bioscd.unit = bc_bios2unit(initial_bootdev); + new_currdev.d_unit = bc_bios2unit(initial_bootdev); } else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) { /* we are booting from pxeldr */ new_currdev.d_dev = &pxedisk; - new_currdev.d_kind.netif.unit = 0; + new_currdev.d_unit = 0; } else { /* we don't know what our boot device is */ new_currdev.d_kind.biosdisk.slice = -1; @@ -236,10 +236,10 @@ * which one we booted off of, just use disk0: as a reasonable default. */ if ((new_currdev.d_type == biosdisk.dv_type) && - ((new_currdev.d_kind.biosdisk.unit = bd_bios2unit(biosdev)) == -1)) { + ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) { printf("Can't work out which disk we are booting from.\n" "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); - new_currdev.d_kind.biosdisk.unit = 0; + new_currdev.d_unit = 0; } env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), i386_setcurrdev, env_nounset);