// The following bit value stands for "broadcast SMI" in the\r
// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files.\r
//\r
-#define ICH9_LPC_SMI_F_BROADCAST BIT0\r
+#define ICH9_LPC_SMI_F_BROADCAST BIT0\r
//\r
// The following bit value stands for "enable CPU hotplug, and inject an SMI\r
// with control value ICH9_APM_CNT_CPU_HOTPLUG upon hotplug", in the\r
// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files.\r
//\r
-#define ICH9_LPC_SMI_F_CPU_HOTPLUG BIT1\r
+#define ICH9_LPC_SMI_F_CPU_HOTPLUG BIT1\r
//\r
// The following bit value stands for "enable CPU hot-unplug, and inject an SMI\r
// with control value ICH9_APM_CNT_CPU_HOTPLUG upon hot-unplug", in the\r
// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files.\r
//\r
-#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG BIT2\r
+#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG BIT2\r
\r
//\r
// Provides a scratch buffer (allocated in EfiReservedMemoryType type memory)\r
//\r
#pragma pack (1)\r
typedef union {\r
- UINT64 Features;\r
- UINT8 FeaturesOk;\r
+ UINT64 Features;\r
+ UINT8 FeaturesOk;\r
} SCRATCH_BUFFER;\r
#pragma pack ()\r
\r
// "etc/smi/features-ok" fw_cfg files from NegotiateSmiFeatures() to\r
// AppendFwCfgBootScript().\r
//\r
-STATIC FIRMWARE_CONFIG_ITEM mRequestedFeaturesItem;\r
-STATIC FIRMWARE_CONFIG_ITEM mFeaturesOkItem;\r
+STATIC FIRMWARE_CONFIG_ITEM mRequestedFeaturesItem;\r
+STATIC FIRMWARE_CONFIG_ITEM mFeaturesOkItem;\r
\r
//\r
// Carries the negotiated SMI features from NegotiateSmiFeatures() to\r
// AppendFwCfgBootScript().\r
//\r
-STATIC UINT64 mSmiFeatures;\r
+STATIC UINT64 mSmiFeatures;\r
\r
/**\r
Negotiate SMI features with QEMU.\r
VOID\r
)\r
{\r
- FIRMWARE_CONFIG_ITEM SupportedFeaturesItem;\r
- UINTN SupportedFeaturesSize;\r
- UINTN RequestedFeaturesSize;\r
- UINTN FeaturesOkSize;\r
- UINT64 RequestedFeaturesMask;\r
+ FIRMWARE_CONFIG_ITEM SupportedFeaturesItem;\r
+ UINTN SupportedFeaturesSize;\r
+ UINTN RequestedFeaturesSize;\r
+ UINTN FeaturesOkSize;\r
+ UINT64 RequestedFeaturesMask;\r
\r
//\r
// Look up the fw_cfg files used for feature negotiation. The selector keys\r
// statically. If the files are missing, then QEMU doesn't support SMI\r
// feature negotiation.\r
//\r
- if (RETURN_ERROR (QemuFwCfgFindFile ("etc/smi/supported-features",\r
- &SupportedFeaturesItem, &SupportedFeaturesSize)) ||\r
- RETURN_ERROR (QemuFwCfgFindFile ("etc/smi/requested-features",\r
- &mRequestedFeaturesItem, &RequestedFeaturesSize)) ||\r
- RETURN_ERROR (QemuFwCfgFindFile ("etc/smi/features-ok",\r
- &mFeaturesOkItem, &FeaturesOkSize))) {\r
- DEBUG ((DEBUG_INFO, "%a: SMI feature negotiation unavailable\n",\r
- __FUNCTION__));\r
+ if (RETURN_ERROR (\r
+ QemuFwCfgFindFile (\r
+ "etc/smi/supported-features",\r
+ &SupportedFeaturesItem,\r
+ &SupportedFeaturesSize\r
+ )\r
+ ) ||\r
+ RETURN_ERROR (\r
+ QemuFwCfgFindFile (\r
+ "etc/smi/requested-features",\r
+ &mRequestedFeaturesItem,\r
+ &RequestedFeaturesSize\r
+ )\r
+ ) ||\r
+ RETURN_ERROR (\r
+ QemuFwCfgFindFile (\r
+ "etc/smi/features-ok",\r
+ &mFeaturesOkItem,\r
+ &FeaturesOkSize\r
+ )\r
+ ))\r
+ {\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "%a: SMI feature negotiation unavailable\n",\r
+ __FUNCTION__\r
+ ));\r
return FALSE;\r
}\r
\r
// If the files are present but their sizes disagree with us, that's a fatal\r
// error (we can't trust the behavior of SMIs either way).\r
//\r
- if (SupportedFeaturesSize != sizeof mSmiFeatures ||\r
- RequestedFeaturesSize != sizeof mSmiFeatures ||\r
- FeaturesOkSize != sizeof (UINT8)) {\r
- DEBUG ((DEBUG_ERROR, "%a: size mismatch in feature negotiation\n",\r
- __FUNCTION__));\r
+ if ((SupportedFeaturesSize != sizeof mSmiFeatures) ||\r
+ (RequestedFeaturesSize != sizeof mSmiFeatures) ||\r
+ (FeaturesOkSize != sizeof (UINT8)))\r
+ {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: size mismatch in feature negotiation\n",\r
+ __FUNCTION__\r
+ ));\r
goto FatalError;\r
}\r
\r
RequestedFeaturesMask |= ICH9_LPC_SMI_F_CPU_HOTPLUG;\r
RequestedFeaturesMask |= ICH9_LPC_SMI_F_CPU_HOT_UNPLUG;\r
}\r
+\r
mSmiFeatures &= RequestedFeaturesMask;\r
QemuFwCfgSelectItem (mRequestedFeaturesItem);\r
QemuFwCfgWriteBytes (sizeof mSmiFeatures, &mSmiFeatures);\r
//\r
QemuFwCfgSelectItem (mFeaturesOkItem);\r
if (QemuFwCfgRead8 () != 1) {\r
- DEBUG ((DEBUG_ERROR, "%a: negotiation failed for feature bitmap 0x%Lx\n",\r
- __FUNCTION__, mSmiFeatures));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: negotiation failed for feature bitmap 0x%Lx\n",\r
+ __FUNCTION__,\r
+ mSmiFeatures\r
+ ));\r
goto FatalError;\r
}\r
\r
// the original QEMU behavior (i.e., unicast SMI) used to differ.\r
//\r
if (RETURN_ERROR (PcdSet64S (PcdCpuSmmApSyncTimeout, 1000000)) ||\r
- RETURN_ERROR (PcdSet8S (PcdCpuSmmSyncMode, 0x00))) {\r
- DEBUG ((DEBUG_ERROR, "%a: PiSmmCpuDxeSmm PCD configuration failed\n",\r
- __FUNCTION__));\r
+ RETURN_ERROR (PcdSet8S (PcdCpuSmmSyncMode, 0x00)))\r
+ {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: PiSmmCpuDxeSmm PCD configuration failed\n",\r
+ __FUNCTION__\r
+ ));\r
goto FatalError;\r
}\r
+\r
DEBUG ((DEBUG_INFO, "%a: using SMI broadcast\n", __FUNCTION__));\r
}\r
\r
if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOTPLUG) == 0) {\r
DEBUG ((DEBUG_INFO, "%a: CPU hotplug not negotiated\n", __FUNCTION__));\r
} else {\r
- DEBUG ((DEBUG_INFO, "%a: CPU hotplug with SMI negotiated\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "%a: CPU hotplug with SMI negotiated\n",\r
+ __FUNCTION__\r
+ ));\r
}\r
\r
if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG) == 0) {\r
DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug not negotiated\n", __FUNCTION__));\r
} else {\r
- DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug with SMI negotiated\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "%a: CPU hot-unplug with SMI negotiated\n",\r
+ __FUNCTION__\r
+ ));\r
}\r
\r
//\r
VOID\r
EFIAPI\r
AppendFwCfgBootScript (\r
- IN OUT VOID *Context OPTIONAL,\r
- IN OUT VOID *ExternalScratchBuffer\r
+ IN OUT VOID *Context OPTIONAL,\r
+ IN OUT VOID *ExternalScratchBuffer\r
)\r
{\r
- SCRATCH_BUFFER *ScratchBuffer;\r
- RETURN_STATUS Status;\r
+ SCRATCH_BUFFER *ScratchBuffer;\r
+ RETURN_STATUS Status;\r
\r
ScratchBuffer = ExternalScratchBuffer;\r
\r
// Write the negotiated feature bitmap into "etc/smi/requested-features".\r
//\r
ScratchBuffer->Features = mSmiFeatures;\r
- Status = QemuFwCfgS3ScriptWriteBytes (mRequestedFeaturesItem,\r
- sizeof ScratchBuffer->Features);\r
+ Status = QemuFwCfgS3ScriptWriteBytes (\r
+ mRequestedFeaturesItem,\r
+ sizeof ScratchBuffer->Features\r
+ );\r
if (RETURN_ERROR (Status)) {\r
goto FatalError;\r
}\r
// Read back "etc/smi/features-ok". This invokes the feature validation &\r
// lockdown. (The validation succeeded at first boot.)\r
//\r
- Status = QemuFwCfgS3ScriptReadBytes (mFeaturesOkItem,\r
- sizeof ScratchBuffer->FeaturesOk);\r
+ Status = QemuFwCfgS3ScriptReadBytes (\r
+ mFeaturesOkItem,\r
+ sizeof ScratchBuffer->FeaturesOk\r
+ );\r
if (RETURN_ERROR (Status)) {\r
goto FatalError;\r
}\r
// If "etc/smi/features-ok" read as 1, we're good. Otherwise, hang the S3\r
// resume process.\r
//\r
- Status = QemuFwCfgS3ScriptCheckValue (&ScratchBuffer->FeaturesOk,\r
- sizeof ScratchBuffer->FeaturesOk, MAX_UINT8, 1);\r
+ Status = QemuFwCfgS3ScriptCheckValue (\r
+ &ScratchBuffer->FeaturesOk,\r
+ sizeof ScratchBuffer->FeaturesOk,\r
+ MAX_UINT8,\r
+ 1\r
+ );\r
if (RETURN_ERROR (Status)) {\r
goto FatalError;\r
}\r
\r
- DEBUG ((DEBUG_VERBOSE, "%a: SMI feature negotiation boot script saved\n",\r
- __FUNCTION__));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: SMI feature negotiation boot script saved\n",\r
+ __FUNCTION__\r
+ ));\r
return;\r
\r
FatalError:\r
CpuDeadLoop ();\r
}\r
\r
-\r
/**\r
Append a boot script fragment that will re-select the previously negotiated\r
SMI features during S3 resume.\r
VOID\r
)\r
{\r
- RETURN_STATUS Status;\r
+ RETURN_STATUS Status;\r
\r
//\r
// We are already running at TPL_CALLBACK, on the stack of\r
// OnS3SaveStateInstalled(). But that's okay, we can easily queue more\r
// notification functions while executing a notification function.\r
//\r
- Status = QemuFwCfgS3CallWhenBootScriptReady (AppendFwCfgBootScript, NULL,\r
- sizeof (SCRATCH_BUFFER));\r
+ Status = QemuFwCfgS3CallWhenBootScriptReady (\r
+ AppendFwCfgBootScript,\r
+ NULL,\r
+ sizeof (SCRATCH_BUFFER)\r
+ );\r
if (RETURN_ERROR (Status)) {\r
ASSERT (FALSE);\r
CpuDeadLoop ();\r