// // PEI 接收資料 // Status = (*PeiServices)->LocatePpi ( PeiServices, &gEfiPeiReadOnlyVariablePpiGuid, 0, NULL, &ReadOnlyVariable ); ASSERT_PEI_ERROR (PeiServices, Status); VariableSize = sizeof (SETUP_DATA); Status = ReadOnlyVariable->GetVariable ( PeiServices, L"Setup", &gEfiSetupGuid, NULL, &VariableSize, &SetupData ); if (EFI_ERROR (Status)) return;
// DXE 接收資料 // Status = gRT->GetVariable( L"Setup", &gSetupGuid, NULL, &VariableSize, &SetupData ); if (EFI_ERROR (Status)) return;
設定變數方法
// 先建好資料結構,並給予GUID
#define VSENSOR_GUID \ { 0xAEA3956D, 0x738, 0x4087, { 0xB4, 0x96, 0xB1, 0x1E, 0x85, 0xE2, 0x85, 0x96 } EFI_GUID VSensor_Guid = VSENSOR_GUID; typedef struct { UINT8 data; } VSENSOR_INFO; VSENSOR_INFO VSensor; VSensor.data = 0; // 要存的資料 // 設定變數GUID Status = pRS->SetVariable ( L"VSENSOR_INFO", &VSensor_Guid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, sizeof(VSENSOR_INFO), &VSensor );
沒有留言:
張貼留言