2 * Copyright (C) 2001-2003 Hewlett-Packard Co.
3 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
5 * This file is part of the ELILO, the EFI Linux boot loader.
7 * ELILO is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * ELILO is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with ELILO; see the file COPYING. If not, write to the Free
19 * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 * Look at the README.devschemes for more explanations on how
32 #define NAMING_SCHEME L"simple"
37 INTN (*device_func)(device_t *dev, EFI_DEVICE_PATH *dp);
41 static UINT32 atapi_count, scsi_count, net_count;
44 atapi_device(device_t *dev, EFI_DEVICE_PATH *dp)
46 //ATAPI_DEVICE_PATH *atapi = (ATAPI_DEVICE_PATH *)dp;
54 SPrint(dev->name+5,FILEOPS_DEVNAME_MAXLEN-5-1, L"%d", atapi_count);
61 scsi_device(device_t *dev, EFI_DEVICE_PATH *dp)
63 //SCSI_DEVICE_PATH *scsi = (SCSI_DEVICE_PATH *)dp;
70 SPrint(dev->name+4, FILEOPS_DEVNAME_MAXLEN-4-1, L"%d", scsi_count);
77 network_device(device_t *dev, EFI_DEVICE_PATH *dp)
79 //MAC_ADDR_DEVICE_PATH *mac = (MAC_ADDR_DEVICE_PATH *)dp;
85 SPrint(dev->name+3, FILEOPS_DEVNAME_MAXLEN-3-1, L"%d", net_count);
92 * what we are looking for in the device path
94 static devices_types_t dev_types[]={
95 { MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, atapi_device},
96 { MESSAGING_DEVICE_PATH, MSG_SCSI_DP, scsi_device},
97 { MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, network_device},
102 simple_scheme(device_t *tab, UINTN n)
104 EFI_DEVICE_PATH *dp1, *dp;
109 * note that this test is necessary but not sufficient to guarantee that this scheme
110 * will work because, we have no way of detecting that the machine got actually
111 * rebooted if the EDD30 variable was forced. this comes from the fact, that elilo
112 * can be invoked once, aborted and then restarted with no machine reboot.
114 * XXX: there may be a way to detect this with the another variable which would
115 * be in volatile memory only
117 if (elilo_opt.edd30_on == 0) {
118 VERB_PRT(4, Print(L"%s device naming scheme only works with EDD3.0 enabled\n", NAMING_SCHEME));
122 for(i=0; i < n; i++) {
123 dp = DevicePathFromHandle(tab[i].dev);
125 ERR_PRT((L"cannot get device path for device %d", i));
128 dp1 = dp = UnpackDevicePath(dp);
130 while (!IsDevicePathEnd(dp)) {
133 if ( p->type == DevicePathType(dp)
134 && p->subtype == DevicePathSubType(dp)) {
135 (*p->device_func)(tab+i, dp);
141 dp = NextDevicePathNode(dp);
149 devname_scheme_t simple_devname_scheme={