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