158 lines
3.9 KiB
C++
158 lines
3.9 KiB
C++
//----------------------------------------------------------------------------
|
|
//
|
|
// Copyright (C) 2004 Intel Corporation
|
|
//
|
|
// File: PTHIcommand.h
|
|
//
|
|
// Contents: header file of PTHICommand class
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
#ifndef __PTHI_COMMAND_H__
|
|
#define __PTHI_COMMAND_H__
|
|
#include "HECIWin.h"
|
|
#include "HostBasedSetupTypedFlow.h"
|
|
#include "HostBasedSetupUntypedFlow.h"
|
|
|
|
/*
|
|
* Type definitions
|
|
*/
|
|
typedef unsigned char UINT8;
|
|
typedef unsigned short UINT16;
|
|
typedef unsigned int UINT32;
|
|
typedef unsigned long ULONG;
|
|
typedef UINT32 AMT_BOOLEAN;
|
|
typedef UINT32 AMT_STATUS;
|
|
|
|
static const UINT32 BIOS_VERSION_LEN = 65;
|
|
static const UINT32 VERSIONS_NUMBER = 50;
|
|
static const UINT32 UNICODE_STRING_LEN = 20;
|
|
|
|
#pragma pack (1)
|
|
|
|
typedef struct _PTHI_VERSION
|
|
{
|
|
UINT8 MajorNumber;
|
|
UINT8 MinorNumber;
|
|
} PTHI_VERSION;
|
|
|
|
typedef struct _COMMAND_FMT
|
|
{
|
|
union
|
|
{
|
|
UINT32 val;
|
|
struct
|
|
{
|
|
UINT32 Operation : 23;
|
|
UINT32 IsResponse : 1;
|
|
UINT32 Class : 8;
|
|
} fields;
|
|
} cmd;
|
|
|
|
} COMMAND_FMT;
|
|
|
|
typedef struct _PTHI_MESSAGE_HEADER
|
|
{
|
|
PTHI_VERSION Version;
|
|
UINT16 Reserved;
|
|
COMMAND_FMT Command;
|
|
UINT32 Length;
|
|
|
|
} PTHI_MESSAGE_HEADER;
|
|
|
|
typedef struct _CFG_GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE
|
|
{
|
|
PTHI_MESSAGE_HEADER Header;
|
|
AMT_STATUS Status;
|
|
LOCAL_SYSTEM_ACCOUNT Account;
|
|
} CFG_GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE;
|
|
|
|
typedef struct _CFG_GET_LOCAL_SYSTEM_ACCOUNT_REQUEST
|
|
{
|
|
PTHI_MESSAGE_HEADER Header;
|
|
UINT8 Reserved[40];
|
|
} CFG_GET_LOCAL_SYSTEM_ACCOUNT_REQUEST;
|
|
|
|
typedef UINT32 CFG_PROVISIONING_MODE;
|
|
|
|
typedef struct _CFG_UNPROVISION_RESPONSE
|
|
{
|
|
PTHI_MESSAGE_HEADER Header;
|
|
AMT_STATUS Status;
|
|
} CFG_UNPROVISION_RESPONSE;
|
|
|
|
typedef struct _CFG_UNPROVISION_REQUEST
|
|
{
|
|
PTHI_MESSAGE_HEADER Header;
|
|
UINT32 Mode;
|
|
} CFG_UNPROVISION_REQUEST;
|
|
|
|
typedef UINT32 AMT_PROVISIONING_STATE;
|
|
|
|
typedef struct _CFG_GET_PROVISIONING_STATE_RESPONSE
|
|
{
|
|
PTHI_MESSAGE_HEADER Header;
|
|
AMT_STATUS Status;
|
|
UINT32 ProvisioningState;
|
|
} CFG_GET_PROVISIONING_STATE_RESPONSE;
|
|
|
|
typedef struct _CFG_GET_PROVISIONING_STATE_REQUEST
|
|
{
|
|
PTHI_MESSAGE_HEADER Header;
|
|
} CFG_GET_PROVISIONING_STATE_REQUEST;
|
|
|
|
#pragma pack ( )
|
|
|
|
class PTHICommand
|
|
{
|
|
public:
|
|
PTHICommand(bool verbose = false);
|
|
~PTHICommand();
|
|
|
|
AMT_STATUS GetLocalSystemAccount(LOCAL_SYSTEM_ACCOUNT *localAccount);
|
|
AMT_STATUS Unprovision(CFG_PROVISIONING_MODE provisionMode);
|
|
AMT_STATUS GetProvisionState(UINT32 *ProvisionState);
|
|
|
|
HECIWin PTHIClient;
|
|
private:
|
|
AMT_STATUS VerifyResponseHeader(const UINT32 command, const PTHI_MESSAGE_HEADER *response_header, UINT32 response_size);
|
|
AMT_STATUS VerifyLocalSystemAccount(const CFG_GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE *response);
|
|
AMT_STATUS VerifyUnprovision(const CFG_UNPROVISION_RESPONSE *response);
|
|
AMT_STATUS VerifyProvisionState(const CFG_GET_PROVISIONING_STATE_RESPONSE *response);
|
|
};
|
|
|
|
#endif
|
|
|
|
const UINT8 AMT_MAJOR_VERSION = 1;
|
|
const UINT8 AMT_MINOR_VERSION = 1;
|
|
|
|
const UINT32 GET_LOCAL_SYSTEM_ACCOUNT_REQUEST = 0x04000067;
|
|
const UINT32 GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE = 0x04800067;
|
|
|
|
const PTHI_MESSAGE_HEADER GET_LOCAL_SYSTEM_ACCOUNT_HEADER =
|
|
{
|
|
{AMT_MAJOR_VERSION,AMT_MINOR_VERSION},0,{GET_LOCAL_SYSTEM_ACCOUNT_REQUEST},40
|
|
};
|
|
|
|
const CFG_PROVISIONING_MODE PROVISIONING_MODE_NONE = 0;
|
|
const CFG_PROVISIONING_MODE PROVISIONING_MODE_ENTERPRISE = 1;
|
|
|
|
const UINT32 UNPROVISION_REQUEST = 0x04000010;
|
|
const UINT32 UNPROVISION_RESPONSE = 0x04800010;
|
|
|
|
const PTHI_MESSAGE_HEADER UNPROVISION_HEADER =
|
|
{
|
|
{AMT_MAJOR_VERSION,AMT_MINOR_VERSION},0,{UNPROVISION_REQUEST},4
|
|
};
|
|
|
|
const AMT_PROVISIONING_STATE PROVISIONING_STATE_PRE = 0;
|
|
const AMT_PROVISIONING_STATE PROVISIONING_STATE_IN = 1;
|
|
const AMT_PROVISIONING_STATE PROVISIONING_STATE_POST = 2;
|
|
|
|
const UINT32 GET_PROVISION_STATE_REQUEST = 0x04000011;
|
|
const UINT32 GET_PROVISION_STATE_RESPONSE = 0x04800011;
|
|
|
|
const PTHI_MESSAGE_HEADER GET_PROVISION_STATE_HEADER =
|
|
{
|
|
{AMT_MAJOR_VERSION,AMT_MINOR_VERSION},0,{GET_PROVISION_STATE_REQUEST},0
|
|
};
|