[if gte mso 9]>

Re: [edk2] Please Help: `_PCD_GET_MODE_16_PcdOvmfHostBridgePciDevId' undeclared

Subject: Re: [edk2] Please Help: `_PCD_GET_MODE_16_PcdOvmfHostBridgePciDevId' undeclared

From: "Gao, Liming" <liming.gao@intel.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>, Gabriel Somlo <gsomlo@gmail.com>

Date: 2014-10-23 14:05:41

Somlo:

  Your patch shows four AcpiTimerLib instances: AcpiTimerLib.inf, BaseAcpiTimerLib.inf, BaseRomAcpiTimerLib.inf and DxeAcpiTimerLib.inf.

 

 I find BaseAcpiTimerLib.inf includes DxeAcpiTimerLib.c that uses PCD. But it doesn’t add gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId in its INF file. So, it will build failure, because this PCD can’t be found.

 

Thanks

Liming

From: Andrew Fish [mailto:afish@apple.com]
Sent: Thursday, October 23, 2014 4:30 AM
To: Gabriel Somlo
Cc: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Please Help: `_PCD_GET_MODE_16_PcdOvmfHostBridgePciDevId' undeclared

 

 

On Oct 22, 2014, at 12:07 PM, Gabriel Somlo <gsomlo@gmail.com> wrote:

 

On Wed, Oct 22, 2014, Andrew Fish <afish@apple.com> wrote:


After doing this, things build just fine. But after further adding:


OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf:
[Pcd]
 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId


OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c:
...
HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);
...


I now get this error:

/home/somlo/KVM-OSX/SCRATCH/edk2/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c:
In function `AcpiTimerLibConstructor':
/home/somlo/KVM-OSX/SCRATCH/edk2/MdePkg/Include/Library/PcdLib.h:377:45:
error: `_PCD_GET_MODE_16_PcdOvmfHostBridgePciDevId' undeclared (first
use in this function)
#define PcdGet16(TokenName)
_PCD_GET_MODE_16_##TokenName
/home/somlo/KVM-OSX/SCRATCH/edk2/MdePkg/Include/Library/PcdLib.h:377:45:


This is usually an INF issue. What does the the AutoGen.h (with the library object files) files look like? That is where this should get declared.


$ find . -name AutoGen.h | grep AcpiTimer
./Build/OvmfX64/DEBUG_GCC48/X64/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib/DEBUG/AutoGen.h
./Build/OvmfX64/DEBUG_GCC48/X64/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib/DEBUG/AutoGen.h
./Build/OvmfX64/DEBUG_GCC48/X64/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib/DEBUG/AutoGen.h

 

Well that is strange? The AutoGen.h is force included, and it looks like it has the correct. #define? The CC Flags should have something like -include AutoGen.h. 

 

1st thing I would look into is a copy paste in the *.inf file of a GUID or library BaseName etc. 

 

You could look at the generated makefile to see if something strange is going on. GNUmakefile should be here: Build/OvmfX64/DEBUG_GCC48/X64/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib/

 

Thanks,

 

Andrew Fish




$cat ./Build/OvmfX64/DEBUG_GCC48/X64/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib/DEBUG/AutoGen.h
/**
 DO NOT EDIT
 FILE auto-generated
 Module name:
   AutoGen.h
 Abstract:       Auto-generated AutoGen.h for building module or library.
**/

#ifndef _AUTOGENH_52DECA02_2EE8_4EAA_8EAD_1AB83F8A5955
#define _AUTOGENH_52DECA02_2EE8_4EAA_8EAD_1AB83F8A5955

#ifdef __cplusplus
extern "C" {
#endif

#include <Base.h>
#include <Library/PcdLib.h>

extern GUID  gEfiCallerIdGuid;
extern CHAR8 *gEfiCallerBaseName;


// PCD definitions
#define _PCD_TOKEN_PcdOvmfHostBridgePciDevId  1U
#define _PCD_GET_MODE_16_PcdOvmfHostBridgePciDevId
LibPcdGet16(_PCD_TOKEN_PcdOvmfHostBridgePciDevId)
#define _PCD_SET_MODE_16_PcdOvmfHostBridgePciDevId(Value)
LibPcdSet16(_PCD_TOKEN_PcdOvmfHostBridgePciDevId, (Value))

RETURN_STATUS
EFIAPI
AcpiTimerLibConstructor (
 VOID
 );


#ifdef __cplusplus
}
#endif

#endif


Thanks much,
--Gabriel