[if gte mso 9]>

Re: [edk2] Xen OVMF early discussions

Subject: Re: [edk2] Xen OVMF early discussions

From: "Sun, Rui" <rui.sun@intel.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>, Andrei Warkentin <andreiw@motorola.com>

Date: 2011-05-27 05:13:57

Hi, Bei,


You can set the corresponding bit for DEBUG_GCD (0x00100000) in gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel in the DSC file for OVMF so that GCD related debug messages can be printed out.


From: Bei Guan [mailto:gbtju85@gmail.com]
Sent: Thursday, May 26, 2011 4:13 PM
To: Andrei Warkentin
Cc: edk2-devel@lists.sourceforge.net; Tim.Deegan@citrix.com
Subject: Re: [edk2] Xen OVMF early discussions



2011/5/26 Bei Guan <gbtju85@gmail.com>


2011/5/26 Bei Guan <gbtju85@gmail.com>


2011/5/25 Andrei Warkentin <andreiw@motorola.com>

Hi Bei,

How are you doing with figuring out what's wrong with the PciBusDxe's
handling of the IDE controller PCI device?


Hi Andrei,


I think I have found the problem. And the location where the problem happens is at



733      //

734      // If remaining device path is NULL,

735      // try to enable all the pci devices under this bridge

736      //

737      if (!PciIoDevice->Registered && PciIoDevice->Allocated) {

738       Status = RegisterPciDevice (

739                   Controller,

740                   PciIoDevice,

741                   NULL

742                   );


744      }


I will give details about this later.

I should say some more about the above code before I find the root of the problem later.

I have located the above code through printing the pci devices in HandleBuffer, which adds in the pci devices one by one in the method StartPciDevicesOnBridge. And I find that all the pci devices with the attributes

PciIoDevice->Registered = 0 and  PciIoDevice->Allocated = 1 except these two ones  DEV(00,01,01) and DEV(00,01,02), which have PciIoDevice->Registered = 0 and  PciIoDevice->Allocated = 0. So, the device handles of these two pci devices has not be created by PCI bus driver, which would be done in function RegisterPciDevice();


And also, I printed the attributes "Registered" and "Allocated" of all the pci devices when they be saned at first time. All the devices have PciIoDevice->Registered = 0 and  PciIoDevice->Allocated = 0. So, the value of attribute "Allocated" must be changed at somewhere later. However, maybe some devices or certain kinds of devices must no be changed. I will find this later.


I got some more infomation about this problem. 

The return value of the following method is EFI_NOT_FOUND. 


Part code of method NotifyPhase()

326             Status = gDS->AllocateIoSpace (

327                             EfiGcdAllocateAnySearchBottomUp, 

328                             EfiGcdIoTypeIo, 

329                             BitsOfAlignment,

330                             AddrLen,

331                             &BaseAddress,

332                             mDriverImageHandle,

333                             NULL

334                             );


Now, I have traced the error to the code file Gcd.c and locat the method CoreAllocateSpace(). The action of the following code is not like that on QEMU. I will continue to investigate it.


1091    while (Link != Map) {

1092      Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);


1094      if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||

1095          GcdAllocateType == EfiGcdAllocateAnySearchTopDown           ) {

1096        Link = Link->BackLink;

1097      } else {

1098        Link = Link->ForwardLink;

1099      }


1101      Status = CoreAllocateSpaceCheckEntry (Operation, Entry, GcdMemoryType, GcdIoType);

1102      if (EFI_ERROR (Status)) {

1103        continue;

1104      }


I find some debug message in Gcd.c, such as 


DEBUG ((DEBUG_GCD, "  Status = %r", Status));


How can I make it work and where can I find the output message?




Bei Guan




BTW, if I change the code 


737      if (!PciIoDevice->Registered && PciIoDevice->Allocated) {




737      if (!PciIoDevice->Registered) {


and the device CDROM can present in the EFI Shell.




Bei Guan





Bei Guan