Re: [edk2] Xen OVMF early discussions

Subject: Re: [edk2] Xen OVMF early discussions

From: Bei Guan <>

To: Andrei Warkentin <>

Date: 2011-05-24 01:10:53

2011/5/23 Bei Guan <>

2011/5/22 Andrei Warkentin <>
Hi Bei,

On Sat, May 21, 2011 at 12:36 PM, Bei Guan <> wrote:
> I tried to locate the main code file or function which detect the devices
> (HardDisk and CDRom) and add them the boot order. But, it seems a little
> hard to do thisthrough the boot trace log of OVMF.
> 2011/5/22 Bei Guan <>
>> HiJordan,
>> Could you tell me how OVMF can detect the HardDisk device when option
>> "-hda" is used in the command line? And how OVMF can detect theCDRom device
>> when option "-cdrom" is used? Which main code file or main function does
>> that? I think these information may be helpful to check why OVMF can't
>> detect the HardDisk and CDROM defined in Xen domain config file.
>> Thanks,
>> Bei Guan

Overall, the flow is something like this -

1) PciBusDxe creates the handles associated with PCI Ide controllers
2) IdeControllerDxe binds to PCI handles that are IDE devices, and
3) IdeBusDxe binds to all handles with the
IDE_CONTROLLER_INIT_PROTOCOL, and scans for attached devices.

So you would want to a) check if IdeControllerDxe ever had it's
Start() method called on anything, and if not, see why Supported()
fails on an IDE PCI device.
b) check if IdeBusDxe fails to enumerate IDE bus (check Start() method)
IdeBusDxe Start() method isn't called. (IdeBus.c: IDEBusDriverBindingStart())
IdeControllerDxe Start() method also isn't called. (IdeController.c: IdeControllerStart())
In IdeControllerDxe Support() method, gBS->OpenProtocol()(line 131) return with Status EFI_UNSUPPORTED (0x80000003) when called after the PciBusDxe Start. (IdeController.c: IdeControllerSupported())
But, it is the same with OVMF on QEMU.

From the boot log, I found that all the PCI devices are scanned, such as

PCI Bus First Scanning
Found DEV(00,00,00)
Found DEV(00,01,00)
Found DEV(00,01,01)
Found DEV(00,01,02)
Found DEV(00,01,03)
Found DEV(00,02,00)
Found DEV(00,03,00)
Found DEV(00,04,00)

All the handles of the devices above are created by PciBusDxe Start(), is it?

And then, in the method VisitAllInstancesOfProtocol() of BdsPlatform.c, gBS->LocateHandleBuffer() is to check the PciIoto find all possible devices. However, gBS->LocateHandleBuffer() can't find some of the Pci devices scanned before, forexample device (00,01,01) and (00,01,02). I don't understand why it can't find the devices in LocateHandleBuffer() even I change parameter ByProtocol to AllHandles(see below).I am not sure this question is useful to our problem? When OVMF on QEMU, after device(00,01,01) found ingBS->LocateHandleBuffer(),IdeControllerSupported is called to check the controller.

Part code inVisitAllInstancesOfProtocol() of BdsPlatform.c
460 Status = gBS->LocateHandleBuffer (
461 ByProtocol,
462 Id,
463 NULL,
464 &HandleCount,
465 &HandleBuffer
466 );

However, device(00,01,01) can be found ingBS->LocateHandleBuffer() whenOVMF on QEMU. The detailed information of related devices is as following.
VendorId: 8086, DeviceId: 7010, RevisionID: 0, SubsystemVendorID: 1AF4, SubsystemID: 1100, ClassCode[0]: 80, ClassCode[1]: 1, ClassCode[2]: 1

VendorId: 8086, DeviceId: 7010, RevisionID: 0, SubsystemVendorID: 5853, SubsystemID: 1, ClassCode[0]: 80, ClassCode[1]: 1, ClassCode[2]: 1
VendorId: 8086, DeviceId: 7020, RevisionID: 1, SubsystemVendorID: 1AF4, SubsystemID: 1100, ClassCode[0]: 0, ClassCode[1]: 3, ClassCode[2]: C

Bei Guan