ChassisDevice.c 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
  1. /*****************************************************************
  2. *****************************************************************
  3. *** **
  4. *** (C)Copyright 2005-2006, American Megatrends Inc. **
  5. *** **
  6. *** All Rights Reserved. **
  7. *** **
  8. *** 6145-F, Northbelt Parkway, Norcross, **
  9. *** **
  10. *** Georgia - 30071, USA. Phone-(770)-246-8600. **
  11. *** **
  12. *****************************************************************
  13. *****************************************************************
  14. ******************************************************************
  15. *
  16. * ChassisDevice.c
  17. * Chassis commands
  18. *
  19. * Author: Rama Bisa <ramab@ami.com>
  20. *
  21. ******************************************************************/
  22. #include <string.h>
  23. #include "com_IPMI_ChassisDevice.h"
  24. #include "ChassisDevice.h"
  25. #include "ChassisTimerTask.h"
  26. #include "Support.h"
  27. #include "main.h"
  28. #include "message.h"
  29. /* Reserved bit macro definitions */
  30. #define RESERVED_BITS_CHASSISCONTROL 0xF0 //(BIT7 | BIT6 | BIT5 |BIT4)
  31. #define RESERVED_BITS_GETCHASSISIDENTIFY 0xFE //(BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)
  32. #define RESERVED_BITS_SETCHASSISCAPS 0xFC //(BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2)
  33. #define RESERVED_BITS_SETPOWERRESTOREPOLICY 0xFC //(BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2)
  34. #define RESERVED_BITS_SETFPBUTTONENABLES 0xF0 //(BIT7 | BIT6 | BIT5 | BIT4)
  35. #if CHASSIS_DEVICE == 1
  36. /*** Local Definitions ***/
  37. #define PRP_ALWAYS_POWEROFF_SUPPORT 0x01
  38. #define PRP_LAST_STATE_SUPPORT 0x02
  39. #define PRP_ALWAYS_POWERON_SUPPORT 0x04
  40. #define CHASSIS_AMI_OEM_PARAM 96
  41. #define CHASSIS_SET_INPROG 0x00
  42. #define CHASSIS_SERVICE_PART_SEL 0x01
  43. #define CHASSIS_SERVICE_PART_SCAN 0x02
  44. #define CHASSIS_BOOT_FLAG_VALID_BIT_CLEAR 0x03
  45. #define CHASSIS_BOOT_INFO_ACK 0x04
  46. #define CHASSIS_BOOT_FLAGS 0x05
  47. #define CHASSIS_BOOT_INITIATOR_INFO 0x06
  48. #define CHASSIS_BOOT_INITIATOR_MBOX 0x07
  49. #define CHASSIS_AMI_OEM_PARAM 96
  50. #define SSICB_OEM_PARAM_BLK_SIZE_TBL 0x78
  51. #define SSICB_BOOT_ORDER_TBL 0x7D
  52. #define SSICB_BOOT_DEV_SELECTOR 0x7E
  53. #define SSICB_SLOT_CONFIG_TBL 0x7F
  54. #define ROLLBACK_OPTION 0x00
  55. /* Mask Bits */
  56. #define BIT5_BIT2_MASK 0x3C
  57. #define BIT6_BIT5_MASK 0x60
  58. #define BIT1_BIT0_MASK 0x03
  59. /* Reserved Bits */
  60. #define RESERVED_VALUE_03 0x03
  61. #define RESERVED_VALUE_10 0x10
  62. #define RESERVED_VALUE_20 0x20
  63. #define RESERVED_VALUE_28 0x28
  64. #define RESERVED_VALUE_30 0x30
  65. #define RESERVED_VALUE_34 0x34
  66. #define RESERVED_VALUE_38 0x38
  67. #define RESERVED_VALUE_40 0x40
  68. #define RESERVED_VALUE_60 0x60
  69. #define RESERVED_VALUE_80 0x80
  70. ///*** Module Varibales ***/
  71. //static const uint8_t m_BootOptParamLen [] = /**< Boot Options parameter length */
  72. //{
  73. // 0x01, /**< Set in progress byte length */
  74. // 0x01, /**< Service Partition selector length */
  75. // 0x01, /**< Service Partition scan length */
  76. // 0x01, /**< Boot flag valid bit length */
  77. // sizeof(BootInfoAck_T), /**< Boot info ack length */
  78. // sizeof(BootFlags_T), /**< Boot Flags valid length */
  79. // sizeof(BootInitiatorInfo_T), /**< Boot init info length */
  80. // sizeof(BootInitiatorMboxReq_T), /**< Boot init info length */
  81. //};
  82. //static const uint8_t m_SSIBootOptParamLen [] = /**< SSI Boot Options parameter length */
  83. //{
  84. // sizeof(OemParamBlkSizeTbl_T), /* OEM Parameter Block Size Table length */
  85. // 0x0, /* Reserved */
  86. // 0x0, /* Reserved */
  87. // 0x0, /* Reserved */
  88. // 0x0, /* Reserved */
  89. // sizeof(BootOrderTblReq_T), /* Boot Order Table length */
  90. // sizeof(uint8_t), /* SSI Boot Device Selector length*/
  91. // sizeof(SlotConfigTbl_T) /* Slot Configuration Table length */
  92. //};
  93. #define MAX_BOOT_PARAMS_DATA 20
  94. typedef struct
  95. {
  96. uint8_t Params;
  97. uint8_t ReservedBits [MAX_BOOT_PARAMS_DATA];
  98. uint8_t DataLen;
  99. } BootCfgRsvdBits_T;
  100. //static BootCfgRsvdBits_T m_RsvdBitsCheck [] = {
  101. // /* Param Reserved Bits Data Size */
  102. // { 0, { 0xFC }, 0x1 }, /* Set In progress */
  103. // { 2, { 0xFC }, 0x1 },
  104. // { 3, { 0xE0 }, 0x1 },
  105. // { 5, { 0x1F,0x00,0x00,0xF0,0xE0}, 0x5 },
  106. // { 6, { 0xF0 }, 0x1 }
  107. //};
  108. /*-------------------------------------
  109. * GetChassisCaps
  110. *-------------------------------------*/
  111. int
  112. GetChassisCaps ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  113. {
  114. GetChassisCapabilitiesRes_T* pGetChassisCapsRes = ( GetChassisCapabilitiesRes_T*) pRes;
  115. printf("GetChassisCaps not implement\r\n");
  116. pGetChassisCapsRes->CompletionCode = CC_NORMAL;
  117. memcpy ( ( uint8_t*)&pGetChassisCapsRes->ChassisCapabilities,
  118. ( uint8_t*)&g_BMCInfo.IpmiConfig.ChassisCapabilities,
  119. sizeof(ChassisCapabilities_T) );
  120. return sizeof(GetChassisCapabilitiesRes_T);
  121. }
  122. /*-------------------------------------
  123. * GetChassisStatus
  124. *-------------------------------------*/
  125. int
  126. GetChassisStatus ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  127. {
  128. GetChassisStatusRes_T* pGetChassisStatusRes =
  129. ( GetChassisStatusRes_T*) pRes;
  130. pGetChassisStatusRes->CompletionCode = CC_NORMAL;
  131. memcpy ( ( uint8_t*)&pGetChassisStatusRes->ChassisPowerState,
  132. ( uint8_t*)&g_BMCInfo.IpmiConfig.ChassisPowerState,
  133. sizeof(ChassisPowerState_T));
  134. return sizeof (GetChassisStatusRes_T) ;
  135. }
  136. /*-------------------------------------
  137. * ChassisControl
  138. *-------------------------------------*/
  139. int
  140. ChassisControl ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes )
  141. {
  142. ChassisControlReq_T* pChassisControlReq =
  143. ( ChassisControlReq_T*) pReq;
  144. ChassisControlRes_T* pChassisControlRes =
  145. ( ChassisControlRes_T*) pRes;
  146. MsgPkt_T MsgPkt;
  147. pChassisControlRes->CompletionCode = CC_NORMAL;
  148. /* Check for the reserved bytes should b zero */
  149. if ( 0 != (pChassisControlReq->ChassisControl & RESERVED_BITS_CHASSISCONTROL ) )
  150. {
  151. pChassisControlRes->CompletionCode = CC_INV_DATA_FIELD;
  152. return sizeof(uint8_t);
  153. }
  154. switch (pChassisControlReq->ChassisControl & 0x0F )
  155. {
  156. case CHASSIS_POWER_DOWN:
  157. //printf ("Chassis IS GOING FOR POWER_DOWN\n");
  158. MsgPkt.Param = PARAM_CHASSIS;
  159. MsgPkt.NetFnLUN = 0x00<<2;
  160. MsgPkt.Cmd = 0x02;
  161. MsgPkt.Data[0] = CHASSIS_POWER_DOWN;
  162. MsgPkt.Size = 1;
  163. PostMsg(gPendActionIfc, &MsgPkt);
  164. // g_BMCInfo.HostOFFStopWDT = TRUE ;
  165. g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
  166. // OnSetRestartCause(g_BMCInfo.ChassisConfig.SysRestartCause, TRUE,BMCInst);
  167. // g_BMCInfo.Msghndlr.ChassisControl= CHASSIS_POWER_DOWN;
  168. break;
  169. case CHASSIS_POWER_UP:
  170. //printf ("Chassis IS GOING FOR POWER UP\n");
  171. MsgPkt.Param = PARAM_CHASSIS;
  172. MsgPkt.NetFnLUN = 0x00<<2;
  173. MsgPkt.Cmd = 0x02;
  174. MsgPkt.Data[0] = CHASSIS_POWER_UP;
  175. MsgPkt.Size = 1;
  176. PostMsg(gPendActionIfc, &MsgPkt);
  177. g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
  178. // OnSetRestartCause(g_BMCInfo.ChassisConfig.SysRestartCause, TRUE,BMCInst);
  179. // g_BMCInfo.Msghndlr.ChassisControl = CHASSIS_POWER_UP;
  180. // /* Set Last Power Event through IPMI Command */
  181. // if(g_PDKHandle[PDK_SETLASTPOWEREVENT] != NULL)
  182. // {
  183. // ((void(*)(uint8_t,int))g_PDKHandle[PDK_SETLASTPOWEREVENT]) (PDK_LAST_POWER_ON_VIA_IPMI,BMCInst);
  184. // }
  185. break;
  186. case CHASSIS_POWER_CYCLE:
  187. //printf ("Chassis IS GOING FOR POWER CYCLE\n");
  188. MsgPkt.Param = PARAM_CHASSIS;
  189. MsgPkt.NetFnLUN = 0x00<<2;
  190. MsgPkt.Cmd = 0x02;
  191. MsgPkt.Data[0] = CHASSIS_POWER_CYCLE;
  192. MsgPkt.Size = 1;
  193. PostMsg(gPendActionIfc, &MsgPkt);
  194. g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
  195. // OnSetRestartCause(g_BMCInfo.ChassisConfig.SysRestartCause, TRUE,BMCInst);
  196. // g_BMCInfo.Msghndlr.ChassisControl = CHASSIS_POWER_CYCLE;
  197. // /* Set Last Power Event through IPMI Command */
  198. // if(g_PDKHandle[PDK_SETLASTPOWEREVENT] != NULL)
  199. // {
  200. // ((void(*)(uint8_t,int))g_PDKHandle[PDK_SETLASTPOWEREVENT]) (PDK_LAST_POWER_ON_VIA_IPMI,BMCInst);
  201. // }
  202. break;
  203. case CHASSIS_HARD_RESET:
  204. //printf ("Chassis IS GOING FOR HARD RESET");
  205. MsgPkt.Param = PARAM_CHASSIS;
  206. MsgPkt.NetFnLUN = 0x00<<2;
  207. MsgPkt.Cmd = 0x02;
  208. MsgPkt.Data[0] = CHASSIS_HARD_RESET;
  209. MsgPkt.Size = 1;
  210. PostMsg(gPendActionIfc, &MsgPkt);
  211. g_BMCInfo.IpmiConfig.SysRestartCause = RESTART_CAUSE_CHASSIS_CTRL;
  212. // OnSetRestartCause(g_BMCInfo.ChassisConfig.SysRestartCause, TRUE,BMCInst);
  213. // g_BMCInfo.Msghndlr.ChassisControl = CHASSIS_HARD_RESET;
  214. break;
  215. case CHASSIS_PULSE_DIAGNOSTIC_INTERRUPT:
  216. //printf ("Chassis IS GOING FOR DIAG INT\n");
  217. MsgPkt.Param = PARAM_CHASSIS;
  218. MsgPkt.NetFnLUN = 0x00<<2;
  219. MsgPkt.Cmd = 0x02;
  220. MsgPkt.Data[0] = CHASSIS_PULSE_DIAGNOSTIC_INTERRUPT;
  221. MsgPkt.Size = 1;
  222. PostMsg(gPendActionIfc, &MsgPkt);
  223. //Platform_HostDiagInt ();
  224. break;
  225. case CHASSIS_SOFT_SHUTDOWN:
  226. //printf ("Chassis IS GOING FOR SOFT SHUTDOWN\n");
  227. MsgPkt.Param = PARAM_CHASSIS;
  228. MsgPkt.NetFnLUN = 0x00<<2;
  229. MsgPkt.Cmd = 0x02;
  230. MsgPkt.Data[0] = CHASSIS_SOFT_SHUTDOWN;
  231. MsgPkt.Size = 1;
  232. PostMsg(gPendActionIfc, &MsgPkt);
  233. //Platform_HostSoftShutDown (BMCInst);
  234. break;
  235. default:
  236. printf ("UNKNOWN Chassis CONTROL REQUEST \r\n");
  237. pChassisControlRes->CompletionCode = CC_INV_DATA_FIELD;
  238. break;
  239. }
  240. FlushIPMIToFlash();
  241. return sizeof(ChassisControlRes_T);
  242. }
  243. /*-------------------------------------
  244. * GetChassisIdentify
  245. *-------------------------------------*/
  246. int
  247. GetChassisIdentify ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  248. {
  249. ChassisIdentifyReq_T* pChassisIdentifyReq =
  250. ( ChassisIdentifyReq_T*) pReq;
  251. ChassisIdentifyRes_T* pChassisIdentifyRes =
  252. ( ChassisIdentifyRes_T*) pRes;
  253. if (ReqLen <= sizeof(ChassisIdentifyReq_T))
  254. {
  255. if (0 != ReqLen)
  256. {
  257. g_BMCInfo.ChassisIdentifyForce = 0;
  258. g_BMCInfo.ChassisIdentifyTimeout = pChassisIdentifyReq->IdentifyInterval;
  259. }
  260. else
  261. {
  262. g_BMCInfo.ChassisIdentifyForce = 0;
  263. g_BMCInfo.ChassisIdentifyTimeout = DEFAULT_IDENTIFY_TIMEOUT;
  264. }
  265. if (ReqLen == 2)
  266. {
  267. /* Check for the reserved bytes should b zero */
  268. if ( 0 != (pChassisIdentifyReq->ForceIdentify & RESERVED_BITS_GETCHASSISIDENTIFY ) )
  269. {
  270. pChassisIdentifyRes->CompletionCode = CC_INV_DATA_FIELD;
  271. return sizeof(uint8_t);
  272. }
  273. if(pChassisIdentifyReq->ForceIdentify & 1)
  274. {
  275. g_BMCInfo.ChassisIdentifyTimeout = 0;
  276. g_BMCInfo.ChassisIdentifyForce = 1;
  277. }
  278. else
  279. {
  280. g_BMCInfo.ChassisIdentifyForce = 0;
  281. }
  282. }
  283. g_BMCInfo.ChassisIdentify = TRUE;
  284. pChassisIdentifyRes->CompletionCode = CC_NORMAL;
  285. }
  286. else
  287. {
  288. pChassisIdentifyRes->CompletionCode = CC_REQ_INV_LEN;
  289. }
  290. return sizeof(ChassisIdentifyRes_T);
  291. }
  292. /*-------------------------------------
  293. * SetChassisCaps
  294. *-------------------------------------*/
  295. int
  296. SetChassisCaps ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  297. {
  298. SetChassisCapabilitiesReq_T* pSetChassisCapsReq =
  299. ( SetChassisCapabilitiesReq_T*) pReq;
  300. SetChassisCapabilitiesRes_T* pSetChassisCapsRes =
  301. ( SetChassisCapabilitiesRes_T*) pRes;
  302. //printf ("SET Chassis CAPABILITIES\n");
  303. /* Check for the reserved bytes should b zero */
  304. if ( 0 != (pSetChassisCapsReq->ChassisCaps.CapabilitiesFlags & RESERVED_BITS_SETCHASSISCAPS ) )
  305. {
  306. pSetChassisCapsRes->CompletionCode = CC_INV_DATA_FIELD;
  307. return sizeof(uint8_t);
  308. }
  309. if ((ReqLen != 5) &&
  310. (ReqLen != sizeof(SetChassisCapabilitiesReq_T)))
  311. {
  312. pSetChassisCapsRes->CompletionCode= CC_REQ_INV_LEN;
  313. return sizeof(SetChassisCapabilitiesRes_T);
  314. }
  315. if((pSetChassisCapsReq->ChassisCaps.CapabilitiesFlags & 0xFC ) != 0)
  316. {
  317. pSetChassisCapsRes->CompletionCode= CC_INV_DATA_FIELD;
  318. return sizeof(SetChassisCapabilitiesRes_T);
  319. }
  320. memcpy (( uint8_t*) &g_BMCInfo.IpmiConfig.ChassisCapabilities,
  321. ( uint8_t*) &pSetChassisCapsReq->ChassisCaps,
  322. sizeof(ChassisCapabilities_T));
  323. pSetChassisCapsRes->CompletionCode = CC_NORMAL;
  324. FlushIPMIToFlash();
  325. return sizeof (SetChassisCapabilitiesRes_T);
  326. }
  327. /*-------------------------------------
  328. * SetPowerRestorePolicy
  329. *-------------------------------------*/
  330. int
  331. SetPowerRestorePolicy ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  332. {
  333. SetPowerRestorePolicyReq_T* pSetPowerRestorePolicyReq =
  334. ( SetPowerRestorePolicyReq_T*) pReq;
  335. SetPowerRestorePolicyRes_T* pSetPowerRestorePolicyRes =
  336. ( SetPowerRestorePolicyRes_T*) pRes;
  337. printf ("\nSET POWER RESORE POLICY\r\n");
  338. /* Check for the reserved bytes should b zero */
  339. if ( 0 != ( pSetPowerRestorePolicyReq->PowerRestorePolicy & RESERVED_BITS_SETPOWERRESTOREPOLICY ))
  340. {
  341. pSetPowerRestorePolicyRes->CompletionCode = CC_INV_DATA_FIELD;
  342. return sizeof (uint8_t);
  343. }
  344. // 011b = no change to the current power restore policy
  345. if (pSetPowerRestorePolicyReq->PowerRestorePolicy != 0x03)
  346. {
  347. g_BMCInfo.IpmiConfig.PowerRestorePolicy =
  348. pSetPowerRestorePolicyReq->PowerRestorePolicy & 0x07;
  349. g_BMCInfo.IpmiConfig.ChassisPowerState.PowerState &= ~0x60;
  350. g_BMCInfo.IpmiConfig.ChassisPowerState.PowerState |= (pSetPowerRestorePolicyReq->PowerRestorePolicy << 5);
  351. FlushIPMIToFlash();
  352. }
  353. pSetPowerRestorePolicyRes->CompletionCode = CC_NORMAL;
  354. pSetPowerRestorePolicyRes->PowerRestorePolicy = PRP_ALWAYS_POWEROFF_SUPPORT |
  355. PRP_LAST_STATE_SUPPORT |
  356. PRP_ALWAYS_POWERON_SUPPORT;
  357. return sizeof(SetPowerRestorePolicyRes_T);
  358. }
  359. /*-------------------------------------
  360. * GetSysRestartCause
  361. *-------------------------------------*/
  362. int
  363. GetSysRestartCause ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  364. {
  365. GetSystemRestartCauseRes_T* pGetSysRestartCauseRes =
  366. ( GetSystemRestartCauseRes_T*) pRes;
  367. uint8_t *curchannel = 0;
  368. //printf ("GET SYSTEM RESTART CAUSE\n");
  369. pGetSysRestartCauseRes->CompletionCode = CC_NORMAL;
  370. pGetSysRestartCauseRes->SysRestartCause = g_BMCInfo.IpmiConfig.SysRestartCause;
  371. pGetSysRestartCauseRes->ChannelID = *curchannel & 0xF;
  372. return sizeof(GetSystemRestartCauseRes_T);
  373. }
  374. /*-------------------------------------
  375. * GetPOHCounter
  376. *-------------------------------------*/
  377. int
  378. GetPOHCounter ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  379. {
  380. //TODO: POHCounterReading unit is hour or minutes or second?
  381. GetPOHCounterRes_T* pGetPOHCounterRes = ( GetPOHCounterRes_T*) pRes;
  382. //printf ("GET POH COUNTER\r\n");
  383. pGetPOHCounterRes->CompletionCode = CC_NORMAL;
  384. pGetPOHCounterRes->MinutesPerCount = POH_MINS_PER_COUNT;
  385. pGetPOHCounterRes->POHCounterReading = (g_BMCInfo.BootValidMinutes/60);
  386. return sizeof(GetPOHCounterRes_T);
  387. }
  388. /*-------------------------------------
  389. * SetSysBOOTOptions
  390. *-------------------------------------*/
  391. int
  392. SetSysBOOTOptions ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  393. {
  394. printf("SetSysBOOTOptions not implement\r\n");
  395. // SetBootOptionsReq_T* pBootOptReq = ( SetBootOptionsReq_T*) pReq;
  396. // SetBootOptionsRes_T* pBootOptRes = ( SetBootOptionsRes_T*) pRes;
  397. // BMCInfo_t *pBMCInfo = &g_BMCInfo;
  398. // uint8_t Parameter;
  399. // BootOptions_T* pBootOptions;
  400. // uint8_t u8SetInProgress;
  401. // uint8_t u8TempData,SSIComputeBladeSupport;
  402. // int i,j=0;
  403. // Parameter = pBootOptReq->ParamValidCumParam & 0x7F;
  404. // SSIComputeBladeSupport = g_corefeatures.ssi_support;
  405. // /*Check for validity of parameter */
  406. // if(SSIComputeBladeSupport)
  407. // {
  408. // if ((Parameter >= sizeof (m_BootOptParamLen)) && (Parameter != CHASSIS_AMI_OEM_PARAM) &&
  409. // (Parameter != SSICB_OEM_PARAM_BLK_SIZE_TBL) && (Parameter < SSICB_BOOT_ORDER_TBL || Parameter > SSICB_SLOT_CONFIG_TBL))
  410. // {
  411. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  412. // return sizeof (SetBootOptionsRes_T);
  413. // }
  414. // }
  415. // else
  416. // {
  417. // if ((Parameter >= sizeof (m_BootOptParamLen)) && (Parameter != CHASSIS_AMI_OEM_PARAM))
  418. // {
  419. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  420. // return sizeof (SetBootOptionsRes_T);
  421. // }
  422. // }
  423. // /*Check if ReqLen valid for OEM Parameter */
  424. // if (CHASSIS_AMI_OEM_PARAM == Parameter)
  425. // {
  426. // if ((ReqLen - 1) != sizeof (AMI_BootOpt_T))
  427. // {
  428. // pBootOptRes->CompletionCode= CC_REQ_INV_LEN;
  429. // return sizeof (uint8_t);
  430. // }
  431. // }
  432. // else if (Parameter >= SSICB_OEM_PARAM_BLK_SIZE_TBL && Parameter <= SSICB_SLOT_CONFIG_TBL)
  433. // {
  434. // if(SSIComputeBladeSupport)
  435. // {
  436. // if ((ReqLen - 1) != m_SSIBootOptParamLen[Parameter-SSICB_OEM_PARAM_BLK_SIZE_TBL])
  437. // {
  438. // pBootOptRes->CompletionCode= CC_REQ_INV_LEN;
  439. // return sizeof (uint8_t);
  440. // }
  441. // }
  442. // }
  443. // else
  444. // {
  445. // /*Check if valid message length */
  446. // //if ( ((ReqLen - 1) != m_BootOptParamLen[Parameter]) && (ReqLen != sizeof (Parameter)))
  447. // if ((ReqLen - 1) != m_BootOptParamLen[Parameter])
  448. // {
  449. // pBootOptRes->CompletionCode= CC_REQ_INV_LEN;
  450. // return sizeof (uint8_t);
  451. // }
  452. // }
  453. //#if 0
  454. // Bit is 1 - Parameter is locked
  455. // Bit is 0 - Parameter is unlocked
  456. //if locked
  457. // if no req to unlock then return invalid
  458. // if req to unlock then unlock and procced
  459. //else
  460. // Proceed
  461. //#endif
  462. // /* Check for Reserved Bits */
  463. // for (i = 0; i < sizeof (m_RsvdBitsCheck)/ sizeof (m_RsvdBitsCheck[0]); i++)
  464. // {
  465. // /* Check if this Parameter Selector needs Reserved bit checking !! */
  466. // if (m_RsvdBitsCheck[i].Params == Parameter)
  467. // {
  468. // //IPMI_DBG_PRINT_2 ("Param - %x, DataLen - %x\n", pSetLanReq->ParameterSelect, m_RsvdBitsCheck[i].DataLen);
  469. // for (j = 0; j < m_RsvdBitsCheck[i].DataLen; j++)
  470. // {
  471. // // IPMI_DBG_PRINT_2 ("Cmp %x, %x\n", pReq[2+j], m_RsvdBitsCheck[i].ReservedBits[j]);
  472. // if ( 0 != (pReq[1+j] & m_RsvdBitsCheck[i].ReservedBits[j]))
  473. // {
  474. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  475. // *pRes = CC_INV_DATA_FIELD;
  476. // return sizeof (*pRes);
  477. // }
  478. // }
  479. // }
  480. // }
  481. // OS_THREAD_MUTEX_ACQUIRE(&g_BMCInfo.ChassisMutex, WAIT_INFINITE);
  482. // pBootOptions = &(BMC_GET_SHARED_MEM(BMCInst)->sBootOptions);
  483. // u8SetInProgress = pBootOptions->u8SetInProgress;
  484. // /* if locked */
  485. // if (pBootOptions->ParameterValid & (1 << Parameter) )
  486. // {
  487. // /*if not req to unlock */
  488. // if (0 != (pBootOptReq->ParamValidCumParam & 0x80))
  489. // {
  490. // pBootOptRes->CompletionCode = CC_INV_DATA_FIELD;
  491. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  492. // return sizeof (uint8_t);
  493. // }
  494. // }
  495. //
  496. // /*Check for valid bit settings */
  497. // if (0 != (pBootOptReq->ParamValidCumParam & 0x80))
  498. // {
  499. // /* The valid bit for parameters 0 - 7 are SET/RESET to
  500. // * corresponding bits 0-7 in ParameterValid field
  501. // */
  502. // pBootOptions->ParameterValid |= (1 << Parameter);
  503. // }
  504. // else
  505. // {
  506. // pBootOptions->ParameterValid &= ~(1 << Parameter);
  507. // }
  508. // /*if only the parameter byte is provided then exit */
  509. // if (ReqLen == sizeof (Parameter))
  510. // {
  511. // pBootOptRes->CompletionCode = CC_NORMAL;
  512. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  513. // return sizeof (SetBootOptionsRes_T);
  514. // }
  515. // switch (Parameter)
  516. // {
  517. // case CHASSIS_SET_INPROG:
  518. // /* Commit Write is optional and supported
  519. // * only if rollback is supported */
  520. // if ( (BMC_BOOT_OPTION_SET_IN_PROGRESS != pBootOptReq->BootParam.SetInProgress) &&
  521. // (BMC_BOOT_OPTION_SET_COMPLETE != pBootOptReq->BootParam.SetInProgress) )
  522. // {
  523. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  524. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  525. // return sizeof(SetBootOptionsRes_T);
  526. // }
  527. // else if ((BMC_BOOT_OPTION_SET_IN_PROGRESS == (u8SetInProgress & 0x03)) &&
  528. // (BMC_BOOT_OPTION_SET_IN_PROGRESS == pBootOptReq->BootParam.SetInProgress))
  529. // {
  530. // IPMI_DBG_PRINT ("\nSET IN PROGRESS ALREADY SET \n");
  531. // pBootOptRes->CompletionCode = CC_SET_IN_PROGRESS;
  532. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  533. // return sizeof(SetBootOptionsRes_T);
  534. // }
  535. // /*Set the new setinpogress byte */
  536. // pBootOptions->u8SetInProgress = pBootOptReq->BootParam.SetInProgress;
  537. // break;
  538. //
  539. // case CHASSIS_SERVICE_PART_SEL:
  540. // pBootOptions->ServicePartitionSelector =
  541. // pBootOptReq->BootParam.ServicePartitionSelector;
  542. // break;
  543. //
  544. // case CHASSIS_SERVICE_PART_SCAN:
  545. // pBootOptions->ServicePartitionScan =
  546. // pBootOptReq->BootParam.ServicePartitionScan;
  547. // /*Update in NVRAM*/
  548. // g_BMCInfo.ChassisConfig.SysPartitionScan = pBootOptReq->BootParam.ServicePartitionScan;
  549. // FlushIPMI((uint8_t*)&g_BMCInfo.ChassisConfig,(uint8_t*)&g_BMCInfo.ChassisConfig.SysPartitionScan,g_BMCInfo.IPMIConfLoc.ChassisConfigAddr,sizeof(uint8_t),BMCInst);
  550. // break;
  551. //
  552. // case CHASSIS_BOOT_FLAG_VALID_BIT_CLEAR:
  553. // pBootOptions->BootFlagValidBitClearing =
  554. // pBootOptReq->BootParam.BootFlagValidBitClearing;
  555. // break;
  556. // case CHASSIS_BOOT_INFO_ACK:
  557. // _fmemcpy (( uint8_t*)&pBootOptions->BootInfoAck,
  558. // ( uint8_t*)&pBootOptReq->BootParam.BootInfoAck,
  559. // sizeof (BootInfoAck_T));
  560. // break;
  561. // case CHASSIS_BOOT_FLAGS:
  562. // u8TempData = (pBootOptReq->BootParam.BootFlags.Data2 & BIT5_BIT2_MASK);
  563. // if((u8TempData == RESERVED_VALUE_28) ||(u8TempData == RESERVED_VALUE_30) ||(u8TempData == RESERVED_VALUE_34)||(u8TempData == RESERVED_VALUE_38))
  564. // {
  565. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  566. // *pRes = CC_INV_DATA_FIELD;
  567. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  568. // return sizeof (*pRes);
  569. // }
  570. // u8TempData = (pBootOptReq->BootParam.BootFlags.Data3 & BIT6_BIT5_MASK);
  571. // if((u8TempData == RESERVED_VALUE_60))
  572. // {
  573. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  574. // *pRes = CC_INV_DATA_FIELD;
  575. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  576. // return sizeof (*pRes);
  577. // }
  578. // u8TempData = (pBootOptReq->BootParam.BootFlags.Data3 & BIT1_BIT0_MASK);
  579. // if((u8TempData == RESERVED_VALUE_03))
  580. // {
  581. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  582. // *pRes = CC_INV_DATA_FIELD;
  583. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  584. // return sizeof (*pRes);
  585. // }
  586. // if((pBootOptReq->BootParam.BootFlags.Data5 == RESERVED_VALUE_20)||(pBootOptReq->BootParam.BootFlags.Data5 == RESERVED_VALUE_40)||(pBootOptReq->BootParam.BootFlags.Data5 == RESERVED_VALUE_80))
  587. // {
  588. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  589. // *pRes = CC_INV_DATA_FIELD;
  590. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  591. // return sizeof (*pRes);
  592. // }
  593. // _fmemcpy (( uint8_t*)&pBootOptions->BootFlags,
  594. // ( uint8_t*)&pBootOptReq->BootParam.BootFlags,
  595. // sizeof (BootFlags_T));
  596. // break;
  597. // case CHASSIS_BOOT_INITIATOR_INFO:
  598. // _fmemcpy (( uint8_t*)&pBootOptions->BootInitiatorInfo,
  599. // ( uint8_t*)&pBootOptReq->BootParam.BootInitiatorInfo,
  600. // sizeof (BootInitiatorInfo_T));
  601. // break;
  602. //
  603. // case CHASSIS_BOOT_INITIATOR_MBOX:
  604. // if (pBootOptReq->BootParam.BootMailBox.BlockSel >= MAX_BOOT_INIT_MAILBOX_BLOCKS)
  605. // {
  606. // IPMI_DBG_PRINT ("\n ONLY FIVE BLOCKS ARE USED \n");
  607. // pBootOptRes->CompletionCode = CC_INV_DATA_FIELD;
  608. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  609. // return sizeof(SetBootOptionsRes_T);
  610. //
  611. // }
  612. // _fmemcpy (( uint8_t*)&pBootOptions->BootMailBox[pBootOptReq->BootParam.BootMailBox.BlockSel],
  613. // ( uint8_t*) &pBootOptReq->BootParam.BootMailBox.BootMBox,
  614. // sizeof (BootInitiatorMailbox_T));
  615. // break;
  616. // case CHASSIS_AMI_OEM_PARAM:
  617. // _fmemcpy (( uint8_t*)&g_BMCInfo.ChassisConfig.OemBootOpt,
  618. // ( uint8_t*) &pBootOptReq->BootParam.Oem,
  619. // sizeof (AMI_BootOpt_T));
  620. // FlushIPMI((uint8_t*)&g_BMCInfo.ChassisConfig,(uint8_t*)&g_BMCInfo.ChassisConfig,g_BMCInfo.IPMIConfLoc.ChassisConfigAddr,sizeof(ChassisConfig_T),BMCInst);
  621. // break;
  622. // case SSICB_OEM_PARAM_BLK_SIZE_TBL:
  623. // if(SSIComputeBladeSupport)
  624. // {
  625. // _fmemcpy (( uint8_t*)&pBootOptions->OemParamBlkSizeTbl,
  626. // ( uint8_t*)&pBootOptReq->BootParam.OemParamBlkSizeTbl,
  627. // sizeof(OemParamBlkSizeTbl_T));
  628. // break;
  629. // }
  630. // else
  631. // {
  632. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  633. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  634. // return sizeof (SetBootOptionsRes_T);
  635. // }
  636. // case SSICB_BOOT_ORDER_TBL:
  637. // if(SSIComputeBladeSupport)
  638. // {
  639. // if (pBootOptReq->BootParam.BootOrderTbl.BlockSel >= g_coremacros.ssi_bot_dev_num)
  640. // {
  641. // pBootOptRes->CompletionCode = CC_INV_DATA_FIELD;
  642. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  643. // return sizeof(uint8_t);
  644. // }
  645. // _fmemcpy (( uint8_t*)&pBootOptions->BootOrderTbl[(pBootOptReq->BootParam.BootOrderTbl.BlockSel) * sizeof(BootOrderTbl_T)],
  646. // ( uint8_t*)&pBootOptReq->BootParam.BootOrderTbl,
  647. // sizeof(BootOrderTbl_T));
  648. // break;
  649. // }
  650. // else
  651. // {
  652. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  653. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  654. // return sizeof (SetBootOptionsRes_T);
  655. // }
  656. // case SSICB_BOOT_DEV_SELECTOR:
  657. // if(SSIComputeBladeSupport)
  658. // {
  659. // pBootOptions->BootDevSelector = pBootOptReq->BootParam.BootDevSelector;
  660. // break;
  661. // }
  662. // else
  663. // {
  664. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  665. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  666. // return sizeof (SetBootOptionsRes_T);
  667. // }
  668. // case SSICB_SLOT_CONFIG_TBL:
  669. // if(SSIComputeBladeSupport)
  670. // {
  671. // _fmemcpy (( uint8_t*)&pBootOptions->SlotConfigTbl,
  672. // ( uint8_t*)&pBootOptReq->BootParam.SlotConfigTbl,
  673. // sizeof(SlotConfigTbl_T));
  674. // break;
  675. // }
  676. // else
  677. // {
  678. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  679. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  680. // return sizeof (SetBootOptionsRes_T);
  681. // }
  682. // default:
  683. // pBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  684. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  685. // return sizeof (SetBootOptionsRes_T);
  686. // }
  687. // if (0 != ROLLBACK_OPTION)
  688. // {
  689. // if (BMC_BOOT_OPTION_COMMIT_WRITE == (u8SetInProgress & 0x03))
  690. // {
  691. // /* Writing to nvRAM when "commit write" is given */
  692. // FlushIPMI((uint8_t*)&g_BMCInfo.ChassisConfig,(uint8_t*)&g_BMCInfo.ChassisConfig,g_BMCInfo.IPMIConfLoc.ChassisConfigAddr,sizeof(ChassisConfig_T),BMCInst);
  693. // /* Setting this to "set complete", don't need mutex protection */
  694. // pBootOptions->u8SetInProgress = BMC_BOOT_OPTION_SET_COMPLETE;
  695. // }
  696. //
  697. // }
  698. // else
  699. // {
  700. // /* Since roll back feature is not provided
  701. // the data is written to nvram */
  702. // FlushIPMI((uint8_t*)&g_BMCInfo.ChassisConfig,(uint8_t*)&g_BMCInfo.ChassisConfig,g_BMCInfo.IPMIConfLoc.ChassisConfigAddr,sizeof(ChassisConfig_T),BMCInst);
  703. // }
  704. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  705. // pBootOptRes->CompletionCode = CC_NORMAL;
  706. return sizeof(SetBootOptionsRes_T);
  707. }
  708. /*-------------------------------------
  709. * GetSysBOOTOptions
  710. *-------------------------------------*/
  711. int
  712. GetSysBOOTOptions ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  713. {
  714. printf("GetSysBOOTOptions not implement\r\n");
  715. // GetBootOptionsReq_T* pGetBootOptReq = ( GetBootOptionsReq_T*) pReq;
  716. // GetBootOptionsRes_T* pGetBootOptRes = ( GetBootOptionsRes_T*) pRes;
  717. // BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
  718. // uint8_t ParamSel,SSIComputeBladeSupport;
  719. // int ResponseLength;
  720. // BootOptions_T sBootOptions;
  721. // IPMI_DBG_PRINT ("GET SYSTEM BOOT OPTIONS\n");
  722. // if(pGetBootOptReq->ParamSel & RESERVED_VALUE_80)
  723. // {
  724. // /* Alarm !!! Somebody is trying to set Reseved Bits */
  725. // *pRes = CC_INV_DATA_FIELD;
  726. // return sizeof (*pRes);
  727. // }
  728. // ParamSel = pGetBootOptReq->ParamSel & 0x7F;
  729. // SSIComputeBladeSupport = g_corefeatures.ssi_support;
  730. // /*Check for validity of parameter */
  731. // if(SSIComputeBladeSupport)
  732. // {
  733. // if ((ParamSel >= sizeof (m_BootOptParamLen)) && (ParamSel != CHASSIS_AMI_OEM_PARAM) &&
  734. // (ParamSel != SSICB_OEM_PARAM_BLK_SIZE_TBL) && (ParamSel < SSICB_BOOT_ORDER_TBL || ParamSel > SSICB_SLOT_CONFIG_TBL))
  735. // {
  736. // pGetBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  737. // return sizeof(uint8_t);
  738. // }
  739. // }
  740. // else
  741. // {
  742. // if ((ParamSel >= sizeof (m_BootOptParamLen)) && (ParamSel != CHASSIS_AMI_OEM_PARAM))
  743. // {
  744. // pGetBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED;
  745. // return sizeof(uint8_t);
  746. // }
  747. // }
  748. // /*Check the validity of Setselector & Blockselector */
  749. // if(SSIComputeBladeSupport)
  750. // {
  751. // if (((0 != pGetBootOptReq->SetSel) && (ParamSel != CHASSIS_BOOT_INITIATOR_MBOX || ParamSel != SSICB_BOOT_ORDER_TBL)) ||
  752. // (ParamSel == CHASSIS_BOOT_INITIATOR_MBOX && pGetBootOptReq->SetSel >= MAX_BOOT_INIT_MAILBOX_BLOCKS) ||
  753. // (ParamSel == SSICB_BOOT_ORDER_TBL && pGetBootOptReq->SetSel >= g_coremacros.ssi_bot_dev_num) ||
  754. // (0 != pGetBootOptReq->BlockSel))
  755. // {
  756. // IPMI_DBG_PRINT ("Set Selector or Block Selector is invalid\n") ;
  757. // pGetBootOptRes->CompletionCode = CC_INV_DATA_FIELD;
  758. // return sizeof(uint8_t);
  759. // }
  760. // }
  761. // else
  762. // {
  763. // if (((0 != pGetBootOptReq->SetSel) && (ParamSel != CHASSIS_BOOT_INITIATOR_MBOX)) ||
  764. // (pGetBootOptReq->SetSel >= MAX_BOOT_INIT_MAILBOX_BLOCKS) ||
  765. // (0 != pGetBootOptReq->BlockSel))
  766. // {
  767. // IPMI_DBG_PRINT ("Set Selector or Block Selector is invalid\n") ;
  768. // pGetBootOptRes->CompletionCode = CC_INV_DATA_FIELD;
  769. // return sizeof(uint8_t);
  770. // }
  771. // }
  772. // pGetBootOptRes->CompletionCode = CC_NORMAL;
  773. // pGetBootOptRes->ParamVersion = CHASSIS_PARAMETER_VERSION;
  774. // pGetBootOptRes->ParameterValid = ParamSel;
  775. // OS_THREAD_MUTEX_ACQUIRE(&g_BMCInfo.ChassisMutex, WAIT_INFINITE);
  776. // // get a local copy of the boot option from the shared memory
  777. // sBootOptions = BMC_GET_SHARED_MEM(BMCInst)->sBootOptions;
  778. // /*Set the Parameter valid bit if needed */
  779. // if (sBootOptions.ParameterValid & (1 << ParamSel))
  780. // {
  781. // pGetBootOptRes->ParameterValid |= 0x80;
  782. // }
  783. // /*Set initial length of Completion code,Param revision & Paramvalid */
  784. // ResponseLength = 0x03;
  785. // /*Load the specific parameter */
  786. // switch (ParamSel)
  787. // {
  788. // case CHASSIS_SET_INPROG :
  789. // pGetBootOptRes->BootParams.SetInProgress = sBootOptions.u8SetInProgress;
  790. // ResponseLength += sizeof (sBootOptions.u8SetInProgress);
  791. // break;
  792. // case CHASSIS_SERVICE_PART_SEL:
  793. // pGetBootOptRes->BootParams.ServicePartitionSelector =
  794. // sBootOptions.ServicePartitionSelector;
  795. // ResponseLength += sizeof (sBootOptions.ServicePartitionScan);
  796. // break;
  797. //
  798. // case CHASSIS_SERVICE_PART_SCAN:
  799. // pGetBootOptRes->BootParams.ServicePartitionScan = g_BMCInfo.ChassisConfig.SysPartitionScan;
  800. // ResponseLength += sizeof (sBootOptions.ServicePartitionScan);
  801. // break;
  802. //
  803. // case CHASSIS_BOOT_FLAG_VALID_BIT_CLEAR:
  804. // pGetBootOptRes->BootParams.BootFlagValidBitClearing =
  805. // sBootOptions.BootFlagValidBitClearing;
  806. // ResponseLength += sizeof (sBootOptions.BootFlagValidBitClearing);
  807. // break;
  808. //
  809. // case CHASSIS_BOOT_INFO_ACK:
  810. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.BootInfoAck,
  811. // ( uint8_t*)&sBootOptions.BootInfoAck,
  812. // sizeof (BootInfoAck_T));
  813. // pGetBootOptRes->BootParams.BootInfoAck.WriteMask = 0;
  814. // ResponseLength += sizeof (BootInfoAck_T);
  815. // break;
  816. //
  817. // case CHASSIS_BOOT_FLAGS:
  818. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.BootFlags,
  819. // ( uint8_t*)&sBootOptions.BootFlags,
  820. // sizeof (BootFlags_T));
  821. // ResponseLength += sizeof (BootFlags_T);
  822. // break;
  823. // case CHASSIS_BOOT_INITIATOR_INFO:
  824. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.BootInitiatorInfo,
  825. // ( uint8_t*)&sBootOptions.BootInitiatorInfo,
  826. // sizeof (BootInitiatorInfo_T));
  827. // ResponseLength += sizeof (BootInitiatorInfo_T);
  828. // break;
  829. //
  830. // case CHASSIS_BOOT_INITIATOR_MBOX:
  831. // pGetBootOptRes->BootParams.BootMailBox.BlockSel = pGetBootOptReq->SetSel;
  832. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.BootMailBox.BootMBox,
  833. // ( uint8_t*)&sBootOptions.BootMailBox[pGetBootOptReq->SetSel],
  834. // sizeof (BootInitiatorMailbox_T));
  835. // ResponseLength += sizeof (BootInitiatorMboxReq_T);
  836. // break;
  837. // case CHASSIS_AMI_OEM_PARAM:
  838. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.Oem,
  839. // ( uint8_t*)&g_BMCInfo.ChassisConfig.OemBootOpt,
  840. // sizeof (AMI_BootOpt_T));
  841. // ResponseLength += sizeof (AMI_BootOpt_T);
  842. // break;
  843. // case SSICB_OEM_PARAM_BLK_SIZE_TBL:
  844. // if(SSIComputeBladeSupport)
  845. // {
  846. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.OemParamBlkSizeTbl,
  847. // ( uint8_t*)&sBootOptions.OemParamBlkSizeTbl,
  848. // sizeof(OemParamBlkSizeTbl_T));
  849. // ResponseLength += sizeof(OemParamBlkSizeTbl_T);
  850. // break;
  851. // }
  852. // else
  853. // {
  854. // pGetBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED ;
  855. // ResponseLength = 1 ;
  856. // break;
  857. // }
  858. // case SSICB_BOOT_ORDER_TBL:
  859. // if(SSIComputeBladeSupport)
  860. // {
  861. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.BootOrderTbl,
  862. // ( uint8_t*)&sBootOptions.BootOrderTbl[pGetBootOptReq->SetSel * sizeof(BootOrderTbl_T)],
  863. // sizeof(BootOrderTbl_T));
  864. // ResponseLength += sizeof(BootOrderTbl_T);
  865. // break;
  866. // }
  867. // else
  868. // {
  869. // pGetBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED ;
  870. // ResponseLength = 1 ;
  871. // break;
  872. // }
  873. // case SSICB_BOOT_DEV_SELECTOR:
  874. // if(SSIComputeBladeSupport)
  875. // {
  876. // pGetBootOptRes->BootParams.BootDevSelector = sBootOptions.BootDevSelector;
  877. // ResponseLength += sizeof(sBootOptions.BootDevSelector);
  878. // break;
  879. // }
  880. // else
  881. // {
  882. // pGetBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED ;
  883. // ResponseLength = 1 ;
  884. // break;
  885. // }
  886. // case SSICB_SLOT_CONFIG_TBL:
  887. // if(SSIComputeBladeSupport)
  888. // {
  889. // _fmemcpy (( uint8_t*)&pGetBootOptRes->BootParams.SlotConfigTbl,
  890. // ( uint8_t*)&sBootOptions.SlotConfigTbl,
  891. // sizeof(SlotConfigTbl_T));
  892. // ResponseLength += sizeof(SlotConfigTbl_T);
  893. // break;
  894. // }
  895. // else
  896. // {
  897. // pGetBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED ;
  898. // ResponseLength = 1 ;
  899. // break;
  900. // }
  901. // default :
  902. // pGetBootOptRes->CompletionCode = CC_PARAM_NOT_SUPPORTED ;
  903. // ResponseLength = 1 ;
  904. // }
  905. // OS_THREAD_MUTEX_RELEASE(&g_BMCInfo.ChassisMutex);
  906. // return ResponseLength;
  907. return 1;
  908. }
  909. /*-------------------------------------
  910. * SetFPButtonEnables
  911. *-------------------------------------*/
  912. int
  913. SetFPButtonEnables ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  914. {
  915. printf("SetFPButtonEnables not implement\r\n");
  916. //#if 0 //FQLI
  917. // PMConfig_T* pPMConfig;
  918. // bool bRet;
  919. // SetFPBtnEnablesRes_T* pFPBtnEnablesRes = (SetFPBtnEnablesRes_T*)pRes;
  920. // SetFPBtnEnablesReq_T* pFPBtnEnablesReq = (SetFPBtnEnablesReq_T*)pReq;
  921. // IPMI_DBG_PRINT ("PwrCtrl - SetFrontPanelEnables\n");
  922. // pFPBtnEnablesRes->CompletionCode = CC_INV_CMD;
  923. // if (pReq)
  924. // {
  925. // pFPBtnEnablesRes->CompletionCode = CC_NORMAL;
  926. // // retrieve chassis status from the NVStore
  927. // pPMConfig = ( PMConfig_T*)GetNVRAddr(NVRH_PMCONFIG);
  928. // // store the front panel enables to the NVStore
  929. // pPMConfig->ChassisConfig.ChassisPowerState.FPBtnEnables = pFPBtnEnablesReq->ButtonEnables;
  930. // // enable / disable front panel buttons. do the set before store the value in case the
  931. // // action fails. if failed to set the passthrough buttons, the current reading will be
  932. // // used to be the current settings.
  933. // bRet = PDK_SetFPEnable(&pFPBtnEnablesReq->ButtonEnables);
  934. // if (bRet != TRUE)
  935. // {
  936. // pFPBtnEnablesRes->CompletionCode = CC_UNSPECIFIED_ERR;
  937. // }
  938. // FlushPMC(&pPMConfig->ChassisConfig.ChassisPowerState.sFrontPanelButton, sizeof(ChassisPowerState_T));
  939. // }
  940. // return sizeof (SetFPBtnEnablesRes_T);
  941. //#else //AMI
  942. // SetFPBtnEnablesReq_T* pFPBtnEnablesReq = ( SetFPBtnEnablesReq_T*)pReq;
  943. // SetFPBtnEnablesRes_T* pFPBtnEnablesRes = ( SetFPBtnEnablesRes_T*)pRes;
  944. // BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
  945. // IPMI_DBG_PRINT ("Set FP Button Enables\n");
  946. // /* Check for the reserved bytes should b zero */
  947. // if ( 0 != (pFPBtnEnablesReq->ButtonEnables & RESERVED_BITS_SETFPBUTTONENABLES ) )
  948. // {
  949. // pFPBtnEnablesRes->CompletionCode = CC_INV_DATA_FIELD;
  950. // return sizeof(uint8_t);
  951. // }
  952. // OS_THREAD_MUTEX_ACQUIRE(&g_BMCInfo.ChassisMutex, WAIT_INFINITE);
  953. // g_BMCInfo.ChassisConfig.ChassisPowerState.FPBtnEnables = pFPBtnEnablesReq->ButtonEnables;
  954. // if(g_PDKHandle[PDK_FPENABLE] != NULL)
  955. // {
  956. // ((int(*)(uint8_t,int))g_PDKHandle[PDK_FPENABLE]) (pFPBtnEnablesReq->ButtonEnables,BMCInst);
  957. // }
  958. // /* Save in NVR */
  959. // FlushIPMI((uint8_t*)&g_BMCInfo.IpmiConfig,sizeof(IPMIConfig_T));
  960. // pFPBtnEnablesRes->CompletionCode = 0x00;
  961. // return sizeof (SetFPBtnEnablesRes_T);
  962. //#endif //FQLI
  963. return 1;
  964. }
  965. /*-------------------------------------
  966. * SetPowerCycleInterval
  967. *-------------------------------------*/
  968. int
  969. SetPowerCycleInterval ( uint8_t* pReq, uint8_t ReqLen, uint8_t* pRes)
  970. {
  971. SetPowerCycleIntervalReq_T* pSetPowerCycleInterval = (SetPowerCycleIntervalReq_T*) pReq;
  972. SetPowerCycleIntervalRes_T* pSetPowerCycleIntervalRes = (SetPowerCycleIntervalRes_T*) pRes;
  973. g_BMCInfo.IpmiConfig.PowerCycleInterval = pSetPowerCycleInterval->PowerCycleInterval;
  974. pSetPowerCycleIntervalRes->CompletionCode = CC_NORMAL;
  975. FlushIPMIToFlash();
  976. return sizeof(SetPowerCycleIntervalRes_T);
  977. }
  978. #endif /* CHASSIS_DEVICE */