Skip to contentSkip to conversation

Deterimining EFI device number within Linux?

Linux-ia64 [email protected] 3 participants 4 messages Mar 27, 2001 – Mar 28, 2001

lore
Share & tools
lore
#0 lore raw

Does anyone know how to determine the EFI Device Number (such as 0x80) for a disk known as /dev/sda, under Linux (ideally from user-space, but I'd take a kernel-space trick too)? There's an equivalent problem in IA-32 which has no known solution. I'm hoping there is for EFI<->Linux.

The problem I'm trying to solve is that my eli2bootmgr program, which puts eli labels into the EFI Boot Manager, needs to correctly identify to EFI which EFI device contains the file system with a \eli.efi application. I also need to know disk geometry, partition type (GPT, MBR), and the like, but I believe I can manage that.

Maybe my approach to this is wrong. I'm writing a Linux user-space application to frob the boot manager. Maybe I should be considering writing an EFI app instead?

Thanks,
Matt

--
Matt Domsch
Sr. Software Engineer
Dell Linux Systems Group
Linux OS Development
www.dell.com/linux

#1 lore raw

Does anyone know how to determine the EFI Device Number (such as 0x80) for a disk known as /dev/sda, under Linux (ideally from user-space, but I'd take a kernel-space trick too)? There's an equivalent problem in IA-32 which has no known solution. I'm hoping there is for EFI<->Linux.

The problem I'm trying to solve is that my eli2bootmgr program, which puts eli labels into the EFI Boot Manager, needs to correctly identify to EFI which EFI device contains the file system with a \eli.efi application. I also need to know disk geometry, partition type (GPT, MBR), and the like, but I believe I can manage that.

Maybe my approach to this is wrong. I'm writing a Linux user-space application to frob the boot manager. Maybe I should be considering writing an EFI app instead?

Thanks,
Matt

--
Matt Domsch
Sr. Software Engineer
Dell Linux Systems Group
Linux OS Development
www.dell.com/linux

#2 lore raw
In reply to [email protected]
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Tue, 27 Mar 2001 17:18:50 -0600, [email protected] said:

Matt> Does anyone know how to determine the EFI Device Number (such Matt> as 0x80) for a disk known as /dev/sda, under Linux (ideally Matt> from user-space, but I'd take a kernel-space trick too)? Matt> There's an equivalent problem in IA-32 which has no known Matt> solution. I'm hoping there is for EFI<->Linux.

I imagine you'd have to determine the hardware path to do so. I'm not sure of the format used by EFI (I think it follows some standard, but I'm not familiar with the details), but I'd expect that you'd need to know the SCSI id, PCI bus, slot & function number of the controller, the sequence of PCI bridges from the CPU to the device, etc. Linux has all this information in one place or another (ioctl(), /proc/pci, etc.), but it probably won't be pretty.

	--david
#3 lore raw
In reply to [email protected]

Matt,

Quoted 4 lines · On Tue, Mar 27, 2001 at 05:18:50PM -0600, [email protected] wrote:

Does anyone know how to determine the EFI Device Number (such as 0x80) for a disk known as /dev/sda, under Linux (ideally from user-space, but I'd take a kernel-space trick too)? There's an equivalent problem in IA-32 which has no known solution. I'm hoping there is for EFI<->Linux.

If you forget about the bios 0x80 stuff, EFI uses device paths as can be seen from the EFI shell by typing map. The text on the righthand side is the device path. It is based on some PCI, ACPI stuff. There is no connection with the Linux way of doing things.

For instance:
fs0 : VenHw(Unknown Device:80)/HD(Part1,Sig00000000)

If you forget about fs0, there is no a priori way to map VenHw(Unknown Device:80)/HD(Part1,Sig00000000) to /dev/sda. You would have to know how (the order) the devices get scanned by both EFI and Linux to make the connection. As David pointed out, your best chances are to reconstruct the hardware path to the device (including partitions) and to somehow convert this into the equivalent EFI device path.

Signature · 1 line
-Stephane