// Initialization of the secure device list void InitSecureDeviceList() { UINT i, num_supported_list; SecureDeviceList = NewList(NULL); num_supported_list = sizeof(SupportedList) / sizeof(SECURE_DEVICE); for (i = 0; i < num_supported_list;i++) { SECURE_DEVICE *dev = &SupportedList[i]; // Support Checking if (IsDeviceSupported(dev)) { // Add the device to the list because it is supported Add(SecureDeviceList, dev); } } }
GPA_Status GPAImplementor::OpenContext(void* pContext, GPA_OpenContextFlags flags, GPA_ContextId* pContextId) { // validate that only a single clock mode is specified unsigned int numClockModes = 0; if (GPA_OPENCONTEXT_CLOCK_MODE_NONE_BIT & flags) { numClockModes++; } if (GPA_OPENCONTEXT_CLOCK_MODE_PEAK_BIT & flags) { numClockModes++; } if (GPA_OPENCONTEXT_CLOCK_MODE_MIN_MEMORY_BIT & flags) { numClockModes++; } if (GPA_OPENCONTEXT_CLOCK_MODE_MIN_ENGINE_BIT & flags) { numClockModes++; } if (1 < numClockModes) { GPA_LogError("More than one clock mode specified."); return GPA_STATUS_ERROR_INVALID_PARAMETER; } GPA_Status gpaStatus = GPA_STATUS_OK; std::lock_guard<std::mutex> lock(m_deviceGpaContextMapMutex); if (!DoesContextInfoExist(pContext)) { GPA_HWInfo hwInfo; if (GPA_STATUS_OK == IsDeviceSupported(pContext, &hwInfo)) { IGPAContext* pNewGPAContext = nullptr; pNewGPAContext = OpenAPIContext(pContext, hwInfo, flags); if (nullptr != pNewGPAContext) { *pContextId = reinterpret_cast<GPA_ContextId>(GPAUniqueObjectManager::Instance()->CreateObject(pNewGPAContext)); m_appContextInfoGpaContextMap.insert(GPADeviceIdentifierGPAContextPair(GetDeviceIdentifierFromContextInfo(pContext), pNewGPAContext)); } else { GPA_LogError("Failed to open API-specific GPA Context."); gpaStatus = GPA_STATUS_ERROR_FAILED; } } else { GPA_LogError("Device not supported."); gpaStatus = GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED; } } else { GPA_LogError("Context is already open."); gpaStatus = GPA_STATUS_ERROR_CONTEXT_ALREADY_OPEN; } return gpaStatus; }