From owner-freebsd-ia64 Wed Feb 26 8:10:18 2003 Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5314A37B401 for ; Wed, 26 Feb 2003 08:10:16 -0800 (PST) Received: from hermes.sc.intel.com (fmr03.intel.com [143.183.121.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A09B43FE1 for ; Wed, 26 Feb 2003 08:10:15 -0800 (PST) (envelope-from adsharma@unix-os.sc.intel.com) Received: from petasus.sc.intel.com (petasus.sc.intel.com [10.3.253.4]) by hermes.sc.intel.com (8.11.6/8.11.6/d: outer.mc,v 1.51 2002/09/23 20:43:23 dmccart Exp $) with ESMTP id h1QG7lT10948; Wed, 26 Feb 2003 16:07:47 GMT Received: from unix-os.sc.intel.com (unix-os.sc.intel.com [143.183.96.244]) by petasus.sc.intel.com (8.11.6/8.11.6/d: inner.mc,v 1.28 2003/01/13 19:44:39 dmccart Exp $) with ESMTP id h1QG9Gu03318; Wed, 26 Feb 2003 16:09:16 GMT Received: from unix-os.sc.intel.com.intel.com (vpnfm001-132.233.9-114-dhcp-client.fm.intel.com [132.233.9.114]) by unix-os.sc.intel.com (8.11.6/8.11.2) with ESMTP id h1QGABr10345; Wed, 26 Feb 2003 08:10:13 -0800 To: Marcel Moolenaar Cc: freebsd-ia64@FreeBSD.ORG Subject: Re: Slow loading of the kernel from efifs ? References: <200302251946.h1PJktr26424@unix-os.sc.intel.com> <20030225213120.GA49775@ns1.xcllnt.net> <20030226093438.GA17538@dhcp01.pn.xcllnt.net> From: Arun Sharma Date: 26 Feb 2003 08:10:11 -0800 In-Reply-To: <20030226093438.GA17538@dhcp01.pn.xcllnt.net> Message-ID: Lines: 79 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-ia64@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Marcel Moolenaar writes: > > Roughly, yes. I'm worried about the situation in which the handle is > invalid or not known to efifs_get_unit(). I've added a new check now. The code doesn't assume that !net => sfs. > Put differently: is the > handle always one corresponding a file I/O protocol if not a network > protocol or do we need to match transitively. See above. > I seem to recall that > the handle attached to the image describes a device, not necessarily > a file system. That's correct. fs_handles also describes devices that support the simple filesystem protocol. -Arun --- sys/boot/efi/libefi/efifs.c- Wed Feb 26 02:16:08 2003 +++ sys/boot/efi/libefi/efifs.c Wed Feb 26 02:50:25 2003 @@ -377,6 +377,19 @@ return 0; } +int +efifs_get_unit(EFI_HANDLE h) +{ + int i; + + for(i = 0; i < fs_handle_count; i++) { + if (fs_handles[i] == h) + return i; + } + + return -1; +} + struct devsw efifs_dev = { "fs", DEVT_DISK, --- sys/boot/efi/loader/main.c- Wed Feb 26 02:37:36 2003 +++ sys/boot/efi/loader/main.c Wed Feb 26 16:01:29 2003 @@ -60,6 +60,7 @@ EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; EFI_GUID mps = MPS_TABLE_GUID; EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL; +EFI_GUID sfsid = SIMPLE_FILE_SYSTEM_PROTOCOL; EFI_GUID sal = SAL_SYSTEM_TABLE_GUID; EFI_GUID smbios = SMBIOS_TABLE_GUID; @@ -104,6 +105,7 @@ { EFI_LOADED_IMAGE *img; EFI_SIMPLE_NETWORK *net; + EFI_FILE_IO_INTERFACE *sfs; EFI_STATUS status; int i; @@ -151,8 +153,14 @@ currdev.d_dev = devsw[1]; /* XXX net */ currdev.d_kind.netif.unit = 0; } else { + + status = BS->HandleProtocol(img->DeviceHandle, &sfsid, + (VOID **)&sfs); + if (EFI_ERROR(status)) + printf("Default device uses an unknown protocol\n"); + currdev.d_dev = devsw[0]; /* XXX disk */ - currdev.d_kind.efidisk.unit = 0; + currdev.d_kind.efidisk.unit = efifs_get_unit(img->DeviceHandle); /* XXX should be able to detect this, default to autoprobe */ currdev.d_kind.efidisk.slice = -1; /* default to 'a' */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ia64" in the body of the message