/* * Internal Functions * */ static UINT32 GetVmVariable(UINT32 Variable, CHAR8* Buffer, UINT32 Size ) { UINT32 VarLen, i; ASMOutU32(EFI_INFO_PORT, Variable); VarLen = ASMInU32(EFI_INFO_PORT); for (i=0; i < VarLen && i < Size; i++) { Buffer[i] = ASMInU8(EFI_INFO_PORT); } return VarLen; }
/** * RTOnce callback that initializes g_fHaveOsk and g_abOsk0And1. * * @returns VINF_SUCCESS. * @param pvUserIgnored Ignored. */ static DECLCALLBACK(int) devR0SmcInitOnce(void *pvUserIgnored) { g_fHaveOsk = devR0SmcQueryHostKey("OSK0", &g_abOsk0And1[0], 32) && devR0SmcQueryHostKey("OSK1", &g_abOsk0And1[32], 32); #if 0 /* * Dump the device registers. */ for (uint16_t uPort = 0x300; uPort < 0x320; uPort ++) LogRel(("SMC: %#06x=%#010x w={%#06x, %#06x}, b={%#04x %#04x %#04x %#04x}\n", uPort, ASMInU32(uPort), ASMInU16(uPort), ASMInU16(uPort + 2), ASMInU8(uPort), ASMInU8(uPort + 1), ASMInU8(uPort +2), ASMInU8(uPort + 3) )); #endif NOREF(pvUserIgnored); return VINF_SUCCESS; }
static UINT32 VBoxWriteNVRAMDoOp(UINT32 u32Operation) { UINT32 u32Rc; LogFlowFuncEnter(); LogFlowFuncMarkVar(u32Operation, "%x"); VBoxWriteNVRAMU32Param(EFI_VM_VARIABLE_OP_START, u32Operation); while ((u32Rc = ASMInU32(EFI_VARIABLE_OP)) == EFI_VARIABLE_OP_STATUS_BSY) { #if 0 MicroSecondDelay (400); #endif /* @todo: sleep here. bird: won't ever happen, so don't bother. */ } LogFlowFuncMarkVar(u32Rc, "%x"); LogFlowFuncLeave(); return u32Rc; }
/** * Waits for the specified state on the host SMC. * * @returns success indicator. * @param bState The desired state. * @param pszWhat What we're currently doing. For the log. */ static bool devR0SmcWaitHostState(uint8_t bState, const char *pszWhat) { uint8_t bCurState; for (uint32_t cMsSleep = 1; cMsSleep <= 64; cMsSleep <<= 1) { RTThreadSleep(cMsSleep); bCurState = ASMInU16(SMC_PORT_CMD); if ((bCurState & 0xf) == bState) return true; } LogRel(("devR0Smc: %s: bCurState=%#x, wanted %#x.\n", pszWhat, bCurState, bState)); #if 0 uint8_t bCurStatus2 = ASMInU8(SMC_PORT_STATUS_CODE); uint8_t bCurStatus3 = ASMInU8(SMC_PORT_STATUS_CODE); uint16_t wCurStatus3 = ASMInU16(SMC_PORT_STATUS_CODE); uint32_t dwCurStatus3 = ASMInU32(SMC_PORT_STATUS_CODE); LogRel(("SMC: status2=%#x status3=%#x w=%#x dw=%#x\n", bCurStatus2, bCurStatus3, wCurStatus3, dwCurStatus3)); #endif return false; }