ipmi_pef.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  1. /*
  2. * Copyright (c) 2004 Dell Computers. All Rights Reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * Redistribution of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * Redistribution in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * Neither the name of Dell Computers, or the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * This software is provided "AS IS," without a warranty of any kind.
  20. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
  21. * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
  22. * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
  23. * DELL COMPUTERS ("DELL") AND ITS LICENSORS SHALL NOT BE LIABLE
  24. * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
  25. * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
  26. * DELL OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
  27. * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
  28. * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
  29. * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
  30. * EVEN IF DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  31. */
  32. #ifndef IPMI_PEF_H
  33. #define IPMI_PEF_H
  34. #include <ipmitool/ipmi.h>
  35. /* PEF */
  36. struct pef_capabilities { /* "get pef capabilities" response */
  37. uint8_t version;
  38. uint8_t actions; /* mapped by PEF_ACTION_xxx */
  39. uint8_t event_filter_count;
  40. };
  41. typedef enum {
  42. P_TRUE,
  43. P_SUPP,
  44. P_ACTV,
  45. P_ABLE,
  46. } flg_e;
  47. #ifdef HAVE_PRAGMA_PACK
  48. #pragma pack(1)
  49. #endif
  50. struct pef_table_entry {
  51. #define PEF_CONFIG_ENABLED 0x80
  52. #define PEF_CONFIG_PRECONFIGURED 0x40
  53. uint8_t config;
  54. #define PEF_ACTION_DIAGNOSTIC_INTERRUPT 0x20
  55. #define PEF_ACTION_OEM 0x10
  56. #define PEF_ACTION_POWER_CYCLE 0x08
  57. #define PEF_ACTION_RESET 0x04
  58. #define PEF_ACTION_POWER_DOWN 0x02
  59. #define PEF_ACTION_ALERT 0x01
  60. uint8_t action;
  61. #define PEF_POLICY_NUMBER_MASK 0x0f
  62. uint8_t policy_number;
  63. #define PEF_SEVERITY_NON_RECOVERABLE 0x20
  64. #define PEF_SEVERITY_CRITICAL 0x10
  65. #define PEF_SEVERITY_WARNING 0x08
  66. #define PEF_SEVERITY_OK 0x04
  67. #define PEF_SEVERITY_INFORMATION 0x02
  68. #define PEF_SEVERITY_MONITOR 0x01
  69. uint8_t severity;
  70. uint8_t generator_ID_addr;
  71. uint8_t generator_ID_lun;
  72. uint8_t sensor_type;
  73. #define PEF_SENSOR_NUMBER_MATCH_ANY 0xff
  74. uint8_t sensor_number;
  75. #define PEF_EVENT_TRIGGER_UNSPECIFIED 0x0
  76. #define PEF_EVENT_TRIGGER_THRESHOLD 0x1
  77. #define PEF_EVENT_TRIGGER_SENSOR_SPECIFIC 0x6f
  78. #define PEF_EVENT_TRIGGER_MATCH_ANY 0xff
  79. uint8_t event_trigger;
  80. uint8_t event_data_1_offset_mask[2];
  81. uint8_t event_data_1_AND_mask;
  82. uint8_t event_data_1_compare_1;
  83. uint8_t event_data_1_compare_2;
  84. uint8_t event_data_2_AND_mask;
  85. uint8_t event_data_2_compare_1;
  86. uint8_t event_data_2_compare_2;
  87. uint8_t event_data_3_AND_mask;
  88. uint8_t event_data_3_compare_1;
  89. uint8_t event_data_3_compare_2;
  90. } ATTRIBUTE_PACKING;
  91. #ifdef HAVE_PRAGMA_PACK
  92. #pragma pack(0)
  93. #endif
  94. struct desc_map { /* maps a description to a value/mask */
  95. const char *desc;
  96. uint32_t mask;
  97. };
  98. struct bit_desc_map { /* description text container */
  99. #define BIT_DESC_MAP_LIST 0x1 /* index-based text array */
  100. #define BIT_DESC_MAP_ANY 0x2 /* bitwise, but only print 1st one */
  101. #define BIT_DESC_MAP_ALL 0x3 /* bitwise, print them all */
  102. uint32_t desc_map_type;
  103. struct desc_map desc_maps[128];
  104. };
  105. static struct bit_desc_map
  106. pef_b2s_actions __attribute__((unused)) = {
  107. BIT_DESC_MAP_ALL,
  108. { {"Alert", PEF_ACTION_ALERT},
  109. {"Power-off", PEF_ACTION_POWER_DOWN},
  110. {"Reset", PEF_ACTION_RESET},
  111. {"Power-cycle", PEF_ACTION_POWER_CYCLE},
  112. {"OEM-defined", PEF_ACTION_OEM},
  113. {"Diagnostic-interrupt", PEF_ACTION_DIAGNOSTIC_INTERRUPT},
  114. {NULL}
  115. } };
  116. static struct bit_desc_map
  117. pef_b2s_severities __attribute__((unused)) = {
  118. BIT_DESC_MAP_ANY,
  119. { {"Non-recoverable", PEF_SEVERITY_NON_RECOVERABLE},
  120. {"Critical", PEF_SEVERITY_CRITICAL},
  121. {"Warning", PEF_SEVERITY_WARNING},
  122. {"OK", PEF_SEVERITY_OK},
  123. {"Information", PEF_SEVERITY_INFORMATION},
  124. {"Monitor", PEF_SEVERITY_MONITOR},
  125. {NULL}
  126. } };
  127. static struct bit_desc_map
  128. pef_b2s_sensortypes __attribute__((unused)) = {
  129. BIT_DESC_MAP_LIST,
  130. { {"Any", 255},
  131. {"Temperature", 1},
  132. {"Voltage", 2},
  133. {"Current", 3},
  134. {"Fan", 4},
  135. {"Chassis Intrusion", 5},
  136. {"Platform security breach", 6},
  137. {"Processor", 7},
  138. {"Power supply", 8},
  139. {"Power Unit", 9},
  140. {"Cooling device", 10},
  141. {"Other (units-based)", 11},
  142. {"Memory", 12},
  143. {"Drive Slot", 13},
  144. {"POST memory resize", 14},
  145. {"POST error", 15},
  146. {"Logging disabled", 16},
  147. {"Watchdog 1", 17},
  148. {"System event", 18},
  149. {"Critical Interrupt", 19},
  150. {"Button", 20},
  151. {"Module/board", 21},
  152. {"uController/coprocessor", 22},
  153. {"Add-in card", 23},
  154. {"Chassis", 24},
  155. {"Chipset", 25},
  156. {"Other (FRU)", 26},
  157. {"Cable/interconnect", 27},
  158. {"Terminator", 28},
  159. {"System boot", 29},
  160. {"Boot error", 30},
  161. {"OS boot", 31},
  162. {"OS critical stop", 32},
  163. {"Slot/connector", 33},
  164. {"ACPI power state", 34},
  165. {"Watchdog 2", 35},
  166. {"Platform alert", 36},
  167. {"Entity presence", 37},
  168. {"Monitor ASIC/IC", 38},
  169. {"LAN", 39},
  170. {"Management subsytem health",40},
  171. {"Battery", 41},
  172. {NULL}
  173. } };
  174. static struct bit_desc_map
  175. pef_b2s_gentype_1 = {
  176. BIT_DESC_MAP_LIST,
  177. { {"<LNC", 0}, /* '<' : getting worse */
  178. {">LNC", 1}, /* '>' : getting better */
  179. {"<LC", 2},
  180. {">LC", 3},
  181. {"<LNR", 4},
  182. {">LNR", 5},
  183. {">UNC", 6},
  184. {"<UNC", 7},
  185. {">UC", 8},
  186. {"<UC", 9},
  187. {">UNR", 10},
  188. {"<UNR", 11},
  189. {NULL}
  190. } };
  191. static struct bit_desc_map
  192. pef_b2s_gentype_2 = {
  193. BIT_DESC_MAP_LIST,
  194. { {"transition to idle", 0},
  195. {"transition to active", 1},
  196. {"transition to busy", 2},
  197. {NULL}
  198. } };
  199. static struct bit_desc_map
  200. pef_b2s_gentype_3 = {
  201. BIT_DESC_MAP_LIST,
  202. { {"state deasserted", 0},
  203. {"state asserted", 1},
  204. {NULL}
  205. } };
  206. static struct bit_desc_map
  207. pef_b2s_gentype_4 = {
  208. BIT_DESC_MAP_LIST,
  209. { {"predictive failure deasserted", 0},
  210. {"predictive failure asserted", 1},
  211. {NULL}
  212. } };
  213. static struct bit_desc_map
  214. pef_b2s_gentype_5 = {
  215. BIT_DESC_MAP_LIST,
  216. { {"limit not exceeded", 0},
  217. {"limit exceeded", 1},
  218. {NULL}
  219. } };
  220. static struct bit_desc_map
  221. pef_b2s_gentype_6 = {
  222. BIT_DESC_MAP_LIST,
  223. { {"performance met", 0},
  224. {"performance lags", 1},
  225. {NULL}
  226. } };
  227. static struct bit_desc_map
  228. pef_b2s_gentype_7 = {
  229. BIT_DESC_MAP_LIST,
  230. { {"ok", 0},
  231. {"<warn", 1}, /* '<' : getting worse */
  232. {"<fail", 2},
  233. {"<dead", 3},
  234. {">warn", 4}, /* '>' : getting better */
  235. {">fail", 5},
  236. {"dead", 6},
  237. {"monitor", 7},
  238. {"informational", 8},
  239. {NULL}
  240. } };
  241. static struct bit_desc_map
  242. pef_b2s_gentype_8 = {
  243. BIT_DESC_MAP_LIST,
  244. { {"device removed/absent", 0},
  245. {"device inserted/present", 1},
  246. {NULL}
  247. } };
  248. static struct bit_desc_map
  249. pef_b2s_gentype_9 = {
  250. BIT_DESC_MAP_LIST,
  251. { {"device disabled", 0},
  252. {"device enabled", 1},
  253. {NULL}
  254. } };
  255. static struct bit_desc_map
  256. pef_b2s_gentype_10 = {
  257. BIT_DESC_MAP_LIST,
  258. { {"transition to running", 0},
  259. {"transition to in test", 1},
  260. {"transition to power off", 2},
  261. {"transition to online", 3},
  262. {"transition to offline", 4},
  263. {"transition to off duty", 5},
  264. {"transition to degraded", 6},
  265. {"transition to power save", 7},
  266. {"install error", 8},
  267. {NULL}
  268. } };
  269. static struct bit_desc_map
  270. pef_b2s_gentype_11 = {
  271. BIT_DESC_MAP_LIST,
  272. { {"fully redundant", 0},
  273. {"redundancy lost", 1},
  274. {"redundancy degraded", 2},
  275. {"<non-redundant/sufficient", 3}, /* '<' : getting worse */
  276. {">non-redundant/sufficient", 4}, /* '>' : getting better */
  277. {"non-redundant/insufficient", 5},
  278. {"<redundancy degraded", 6},
  279. {">redundancy degraded", 7},
  280. {NULL}
  281. } };
  282. static struct bit_desc_map
  283. pef_b2s_gentype_12 = {
  284. BIT_DESC_MAP_LIST,
  285. { {"D0 power state", 0},
  286. {"D1 power state", 1},
  287. {"D2 power state", 2},
  288. {"D3 power state", 3},
  289. {NULL}
  290. } };
  291. static struct bit_desc_map *
  292. pef_b2s_generic_ER[] __attribute__((unused)) = {
  293. &pef_b2s_gentype_1,
  294. &pef_b2s_gentype_2,
  295. &pef_b2s_gentype_3,
  296. &pef_b2s_gentype_4,
  297. &pef_b2s_gentype_5,
  298. &pef_b2s_gentype_6,
  299. &pef_b2s_gentype_7,
  300. &pef_b2s_gentype_8,
  301. &pef_b2s_gentype_9,
  302. &pef_b2s_gentype_10,
  303. &pef_b2s_gentype_11,
  304. &pef_b2s_gentype_12,
  305. };
  306. #define PEF_B2S_GENERIC_ER_ENTRIES \
  307. (sizeof(pef_b2s_generic_ER) / sizeof(pef_b2s_generic_ER[0]))
  308. #ifdef HAVE_PRAGMA_PACK
  309. #pragma pack(1)
  310. #endif
  311. struct pef_policy_entry {
  312. #define PEF_POLICY_ID_MASK 0xf0
  313. #define PEF_POLICY_ID_SHIFT 4
  314. #define PEF_POLICY_DISABLED 0xF7
  315. #define PEF_POLICY_ENABLED 0x08
  316. #define PEF_POLICY_FLAGS_MASK 0x07
  317. #define PEF_POLICY_FLAGS_MATCH_ALWAYS 0
  318. #define PEF_POLICY_FLAGS_PREV_OK_SKIP 1
  319. #define PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET 2
  320. #define PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET 3
  321. #define PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET 4
  322. uint8_t policy;
  323. #define PEF_POLICY_CHANNEL_MASK 0xf0
  324. #define PEF_POLICY_CHANNEL_SHIFT 4
  325. #define PEF_POLICY_DESTINATION_MASK 0x0f
  326. uint8_t chan_dest;
  327. #define PEF_POLICY_EVENT_SPECIFIC 0x80
  328. uint8_t alert_string_key;
  329. } ATTRIBUTE_PACKING;
  330. #ifdef HAVE_PRAGMA_PACK
  331. #pragma pack(0)
  332. #endif
  333. static struct bit_desc_map
  334. pef_b2s_policies __attribute__((unused)) = {
  335. BIT_DESC_MAP_LIST,
  336. { {"Match-always", PEF_POLICY_FLAGS_MATCH_ALWAYS},
  337. {"Try-next-entry", PEF_POLICY_FLAGS_PREV_OK_SKIP},
  338. {"Try-next-set", PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET},
  339. {"Try-next-channel", PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET},
  340. {"Try-next-destination", PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET},
  341. {NULL}
  342. } };
  343. static struct bit_desc_map
  344. pef_b2s_ch_medium __attribute__((unused)) = {
  345. #define PEF_CH_MEDIUM_TYPE_IPMB 1
  346. #define PEF_CH_MEDIUM_TYPE_ICMB_10 2
  347. #define PEF_CH_MEDIUM_TYPE_ICMB_09 3
  348. #define PEF_CH_MEDIUM_TYPE_LAN 4
  349. #define PEF_CH_MEDIUM_TYPE_SERIAL 5
  350. #define PEF_CH_MEDIUM_TYPE_XLAN 6
  351. #define PEF_CH_MEDIUM_TYPE_PCI_SMBUS 7
  352. #define PEF_CH_MEDIUM_TYPE_SMBUS_V1X 8
  353. #define PEF_CH_MEDIUM_TYPE_SMBUS_V2X 9
  354. #define PEF_CH_MEDIUM_TYPE_USB_V1X 10
  355. #define PEF_CH_MEDIUM_TYPE_USB_V2X 11
  356. #define PEF_CH_MEDIUM_TYPE_SYSTEM 12
  357. BIT_DESC_MAP_LIST,
  358. { {"IPMB (I2C)", PEF_CH_MEDIUM_TYPE_IPMB},
  359. {"ICMB v1.0", PEF_CH_MEDIUM_TYPE_ICMB_10},
  360. {"ICMB v0.9", PEF_CH_MEDIUM_TYPE_ICMB_09},
  361. {"802.3 LAN", PEF_CH_MEDIUM_TYPE_LAN},
  362. {"Serial/Modem (RS-232)", PEF_CH_MEDIUM_TYPE_SERIAL},
  363. {"Other LAN", PEF_CH_MEDIUM_TYPE_XLAN},
  364. {"PCI SMBus", PEF_CH_MEDIUM_TYPE_PCI_SMBUS},
  365. {"SMBus v1.0/1.1", PEF_CH_MEDIUM_TYPE_SMBUS_V1X},
  366. {"SMBus v2.0", PEF_CH_MEDIUM_TYPE_SMBUS_V2X},
  367. {"USB 1.x", PEF_CH_MEDIUM_TYPE_USB_V1X},
  368. {"USB 2.x", PEF_CH_MEDIUM_TYPE_USB_V2X},
  369. {"System I/F (KCS,SMIC,BT)", PEF_CH_MEDIUM_TYPE_SYSTEM},
  370. {NULL}
  371. } };
  372. #ifdef HAVE_PRAGMA_PACK
  373. #pragma pack(1)
  374. #endif
  375. struct pef_cfgparm_selector {
  376. #define PEF_CFGPARM_ID_REVISION_ONLY_MASK 0x80
  377. #define PEF_CFGPARM_ID_SET_IN_PROGRESS 0
  378. #define PEF_CFGPARM_ID_PEF_CONTROL 1
  379. #define PEF_CFGPARM_ID_PEF_ACTION 2
  380. #define PEF_CFGPARM_ID_PEF_STARTUP_DELAY 3
  381. #define PEF_CFGPARM_ID_PEF_ALERT_STARTUP_DELAY 4
  382. #define PEF_CFGPARM_ID_PEF_FILTER_TABLE_SIZE 5
  383. #define PEF_CFGPARM_ID_PEF_FILTER_TABLE_ENTRY 6
  384. #define PEF_CFGPARM_ID_PEF_FILTER_TABLE_DATA_1 7
  385. #define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_SIZE 8
  386. #define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_ENTRY 9
  387. #define PEF_CFGPARM_ID_SYSTEM_GUID 10
  388. #define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_SIZE 11
  389. #define PEF_CFGPARM_ID_PEF_ALERT_STRING_KEY 12
  390. #define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_ENTRY 13
  391. uint8_t id;
  392. uint8_t set;
  393. uint8_t block;
  394. } ATTRIBUTE_PACKING;
  395. #ifdef HAVE_PRAGMA_PACK
  396. #pragma pack(0)
  397. #endif
  398. #ifdef HAVE_PRAGMA_PACK
  399. #pragma pack(1)
  400. #endif
  401. struct pef_cfgparm_set_in_progress {
  402. #define PEF_SET_IN_PROGRESS_COMMIT_WRITE 0x02
  403. #define PEF_SET_IN_PROGRESS 0x01
  404. uint8_t data1;
  405. } ATTRIBUTE_PACKING;
  406. #ifdef HAVE_PRAGMA_PACK
  407. #pragma pack(0)
  408. #endif
  409. #ifdef HAVE_PRAGMA_PACK
  410. #pragma pack(1)
  411. #endif
  412. struct pef_cfgparm_control {
  413. #define PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY 0x08
  414. #define PEF_CONTROL_ENABLE_STARTUP_DELAY 0x04
  415. #define PEF_CONTROL_ENABLE_EVENT_MESSAGES 0x02
  416. #define PEF_CONTROL_ENABLE 0x01
  417. uint8_t data1;
  418. } ATTRIBUTE_PACKING;
  419. #ifdef HAVE_PRAGMA_PACK
  420. #pragma pack(0)
  421. #endif
  422. static struct bit_desc_map
  423. pef_b2s_control __attribute__((unused)) = {
  424. BIT_DESC_MAP_ALL,
  425. { {"PEF", PEF_CONTROL_ENABLE},
  426. {"PEF event messages", PEF_CONTROL_ENABLE_EVENT_MESSAGES},
  427. {"PEF startup delay", PEF_CONTROL_ENABLE_STARTUP_DELAY},
  428. {"Alert startup delay", PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY},
  429. {NULL}
  430. } };
  431. #ifdef HAVE_PRAGMA_PACK
  432. #pragma pack(1)
  433. #endif
  434. struct pef_cfgparm_action {
  435. #define PEF_ACTION_ENABLE_DIAGNOSTIC_INTERRUPT 0x20
  436. #define PEF_ACTION_ENABLE_OEM 0x10
  437. #define PEF_ACTION_ENABLE_POWER_CYCLE 0x08
  438. #define PEF_ACTION_ENABLE_RESET 0x04
  439. #define PEF_ACTION_ENABLE_POWER_DOWN 0x02
  440. #define PEF_ACTION_ENABLE_ALERT 0x01
  441. uint8_t data1;
  442. } ATTRIBUTE_PACKING;
  443. #ifdef HAVE_PRAGMA_PACK
  444. #pragma pack(0)
  445. #endif
  446. #ifdef HAVE_PRAGMA_PACK
  447. #pragma pack(1)
  448. #endif
  449. struct pef_cfgparm_startup_delay {
  450. uint8_t data1;
  451. } ATTRIBUTE_PACKING;
  452. #ifdef HAVE_PRAGMA_PACK
  453. #pragma pack(0)
  454. #endif
  455. #ifdef HAVE_PRAGMA_PACK
  456. #pragma pack(1)
  457. #endif
  458. struct pef_cfgparm_alert_startup_delay {
  459. uint8_t data1;
  460. } ATTRIBUTE_PACKING;
  461. #ifdef HAVE_PRAGMA_PACK
  462. #pragma pack(0)
  463. #endif
  464. #ifdef HAVE_PRAGMA_PACK
  465. #pragma pack(1)
  466. #endif
  467. struct pef_cfgparm_filter_table_size {
  468. #define PEF_FILTER_TABLE_SIZE_MASK 0x7f
  469. uint8_t data1;
  470. } ATTRIBUTE_PACKING;
  471. #ifdef HAVE_PRAGMA_PACK
  472. #pragma pack(0)
  473. #endif
  474. #ifdef HAVE_PRAGMA_PACK
  475. #pragma pack(1)
  476. #endif
  477. struct pef_cfgparm_filter_table_entry {
  478. # define PEF_FILTER_DISABLED 0x7F
  479. # define PEF_FILTER_ENABLED 0x80
  480. # define PEF_FILTER_TABLE_ID_MASK 0x7F
  481. uint8_t data1;
  482. struct pef_table_entry entry;
  483. } ATTRIBUTE_PACKING;
  484. #ifdef HAVE_PRAGMA_PACK
  485. #pragma pack(0)
  486. #endif
  487. #ifdef HAVE_PRAGMA_PACK
  488. #pragma pack(1)
  489. #endif
  490. struct pef_cfgparm_filter_table_data_1 {
  491. uint8_t id;
  492. uint8_t cfg;
  493. } ATTRIBUTE_PACKING;
  494. #ifdef HAVE_PRAGMA_PACK
  495. #pragma pack(0)
  496. #endif
  497. #ifdef HAVE_PRAGMA_PACK
  498. #pragma pack(1)
  499. #endif
  500. struct pef_cfgparm_policy_table_size {
  501. #define PEF_POLICY_TABLE_SIZE_MASK 0x7f
  502. uint8_t data1;
  503. } ATTRIBUTE_PACKING;
  504. #ifdef HAVE_PRAGMA_PACK
  505. #pragma pack(0)
  506. #endif
  507. #ifdef HAVE_PRAGMA_PACK
  508. #pragma pack(1)
  509. #endif
  510. struct pef_cfgparm_policy_table_entry {
  511. #define PEF_POLICY_TABLE_ID_MASK 0x7f
  512. uint8_t data1;
  513. struct pef_policy_entry entry;
  514. } ATTRIBUTE_PACKING;
  515. #ifdef HAVE_PRAGMA_PACK
  516. #pragma pack(0)
  517. #endif
  518. #ifdef HAVE_PRAGMA_PACK
  519. #pragma pack(1)
  520. #endif
  521. struct pef_cfgparm_system_guid {
  522. #define PEF_SYSTEM_GUID_USED_IN_PET 0x01
  523. uint8_t data1;
  524. uint8_t guid[16];
  525. } ATTRIBUTE_PACKING;
  526. #ifdef HAVE_PRAGMA_PACK
  527. #pragma pack(0)
  528. #endif
  529. #ifdef HAVE_PRAGMA_PACK
  530. #pragma pack(1)
  531. #endif
  532. struct pef_cfgparm_alert_string_table_size {
  533. #define PEF_ALERT_STRING_TABLE_SIZE_MASK 0x7f
  534. uint8_t data1;
  535. } ATTRIBUTE_PACKING;
  536. #ifdef HAVE_PRAGMA_PACK
  537. #pragma pack(0)
  538. #endif
  539. #ifdef HAVE_PRAGMA_PACK
  540. #pragma pack(1)
  541. #endif
  542. struct pef_cfgparm_alert_string_keys {
  543. #define PEF_ALERT_STRING_ID_MASK 0x7f
  544. uint8_t data1;
  545. #define PEF_EVENT_FILTER_ID_MASK 0x7f
  546. uint8_t data2;
  547. #define PEF_ALERT_STRING_SET_ID_MASK 0x7f
  548. uint8_t data3;
  549. } ATTRIBUTE_PACKING;
  550. #ifdef HAVE_PRAGMA_PACK
  551. #pragma pack(0)
  552. #endif
  553. #ifdef HAVE_PRAGMA_PACK
  554. #pragma pack(1)
  555. #endif
  556. struct pef_cfgparm_alert_string_table_entry {
  557. uint8_t id;
  558. uint8_t blockno;
  559. uint8_t block[16];
  560. } ATTRIBUTE_PACKING;
  561. #ifdef HAVE_PRAGMA_PACK
  562. #pragma pack(0)
  563. #endif
  564. /* PEF - LAN */
  565. #ifdef HAVE_PRAGMA_PACK
  566. #pragma pack(1)
  567. #endif
  568. struct pef_lan_cfgparm_selector {
  569. #define PEF_LAN_CFGPARM_CH_REVISION_ONLY_MASK 0x80
  570. #define PEF_LAN_CFGPARM_CH_MASK 0x0f
  571. #define PEF_LAN_CFGPARM_ID_PET_COMMUNITY 16
  572. #define PEF_LAN_CFGPARM_ID_DEST_COUNT 17
  573. #define PEF_LAN_CFGPARM_ID_DESTTYPE 18
  574. #define PEF_LAN_CFGPARM_ID_DESTADDR 19
  575. uint8_t ch;
  576. uint8_t id;
  577. uint8_t set;
  578. uint8_t block;
  579. } ATTRIBUTE_PACKING;
  580. #ifdef HAVE_PRAGMA_PACK
  581. #pragma pack(0)
  582. #endif
  583. #ifdef HAVE_PRAGMA_PACK
  584. #pragma pack(1)
  585. #endif
  586. struct pef_lan_cfgparm_dest_size {
  587. #define PEF_LAN_DEST_TABLE_SIZE_MASK 0x0f
  588. uint8_t data1;
  589. } ATTRIBUTE_PACKING;
  590. #ifdef HAVE_PRAGMA_PACK
  591. #pragma pack(0)
  592. #endif
  593. #ifdef HAVE_PRAGMA_PACK
  594. #pragma pack(1)
  595. #endif
  596. struct pef_lan_cfgparm_dest_type {
  597. #define PEF_LAN_DEST_TYPE_ID_MASK 0x0f
  598. uint8_t dest;
  599. #define PEF_LAN_DEST_TYPE_ACK 0x80
  600. #define PEF_LAN_DEST_TYPE_MASK 0x07
  601. #define PEF_LAN_DEST_TYPE_PET 0
  602. #define PEF_LAN_DEST_TYPE_OEM_1 6
  603. #define PEF_LAN_DEST_TYPE_OEM_2 7
  604. uint8_t dest_type;
  605. uint8_t alert_timeout;
  606. #define PEF_LAN_RETRIES_MASK 0x07
  607. uint8_t retries;
  608. } ATTRIBUTE_PACKING;
  609. #ifdef HAVE_PRAGMA_PACK
  610. #pragma pack(0)
  611. #endif
  612. static struct bit_desc_map
  613. pef_b2s_lan_desttype __attribute__((unused)) = {
  614. BIT_DESC_MAP_LIST,
  615. { {"Acknowledged", PEF_LAN_DEST_TYPE_ACK},
  616. {"PET", PEF_LAN_DEST_TYPE_PET},
  617. {"OEM 1", PEF_LAN_DEST_TYPE_OEM_1},
  618. {"OEM 2", PEF_LAN_DEST_TYPE_OEM_2},
  619. {NULL}
  620. } };
  621. #ifdef HAVE_PRAGMA_PACK
  622. #pragma pack(1)
  623. #endif
  624. struct pef_lan_cfgparm_dest_info {
  625. #define PEF_LAN_DEST_MASK 0x0f
  626. uint8_t dest;
  627. #define PEF_LAN_DEST_ADDRTYPE_MASK 0xf0
  628. #define PEF_LAN_DEST_ADDRTYPE_SHIFT 4
  629. #define PEF_LAN_DEST_ADDRTYPE_IPV4_MAC 0x00
  630. uint8_t addr_type;
  631. #define PEF_LAN_DEST_GATEWAY_USE_BACKUP 0x01
  632. uint8_t gateway;
  633. uint8_t ip[4];
  634. uint8_t mac[6];
  635. } ATTRIBUTE_PACKING;
  636. #ifdef HAVE_PRAGMA_PACK
  637. #pragma pack(0)
  638. #endif
  639. /* PEF - Serial/PPP */
  640. #ifdef HAVE_PRAGMA_PACK
  641. #pragma pack(1)
  642. #endif
  643. struct pef_serial_cfgparm_selector {
  644. #define PEF_SERIAL_CFGPARM_CH_REVISION_ONLY_MASK 0x80
  645. #define PEF_SERIAL_CFGPARM_CH_MASK 0x0f
  646. #define PEF_SERIAL_CFGPARM_ID_DEST_COUNT 16
  647. #define PEF_SERIAL_CFGPARM_ID_DESTINFO 17
  648. #define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING_COUNT 20
  649. #define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING 21
  650. #define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_COUNT 24
  651. #define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_INFO 25
  652. #define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_PAGER_STRING 27
  653. uint8_t ch;
  654. uint8_t id;
  655. uint8_t set;
  656. uint8_t block;
  657. } ATTRIBUTE_PACKING;
  658. #ifdef HAVE_PRAGMA_PACK
  659. #pragma pack(0)
  660. #endif
  661. #ifdef HAVE_PRAGMA_PACK
  662. #pragma pack(1)
  663. #endif
  664. struct pef_serial_cfgparm_dest_size {
  665. #define PEF_SERIAL_DEST_TABLE_SIZE_MASK 0x0f
  666. uint8_t data1;
  667. } ATTRIBUTE_PACKING;
  668. #ifdef HAVE_PRAGMA_PACK
  669. #pragma pack(0)
  670. #endif
  671. #ifdef HAVE_PRAGMA_PACK
  672. #pragma pack(1)
  673. #endif
  674. struct pef_serial_cfgparm_dest_info {
  675. #define PEF_SERIAL_DEST_MASK 0x0f
  676. uint8_t dest;
  677. #define PEF_SERIAL_DEST_TYPE_ACK 0x80
  678. #define PEF_SERIAL_DEST_TYPE_MASK 0x0f
  679. #define PEF_SERIAL_DEST_TYPE_DIAL 0
  680. #define PEF_SERIAL_DEST_TYPE_TAP 1
  681. #define PEF_SERIAL_DEST_TYPE_PPP 2
  682. #define PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK 3
  683. #define PEF_SERIAL_DEST_TYPE_PPP_CALLBACK 4
  684. #define PEF_SERIAL_DEST_TYPE_OEM_1 14
  685. #define PEF_SERIAL_DEST_TYPE_OEM_2 15
  686. uint8_t dest_type;
  687. uint8_t alert_timeout;
  688. #define PEF_SERIAL_RETRIES_MASK 0x77
  689. #define PEF_SERIAL_RETRIES_POST_CONNECT_MASK 0x70
  690. #define PEF_SERIAL_RETRIES_PRE_CONNECT_MASK 0x07
  691. uint8_t retries;
  692. #define PEF_SERIAL_DIALPAGE_STRING_ID_MASK 0xf0
  693. #define PEF_SERIAL_DIALPAGE_STRING_ID_SHIFT 4
  694. #define PEF_SERIAL_TAP_PAGE_SERVICE_ID_MASK 0x0f
  695. #define PEF_SERIAL_PPP_ACCT_IPADDR_ID_MASK 0xf0
  696. #define PEF_SERIAL_PPP_ACCT_IPADDR_ID_SHIFT 4
  697. #define PEF_SERIAL_PPP_ACCT_ID_MASK 0x0f
  698. #define PEF_SERIAL_CALLBACK_IPADDR_ID_MASK 0x0f
  699. #define PEF_SERIAL_CALLBACK_IPADDR_ID_SHIFT 4
  700. #define PEF_SERIAL_CALLBACK_ACCT_ID_MASK 0xf0
  701. uint8_t data5;
  702. } ATTRIBUTE_PACKING;
  703. #ifdef HAVE_PRAGMA_PACK
  704. #pragma pack(0)
  705. #endif
  706. static struct bit_desc_map
  707. pef_b2s_serial_desttype __attribute__((unused)) = {
  708. BIT_DESC_MAP_LIST,
  709. { {"Acknowledged", PEF_SERIAL_DEST_TYPE_ACK},
  710. {"TAP page", PEF_SERIAL_DEST_TYPE_TAP},
  711. {"PPP PET", PEF_SERIAL_DEST_TYPE_PPP},
  712. {"Basic callback", PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK},
  713. {"PPP callback", PEF_SERIAL_DEST_TYPE_PPP_CALLBACK},
  714. {"OEM 1", PEF_SERIAL_DEST_TYPE_OEM_1},
  715. {"OEM 2", PEF_SERIAL_DEST_TYPE_OEM_2},
  716. {NULL}
  717. } };
  718. #ifdef HAVE_PRAGMA_PACK
  719. #pragma pack(1)
  720. #endif
  721. struct pef_serial_cfgparm_dial_string_count {
  722. #define PEF_SERIAL_DIAL_STRING_COUNT_MASK 0x0f
  723. uint8_t data1;
  724. } ATTRIBUTE_PACKING;
  725. #ifdef HAVE_PRAGMA_PACK
  726. #pragma pack(0)
  727. #endif
  728. #ifdef HAVE_PRAGMA_PACK
  729. #pragma pack(1)
  730. #endif
  731. struct pef_serial_cfgparm_dial_string {
  732. #define PEF_SERIAL_DIAL_STRING_MASK 0x0f
  733. uint8_t data1;
  734. uint8_t data2;
  735. uint8_t data3;
  736. } ATTRIBUTE_PACKING;
  737. #ifdef HAVE_PRAGMA_PACK
  738. #pragma pack(0)
  739. #endif
  740. #ifdef HAVE_PRAGMA_PACK
  741. #pragma pack(1)
  742. #endif
  743. struct pef_serial_cfgparm_tap_acct_count {
  744. #define PEF_SERIAL_TAP_ACCT_COUNT_MASK 0x0f
  745. uint8_t data1;
  746. } ATTRIBUTE_PACKING;
  747. #ifdef HAVE_PRAGMA_PACK
  748. #pragma pack(0)
  749. #endif
  750. #ifdef HAVE_PRAGMA_PACK
  751. #pragma pack(1)
  752. #endif
  753. struct pef_serial_cfgparm_tap_acct_info {
  754. uint8_t data1;
  755. #define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_MASK 0xf0
  756. #define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_SHIFT 4
  757. #define PEF_SERIAL_TAP_ACCT_INFO_SVC_SETTINGS_ID_MASK 0x0f
  758. uint8_t data2;
  759. } ATTRIBUTE_PACKING;
  760. #ifdef HAVE_PRAGMA_PACK
  761. #pragma pack(0)
  762. #endif
  763. #ifdef HAVE_PRAGMA_PACK
  764. #pragma pack(1)
  765. #endif
  766. struct pef_serial_cfgparm_tap_svc_settings {
  767. uint8_t data1;
  768. #define PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX 0x0
  769. #define PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX 0x01
  770. #define PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX 0x02
  771. uint8_t confirmation_flags;
  772. uint8_t service_type[3];
  773. uint8_t escape_mask[4];
  774. uint8_t timeout_parms[3];
  775. uint8_t retry_parms[2];
  776. } ATTRIBUTE_PACKING;
  777. #ifdef HAVE_PRAGMA_PACK
  778. #pragma pack(0)
  779. #endif
  780. static struct bit_desc_map
  781. pef_b2s_tap_svc_confirm __attribute__((unused)) = {
  782. BIT_DESC_MAP_LIST,
  783. { {"ACK", PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX},
  784. {"211+ACK", PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX},
  785. {"{211|213}+ACK", PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX},
  786. {NULL}
  787. } };
  788. #if 0 /* FYI : config parm groupings */
  789. struct pef_config_parms { /* PEF */
  790. struct pef_cfgparm_set_in_progress;
  791. struct pef_cfgparm_control;
  792. struct pef_cfgparm_action;
  793. struct pef_cfgparm_startup_delay; /* in seconds, 1-based */
  794. struct pef_cfgparm_alert_startup_delay; /* in seconds, 1-based */
  795. struct pef_cfgparm_filter_table_size; /* 1-based, READ-ONLY */
  796. struct pef_cfgparm_filter_table_entry;
  797. struct pef_cfgparm_filter_table_data_1;
  798. struct pef_cfgparm_policy_table_size;
  799. struct pef_cfgparm_policy_table_entry;
  800. struct pef_cfgparm_system_guid;
  801. struct pef_cfgparm_alert_string_table_size;
  802. struct pef_cfgparm_alert_string_keys;
  803. struct pef_cfgparm_alert_string_table_entry;
  804. } ATTRIBUTE_PACKING;
  805. struct pef_lan_config_parms { /* LAN */
  806. struct pef_lan_cfgparm_set_in_progress;
  807. struct pef_lan_cfgparm_auth_capabilities;
  808. struct pef_lan_cfgparm_auth_type;
  809. struct pef_lan_cfgparm_ip_address;
  810. struct pef_lan_cfgparm_ip_address_source;
  811. struct pef_lan_cfgparm_mac_address;
  812. struct pef_lan_cfgparm_subnet_mask;
  813. struct pef_lan_cfgparm_ipv4_header_parms;
  814. struct pef_lan_cfgparm_primary_rmcp_port;
  815. struct pef_lan_cfgparm_secondary_rmcp_port;
  816. struct pef_lan_cfgparm_bmc_generated_arp_control;
  817. struct pef_lan_cfgparm_gratuitous_arp;
  818. struct pef_lan_cfgparm_default_gateway_ipaddr;
  819. struct pef_lan_cfgparm_default_gateway_macaddr;
  820. struct pef_lan_cfgparm_backup_gateway_ipaddr;
  821. struct pef_lan_cfgparm_backup_gateway_macaddr;
  822. struct pef_lan_cfgparm_pet_community;
  823. struct pef_lan_cfgparm_destination_count;
  824. struct pef_lan_cfgparm_destination_type;
  825. struct pef_lan_cfgparm_destination_ipaddr;
  826. } ATTRIBUTE_PACKING;
  827. struct pef_serial_config_parms { /* Serial/PPP */
  828. struct pef_serial_cfgparm_set_in_progress;
  829. struct pef_serial_cfgparm_auth_capabilities;
  830. struct pef_serial_cfgparm_auth_type;
  831. struct pef_serial_cfgparm_connection_mode;
  832. struct pef_serial_cfgparm_idle_timeout;
  833. struct pef_serial_cfgparm_callback_control;
  834. struct pef_serial_cfgparm_session_termination;
  835. struct pef_serial_cfgparm_ipmi_settings;
  836. struct pef_serial_cfgparm_mux_control;
  837. struct pef_serial_cfgparm_modem_ring_time;
  838. struct pef_serial_cfgparm_modem_init_string;
  839. struct pef_serial_cfgparm_modem_escape_sequence;
  840. struct pef_serial_cfgparm_modem_hangup_sequence;
  841. struct pef_serial_cfgparm_modem_dial_command;
  842. struct pef_serial_cfgparm_page_blackout_interval;
  843. struct pef_serial_cfgparm_pet_community;
  844. struct pef_serial_cfgparm_destination_count;
  845. struct pef_serial_cfgparm_destination_info;
  846. struct pef_serial_cfgparm_call_retry_interval;
  847. struct pef_serial_cfgparm_destination_settings;
  848. struct pef_serial_cfgparm_dialstring_count;
  849. struct pef_serial_cfgparm_dialstring_info;
  850. struct pef_serial_cfgparm_ipaddr_count;
  851. struct pef_serial_cfgparm_ipaddr_info;
  852. struct pef_serial_cfgparm_tap_acct_count;
  853. struct pef_serial_cfgparm_tap_acct_info;
  854. struct pef_serial_cfgparm_tap_acct_passwords; /* WRITE only */
  855. struct pef_serial_cfgparm_tap_pager_id_strings;
  856. struct pef_serial_cfgparm_tap_service_settings;
  857. struct pef_serial_cfgparm_terminal_mode_config;
  858. struct pef_serial_cfgparm_ppp_otions;
  859. struct pef_serial_cfgparm_ppp_primary_rmcp_port;
  860. struct pef_serial_cfgparm_ppp_secondary_rmcp_port;
  861. struct pef_serial_cfgparm_ppp_link_auth;
  862. struct pef_serial_cfgparm_ppp_chap_name;
  863. struct pef_serial_cfgparm_ppp_accm;
  864. struct pef_serial_cfgparm_ppp_snoop_accm;
  865. struct pef_serial_cfgparm_ppp_acct_count;
  866. struct pef_serial_cfgparm_ppp_acct_dialstring_selector;
  867. struct pef_serial_cfgparm_ppp_acct_ipaddrs;
  868. struct pef_serial_cfgparm_ppp_acct_user_names;
  869. struct pef_serial_cfgparm_ppp_acct_user_domains;
  870. struct pef_serial_cfgparm_ppp_acct_user_passwords; /* WRITE only */
  871. struct pef_serial_cfgparm_ppp_acct_auth_settings;
  872. struct pef_serial_cfgparm_ppp_acct_connect_hold_times;
  873. struct pef_serial_cfgparm_ppp_udp_proxy_ipheader;
  874. struct pef_serial_cfgparm_ppp_udp_proxy_xmit_bufsize;
  875. struct pef_serial_cfgparm_ppp_udp_proxy_recv_bufsize;
  876. struct pef_serial_cfgparm_ppp_remote_console_ipaddr;
  877. } ATTRIBUTE_PACKING;
  878. #endif
  879. #define IPMI_CMD_GET_PEF_CAPABILITIES 0x10
  880. #define IPMI_CMD_SET_PEF_CONFIG_PARMS 0x12
  881. #define IPMI_CMD_GET_PEF_CONFIG_PARMS 0x13
  882. #define IPMI_CMD_GET_LAST_PROCESSED_EVT_ID 0x15
  883. #define IPMI_CMD_GET_SYSTEM_GUID 0x37
  884. #define IPMI_CMD_GET_CHANNEL_INFO 0x42
  885. #define IPMI_CMD_LAN_GET_CONFIG 0x02
  886. #define IPMI_CMD_SERIAL_GET_CONFIG 0x11
  887. struct pef_cfgparm_set_policy_table_entry
  888. {
  889. uint8_t param_selector;
  890. uint8_t policy_id;
  891. struct pef_policy_entry entry;
  892. } ATTRIBUTE_PACKING;
  893. const char * ipmi_pef_bit_desc(struct bit_desc_map * map, uint32_t val);
  894. void ipmi_pef_print_flags(struct bit_desc_map * map, flg_e type, uint32_t val);
  895. void ipmi_pef_print_dec(const char * text, uint32_t val);
  896. void ipmi_pef_print_hex(const char * text, uint32_t val);
  897. void ipmi_pef_print_1xd(const char * text, uint32_t val);
  898. void ipmi_pef_print_2xd(const char * text, uint8_t u1, uint8_t u2);
  899. void ipmi_pef_print_str(const char * text, const char * val);
  900. int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv);
  901. #endif /* IPMI_PEF_H */