[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


  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.




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:


HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);

I now get this error:

In function `AcpiTimerLibConstructor':
error: `_PCD_GET_MODE_16_PcdOvmfHostBridgePciDevId' undeclared (first
use in this function)
#define PcdGet16(TokenName)

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


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/




Andrew Fish

$cat ./Build/OvmfX64/DEBUG_GCC48/X64/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib/DEBUG/AutoGen.h
 FILE auto-generated
 Module name:
 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" {

#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
#define _PCD_SET_MODE_16_PcdOvmfHostBridgePciDevId(Value)
LibPcdSet16(_PCD_TOKEN_PcdOvmfHostBridgePciDevId, (Value))

AcpiTimerLibConstructor (

#ifdef __cplusplus


Thanks much,