From owner-p4-projects@FreeBSD.ORG Fri Oct 27 05:02:35 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 8B92416A47E; Fri, 27 Oct 2006 05:02:35 +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 2EF1816A47B for ; Fri, 27 Oct 2006 05:02:35 +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 4F3AE43D5F for ; Fri, 27 Oct 2006 05:02:34 +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 k9R52YcI029959 for ; Fri, 27 Oct 2006 05:02:34 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9R52X43029956 for perforce@freebsd.org; Fri, 27 Oct 2006 05:02:33 GMT (envelope-from marcel@freebsd.org) Date: Fri, 27 Oct 2006 05:02:33 GMT Message-Id: <200610270502.k9R52X43029956@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 108545 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: Fri, 27 Oct 2006 05:02:35 -0000 http://perforce.freebsd.org/chv.cgi?CH=108545 Change 108545 by marcel@marcel_cluster on 2006/10/27 05:01:41 Sync with current libefi. Affected files ... .. //depot/projects/ia64/sys/boot/ia64/common/devicename.c#2 edit .. //depot/projects/ia64/sys/boot/ia64/efi/conf.c#3 edit .. //depot/projects/ia64/sys/boot/ia64/efi/main.c#3 edit Differences ... ==== //depot/projects/ia64/sys/boot/ia64/common/devicename.c#2 (text+ko) ==== @@ -34,9 +34,8 @@ #include #include -#include "efiboot.h" -static int efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path); +static int efi_parsedev(struct devdesc **dev, const char *devspec, const char **path); /* * Point (dev) at an allocated device specifier for the device matching the @@ -46,7 +45,7 @@ int efi_getdev(void **vdev, const char *devspec, const char **path) { - struct efi_devdesc **dev = (struct efi_devdesc **)vdev; + struct devdesc **dev = (struct devdesc **)vdev; int rv; /* @@ -80,143 +79,79 @@ * * For disk-type devices, the syntax is: * - * disk[s][]: - * + * fs: */ static int -efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path) +efi_parsedev(struct devdesc **dev, const char *devspec, const char **path) { - struct efi_devdesc *idev; + struct devdesc *idev; struct devsw *dv; - int i, unit, slice, partition, err; + int i, err; char *cp; const char *np; /* minimum length check */ if (strlen(devspec) < 2) - return(EINVAL); + return (EINVAL); /* look for a device that matches */ - for (i = 0, dv = NULL; devsw[i] != NULL; i++) { - if (!strncmp(devspec, devsw[i]->dv_name, strlen(devsw[i]->dv_name))) { - dv = devsw[i]; + for (i = 0; devsw[i] != NULL; i++) { + dv = devsw[i]; + if (!strncmp(devspec, dv->dv_name, strlen(dv->dv_name))) break; - } } + if (devsw[i] == NULL) + return (ENOENT); + + idev = malloc(sizeof(struct devdesc)); + if (idev == NULL) + return (ENOMEM); + idev->d_dev = dv; + idev->d_type = dv->dv_type; + idev->d_unit = -1; - if (dv == NULL) - return(ENOENT); - idev = malloc(sizeof(struct efi_devdesc)); err = 0; np = (devspec + strlen(dv->dv_name)); - - switch(dv->dv_type) { - case DEVT_NONE: /* XXX what to do here? Do we care? */ - break; - - case DEVT_DISK: - unit = -1; - slice = -1; - partition = -1; - if (*np && (*np != ':')) { - unit = strtol(np, &cp, 10); /* next comes the unit number */ - if (cp == np) { - err = EUNIT; - goto fail; - } - if (*cp == 's') { /* got a slice number */ - np = cp + 1; - slice = strtol(np, &cp, 10); - if (cp == np) { - err = ESLICE; - goto fail; - } - } - if (*cp && (*cp != ':')) { - partition = *cp - 'a'; /* get a partition number */ - if ((partition < 0) || (partition >= MAXPARTITIONS)) { - err = EPART; - goto fail; - } - cp++; - } + if (*np && (*np != ':')) { + idev->d_unit = strtol(np, &cp, 0); + if (cp == np) { + idev->d_unit = -1; + free(idev); + return (EUNIT); } - if (*cp && (*cp != ':')) { - err = EINVAL; - goto fail; - } - - idev->d_kind.efidisk.unit = unit; - idev->d_kind.efidisk.slice = slice; - idev->d_kind.efidisk.partition = partition; - - if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; - break; - - case DEVT_NET: - unit = 0; - - if (*np && (*np != ':')) { - unit = strtol(np, &cp, 0); /* get unit number if present */ - if (cp == np) { - err = EUNIT; - goto fail; - } - } - if (*cp && (*cp != ':')) { - err = EINVAL; - goto fail; - } - - idev->d_kind.netif.unit = unit; - if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; - break; - - default: - err = EINVAL; - goto fail; } - idev->d_dev = dv; - idev->d_type = dv->dv_type; - if (dev == NULL) { + if (*cp && (*cp != ':')) { free(idev); - } else { + return (EINVAL); + } + + if (path != NULL) + *path = (*cp == 0) ? cp : cp + 1; + if (dev != NULL) *dev = idev; - } + else + free(idev); return(0); - - fail: - free(idev); - return(err); } char * efi_fmtdev(void *vdev) { - struct efi_devdesc *dev = (struct efi_devdesc *)vdev; + struct devdesc *dev = (struct devdesc *)vdev; static char buf[128]; /* XXX device length constant? */ - char *cp; - + switch(dev->d_type) { case DEVT_NONE: strcpy(buf, "(no device)"); break; case DEVT_DISK: - cp = buf; - cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.efidisk.unit); - if (dev->d_kind.efidisk.slice > 0) - cp += sprintf(cp, "s%d", dev->d_kind.efidisk.slice); - if (dev->d_kind.efidisk.partition >= 0) - cp += sprintf(cp, "%c", dev->d_kind.efidisk.partition + 'a'); - strcat(cp, ":"); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); 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); @@ -227,9 +162,9 @@ * Set currdev to suit the value being supplied in (value) */ int -efi_setcurrdev(struct env_var *ev, int flags, void *value) +efi_setcurrdev(struct env_var *ev, int flags, const void *value) { - struct efi_devdesc *ncurr; + struct devdesc *ncurr; int rv; if ((rv = efi_parsedev(&ncurr, value, NULL)) != 0) ==== //depot/projects/ia64/sys/boot/ia64/efi/conf.c#3 (text+ko) ==== @@ -38,8 +38,6 @@ #include #include -#include "efiboot.h" - /* * We could use linker sets for some or all of these, but * then we would have to control what ended up linked into @@ -57,15 +55,15 @@ }; struct fs_ops *file_system[] = { - &efi_fsops, -/* &ufs_fsops, */ + &efifs_fsops, + &ufs_fsops, &nfs_fsops, &gzipfs_fsops, NULL }; struct netif_driver *netif_drivers[] = { - &efi_net, + &efinetif, NULL, }; ==== //depot/projects/ia64/sys/boot/ia64/efi/main.c#3 (text+ko) ==== @@ -40,7 +40,6 @@ #include #include "bootstrap.h" -#include "efiboot.h" /* DIG64 Headless Console & Debug Port Table. */ #define HCDP_TABLE_GUID \ @@ -51,8 +50,16 @@ extern char bootprog_date[]; extern char bootprog_maker[]; -struct efi_devdesc currdev; /* our current device */ -struct arch_switch archsw; /* MI/MD interface boundary */ +extern int efi_autoload(void); +extern char *efi_fmtdev(void *vdev); +extern int efi_getdev(void **vdev, const char *devspec, const char **path); +extern int efi_setcurrdev(struct env_var *ev, int flags, const void *value); +extern ssize_t efi_copyin(const void *src, vm_offset_t dest, size_t len); +extern ssize_t efi_copyout(const vm_offset_t src, void *dest, size_t len); +extern ssize_t efi_readin(int fd, vm_offset_t dest, size_t len); + +struct devdesc currdev; /* our current device */ +struct arch_switch archsw; /* MI/MD interface boundary */ extern u_int64_t ia64_pal_entry; @@ -144,13 +151,10 @@ i = efifs_get_unit(img->DeviceHandle); if (i >= 0) { currdev.d_dev = devsw[0]; /* XXX disk */ - currdev.d_kind.efidisk.unit = i; - /* XXX should be able to detect this, default to autoprobe */ - currdev.d_kind.efidisk.slice = -1; - currdev.d_kind.efidisk.partition = 0; + currdev.d_unit = i; } else { currdev.d_dev = devsw[1]; /* XXX net */ - currdev.d_kind.netif.unit = 0; /* XXX */ + currdev.d_unit = 0; /* XXX */ } currdev.d_type = currdev.d_dev->dv_type;