123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- #include <string.h>
- #include <stdio.h>
- #include "IPMDevice.h"
- #include "MsgHndlr.h"
- #include "Support.h"
- #include "com_IPMIDefs.h"
- #include "com_IPMI_IPM.h"
- #include "Sensor.h"
- #include "main.h"
- #include "WDT.h"
- #include "ChassisTimerTask.h"
- #include "com_IPMI_App.h"
- #if IPM_DEVICE == 1
- #define ACPI_SET_SYS_PWR_STATE 0x80
- #define ACPI_SET_DEV_PWR_STATE 0x80
- #define ACPI_SYS_PWR_STATE_MASK 0x7F
- #define ACPI_DEV_PWR_STATE_MASK 0x7F
- #define ACPI_MAX_SYS_PWR_STATE 16
- #define ACPI_MAX_DEV_PWR_STATE 7
- #define ACPI_FLAG_SET 1
- #define ACPI_FLAG_UNSET 0
- extern WDTTmrMgr_T g_WDTTmrMgr;
- #define WORKING_STATE 0x0
- #define S1_SLEEPING_STATE 0x1
- static uint8_t MfgID[] = {0x12,0x34,0x56};
- static uint16_t g_ProdID = 0xaabb;
- static void GetFirmwareVersion(unsigned int* Major,unsigned int* Minor,unsigned int* Rev)
- {
- *Major = g_BMCInfo.FwMajorVer;
- *Minor = g_BMCInfo.FwMinorVer;
- *Rev = 0;
- }
- int
- GetDevID ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- GetDevIDRes_T* pGetDevIDRes = ( GetDevIDRes_T*) pRes;
- static unsigned int Major,Minor,Rev;
- static unsigned char MinorBCD;
- static int firsttime = 1;
- if(firsttime == 1)
- {
-
- GetFirmwareVersion(&Major,&Minor,&Rev);
- MinorBCD = ((Minor/10)<<4)+(Minor%10);
- firsttime = 0;
- }
- pGetDevIDRes->CompletionCode = CC_NORMAL;
- pGetDevIDRes->DeviceID = DEVICE_ID;
- pGetDevIDRes->DevRevision = IPMI_DEV_REVISION;
- pGetDevIDRes->FirmwareRevision1 = Major ;
- pGetDevIDRes->FirmwareRevision2 = MinorBCD;
- pGetDevIDRes->IPMIVersion = IPMI_VERSION;
- pGetDevIDRes->DevSupport = DEV_SUPPORT;
- pGetDevIDRes->ProdID = (g_ProdID);
- pGetDevIDRes->AuxFirmwareRevision = Rev;
- memcpy (pGetDevIDRes->MfgID, MfgID, sizeof (MfgID));
- return sizeof (GetDevIDRes_T);
- }
- int
- ColdReset ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- MsgPkt_T MsgPkt;
- MsgPkt.Param = PARAM_MC;
- MsgPkt.NetFnLUN = NETFN_APP<<2;
- MsgPkt.Cmd = CMD_COLD_RESET;
-
- PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);
- *pRes = CC_NORMAL;
- return sizeof (*pRes);
- }
- int
- WarmReset ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- MsgPkt_T MsgPkt;
- MsgPkt.Param = PARAM_MC;
- MsgPkt.NetFnLUN = NETFN_APP<<2;
- MsgPkt.Cmd = CMD_WARM_RESET;
-
- PostMsg(gFd_ChassisPwrHndlrQue, &MsgPkt);
- *pRes = CC_NORMAL;
- return sizeof (*pRes);
- }
- int
- GetSelfTestResults ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- GetSelfTestRes_T* pGetSelfTest = ( GetSelfTestRes_T*) pRes;
- pGetSelfTest->CompletionCode = CC_NORMAL;
- pGetSelfTest->TestResultByte1 = ( 0 == g_BMCInfo.SelfTestByte ) ?
- GST_NO_ERROR: GST_CORRUPTED_DEVICES;
- pGetSelfTest->TestResultByte2 = g_BMCInfo.SelfTestByte;
- return sizeof (GetSelfTestRes_T);
- }
- int
- MfgTestOn ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- printf("MfgTestOn not implement\r\n");
- *pRes = CC_NORMAL;
- return sizeof (*pRes);
- }
- int
- SetACPIPwrState ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- printf("SetACPIPwrState not implement\r\n");
- *pRes = CC_NORMAL;
- return sizeof (*pRes);
- }
- int
- GetACPIPwrState ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- GetACPIPwrStateRes_T* pGetACPIRes = ( GetACPIPwrStateRes_T*) pRes;
- printf("GetACPIPwrState not implement\r\n");
- pGetACPIRes->CompletionCode = CC_NORMAL;
- pGetACPIRes->ACPISysPwrState = 0;
- pGetACPIRes->ACPIDevPwrState = 0;
-
- return sizeof (GetACPIPwrStateRes_T);
- }
- int
- GetDevGUID ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
- {
- GetDevGUIDRes_T* pGetDevGUIDRes = ( GetDevGUIDRes_T*) pRes;
- pGetDevGUIDRes->CompletionCode = CC_NORMAL;
- memcpy (pGetDevGUIDRes->Node, g_BMCInfo.DeviceGUID, 16);
-
- return sizeof (GetDevGUIDRes_T);
- }
- #endif
|