AGESA_STATUS agesawrapper_amdinitmid(void) { AGESA_STATUS status; AMD_INTERFACE_PARAMS AmdParamStruct; AMD_MID_PARAMS *MidParam; memset(&AmdParamStruct, 0, sizeof(AMD_INTERFACE_PARAMS)); AmdParamStruct.AgesaFunctionName = AMD_INIT_MID; AmdParamStruct.AllocationMethod = PostMemDram; AmdParamStruct.StdHeader.AltImageBasePtr = 0; AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; AmdParamStruct.StdHeader.Func = 0; AmdParamStruct.StdHeader.ImageBasePtr = 0; AmdCreateStruct(&AmdParamStruct); /* OEM Should Customize the defaults through this hook. */ MidParam = (AMD_MID_PARAMS *) AmdParamStruct.NewStructPtr; if (OemHook->InitMid) OemHook->InitMid(MidParam); status = AmdInitMid(MidParam); AGESA_EVENTLOG(status, &MidParam->StdHeader); AmdReleaseStruct(&AmdParamStruct); return status; }
VOID EFIAPI InvokeAmdInitMid ( IN EFI_EVENT Event, IN VOID *Context ) /*++ Routine Description: Installs the AmdInitMid This function gets called each time the EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled Arguments & Return Values: Standard event handling function prototype --*/ { AMD_INTERFACE_PARAMS AmdInterfaceParams; AGESA_STATUS AgesaStatus; AMD_DXE_INIT_MID_PROTOCOL AmdInitMidProtocol; EFI_HANDLE Handle; STATIC BOOLEAN InitMidInvoked = FALSE; // // Prepare for AmdInitMid // if (!InitMidInvoked) { ZeroMem (&AmdInterfaceParams, sizeof (AMD_INTERFACE_PARAMS)); AmdInterfaceParams.StdHeader.ImageBasePtr = 0; AmdInterfaceParams.StdHeader.HeapStatus = HEAP_SYSTEM_MEM; AmdInterfaceParams.AllocationMethod = PostMemDram; AmdInterfaceParams.AgesaFunctionName = AMD_INIT_MID; AgesaStatus = AmdCreateStruct (&AmdInterfaceParams); ((AMD_MID_PARAMS *)AmdInterfaceParams.NewStructPtr)->StdHeader = AmdInterfaceParams.StdHeader; OemCustomizeInitMid (gBS, (AMD_MID_PARAMS *)AmdInterfaceParams.NewStructPtr); AgesaStatus = AmdInitMid ((AMD_MID_PARAMS *)AmdInterfaceParams.NewStructPtr); OemHookAfterInitMid (gBS, (AMD_MID_PARAMS *)AmdInterfaceParams.NewStructPtr); if ((AgesaStatus == AGESA_CRITICAL) || (AgesaStatus == AGESA_FATAL)) { return; } AmdInitMidProtocol.Revision = AGESA_DXE_INIT_MID_REV; Handle = NULL; gBS->InstallProtocolInterface ( &Handle, &gAmdDxeInitMidProtocolGuid, EFI_NATIVE_INTERFACE, &AmdInitMidProtocol ); } InitMidInvoked = TRUE; }
AGESA_STATUS agesawrapper_amdinitmid(void) { AGESA_STATUS status; AMD_INTERFACE_PARAMS AmdParamStruct; AMD_MID_PARAMS *MidParam; /* Enable MMIO on AMD CPU Address Map Controller */ amd_initcpuio (); LibAmdMemFill (&AmdParamStruct, 0, sizeof (AMD_INTERFACE_PARAMS), &(AmdParamStruct.StdHeader)); AmdParamStruct.AgesaFunctionName = AMD_INIT_MID; AmdParamStruct.AllocationMethod = PostMemDram; AmdParamStruct.StdHeader.AltImageBasePtr = 0; AmdParamStruct.StdHeader.CalloutPtr = &GetBiosCallout; AmdParamStruct.StdHeader.Func = 0; AmdParamStruct.StdHeader.ImageBasePtr = 0; AmdCreateStruct (&AmdParamStruct); MidParam = (AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr; MidParam->GnbMidConfiguration.iGpuVgaMode = 0;/* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */ MidParam->GnbMidConfiguration.GnbIoapicAddress = 0xFEC20000; MidParam->FchInterface.AzaliaController = AzEnable; MidParam->FchInterface.SataClass = CONFIG_HUDSON_SATA_MODE; MidParam->FchInterface.SataEnable = !((CONFIG_HUDSON_SATA_MODE == 0) || (CONFIG_HUDSON_SATA_MODE == 3)); MidParam->FchInterface.IdeEnable = (CONFIG_HUDSON_SATA_MODE == 0) || (CONFIG_HUDSON_SATA_MODE == 3); MidParam->FchInterface.SataIdeMode = (CONFIG_HUDSON_SATA_MODE == 3); status = AmdInitMid ((AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr); if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus); AmdReleaseStruct (&AmdParamStruct); return status; }