Compare commits

..

544 Commits

Author SHA1 Message Date
d0f52c7a6b This commit was manufactured by cvs2svn to create tag 'IPMITOOL_1_8_9'. 2007-03-06 22:31:08 +00:00
2e7571daf2 Prepare for release. 2007-03-06 22:31:07 +00:00
c13966f04b fix byteswapping problem on sparc (and other big endian architectures) 2007-03-05 05:16:02 +00:00
56b892cea1 Benoit Guillon fix for get fru activation policy args 2007-02-23 19:13:48 +00:00
bec24b9019 - Fix a bug in sol when no retry-count is set. Was causing a line to be duplicate. 2007-02-23 15:12:20 +00:00
45185b23ec Fix configuring with FreeIPMI interface on FreeBSD 2007-02-23 08:21:07 +00:00
ecca25ed2b Add Arkadiusz Miskiewicz's Makefile, spec, config changes; update changelog for v1.8.9 2007-02-23 06:02:08 +00:00
eccd10200f Update ChangeLog to prepare for v1.8.9 2007-02-23 04:43:48 +00:00
0bad3feabd Benoit Guillon patch for bug in Get FRU Activation Policy result 2007-02-22 23:38:04 +00:00
edb0ba9c6d Allow ipmitool/ipmievd to target specific device nodes on multi-BMC systems 2007-02-22 22:32:06 +00:00
c4a368edfb Fixing a few misspellings 2007-02-22 22:03:32 +00:00
b136863199 Fix for new prefix code causing segfault with ipmievd sel cmd 2007-02-22 21:48:26 +00:00
628c3ca854 freeipmi interface files 2007-02-22 18:17:46 +00:00
0a682dbedd add freeipmi interface support 2007-02-22 18:16:10 +00:00
b3dde472ce Fix breakage on FreeBSD caused by configure.in rev 1.64 2007-02-22 02:35:39 +00:00
22f0fc7c00 removed endianness check 2007-02-08 20:22:54 +00:00
6eaa2e8305 Added
ipmi_sel_get_oem_sensor_type
and
 ipmi_sel_get_oem_sensor_type_offset APIs

as well as get_kontron_evt_desc.
Added lookups in ipmi_get_event_desc for OEM defined sensor types.
Added oem_kontron_event_types definition
2007-02-07 21:14:54 +00:00
992b36bc0f fixed for big endian (PPC) architecture 2007-02-01 14:28:44 +00:00
6a68dc2e65 - Incremented to version 0.4
- Fixed lan iface inaccesiblity timeout handling. Waiting for firmware
    activation completion (fixed sleep) before re-opening a session and
    get the final firmware upgrade status.
  - Fixed some user interface stuff.
2007-01-17 19:38:18 +00:00
66958d8c52 fix ipmi_fru_edit_multirec return code 2007-01-17 16:05:28 +00:00
333dc5bedc added initial interactive edition support for multirec
added IANA verification before interpreting PICMG records
added edit support for AMC activation "Maximum Internal Current"
2007-01-17 16:04:12 +00:00
a62287c589 undefined ENABLE_OPENIPMI_V39_PATCH 2007-01-11 21:36:25 +00:00
43a529bff0 added new header dependancies 2007-01-11 21:28:55 +00:00
cf96efd47d added missing () for operator precedence bug 2007-01-11 21:17:46 +00:00
9cbe0938f1 Added initial AMC ekey query operation support 2007-01-11 21:15:12 +00:00
7acd1310ec avoid lprintf to control \n generation 2007-01-11 19:35:29 +00:00
77b47d3751 improvements to ekeying support (PICMG 3.x only)
- added getall/getgranted/getdenied support
 - changed cli arg parsing (avoid segfaults)
 - changet set portstate interface vs channel ordering
2007-01-11 18:47:53 +00:00
9a4979ac62 - Fix bug with bad handling of GetDeviceId answer when sol traffic occurs
(generating garbage on the screen)
---** Thanks to Jarrod B Johnson [jbj@vnet.ibm.com] for the patch **---
2007-01-11 18:40:10 +00:00
9e4bbc2e65 - Re-Enable Keep Alive function using GetDeviceId
(I re-enable this function since the bug in the keep alive has been addressed)
- Keep the usage of sol for keep alive when usesolforkeepalive is added after
the activate.
2007-01-11 18:36:25 +00:00
8fc8e1a69a added ENABLE_OPENIPMI_V39_PATCH (not enable by default)
updated to 0.3
2007-01-11 16:23:59 +00:00
18b6d4cc08 added TRUE and FALSE definitions 2007-01-11 15:33:31 +00:00
a74e7d396a changed hpmxxx keyword to hpm in main to access HPM.1 functionnality 2007-01-11 15:29:04 +00:00
88af9d3652 Added lan packet size reduction mechanism to workaround fact
that lan iface will not return C7 on excessive length
2007-01-11 15:25:53 +00:00
968e97d905 Adjusted packet length for AMC.0 specification retricting IPMB packets to
32 bytes
 Added lan packet size reduction mechanism to workaround fact
    that lan iface will not return C7 on excessive length
2007-01-11 15:01:39 +00:00
459770d58c now includes ipmi_cc.h for generic completion codes 2007-01-11 14:43:22 +00:00
c28da79cab Added generic completion codes to be used instead of hardcoded values 2007-01-11 14:42:51 +00:00
b548d3573b - Still in development
- Implementation now aligned with specification HPM.1 draft 0.9
- Tested with Kontron implementation
2006-12-01 16:36:54 +00:00
68afc1b001 Handle timeout completion code C3h in SaveFirmwareImage 2006-12-01 16:34:48 +00:00
c78911c730 -Add HPM.1 support
Based on specification (non-official) release version 0.74
Implemented and tested on Kontron ATCA blade
2006-11-17 20:27:16 +00:00
6ac87eed90 - Add HPM.1 support module 2006-11-17 20:24:15 +00:00
9f66ac2cd3 - Fix a bug with the keepalive functionallity. When keepAlive GetDeviceId is sent and SOL traffic is received in between the answer, the SOL packet is ignore or use as an answer.
- Change the keepalive function to send empty SOL packet instead of sending the getdeviceid command.
2006-11-14 16:08:55 +00:00
3bd95062ba Avoids printing invalid sensor reading when the reading actually fails 2006-11-06 20:45:00 +00:00
86a32205be Added ability to map OEM sensor types to OEM description string using
IANA number.
Moved IANA number table
2006-11-03 21:10:59 +00:00
583a5e7cd0 Added sensor type strings for IPMI v2.0 2006-11-03 19:44:51 +00:00
381783786a Added PICMG specific IDs in entity_id_vals 2006-11-03 19:35:07 +00:00
cea777a51d Added sdr_convert_sensor_hysterisis to avoid taking "B" into consideration 2006-11-03 19:04:15 +00:00
e3c97ddd3d Do not use readings for sensors with Sensor Scanning bit cleared 2006-10-25 03:21:57 +00:00
e7f7209c32 - Auto adjust packet size for SaveFirmwareImage
- Fix bug with sendMessage of bad length with different target (IOL, IPMB-0, IPMB-L, etc..)
2006-10-13 15:03:13 +00:00
5d21a9d8a8 - Fix bug with Function Get Channel Cipher Suites command when more than 1 page used. 2006-10-06 20:33:42 +00:00
74e028690b - Fix a bug with command ipmitool lan stats get 1.
Stats on channel 1 is always rejected while channel 1 can be lan.
command printconf and print is OK.
2006-10-06 17:47:10 +00:00
fda2c028fe fix formatting loss 2006-09-21 19:53:33 +00:00
19f9d13807 - Fix a bug with FWUM Get Info
- Output of DEBUG build was erronous.
- Mode byte change to a bitfield
2006-09-21 15:29:09 +00:00
9fcde40c97 - Fix lan set access command to use value already save within parameters for PEF and authentication
- This was causing problem to implementation where PEF alerting is not supported.
- Enable PEF was hard coded.
2006-09-21 14:03:42 +00:00
34b21d2d57 better detection of linux/compiler.h 2006-09-14 16:20:59 +00:00
9e14d37835 add nokeepalive option to sol activate 2006-09-13 00:01:55 +00:00
981a24365f add support for name+privilege lookup for lanplus sessions 2006-09-12 23:23:28 +00:00
729bf0e7c3 new chassis bootdev options 2006-09-11 17:07:00 +00:00
db4a2e5951 fix compile error 2006-09-11 16:20:56 +00:00
ef20239926 update comment regarding sol packet handling 2006-09-11 16:19:29 +00:00
e672819a9d fix unlock behavior to always do set-complete 2006-09-11 16:14:01 +00:00
f61c3acbaf fix sequence number incrementing on retry 2006-09-01 17:48:15 +00:00
eab4dfe679 fix display of auth enables 2006-09-01 17:47:50 +00:00
89199b49f3 fix ipmievd fd closing bug 2006-08-31 22:14:29 +00:00
96dec6ddc7 add set-in-progress flag support to chassis bootdev 2006-08-23 17:25:37 +00:00
153965aca2 missing header fix 2006-08-23 16:47:00 +00:00
4e79265a7c prefix hostname on sel ipmievd sessions 2006-08-18 22:31:19 +00:00
1c60cbf500 add sol payload enable/disable command 2006-08-18 20:09:33 +00:00
b82cfdf945 - fix SOL set errors when commit-write not supported
- fix reset of session timeout for lanplus interface
2006-08-11 17:57:15 +00:00
09a6e0e917 add firewall top-level command 2006-08-04 17:28:00 +00:00
760de11c71 debug output 2006-08-03 16:41:18 +00:00
50f36dd841 fix user priv bugs 2006-07-28 22:37:49 +00:00
0d6fecc737 There is a bug in ipmi_sdr.h which prevents ipmitool from correctly displaying
thresholds and threshold mask. The "Discrete reading mask/Settable threshold
mask, Readable threshold mask" field in SDR has two bytes (16 bits). The 16 bits
should be treated as one uint16_t instead of two bytes. Otherwise, if someone
sets the fields to 0x3f, it will be mistakenly interpreted as 0x3f00 instead of
0x003f.
2006-07-28 20:43:50 +00:00
ab58809b3b update version to 1.8.9 2006-07-28 20:18:58 +00:00
d572add750 fix SOLv2 NACK and retry handling for Intel ESB2 BMC 2006-07-28 20:17:25 +00:00
fa21266ec2 fix segfault when incorrect oem option supplied 2006-07-28 16:39:18 +00:00
f63189780f Don't display physical FRU devices; FRU API only works for logical devices 2006-07-24 17:12:32 +00:00
7849cc978f add 'get' to the help information 2006-07-22 03:23:40 +00:00
6013cec710 minor fixes 2006-07-14 22:36:50 +00:00
9f6133936d fix bus problem with spd command 2006-07-12 19:31:31 +00:00
580f416693 compile error 2006-07-12 19:25:43 +00:00
c99e8595e4 fix segfault in SOL when remote BMC does not return packet 2006-07-06 21:38:21 +00:00
a92765fbc9 fixes from netbsd 2006-06-28 22:16:32 +00:00
cc63758d53 patch from netbsd 2006-06-28 22:04:30 +00:00
388b9e058d misc cleanups 2006-06-28 21:21:34 +00:00
520aa05c07 fix segfault and channel problem with user priv command 2006-06-28 21:06:16 +00:00
533582e9e3 add remote spd printing 2006-06-28 20:58:08 +00:00
c3289bb6f4 Initial checkin. This file will describe SOL in ipmitool at a high level. 2006-06-20 21:33:53 +00:00
b3d2bb937d Cleaned up return codes for invalid arguments passed to sub-commands. 2006-06-20 19:48:53 +00:00
070f36d1ae __ipmi_sel_savelist_entries should return 0 instead of -1 if the SEL is
empty.  An empty SEL shouldn't be an error condition when listing the SEL.
2006-06-20 19:20:25 +00:00
882d9ce81c why does every version of gcc behave different? 2006-05-26 04:41:11 +00:00
d0e5434790 add support for bus/chan on i2c raw command 2006-05-26 04:35:16 +00:00
4ab522ab29 Fixed time_t conversion bug for 64-bit OS
.
2006-05-23 20:41:08 +00:00
ce3636894d use select() instead of alarm signal for receive timeout 2006-05-17 23:57:44 +00:00
83a924d7ed fix gcc4 compile warnings (again...) 2006-05-16 23:43:37 +00:00
28a7f2c14b fix compile warning 2006-05-16 23:09:34 +00:00
10154ba9ce fix compile warnings 2006-05-16 23:09:06 +00:00
12a6554416 fix formatting and compile warnings 2006-05-16 23:06:38 +00:00
78f8f0793f fix segfault that was reverted... 2006-05-16 22:28:19 +00:00
4433696ae4 fix tsol on big-endian 2006-05-12 15:37:45 +00:00
c9b2eb04f6 Implemented sdr_convert_sensor_tolerance
- uses y = L[Mx/2 * 10K2 ] formula as per IPMI spec
This function is now used instead of sdr_convert_sensor_reading when it
 comes to tolerance.
2006-05-12 14:07:31 +00:00
be79973194 remove fclose that happened before fopen 2006-05-03 22:05:24 +00:00
8e12bc0299 - Fix flag in StartFirmwareImage 2006-05-03 13:34:59 +00:00
b253fd5da3 - Remove write number of bytes in function SaveFirwwareImage
- Use this extra byte for payload transfer
2006-05-02 19:05:39 +00:00
811c894d78 added "--with-rpm-release" configure option to set the RPM release number
the distro tag, if supplied, is still part of the release value
2006-05-02 16:26:13 +00:00
65d1b0a623 ipmi_sdr.c: Fix ipmi_sdr_get_sensor_reading_ipmb() to keep track of device lun.
ipmi_sdr.c: Better error handling to avoid coredump when sensor description is missing.
ipmi_sensor.c: use new ipmi_sdr_get_sensor_reading_ipmb() interface
ipmi_sunoem.c: keep track of device lun
ipmi_sel.h: add "OEM Specific" device description
ipmi_sdr.h: modify ipmi_sdr_get_sensor_reading_ipmb() prototype
2006-05-01 23:57:01 +00:00
e667785bd3 update changelogs, prepare for 1.8.8 2006-05-01 23:33:33 +00:00
cf74129ba8 grr last time 2006-05-01 23:22:44 +00:00
3a30f4d0b8 intf -> eintf 2006-05-01 23:20:49 +00:00
ac40435a4a connect before fork to return error to initscript if needed 2006-05-01 23:15:38 +00:00
b800400c41 clear password if authtype NONE specified on command line 2006-05-01 22:33:21 +00:00
9132b30b6c fix cipher suite display bug 2006-05-01 22:28:45 +00:00
dd29a141ed add kontronoem header to package build 2006-05-01 22:23:53 +00:00
9f86c0601a fix typo in sol output when sending break 2006-04-27 18:08:30 +00:00
f7cfe44ce7 add missing MD2 authtype 2006-04-27 18:05:57 +00:00
1ad5d3d0b2 remove a few straggling nuclear clauses 2006-04-27 18:04:09 +00:00
9b4766a767 - Add lun consideration in ipmi_openipmi_send_cmd 2006-04-21 19:57:25 +00:00
a43c37e6ce - Add kontron oem file 2006-04-21 19:28:01 +00:00
ee044f0169 Remove static keyword to read_fru_area, write_fru_area, get_fru_area_str to be used in other files 2006-04-21 19:15:12 +00:00
a089b441f9 Upgrade to new protocol version
Faster Upgrade
2006-04-21 16:36:51 +00:00
adef82354e Fix compiling error 2006-04-21 16:34:30 +00:00
ee59c4d0f1 fix segfaults 2006-04-11 01:43:59 +00:00
9fd9b29cb5 clear ipmi_rq before using to remove garbage data like LUN. throttle keystroke errors unless verbose 2006-04-11 00:47:49 +00:00
35a7fad915 use find_lan_channel() for printing when no channel specified on command line 2006-04-11 00:47:10 +00:00
905892b5a7 ipmi_user.c: only allocated needed 3 bytes in ipmi_user_set_userpriv() 2006-03-28 17:01:16 +00:00
8fd02275a0 conditionally include config.h only if it is present 2006-03-28 16:56:56 +00:00
133cf86058 fix paths.h handling for solaris 2006-03-19 23:33:53 +00:00
7467b928c1 add missing header to dist, add default freebsd configure options 2006-03-19 23:22:25 +00:00
cfd5783232 update manpage 2006-03-19 23:10:40 +00:00
c44a3a85f6 update changelog 2006-03-19 23:08:23 +00:00
7e029dbb87 add initscripts for ipmievd 2006-03-19 23:06:56 +00:00
e3be943843 update debian files from maintainer 2006-03-19 23:01:48 +00:00
4b1ccbfdc3 cleanup sdr cache generation 2006-03-19 22:53:15 +00:00
e37e785449 make ipmievd write pidfile 2006-03-19 22:35:12 +00:00
66ffa994e9 better handling of termios header file 2006-03-19 21:20:42 +00:00
21fb127ce2 fix gcc4 + buildcheck compile problems 2006-03-19 21:15:06 +00:00
c65b206144 fix gcc4 compile warnings 2006-03-19 20:54:44 +00:00
a3d206523d make OEM SEL file a generic command line option 2006-03-19 20:04:20 +00:00
06ad21054f Add support for IPMIv2 Firmware Firewall 2006-03-19 19:08:50 +00:00
e2cc94d96b Add support for FreeBSD OpenIPMI-compatible driver 2006-03-19 18:40:48 +00:00
56c495455c Add support for setting VLAN id and priority 2006-03-19 18:37:16 +00:00
64af2f2bdb Display message and exit if keepalive fails during SOL 2006-03-19 18:29:07 +00:00
d80fa31411 Support IPMIv2 SOL on older Intel boxes 2006-03-19 18:24:37 +00:00
271c681609 disable file paranoia checks on read files by default 2006-03-19 18:22:39 +00:00
fa8c8116e1 Add support for IBM OEM SEL messages 2006-03-19 18:05:20 +00:00
5532b6856e Add IPMIv2 SOL loopback test 2006-03-19 18:01:56 +00:00
58ea8803f9 remove nuclear clause from license 2006-03-19 17:59:39 +00:00
99070e730e increase argument size for shell/exec for raw commands 2006-03-19 17:44:40 +00:00
115df86f23 implement sbled command for sun blades 2006-03-10 19:30:44 +00:00
a94f0e612c check that intf->open(intf) is successful before proceeding
add additional debug messages
2006-03-01 21:25:24 +00:00
e21475c78d attempt to fix bridged commands over lan interfaces 2006-01-26 21:38:11 +00:00
6f3e247274 add 'sensor reading' command 2006-01-26 21:37:23 +00:00
b8d9ada302 fix retry handling for SOL 2006-01-17 18:13:41 +00:00
29dbaf6882 update to version 1.8.6 2006-01-17 17:51:21 +00:00
f367905bef fix Unknown display for val2str() 2006-01-17 17:30:29 +00:00
66cb3143dc send periodic keepalive packet when SOL is active to keep session open 2006-01-17 17:25:23 +00:00
79befbb112 set payload length for outbound sol packets to prevent memory corruption in openssl during SOL 2006-01-17 17:24:42 +00:00
185b762fa9 use \r\n for log output during raw mode 2006-01-17 17:24:06 +00:00
5d7197d467 update changelog 2006-01-15 21:56:48 +00:00
b0498d93cf fix date in changelog 2006-01-15 21:33:14 +00:00
9f49913c2f change copyright tag to license 2006-01-15 21:32:28 +00:00
73d088de1f remove CYGWIN defines for older cygwin support 2006-01-15 21:21:49 +00:00
d4a64e17f2 update version 2006-01-15 20:46:13 +00:00
e855ba03df update email address to remove sun.com 2006-01-15 20:46:00 +00:00
68cdacb211 update changelog 2006-01-15 20:39:26 +00:00
85643e52a2 byteswap port 2006-01-15 20:25:23 +00:00
776080c88a update manpage with new arguments and tsol command 2006-01-15 20:21:30 +00:00
f0cd89fea6 add missing define 2006-01-15 19:14:04 +00:00
d6e85b8427 updates from sourceforge,
changes to support settable SOL escape char
2006-01-15 06:41:08 +00:00
ed8a467f6d update tyan sol to behave like ipmiv2 sol client 2006-01-15 06:40:37 +00:00
715add8fef fix iana for supermicro, add for tyan 2006-01-14 18:43:43 +00:00
da9252ceba add supermicro oem type 2006-01-13 18:25:10 +00:00
ae1fe95cb1 Cleared set_access structure; contained garbage data 2005-12-09 19:57:48 +00:00
f42f7c701c Add support for bridged message over different channel
Ex.: In an ATCA environment, send a message through the LAN iface
to another blade present in the chassis or to an AMC bay.
Tested:
Lan.c with Kontron AT8001 with Intel CMM shelf manager
Lan.c with Kontron AT8001 with Kontron AMC's
Lanplus.c with Kontron AT8001 with Intel CMM shelf manager
Lanplus.c with Kontron AT8001 with Kontron AMC's
2005-11-28 18:45:37 +00:00
29f43931e4 * Change maximum channel size for 0x0e (current channel) 2005-11-24 16:08:51 +00:00
2ea87e639b * Add command to get and clear UDP/RMCP/IP Statistics 2005-11-24 16:04:37 +00:00
8ec87a396e * Add priv commands to set user privileges 2005-11-23 21:59:23 +00:00
cd7e75a9d5 * Fix req_seq issue with RMCP+ 2005-11-23 21:45:37 +00:00
738cf02694 On all IPMI commands, the structure ipmi_rq must be cleared (memset(&req, 0, sizeof(req)).
This was not done for the 4 commands sent.  This was causing some commands
sent to the KCS interface to have an invalid LUN.
2005-10-28 14:10:48 +00:00
f7519e00eb revert 6-bit ascii size computation 2005-09-29 18:40:04 +00:00
c546582e92 new command for Add SEL Entry on event list from file 2005-09-23 20:08:51 +00:00
22c7f92135 add event direction to output 2005-09-23 20:07:50 +00:00
f449928806 don't print builtin fru header twice 2005-09-09 23:27:11 +00:00
8a0559a651 add top-level "power" command as shortcut to chassis power commands 2005-09-09 23:19:41 +00:00
6cb97e4327 6-bit packed ascii size computation was not correctly handling strings that are not 3-byte aligned 2005-09-09 23:17:55 +00:00
a15d6a31ac - Fix a bug where the retry-count parameters was 'anded' with 0x03 instead of 0x07
See IPMI specification 2.0 rev 1.0 markup june 2004 table 26-5 parameters 4
2005-09-09 17:09:50 +00:00
77275ab616 sel version output is 4-bit bcd in a single byte 2005-09-06 22:43:10 +00:00
32c94e3eae update version to 1.8.4 2005-09-06 22:02:03 +00:00
36e388648d add 'echo' command for use in ipmi scripts 2005-09-06 22:00:45 +00:00
aac4cc9e05 remove constraint on table size, a size of 0 can actually mean just entry 0 is populated 2005-09-06 18:37:38 +00:00
c552839583 forgot to add config.h 2005-09-02 18:12:04 +00:00
9dd625a215 don't print access info for non-lan channels 2005-09-02 17:57:05 +00:00
f50160a9e4 fix portability issues 2005-09-02 17:56:27 +00:00
67a60f1c9d Adjust sel info output 2005-09-01 20:57:09 +00:00
7eeae98fb4 optimize sign extension 2005-08-27 02:26:32 +00:00
ae92538cbb fix formatting issues 2005-08-26 23:00:56 +00:00
558f279597 manufacturer id is lsb first on oem sel records 2005-08-23 20:55:09 +00:00
4e9fb18ef6 eliminate extra noise 2005-08-23 20:51:53 +00:00
dc7c60b7a8 fix segfault when BMC does not support locking 2005-08-23 20:50:15 +00:00
38d0926d9f add Tyan IPMIv1.5 SOL code, contributed by Tyan Computer Corp
it may need some work to fine tune the behavior on actual
hardware but this is the initial raw code contribution.
2005-08-23 19:09:25 +00:00
661a80433e let event specific pef policies continue to print info 2005-08-23 19:05:43 +00:00
a4c5e7bda0 revert email address change that was made 2005-08-23 19:05:14 +00:00
cf40042856 update a few strings 2005-08-23 19:03:24 +00:00
92876549ab add support for enabling/disabling lan alerting for channel; default to enabled 2005-08-23 19:02:50 +00:00
141721d220 increase timeout and limit retries to 1 for raw commands 2005-08-23 19:01:35 +00:00
1e0164c253 allow 'sel time set now' to set sel time to current client time 2005-08-23 18:59:43 +00:00
ecb214d423 add support for configuring lan alerting 2005-08-23 17:59:09 +00:00
1196369aaf let entity id be specified as string 2005-08-22 16:32:24 +00:00
bfe06ebd98 extra argument to function removed 2005-08-22 16:31:31 +00:00
58e4e355f8 fix segfault when raw command returns error 2005-08-18 23:54:27 +00:00
9d762b82a0 Recognize and decipher OEM SEL entries properly 2005-08-17 20:34:21 +00:00
9ad01e6eed fix a few gcc4 compile warnings, lots remaining... 2005-08-11 16:20:36 +00:00
53c97bc5b4 not closing session after chassis power control can be bad for session management on the bmc 2005-08-11 16:18:22 +00:00
6ab2eb972e gcc4 is very picky about signedness and event_type is only 7 bits. not sure if this is gcc bug or not. 2005-08-11 16:10:51 +00:00
e25e0b8e71 Update write_fru_area Api so both upgEkey and fru write works properly
also added some comments. And change some printf to lprintf
 - added soffset(source offset) and doffset(destination) parameters to write_fru_area
2005-07-26 14:40:23 +00:00
cfd7f610cb rename define to be more correct 2005-07-14 23:51:52 +00:00
f9d19aa0c5 fix typo and simplify string 2005-07-14 23:44:33 +00:00
6a90734a67 add sun id 2005-07-14 23:40:25 +00:00
2440c09d50 update sensor type code table 2005-07-14 23:06:45 +00:00
1f597a78e2 prevent segfault on bad SEL data 2005-07-14 21:47:20 +00:00
f4dd419fe6 -Modified read length to fit bridge message (mostly for AMC) 2005-07-14 15:56:04 +00:00
b3472220af make this function a macro 2005-07-14 00:21:26 +00:00
54d6016a31 why was this using pow? 2005-07-13 18:37:30 +00:00
864ac5ad26 Added conditionaly built GetDeviceLocator call when INCLUDE_PICMG_GET_DEVICE_LOCATOR
is defined. It doesn't allow for bridged send messages to reach AMC yet.
2005-07-12 14:49:12 +00:00
17d68a4289 Added Kontron fwum header 2005-07-12 14:47:06 +00:00
907d8b30f5 Added Kontron OEM firmware update commands 2005-07-12 14:43:56 +00:00
c2d9746775 Added Manufacturer name strings to mc info 2005-07-12 14:27:36 +00:00
51a92c0917 Corrected typo 2005-07-12 13:38:51 +00:00
07f4139e70 added selftest support 2005-07-12 13:19:03 +00:00
6514de2b13 added read/write support and PICMG ekey support 2005-07-12 13:15:02 +00:00
89f6d591e0 added GetSelfTestResult defines 2005-07-12 13:13:47 +00:00
f9f0599908 added PICMG netfn\n ran lindent 2005-07-12 13:09:33 +00:00
c792f6e7e1 added SEL event definition for PICMG events 2005-07-12 12:42:02 +00:00
bce51c05f8 Added picmg fru data types 2005-07-12 12:37:23 +00:00
e0912fc6b7 Added initial PICMG command support 2005-07-12 12:36:47 +00:00
2c117c95ea added initial PICMG support
- added command support
 - added PICMG FRU data support
2005-07-12 12:36:00 +00:00
e7140ed0c8 added support for alternate devfs node location 2005-07-12 12:28:09 +00:00
6049aa0fe4 added support for channel and lun command line arguments 2005-07-12 12:25:29 +00:00
96876bb061 added support for built-in sdrs 2005-07-12 12:21:13 +00:00
4d2f9ebdc2 email address for Jon has changed 2005-07-11 20:14:00 +00:00
54dfc91b2b Extended the string list for Entity IDs, per the 2.0 spec's table 43-13. 2005-07-05 16:12:13 +00:00
86d54446e9 fix for freebsd 2005-06-28 21:14:51 +00:00
a7bcb2422e make rhel build i386 arch rpms on opteron when using 'make rpm' 2005-06-28 20:28:40 +00:00
4067bafa57 Added some support for the interpretation of OEM event messages (type 2 SEL
entries with with an event type in the OEM range).  For Newisys OEM SEL
entries, textual message descriptions are retrieved through a Newisys IPMI
OEM command.
include/ipmitool/ipmi_sel.h lib/ipmi_sel.c src/ipmievd.c CVS:
----------------------------------------------------------------------
2005-06-28 20:19:08 +00:00
624392f798 add check for tgetent to fix readline problems on RHEL4 2005-06-28 18:53:37 +00:00
ac2cc29ac0 remove / from string 2005-06-27 22:45:14 +00:00
87540ecf2a don't spin while waiting for 0 bytes in case BMC lies about how much data is in a FRU 2005-06-27 22:23:34 +00:00
6d77f698f2 allow SOL port to be sent in network byte order since some BMCs do this 2005-06-27 22:15:05 +00:00
083e6afc46 fix doc bug 2005-06-27 22:07:04 +00:00
384f9219ba move selftest results to its own command 2005-06-27 22:01:54 +00:00
fef402714f print binary data for i2c transactions 2005-06-25 17:33:35 +00:00
312b564091 A clarification (E347) in the IPMI v2 errata document (mark II) makes it
pretty clear that listing algorithms by cipher suite does not list all
algorithms, but lists supported algothms *grouped* by cipher suite.  Since
both views contain the same information, we will just support one in
ipmitool -- supported algorithms listed by cipher suite view.
2005-06-22 22:12:59 +00:00
a85bd201df work around readline 4.2 bug 2005-06-17 23:14:44 +00:00
e633524d34 fix freebsd compile problem 2005-06-17 23:12:53 +00:00
a892bb499a add configure option for specifying a distro tag for "make rpm" builds 2005-06-16 23:56:32 +00:00
836149f966 update changelog 2005-06-16 23:54:01 +00:00
694f92918f add support for entering netfn as a string for raw commands 2005-06-16 23:48:58 +00:00
1fe48e8a36 fix sdr printing of deassertion events and negative values for min/max 2005-06-16 23:47:15 +00:00
380f330e15 handle 0xcc response without error 2005-06-16 23:46:26 +00:00
fe38fb4e7b fix potential crash in cleanup code 2005-06-16 16:58:11 +00:00
ffd03bc964 two changes:
1. the IPMI spec says sessions are opened at USER level and must
be increased to desired privilege level.  This was not happening
for lanplus connections and causing problems with an OSA stack.

2. the 5ms delay between retries was not happening for SOL packets,
this is causing problems with a different implementation...
2005-06-16 16:53:01 +00:00
f9e30a894c typo 2005-06-16 16:50:28 +00:00
f733bcf2f1 decode cpu/dimm handling in sel if possible 2005-06-15 19:26:55 +00:00
51e906b7c6 Uploaded debian package into the Debian archive. 2005-06-05 09:01:32 +00:00
70cc60d8a4 add self-test results to chassis status output 2005-06-02 22:03:18 +00:00
c2c1204cb1 enable sdrcache on solaris 2005-06-02 22:02:41 +00:00
f87420b587 don't return error when user not supported 2005-06-02 22:01:36 +00:00
33cad9b907 In Get SEL Info, if the BMC returns a date of 0x00000000 of 0xffffffff,
print "Not available" instead of attempting to interpret the date.
2005-05-23 19:07:17 +00:00
b42902f880 Added the readraw and writeraw subcommands. These will allow the user
to save and view binary versions of the SEL.  The readraw subcommand is
being added to aid the Newisys troubleshooting facility, and the writeraw
subcommand is being added for parity.
2005-05-23 18:31:53 +00:00
8e77031a97 Added documentation for the readraw/writeraw subcommands. 2005-05-19 20:55:54 +00:00
b7962d85dc forgot one patch from sourceforge 2005-05-19 01:39:59 +00:00
36fefdabc3 update changelogs for 1.8.2 release 2005-05-18 23:51:18 +00:00
0ad17ece4a minor manpage update 2005-05-18 21:27:04 +00:00
990a9a4b6b fix display of binary encoded fru data 2005-05-18 07:14:15 +00:00
df7d0e6ee6 when caching sdrs from file leave room for trailing null to end description string 2005-05-17 22:55:25 +00:00
0f3c980b49 clear sensor desc before copying 2005-05-17 22:28:36 +00:00
8cfb4c0897 add helper define for max string length, allow default commands to receive options 2005-05-17 21:05:21 +00:00
650f12ab23 *** empty log message *** 2005-05-17 03:41:44 +00:00
fb0cc0187c don't print some event status fields 2005-05-16 23:59:39 +00:00
723b7c0614 export functions for use 2005-05-16 23:59:23 +00:00
bac5e21634 fix csv handling for 'sel elist' command 2005-05-15 17:47:13 +00:00
2ef302401e fix compile warnings with -Wall 2005-05-15 17:42:21 +00:00
cd174d8e73 don't stop looking when sensor is not found 2005-05-15 17:40:20 +00:00
718232945c add csv output support 2005-05-15 17:39:25 +00:00
fa3bb0960b broke fru lookups for 'sel get' command 2005-05-15 06:23:50 +00:00
b8a2890ace update manpage with new command help 2005-05-15 06:18:01 +00:00
5a7385f780 clean up output 2005-05-15 06:12:41 +00:00
9708c8326f add support for generating events based on sensor information 2005-05-15 05:59:36 +00:00
b1cf8c6a2b export function for other use 2005-05-15 05:57:35 +00:00
3af858eecf add 'sdr get' command, add hysteresis to sdr verbose output 2005-05-15 05:56:44 +00:00
f04b6d858f clean up output and shorten blink names 2005-05-15 05:55:09 +00:00
12c19f88ca add structure for PEMs 2005-05-15 04:53:39 +00:00
4385f3c403 *** empty log message *** 2005-05-15 04:52:18 +00:00
f598c42e2e fix str2val() 2005-05-15 04:51:02 +00:00
a567ac9426 fix handling of quotes in shell 2005-05-15 04:50:34 +00:00
2d0c486541 make sdr elist reporting consistent 2005-05-14 04:17:56 +00:00
1a4399a9eb conditional compile of ipmievd can go away 2005-05-14 03:37:29 +00:00
58c0fa890b minor fix for generic sdr display 2005-05-13 23:59:07 +00:00
06147e6a37 warm reset does not necessarily mean lost session 2005-05-13 17:09:27 +00:00
d559b1fa2d add man text for sel save command 2005-05-12 04:53:33 +00:00
bd30ca98db update manpages with help text for new commands 2005-05-12 04:47:51 +00:00
e5a6d23f9c clean up event messages 2005-05-12 04:24:16 +00:00
81aa0855f8 add -S option 2005-05-12 04:23:37 +00:00
281777996b add extended sel list functionality, ability to save SEL to a file 2005-05-12 04:23:07 +00:00
57c49ef9b8 lots of changes to SDR handling 2005-05-12 04:14:26 +00:00
adb40e53a1 add oem commands 2005-05-12 04:13:32 +00:00
db3da49158 break down GUID format 2005-05-12 04:12:40 +00:00
6f9b34313e fix invalid function prototyes 2005-05-11 05:56:47 +00:00
081baa7e24 print PEF actions 2005-05-11 05:55:20 +00:00
bbaf882dd1 add icts oem option 2005-05-11 05:55:05 +00:00
9e4ad72524 fix function prototype 2005-05-11 05:50:13 +00:00
ea0e9ca5fd add __max define 2005-05-11 05:49:41 +00:00
ace510828f add --enable-solaris-opt configure option to enable all command line options on solaris 2005-05-11 05:48:45 +00:00
6cc2c67671 add support for passing cmos clear bit to BIOS 2005-05-11 05:47:53 +00:00
d5d36e1941 add chassis power control vals 2005-05-11 05:46:40 +00:00
b65ec95257 remove unused variables 2005-05-11 05:45:17 +00:00
6b8d9243c2 add missing include 2005-05-11 05:44:53 +00:00
5c2cd09f6a fix function prototypes 2005-05-11 05:44:41 +00:00
e34c7eeb5c uninitialized variable 2005-05-11 05:44:23 +00:00
eb8653f02a add icts oem option, make bmc_rand not print with verbose mode 2005-05-11 04:42:51 +00:00
24a0b44a98 add noanswer flag to open interface 2005-05-11 04:42:06 +00:00
d69b8e8b7f fix typo in manpage 2005-05-03 15:54:47 +00:00
8b68086fdb change IPMI_CHANNEL_MEDIUM_IPMB define to not conflict with openipmi 2005-05-03 15:19:15 +00:00
35c6bb4a9d update manpages 2005-04-29 22:00:35 +00:00
928c500484 * New upstream release.
-  Fix FRU reading for large (>255 bytes) areas.
     -  Overhaul to ipmievd to support SEL polling in addition to OpenIPMI.
     -  Fix LAN parameter segfault when no Ciphers supported by
        BMC. (Closes: #306806)
     -  Fix IPMIv2 support on Intel v2 BMCs (use -o intelplus).
     -  Separate option parsing code from main ipmitool source file.
     -  Add raw I2C support with IPMI Master Read-Write command.
   * Correct the upstream URL in debian/changelog to the current one.
   * Suggest package openipmi. (Closes: #305629)
   * Add debian/watch file to detect new source versions.
2005-04-28 20:51:59 +00:00
2da00b9a47 * New upstream release.
-  Fix FRU reading for large (>255 bytes) areas.
     -  Overhaul to ipmievd to support SEL polling in addition to OpenIPMI.
     -  Fix LAN parameter segfault when no Ciphers supported by
        BMC. (Closes: #306806)
     -  Fix IPMIv2 support on Intel v2 BMCs (use -o intelplus).
     -  Separate option parsing code from main ipmitool source file.
     -  Add raw I2C support with IPMI Master Read-Write command.
   * Correct the upstream URL in debian/changelog to the current one.
   * Suggest package openipmi. (Closes: #305629)
2005-04-28 20:45:28 +00:00
04802db0e0 Correct the upstream URL in debian/changelog to the current one. 2005-04-28 20:43:53 +00:00
85d612fa35 command list missing from shell help 2005-04-28 15:58:46 +00:00
1340786bda fix handling of sel when it is cleared 2005-04-27 22:39:15 +00:00
30eec7d0ac only decode sensor-specific states 2005-04-22 19:53:27 +00:00
5298b1ca71 fix memory leaks, optimize payload allocator to only allocate what is needed instead of max amount 2005-04-22 19:52:01 +00:00
a292d94239 fix handling of sensors that are read correctly 2005-04-22 05:07:17 +00:00
26557547b4 typos 2005-04-21 04:21:50 +00:00
2c2437239d fix chassis power status exit code 2005-04-21 04:13:55 +00:00
7b3fac2071 fix chassis power status command 2005-04-21 03:30:55 +00:00
763abe4889 add sys/poll header for internal openipmi compiles 2005-04-21 01:13:01 +00:00
2a574a3e8b update changelogs for release,
add readme for debian packages that points to howto by Tim Small
2005-04-21 00:08:15 +00:00
f108b55d13 don't display open command for ipmievd when not available 2005-04-20 23:38:16 +00:00
13659fb466 add ipmievd to solaris packages 2005-04-20 23:27:49 +00:00
412798482c fix segfault from stupid error 2005-04-20 23:10:30 +00:00
90448837ec add ability to configure session retry and timeout settings,
add chassis power status command with return value indicating status
2005-04-20 23:04:00 +00:00
fecfc09c8b update version to 1.8.2, ipmievd can now build and work on non-linux systems 2005-04-20 22:49:25 +00:00
820d9e6bb3 massive overhaul to ipmievd to support both openipmi event message buffer and manual SEL polling 2005-04-20 22:48:49 +00:00
251de396a1 ipmi_intf_print takes argument listing supported interfaces 2005-04-20 22:46:52 +00:00
774c74a64c fix fru decoding for large areas, was overflowing 8bit counter 2005-04-20 22:42:11 +00:00
c7c5b2de37 add daemonize function to helper library 2005-04-20 22:40:53 +00:00
762f6fff1c ipmi_intf_print takes optional list of 'supported' interfaces to display 2005-04-20 21:43:02 +00:00
4ea12d4308 add ipmi_main.[ch] to the build system 2005-04-20 21:41:58 +00:00
ce01d13e98 move option parsing and command handling to its own file for reuse 2005-04-20 21:05:45 +00:00
1c4f38bba8 add rawi2c master read/write command 2005-04-20 21:03:33 +00:00
b2c96c3a1f add noanswer flag, and ipmi_cmd structures 2005-04-20 20:52:30 +00:00
4c99a6f676 intelplus mode does not try for highest priv based on algorithms 2005-04-20 20:48:47 +00:00
78049bf3b7 add system firwmware sensor-specific bits, add function to get sensor type based on event code and offset 2005-04-20 20:47:05 +00:00
6052a2b57a add sdr_cache function, fix Get SDR Header to handle cancelled reservation 2005-04-20 20:44:59 +00:00
392454c646 handle parameter out of range error without returning error code, fix segfault when no cipher suites defined 2005-04-20 20:36:01 +00:00
805835ca69 Properly close a session if our set session priv level command failed.
By this time we have activated successfully.
2005-04-08 21:37:33 +00:00
c86c21e734 Added missing val2str(rsp->ccode, completion_code_vals) for format argument. 2005-04-08 19:19:04 +00:00
897b3c5a46 Changelog for 1.8.1-1 debian release. 2005-04-06 23:19:46 +00:00
4e93bf01ed missing checkin seems to have disappeared: up to 1.8.1 2005-04-06 22:44:01 +00:00
9573ee3eed add linux/compile.h for 2.6 compiles 2005-04-06 20:51:02 +00:00
ef4e6f3dad ipmievd installs in /usr/sbin 2005-04-06 20:33:29 +00:00
3d30271e73 prefix with dist_ so they get included with make dist 2005-04-04 22:13:48 +00:00
c39a8026da avoid possible redefine 2005-04-04 01:15:20 +00:00
20a4a2f950 updates to debian builds from Petter Reinholdtsen 2005-04-04 01:09:50 +00:00
55ac08dc49 always remove old device file in case we get new dynamic major assigned from kernel 2005-04-03 22:45:56 +00:00
3fa867b222 swap order of readline/curses linking to fix static compile 2005-03-31 17:49:16 +00:00
8169fc6b3f intf_lan -> lan 2005-03-31 17:42:11 +00:00
505ec7615d don't enable bmc driver on sparc 2005-03-25 23:12:10 +00:00
116c7a7cf9 fix segfault when no entity passed 2005-03-25 16:58:54 +00:00
5c1661707c add patch to allow sel list qualifiers 2005-03-24 19:23:08 +00:00
c105728a9a add rpath for solaris, add darwin config block 2005-03-24 19:10:36 +00:00
08e8e99fe2 remove unused argument from usage text 2005-03-24 18:32:33 +00:00
596ef14553 add usage text for entity and dump commands 2005-03-24 18:31:03 +00:00
0d3daba614 undefine BSWAP_16 and BSWAP_32 so no warnings in case we redefine later 2005-03-24 17:30:59 +00:00
b42a8d7d6f typo alogrithms->algorithms 2005-03-24 01:46:03 +00:00
75ae0675c2 fix error message when de-activating SOL fails 2005-03-24 01:44:26 +00:00
a427845e41 dont print error for missing parameters 2005-03-24 01:39:01 +00:00
d2364e50b2 fix error message display 2005-03-24 01:34:25 +00:00
e05098f802 fix option parsing on isol command 2005-03-24 01:33:37 +00:00
d7e971d92f fix compile error with gcc4 2005-03-21 09:33:52 +00:00
4e59621e64 use double instead of float because its more portable 2005-03-18 00:43:05 +00:00
3da7fea17f solaris 9 doesn't have sqrtf 2005-03-18 00:36:20 +00:00
9c476f36aa bmc interface changes I missed 2005-03-17 23:02:40 +00:00
c575d4b028 update changelog 2005-03-17 18:45:02 +00:00
775f349d04 list bootdev in help instead of bootparam 2005-03-17 17:03:04 +00:00
69c50e3d73 clearer description 2005-03-17 05:00:32 +00:00
e9c27522c0 resurrect wv2 oemtype 2005-03-17 04:59:02 +00:00
14042e4021 sometimes still get valid read when scanning is disabled 2005-03-17 04:39:51 +00:00
47e42d3f32 fix compile errors when -Wall is specified 2005-03-17 03:28:53 +00:00
344cd68cc1 add get guid cmd define 2005-03-17 02:55:41 +00:00
8974794475 fix sel print error 2005-03-17 00:12:32 +00:00
3a96ee3272 update bmc driver for solaris 2005-03-17 00:12:08 +00:00
1fbd130b9b update changelogs 2005-03-17 00:11:13 +00:00
d2bee0687a ressurect isol command 2005-03-17 00:03:14 +00:00
34474dcb2a add linear sensor support 2005-03-16 23:54:12 +00:00
e7f78a54f9 set version 1.8.0 2005-03-16 23:52:12 +00:00
2c87bfc701 fix typos 2005-03-16 23:51:29 +00:00
d4b64f4277 add option to get mc guid 2005-03-16 23:21:22 +00:00
9caeb52ec1 support fru list as well as fru print 2005-03-16 23:20:55 +00:00
b27e296399 fix setting of chassis boot parameters 2005-03-16 23:20:37 +00:00
f29c7e699c support 16bit payload lengths with ipmiv2 2005-03-16 23:17:37 +00:00
04561e2433 fix handling of names with spaces in exec/shell 2005-03-16 23:13:57 +00:00
6d1f8521e6 Removed calls to ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN)
in the sub-commands.  We are ADMIN by default.
2005-03-09 20:29:35 +00:00
90e2c17543 From Holger Liebig. Many changes, primarily to support Intel's v2
capable BMC.  Also includes many general fixes.  Thank you Holger.
2005-03-09 17:16:14 +00:00
1df7ca9588 From Holger Liebig, define IPMI_PAYLOAD_TYPE_OEM 2005-03-09 17:13:35 +00:00
6dae08746d From Holger Liebig. Add support for Intel RMCP+ capabable BMC. 2005-03-09 17:12:44 +00:00
413078f80b Don't use fake random numbers ;-) 2005-03-09 17:11:09 +00:00
e2cd941c34 Allow setting of RMCP+ messaging cipher suite privilege levels 2005-03-08 20:11:48 +00:00
ca85cb4688 Added IPMI_SESSION_PRIV_UNSPECIFIED for the RMCP+ cipher suite priv code 2005-03-08 20:06:29 +00:00
e067d97a41 Now printing "RMCP+ Cipher Suites" and "Cipher Suite Priv Max" data. 2005-03-07 16:35:28 +00:00
ac3e23b9b9 Extended LAN Configuration Parameteres to include RMCP+ related parameters
new to the v2 spec.
2005-03-07 16:34:01 +00:00
a60b6acce1 Usage statement change "authentication" ==> "auth" in order to keep
column width < 80 characters.
2005-03-07 14:00:56 +00:00
daf5180838 Contribution by Holger Liebig. Better error handling, graceful handling
of unsupported options and human readable error output.
2005-03-04 21:39:50 +00:00
3979342536 Disable block padding in OpenSSL encryption/decryption 2005-03-03 20:02:51 +00:00
a12c0c31bb The session ID and sequence numbers should be set to 0 in pre-session. 2005-02-25 20:05:31 +00:00
7094b4f838 Correct comment in return code description for lanplus_rakp4_matches 2005-02-23 20:54:06 +00:00
f0b24c9a0e remove inaccurate assert. 2005-02-23 16:29:55 +00:00
674eb706a3 Fix bug in argument processing for sol channel 2005-02-17 22:35:52 +00:00
fe4f77cfdd Corrected misspelling Parial ==> Partial 2005-02-17 22:27:43 +00:00
cd5ee61d23 Added implementation for "channel getciphers" which implements the
command Get Channel Cipher Suites.
2005-02-17 22:26:08 +00:00
f7dc0a57de Move algorithm ID definitions into the higher level ipmi_constants.h file 2005-02-17 22:24:38 +00:00
c6db0382e5 move some strings (for algorithm descriptions) into a the higher level
ipmi_strings.[c|h] file.
2005-02-17 22:22:40 +00:00
761ce85d28 include the numeric error code if it's available. 2005-02-16 22:33:02 +00:00
3d29ed01a5 Fix 2 minor bugs in output. 1) if a field didn't exist, we weren't
updating our offset.  This caused subsequent fields to not be displayed.
2) Add missing field "Board Mfg".  I think this was just an oversight
during a rewrite.
2005-02-16 20:12:06 +00:00
bc17282c3a Per request from fujitsu-siemens, don't pad username in RAKP1 message 2005-02-10 17:15:48 +00:00
247ad8f661 Corrected size of RAKP1 messages (43 ==> 44) 2005-02-10 17:14:54 +00:00
5679de9984 Added some debugging output 2005-02-09 19:30:33 +00:00
15ed988689 User cipher suite as specified by the user (with -C). We now support
integrity and encryption algorithms of NONE.  Also fixed where we were
using the auth algorithm in places where the integrity albums was supposed
to be used.
2005-02-09 19:29:19 +00:00
34ddf53870 Added the -C option so that a user can specify a cipher suite ID. This
cipher suite ID indicates which authentication, integrity and
encryption algorithms should be used form IPMIv2 RMCP+ (lanplus) sessions.
2005-02-09 19:26:45 +00:00
42e73b39de Added ability to store and set the requested cipher suite ID
and its alogorithm specifiers.
2005-02-09 19:24:08 +00:00
aca415c287 fix rmcp ping/pong handling for network-byte-order 2005-02-09 17:42:13 +00:00
c4699aba9c A one-off error was preventing a output of the last user. This was caught
by Anthony Yeung at Newisys.
2005-02-08 19:15:37 +00:00
be2c0c4b03 Set rsp->data_len to 0 if there is not response data. 2005-02-04 18:46:15 +00:00
0d72cd27cc Increase the data buffer size of raw packet data. Also avoid buffer
overflows with this data.
2005-02-02 20:47:11 +00:00
e4ba0c3de3 fix sel list return code 2005-02-02 17:28:03 +00:00
96bd14b905 fix authtype setting parameters 2005-02-01 16:28:32 +00:00
8a2a11c520 checking invalid return code for feof 2005-02-01 00:14:37 +00:00
9164d3b69e incorrect bigendian define was messing up fru locator records 2005-02-01 00:13:34 +00:00
80a9f3acb2 return success on poh command 2005-02-01 00:08:04 +00:00
94f272e8e2 don't dump packets unless verbose is given twice 2005-02-01 00:07:19 +00:00
682caca7ea converted some spaces into tabs for consistency 2005-01-28 15:47:14 +00:00
d6274af150 Added text indicating whether threshold crossings are assertion or
deassertion events.  This fix is submitted for Wes Bemont at Newisys.
2005-01-28 15:45:39 +00:00
1d7e045d47 don't return failure code on timeouts 2005-01-27 17:41:48 +00:00
8dd12afdad explicit return value when printing analog sensors 2005-01-27 17:39:30 +00:00
174b13e835 set logpriv to null on log_halt 2005-01-21 23:10:57 +00:00
ff89a0e2f2 fix debug output formatting 2005-01-21 16:07:06 +00:00
9dbab242bd fix segfault when setting auth levels 2005-01-21 16:06:03 +00:00
658b502e64 trim extra bytes from data 2005-01-21 16:04:34 +00:00
b8d8587b2a exit status 0 when printing usage help. add bmc command aliased to mc command 2005-01-19 17:25:25 +00:00
445025f2f4 stop printing lan parameters if one returns an error other than 0x80 2005-01-18 17:01:00 +00:00
55ee755de8 cygwin needs inet_aton 2005-01-18 16:49:43 +00:00
e9281ea912 set specific options for building under cygwin 2005-01-12 21:14:55 +00:00
58ef4f8af6 move enum flg_e enum define to header file and make sure ipmi_pef_print_flags() prototype is correct 2005-01-12 21:13:25 +00:00
2e5d0c2921 cygwin does not have inet_ntop() function so do manual print of ip addresses on windows 2005-01-12 21:12:19 +00:00
79421577cc change input type to uint32_t instead of int 2005-01-12 21:11:12 +00:00
651466fc41 use inet_aton instead of inet_pton for compatibility 2005-01-12 21:08:56 +00:00
072986b669 fix compiler warnings related to types, use inet_aton instead of inet_pton for compatibility 2005-01-12 21:05:42 +00:00
ada87b8255 send lprintf messages to stderr 2005-01-11 21:36:37 +00:00
81d5b08b3d send warning to stderr 2005-01-11 21:36:22 +00:00
08844ec93b add function comments 2005-01-11 16:16:43 +00:00
218094310b display only command list when 'help' specified on command line 2005-01-11 16:08:38 +00:00
38fc65ae88 beautify lan print output 2005-01-11 16:08:12 +00:00
777cdb124c fix lan parameter set where it was doing incorrect comparison on channel medium 2005-01-10 20:25:34 +00:00
eb75ecf114 the option to read password from file is available on solaris 2005-01-10 17:22:52 +00:00
264a45de0f add attribution 2005-01-08 03:00:23 +00:00
704f4c87c6 update changelog 2005-01-08 02:58:33 +00:00
c7a6be575d add more flexible way of handling OEM boards
now pass a "-o <oemtype>" argument on the command line
the currently defined oem types are "supermicro" and "intelwv2"
the existing -g and -s options are still present for compatibility
2005-01-08 02:49:22 +00:00
f763641c2e only enable "shell" command if readline is found 2005-01-07 23:39:15 +00:00
5575a33119 set hard limit of 128 in nested structure for older gcc 2005-01-07 23:31:12 +00:00
dd376289c5 fix newline on solaris 2005-01-07 23:29:49 +00:00
9c160b5a07 add BMC plugin for Solaris 10 2005-01-07 22:57:15 +00:00
46f3f3d4db return value for non-void function, for -Wall compile 2005-01-07 22:55:55 +00:00
ad932e0cfd fix datatypes so it compiles with -Wall 2005-01-07 22:54:22 +00:00
b5306e1aa6 add unused attribute to static definitions so it compiles with -Wall 2005-01-07 22:53:55 +00:00
e72103d30f check malloc and strdup for success 2005-01-07 22:43:38 +00:00
21837864cc send errors to stderr using lprintf helper 2005-01-07 22:37:58 +00:00
cfa8f69f97 send errors to stderr using lprintf helper 2005-01-07 22:28:18 +00:00
55969d4a32 change return types 2005-01-07 22:17:25 +00:00
87234ecd0f send errors to stderr,
propogate return codes to top level
2005-01-07 22:15:56 +00:00
14ee3f2362 be pedantic when checking for errors 2005-01-07 22:14:56 +00:00
db9614572b send errors to stderr 2005-01-07 22:14:30 +00:00
014040610f use uint{8,16,32}_t instead of "unsigned {char,short,int|long}" 2005-01-07 02:05:49 +00:00
9c848916cc fix compile problems with -g
update lan interface to send debug and errors to stderr
2005-01-06 22:35:35 +00:00
de7de91f99 use uint8_t and uint32_t throughout ipmitool 2005-01-06 22:32:07 +00:00
dbbeee1b6f update error handling for "session" and "user" commands
check channel medium type before attempting to do lan operations on it
2005-01-06 21:17:52 +00:00
32cba5f174 don't bail on SDR version 0x02 2005-01-06 19:19:35 +00:00
f5c8042629 remove the rest of isol 2005-01-06 19:13:52 +00:00
e23dde507e remove isol,
remove signal handler function as it was not used,
clean up error handling in ipmi_open_file
change min define to __min to avoid conflicts
2005-01-06 19:09:05 +00:00
4db9739e17 massive rework of many subsytems
handle errors better and return status codes correctly
2005-01-06 17:48:24 +00:00
b6852fc77b fix supermicro sdr problem 2004-12-13 19:53:46 +00:00
356fad232e formatting changes 2004-11-24 23:53:19 +00:00
30bc6b18cb change bmc -> mc 2004-11-24 23:52:23 +00:00
3dfa1a4209 fix handling of signed equation variables in sensor readings 2004-11-24 23:23:04 +00:00
d25bd0a5e7 rename bmc -> mc 2004-11-22 21:34:30 +00:00
0007006347 use helper function for printing discrete states 2004-11-19 19:53:09 +00:00
7dcd5cec76 add function to print extended SEL record info
for breaking down Event Data fields
2004-11-19 19:52:15 +00:00
929d330424 add function to handle printing asserted states 2004-11-19 19:51:16 +00:00
d17909e3ec check sizes before malloc,
change strcpy to strncpy
2004-11-19 19:50:19 +00:00
2e46c84218 only search for 7 bits 2004-11-19 19:49:23 +00:00
b0ccfba549 moved completion_code_vals 2004-11-19 19:48:53 +00:00
49cc30816a add missing header 2004-11-19 19:48:16 +00:00
f4e4d8433c clean up a few state descriptions 2004-11-19 19:47:02 +00:00
a718edf808 add function for printing discrete states 2004-11-19 19:46:27 +00:00
dce547bcfd put completion_code_vals define back in here 2004-11-19 19:45:44 +00:00
f045c0fa3d add much improved startup script for redhat
rename old script to ipmi.init.basic
2004-11-17 23:48:44 +00:00
c58b02fa94 fix for systems where ipv6 is enabled 2004-11-17 23:47:49 +00:00
ae735c748d set my_addr to IPMI_BMC_SLAVE_ADDR by default 2004-11-17 23:36:06 +00:00
dba187190f fix compile on freebsd 2004-11-17 23:35:24 +00:00
914159b3b5 handle bridged reponses by matching the request and response commands
don't send pings to sm boards
2004-11-17 23:34:29 +00:00
33d9b75951 change "bmc" top level command to "ipmc"
but keep "bmc" around for compatibility (for now)
2004-11-17 23:33:35 +00:00
a5012d1901 make readline use handle different versions 2004-11-17 23:27:54 +00:00
1a34cc960e add cleanup function to clear sdr cache,
zero password field when setting
2004-11-17 23:27:13 +00:00
2e1f1ef750 fix compile on freebsd 2004-11-17 23:25:16 +00:00
17b43f1b45 add new valstrs 2004-11-17 23:23:05 +00:00
0aba9fc8b6 change formatting to be consistant 2004-11-17 23:21:48 +00:00
279053aa84 add a "sel get" command,
change formatting to be consistant
2004-11-17 23:20:22 +00:00
3c58698736 change formating to be consistant,
add entity lookup functions
2004-11-17 23:19:10 +00:00
d23d74ce9f fix typo 2004-11-17 23:17:54 +00:00
a87957ac7f handle errors gracefully,
check values before malloc,
add external function for entity association lookups
2004-11-17 23:16:44 +00:00
7723fb41b3 add support for reading event list from a text file,
add support for generating events over system interface
2004-11-17 23:14:46 +00:00
6cdcd8555a break down ccode on error 2004-11-17 23:11:59 +00:00
1cf302c89e move valstr defines 2004-11-17 23:10:56 +00:00
b696e2ceb3 add new valstr defines 2004-11-17 23:02:19 +00:00
9ec6a6d154 use entity_id structure,
add oem structure,
move valstr defines to ipmi_string.h
2004-11-17 23:01:51 +00:00
66fbb6fbbc move valstr defines to ipmi_string.h 2004-11-17 22:59:54 +00:00
4e7e7ae0a6 add cleanup function 2004-11-17 22:59:26 +00:00
79f3994cfb move completion_code_vals define to ipmi_strings.h 2004-11-17 22:58:14 +00:00
e7e901c935 add functions for SDR to use 2004-11-17 22:56:50 +00:00
3836cb00e8 move valstr defines to ipmi_strings.h 2004-11-17 22:51:30 +00:00
d52c8f01c5 move strings to lib/ipmi_strings.h
add entity id structure for lookups
2004-11-17 22:19:15 +00:00
c3df0b8851 fix for freebsd 2004-11-17 22:16:23 +00:00
99320869d2 move include 2004-11-11 20:49:43 +00:00
1f36312b41 fix spelling error 2004-11-11 20:29:15 +00:00
62574d281c fix formatting 2004-11-11 19:13:31 +00:00
e75fb44b4c fix spelling errors 2004-11-11 19:12:39 +00:00
848646514c check for both curses and ncurses 2004-11-11 19:07:45 +00:00
4edd58a744 fix compile on freebsd 2004-10-25 19:37:38 +00:00
2d3af919ba add special auth support 2004-10-25 19:21:51 +00:00
2c189f0663 add special auth functions 2004-10-25 19:21:13 +00:00
a3a95fb770 add support for -s option 2004-10-25 19:20:47 +00:00
5c846a6eb6 allow oem authtype to be set 2004-10-25 19:20:21 +00:00
3ebe119a94 add authspecial flag 2004-10-25 19:19:59 +00:00
b49691a272 add pef header to cvs 2004-10-25 19:19:39 +00:00
0ef81e301f add pef support, from Tim Murphy 2004-10-08 22:41:38 +00:00
c5d65ba940 update version to 1.6.2 2004-10-08 22:17:11 +00:00
137 changed files with 34425 additions and 8136 deletions

View File

@ -28,6 +28,3 @@ PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
You acknowledge that this software is not designed or intended for use
in the design, construction, operation or maintenance of any nuclear
facility.

View File

@ -1,3 +1,150 @@
version 1.8.9 released 2007-03-06
* Added initial AMC ekey query operation support
* Improvements to ekeying support (PICMG 3.x only)
* Added initial interactive edition support for multirec; added IANA
verification before interpreting PICMG records.
* Added edit support for AMC activation "Maximum Internal Current"
* Fix bug generating garbage on the screen when handling GetDeviceId
and sol traffic occurs
* Added ability to map OEM sensor types to OEM description string using
IANA number; moved IANA number table
* Fix lan set access command to use value already saved within
parameters for PEF and authentication
* Fix bug in cmd ipmitool lan stats get 1
* Add support to allow ipmitool/ipmievd to target specific device
nodes on multi-BMC systems
* Add support for name+privilege lookup for lanplus sessions
* Fix time_t conversion bug for 64-bit OS
* Added prefix of hostname on sel ipmievd sessions
* Fixed FWUM Get Info
* Fix ipmievd fd closing bug
* Add set-in-progress flag support to chassis bootdev
* Added new chassis bootdev options
* Add sol payload enable/disable comman
* Fix SOL set errors when commit-write not supported
* Fix reset of session timeout for lanplus interface
* Fixed lan interface accessibility timeout handling
* Fix bug with Function Get Channel Cipher Suites command when
more than 1 page used.
* Fix missing firmware firewall top-level command
* Fix bug in SOL keepalive functionality
* Fix SOLv2 NACK and retry handling for Intel ESB2 BMC
* Added ipmi_sel_get_oem_sensor* APIs
* Added HPM.1 support
* Fix segfault when incorrect oem option supplied
* Fix bus problem with spd command
* Fix segfault in SOL when remote BMC does not return packet
* Adjust packet length for AMC.0 retricting IPMB packets to 32 bytes
* Added lan packet size reduction mechanism
* Fix bug with sendMessage of bad length with different target
* Fix for big endian (PPC) architecture
* NetBSD fixes
* Fix segfault and channel problem with user priv command
* Add support for bus/chan on i2c raw command
* Add freeipmi interface support
* Add remote spd printing
* Add better detection of linux/compiler.h to config
* Makefile changes to fix makedistcheck, etc.
version 1.8.8
* Fix segfaults in sensor data repository list
* Fix ipmievd to open interface before daemonizing
* Fix IPMIv1.5 authtype NONE to ignore supplied password
* Fix cipher suite display bug in lan print
* Fix typo in IPMIv2 SOL output when sending break
* Fix improper LUN handling with Tyan SOL
* Add LUN support to OpenIPMI interface
* Add support for Kontron OEM commands
* Update to Kontron Firmware Update command
version 1.8.7
* Remove nuclear clause from license
* Add Sun OEM command for blades
* Increase argument size for raw commands in shell/exec
* Fix handling of LUNs for LAN interfaces
* Add IPMIv2 SOL loopback test
* Add support for IBM OEM SEL messages
* Disable file paranoia checks on read files by default
* Support IPMIv2 SOL on older Intel boxes
* Display message and exit if keepalive fails during SOL
* Add support for setting VLAN id and priority
* Add support for FreeBSD OpenIPMI-compatible driver
* Add support for IPMIv2 Firmware Firewall
* Fix gcc4 compile warnings
* Make ipmievd generate pidfile
* Add initscripts for ipmievd
version 1.8.6
* Fix memory corruption when sending encrypted SOL traffic
* Add keepalive timer to IPMIv2 SOL sessions
version 1.8.5
* Add support for settable SOL escape character with -e option
* Add support for Kg BMC key for IPMIv2 authentication with -k option
* Add support for Tyan IPMIv1.5 SOL with tsol command
* Add support for PICMG devices
* Add support for OEM SEL event parsing
* Add support for command bridging over lan and lanplus interfaces
* New 'chassis selftest' command
* Many bufxies and patches from contributors
version 1.8.3
* Add support for 'sel readraw' and 'sel writeraw' commands.
* Add support for entering NetFn as a string for RAW commands.
* Add support for appending distro tag to integrated RPM builds.
* Fix LAN parameter printing to handle Invalid Data Field response
without errors.
* Add 5ms delay to IPMIv2 SOL retry packets
* IPMIv2 interface will now correctly set session privilege level
to requested level after session is opened.
version 1.8.2 (released May 18 2005)
* Fix FRU reading for large (>255 bytes) areas.
* Overhaul to ipmievd to support SEL polling in addition to OpenIPMI.
* Fix LAN parameter segfault when no Ciphers supported by BMC.
* Fix IPMIv2 support on Intel v2 BMCs (use -o intelplus).
* Separate option parsing code from main ipmitool source file.
* Add raw I2C support with IPMI Master Read-Write command.
* Add support for new 'sdr elist' extended output format.
* Add support for listing sensors by type with 'sdr type' command.
* Add support for new 'sel elist' extended output format that
cross-references events with sensors.
* Add support for sending dynamically generated platform events
based on existing sensor information.
* New '-S' argument to read local SDR cache created with 'sdr dump'.
* Updated manpage for ipmitool and ipmievd.
version 1.8.1
* ipmievd installs in /usr/sbin
version 1.8.0
* Fix IPMIv2.0 issues
* Fix chassis boot parameter support
* Add support for linear sensors
version 1.7.1
* Update bmc plugin to work with new Solaris bmc driver (new ioctl
for interface detection and new STREAMS message-based interface)
version 1.7.0
* Propogate errors correctly so exit status will be useful
* More consistent display of errors including completion code text
* Errors and debug is send to stderr now
* New "sel get" command that will print details about SEL entry
and corresponding SDR records as well as FRUs via entity association
* Improved event generator, now supports reading events from text file
* New "-o oemtype" option for specifying OEM boards
exsting types are "supermicro" and "intelwv2"
* New PEF subsystem from Tim Murphy at Dell
* New "bmc" plugin for Solaris 10 x86
* Many bugfixes and contributed patches
version 1.6.2
* Support for Supermicro BMC OEM authentication method
version 1.6.1
* Fix minor problem with LAN parameter setting
version 1.6.0
* Add a README file
* Add Solaris x86 interface plugin

View File

@ -27,13 +27,9 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
DOCDIR = $(DESTDIR)/$(datadir)/doc/$(PACKAGE)
DOCLIST = README COPYING AUTHORS ChangeLog
DOCDIR = $(datadir)/doc/$(PACKAGE)
DOCLIST = $(top_srcdir)/README $(top_srcdir)/COPYING $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog
EXTRA_DIST = $(DOCLIST) \
debian/changelog debian/control debian/copyright \
@ -52,8 +48,11 @@ dist-hook:
cp control/ipmitool.spec $(distdir)
install-data-local:
mkdir -p $(DOCDIR)
install -m 644 $(DOCLIST) $(DOCDIR)
mkdir -p $(DESTDIR)$(DOCDIR)
$(INSTALL_DATA) $(DOCLIST) $(DESTDIR)$(DOCDIR)
uninstall-local:
-rm -rf $(DESTDIR)$(DOCDIR)
.PHONY: pkg
pkg: PKG := ipmitool-@VERSION@-@OS@-@ARCH@
@ -80,4 +79,3 @@ rpm: control/ipmitool.spec dist
.PHONY: clean-rpm
clean-rpm:
-rm -rf $(RPMDIR)

View File

@ -176,7 +176,6 @@ Commands:
fru Print built-in FRU and scan SDR for FRU locators
sel Print System Evelnt Log
sol Configure IPMIv2.0 Serial-over-LAN
isol Configure Intel IPMIv1.5 Serial-over-LAN
user Configure BMC users
channel Configure BMC channels
session Print session information

View File

@ -29,10 +29,6 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
aclocal
libtoolize --automake --copy

View File

@ -3,7 +3,7 @@ dnl autoconf for ipmitool
dnl
AC_INIT([src/ipmitool.c])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([ipmitool], [1.6.1])
AM_INIT_AUTOMAKE([ipmitool], [1.8.9])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/ipmitool.c])
AC_PREREQ(2.50)
@ -18,7 +18,7 @@ AC_CHECK_PROG([RPMBUILD], [rpmbuild], [rpmbuild], [rpm])
AC_CHECK_PROG([SED], [sed], [sed])
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h])
AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h paths.h])
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/socket.h])
AC_CHECK_HEADERS([sys/byteorder.h byteswap.h])
@ -51,6 +51,8 @@ if test "x$exec_prefix" = "xNONE"; then
exec_prefix="$prefix"
fi
enable_all_options=yes
dnl set some things so we build with GNU tools on Solaris
case "$host_os" in
solaris*)
@ -58,11 +60,47 @@ solaris*)
STRIP=gstrip
LD=gld
AR=gar
# openssl libs are in /usr/sfw/lib on solaris 10
LIBS="$LIBS -R/usr/sfw/lib"
# disable the linux-specific interfaces
# and bmc on SPARC (there is no bmc driver for SPARC)
if [[ `mach -p` = sparc ]]; then
enable_intf_bmc=no
else
enable_intf_bmc=yes
fi
enable_intf_imb=no
enable_intf_open=no
enable_ipmievd=no
enable_intf_lipmi=no
enable_ipmishell=no
enable_all_options=no
;;
*cygwin*)
# disable the linux and solaris-specific interfaces
enable_intf_imb=no
enable_intf_open=no
enable_intf_lipmi=no
enable_intf_bmc=no
enable_ipmishell=no
;;
*darwin*)
# disable the linux and solaris-specific interfaces
enable_intf_imb=no
enable_intf_open=no
enable_intf_lipmi=no
enable_intf_bmc=no
enable_ipmishell=no
;;
*freebsd*)
enable_intf_imb=no
enable_intf_lipmi=no
enable_intf_bmc=no
;;
*netbsd*)
enable_intf_imb=no
enable_intf_lipmi=no
enable_intf_bmc=no
enable_intf_open=no
;;
esac
@ -71,6 +109,15 @@ AC_SUBST(OS, $host_os)
AC_SUBST(PSTAMP, $host)
AC_SUBST(BASEDIR, $prefix)
dnl allow solaris builds to include all options
AC_ARG_ENABLE([solaris-opt],
[AC_HELP_STRING([--enable-solaris-opt],
[enable all options for Solaris [default=no]])],
[], [enable_solaris_opt=no])
if test "x$enable_all_options" = "xyes" || test "x$enable_solaris_opt" = "xyes"; then
AC_DEFINE(ENABLE_ALL_OPTIONS, [1], [Define to 1 to enable all command line options.])
fi
dnl check for OpenSSL functionality
AC_ARG_ENABLE([internal-md5],
[AC_HELP_STRING([--enable-internal-md5],
@ -136,6 +183,8 @@ else
enable_intf_lanplus=no
fi
ORIG_CPPFLAGS=$CPPFLAGS
dnl look for OpenIPMI header files
AC_ARG_WITH([kerneldir],
[AC_HELP_STRING([--with-kerneldir=DIR],
@ -145,6 +194,8 @@ AC_ARG_WITH([kerneldir],
fi
CFLAGS="$CFLAGS -I ${with_kerneldir}/include"
AC_SUBST(CFLAGS)
CPPFLAGS="$CPPFLAGS -I ${with_kerneldir}/include"
AC_SUBST(CPPFLAGS)
if test -s ${with_kerneldir}/include/linux/version.h ; then
kernelver=`grep UTS_RELEASE ${with_kerneldir}/include/linux/version.h | \
sed 's/^\#define UTS_RELEASE \"\(2\.[0-9]\)\..*/\1/'`
@ -153,15 +204,91 @@ AC_ARG_WITH([kerneldir],
AC_SUBST(CPPFLAGS)
fi
fi])
AH_TEMPLATE([HAVE_LINUX_COMPILER_H], [])
AC_MSG_CHECKING([for linux/compiler.h])
AC_PREPROC_IFELSE([#include <linux/compiler.h>],
[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
[Define to 1 if you have the <linux/compiler.h> header file.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
CPPFLAGS=$ORIG_CPPFLAGS
AC_SUBST(CPPFLAGS)
AC_CHECK_HEADER([linux/ipmi.h],
[AC_DEFINE(HAVE_OPENIPMI_H, [1],
[Define to 1 if you have the <linux/ipmi.h> header file.])],
[echo "** Unable to find OpenIPMI header files. Using internal version."])
[AC_CHECK_HEADER([sys/ipmi.h],
[AC_DEFINE(HAVE_FREEBSD_IPMI_H, [1],
[Define to 1 if you have the <sys/ipmi.h> header file.])],
[echo "** Unable to find OpenIPMI header files. Using internal version."])])
dnl look for FreeIPMI files
AC_CHECK_LIB(freeipmi, ipmi_open_inband, [have_free=yes], [have_free=no])
AC_ARG_ENABLE([intf-free],
[AC_HELP_STRING([--enable-intf-free],
[enable FreeIPMI IPMI interface [default=auto]])],
[if test "x$enable_intf_free" != "xno" && test "x$have_free" != "xyes"; then
echo "** Unable to build FreeIPMI interface support!"
enable_intf_free=no
fi],
[enable_intf_free=$have_free])
if test "x$enable_intf_free" = "xstatic" || test "x$enable_intf_free" = "xplugin"; then
enable_intf_free=yes
fi
if test "x$enable_intf_free" = "xyes"; then
dnl Determine if you got the right FreeIPMI version
AC_MSG_CHECKING([for good libfreeipmi version])
AC_TRY_COMPILE([
#include <sys/types.h> /* For size_t */
#include <stdio.h> /* For NULL */
#include <freeipmi/freeipmi.h>
#include <freeipmi/udm/ipmi-udm.h>
], [
ipmi_device_t dev;
dev = ipmi_open_inband(IPMI_DEVICE_KCS,
0,
0,
0,
NULL,
0);
], ac_free_version_good=yes,ac_free_version_good=no)
AC_MSG_RESULT($ac_free_version_good)
if test "x$ac_free_version_good" = "xyes"; then
AC_DEFINE(IPMI_INTF_FREE, [1], [Define to 1 to enable FreeIPMI interface.])
AC_SUBST(INTF_FREE, [free])
AC_SUBST(INTF_FREE_LIB, [libintf_free.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB free/libintf_free.la"
else
enable_intf_free=no
fi
fi
dnl look for termios header file
AC_CHECK_HEADER([termios.h],
[AC_DEFINE(HAVE_TERMIOS_H, [1], [Define to 1 if you have <termios.h>.])],
[AC_CHECK_HEADER([sys/termios.h],
[AC_DEFINE(HAVE_SYS_TERMIOS_H, [1], [Define to 1 if you have <sys/termios.h>.])],
[echo "** Unable to find termios header file."])])
dnl set RPM distro tag for use in RPM name
AC_ARG_WITH([rpm-distro],
[AC_HELP_STRING([--with-rpm-distro=DISTRO],
[set Linux distribution tag for use in RPM version string])],
[AC_SUBST(DISTRO, $with_rpm_distro)])
dnl set RPM release tag
AC_ARG_WITH([rpm-release],
[AC_HELP_STRING([--with-rpm-release=RELEASE],
[set release number for RPM release field])],
[], [with_rpm_release=1])
AC_SUBST(RPM_RELEASE, $with_rpm_release)
dnl enable Linux OpenIPMI interface
AC_ARG_ENABLE([intf-open],
[AC_HELP_STRING([--enable-intf-open],
[enable Linux OpenIPMI interface [default=yes]])],
[enable Linux OpenIPMI interface [default=auto]])],
[], [enable_intf_open=yes])
if test "x$enable_intf_open" = "xstatic" || test "x$enable_intf_open" = "xplugin"; then
enable_intf_open=yes
@ -176,7 +303,7 @@ fi
dnl enable Intel IMB interface
AC_ARG_ENABLE([intf-imb],
[AC_HELP_STRING([--enable-intf-imb],
[enable Intel IMB driver interface [default=yes]])],
[enable Intel IMB driver interface [default=auto]])],
[], [enable_intf_imb=yes])
if test "x$enable_intf_imb" = "xstatic" || test "x$enable_intf_imb" = "xplugin"; then
enable_intf_imb=yes
@ -192,46 +319,51 @@ dnl enable Solaris LIPMI interface
AC_CHECK_HEADER([sys/lipmi/lipmi_intf.h], [have_lipmi=yes], [have_lipmi=no])
AC_ARG_ENABLE([intf-lipmi],
[AC_HELP_STRING([--enable-intf-lipmi],
[enable Solaris x86 IPMI interface [default=auto]])],
[enable Solaris 9 x86 IPMI interface [default=no]])],
[if test "x$enable_intf_lipmi" != "xno" && test "x$have_lipmi" != "xyes"; then
echo "** Unable to build Solaris x86 IPMI interface support!"
echo "** Unable to build Solaris 9 x86 IPMI interface support!"
enable_intf_lipmi=no
fi],
[enable_intf_lipmi=$have_lipmi])
[enable_intf_lipmi=no])
if test "x$enable_intf_lipmi" = "xstatic" || test "x$enable_intf_lipmi" = "xplugin"; then
enable_intf_lipmi=yes
fi
if test "x$enable_intf_lipmi" = "xyes"; then
AC_DEFINE(IPMI_INTF_LIPMI, [1], [Define to 1 to enable Solaris LIPMI interface.])
AC_DEFINE(IPMI_INTF_LIPMI, [1], [Define to 1 to enable Solaris 9 LIPMI interface.])
AC_SUBST(INTF_LIPMI, [lipmi])
AC_SUBST(INTF_LIPMI_LIB, [libintf_lipmi.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lipmi/libintf_lipmi.la"
fi
dnl enable Solaris BMC interface
AC_ARG_ENABLE([intf-bmc],
[AC_HELP_STRING([--enable-intf-bmc],
[enable Solaris 10 x86 IPMI interface [default=auto]])],,
[enable_intf_bmc=no])
if test "x$enable_intf_bmc" = "xstatic" || test "x$enable_intf_bmc" = "xplugin"; then
enable_intf_bmc=yes
fi
if test "x$enable_intf_bmc" = "xyes"; then
AC_DEFINE(IPMI_INTF_BMC, [1], [Define to 1 to enable Solaris 10 BMC interface.])
AC_SUBST(INTF_BMC, [bmc])
AC_SUBST(INTF_BMC_LIB, [libintf_bmc.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
fi
AC_SUBST(IPMITOOL_INTF_LIB)
dnl check for readline library to enable ipmi shell
have_readline=no
AC_SEARCH_LIBS([readline], [readline], [have_readline=yes],
[AC_CHECK_LIB([readline], [readline],
[have_readline=yes], [], [-lcurses])])
AC_ARG_ENABLE([ipmishell],
[AC_HELP_STRING([--enable-ipmishell],
[enable IPMI shell interface [default=yes]])],
[], [enable_ipmishell=yes])
if test "x$enable_ipmishell" = "xyes" && test "x$have_readline" = "xyes"; then
AC_DEFINE(HAVE_READLINE, [1], [Define to 1 if readline present.])
LIBS="$LIBS -lcurses -lreadline"
fi
dnl enable IPMI Event Daemon
AC_ARG_ENABLE([ipmievd],
[AC_HELP_STRING([--enable-ipmievd],
[enable IPMI Event daemon [default=yes]])],
[], [enable_ipmievd=yes])
AM_CONDITIONAL(IPMIEVD, [test "x$enable_ipmievd" = "xyes"])
if test "x$enable_ipmievd" = "xyes"; then
AC_SUBST(IPMIEVD_BIN, [ipmievd])
if test "x$enable_ipmishell" = "xyes"; then
AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
if test "x$have_curses" = "xyes" && test "x$have_readline" = "xyes"; then
AC_DEFINE(HAVE_READLINE, [1], [Define to 1 if readline present.])
fi
fi
dnl Enable -Wall -Werror
@ -239,11 +371,19 @@ AC_ARG_ENABLE([buildcheck],
[AC_HELP_STRING([--enable-buildcheck],
[enable -Wall -Werror for build testing [default=no]])],
[if test "x$enable_buildcheck" != "xno"; then
CFLAGS="$CFLAGS -Wall -Werror"
CFLAGS="$CFLAGS -Wall -Werror -Wpointer-arith -Wstrict-prototypes"
fi], [])
AC_SUBST(CFLAGS)
dnl Enable extra file security paranoia
AC_ARG_ENABLE([file-security],
[AC_HELP_STRING([--enable-file-security],
[enable extra security checks on files opened for read [default=no]])],
[if test "x$enable_file_security" != "xno"; then
AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for extra file security.])
fi], [])
dnl Generate files for build
AC_CONFIG_FILES([Makefile
doc/Makefile
@ -251,6 +391,7 @@ AC_CONFIG_FILES([Makefile
control/Makefile
control/pkginfo
control/prototype
control/rpmmacros
control/ipmitool.spec
lib/Makefile
include/Makefile
@ -260,7 +401,9 @@ AC_CONFIG_FILES([Makefile
src/plugins/lan/Makefile
src/plugins/lanplus/Makefile
src/plugins/open/Makefile
src/plugins/free/Makefile
src/plugins/imb/Makefile
src/plugins/bmc/Makefile
src/plugins/lipmi/Makefile])
AC_OUTPUT
@ -272,10 +415,12 @@ AC_MSG_RESULT([Interfaces])
AC_MSG_RESULT([ lan : $enable_intf_lan])
AC_MSG_RESULT([ lanplus : $enable_intf_lanplus])
AC_MSG_RESULT([ open : $enable_intf_open])
AC_MSG_RESULT([ free : $enable_intf_free])
AC_MSG_RESULT([ imb : $enable_intf_imb])
AC_MSG_RESULT([ bmc : $enable_intf_bmc])
AC_MSG_RESULT([ lipmi : $enable_intf_lipmi])
AC_MSG_RESULT([])
AC_MSG_RESULT([Extra tools])
AC_MSG_RESULT([ ipmievd : $enable_ipmievd])
AC_MSG_RESULT([ ipmievd : yes])
AC_MSG_RESULT([])

View File

@ -27,13 +27,11 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
MAINTAINERCLEANFILES = Makefile.in
dist_pkgdata_DATA = bmclanconf ipmi.init README \
EXTRA_DIST = README oem_ibm_sel_map \
bmclanconf ipmi.init.basic ipmi.init.redhat \
ipmievd.init.redhat ipmievd.init.suse ipmievd.init.debian \
collect_data.sh create_rrds.sh create_webpage_compact.sh create_webpage.sh

View File

@ -29,11 +29,6 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
#
# This script is designed for Sun Fire LX50, V60x and V65x systems.
@ -248,7 +243,7 @@ case `uname -s` in
Linux)
if [ X$IFACE != X ]; then
if [ X$IP_ADDRESS = X ]; then
IP_ADDRESS=`$IFCONFIG $IFACE | grep inet | awk -F"[:[:space:]]+" '{print $4}'`
IP_ADDRESS=`$IFCONFIG $IFACE | grep "inet addr" | awk -F"[:[:space:]]+" '{print $4}'`
fi
if [ X$IP_NETMASK = X ]; then
IP_NETMASK=`$IFCONFIG $IFACE | grep Bcast | awk -F"[:[:space:]]+" '{print $8}'`

222
ipmitool/contrib/ipmi.init.redhat Executable file
View File

@ -0,0 +1,222 @@
#!/bin/sh
#
# chkconfig: 2345 11 60
# description: start, stop, or query ipmi system monitoring tools
# config: /etc/sysconfig/ipmi
#
# For Redhat, Fedora, or similar systems. Handles both 2.4 and 2.6
# configurations. Requires an /etc/sysconfig/ipmi file to function,
# see below.
#
# Phil Hollenback
# philiph@pobox.com
# Source function library.
. /etc/init.d/functions
# Exit silently if we don't have a sysconfig file,
# and read IPMI setting from it to determine whether or
# not to continue.
# The only current setting is ipmi={YES|NO}, whether or not
# to enable IPMI.
[ -f /etc/sysconfig/ipmi ] || exit 0
. /etc/sysconfig/ipmi
[ "${IPMI}" = "yes" ] || exit 0
RETVAL=0
start() {
echo -n $"Starting ipmi: "
# If ipmidev isn't listed in /proc/devices, try
# loading the modules.
if ! grep -q ipmidev /proc/devices
then
/sbin/modprobe ipmi_msghandler || RETVAL=1
/sbin/modprobe ipmi_devintf || RETVAL=1
# Try loading new driver module, fall back to old
# module if that fails.
if ! /sbin/modprobe ipmi_si >/dev/null 2>&1
then
/sbin/modprobe ipmi_kcs_drv || RETVAL=1
fi
fi
# If ipmidev still isn't listed in /proc/devices after we load
# modules, this just isn't going to work. Set RETVAL to mark
# this failure.
grep -q ipmidev /proc/devices || RETVAL=1
# remove old device file always
# in case ipmi gets assigned new dynamic major number from kernel
if [ -c /dev/ipmi0 ]; then
rm -f /dev/ipmi0
fi
# Check if the device file exists and create if not.
if [ ! -c /dev/ipmi0 ] && [ $RETVAL -eq 0 ]
then
major=$(awk '/ ipmidev$/{print $1}' /proc/devices)
/bin/mknod -m 0600 /dev/ipmi0 c $major 0 || RETVAL=1
fi
if [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ipmi ; then
echo_success
echo
else
echo_failure
echo
fi
}
stop() {
echo -n $"Shutting down ipmi: "
# Stop doesn't actually do anything because we currently don't
# unload ipmi modules on stop. That might change in the future
# if we decide unloading the ipmi modules is safe.
RETVAL=0
if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ipmi ; then
echo_success
echo
else
echo_failure
echo
fi
}
dostatus() {
# Extract cpu temperatures from ipmitool output.
# Abort if we don't have the ipmitool program.
if ! /usr/bin/ipmitool -V >/dev/null
then
echo "/usr/bin/ipmitool not found!" >&2
exit 1
fi
# Abort if ipmi isn't loaded.
if ! grep -q ipmidev /proc/devices
then
echo "ipmi not listed in /proc/devices!" >&2
exit 1
fi
# Check if we are running on a v1.0 IPMI system, and
# change our processor search string appropriately.
if /usr/bin/ipmitool -I open bmc info | \
grep -q "IPMI Version.*1.0"
then
IpmiVersion="1.0"
fi
# Determine # of running processors
NumProcs=$(grep -c processor /proc/cpuinfo)
if [ $NumProcs -eq 0 ]
then
echo "Can't determine number of processors!" >&2
exit 1
fi
# Now build the query string. Concatenate it into
# one string because that's more efficient on 2.4 systems.
Count=1
TempString=""
while [ $Count -le $NumProcs ]
do
if [ x$IpmiVersion = x"1.0" ]
then
TempString="$TempString CPU\ $Count"
else
TempString="$TempString Processor$Count\ Temp"
fi
Count=$((Count + 1))
done
# building TempString like this and eval'ing it is ugly, but
# it's the only way I could make the quoting work. Sorry.
TempString="/usr/bin/ipmitool -I open sensor get $TempString"
eval $TempString | awk -v "c=$Count" '
BEGIN {
n = 1
}
/Sensor Reading/ {
printf "CPU%s Temp: %s\n",n,$4
n++
}
END {
if ( n != c) {
printf "Error: found %s CPUs, but got temps for %s\n",--c,--n >"/dev/stderr"
exit 1
}
exit 0
}'
RETVAL=$((RETVAL + $?))
return $RETVAL
}
restart() {
stop
start
RETVAL=$?
}
condrestart() {
[ -e /var/lock/subsys/ipmi ] && restart || :
}
remove () {
# Actually remove the drivers. Don't do during stop in case
# this causes system to become unstable (a la lm_sensors)
if /sbin/lsmod | awk '{print $1}' | grep -q ipmi_
then
# Try removing both 2.4 and 2.6 modules.
/sbin/rmmod ipmi_si 2>/dev/null
/sbin/rmmod ipmi_kcs_drv 2>/dev/null
/sbin/rmmod ipmi_devintf
/sbin/rmmod ipmi_msghandler
else
echo "No ipmi modules loaded!" >&2
RETVAL=1
return $RETVAL
fi
# Wait a sec to give modules time to unload.
sleep 1
# Check if we failed to remove any modules, and complain if so.
if /sbin/lsmod | awk '{print $1}' | grep -q ipmi_
then
echo "ipmi modules still loaded!" >&2
RETVAL=1
return $RETVAL
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
dostatus
;;
restart|reload)
restart
;;
condrestart)
condrestart
;;
remove)
remove
;;
*)
echo "Usage: ipmi {start|stop|status|restart|condrestart|remove}"
exit 1
esac
exit $RETVAL

View File

@ -0,0 +1,92 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: ipmievd
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop: $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: IPMI event daemon
# Description: ipmievd is a daemon which will listen for events
# from the BMC that are being sent to the SEL and
# also log those messages to syslog.
### END INIT INFO
#
# Author: Elmar Hoffmann <elho@elho.net>
# Licence: This script is public domain using the same
# licence as ipmitool itself.
# Modified by: Petter Reinholdtsen
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="IPMI event daemon"
NAME=ipmievd
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
. /etc/default/rcS
# Options used by ipmievd.
#
# "open" uses the asynchronous event notification from the OpenIPMI
# kernel driver, "sel" uses active polling of the contents of the SEL
# for new events.
#
# Need to force 'daemon' mode, to make sure messages are sent to
# syslog and the program forks into the background.
#
# Se ipmievd(8) for more info.
IPMIEVD_OPTIONS="open daemon"
# Read config file if it is present.
[ -f /etc/default/$NAME ] && . /etc/default/$NAME
#
# Function that starts the daemon/service.
#
d_start() {
start-stop-daemon --start --quiet --exec $DAEMON -- $IPMIEVD_OPTIONS
}
#
# Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --quiet --name $NAME --exec $DAEMON
}
CODE=0
case "$1" in
start)
[ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME"
d_start || CODE=$?
[ "$VERBOSE" != no ] && log_end_msg $CODE
exit $CODE
;;
stop)
log_begin_msg "Stopping $DESC" "$NAME"
d_stop || CODE=$?
log_end_msg $CODE
exit $CODE
;;
restart|force-reload)
log_begin_msg "Restarting $DESC" "$NAME"
d_stop || true
sleep 1
d_start || CODE=$?
log_end_msg $CODE
exit $CODE
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,87 @@
#!/bin/bash
#
# /etc/rc.d/init.d/ipmievd
#
# Based on example sysvinitfiles script
# Copyright (c) 2000 Red Hat Software, Inc.
#
# chkconfig: 345 99 00
# description: ipmievd daemon to send events to syslog
# processname: ipmievd
# config: /etc/sysconfig/ipmievd
#
### BEGIN INIT INFO
# Provides: ipmievd
# Required-Start: $syslog ipmi
# Should-Start: $time
# Required-Stop: $syslog ipmi
# Should-Stop: $time
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: ipmievd daemon to send events to syslog
# Description: Start ipmievd to read events from BMC and
# log them to syslog. Events correspond to hardware faults,
# state transitions such as power on and off, and sensor
# readings such as temperature, voltage and fan speed that
# are abnormal.
### END INIT INFO
IPMIEVD_BIN=/usr/sbin/ipmievd
test -x $IPMIEVD_BIN || { echo "$IPMIEVD_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file
IPMIEVD_CONFIG=/etc/sysconfig/ipmievd
test -r $IPMIEVD_CONFIG || { echo "$IPMIEVD_CONFIG does not exist";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
# Read config file
. $IPMIEVD_CONFIG
# Source function library.
. /etc/init.d/functions
start() {
echo "Starting ipmievd:"
if [ -f /var/lock/subsys/ipmievd ]; then
return 0
fi
daemon $IPMIEVD_BIN $IPMIEVD_OPTIONS
ret=$?
[ $ret -eq 0 ] && touch /var/lock/subsys/ipmievd
return $ret
}
stop() {
echo "Shutting down ipmievd:"
killproc $IPMIEVD_BIN
ret=$?
[ $ret -eq 0 ] && rm -f /var/lock/subsys/ipmievd
return $ret
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $IPMIEVD_BIN
;;
restart|reload)
stop
start
;;
condrestart)
[ -f /var/lock/subsys/ipmievd ] && restart || :
;;
*)
echo "Usage: ipmievd {start|stop|status|reload|restart|condrestart}"
exit 1
;;
esac
exit $?

View File

@ -0,0 +1,212 @@
#!/bin/bash
#
# System startup script for ipmievd
# Based on skeleton.compat example script
# Copyright (C) 1995--2005 Kurt Garloff, SUSE / Novell Inc.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
# USA.
#
# Note: This template uses functions rc_XXX defined in /etc/rc.status on
# UnitedLinux/SUSE/Novell based Linux distributions. However, it will work
# on other distributions as well, by using the LSB (Linux Standard Base)
# or RH functions or by open coding the needed functions.
# Read http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/ if you prefer not
# to use this template.
#
# chkconfig: 345 99 00
# description: ipmievd daemon
#
### BEGIN INIT INFO
# Provides: ipmievd
# Required-Start: $syslog ipmi
# Should-Start: $time
# Required-Stop: $syslog ipmi
# Should-Stop: $time
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: ipmievd daemon to send events to syslog
# Description: Start ipmievd to read events from BMC and
# log them to syslog. Events correspond to hardware faults,
# state transitions such as power on and off, and sensor
# readings such as temperature, voltage and fan speed that
# are abnormal.
### END INIT INFO
#
# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
IPMIEVD_BIN=/usr/sbin/ipmievd
test -x $IPMIEVD_BIN || { echo "$IPMIEVD_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
IPMIEVD_CONFIG=/etc/sysconfig/ipmievd
test -r $IPMIEVD_CONFIG || { echo "$IPMIEVD_CONFIG does not exist";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
# Read config
. $IPMIEVD_CONFIG
if test -e /etc/rc.status; then
# SUSE rc script library
. /etc/rc.status
else
export LC_ALL=POSIX
_cmd=$1
declare -a _SMSG
if test "${_cmd}" = "status"; then
_SMSG=(running dead dead unused unknown reserved)
_RC_UNUSED=3
else
_SMSG=(done failed failed missed failed skipped unused failed failed reserved)
_RC_UNUSED=6
fi
if test -e /lib/lsb/init-functions; then
# LSB
. /lib/lsb/init-functions
echo_rc()
{
if test ${_RC_RV} = 0; then
log_success_msg " [${_SMSG[${_RC_RV}]}] "
else
log_failure_msg " [${_SMSG[${_RC_RV}]}] "
fi
}
# TODO: Add checking for lockfiles
checkproc() { return pidofproc ${1+"$@"} >/dev/null 2>&1; }
elif test -e /etc/init.d/functions; then
# RHAT
. /etc/init.d/functions
echo_rc()
{
#echo -n " [${_SMSG[${_RC_RV}]}] "
if test ${_RC_RV} = 0; then
success " [${_SMSG[${_RC_RV}]}] "
else
failure " [${_SMSG[${_RC_RV}]}] "
fi
}
checkproc() { return status ${1+"$@"}; }
start_daemon() { return daemon ${1+"$@"}; }
else
# emulate it
echo_rc() { echo " [${_SMSG[${_RC_RV}]}] "; }
fi
rc_reset() { _RC_RV=0; }
rc_failed()
{
if test -z "$1"; then
_RC_RV=1;
elif test "$1" != "0"; then
_RC_RV=$1;
fi
return ${_RC_RV}
}
rc_check()
{
return rc_failed $?
}
rc_status()
{
rc_failed $?
if test "$1" = "-r"; then _RC_RV=0; shift; fi
if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
if test "$1" = "-v"; then echo_rc; shift; fi
if test "$1" = "-r"; then _RC_RV=0; shift; fi
return ${_RC_RV}
}
rc_exit() { exit ${_RC_RV}; }
rc_active()
{
if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
return 1
}
fi
# Reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - user had insufficient privileges
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signaling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting ipmievd "
start_daemon $IPMIEVD_BIN $IPMIEVD_OPTIONS
rc_status -v
;;
stop)
echo -n "Shutting down ipmievd "
killproc -TERM $IPMIEVD_BIN
rc_status -v
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
echo -n "Reload service ipmievd "
$0 try-restart
rc_status
;;
reload)
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for service ipmievd "
checkproc $IPMIEVD_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload| reload}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,202 @@
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x04","Chassis Number","Memory Card","Completion Code (0x00=Success)","0x00","Memory hot replace event"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x05","Chassis Number","Memory Card","Memory Size (in 512MB units)","0x00","Memory hot add event"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x00","Chassis Number","Scalability Port Number","R","0x00","Scalability link down"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x01","Chassis Number","Scalability Port Number","R","0x00","Scalability link up"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x02","Chassis Number","Scalability Port Number","R","0x00","Scalability link double wide down"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x03","Chassis Number","Scalability Port Number","R","0x00","Scalability link double wide up"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x80","Chassis Number","Scalability Port Number","R","0x00","Scalability link PFA"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x81","Chassis Number","Scalability Port Number","R","0x00","Scalability link invalid port"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x82","Chassis Number","Scalability Port Number","R","0x00","Scalability link invalid node"
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x03","0x83","Chassis Number","Scalability Port Number","R","0x00","Scalability link kill"
"0xE0","0x00","0x00","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Device OK"
"0xE0","0x00","0x01","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required ROM space not available"
"0xE0","0x00","0x02","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required I/O Space not available"
"0xE0","0x00","0x03","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required memory not available"
"0xE0","0x00","0x04","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required memory below 1MB not available"
"0xE0","0x00","0x05","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","ROM checksum failed"
"0xE0","0x00","0x06","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","BIST failed"
"0xE0","0x00","0x07","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Planar device missing or disabled by user"
"0xE0","0x00","0x08","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","PCI device has an invalid PCI configuration space header"
"0xE0","0x00","0x09","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","FRU information for added PCI device"
"0xE0","0x00","0x0A","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","FRU information for removed PCI device"
"0xE0","0x00","0x0B","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","A PCI device was added, PCI FRU information is stored in next log entry"
"0xE0","0x00","0x0C","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","A PCI device was removed, PCI FRU information is stored in next log entry"
"0xE0","0x00","0x0D","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Requested resources not available"
"0xE0","0x00","0x0E","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required I/O Space Not Available"
"0xE0","0x00","0x0F","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required I/O Space Not Available"
"0xE0","0x00","0x10","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required I/O Space Not Available"
"0xE0","0x00","0x11","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required I/O Space Not Available"
"0xE0","0x00","0x12","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Required I/O Space Not Available"
"0xE0","0x00","0x13","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Planar video disabled due to add in video card"
"0xE0","0x00","0x14","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","FRU information for PCI device partially disabled "
"0xE0","0x00","0x15","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","A PCI device was partially disabled, PCI FRU information is stored in next log entry"
"0xE0","0x00","0x16","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","A 33Mhz device is installed on a 66Mhz bus, PCI device information is stored in next log entry"
"0xE0","0x00","0x17","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","FRU information, 33Mhz device installed on 66Mhz bus"
"0xE0","0x00","0x18","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Merge cable missing"
"0xE0","0x00","0x19","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Node 1 to Node 2 cable missing"
"0xE0","0x00","0x1A","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Node 1 to Node 3 cable missing"
"0xE0","0x00","0x1B","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Node 2 to Node 3 cable missing"
"0xE0","0x00","0x1C","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Nodes could not merge"
"0xE0","0x00","0x1D","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","No 8 way SMP cable"
"0xE0","0x00","0x1E","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Primary North Bridge to PCI Host Bridge IB Link has failed"
"0xE0","0x00","0x1F","Chassis Number","Slot Number","Bus Number","Device ID (MSB)","Device ID (LSB)","Vendor ID (MSB)","Vendor ID (LSB)","R","R","R","0x00","Redundant PCI Host Bridge IB Link has failed"
"0xE0","0x00","0x00","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Device OK"
"0xE0","0x00","0x01","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required ROM space not available"
"0xE0","0x00","0x02","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required I/O Space not available"
"0xE0","0x00","0x03","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required memory not available"
"0xE0","0x00","0x04","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required memory below 1MB not available"
"0xE0","0x00","0x05","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","ROM checksum failed"
"0xE0","0x00","0x06","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","BIST failed"
"0xE0","0x00","0x07","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Planar device missing or disabled by user"
"0xE0","0x00","0x08","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","PCI device has an invalid PCI configuration space header"
"0xE0","0x00","0x09","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","FRU information for added PCI device"
"0xE0","0x00","0x0A","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","FRU information for removed PCI device"
"0xE0","0x00","0x0B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","A PCI device was added, PCI FRU information is stored in next log entry"
"0xE0","0x00","0x0C","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","A PCI device was removed, PCI FRU information is stored in next log entry"
"0xE0","0x00","0x0D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Requested resources not available"
"0xE0","0x00","0x0E","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required I/O Space Not Available"
"0xE0","0x00","0x0F","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required I/O Space Not Available"
"0xE0","0x00","0x10","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required I/O Space Not Available"
"0xE0","0x00","0x11","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required I/O Space Not Available"
"0xE0","0x00","0x12","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Required I/O Space Not Available"
"0xE0","0x00","0x13","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Planar video disabled due to add in video card"
"0xE0","0x00","0x14","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","FRU information for PCI device partially disabled "
"0xE0","0x00","0x15","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","A PCI device was partially disabled, PCI FRU information is stored in next log entry"
"0xE0","0x00","0x16","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","A 33Mhz device is installed on a 66Mhz bus, PCI device information is stored in next log entry"
"0xE0","0x00","0x17","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","FRU information, 33Mhz device installed on 66Mhz bus"
"0xE0","0x00","0x18","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Merge cable missing"
"0xE0","0x00","0x19","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Node 1 to Node 2 cable missing"
"0xE0","0x00","0x1A","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Node 1 to Node 3 cable missing"
"0xE0","0x00","0x1B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Node 2 to Node 3 cable missing"
"0xE0","0x00","0x1C","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Nodes could not merge"
"0xE0","0x00","0x1D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","No 8 way SMP cable"
"0xE0","0x00","0x1E","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Primary North Bridge to PCI Host Bridge IB Link has failed"
"0xE0","0x00","0x1F","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","R","R","R","0x01","Redundant PCI Host Bridge IB Link has failed"
"0xE0","0x01","0x00","Chassis Number","Processor Number","R","R","R","R","R","R","R","R","0x00","Processor has failed BIST"
"0xE0","0x01","0x01","Chassis Number","Processor Number","R","R","R","R","R","R","R","R","0x00","Unable to apply processor microcode update"
"0xE0","0x01","0x02","Chassis Number","Processor Number","R","R","R","R","R","R","R","R","0x00","POST does not support current stepping level of processor"
"0xE0","0x01","0x03","Chassis Number","Processor Number","R","R","R","R","R","R","R","R","0x00","CPU mismatch detected"
"0xE0","0x02","0x00","Chassis Number","Memory Card","Memory DIMM","R","R","R","R","R","R","R","0x00","Uncorrectable memory error occurred"
"0xE0","0x02","0x01","Chassis Number","Memory Card","Memory DIMM","Failing Symbol","R","R","R","R","R","R","0x00","Correctable memory threshold occurred"
"0xE0","0x02","0x02","0x00","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x00","DIMM enabled"
"0xE0","0x02","0x02 ","0x01","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x00","DIMM disabled, failed ECC test"
"0xE0","0x02","0x02 ","0x02","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x00","DIMM disabled, failed POST/BIOS memory test"
"0xE0","0x02","0x02 ","0x03","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x00","DIMM disabled, non-supported memory device"
"0xE0","0x02","0x02 ","0x04","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x00","DIMM disabled, non-matching or missing DIMM(s)"
"0xE0","0x03","0x00","Chassis Number","Memory Card","R","R","R","R","R","R","R","R","0x00","Memory card enabled"
"0xE0","0x03","0x00","Chassis Number","Memory Card","R","R","R","R","R","R","R","R","0x00","Memory card disabled"
"0xE0","0x02","0x00","0x00","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x01","DIMM enabled"
"0xE0","0x02","0x00","0x01","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x01","DIMM disabled, failed ECC test"
"0xE0","0x02","0x00","0x02","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x01","DIMM disabled, failed POST/BIOS memory test"
"0xE0","0x02","0x00","0x03","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x01","DIMM disabled, non-supported memory device"
"0xE0","0x02","0x00","0x04","Chassis","Memory Card","Memory DIMM","R","R","R","R","R","R","0x01","DIMM disabled, non-matching or missing DIMM(s)"
"0xE1","0x00","0x00","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","Unknown SERR/PERR detected on PCI bus"
"0xE1","0x00","0x01","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Address of special cycle DPE"
"0xE1","0x00","0x02","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: Master read parity error"
"0xE1","0x00","0x03","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Received target parity error"
"0xE1","0x00","0x04","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: Master write parity error"
"0xE1","0x00","0x05","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Device signaled SERR"
"0xE1","0x00","0x06","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: Slave signaled parity error"
"0xE1","0x00","0x07","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Signaled Target Abort"
"0xE1","0x00","0x08","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: Additional Correctable ECC Error"
"0xE1","0x00","0x09","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Received Master Abort"
"0xE1","0x00","0x0A","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: Additional Uncorrectable ECC Error"
"0xE1","0x00","0x0B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Split Completion Discarded"
"0xE1","0x00","0x0C","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: Correctable ECC Error"
"0xE1","0x00","0x0D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Unexpected Split Completion"
"0xE1","0x00","0x0E","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: Uncorrectable ECC Error"
"0xE1","0x00","0x0F","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Received split completion error"
"0xE1","0x00","0x11","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Address of special cycle DPE"
"0xE1","0x00","0x12","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI-PCI bridge secondary error: Master read parity error"
"0xE1","0x00","0x13","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Received target parity error"
"0xE1","0x00","0x14","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI-PCI bridge secondary error: Master write parity error"
"0xE1","0x00","0x15","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Device Signaled SERR"
"0xE1","0x00","0x16","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI-PCI bridge secondary error: Slave Signaled Parity Error"
"0xE1","0x00","0x17","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Signaled Target Abort"
"0xE1","0x00","0x18","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI-PCI bridge secondary error: Additional Correctable ECC Error"
"0xE1","0x00","0x19","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Received Master Abort"
"0xE1","0x00","0x1A","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI-PCI bridge secondary error: Additional Uncorrectable ECC Error"
"0xE1","0x00","0x1B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Split Completion Discarded"
"0xE1","0x00","0x1C","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI-PCI bridge secondary error: Correctable ECC Error"
"0xE1","0x00","0x1D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Unexpected Split Completion"
"0xE1","0x00","0x1E","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI-PCI bridge secondary error: Uncorrectable ECC Error"
"0xE1","0x00","0x1F","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI-PCI bridge secondary error: Received split completion error"
"0xE1","0x00","0x20","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI ECC Error (Corrected)"
"0xE1","0x00","0x21","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI Bus Address Parity Error"
"0xE1","0x00","0x22","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI Bus Data Parity Error"
"0xE1","0x00","0x23","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: SERR# Asserted"
"0xE1","0x00","0x24","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PERR Received by Calgary on a PCIX Split Completion"
"0xE1","0x00","0x25","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Invalid Address"
"0xE1","0x00","0x27","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: TCE Extent Error"
"0xE1","0x00","0x29","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Page Fault"
"0xE1","0x00","0x2B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Unauthorized Access"
"0xE1","0x00","0x2D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Parity Error in DMA Read Data Buffer"
"0xE1","0x00","0x2F","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI Bus Time Out"
"0xE1","0x00","0x31","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: DMA Delayed Read Timeout"
"0xE1","0x00","0x33","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Internal Error on PCIX Split Completion"
"0xE1","0x00","0x35","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: DMA Read Reply (RIO) Timeout"
"0xE1","0x00","0x37","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Internal RAM Error on DMA Write"
"0xE1","0x00","0x39","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: MVE Valid Bit Off"
"0xE1","0x00","0x3B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: MVE Index Invalid"
"0xE1","0x00","0x40","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: ECC Error (Corrected)"
"0xE1","0x00","0x41","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: SERR# Detected"
"0xE1","0x00","0x42","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI Bus Data Parity Error"
"0xE1","0x00","0x43","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: No DEVSEL#"
"0xE1","0x00","0x45","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Bus Time Out"
"0xE1","0x00","0x47","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Retry Count Expired"
"0xE1","0x00","0x49","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Target-Abort"
"0xE1","0x00","0x4B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Invalid Size"
"0xE1","0x00","0x4D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Access Not Enabled"
"0xE1","0x00","0x4F","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Internal RAM Error on MMIO Store"
"0xE1","0x00","0x51","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Split Response Received"
"0xE1","0x00","0x53","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCIX Split Completion Error Status Received"
"0xE1","0x00","0x55","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Unexpected PCIX Split Completion Received"
"0xE1","0x00","0x57","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCIX Split Completion Timeout"
"0xE1","0x00","0x59","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Recoverable Error Summary Bit"
"0xE1","0x00","0x5B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: CSR Error Summary Bit"
"0xE1","0x00","0x5D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Internal RAM Error on MMIO Load"
"0xE1","0x00","0x61","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Bad Command"
"0xE1","0x00","0x63","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Length Field Invalid"
"0xE1","0x00","0x65","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Load Greater Than 8 & No Write Buffer Enabled"
"0xE1","0x00","0x67","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCIX Discontiguous Byte Enable Error"
"0xE1","0x00","0x69","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: 4K Address Boundary Crossing Error"
"0xE1","0x00","0x6B","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Store Wrap State Machine Check"
"0xE1","0x00","0x6D","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Target State Machine Check"
"0xE1","0x00","0x6F","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Invalid Transaction PM/DW"
"0xE1","0x00","0x71","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Invalid Transaction PM/DR"
"0xE1","0x00","0x73","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: Invalid Transaction PS/DW"
"0xE1","0x00","0x75","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: DMA Write Command FIFO Parity Error"
"0xE1","0x00","0x76","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PERR: PCI Secondary Status Register Dump"
"0xE1","0x00","0x77","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","SERR: PCI Secondary Status Register Dump"
"0xE1","0x00","0x81","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x00","PCI-to-PCI Bridge Discard Timer Error"
"0xE1","0x00","0x01","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x01","SERR detected on PCI bus"
"0xE1","0x00","0x02","Chassis Number","Slot Number","Bus Number","Device ID (LSB)","Device ID (MSB)","Vendor ID (LSB)","Vendor ID (MSB)","Status Register (LSB)","Status Register (MSB)","DevFun Number","0x01","PERR detected on PCI bus"
"0xE1","0x01","0x00","R","R","Bank (LSB)","Bank (MSB)","Apic ID (LSB)","Apic ID (MSB)","CK4(LSB)","CK4","CK4","CK4(MSB)","0x00","Processor Error Information Data A"
"0xE1","0x01","0x01","R","R","Address high (LSB)","Address high","Address high","Address high (MSB)","Address low (LSB)","Address low ","Address low ","Address low (MSB)","0x00","Processor Error Information Data B1"
"0xE1","0x01","0x02","R","R","Timestamp high (LSB)","Timestamp high","Timestamp high","Timestamp high (MSB)","Timestamp Low (LSB)","Timestamp low","Timestamp low","Timestamp low (MSB)","0x00","Processor Error Information Data B2"
"0xE1","0x01","0x03","R","R","MCA status register high (LSB)","MCA status register high","MCA status register high","MCA status register high (MSB)","MCA status register low (LSB)","MCA status register low","MCA status register low","MCA status register low (MSB)","0x00","Processor Error Information Data C"
"0xE1","0x01","0x04","Chassis","0x00","Processor ID","R","R","R","R","R","R","R","0x00","Processor recoverable error"
"0xE1","0x01","0x04","Chassis","0x01","Processor ID","R","R","R","R","R","R","R","0x00","Processor unrecoverable error"
"0xE1","0x02","0x00","0x00","Failed Row","Spare Row","R","R","R","R","R","R","R","0x00","Memory sparing event, start 1"
"0xE1","0x02","0x00","0x02","Failed Row","Spare Row","R","R","R","R","R","R","R","0x00","Memory sparing event, done 1"
"0xE1","0x02","0x00","0x01","Failed Row 1","Failed Row 2","Spare Row 1","Spare Row 2","R","R","R","R","R","0x00","Memory sparing event, start 2"
"0xE1","0x02","0x00","0x03","Failed Row 1","Failed Row 2","Spare Row 1","Spare Row 2","R","R","R","R","R","0x00","Memory sparing event, done 2"
"0xE1","0x02","0x01","Failed Port","Spare Port","R","R","R","R","R","R","R","R","0x00","Memory mirroring failover occurred"
"0xE1","0x04","0x00","0x00","FSB FERR/NERR Register","FSB FERR/NERR Register","Chassis Number","R","R","R","R","R","R","0x00","FSB A Fatal"
"0xE1","0x04","0x00","0x01","FSB FERR/NERR Register","FSB FERR/NERR Register","Chassis Number","R","R","R","R","R","R","0x00","FSB A Nonfatal"
"0xE1","0x04","0x00","0x02","FSB FERR/NERR Register","FSB FERR/NERR Register","Chassis Number","R","R","R","R","R","R","0x00","FSB B Fatal"
"0xE1","0x04","0x00","0x03","FSB FERR/NERR Register","FSB FERR/NERR Register","Chassis Number","R","R","R","R","R","R","0x00","FSB B Nonfatal"
"0xE1","0x05","0x00","0x02","Hi FERR or NERR Register","R","R","R","R","R","R","R","R","0x00","Lindenhurst Chipset Event: Hi Fatal"
"0xE1","0x05","0x00","0x03","Hi FERR or NERR Register","R","R","R","R","R","R","R","R","0x00","Lindenhurst Chipset Event: Hi Nonfatal"
"0xE1","0x05","0x01","0x02","Status Register Contents","R","R","R","R","R","R","R","R","0x00","Fatal internal north bridge error"
"0xE1","0x05","0x01","0x03","Status Register Contents","R","R","R","R","R","R","R","R","0x00","Nonfatal internal north bridge error"
"0xE2","0x00","Register ID","R","First Fire Bit","Register Data (LSB)","Register Data","Register Data","Register Data","Register Data","Register Data","Register Data","Register Data (MSB)","0x00","PCI Industry Standard Register Dump"
"0xE2","0x01","Register ID","R","First Fire Bit (0xFF if N/A)","Register Data (LSB)","Register Data","Register Data","Register Data","Register Data","Register Data","Register Data","Register Data (MSB)","0x00","PCI-X Industry Standard Register Dump"
"0xE2","0x02","Register ID","R","First Fire Bit (0xFF if N/A)","Register Data (LSB)","Register Data","Register Data","Register Data","Register Data","Register Data","Register Data","Register Data (MSB)","0x00","PCI Express Industry Standard Register Dump"
"0xE3","Platform ID","Register ID","R","R","R","R","R","R","Register Data (LSB)","Register Data","Register Data","Register Data (MSB)","0x00","RAW Hex Dump"
"0xC0","XX","XX","XX","XX","XX","XX","XX","0x00","0x00","R","R","R","0x00","PCI Event/Error Occurred. Next non-timestamped OEM SEL entry will contain details of the specific PCI event/error"
"0xC0","XX","XX","XX","XX","XX","XX","XX","0x01","0x00","R","R","R","0x00","Processor Event/Error Occurred. Next non-timestamped OEM SEL entry will contain details of the specific PCI event/error"
"0xC0","XX","XX","XX","XX","XX","XX","XX","0x02","0x00","R","R","R","0x00","Memory Event/Error Occurred. Next non-timestamped OEM SEL entry will contain details of the specific PCI event/error"
"0xC0","XX","XX","XX","XX","XX","XX","XX","0x03","0x00","R","R","R","0x00"," Scalability Event/Error Occurred. Next non-timestamped OEM SEL entry will contain details of the specific PCI event/error"
"0xC0","XX","XX","XX","XX","XX","XX","XX","0x04","0x00","R","R","R","0x00","Bus PCI Event/Error Occurred. Next non-timestamped OEM SEL entry will contain details of the specific PCI event/error"
"0xC0","XX","XX","XX","XX","XX","XX","XX","0x05","0x00","R","R","R","0x00","Chipset Event/Error Occurred. Next non-timestamped OEM SEL entry will contain details of the specific PCI event/error"

View File

@ -27,15 +27,11 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = pkginfo.in prototype.in ipmitool.spec.in \
rpmrc rpmmacros
EXTRA_DIST = pkginfo.in prototype.in \
ipmitool.spec.in rpmmacros.in rpmrc
dist-hook: pkginfo prototype
dist-hook: pkginfo prototype rpmmacros

View File

@ -1,11 +1,11 @@
Name: ipmitool
Summary: ipmitool - Utility for IPMI control
Version: @VERSION@
Release: 1%{?_distro:.%{_distro}}
Copyright: BSD
Release: @RPM_RELEASE@%{?_distro:.%{_distro}}
License: BSD
Group: Utilities
Packager: Duncan Laurie <duncan@iceblink.org>
Source: ipmitool-@VERSION@.tar.gz
Source: %{name}-%{version}.tar.gz
Buildroot: /var/tmp/ipmitool-root
%description
@ -32,8 +32,10 @@ fi
%build
./configure --with-kerneldir \
--with-rpm-distro=@DISTRO@ \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--sbindir=%{_sbindir} \
--datadir=%{_datadir} \
--includedir=%{_includedir} \
--libdir=%{_libdir} \
@ -48,16 +50,147 @@ make DESTDIR=$RPM_BUILD_ROOT install-strip
if [ "$RPM_BUILD_ROOT" ] && [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
rm -rf $RPM_BUILD_DIR/ipmitool-@VERSION@
%files
%defattr(-,root,root)
%{_bindir}/*
%{_datadir}/ipmitool/*
%doc %{_mandir}/man1/*
%doc %{_datadir}/doc/ipmitool/*
%defattr(755,root,root)
%attr(755,root,root) %{_bindir}/*
%attr(755,root,root) %{_sbindir}/*
%{_mandir}/man*/*
%doc %{_datadir}/doc/ipmitool
%changelog
* Tue Mar 6 2007 <pere@hungry.com> 1.8.9-1
- Added initial AMC ekey query operation support
- Improvements to ekeying support (PICMG 3.x only)
- Added initial interactive edition support for multirec; added IANA
verification before interpreting PICMG records.
- Added edit support for AMC activation "Maximum Internal Current"
- Fix bug generating garbage on the screen when handling GetDeviceId
and sol traffic occurs
- Added ability to map OEM sensor types to OEM description string using
IANA number; moved IANA number table
- Fix lan set access command to use value already saved within parameters
for PEF and authentication
- Fix bug in cmd ipmitool lan stats get 1
- Add support to allow ipmitool/ipmievd to target specific device nodes
on multi-BMC systems
- Add support for name+privilege lookup for lanplus sessions
- Fix time_t conversion bug for 64-bit OS
- Added prefix of hostname on sel ipmievd sessions
- Fixed FWUM Get Info
- Fix ipmievd fd closing bug
- Add set-in-progress flag support to chassis bootdev
- Added new chassis bootdev options
- Add sol payload enable/disable comman
- Fix SOL set errors when commit-write not supported
- Fix reset of session timeout for lanplus interface
- Fixed lan interface accessibility timeout handling
- Fix bug with Function Get Channel Cipher Suites command when more
than 1 page used.
- Fix missing firmware firewall top-level command
- Fix bug in SOL keepalive functionality
- Fix SOLv2 NACK and retry handling for Intel ESB2 BMC
- Added ipmi_sel_get_oem_sensor* APIs
- Added HPM.1 support
- Fix segfault when incorrect oem option supplied
- Fix bus problem with spd command
- Fix segfault in SOL when remote BMC does not return packet
- Adjust packet length for AMC.0 retricting IPMB packets to 32 bytes
- Added lan packet size reduction mechanism
- Fix bug with sendMessage of bad length with different target
- Fix for big endian (PPC) architecture
- NetBSD fixes
- Fix segfault and channel problem with user priv command
- Add support for bus/chan on i2c raw command
- Add freeipmi interface support
- Add remote spd printing
- Add better detection of linux/compiler.h to config
- Makefile changes to fix makedistcheck, etc.
* Tue May 02 2006 <duncan@iceblink.org> 1.8.8-1
- Fix segfaults in sensor data repository list
- Fix ipmievd to open interface before daemonizing
- Fix IPMIv1.5 authtype NONE to ignore supplied password
- Fix cipher suite display bug in lan print
- Fix typo in IPMIv2 SOL output when sending break
- Fix improper LUN handling with Tyan SOL
- Add LUN support to OpenIPMI interface
- Add support for Kontron OEM commands
- Update to Kontron Firmware Update command
* Sun Mar 19 2006 <duncan@iceblink.org> 1.8.7-1
- Add Sun OEM command for blades
- Increase argument size for raw commands in shell/exec
- Fix handling of LUNs for LAN interfaces
- Add IPMIv2 SOL loopback test
- Add support for IBM OEM SEL messages
- Disable file paranoia checks on read files by default
- Support IPMIv2 SOL on older Intel boxes
- Display message and exit if keepalive fails during SOL
- Add support for setting VLAN id and priority
- Add support for FreeBSD OpenIPMI-compatible driver
- Add support for IPMIv2 Firmware Firewall
- Fix gcc4 compile warnings
- Make ipmievd generate pidfile
- Add initscripts for ipmievd
* Mon Jan 17 2006 <duncan@iceblink.org> 1.8.6-1
- Fix memory corruption when sending encrypted SOL traffic
- Add keepalive timer to IPMIv2 SOL sessions
* Sat Jan 14 2006 <duncan@iceblink.org> 1.8.5-1
- Raise privilege level after creating IPMIv2 session
- Add support for settable SOL escape character with -e option
- Add support for Kg BMC key for IPMIv2 authentication with -k option
- Add support for Tyan IPMIv1.5 SOL with tsol command
- Add support for PICMG devices
- Add support for OEM SEL event parsing
- Add support for command bridging over lan and lanplus interfaces
- New 'chassis selftest' command
- Many bufxies and patches from contributors
* Wed May 18 2005 <duncan@iceblink.org> 1.8.2-1
- Fix FRU reading for large (>255 bytes) areas.
- Overhaul to ipmievd to support SEL polling in addition to OpenIPMI.
- Fix LAN parameter segfault when no Ciphers supported by BMC.
- Fix IPMIv2 support on Intel v2 BMCs (use -o intelplus).
- Separate option parsing code from main ipmitool source file.
- Add raw I2C support with IPMI Master Read-Write command.
- Add support for new 'sdr elist' extended output format.
- Add support for listing sensors by type with 'sdr type' command.
- Add support for new 'sel elist' extended output format that
cross-references events with sensors.
- Add support for sending dynamically generated platform events
based on existing sensor information.
- New '-S' argument to read local SDR cache created with 'sdr dump'.
- Updated manpage for ipmitool and ipmievd.
* Wed Apr 06 2005 <duncan@iceblink.org> 1.8.1-1
- Install ipmievd into /usr/sbin
* Wed Mar 16 2005 <duncan@iceblink.org> 1.8.0-1
- Fix IPMIv2.0 issues
- Fix chassis boot parameter support
- Add support for linear sensors
- Update bmc plugin to work with new Solaris bmc driver (new ioctl
for interface detection and new STREAMS message-based interface)
* Tue Jan 18 2005 <duncan@iceblink.org> 1.7.0-1
- Propogate errors correctly so exit status will be useful
- More consistent display of errors including completion code text
- Errors and debug is send to stderr now
- New "sel get" command that will print details about SEL entry
and corresponding SDR records as well as FRUs via entity association
- Improved event generator, now supports reading events from text file
- New "-o oemtype" option for specifying OEM boards
exsting types are "supermicro" and "intelwv2"
- New PEF subsystem from Tim Murphy at Dell
- New "bmc" plugin for Solaris 10 x86
- Many bugfixes and contributed patches
- Support for Supermicro BMC OEM authentication method
- Fix minor problem with LAN parameter setting
* Wed Aug 18 2004 <duncan@iceblink.org> 1.6.0-1
- Add a README
- Add support for IPMIv2 and Serial-over-LAN from Newisys

View File

@ -4,7 +4,7 @@ ARCH="@ARCH@"
VERSION="@VERSION@"
CATEGORY="system"
VENDOR="Duncan Laurie"
EMAIL="duncan@sun.com"
EMAIL="duncan@iceblink.org"
PSTAMP="@PSTAMP@"
BASEDIR="@BASEDIR@"
CLASSES="none"

View File

@ -1,7 +1,12 @@
i pkginfo
d none bin ? ? ?
f none bin/@PACKAGE@=../src/@PACKAGE@ 0755 root bin
d none sbin ? ? ?
f none sbin/ipmievd=../src/ipmievd 0755 root bin
d none share ? ? ?
d none share/man ? ? ?
d none share/man/man1 ? ? ?
f none share/man/man1/@PACKAGE@.1=../doc/@PACKAGE@.1 0644 root bin
d none share/man/man8 ? ? ?
f none share/man/man8/ipmievd.8=../doc/ipmievd.8 0644 root bin

View File

@ -6,6 +6,7 @@
%_buildroot %{_topdir}/%{_tmppath}/%{name}-%{version}-root
%_rpmdir %{_topdir}/RPMS
%_srcrpmdir %{_topdir}/SRPMS
%_distro @DISTRO@
%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%packager duncan@iceblink.org
%distribution Sourceforge Build

View File

@ -1 +1,8 @@
macrofiles: /usr/lib/rpm/macros:/usr/lib/rpm/%{_target}/macros:/etc/rpm/macros.specspo:/etc/rpm/macros:/etc/rpm/%{_target}/macros:%(echo $CONFIGDIR)/rpmmacros
buildarchtranslate: athlon: i386
buildarchtranslate: i686: i386
buildarchtranslate: i586: i386
buildarchtranslate: i486: i386
buildarchtranslate: i386: i386

View File

@ -0,0 +1,5 @@
For more information about setting up your Debian system with IPMI
please see the excellent howto by Tim Small:
http://buttersideup.com/docs/howto/IPMI_on_Debian.html

View File

@ -1,3 +1,146 @@
ipmitool (1.8.7-2) unstable; urgency=low
* Fix typo in init.d/ipmievd. (Closes: #361309)
-- Petter Reinholdtsen <pere@debian.org> Sat, 8 Apr 2006 06:44:31 +0200
ipmitool (1.8.7-1) unstable; urgency=low
* New upstream version.
- Dropped nuclear clause from the copyright. Updated debian/copyright
to reflect this.
- ipmievd now store pid in /var/run/ipmievd.pid. Adjust init.d
script to use it.
* Rename /etc/default/ipmievd variable IPMIEVD_OPTS is renamed to
IPMIEVD_OPTIONS to stay compatible with upstream and other
distributions. Add backwards compatibility code with a warning to
the users of the old variable.
-- Petter Reinholdtsen <pere@debian.org> Sun, 26 Mar 2006 21:11:08 +0200
ipmitool (1.8.6-2) unstable; urgency=low
* Add ia64 as an supported arch. (Closes: #355930)
-- Petter Reinholdtsen <pere@debian.org> Fri, 10 Mar 2006 23:34:50 +0100
ipmitool (1.8.6-1) unstable; urgency=low
* New upstream version.
- Avoid crashing when setting lan IP address. (Closes: #351205)
* Avoid changing history by reverding upstream change
to email addresses in debian/changelog.
* Correct typo in control file: Suggest -> Suggests. Thanks
to Philipp Matthias Hahn for the report.
* Add init.d/ipmievd script. Based on script from Elmar Hoffmann,
slightly modified to use lsb-base functions. Added dependency on
lsb-base. (Closes: #345994)
-- Petter Reinholdtsen <pere@debian.org> Sun, 26 Feb 2006 10:31:14 +0100
ipmitool (1.8.2-2) unstable; urgency=low
* Add build-dependency on 'libreadline5-dev | libreadline-dev' to make
sure all archs get readline support. (Closes: #326341)
* Add build-dependency on libssl-dev to enable SSL support on
all archs.
* Updated Standards-Version to 3.6.2.1. (No updates required)
-- Petter Reinholdtsen <pere@debian.org> Sat, 3 Sep 2005 19:18:51 +0200
ipmitool (1.8.2-1) unstable; urgency=low
* New upstream release.
- Fix FRU reading for large (>255 bytes) areas.
- Overhaul to ipmievd to support SEL polling in addition to OpenIPMI.
- Fix LAN parameter segfault when no Ciphers supported by
BMC. (Closes: #306806)
- Fix IPMIv2 support on Intel v2 BMCs (use -o intelplus).
- Separate option parsing code from main ipmitool source file.
- Add raw I2C support with IPMI Master Read-Write command.
- Add support for new 'sdr elist' extended output format.
- Add support for listing sensors by type with 'sdr type' command.
- Add support for new 'sel elist' extended output format that
cross-references events with sensors.
- Add support for sending dynamically generated platform events
based on existing sensor information.
- New '-S' argument to read local SDR cache created with 'sdr dump'.
- Updated manpage for ipmitool and ipmievd. (Closes: #306894)
* Correct the upstream URL in debian/changelog to the current one.
* Suggest package openipmi. (Closes: #305629)
* Add debian/watch file to detect new source versions.
-- Petter Reinholdtsen <pere@debian.org> Sun, 5 Jun 2005 10:29:18 +0200
ipmitool (1.8.1-1) unstable; urgency=low
* New upstream release.
* Install ipmievd into /usr/sbin/.
-- Petter Reinholdtsen <pere@debian.org> Thu, 7 Apr 2005 01:18:44 +0200
ipmitool (1.8.0-1) unstable; urgency=low
* Initial upload into Debian, based on the upstream build
rules. (Closes: #299924)
* Convert debian/changelog to UTF-8.
* Change section from 'contrib' to 'utils'.
* Build-depend on debhelper (>> 4.0.0) to match the rules file.
* Set Standards-version to 3.6.1.
* Make sure binary dependency is properly generated.
* Add long description, copied from the project README.
* Drop useless provides 'ipmitool', as the package is called 'ipmitool'.
* Don't install the COPYING file, as the license text already is
included in debian/copyright.
* Remove unused parts of the rules file.
* Correct clean target in rules file, to use 'distclean' and remove
configure-stamp not bogus config-stamp.
-- Petter Reinholdtsen <pere@debian.org> Sun, 3 Apr 2005 20:52:02 +0200
ipmitool (1.8.0) unstable; urgency=low
* Fix IPMIv2.0 issues
* Fix chassis boot parameter support
* Add support for linear sensors
-- Duncan Laurie <duncan@iceblink.org> Wed, Mar 16 2005 17:08:12 -0700
ipmitool (1.7.1) unstable; urgency=low
* Update bmc plugin to work with new Solaris bmc driver (new ioctl
for interface detection and new STREAMS message-based interface).
-- Seth Goldberg <sethmeisterg@hotmail.com> Mon, Mar 7 2005 18:03:00 -0800
ipmitool (1.7.0) unstable; urgency=low
* Propogate errors correctly so exit status will be useful
* More consistent display of errors including completion code text
* Errors and debug is send to stderr now
* New "sel get" command that will print details about SEL entry
and corresponding SDR records as well as FRUs via entity association
* Improved event generator, now supports reading events from text file
* New "-o oemtype" option for specifying OEM boards
exsting types are "supermicro" and "intelwv2"
* New PEF subsystem
* New "bmc" plugin for Solaris 10 x86
* Many bugfixes and contributed patches
-- Duncan Laurie <duncan@iceblink.org> Fri, Jan 7 2005 19:58:22 -0700
ipmitool (1.6.2) unstable; urgency=low
* Support for Supermicro BMC OEM authentication method
-- Duncan Laurie <duncan@iceblink.org> Mon, 16 Nov 2004 08:20:01 -0700
ipmitool (1.6.1) unstable; urgency=low
* Fix minor problem with LAN parameter setting
-- Duncan Laurie <duncan@iceblink.org> Wed, 29 Sep 2004 11:19:17 -0700
ipmitool (1.6.0) unstable; urgency=low
* Add a README
@ -27,7 +170,7 @@ ipmitool (1.5.9) unstable; urgency=low
* Add configure option for changing binary to ipmiadm for Solaris
* Fix compile problem on Solaris 8
-- Duncan Laurie <duncan@sun.com> Sat, 27 Mar 2004 00:11:37 -0700
-- Duncan Laurie <duncan@iceblink.org> Sat, 27 Mar 2004 00:11:37 -0700
ipmitool (1.5.8) unstable; urgency=low
@ -41,7 +184,7 @@ ipmitool (1.5.8) unstable; urgency=low
* Add support for Linux kernel panic messages in SEL output
* Add support for type 3 SDR records
-- Duncan Laurie <duncan@sun.com> Tue, 27 Jan 2004 16:23:25 -0700
-- Duncan Laurie <duncan@iceblink.org> Tue, 27 Jan 2004 16:23:25 -0700
ipmitool (1.5.7) unstable; urgency=low
@ -50,49 +193,49 @@ ipmitool (1.5.7) unstable; urgency=low
* better handling of SDR printing
* contrib scripts for creating rrdtool graphs
-- Duncan Laurie <duncan@sun.com> Mon, 5 Jan 2004 17:29:50 -0700
-- Duncan Laurie <duncan@iceblink.org> Mon, 5 Jan 2004 17:29:50 -0700
ipmitool (1.5.6) unstable; urgency=low
* Fix SEL event decoding for generic events
* Handle empty SEL gracefully when doing "sel list"
* Fix sdr handling of sensors that do not return a reading
* Fix for CSV display of sensor readings/units from Fredrik <EFBFBD>hrn
* Fix for CSV display of sensor readings/units from Fredrik Öhrn
-- Duncan Laurie <duncan@sun.com> Thu, 4 Dec 2003 14:47:19 -0700
-- Duncan Laurie <duncan@iceblink.org> Thu, 4 Dec 2003 14:47:19 -0700
ipmitool (1.5.5) unstable; urgency=low
* Add -U option for setting LAN username
* Fix -v usage for plugin interfaces
-- Duncan Laurie <duncan@sun.com> Tue, 25 Nov 2003 15:10:48 -0700
-- Duncan Laurie <duncan@iceblink.org> Tue, 25 Nov 2003 15:10:48 -0700
ipmitool (1.5.4) unstable; urgency=low
* Put interface plugin API into library
* Fix ipmievd
-- Duncan Laurie <duncan@sun.com> Fri, 14 Nov 2003 15:16:34 -0700
-- Duncan Laurie <duncan@iceblink.org> Fri, 14 Nov 2003 15:16:34 -0700
ipmitool (1.5.3) unstable; urgency=low
* Add -g option to work with grizzly bmc
-- Duncan Laurie <duncan@sun.com> Mon, 3 Nov 2003 18:04:07 -0700
-- Duncan Laurie <duncan@iceblink.org> Mon, 3 Nov 2003 18:04:07 -0700
ipmitool (1.5.2) unstable; urgency=low
* add support for setting gratuitous arp interval
-- Duncan Laurie <duncan@sun.com> Fri, 24 Oct 2003 11:00:00 -0700
-- Duncan Laurie <duncan@iceblink.org> Fri, 24 Oct 2003 11:00:00 -0700
ipmitool (1.5.1) unstable; urgency=low
* better SEL support
* fix display bug in SDR list
-- Duncan Laurie <duncan@sun.com> Wed, 8 Oct 2003 17:28:51 -0700
-- Duncan Laurie <duncan@iceblink.org> Wed, 8 Oct 2003 17:28:51 -0700
ipmitool (1.5.0) unstable; urgency=low
@ -100,24 +243,24 @@ ipmitool (1.5.0) unstable; urgency=low
* add Intel IMB driver support
* use autoconf/automake/libtool
-- Duncan Laurie <duncan@sun.com> Fri, 5 Sep 2003 11:57:32 -0700
-- Duncan Laurie <duncan@iceblink.org> Fri, 5 Sep 2003 11:57:32 -0700
ipmitool (1.2-1) unstable; urgency=low
* New command line option parsing
* More chassis commands supported
-- Duncan Laurie <duncan@sun.com> Wed, 2 Apr 2003 17:44:17 -0700
-- Duncan Laurie <duncan@iceblink.org> Wed, 2 Apr 2003 17:44:17 -0700
ipmitool (1.1-1) unstable; urgency=low
* Minor fixes.
-- Duncan Laurie <duncan@sun.com> Tue, 1 Apr 2003 14:31:10 -0700
-- Duncan Laurie <duncan@iceblink.org> Tue, 1 Apr 2003 14:31:10 -0700
ipmitool (1.0-1) unstable; urgency=low
* Initial Release.
-- Duncan Laurie <duncan@sun.com> Sun, 30 Mar 2003 21:30:46 -0700
-- Duncan Laurie <duncan@iceblink.org> Sun, 30 Mar 2003 21:30:46 -0700

View File

@ -1,12 +1,28 @@
Source: ipmitool
Section: contrib
Section: utils
Priority: optional
Maintainer: Duncan Laurie <duncan@iceblink.org>
Build-Depends: debhelper (>> 3.0.0)
Standards-Version: 3.5.8
Maintainer: Petter Reinholdtsen <pere@debian.org>
Uploaders: Duncan Laurie <duncan@iceblink.org>
Build-Depends: debhelper (>> 4.0.0), libreadline5-dev | libreadline-dev, libssl-dev
Standards-Version: 3.6.2.1
Package: ipmitool
Architecture: i386 amd64
Provides: ipmitool
Description: Utility for IPMI control with kernel driver or LAN interface
Architecture: i386 amd64 ia64
Depends: ${shlibs:Depends}, lsb-base
Suggests: openipmi
Description: utility for IPMI control with kernel driver or LAN interface
A utility for managing and configuring devices that support the
Intelligent Platform Management Interface. IPMI is an open standard
for monitoring, logging, recovery, inventory, and control of hardware
that is implemented independent of the main CPU, BIOS, and OS. The
service processor (or Baseboard Management Controller, BMC) is the
brain behind platform management and its primary purpose is to handle
the autonomous sensor monitoring and event logging features.
.
The ipmitool program provides a simple command-line interface to this
BMC. It features the ability to read the sensor data repository
(SDR) and print sensor values, display the contents of the System
Event Log (SEL), print Field Replaceable Unit (FRU) inventory
information, read and set LAN configuration parameters, and perform
remote chassis power control.

View File

@ -1,7 +1,10 @@
ipmitool
Duncan Laurie <duncan@sun.com>
http://www.iceblink.org/ipmitool/
This package was debianized by Duncan Laurie before
2003-11-18 17:55:21 +0100.
It was downloaded from <URL:http://ipmitool.sourceforge.net/>
Upstream Author: Duncan Laurie <duncan@iceblink.org>
Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
@ -31,8 +34,3 @@ OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
You acknowledge that this software is not designed or intended for use
in the design, construction, operation or maintenance of any nuclear
facility.

View File

@ -1,3 +1,4 @@
usr/bin
usr/sbin
usr/share/ipmitool
usr/share/doc/ipmitool

View File

@ -1,4 +1,2 @@
README
COPYING
AUTHORS
ChangeLog

View File

@ -0,0 +1,99 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: ipmievd
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop: $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: IPMI event daemon
# Description: ipmievd is a daemon which will listen for events
# from the BMC that are being sent to the SEL and
# also log those messages to syslog.
### END INIT INFO
#
# Author: Elmar Hoffmann <elho@elho.net>
# Licence: This script is public domain using the same
# licence as ipmitool itself.
# Modified by: Petter Reinholdtsen
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="IPMI event daemon"
NAME=ipmievd
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
. /etc/default/rcS
# Options used by ipmievd.
#
# "open" uses the asynchronous event notification from the OpenIPMI
# kernel driver, "sel" uses active polling of the contents of the SEL
# for new events.
#
# Need to force 'daemon' mode, to make sure messages are sent to
# syslog and the program forks into the background.
#
# Se ipmievd(8) for more info.
IPMIEVD_OPTIONS="open daemon"
# Read config file if it is present.
[ -f /etc/default/$NAME ] && . /etc/default/$NAME
# Backwards compatibility with version 1.8.6-2 and 1.8.6-1. The
# variable was renamed to be compatible with upstream, SuSe and RedHat.
if [ -n "$IPMIEVD_OPTS" ]; then
echo "warning: /etc/default/$NAME variable IPMIEVD_OPTS should be renamed to IPMIEVD_OPTIONS"
IPMIEVD_OPTIONS="$IPMIEVD_OPTS"
fi
#
# Function that starts the daemon/service.
#
d_start() {
start-stop-daemon --start --quiet --exec $DAEMON -- $IPMIEVD_OPTIONS
}
#
# Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --quiet --name $NAME --exec $DAEMON
}
CODE=0
case "$1" in
start)
[ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME"
d_start || CODE=$?
[ "$VERBOSE" != no ] && log_end_msg $CODE
exit $CODE
;;
stop)
log_begin_msg "Stopping $DESC" "$NAME"
d_stop || CODE=$?
log_end_msg $CODE
exit $CODE
;;
restart|force-reload)
log_begin_msg "Restarting $DESC" "$NAME"
d_stop || true
sleep 1
d_start || CODE=$?
log_end_msg $CODE
exit $CODE
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@ -41,10 +41,10 @@ build-indep-stamp: configure-stamp
clean:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp config-stamp
rm -f build-arch-stamp build-indep-stamp configure-stamp
# Add here commands to clean up after the build process.
-$(MAKE) clean
-$(MAKE) distclean
dh_clean
@ -71,6 +71,17 @@ install-arch:
# debian/tmp.
$(MAKE) install DESTDIR=$(CURDIR)/debian/ipmitool
# No need to have two copies of the license text in the package.
$(RM) $(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/COPYING
# Move upstream changelog to correct filename.
mv $(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/ChangeLog \
$(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/changelog
# Compress to avoid lintian warning. Not sure why dh_compress
# isn't fixing this.
gzip -9 $(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/changelog
# dh_movefiles -a
# Must not depend on anything. This is to be called by
# binary-arch/binary-multi
@ -78,27 +89,16 @@ install-arch:
binary-common:
dh_testdir
dh_testroot
# dh_installdebconf
dh_installdocs
# dh_installexamples
# dh_installmenu
# dh_installemacsen
# dh_installpam
# dh_installinit
# dh_installcron
# dh_installmanpages
# dh_installinfo
# dh_undocumented
# dh_installchangelogs
dh_installchangelogs
dh_installinit --name ipmievd
dh_link
dh_strip
dh_compress
dh_fixperms
# You may want to make some executables suid here.
# dh_suidregister
dh_makeshlibs
dh_shlibdeps
dh_installdeb
# dh_perl
dh_gencontrol
dh_md5sums
dh_builddeb

6
ipmitool/debian/watch Normal file
View File

@ -0,0 +1,6 @@
# Rename this file to "watch" and then you can run the "uscan" command
# to check for upstream updates and more.
# Site Directory Pattern Version Script
version=2
http://heanet.dl.sourceforge.net/sourceforge/ipmitool/ipmitool-(.*).tar.bz2
# debian uupdate

View File

@ -27,14 +27,10 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
MAINTAINERCLEANFILES = Makefile.in
man_MANS = ipmitool.1
man_MANS = ipmitool.1 ipmievd.8
EXTRA_DIST = $(man_MANS)

231
ipmitool/doc/ipmievd.8 Normal file
View File

@ -0,0 +1,231 @@
.TH "ipmievd" "8" "" "Duncan Laurie" ""
.SH "NAME"
ipmievd \- IPMI event daemon for sending events to syslog
.SH "SYNOPSIS"
ipmievd [\fB\-c\fR|\fB\-h\fR|\fB\-d \fIN\fP\fR|\fB\-v\fR|\fB\-V\fR]
\fB\-I\fR \fIopen\fP <\fIopen\fR | \fIsel\fR> [<\fIoption\fP>]
ipmievd [\fB\-c\fR|\fB\-h\fR|\fB\-v\fR|\fB\-V\fR]
\fB\-I\fR \fIlan\fP \fB\-H\fR <\fIhostname\fP>
[\fB\-p\fR <\fIport\fP>]
[\fB\-U\fR <\fIusername\fP>]
[\fB\-A\fR <\fIauthtype\fP>]
[\fB\-L\fR <\fIprivlvl\fP>]
[\fB\-a\fR|\fB\-E\fR|\fB\-P\fR|\fB\-f\fR <\fIpassword\fP>]
[\fB\-o\fR <\fIoemtype\fP>]
[\fB\-O\fR <\fIsel oem\fP>]
\fIsel\fP [<\fIoption\fP>]
ipmievd [\fB\-c\fR|\fB\-h\fR|\fB\-v\fR|\fB\-V\fR]
\fB\-I\fR \fIlanplus\fP \fB\-H\fR <\fIhostname\fP>
[\fB\-p\fR <\fIport\fP>]
[\fB\-U\fR <\fIusername\fP>]
[\fB\-L\fR <\fIprivlvl\fP>]
[\fB\-a\fR|\fB\-E\fR|\fB\-P\fR|\fB\-f\fR <\fIpassword\fP>]
[\fB\-o\fR <\fIoemtype\fP>]
[\fB\-O\fR <\fIsel oem\fP>]
[\fB\-C\fR <\fIciphersuite\fP>]
\fIsel\fR [<\fIoption\fP>]
.SH "DESCRIPTION"
\fBipmievd\fP is a daemon which will listen for events from the
BMC that are being sent to the SEL and also log those messages to
syslog. It is able to run in one of two modes: either using the
Event Message Buffer and asynchronous event notification from the
OpenIPMI kernel driver or actively polling the contents of the
SEL for new events. Upon receipt of an event via either mechanism
it will be logged to syslog with the \fILOG_LOCAL4\fP facility.
It is based on the \fBipmitool\fR utility and shares the same IPMI
interface support and session setup options. Please see the
\fBipmitool\fR manpage for more information on supported IPMI
interfaces.
.SH "OPTIONS"
.TP
\fB\-a\fR
Prompt for the remote server password.
.TP
\fB\-A\fR <\fIauthtype\fP>
Specify an authentication type to use during IPMIv1.5 \fIlan\fP
session activation. Supported types are NONE, PASSWORD, MD2, MD5, or OEM.
.TP
\fB\-c\fR
Present output in CSV (comma separated variable) format.
This is not available with all commands.
.TP
\fB\-C\fR <\fIciphersuite\fP>
The remote server authentication, integrity, and encryption algorithms
to use for IPMIv2 \fIlanplus\fP connections. See table 22\-19 in the
IPMIv2 specification. The default is 3 which specifies RAKP\-HMAC\-SHA1
authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128 encryption algorightms.
.TP
\fB\-E\fR
The remote server password is specified by the environment
variable \fIIPMI_PASSWORD\fP.
.TP
\fB\-f\fR <\fIpassword_file\fP>
Specifies a file containing the remote server password. If this
option is absent, or if password_file is empty, the password
will default to NULL.
.TP
\fB\-h\fR
Get basic usage help from the command line.
.TP
\fB\-H\fR <\fIaddress\fP>
Remote server address, can be IP address or hostname. This
option is required for \fIlan\fP and \fIlanplus\fP interfaces.
.TP
\fB\-I\fR <\fIinterface\fP>
Selects IPMI interface to use. Supported interfaces that are
compiled in are visible in the usage help output.
.TP
\fB\-L\fR <\fIprivlvl\fP>
Force session privilege level. Can be CALLBACK, USER,
OPERATOR, ADMIN. Default is ADMIN.
.TP
\fB\-m\fR <\fIlocal_address\fP>
Set the local IPMB address. The default is 0x20 and there
should be no need to change it for normal operation.
.TP
\fB\-o\fR <\fIoemtype\fP>
Select OEM type to support. This usually involves minor hacks
in place in the code to work around quirks in various BMCs from
various manufacturers. Use \fI\-o list\fP to see a list of
current supported OEM types.
.TP
\fB\-O\fR <\fIsel oem\fP>
Open selected file and read OEM SEL event descriptions to be used
during SEL listings. See examples in contrib dir for file format.
.TP
\fB\-p\fR <\fIport\fP>
Remote server UDP port to connect to. Default is 623.
.TP
\fB\-P\fR <\fIpassword\fP>
Remote server password is specified on the command line.
If supported it will be obscured in the process list.
\fBNote!\fR Specifying the password as a command line
option is not recommended.
.TP
\fB\-S\fR <\fIsdr_cache_file\fP>
Use local file for remote SDR cache. Using a local SDR cache
can drastically increase performance for commands that require
knowledge of the entire SDR to perform their function.
.TP
\fB\-t\fR <\fItarget_address\fP>
Bridge IPMI requests to the remote target address.
.TP
\fB\-U\fR <\fIusername\fP>
Remote server username, default is NULL user.
.TP
\fB\-d \fIN\fP\fR
Use device number N to specify the /dev/ipmiN (or
/dev/ipmi/N or /dev/ipmidev/N) device to use for in-band
BMC communication. Used to target a specific BMC on a
multi-node, multi-BMC system through the ipmi device
driver interface. Default is 0.
.TP
\fB\-v\fR
Increase verbose output level. This option may be specified
multiple times to increase the level of debug output. If given
three times you will get hexdumps of all incoming and
outgoing packets.
.TP
\fB\-V\fR
Display version information.
.LP
If no password method is specified then ipmievd will prompt the
user for a password. If no password is entered at the prompt,
the remote server password will default to NULL.
.SH "COMMANDS"
.TP
\fIhelp\fP
This can be used to get command\-line help. It may also be
placed at the end of commands to get option usage help.
> ipmievd help
.br
Commands:
open Use OpenIPMI for asyncronous notification of events
sel Poll SEL for notification of events
.TP
\fIopen\fP
This command starts ipmievd with the OpenIPMI event watching
mechanism which relies on the Event Message Buffer feature of
IPMI. This requires a properly installed and configured
OpenIPMI driver on Linux and is only valid to be run through
the \fIopen\fP interface. See the \fBipmitool\fR manpage
and associated documentation for more information on setting
up the OpenIPMI driver.
\fBNote\fR: Some BMC do not support the Event Message Buffer
required for this command. Other BMCs claim to support it but
do not actually deliver events to it. If this is the case please
use the \fIsel\fP method.
.RS
.TP
\fIdaemon\fP
Launch process as a daemon and reparent to init process.
All messages will be sent to syslog. This is the default action.
.TP
\fInodaemon\fP
Do NOT become a daemon, instead log all messages to stderr.
.TP
\fIpidfile\fP=<\fBfilename\fR>
Save process ID to this file when in daemon mode. Defaults to
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
number -- defaults to 0).
.RE
.TP
\fIsel\fP
This command starts ipmievd with the SEL Polling event watching
mechanism. This will poll the SEL periodically to determine if
new events have been logged. This command should work with all
BMCs and is capable of using the LAN interface as well to monitor
a remote system and log its events to a local syslog.
.RS
.TP
\fIdaemon\fP
Launch process as a daemon and reparent to init process.
All messages will be sent to syslog. This is the default action.
.TP
\fInodaemon\fP
Do NOT become a daemon, instead log all messages to stderr.
.TP
\fIpidfile\fP=<\fBfilename\fR>
Save process ID to this file when in daemon mode. Defaults to
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
number -- defaults to 0).
.TP
\fItimeout\fP=<\fBseconds\fR>
Time between checks for SEL polling method. Default is 10 seconds.
.RE
.SH "EXAMPLES"
.TP
\fIExample 1\fP: Daemon process watching OpenIPMI for events
> ipmievd \-I open open daemon
.TP
\fIExample 2\fP: Local non\-daemon process checking remote SEL every 30 seconds
> ipmievd \-I lan \-H 1.2.3.4 \-f passfile sel nodaemon timeout=30
.br
Reading Sensors...
.br
Waiting for Events...
.br
.SH "AUTHOR"
Duncan Laurie <duncan@iceblink.org>
.SH "SEE ALSO"
.TP
IPMItool Homepage
http://ipmitool.sourceforge.net
.TP
Intelligent Platform Management Interface Specification
http://www.intel.com/design/servers/ipmi
.TP
OpenIPMI Homepage
http://openipmi.sourceforge.net

File diff suppressed because it is too large Load Diff

View File

@ -27,10 +27,6 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
MAINTAINERCLEANFILES = Makefile.in

View File

@ -27,16 +27,15 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = log.h bswap.h helper.h ipmi.h ipmi_intf.h \
ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_lanp.h \
ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_bmc.h ipmi_raw.h \
noinst_HEADERS = log.h bswap.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \
ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_hpmfwupg.h ipmi_lanp.h \
ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_mc.h ipmi_raw.h \
ipmi_channel.h ipmi_sensor.h ipmi_event.h ipmi_session.h \
ipmi_strings.h ipmi_constants.h ipmi_isol.h ipmi_user.h
ipmi_strings.h ipmi_constants.h ipmi_user.h ipmi_pef.h \
ipmi_oem.h ipmi_isol.h ipmi_sunoem.h ipmi_picmg.h \
ipmi_fwum.h ipmi_main.h ipmi_tsol.h ipmi_firewall.h \
ipmi_kontronoem.h

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_BSWAP_H
@ -41,6 +37,9 @@
# include <config.h>
#endif
#undef BSWAP_16
#undef BSWAP_32
#if HAVE_BYTESWAP_H
# include <byteswap.h>
# define BSWAP_16(x) bswap_16(x)

View File

@ -28,41 +28,69 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_HELPER_H
#define IPMI_HELPER_H
#include <sys/types.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
struct ipmi_intf;
struct valstr {
unsigned short val;
uint16_t val;
const char * str;
};
struct oemvalstr {
uint16_t oem;
uint16_t val;
const char * str;
};
const char * val2str(unsigned short val, const struct valstr * vs);
unsigned short str2val(const char * str, const struct valstr * vs);
unsigned short buf2short(unsigned char * buf);
uint32_t buf2long(unsigned char * buf);
const char * buf2str(unsigned char * buf, int len);
void printbuf(const unsigned char * buf, int len, const char * desc);
void signal_handler(int sig, void * handler);
unsigned char ipmi_csum(unsigned char * d, int s);
FILE * ipmi_open_file(const char * file, int flags);
const char * val2str(uint16_t val, const struct valstr * vs);
const char * oemval2str(uint16_t oem,uint16_t val, const struct oemvalstr * vs);
uint16_t str2val(const char * str, const struct valstr * vs);
void print_valstr(const struct valstr * vs, const char * title, int loglevel);
void print_valstr_2col(const struct valstr * vs, const char * title, int loglevel);
uint16_t buf2short(uint8_t * buf);
uint32_t buf2long(uint8_t * buf);
const char * buf2str(uint8_t * buf, int len);
void printbuf(const uint8_t * buf, int len, const char * desc);
uint8_t ipmi_csum(uint8_t * d, int s);
FILE * ipmi_open_file(const char * file, int rw);
void ipmi_start_daemon(struct ipmi_intf *intf);
#define ipmi_open_file_read(file) ipmi_open_file(file, 0)
#define ipmi_open_file_write(file) ipmi_open_file(file, 1)
#define SIG_IGNORE(s) ((void)signal((s), SIG_IGN))
#define SIG_DEFAULT(s) ((void)signal((s), SIG_DFL))
#define SIG_HANDLE(s,h) ((void)signal_handler((s), (h)))
#ifndef __min
# define __min(a, b) ((a) < (b) ? (a) : (b))
#endif
#define min(a, b) ((a) < (b) ? (a) : (b))
#ifndef __max
# define __max(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef __minlen
# define __minlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x < y) ? x : y;})
#endif
#ifndef __maxlen
# define __maxlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x > y) ? x : y;})
#endif
#endif /* IPMI_HELPER_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_H
@ -40,14 +36,18 @@
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi_cc.h>
#define IPMI_BUF_SIZE 1024
/* From table 13.16 of the IPMI v2 specification */
#define IPMI_PAYLOAD_TYPE_IPMI 0x00
#define IPMI_PAYLOAD_TYPE_SOL 0x01
#define IPMI_PAYLOAD_TYPE_OEM 0x02
#define IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST 0x10
#define IPMI_PAYLOAD_TYPE_RMCP_OPEN_RESPONSE 0x11
#define IPMI_PAYLOAD_TYPE_RAKP_1 0x12
@ -55,100 +55,95 @@
#define IPMI_PAYLOAD_TYPE_RAKP_3 0x14
#define IPMI_PAYLOAD_TYPE_RAKP_4 0x15
extern int verbose;
extern int csv_output;
struct ipmi_rq {
struct {
unsigned char netfn;
unsigned char cmd;
unsigned short data_len;
unsigned char *data;
uint8_t netfn:6;
uint8_t lun:2;
uint8_t cmd;
uint8_t target_cmd;
uint16_t data_len;
uint8_t *data;
} msg;
};
/*
* This is what the sendrcv_v2() function would take as an argument. The common case
* is for payload_type to be IPMI_PAYLOAD_TYPE_IPMI.
*/
struct ipmi_v2_payload {
unsigned short payload_length;
unsigned char payload_type;
uint16_t payload_length;
uint8_t payload_type;
union {
struct {
unsigned char rq_seq;
struct ipmi_rq * request;
uint8_t rq_seq;
struct ipmi_rq *request;
} ipmi_request;
struct {
unsigned char rs_seq;
struct ipmi_rs * response;
uint8_t rs_seq;
struct ipmi_rs *response;
} ipmi_response;
/* Only used internally by the lanplus interface */
struct {
unsigned char * request;
uint8_t *request;
} open_session_request;
/* Only used internally by the lanplus interface */
struct {
unsigned char * message;
uint8_t *message;
} rakp_1_message;
/* Only used internally by the lanplus interface */
struct {
unsigned char * message;
uint8_t *message;
} rakp_2_message;
/* Only used internally by the lanplus interface */
struct {
unsigned char * message;
uint8_t *message;
} rakp_3_message;
/* Only used internally by the lanplus interface */
struct {
unsigned char * message;
uint8_t *message;
} rakp_4_message;
struct {
unsigned char data[IPMI_BUF_SIZE];
unsigned short character_count;
unsigned char packet_sequence_number;
unsigned char acked_packet_number;
unsigned char accepted_character_count;
unsigned char is_nack; /* bool */
unsigned char assert_ring_wor; /* bool */
unsigned char generate_break; /* bool */
unsigned char deassert_cts; /* bool */
unsigned char deassert_dcd_dsr; /* bool */
unsigned char flush_inbound; /* bool */
unsigned char flush_outbound; /* bool */
uint8_t data[IPMI_BUF_SIZE];
uint16_t character_count;
uint8_t packet_sequence_number;
uint8_t acked_packet_number;
uint8_t accepted_character_count;
uint8_t is_nack; /* bool */
uint8_t assert_ring_wor; /* bool */
uint8_t generate_break; /* bool */
uint8_t deassert_cts; /* bool */
uint8_t deassert_dcd_dsr; /* bool */
uint8_t flush_inbound; /* bool */
uint8_t flush_outbound; /* bool */
} sol_packet;
} payload;
};
struct ipmi_rq_entry {
struct ipmi_rq req;
struct ipmi_intf * intf;
unsigned char rq_seq;
unsigned char * msg_data;
struct ipmi_intf *intf;
uint8_t rq_seq;
uint8_t *msg_data;
int msg_len;
struct ipmi_rq_entry * next;
struct ipmi_rq_entry *next;
};
struct ipmi_rs {
unsigned char ccode;
unsigned char data[IPMI_BUF_SIZE];
uint8_t ccode;
uint8_t data[IPMI_BUF_SIZE];
/*
* Looks like this is the length of the entire packet, including the RMCP
@ -157,79 +152,76 @@ struct ipmi_rs {
int data_len;
struct {
unsigned char netfn;
unsigned char cmd;
unsigned char seq;
unsigned char lun;
uint8_t netfn;
uint8_t cmd;
uint8_t seq;
uint8_t lun;
} msg;
struct {
unsigned char authtype;
uint32_t seq;
uint32_t id;
unsigned char bEncrypted; /* IPMI v2 only */
unsigned char bAuthenticated; /* IPMI v2 only */
unsigned char payloadtype; /* IPMI v2 only */
uint8_t authtype;
uint32_t seq;
uint32_t id;
uint8_t bEncrypted; /* IPMI v2 only */
uint8_t bAuthenticated; /* IPMI v2 only */
uint8_t payloadtype; /* IPMI v2 only */
/* This is the total length of the payload or
IPMI message. IPMI v2.0 requires this to
be 2 bytes. Not really used for much. */
unsigned short msglen;
uint16_t msglen;
} session;
/*
* A union of the different possible payload meta-data
*/
union {
struct {
unsigned char rq_addr;
unsigned char netfn;
unsigned char rq_lun;
unsigned char rs_addr;
unsigned char rq_seq;
unsigned char rs_lun;
unsigned char cmd;
uint8_t rq_addr;
uint8_t netfn;
uint8_t rq_lun;
uint8_t rs_addr;
uint8_t rq_seq;
uint8_t rs_lun;
uint8_t cmd;
} ipmi_response;
struct {
unsigned char message_tag;
unsigned char rakp_return_code;
unsigned char max_priv_level;
unsigned int console_id;
unsigned int bmc_id;
unsigned char auth_alg;
unsigned char integrity_alg;
unsigned char crypt_alg;
uint8_t message_tag;
uint8_t rakp_return_code;
uint8_t max_priv_level;
uint32_t console_id;
uint32_t bmc_id;
uint8_t auth_alg;
uint8_t integrity_alg;
uint8_t crypt_alg;
} open_session_response;
struct {
unsigned char message_tag;
unsigned char rakp_return_code;
unsigned int console_id;
unsigned char bmc_rand[16]; /* Random number generated by the BMC */
unsigned char bmc_guid[16];
unsigned char key_exchange_auth_code[20];
uint8_t message_tag;
uint8_t rakp_return_code;
uint32_t console_id;
uint8_t bmc_rand[16]; /* Random number generated by the BMC */
uint8_t bmc_guid[16];
uint8_t key_exchange_auth_code[20];
} rakp2_message;
struct {
unsigned char message_tag;
unsigned char rakp_return_code;
unsigned int console_id;
unsigned char integrity_check_value[20];
uint8_t message_tag;
uint8_t rakp_return_code;
uint32_t console_id;
uint8_t integrity_check_value[20];
} rakp4_message;
struct {
unsigned char packet_sequence_number;
unsigned char acked_packet_number;
unsigned char accepted_character_count;
unsigned char is_nack; /* bool */
unsigned char transfer_unavailable; /* bool */
unsigned char sol_inactive; /* bool */
unsigned char transmit_overrun; /* bool */
unsigned char break_detected; /* bool */
uint8_t packet_sequence_number;
uint8_t acked_packet_number;
uint8_t accepted_character_count;
uint8_t is_nack; /* bool */
uint8_t transfer_unavailable; /* bool */
uint8_t sol_inactive; /* bool */
uint8_t transmit_overrun; /* bool */
uint8_t break_detected; /* bool */
} sol_packet;
} payload;
};
#define IPMI_NETFN_CHASSIS 0x0
#define IPMI_NETFN_BRIDGE 0x2
#define IPMI_NETFN_SE 0x4
@ -237,11 +229,28 @@ struct ipmi_rs {
#define IPMI_NETFN_FIRMWARE 0x8
#define IPMI_NETFN_STORAGE 0xa
#define IPMI_NETFN_TRANSPORT 0xc
#define IPMI_NETFN_PICMG 0x2C
#define IPMI_NETFN_ISOL 0x34
#define IPMI_NETFN_TSOL 0x30
#define IPMI_BMC_SLAVE_ADDR 0x20
#define IPMI_REMOTE_SWID 0x81
extern const struct valstr completion_code_vals[25];
#endif /* IPMI_H */
/* These values are IANA numbers */
typedef enum IPMI_OEM {
IPMI_OEM_UNKNOWN = 0,
IPMI_OEM_SUN = 42,
IPMI_OEM_NOKIA = 94,
IPMI_OEM_INTEL = 343,
IPMI_OEM_TYAN = 6653,
IPMI_OEM_NEWISYS = 9237,
IPMI_OEM_SUPERMICRO = 10876,
IPMI_OEM_GOOGLE = 11129,
IPMI_OEM_PICMG = 12634,
IPMI_OEM_KONTRON = 15000,
} IPMI_OEM;
extern const struct valstr completion_code_vals[];
#endif /* IPMI_H */

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_CC_H
#define IPMI_CC_H
/*
Thu Jan 11 09:32:41 2007
francois.isabelle@ca.kontron.com
I just noticed that most modules refer to IPMI completion codes using
hard coded values ...
*/
/*
* CC
* See IPMI specification table 5-2 Generic Completion Codes
*/
#define IPMI_CC_OK 0x00
#define IPMI_CC_NODE_BUSY 0xc0
#define IPMI_CC_INV_CMD 0xc1
#define IPMI_CC_INV_CMD_FOR_LUN 0xc2
#define IPMI_CC_TIMEOUT 0xc3
#define IPMI_CC_OUT_OF_SPACE 0xc4
#define IPMI_CC_RES_CANCELED 0xc5
#define IPMI_CC_REQ_DATA_TRUNC 0xc6
#define IPMI_CC_REQ_DATA_INV_LENGTH 0xc7
#define IPMI_CC_REQ_DATA_FIELD_EXCEED 0xc8
#define IPMI_CC_PARAM_OUT_OF_RANGE 0xc9
#define IPMI_CC_CANT_RET_NUM_REQ_BYTES 0xca
#define IPMI_CC_REQ_DATA_NOT_PRESENT 0xcb
#define IPMI_CC_INV_DATA_FIELD_IN_REQ 0xcc
#define IPMI_CC_ILL_SENSOR_OR_RECORD 0xcd
#define IPMI_CC_RESP_COULD_NOT_BE_PRV 0xce
#define IPMI_CC_CANT_RESP_DUPLI_REQ 0xcf
#define IPMI_CC_CANT_RESP_SDRR_UPDATE 0xd0
#define IPMI_CC_CANT_RESP_FIRM_UPDATE 0xd1
#define IPMI_CC_CANT_RESP_BMC_INIT 0xd2
#define IPMI_CC_DESTINATION_UNAVAILABLE 0xd3
#define IPMI_CC_INSUFFICIENT_PRIVILEGES 0xd4
#define IPMI_CC_NOT_SUPPORTED_PRESENT_STATE 0xd5
#define IPMI_CC_ILLEGAL_COMMAND_DISABLED 0xd6
#define IPMI_CC_UNSPECIFIED_ERROR 0xff
#endif /*IPMI_CC_H*/

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_CHANNEL_H
@ -42,14 +38,16 @@
#endif
#include <ipmitool/ipmi.h>
#define IPMI_GET_CHANNEL_AUTH_CAP 0x38
#define IPMI_GET_CHANNEL_ACCESS 0x41
#define IPMI_GET_CHANNEL_INFO 0x42
#define IPMI_SET_USER_ACCESS 0x43
#define IPMI_GET_USER_ACCESS 0x44
#define IPMI_SET_USER_NAME 0x45
#define IPMI_GET_USER_NAME 0x46
#define IPMI_SET_USER_PASSWORD 0x47
#define IPMI_GET_CHANNEL_AUTH_CAP 0x38
#define IPMI_GET_CHANNEL_ACCESS 0x41
#define IPMI_GET_CHANNEL_INFO 0x42
#define IPMI_SET_USER_ACCESS 0x43
#define IPMI_GET_USER_ACCESS 0x44
#define IPMI_SET_USER_NAME 0x45
#define IPMI_GET_USER_NAME 0x46
#define IPMI_SET_USER_PASSWORD 0x47
#define IPMI_GET_CHANNEL_CIPHER_SUITES 0x54
/*
@ -57,44 +55,44 @@
* From table 22-15 of the IPMI v2.0 spec
*/
struct get_channel_auth_cap_rsp {
unsigned char channel_number;
uint8_t channel_number;
#if WORDS_BIGENDIAN
unsigned char v20_data_available : 1; /* IPMI v2.0 data is available */
unsigned char __reserved1 : 1;
unsigned char enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */
uint8_t __reserved1 : 1;
uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
#else
unsigned char enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
unsigned char __reserved1 : 1;
unsigned char v20_data_available : 1; /* IPMI v2.0 data is available */
uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */
uint8_t __reserved1 : 1;
uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved2 : 2;
unsigned char kg_status : 1; /* two-key login status */
unsigned char per_message_auth : 1; /* per-message authentication status */
unsigned char user_level_auth : 1; /* user-level authentication status */
unsigned char non_null_usernames : 1; /* one or more non-null users exist */
unsigned char null_usernames : 1; /* one or more null usernames non-null pwds */
unsigned char anon_login_enabled : 1; /* a null-named, null-pwd user exists */
uint8_t __reserved2 : 2;
uint8_t kg_status : 1; /* two-key login status */
uint8_t per_message_auth : 1; /* per-message authentication status */
uint8_t user_level_auth : 1; /* user-level authentication status */
uint8_t non_null_usernames : 1; /* one or more non-null users exist */
uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */
uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */
#else
unsigned char anon_login_enabled : 1; /* a null-named, null-pwd user exists */
unsigned char null_usernames : 1; /* one or more null usernames non-null pwds */
unsigned char non_null_usernames : 1; /* one or more non-null users exist */
unsigned char user_level_auth : 1; /* user-level authentication status */
unsigned char per_message_auth : 1; /* per-message authentication status */
unsigned char kg_status : 1; /* two-key login status */
unsigned char __reserved2 : 2;
uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */
uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */
uint8_t non_null_usernames : 1; /* one or more non-null users exist */
uint8_t user_level_auth : 1; /* user-level authentication status */
uint8_t per_message_auth : 1; /* per-message authentication status */
uint8_t kg_status : 1; /* two-key login status */
uint8_t __reserved2 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved3 : 6;
unsigned char ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
unsigned char ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
uint8_t __reserved3 : 6;
uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
#else
unsigned char ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
unsigned char ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
unsigned char __reserved3 : 6;
uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */
uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */
uint8_t __reserved3 : 6;
#endif
unsigned char oem_id[3]; /* IANA enterprise number for auth type */
unsigned char oem_aux_data; /* Additional OEM specific data for oem auths */
uint8_t oem_id[3]; /* IANA enterprise number for auth type */
uint8_t oem_aux_data; /* Additional OEM specific data for oem auths */
} __attribute__ ((packed));
@ -105,35 +103,35 @@ struct get_channel_auth_cap_rsp {
*/
struct get_channel_info_rsp {
#if WORDS_BIGENDIAN
unsigned char __reserved1 : 4;
unsigned char channel_number : 4; /* channel number */
uint8_t __reserved1 : 4;
uint8_t channel_number : 4; /* channel number */
#else
unsigned char channel_number : 4; /* channel number */
unsigned char __reserved1 : 4;
uint8_t channel_number : 4; /* channel number */
uint8_t __reserved1 : 4;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved2 : 1;
unsigned char channel_medium : 7; /* Channel medium type per table 6-3 */
uint8_t __reserved2 : 1;
uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */
#else
unsigned char channel_medium : 7; /* Channel medium type per table 6-3 */
unsigned char __reserved2 : 1;
uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */
uint8_t __reserved2 : 1;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved3 : 3;
unsigned char channel_protocol : 5; /* Channel protocol per table 6-2 */
uint8_t __reserved3 : 3;
uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */
#else
unsigned char channel_protocol : 5; /* Channel protocol per table 6-2 */
unsigned char __reserved3 : 3;
uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */
uint8_t __reserved3 : 3;
#endif
#if WORDS_BIGENDIAN
unsigned char session_support : 2; /* Description of session support */
unsigned char active_sessions : 6; /* Count of active sessions */
uint8_t session_support : 2; /* Description of session support */
uint8_t active_sessions : 6; /* Count of active sessions */
#else
unsigned char active_sessions : 6; /* Count of active sessions */
unsigned char session_support : 2; /* Description of session support */
uint8_t active_sessions : 6; /* Count of active sessions */
uint8_t session_support : 2; /* Description of session support */
#endif
unsigned char vendor_id[3]; /* For OEM that specified the protocol */
unsigned char aux_info[2]; /* Not used*/
uint8_t vendor_id[3]; /* For OEM that specified the protocol */
uint8_t aux_info[2]; /* Not used*/
} __attribute__ ((packed));
@ -144,87 +142,88 @@ struct get_channel_info_rsp {
*/
struct get_channel_access_rsp {
#if WORDS_BIGENDIAN
unsigned char __reserved1 : 2;
unsigned char alerting : 1;
unsigned char per_message_auth : 1;
unsigned char user_level_auth : 1;
unsigned char access_mode : 3;
uint8_t __reserved1 : 2;
uint8_t alerting : 1;
uint8_t per_message_auth : 1;
uint8_t user_level_auth : 1;
uint8_t access_mode : 3;
#else
unsigned char access_mode : 3;
unsigned char user_level_auth : 1;
unsigned char per_message_auth : 1;
unsigned char alerting : 1;
unsigned char __reserved1 : 2;
uint8_t access_mode : 3;
uint8_t user_level_auth : 1;
uint8_t per_message_auth : 1;
uint8_t alerting : 1;
uint8_t __reserved1 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved2 : 4;
unsigned char channel_priv_limit : 4; /* Channel privilege level limit */
uint8_t __reserved2 : 4;
uint8_t channel_priv_limit : 4; /* Channel privilege level limit */
#else
unsigned char channel_priv_limit : 4; /* Channel privilege level limit */
unsigned char __reserved2 : 4;
uint8_t channel_priv_limit : 4; /* Channel privilege level limit */
uint8_t __reserved2 : 4;
#endif
} __attribute__ ((packed));
struct get_user_access_rsp {
#if WORDS_BIGENDIAN
unsigned char __reserved1 : 2;
unsigned char max_user_ids : 6;
unsigned char __reserved2 : 2;
unsigned char enabled_user_ids : 6;
unsigned char __reserved3 : 2;
unsigned char fixed_user_ids : 6;
unsigned char __reserved4 : 1;
unsigned char callin_callback : 1;
unsigned char link_auth : 1;
unsigned char ipmi_messaging : 1;
unsigned char privilege_limit : 4;
uint8_t __reserved1 : 2;
uint8_t max_user_ids : 6;
uint8_t __reserved2 : 2;
uint8_t enabled_user_ids : 6;
uint8_t __reserved3 : 2;
uint8_t fixed_user_ids : 6;
uint8_t __reserved4 : 1;
uint8_t callin_callback : 1;
uint8_t link_auth : 1;
uint8_t ipmi_messaging : 1;
uint8_t privilege_limit : 4;
#else
unsigned char max_user_ids : 6;
unsigned char __reserved1 : 2;
unsigned char enabled_user_ids : 6;
unsigned char __reserved2 : 2;
unsigned char fixed_user_ids : 6;
unsigned char __reserved3 : 2;
unsigned char privilege_limit : 4;
unsigned char ipmi_messaging : 1;
unsigned char link_auth : 1;
unsigned char callin_callback : 1;
unsigned char __reserved4 : 1;
uint8_t max_user_ids : 6;
uint8_t __reserved1 : 2;
uint8_t enabled_user_ids : 6;
uint8_t __reserved2 : 2;
uint8_t fixed_user_ids : 6;
uint8_t __reserved3 : 2;
uint8_t privilege_limit : 4;
uint8_t ipmi_messaging : 1;
uint8_t link_auth : 1;
uint8_t callin_callback : 1;
uint8_t __reserved4 : 1;
#endif
} __attribute__ ((packed));
struct set_user_access_data {
#if WORDS_BIGENDIAN
unsigned char change_bits : 1;
unsigned char callin_callback : 1;
unsigned char link_auth : 1;
unsigned char ipmi_messaging : 1;
unsigned char channel : 4;
unsigned char __reserved1 : 2;
unsigned char user_id : 6;
unsigned char __reserved2 : 4;
unsigned char privilege_limit : 4;
unsigned char __reserved3 : 4;
unsigned char session_limit : 4;
uint8_t change_bits : 1;
uint8_t callin_callback : 1;
uint8_t link_auth : 1;
uint8_t ipmi_messaging : 1;
uint8_t channel : 4;
uint8_t __reserved1 : 2;
uint8_t user_id : 6;
uint8_t __reserved2 : 4;
uint8_t privilege_limit : 4;
uint8_t __reserved3 : 4;
uint8_t session_limit : 4;
#else
unsigned char channel : 4;
unsigned char ipmi_messaging : 1;
unsigned char link_auth : 1;
unsigned char callin_callback : 1;
unsigned char change_bits : 1;
unsigned char user_id : 6;
unsigned char __reserved1 : 2;
unsigned char privilege_limit : 4;
unsigned char __reserved2 : 4;
unsigned char session_limit : 4;
unsigned char __reserved3 : 4;
uint8_t channel : 4;
uint8_t ipmi_messaging : 1;
uint8_t link_auth : 1;
uint8_t callin_callback : 1;
uint8_t change_bits : 1;
uint8_t user_id : 6;
uint8_t __reserved1 : 2;
uint8_t privilege_limit : 4;
uint8_t __reserved2 : 4;
uint8_t session_limit : 4;
uint8_t __reserved3 : 4;
#endif
} __attribute__ ((packed));
int ipmi_channel_main(struct ipmi_intf *, int, char **);
int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, unsigned char channel, unsigned char priv);
int ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel);
uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel);
uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf);
int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv);
int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, uint8_t channel, uint8_t priv);
int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel);
#endif /*IPMI_CHANNEL_H*/

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_CHASSIS_H
@ -51,6 +47,9 @@
#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1
#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0
int ipmi_chassis_main(struct ipmi_intf *, int, char **);
int ipmi_chassis_power_status(struct ipmi_intf * intf);
int ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl);
int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv);
int ipmi_power_main(struct ipmi_intf * intf, int argc, char ** argv);
#endif /*IPMI_CHASSIS_H*/

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_CONSTANTS_H
@ -55,6 +51,8 @@
#define IPMI_SUSPEND_RESUME_PAYLOAD_ENCRYPTYION 0x55
#define IPMI_GET_SEL_TIME 0x48
#define IPMI_SET_SEL_TIME 0x49
#define IPMI_SET_USER_PAYLOAD_ACCESS 0x4c
#define IPMI_GET_USER_PAYLOAD_ACCESS 0x4d
#define IPMI_1_5_AUTH_TYPE_BIT_NONE 0x01
#define IPMI_1_5_AUTH_TYPE_BIT_MD2 0x02
@ -70,6 +68,7 @@
#define IPMI_SESSION_AUTHTYPE_OEM 0x5
#define IPMI_SESSION_AUTHTYPE_RMCP_PLUS 0x6
#define IPMI_SESSION_PRIV_UNSPECIFIED 0x0
#define IPMI_SESSION_PRIV_CALLBACK 0x1
#define IPMI_SESSION_PRIV_USER 0x2
#define IPMI_SESSION_PRIV_OPERATOR 0x3
@ -80,4 +79,56 @@
#define IPMI_SET_IN_PROGRESS_IN_PROGRESS 0x01
#define IPMI_SET_IN_PROGRESS_COMMIT_WRITE 0x02
#define IPMI_CHANNEL_MEDIUM_RESERVED 0x0
#define IPMI_CHANNEL_MEDIUM_IPMB_I2C 0x1
#define IPMI_CHANNEL_MEDIUM_ICMB_1 0x2
#define IPMI_CHANNEL_MEDIUM_ICMB_09 0x3
#define IPMI_CHANNEL_MEDIUM_LAN 0x4
#define IPMI_CHANNEL_MEDIUM_SERIAL 0x5
#define IPMI_CHANNEL_MEDIUM_LAN_OTHER 0x6
#define IPMI_CHANNEL_MEDIUM_SMBUS_PCI 0x7
#define IPMI_CHANNEL_MEDIUM_SMBUS_1 0x8
#define IPMI_CHANNEL_MEDIUM_SMBUS_2 0x9
#define IPMI_CHANNEL_MEDIUM_USB_1 0xa
#define IPMI_CHANNEL_MEDIUM_USB_2 0xb
#define IPMI_CHANNEL_MEDIUM_SYSTEM 0xc
#define IPMI_CHASSIS_CTL_POWER_DOWN 0x0
#define IPMI_CHASSIS_CTL_POWER_UP 0x1
#define IPMI_CHASSIS_CTL_POWER_CYCLE 0x2
#define IPMI_CHASSIS_CTL_HARD_RESET 0x3
#define IPMI_CHASSIS_CTL_PULSE_DIAG 0x4
#define IPMI_CHASSIS_CTL_ACPI_SOFT 0x5
#define IPMI_CHASSIS_POLICY_NO_CHANGE 0x3
#define IPMI_CHASSIS_POLICY_ALWAYS_ON 0x2
#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1
#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0
#define IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS 0
#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SELECT 1
#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SCAN 2
#define IPMI_CHASSIS_BOOTPARAM_FLAG_VALID 3
#define IPMI_CHASSIS_BOOTPARAM_INFO_ACK 4
#define IPMI_CHASSIS_BOOTPARAM_BOOT_FLAGS 5
#define IPMI_CHASSIS_BOOTPARAM_INIT_INFO 6
#define IPMI_CHASSIS_BOOTPARAM_INIT_MBOX 7
/* From table 13-17 of the IPMI v2 specification */
#define IPMI_AUTH_RAKP_NONE 0x00
#define IPMI_AUTH_RAKP_HMAC_SHA1 0x01
#define IPMI_AUTH_RAKP_HMAC_MD5 0x02
/* From table 13-18 of the IPMI v2 specification */
#define IPMI_INTEGRITY_NONE 0x00
#define IPMI_INTEGRITY_HMAC_SHA1_96 0x01
#define IPMI_INTEGRITY_HMAC_MD5_128 0x02
#define IPMI_INTEGRITY_MD5_128 0x03
/* From table 13-19 of the IPMI v2 specfication */
#define IPMI_CRYPT_NONE 0x00
#define IPMI_CRYPT_AES_CBC_128 0x01
#define IPMI_CRYPT_XRC4_128 0x02
#define IPMI_CRYPT_XRC4_40 0x03
#endif /*IPMI_CONSTANTS_H*/

View File

@ -28,106 +28,20 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_ENTITY_H
#define IPMI_ENTITY_H
#include <ipmitool/helper.h>
const struct valstr entity_id_vals[] __attribute__((unused)) = {
{ 0x00, "Unspecified" },
{ 0x01, "Other" },
{ 0x02, "Unknown" },
{ 0x03, "Processor" },
{ 0x04, "Disk or Disk Bay" },
{ 0x05, "Peripheral Bay" },
{ 0x06, "System Management Module" },
{ 0x07, "System Board" },
{ 0x08, "Memory Module" },
{ 0x09, "Processor Module" },
{ 0x0a, "Power Supply" },
{ 0x0b, "Add-in Card" },
{ 0x0c, "Front Panel Board" },
{ 0x0d, "Back Panel Board" },
{ 0x0e, "Power System Board" },
{ 0x0f, "Drive Backplane" },
{ 0x10, "System Internal Expansion Board" },
{ 0x11, "Other System Board" },
{ 0x12, "Processor Board" },
{ 0x13, "Power Unit" },
{ 0x14, "Power Module" },
{ 0x15, "Power Management" },
{ 0x16, "Chassis Back Panel Board" },
{ 0x17, "System Chassis" },
{ 0x18, "Sub-Chassis" },
{ 0x19, "Other Chassis Board" },
{ 0x1a, "Disk Drive Bay" },
{ 0x1b, "Peripheral Bay" },
{ 0x1c, "Device Bay" },
{ 0x1d, "Fan Device" },
{ 0x1e, "Cooling Unit" },
{ 0x1f, "Cable/Interconnect" },
{ 0x20, "Memory Device" },
{ 0x21, "System Management Software" },
{ 0x22, "BIOS" },
{ 0x23, "Operating System" },
{ 0x24, "System Bus" },
{ 0x25, "Group" },
{ 0x26, "Remote Management Device" },
{ 0x27, "External Environment" },
{ 0x28, "Battery" },
{ 0x00, NULL },
};
const struct valstr device_type_vals[] __attribute__((unused)) = {
{ 0x00, "Reserved" },
{ 0x01, "Reserved" },
{ 0x02, "DS1624 temperature sensor" },
{ 0x03, "DS1621 temperature sensor" },
{ 0x04, "LM75 Temperature Sensor" },
{ 0x05, "Heceta ASIC" },
{ 0x06, "Reserved" },
{ 0x07, "Reserved" },
{ 0x08, "EEPROM, 24C01" },
{ 0x09, "EEPROM, 24C02" },
{ 0x0a, "EEPROM, 24C04" },
{ 0x0b, "EEPROM, 24C08" },
{ 0x0c, "EEPROM, 24C16" },
{ 0x0d, "EEPROM, 24C17" },
{ 0x0e, "EEPROM, 24C32" },
{ 0x0f, "EEPROM, 24C64" },
{ 0x1000, "IPMI FRU Inventory" },
{ 0x1001, "DIMM Memory ID" },
{ 0x1002, "IPMI FRU Inventory" },
{ 0x1003, "System Processor Cartridge FRU" },
{ 0x11, "Reserved" },
{ 0x12, "Reserved" },
{ 0x13, "Reserved" },
{ 0x14, "PCF 8570 256 byte RAM" },
{ 0x15, "PCF 8573 clock/calendar" },
{ 0x16, "PCF 8574A I/O Port" },
{ 0x17, "PCF 8583 clock/calendar" },
{ 0x18, "PCF 8593 clock/calendar" },
{ 0x19, "Clock calendar" },
{ 0x1a, "PCF 8591 A/D, D/A Converter" },
{ 0x1b, "I/O Port" },
{ 0x1c, "A/D Converter" },
{ 0x1d, "D/A Converter" },
{ 0x1e, "A/D, D/A Converter" },
{ 0x1f, "LCD Controler/Driver" },
{ 0x20, "Core Logic (Chip set) Device" },
{ 0x21, "LMC6874 Intelligent Battery controller" },
{ 0x22, "Intelligent Batter controller" },
{ 0x23, "Combo Management ASIC" },
{ 0x24, "Maxim 1617 Temperature Sensor" },
{ 0xbf, "Other/Unspecified" },
{ 0x00, NULL },
};
struct entity_id {
uint8_t id; /* physical entity id */
#if WORDS_BIGENDIAN
uint8_t logical : 1; /* physical/logical */
uint8_t instance : 7; /* instance number */
#else
uint8_t instance : 7; /* instance number */
uint8_t logical : 1; /* physical/logical */
#endif
} __attribute__ ((packed));
#endif /* IPMI_ENTITY_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_EVENT_H
@ -42,6 +38,23 @@
#endif
#include <ipmitool/ipmi.h>
#define EVENT_DIR_ASSERT 0
#define EVENT_DIR_DEASSERT 1
struct platform_event_msg {
uint8_t evm_rev;
uint8_t sensor_type;
uint8_t sensor_num;
#if WORDS_BIGENDIAN
uint8_t event_dir : 1;
uint8_t event_type : 7;
#else
uint8_t event_type : 7;
uint8_t event_dir : 1;
#endif
uint8_t event_data[3];
} __attribute__((packed));
int ipmi_event_main(struct ipmi_intf *, int, char **);
#endif /*IPMI_EVENT_H*/

View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_FIREWALL_H
#define IPMI_FIREWALL_H
#include <ipmitool/ipmi.h>
int ipmi_firewall_main(struct ipmi_intf *, int, char **);
#define BMC_GET_NETFN_SUPPORT 0x09
#define BMC_GET_COMMAND_SUPPORT 0x0A
#define BMC_GET_COMMAND_SUBFUNCTION_SUPPORT 0x0B
#define BMC_GET_CONFIGURABLE_COMMANDS 0x0C
#define BMC_GET_CONFIGURABLE_COMMAND_SUBFUNCTIONS 0x0D
#define BMC_SET_COMMAND_ENABLES 0x60
#define BMC_GET_COMMAND_ENABLES 0x61
#define BMC_SET_COMMAND_SUBFUNCTION_ENABLES 0x62
#define BMC_GET_COMMAND_SUBFUNCTION_ENABLES 0x63
#define BMC_OEM_NETFN_IANA_SUPPORT 0x64
#define SET_COMMAND_ENABLE_BYTE (BMC_SET_COMMAND_ENABLES / 8)
#define SET_COMMAND_ENABLE_BIT (BMC_SET_COMMAND_ENABLES % 8)
#define MAX_LUN 4
#define MAX_NETFN 64
#define MAX_NETFN_PAIR (MAX_NETFN/2)
#define MAX_COMMAND 256
#define MAX_SUBFN 32
#define MAX_COMMAND_BYTES (MAX_COMMAND>>3)
#define MAX_SUBFN_BYTES (MAX_SUBFN>>3)
// support is a bitfield with the following bits set...
#define BIT_AVAILABLE 0x01
#define BIT_CONFIGURABLE 0x02
#define BIT_ENABLED 0x04
extern int verbose;
struct command_support {
unsigned char support;
unsigned char version[3];
unsigned char subfn_support[MAX_SUBFN_BYTES];
unsigned char subfn_config[MAX_SUBFN_BYTES];
unsigned char subfn_enable[MAX_SUBFN_BYTES];
};
struct lun_netfn_support {
unsigned char support;
struct command_support command[MAX_COMMAND];
unsigned char command_mask[MAX_COMMAND_BYTES];
unsigned char config_mask[MAX_COMMAND_BYTES];
unsigned char enable_mask[MAX_COMMAND_BYTES];
};
struct lun_support {
unsigned char support;
struct lun_netfn_support netfn[MAX_NETFN_PAIR];
};
struct bmc_fn_support {
struct lun_support lun[MAX_LUN];
};
struct ipmi_function_params {
int channel;
int lun;
int netfn;
int command;
int subfn;
unsigned char force;
};
static inline int bit_test(const unsigned char * bf, int n) {
return !!(bf[n>>3]&(1<<(n%8)));
}
static inline void bit_set(unsigned char * bf, int n, int v) {
bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8));
}
#endif /*IPMI_FIREWALL_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_FRU_H
@ -39,6 +35,7 @@
#include <inttypes.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_sdr.h>
#if HAVE_CONFIG_H
# include <config.h>
@ -64,54 +61,54 @@ enum {
};
struct fru_info {
unsigned short size;
unsigned char access : 1;
uint16_t size;
uint8_t access:1;
} __attribute__ ((packed));
struct fru_header {
unsigned char version;
uint8_t version;
struct {
unsigned char internal;
unsigned char chassis;
unsigned char board;
unsigned char product;
unsigned char multi;
uint8_t internal;
uint8_t chassis;
uint8_t board;
uint8_t product;
uint8_t multi;
} offset;
unsigned char pad;
unsigned char checksum;
uint8_t pad;
uint8_t checksum;
} __attribute__ ((packed));
struct fru_area_chassis {
unsigned char area_ver;
unsigned char type;
unsigned short area_len;
char * part;
char * serial;
uint8_t area_ver;
uint8_t type;
uint16_t area_len;
char *part;
char *serial;
};
struct fru_area_board {
unsigned char area_ver;
unsigned char lang;
unsigned short area_len;
uint8_t area_ver;
uint8_t lang;
uint16_t area_len;
uint32_t mfg_date_time;
char * mfg;
char * prod;
char * serial;
char * part;
char * fru;
char *mfg;
char *prod;
char *serial;
char *part;
char *fru;
};
struct fru_area_product {
unsigned char area_ver;
unsigned char lang;
unsigned short area_len;
char * mfg;
char * name;
char * part;
char * version;
char * serial;
char * asset;
char * fru;
uint8_t area_ver;
uint8_t lang;
uint16_t area_len;
char *mfg;
char *name;
char *part;
char *version;
char *serial;
char *asset;
char *fru;
};
struct fru_multirec_header {
@ -121,107 +118,260 @@ struct fru_multirec_header {
#define FRU_RECORD_TYPE_MANAGEMENT_ACCESS 0x03
#define FRU_RECORD_TYPE_BASE_COMPATIBILITY 0x04
#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05
unsigned char type;
unsigned char format;
unsigned char len;
unsigned char record_checksum;
unsigned char header_checksum;
#define FRU_RECORD_TYPE_OEM_EXTENSION 0xc0
uint8_t type;
uint8_t format;
uint8_t len;
uint8_t record_checksum;
uint8_t header_checksum;
} __attribute__ ((packed));
struct fru_multirec_powersupply {
#if WORDS_BIGENDIAN
unsigned short capacity;
uint16_t capacity;
#else
unsigned short capacity : 12;
unsigned short __reserved1 : 4;
uint16_t capacity:12;
uint16_t __reserved1:4;
#endif
unsigned short peak_va;
unsigned char inrush_current;
unsigned char inrush_interval;
unsigned short lowend_input1;
unsigned short highend_input1;
unsigned short lowend_input2;
unsigned short highend_input2;
unsigned char lowend_freq;
unsigned char highend_freq;
unsigned char dropout_tolerance;
uint16_t peak_va;
uint8_t inrush_current;
uint8_t inrush_interval;
uint16_t lowend_input1;
uint16_t highend_input1;
uint16_t lowend_input2;
uint16_t highend_input2;
uint8_t lowend_freq;
uint8_t highend_freq;
uint8_t dropout_tolerance;
#if WORDS_BIGENDIAN
unsigned char __reserved2 : 3;
unsigned char tach : 1;
unsigned char hotswap : 1;
unsigned char autoswitch : 1;
unsigned char pfc : 1;
unsigned char predictive_fail : 1;
uint8_t __reserved2:3;
uint8_t tach:1;
uint8_t hotswap:1;
uint8_t autoswitch:1;
uint8_t pfc:1;
uint8_t predictive_fail:1;
#else
unsigned char predictive_fail : 1;
unsigned char pfc : 1;
unsigned char autoswitch : 1;
unsigned char hotswap : 1;
unsigned char tach : 1;
unsigned char __reserved2 : 3;
uint8_t predictive_fail:1;
uint8_t pfc:1;
uint8_t autoswitch:1;
uint8_t hotswap:1;
uint8_t tach:1;
uint8_t __reserved2:3;
#endif
unsigned short peak_cap_ht;
uint16_t peak_cap_ht;
#if WORDS_BIGENDIAN
unsigned char combined_voltage1 : 4;
unsigned char combined_voltage2 : 4;
uint8_t combined_voltage1:4;
uint8_t combined_voltage2:4;
#else
unsigned char combined_voltage2 : 4;
unsigned char combined_voltage1 : 4;
uint8_t combined_voltage2:4;
uint8_t combined_voltage1:4;
#endif
unsigned short combined_capacity;
unsigned char rps_threshold;
uint16_t combined_capacity;
uint8_t rps_threshold;
} __attribute__ ((packed));
static const char * combined_voltage_desc[] __attribute__((unused)) = {
"12 V", "-12 V", "5 V", "3.3 V"
};
static const char *combined_voltage_desc[] __attribute__ ((unused)) = {
"12 V", "-12 V", "5 V", "3.3 V"};
struct fru_multirec_dcoutput {
#if WORDS_BIGENDIAN
unsigned char standby : 1;
unsigned char __reserved : 3;
unsigned char output_number : 4;
uint8_t standby:1;
uint8_t __reserved:3;
uint8_t output_number:4;
#else
unsigned char output_number : 4;
unsigned char __reserved : 3;
unsigned char standby : 1;
uint8_t output_number:4;
uint8_t __reserved:3;
uint8_t standby:1;
#endif
short nominal_voltage;
short max_neg_dev;
short max_pos_dev;
unsigned short ripple_and_noise;
unsigned short min_current;
unsigned short max_current;
uint16_t ripple_and_noise;
uint16_t min_current;
uint16_t max_current;
} __attribute__ ((packed));
struct fru_multirec_dcload {
#if WORDS_BIGENDIAN
unsigned char __reserved : 4;
unsigned char output_number : 4;
uint8_t __reserved:4;
uint8_t output_number:4;
#else
unsigned char output_number : 4;
unsigned char __reserved : 4;
uint8_t output_number:4;
uint8_t __reserved:4;
#endif
short nominal_voltage;
short min_voltage;
short max_voltage;
unsigned short ripple_and_noise;
unsigned short min_current;
unsigned short max_current;
uint16_t ripple_and_noise;
uint16_t min_current;
uint16_t max_current;
} __attribute__ ((packed));
static const char * chassis_type_desc[] __attribute__((unused)) = {
"Unspecified", "Other", "Unknown",
"Desktop", "Low Profile Desktop", "Pizza Box",
"Mini Tower", "Tower",
"Portable", "LapTop", "Notebook", "Hand Held", "Docking Station",
"All in One", "Sub Notebook", "Space-saving", "Lunch Box",
"Main Server Chassis", "Expansion Chassis", "SubChassis",
"Bus Expansion Chassis", "Peripheral Chassis", "RAID Chassis",
"Rack Mount Chassis"
};
struct fru_multirec_oem_header {
unsigned char mfg_id[3];
#define FRU_PICMG_BACKPLANE_P2P 0x04
#define FRU_PICMG_ADDRESS_TABLE 0x10
#define FRU_PICMG_SHELF_POWER_DIST 0x11
#define FRU_PICMG_SHELF_ACTIVATION 0x12
#define FRU_PICMG_SHMC_IP_CONN 0x13
#define FRU_PICMG_BOARD_P2P 0x14
#define FRU_AMC_CURRENT 0x16
#define FRU_AMC_ACTIVATION 0x17
#define FRU_AMC_CARRIER_P2P 0x18
#define FRU_AMC_P2P 0x19
#define FRU_AMC_CARRIER_INFO 0x1a
unsigned char record_id;
unsigned char record_version;
} __attribute__ ((packed));
void ipmi_print_fru(struct ipmi_intf *, unsigned char);
int ipmi_fru_main(struct ipmi_intf *, int, char **);
struct fru_picmgext_guid {
unsigned char guid[16];
} __attribute__ ((packed));
#endif /* IPMI_FRU_H */
struct fru_picmgext_link_desc {
#ifndef WORDS_BIGENDIAN
unsigned int designator:12;
#define FRU_PICMGEXT_LINK_TYPE_BASE 0x01
#define FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET 0x02
#define FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND 0x03
#define FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR 0x04
#define FRU_PICMGEXT_LINK_TYPE_PCIE 0x05
unsigned int type:8;
unsigned int ext:4;
unsigned int grouping:8;
#else
unsigned int grouping:8;
unsigned int ext:4;
#define FRU_PICMGEXT_LINK_TYPE_BASE 0x01
#define FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET 0x02
#define FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND 0x03
#define FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR 0x04
#define FRU_PICMGEXT_LINK_TYPE_PCIE 0x05
unsigned int type:8;
unsigned int designator:12;
#endif
} __attribute__ ((packed));
#define FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED 0x00
#define FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 0x01
#define FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS 0x02
#define FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 0x03
#define FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 0x04
#define FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET 0x05
#define FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO 0x06
#define FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE 0x07
/* This is used in command, not in FRU */
struct fru_picmgext_amc_link_info {
unsigned char linkInfo[3];
} __attribute__ ((packed));
struct fru_picmgext_amc_link_desc_core {
#ifndef WORDS_BIGENDIAN
unsigned int designator:12;
unsigned int type:8;
unsigned int ext:4;
unsigned int grouping:8;
#else
unsigned int grouping:8;
unsigned int ext:4;
unsigned int type:8;
unsigned int designator:12;
#endif
} __attribute__ ((packed));
struct fru_picmgext_amc_link_desc_extra {
#ifndef WORDS_BIGENDIAN
unsigned char asymetricMatch:2;
unsigned char reserved:6;
#else
unsigned char reserved:6;
unsigned char asymetricMatch:2;
#endif
} __attribute__ ((packed));
struct fru_picmgext_amc_link_desc {
#ifndef WORDS_BIGENDIAN
struct fru_picmgext_amc_link_desc_core core;/* lsb */
struct fru_picmgext_amc_link_desc_extra extra;
#else
struct fru_picmgext_amc_link_desc_extra extra;
struct fru_picmgext_amc_link_desc_core core;/* lsb */
#endif
} __attribute__ ((packed));
struct fru_picmgext_chn_desc {
#ifndef WORDS_BIGENDIAN
unsigned char remote_slot:8;
unsigned char remote_chn:5;
unsigned char local_chn:5;
unsigned char:6;
#else
unsigned char:6;
unsigned char local_chn:5;
unsigned char remote_chn:5;
unsigned char remote_slot:8;
#endif
} __attribute__ ((packed));
struct fru_picmgext_slot_desc {
unsigned char chan_type;
unsigned char slot_addr;
unsigned char chn_count;
} __attribute__ ((packed));
#define FRU_PICMGEXT_DESIGN_IF_BASE 0x00
#define FRU_PICMGEXT_DESIGN_IF_FABRIC 0x01
#define FRU_PICMGEXT_DESIGN_IF_UPDATE_CHANNEL 0x02
#define FRU_PICMGEXT_DESIGN_IF_RESERVED 0x03
struct fru_picmgext_carrier_activation_record {
unsigned short max_internal_curr;
unsigned char allowance_for_readiness;
unsigned char module_activation_record_count;
} __attribute__ ((packed));
struct fru_picmgext_activation_record {
unsigned char ibmb_addr;
unsigned char max_module_curr;
unsigned char reserved;
} __attribute__ ((packed));
struct fru_picmgext_carrier_p2p_record {
unsigned char resource_id;
unsigned char p2p_count;
} __attribute__ ((packed));
struct fru_picmgext_carrier_p2p_descriptor {
#ifndef WORDS_BIGENDIAN
unsigned char remote_resource_id;
unsigned short remote_port:5;
unsigned short local_port:5;
unsigned short reserved:6;
#else
unsigned short reserved:6;
unsigned short local_port:5;
unsigned short remote_port:5;
unsigned char remote_resource_id;
#endif
} __attribute__ ((packed));
static const char *chassis_type_desc[] __attribute__ ((unused)) = {
"Unspecified", "Other", "Unknown",
"Desktop", "Low Profile Desktop", "Pizza Box",
"Mini Tower", "Tower",
"Portable", "LapTop", "Notebook", "Hand Held",
"Docking Station", "All in One", "Sub Notebook",
"Space-saving", "Lunch Box", "Main Server Chassis",
"Expansion Chassis", "SubChassis", "Bus Expansion Chassis",
"Peripheral Chassis", "RAID Chassis", "Rack Mount Chassis"};
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);
int ipmi_spd_print(uint8_t *data, int len);
int ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id);
#endif /* IPMI_FRU_H */

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_KFWUM_H
#define IPMI_KFWUM_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_fwum_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KFWUM_H */

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_HPMFWUPG_H
#define IPMI_HPMFWUPG_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KFWUM_H */

View File

@ -28,16 +28,13 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_INTF_H
#define IPMI_INTF_H
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_oem.h>
#include <ipmitool/ipmi_constants.h>
#include <sys/types.h>
@ -66,16 +63,26 @@ enum LANPLUS_SESSION_STATE {
#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */
struct ipmi_session {
unsigned char hostname[64];
unsigned char username[16];
unsigned char authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1];
unsigned char challenge[16];
unsigned char authtype;
unsigned char authtype_set;
unsigned char privlvl;
uint8_t hostname[64];
uint8_t username[17];
uint8_t authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1];
uint8_t challenge[16];
uint8_t authtype;
uint8_t authtype_set;
#define IPMI_AUTHSTATUS_PER_MSG_DISABLED 0x10
#define IPMI_AUTHSTATUS_PER_USER_DISABLED 0x08
#define IPMI_AUTHSTATUS_NONNULL_USERS_ENABLED 0x04
#define IPMI_AUTHSTATUS_NULL_USERS_ENABLED 0x02
#define IPMI_AUTHSTATUS_ANONYMOUS_USERS_ENABLED 0x01
uint8_t authstatus;
uint8_t authextra;
uint8_t privlvl;
uint8_t cipher_suite_id;
char sol_escape_char;
int password;
int port;
int active;
int retry;
uint32_t session_id;
uint32_t in_seq;
@ -92,10 +99,14 @@ struct ipmi_session {
enum LANPLUS_SESSION_STATE session_state;
/* These are the algorithms agreed upon for the session */
unsigned char auth_alg;
unsigned char integrity_alg;
unsigned char crypt_alg;
unsigned char max_priv_level;
uint8_t requested_auth_alg;
uint8_t requested_integrity_alg;
uint8_t requested_crypt_alg;
uint8_t auth_alg;
uint8_t integrity_alg;
uint8_t crypt_alg;
uint8_t max_priv_level;
uint8_t lookupbit;
uint32_t console_id;
uint32_t bmc_id;
@ -105,18 +116,18 @@ struct ipmi_session {
*/
/* Random number generated byt the console */
unsigned char console_rand[16];
uint8_t console_rand[16];
/* Random number generated by the BMC */
unsigned char bmc_rand[16];
uint8_t bmc_rand[16];
unsigned char bmc_guid[16];
unsigned char requested_role; /* As sent in the RAKP 1 message */
unsigned char rakp2_return_code;
uint8_t bmc_guid[16];
uint8_t requested_role; /* As sent in the RAKP 1 message */
uint8_t rakp2_return_code;
unsigned char sik[IPMI_SIK_BUFFER_SIZE]; /* Session integrity key */
unsigned char kg[IPMI_KG_BUFFER_SIZE]; /* BMC key */
unsigned char k1[20]; /* Used for Integrity checking? */
unsigned char k2[20]; /* First 16 bytes used for AES */
uint8_t sik[IPMI_SIK_BUFFER_SIZE]; /* Session integrity key */
uint8_t kg[IPMI_KG_BUFFER_SIZE]; /* BMC key */
uint8_t k1[20]; /* Used for Integrity checking? */
uint8_t k2[20]; /* First 16 bytes used for AES */
} v2_data;
@ -127,15 +138,25 @@ struct ipmi_session {
uint16_t max_inbound_payload_size;
uint16_t max_outbound_payload_size;
uint16_t port;
unsigned char sequence_number;
uint8_t sequence_number;
/* This data describes the last SOL packet */
unsigned char last_received_sequence_number;
unsigned char last_received_byte_count;
uint8_t last_received_sequence_number;
uint8_t last_received_byte_count;
void (*sol_input_handler)(struct ipmi_rs * rsp);
} sol_data;
};
struct ipmi_cmd {
int (*func)(struct ipmi_intf * intf, int argc, char ** argv);
const char * name;
const char * desc;
};
struct ipmi_intf_support {
const char * name;
int supported;
};
struct ipmi_intf {
char name[16];
@ -143,11 +164,17 @@ struct ipmi_intf {
int fd;
int opened;
int abort;
int thump;
int noanswer;
struct ipmi_session * session;
unsigned int my_addr;
unsigned int target_addr;
struct ipmi_oem_handle * oem;
struct ipmi_cmd * cmdlist;
uint32_t my_addr;
uint32_t target_addr;
uint8_t target_lun;
uint8_t target_channel;
uint8_t devnum;
int (*setup)(struct ipmi_intf * intf);
int (*open)(struct ipmi_intf * intf);
@ -160,13 +187,20 @@ struct ipmi_intf {
};
struct ipmi_intf * ipmi_intf_load(char * name);
void ipmi_intf_print(void);
void ipmi_intf_print(struct ipmi_intf_support * intflist);
void ipmi_intf_session_set_hostname(struct ipmi_intf * intf, char * hostname);
void ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username);
void ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password);
void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, unsigned char privlvl);
void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t privlvl);
void ipmi_intf_session_set_lookupbit(struct ipmi_intf * intf, uint8_t lookupbit);
void ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf, uint8_t cipher_suite_id);
void ipmi_intf_session_set_sol_escape_char(struct ipmi_intf * intf, char sol_escape_char);
void ipmi_intf_session_set_kgkey(struct ipmi_intf * intf, char * kgkey);
void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port);
void ipmi_intf_session_set_authtype(struct ipmi_intf * intf, unsigned char authtype);
void ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype);
void ipmi_intf_session_set_timeout(struct ipmi_intf * intf, uint32_t timeout);
void ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry);
void ipmi_cleanup(struct ipmi_intf * intf);
#endif /* IPMI_INTF_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_ISOL_H
@ -48,6 +44,11 @@
#define ISOL_ENABLE_FLAG 0x01
#define ISOL_PRIVILEGE_LEVEL_USER 0x02
#define ISOL_BAUD_RATE_PARAM 0x05
#define ISOL_BAUD_RATE_9600 0x06
#define ISOL_BAUD_RATE_19200 0x07
#define ISOL_BAUD_RATE_38400 0x08
#define ISOL_BAUD_RATE_57600 0x09
#define ISOL_BAUD_RATE_115200 0x0A
#define ISOL_PREFERRED_BAUD_RATE 0x07
int ipmi_isol_main(struct ipmi_intf *, int, char **);

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2004 Kontron Canada, Inc. All Rights Reserved.
*
* Base on code from
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_KONTRONOEM_H
#define IPMI_KONTRONOEM_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_kontronoem_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KONTRONOEM_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_LANP_H
@ -46,10 +42,13 @@
# define IPMI_LAN_SUSPEND_ARP_GRAT (1)
#define IPMI_LAN_GET_STAT 0x04
#define IPMI_CHANNEL_NUMBER_MAX 0xd
#define IPMI_CHANNEL_NUMBER_MAX 0xe
extern const struct valstr ipmi_privlvl_vals[];
extern const struct valstr ipmi_authtype_vals[];
#define IPMI_LANP_TIMEOUT 3
#define IPMI_LANP_RETRIES 10
#define IPMI_LANP_WRITE_UNLOCK 0
#define IPMI_LANP_WRITE_LOCK 1
#define IPMI_LANP_WRITE_COMMIT 2
enum {
IPMI_LANP_SET_IN_PROGRESS,
@ -57,21 +56,26 @@ enum {
IPMI_LANP_AUTH_TYPE_ENABLE,
IPMI_LANP_IP_ADDR,
IPMI_LANP_IP_ADDR_SRC,
IPMI_LANP_MAC_ADDR,
IPMI_LANP_MAC_ADDR, /* 5 */
IPMI_LANP_SUBNET_MASK,
IPMI_LANP_IP_HEADER,
IPMI_LANP_PRI_RMCP_PORT,
IPMI_LANP_SEC_RMCP_PORT,
IPMI_LANP_BMC_ARP,
IPMI_LANP_BMC_ARP, /* 10 */
IPMI_LANP_GRAT_ARP,
IPMI_LANP_DEF_GATEWAY_IP,
IPMI_LANP_DEF_GATEWAY_MAC,
IPMI_LANP_BAK_GATEWAY_IP,
IPMI_LANP_BAK_GATEWAY_MAC,
IPMI_LANP_BAK_GATEWAY_MAC, /* 15 */
IPMI_LANP_SNMP_STRING,
IPMI_LANP_NUM_DEST,
IPMI_LANP_DEST_TYPE,
IPMI_LANP_DEST_ADDR,
IPMI_LANP_VLAN_ID, /* 20 */
IPMI_LANP_VLAN_PRIORITY,
IPMI_LANP_RMCP_CIPHER_SUPPORT,
IPMI_LANP_RMCP_CIPHERS,
IPMI_LANP_RMCP_PRIV_LEVELS,
IPMI_LANP_OEM_ALERT_STRING=96,
IPMI_LANP_ALERT_RETRY=97,
IPMI_LANP_UTC_OFFSET=98,
@ -85,35 +89,40 @@ static struct lan_param {
int cmd;
int size;
char desc[24];
unsigned char * data;
uint8_t * data;
int data_len;
} ipmi_lan_params[] __attribute__((unused)) = {
{ IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress" },
{ IPMI_LANP_AUTH_TYPE, 1, "Auth Type" },
{ IPMI_LANP_AUTH_TYPE, 1, "Auth Type Support" },
{ IPMI_LANP_AUTH_TYPE_ENABLE, 5, "Auth Type Enable" },
{ IPMI_LANP_IP_ADDR, 4, "IP Address" },
{ IPMI_LANP_IP_ADDR_SRC, 1, "IP Address Source" },
{ IPMI_LANP_MAC_ADDR, 6, "MAC Address" },
{ IPMI_LANP_MAC_ADDR, 6, "MAC Address" }, /* 5 */
{ IPMI_LANP_SUBNET_MASK, 4, "Subnet Mask" },
{ IPMI_LANP_IP_HEADER, 3, "IP Header" },
{ IPMI_LANP_PRI_RMCP_PORT, 2, "Primary RMCP Port" },
{ IPMI_LANP_SEC_RMCP_PORT, 2, "Secondary RMCP Port" },
{ IPMI_LANP_BMC_ARP, 1, "BMC ARP Control" },
{ IPMI_LANP_BMC_ARP, 1, "BMC ARP Control" }, /* 10 */
{ IPMI_LANP_GRAT_ARP, 1, "Gratituous ARP Intrvl" },
{ IPMI_LANP_DEF_GATEWAY_IP, 4, "Default Gateway IP" },
{ IPMI_LANP_DEF_GATEWAY_MAC, 6, "Default Gateway MAC" },
{ IPMI_LANP_BAK_GATEWAY_IP, 4, "Backup Gateway IP" },
{ IPMI_LANP_BAK_GATEWAY_MAC, 6, "Backup Gateway MAC" },
{ IPMI_LANP_BAK_GATEWAY_MAC, 6, "Backup Gateway MAC" }, /* 15 */
{ IPMI_LANP_SNMP_STRING, 18, "SNMP Community String" },
{ IPMI_LANP_NUM_DEST, 1, "Number of Destinations"},
{ IPMI_LANP_DEST_TYPE, 4, "Destination Type" },
{ IPMI_LANP_DEST_ADDR, 13, "Destination Addresses" },
{ IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String" },
{ IPMI_LANP_VLAN_ID, 2, "802.1q VLAN ID" }, /* 20 */
{ IPMI_LANP_VLAN_PRIORITY, 1, "802.1q VLAN Priority" },
{ IPMI_LANP_RMCP_CIPHER_SUPPORT,1, "RMCP+ Cipher Suite Count" },
{ IPMI_LANP_RMCP_CIPHERS, 16, "RMCP+ Cipher Suites" },
{ IPMI_LANP_RMCP_PRIV_LEVELS, 9, "Cipher Suite Priv Max" },
{ IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String" }, /* 25 */
{ IPMI_LANP_ALERT_RETRY, 1, "Alert Retry Algorithm" },
{ IPMI_LANP_UTC_OFFSET, 3, "UTC Offset" },
{ IPMI_LANP_DHCP_SERVER_IP, 4, "DHCP Server IP" },
{ IPMI_LANP_DHCP_SERVER_MAC, 6, "DHDP Server MAC" },
{ IPMI_LANP_DHCP_ENABLE, 1, "DHCP Enable" },
{ IPMI_LANP_DHCP_SERVER_MAC, 6, "DHDP Server MAC" },
{ IPMI_LANP_DHCP_ENABLE, 1, "DHCP Enable" }, /* 30 */
{ IPMI_LANP_CHAN_ACCESS_MODE, 2, "Channel Access Mode" },
{ -1 }
};

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_MAIN_H
#define IPMI_MAIN_H
#include <ipmitool/ipmi_intf.h>
int ipmi_main(int argc, char ** argv, struct ipmi_cmd * cmdlist, struct ipmi_intf_support * intflist);
void ipmi_cmd_print(struct ipmi_cmd * cmdlist);
int ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv);
#endif /* IPMI_MAIN_H */

View File

@ -28,51 +28,48 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_BMC_H
#define IPMI_BMC_H
#ifndef IPMI_MC_H
#define IPMI_MC_H
#include <ipmitool/ipmi.h>
#define BMC_GET_DEVICE_ID 0x01
#define BMC_COLD_RESET 0x02
#define BMC_WARM_RESET 0x03
#define BMC_GET_SELF_TEST 0x04
#define BMC_SET_GLOBAL_ENABLES 0x2e
#define BMC_GET_GLOBAL_ENABLES 0x2f
#define BMC_GET_DEVICE_ID 0x01
#define BMC_COLD_RESET 0x02
#define BMC_WARM_RESET 0x03
#define BMC_GET_SELF_TEST 0x04
#define BMC_SET_GLOBAL_ENABLES 0x2e
#define BMC_GET_GLOBAL_ENABLES 0x2f
#define BMC_GET_GUID 0x37
int ipmi_bmc_main(struct ipmi_intf *, int, char **);
int ipmi_mc_main(struct ipmi_intf *, int, char **);
/*
* Response data from IPM Get Device ID Command (IPMI rev 1.5, section 17.1)
* The following really apply to any IPM device, not just BMCs...
*/
struct ipm_devid_rsp {
unsigned char device_id;
unsigned char device_revision;
unsigned char fw_rev1;
unsigned char fw_rev2;
unsigned char ipmi_version;
unsigned char adtl_device_support;
unsigned char manufacturer_id[3];
unsigned char product_id[2];
unsigned char aux_fw_rev[4];
uint8_t device_id;
uint8_t device_revision;
uint8_t fw_rev1;
uint8_t fw_rev2;
uint8_t ipmi_version;
uint8_t adtl_device_support;
uint8_t manufacturer_id[3];
uint8_t product_id[2];
uint8_t aux_fw_rev[4];
} __attribute__ ((packed));
#define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */
#define IPM_DEV_DEVICE_ID_REV_MASK (0x07) /* BCD-enoded */
#define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */
#define IPM_DEV_DEVICE_ID_REV_MASK (0x07) /* BCD-enoded */
#define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */
#define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */
#define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */
#define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */
#define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */
#define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */
#define IPM_DEV_IPMI_VER_MINOR_SHIFT (4) /* Minor rev shift */
#define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */
#define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */
#define IPM_DEV_IPMI_VER_MINOR_SHIFT (4) /* Minor rev shift */
#define IPM_DEV_IPMI_VERSION_MAJOR(x) \
(x & IPM_DEV_IPMI_VER_MAJOR_MASK)
#define IPM_DEV_IPMI_VERSION_MINOR(x) \
@ -81,6 +78,26 @@ struct ipm_devid_rsp {
#define IPM_DEV_MANUFACTURER_ID(x) \
((uint32_t) ((x[2] & 0x0F) << 16 | x[1] << 8 | x[0]))
#define IPM_DEV_ADTL_SUPPORT_BITS (8)
#define IPM_DEV_ADTL_SUPPORT_BITS (8)
#endif /*IPMI_BMC_H*/
struct ipm_selftest_rsp {
unsigned char code;
unsigned char test;
} __attribute__ ((packed));
#define IPM_SFT_CODE_OK 0x55
#define IPM_SFT_CODE_NOT_IMPLEMENTED 0x56
#define IPM_SFT_CODE_DEV_CORRUPTED 0x57
#define IPM_SFT_CODE_FATAL_ERROR 0x58
#define IPM_SFT_CODE_RESERVED 0xff
#define IPM_SELFTEST_SEL_ERROR 0x80
#define IPM_SELFTEST_SDR_ERROR 0x40
#define IPM_SELFTEST_FRU_ERROR 0x20
#define IPM_SELFTEST_IPMB_ERROR 0x10
#define IPM_SELFTEST_SDRR_EMPTY 0x08
#define IPM_SELFTEST_INTERNAL_USE 0x04
#define IPM_SELFTEST_FW_BOOTBLOCK 0x02
#define IPM_SELFTEST_FW_CORRUPTED 0x01
#endif /*IPMI_MC_H */

View File

@ -0,0 +1,47 @@
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_OEM_H
#define IPMI_OEM_H
#include <ipmitool/ipmi.h>
/* oem handler, see lib/ipmi_oem.c */
struct ipmi_oem_handle {
const char * name;
const char * desc;
int (*setup)(struct ipmi_intf * intf);
};
void ipmi_oem_print(void);
int ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype);
int ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype);
#endif /*IPMI_OEM_H*/

View File

@ -0,0 +1,784 @@
/*
* Copyright (c) 2004 Dell Computers. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Dell Computers, or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* DELL COMPUTERS ("DELL") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* DELL OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_PEF_H
#define IPMI_PEF_H
#include <ipmitool/ipmi.h>
/* PEF */
struct pef_capabilities { /* "get pef capabilities" response */
uint8_t version;
uint8_t actions; /* mapped by PEF_ACTION_xxx */
uint8_t tblsize;
};
typedef enum {
P_TRUE,
P_SUPP,
P_ACTV,
P_ABLE,
} flg_e;
struct pef_table_entry {
#define PEF_CONFIG_ENABLED 0x80
#define PEF_CONFIG_PRECONFIGURED 0x40
uint8_t config;
#define PEF_ACTION_DIAGNOSTIC_INTERRUPT 0x20
#define PEF_ACTION_OEM 0x10
#define PEF_ACTION_POWER_CYCLE 0x08
#define PEF_ACTION_RESET 0x04
#define PEF_ACTION_POWER_DOWN 0x02
#define PEF_ACTION_ALERT 0x01
uint8_t action;
#define PEF_POLICY_NUMBER_MASK 0x0f
uint8_t policy_number;
#define PEF_SEVERITY_NON_RECOVERABLE 0x20
#define PEF_SEVERITY_CRITICAL 0x10
#define PEF_SEVERITY_WARNING 0x08
#define PEF_SEVERITY_OK 0x04
#define PEF_SEVERITY_INFORMATION 0x02
#define PEF_SEVERITY_MONITOR 0x01
uint8_t severity;
uint8_t generator_ID_addr;
uint8_t generator_ID_lun;
uint8_t sensor_type;
#define PEF_SENSOR_NUMBER_MATCH_ANY 0xff
uint8_t sensor_number;
#define PEF_EVENT_TRIGGER_UNSPECIFIED 0x0
#define PEF_EVENT_TRIGGER_THRESHOLD 0x1
#define PEF_EVENT_TRIGGER_SENSOR_SPECIFIC 0x6f
#define PEF_EVENT_TRIGGER_MATCH_ANY 0xff
uint8_t event_trigger;
uint8_t event_data_1_offset_mask[2];
uint8_t event_data_1_AND_mask;
uint8_t event_data_1_compare_1;
uint8_t event_data_1_compare_2;
uint8_t event_data_2_AND_mask;
uint8_t event_data_2_compare_1;
uint8_t event_data_2_compare_2;
uint8_t event_data_3_AND_mask;
uint8_t event_data_3_compare_1;
uint8_t event_data_3_compare_2;
} __attribute__ ((packed));
struct desc_map { /* maps a description to a value/mask */
const char *desc;
uint32_t mask;
};
struct bit_desc_map { /* description text container */
#define BIT_DESC_MAP_LIST 0x1 /* index-based text array */
#define BIT_DESC_MAP_ANY 0x2 /* bitwise, but only print 1st one */
#define BIT_DESC_MAP_ALL 0x3 /* bitwise, print them all */
uint32_t desc_map_type;
struct desc_map desc_maps[128];
};
static struct bit_desc_map
pef_b2s_actions __attribute__((unused)) = {
BIT_DESC_MAP_ALL,
{ {"Alert", PEF_ACTION_ALERT},
{"Power-off", PEF_ACTION_POWER_DOWN},
{"Reset", PEF_ACTION_RESET},
{"Power-cycle", PEF_ACTION_POWER_CYCLE},
{"OEM-defined", PEF_ACTION_OEM},
{"Diagnostic-interrupt", PEF_ACTION_DIAGNOSTIC_INTERRUPT},
{NULL}
} };
static struct bit_desc_map
pef_b2s_severities __attribute__((unused)) = {
BIT_DESC_MAP_ANY,
{ {"Non-recoverable", PEF_SEVERITY_NON_RECOVERABLE},
{"Critical", PEF_SEVERITY_CRITICAL},
{"Warning", PEF_SEVERITY_WARNING},
{"OK", PEF_SEVERITY_OK},
{"Information", PEF_SEVERITY_INFORMATION},
{"Monitor", PEF_SEVERITY_MONITOR},
{NULL}
} };
static struct bit_desc_map
pef_b2s_sensortypes __attribute__((unused)) = {
BIT_DESC_MAP_LIST,
{ {"Any", 255},
{"Temperature", 1},
{"Voltage", 2},
{"Current", 3},
{"Fan", 4},
{"Chassis Intrusion", 5},
{"Platform security breach", 6},
{"Processor", 7},
{"Power supply", 8},
{"Power Unit", 9},
{"Cooling device", 10},
{"Other (units-based)", 11},
{"Memory", 12},
{"Drive Slot", 13},
{"POST memory resize", 14},
{"POST error", 15},
{"Logging disabled", 16},
{"Watchdog 1", 17},
{"System event", 18},
{"Critical Interrupt", 19},
{"Button", 20},
{"Module/board", 21},
{"uController/coprocessor", 22},
{"Add-in card", 23},
{"Chassis", 24},
{"Chipset", 25},
{"Other (FRU)", 26},
{"Cable/interconnect", 27},
{"Terminator", 28},
{"System boot", 29},
{"Boot error", 30},
{"OS boot", 31},
{"OS critical stop", 32},
{"Slot/connector", 33},
{"ACPI power state", 34},
{"Watchdog 2", 35},
{"Platform alert", 36},
{"Entity presence", 37},
{"Monitor ASIC/IC", 38},
{"LAN", 39},
{"Management subsytem health",40},
{"Battery", 41},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_1 = {
BIT_DESC_MAP_LIST,
{ {"<LNC", 0}, /* '<' : getting worse */
{">LNC", 1}, /* '>' : getting better */
{"<LC", 2},
{">LC", 3},
{"<LNR", 4},
{">LNR", 5},
{">UNC", 6},
{"<UNC", 7},
{">UC", 8},
{"<UC", 9},
{">UNR", 10},
{"<UNR", 11},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_2 = {
BIT_DESC_MAP_LIST,
{ {"transition to idle", 0},
{"transition to active", 1},
{"transition to busy", 2},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_3 = {
BIT_DESC_MAP_LIST,
{ {"state deasserted", 0},
{"state asserted", 1},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_4 = {
BIT_DESC_MAP_LIST,
{ {"predictive failure deasserted", 0},
{"predictive failure asserted", 1},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_5 = {
BIT_DESC_MAP_LIST,
{ {"limit not exceeded", 0},
{"limit exceeded", 1},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_6 = {
BIT_DESC_MAP_LIST,
{ {"performance met", 0},
{"performance lags", 1},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_7 = {
BIT_DESC_MAP_LIST,
{ {"ok", 0},
{"<warn", 1}, /* '<' : getting worse */
{"<fail", 2},
{"<dead", 3},
{">warn", 4}, /* '>' : getting better */
{">fail", 5},
{"dead", 6},
{"monitor", 7},
{"informational", 8},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_8 = {
BIT_DESC_MAP_LIST,
{ {"device removed/absent", 0},
{"device inserted/present", 1},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_9 = {
BIT_DESC_MAP_LIST,
{ {"device disabled", 0},
{"device enabled", 1},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_10 = {
BIT_DESC_MAP_LIST,
{ {"transition to running", 0},
{"transition to in test", 1},
{"transition to power off", 2},
{"transition to online", 3},
{"transition to offline", 4},
{"transition to off duty", 5},
{"transition to degraded", 6},
{"transition to power save", 7},
{"install error", 8},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_11 = {
BIT_DESC_MAP_LIST,
{ {"fully redundant", 0},
{"redundancy lost", 1},
{"redundancy degraded", 2},
{"<non-redundant/sufficient", 3}, /* '<' : getting worse */
{">non-redundant/sufficient", 4}, /* '>' : getting better */
{"non-redundant/insufficient", 5},
{"<redundancy degraded", 6},
{">redundancy degraded", 7},
{NULL}
} };
static struct bit_desc_map
pef_b2s_gentype_12 = {
BIT_DESC_MAP_LIST,
{ {"D0 power state", 0},
{"D1 power state", 1},
{"D2 power state", 2},
{"D3 power state", 3},
{NULL}
} };
static struct bit_desc_map *
pef_b2s_generic_ER[] __attribute__((unused)) = {
&pef_b2s_gentype_1,
&pef_b2s_gentype_2,
&pef_b2s_gentype_3,
&pef_b2s_gentype_4,
&pef_b2s_gentype_5,
&pef_b2s_gentype_6,
&pef_b2s_gentype_7,
&pef_b2s_gentype_8,
&pef_b2s_gentype_9,
&pef_b2s_gentype_10,
&pef_b2s_gentype_11,
&pef_b2s_gentype_12,
};
#define PEF_B2S_GENERIC_ER_ENTRIES \
(sizeof(pef_b2s_generic_ER) / sizeof(pef_b2s_generic_ER[0]))
struct pef_policy_entry {
#define PEF_POLICY_ID_MASK 0xf0
#define PEF_POLICY_ID_SHIFT 4
#define PEF_POLICY_ENABLED 0x08
#define PEF_POLICY_FLAGS_MASK 0x07
#define PEF_POLICY_FLAGS_MATCH_ALWAYS 0
#define PEF_POLICY_FLAGS_PREV_OK_SKIP 1
#define PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET 2
#define PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET 3
#define PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET 4
uint8_t policy;
#define PEF_POLICY_CHANNEL_MASK 0xf0
#define PEF_POLICY_CHANNEL_SHIFT 4
#define PEF_POLICY_DESTINATION_MASK 0x0f
uint8_t chan_dest;
#define PEF_POLICY_EVENT_SPECIFIC 0x80
uint8_t alert_string_key;
} __attribute__ ((packed));
static struct bit_desc_map
pef_b2s_policies __attribute__((unused)) = {
BIT_DESC_MAP_LIST,
{ {"Match-always", PEF_POLICY_FLAGS_MATCH_ALWAYS},
{"Try-next-entry", PEF_POLICY_FLAGS_PREV_OK_SKIP},
{"Try-next-set", PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET},
{"Try-next-channel", PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET},
{"Try-next-destination", PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET},
{NULL}
} };
static struct bit_desc_map
pef_b2s_ch_medium __attribute__((unused)) = {
#define PEF_CH_MEDIUM_TYPE_IPMB 1
#define PEF_CH_MEDIUM_TYPE_ICMB_10 2
#define PEF_CH_MEDIUM_TYPE_ICMB_09 3
#define PEF_CH_MEDIUM_TYPE_LAN 4
#define PEF_CH_MEDIUM_TYPE_SERIAL 5
#define PEF_CH_MEDIUM_TYPE_XLAN 6
#define PEF_CH_MEDIUM_TYPE_PCI_SMBUS 7
#define PEF_CH_MEDIUM_TYPE_SMBUS_V1X 8
#define PEF_CH_MEDIUM_TYPE_SMBUS_V2X 9
#define PEF_CH_MEDIUM_TYPE_USB_V1X 10
#define PEF_CH_MEDIUM_TYPE_USB_V2X 11
#define PEF_CH_MEDIUM_TYPE_SYSTEM 12
BIT_DESC_MAP_LIST,
{ {"IPMB (I2C)", PEF_CH_MEDIUM_TYPE_IPMB},
{"ICMB v1.0", PEF_CH_MEDIUM_TYPE_ICMB_10},
{"ICMB v0.9", PEF_CH_MEDIUM_TYPE_ICMB_09},
{"802.3 LAN", PEF_CH_MEDIUM_TYPE_LAN},
{"Serial/Modem (RS-232)", PEF_CH_MEDIUM_TYPE_SERIAL},
{"Other LAN", PEF_CH_MEDIUM_TYPE_XLAN},
{"PCI SMBus", PEF_CH_MEDIUM_TYPE_PCI_SMBUS},
{"SMBus v1.0/1.1", PEF_CH_MEDIUM_TYPE_SMBUS_V1X},
{"SMBus v2.0", PEF_CH_MEDIUM_TYPE_SMBUS_V2X},
{"USB 1.x", PEF_CH_MEDIUM_TYPE_USB_V1X},
{"USB 2.x", PEF_CH_MEDIUM_TYPE_USB_V2X},
{"System I/F (KCS,SMIC,BT)", PEF_CH_MEDIUM_TYPE_SYSTEM},
{NULL}
} };
struct pef_cfgparm_selector {
#define PEF_CFGPARM_ID_REVISION_ONLY_MASK 0x80
#define PEF_CFGPARM_ID_SET_IN_PROGRESS 0
#define PEF_CFGPARM_ID_PEF_CONTROL 1
#define PEF_CFGPARM_ID_PEF_ACTION 2
#define PEF_CFGPARM_ID_PEF_STARTUP_DELAY 3
#define PEF_CFGPARM_ID_PEF_ALERT_STARTUP_DELAY 4
#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_SIZE 5
#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_ENTRY 6
#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_DATA_1 7
#define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_SIZE 8
#define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_ENTRY 9
#define PEF_CFGPARM_ID_SYSTEM_GUID 10
#define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_SIZE 11
#define PEF_CFGPARM_ID_PEF_ALERT_STRING_KEY 12
#define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_ENTRY 13
uint8_t id;
uint8_t set;
uint8_t block;
} __attribute__ ((packed));
struct pef_cfgparm_set_in_progress {
#define PEF_SET_IN_PROGRESS_COMMIT_WRITE 0x02
#define PEF_SET_IN_PROGRESS 0x01
uint8_t data1;
} __attribute__ ((packed));
struct pef_cfgparm_control {
#define PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY 0x08
#define PEF_CONTROL_ENABLE_STARTUP_DELAY 0x04
#define PEF_CONTROL_ENABLE_EVENT_MESSAGES 0x02
#define PEF_CONTROL_ENABLE 0x01
uint8_t data1;
} __attribute__ ((packed));
static struct bit_desc_map
pef_b2s_control __attribute__((unused)) = {
BIT_DESC_MAP_ALL,
{ {"PEF", PEF_CONTROL_ENABLE},
{"PEF event messages", PEF_CONTROL_ENABLE_EVENT_MESSAGES},
{"PEF startup delay", PEF_CONTROL_ENABLE_STARTUP_DELAY},
{"Alert startup delay", PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY},
{NULL}
} };
struct pef_cfgparm_action {
#define PEF_ACTION_ENABLE_DIAGNOSTIC_INTERRUPT 0x20
#define PEF_ACTION_ENABLE_OEM 0x10
#define PEF_ACTION_ENABLE_POWER_CYCLE 0x08
#define PEF_ACTION_ENABLE_RESET 0x04
#define PEF_ACTION_ENABLE_POWER_DOWN 0x02
#define PEF_ACTION_ENABLE_ALERT 0x01
uint8_t data1;
} __attribute__ ((packed));
struct pef_cfgparm_startup_delay {
uint8_t data1;
} __attribute__ ((packed));
struct pef_cfgparm_alert_startup_delay {
uint8_t data1;
} __attribute__ ((packed));
struct pef_cfgparm_filter_table_size {
#define PEF_FILTER_TABLE_SIZE_MASK 0x7f
uint8_t data1;
} __attribute__ ((packed));
struct pef_cfgparm_filter_table_entry {
#define PEF_FILTER_TABLE_ID_MASK 0x7f
uint8_t data1;
struct pef_table_entry entry;
} __attribute__ ((packed));
struct pef_cfgparm_filter_table_data_1 {
uint8_t data1;
uint8_t data2;
} __attribute__ ((packed));
struct pef_cfgparm_policy_table_size {
#define PEF_POLICY_TABLE_SIZE_MASK 0x7f
uint8_t data1;
} __attribute__ ((packed));
struct pef_cfgparm_policy_table_entry {
#define PEF_POLICY_TABLE_ID_MASK 0x7f
uint8_t data1;
struct pef_policy_entry entry;
} __attribute__ ((packed));
struct pef_cfgparm_system_guid {
#define PEF_SYSTEM_GUID_USED_IN_PET 0x01
uint8_t data1;
uint8_t guid[16];
} __attribute__ ((packed));
struct pef_cfgparm_alert_string_table_size {
#define PEF_ALERT_STRING_TABLE_SIZE_MASK 0x7f
uint8_t data1;
} __attribute__ ((packed));
struct pef_cfgparm_alert_string_keys {
#define PEF_ALERT_STRING_ID_MASK 0x7f
uint8_t data1;
#define PEF_EVENT_FILTER_ID_MASK 0x7f
uint8_t data2;
#define PEF_ALERT_STRING_SET_ID_MASK 0x7f
uint8_t data3;
} __attribute__ ((packed));
struct pef_cfgparm_alert_string_table_entry {
uint8_t id;
uint8_t blockno;
uint8_t block[16];
} __attribute__ ((packed));
/* PEF - LAN */
struct pef_lan_cfgparm_selector {
#define PEF_LAN_CFGPARM_CH_REVISION_ONLY_MASK 0x80
#define PEF_LAN_CFGPARM_CH_MASK 0x0f
#define PEF_LAN_CFGPARM_ID_PET_COMMUNITY 16
#define PEF_LAN_CFGPARM_ID_DEST_COUNT 17
#define PEF_LAN_CFGPARM_ID_DESTTYPE 18
#define PEF_LAN_CFGPARM_ID_DESTADDR 19
uint8_t ch;
uint8_t id;
uint8_t set;
uint8_t block;
} __attribute__ ((packed));
struct pef_lan_cfgparm_dest_size {
#define PEF_LAN_DEST_TABLE_SIZE_MASK 0x0f
uint8_t data1;
} __attribute__ ((packed));
struct pef_lan_cfgparm_dest_type {
#define PEF_LAN_DEST_TYPE_ID_MASK 0x0f
uint8_t dest;
#define PEF_LAN_DEST_TYPE_ACK 0x80
#define PEF_LAN_DEST_TYPE_MASK 0x07
#define PEF_LAN_DEST_TYPE_PET 0
#define PEF_LAN_DEST_TYPE_OEM_1 6
#define PEF_LAN_DEST_TYPE_OEM_2 7
uint8_t dest_type;
uint8_t alert_timeout;
#define PEF_LAN_RETRIES_MASK 0x07
uint8_t retries;
} __attribute__ ((packed));
static struct bit_desc_map
pef_b2s_lan_desttype __attribute__((unused)) = {
BIT_DESC_MAP_LIST,
{ {"Acknowledged", PEF_LAN_DEST_TYPE_ACK},
{"PET", PEF_LAN_DEST_TYPE_PET},
{"OEM 1", PEF_LAN_DEST_TYPE_OEM_1},
{"OEM 2", PEF_LAN_DEST_TYPE_OEM_2},
{NULL}
} };
struct pef_lan_cfgparm_dest_info {
#define PEF_LAN_DEST_MASK 0x0f
uint8_t dest;
#define PEF_LAN_DEST_ADDRTYPE_MASK 0xf0
#define PEF_LAN_DEST_ADDRTYPE_SHIFT 4
#define PEF_LAN_DEST_ADDRTYPE_IPV4_MAC 0x00
uint8_t addr_type;
#define PEF_LAN_DEST_GATEWAY_USE_BACKUP 0x01
uint8_t gateway;
uint8_t ip[4];
uint8_t mac[6];
} __attribute__ ((packed));
/* PEF - Serial/PPP */
struct pef_serial_cfgparm_selector {
#define PEF_SERIAL_CFGPARM_CH_REVISION_ONLY_MASK 0x80
#define PEF_SERIAL_CFGPARM_CH_MASK 0x0f
#define PEF_SERIAL_CFGPARM_ID_DEST_COUNT 16
#define PEF_SERIAL_CFGPARM_ID_DESTINFO 17
#define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING_COUNT 20
#define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING 21
#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_COUNT 24
#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_INFO 25
#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_PAGER_STRING 27
uint8_t ch;
uint8_t id;
uint8_t set;
uint8_t block;
} __attribute__ ((packed));
struct pef_serial_cfgparm_dest_size {
#define PEF_SERIAL_DEST_TABLE_SIZE_MASK 0x0f
uint8_t data1;
} __attribute__ ((packed));
struct pef_serial_cfgparm_dest_info {
#define PEF_SERIAL_DEST_MASK 0x0f
uint8_t dest;
#define PEF_SERIAL_DEST_TYPE_ACK 0x80
#define PEF_SERIAL_DEST_TYPE_MASK 0x0f
#define PEF_SERIAL_DEST_TYPE_DIAL 0
#define PEF_SERIAL_DEST_TYPE_TAP 1
#define PEF_SERIAL_DEST_TYPE_PPP 2
#define PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK 3
#define PEF_SERIAL_DEST_TYPE_PPP_CALLBACK 4
#define PEF_SERIAL_DEST_TYPE_OEM_1 14
#define PEF_SERIAL_DEST_TYPE_OEM_2 15
uint8_t dest_type;
uint8_t alert_timeout;
#define PEF_SERIAL_RETRIES_MASK 0x77
#define PEF_SERIAL_RETRIES_POST_CONNECT_MASK 0x70
#define PEF_SERIAL_RETRIES_PRE_CONNECT_MASK 0x07
uint8_t retries;
#define PEF_SERIAL_DIALPAGE_STRING_ID_MASK 0xf0
#define PEF_SERIAL_DIALPAGE_STRING_ID_SHIFT 4
#define PEF_SERIAL_TAP_PAGE_SERVICE_ID_MASK 0x0f
#define PEF_SERIAL_PPP_ACCT_IPADDR_ID_MASK 0xf0
#define PEF_SERIAL_PPP_ACCT_IPADDR_ID_SHIFT 4
#define PEF_SERIAL_PPP_ACCT_ID_MASK 0x0f
#define PEF_SERIAL_CALLBACK_IPADDR_ID_MASK 0x0f
#define PEF_SERIAL_CALLBACK_IPADDR_ID_SHIFT 4
#define PEF_SERIAL_CALLBACK_ACCT_ID_MASK 0xf0
uint8_t data5;
} __attribute__ ((packed));
static struct bit_desc_map
pef_b2s_serial_desttype __attribute__((unused)) = {
BIT_DESC_MAP_LIST,
{ {"Acknowledged", PEF_SERIAL_DEST_TYPE_ACK},
{"TAP page", PEF_SERIAL_DEST_TYPE_TAP},
{"PPP PET", PEF_SERIAL_DEST_TYPE_PPP},
{"Basic callback", PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK},
{"PPP callback", PEF_SERIAL_DEST_TYPE_PPP_CALLBACK},
{"OEM 1", PEF_SERIAL_DEST_TYPE_OEM_1},
{"OEM 2", PEF_SERIAL_DEST_TYPE_OEM_2},
{NULL}
} };
struct pef_serial_cfgparm_dial_string_count {
#define PEF_SERIAL_DIAL_STRING_COUNT_MASK 0x0f
uint8_t data1;
} __attribute__ ((packed));
struct pef_serial_cfgparm_dial_string {
#define PEF_SERIAL_DIAL_STRING_MASK 0x0f
uint8_t data1;
uint8_t data2;
uint8_t data3;
} __attribute__ ((packed));
struct pef_serial_cfgparm_tap_acct_count {
#define PEF_SERIAL_TAP_ACCT_COUNT_MASK 0x0f
uint8_t data1;
} __attribute__ ((packed));
struct pef_serial_cfgparm_tap_acct_info {
uint8_t data1;
#define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_MASK 0xf0
#define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_SHIFT 4
#define PEF_SERIAL_TAP_ACCT_INFO_SVC_SETTINGS_ID_MASK 0x0f
uint8_t data2;
} __attribute__ ((packed));
struct pef_serial_cfgparm_tap_svc_settings {
uint8_t data1;
#define PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX 0x0
#define PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX 0x01
#define PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX 0x02
uint8_t confirmation_flags;
uint8_t service_type[3];
uint8_t escape_mask[4];
uint8_t timeout_parms[3];
uint8_t retry_parms[2];
} __attribute__ ((packed));
static struct bit_desc_map
pef_b2s_tap_svc_confirm __attribute__((unused)) = {
BIT_DESC_MAP_LIST,
{ {"ACK", PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX},
{"211+ACK", PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX},
{"{211|213}+ACK", PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX},
{NULL}
} };
#if 0 /* FYI : config parm groupings */
struct pef_config_parms { /* PEF */
struct pef_cfgparm_set_in_progress;
struct pef_cfgparm_control;
struct pef_cfgparm_action;
struct pef_cfgparm_startup_delay; /* in seconds, 1-based */
struct pef_cfgparm_alert_startup_delay; /* in seconds, 1-based */
struct pef_cfgparm_filter_table_size; /* 1-based, READ-ONLY */
struct pef_cfgparm_filter_table_entry;
struct pef_cfgparm_filter_table_data_1;
struct pef_cfgparm_policy_table_size;
struct pef_cfgparm_policy_table_entry;
struct pef_cfgparm_system_guid;
struct pef_cfgparm_alert_string_table_size;
struct pef_cfgparm_alert_string_keys;
struct pef_cfgparm_alert_string_table_entry;
} __attribute__ ((packed));
struct pef_lan_config_parms { /* LAN */
struct pef_lan_cfgparm_set_in_progress;
struct pef_lan_cfgparm_auth_capabilities;
struct pef_lan_cfgparm_auth_type;
struct pef_lan_cfgparm_ip_address;
struct pef_lan_cfgparm_ip_address_source;
struct pef_lan_cfgparm_mac_address;
struct pef_lan_cfgparm_subnet_mask;
struct pef_lan_cfgparm_ipv4_header_parms;
struct pef_lan_cfgparm_primary_rmcp_port;
struct pef_lan_cfgparm_secondary_rmcp_port;
struct pef_lan_cfgparm_bmc_generated_arp_control;
struct pef_lan_cfgparm_gratuitous_arp;
struct pef_lan_cfgparm_default_gateway_ipaddr;
struct pef_lan_cfgparm_default_gateway_macaddr;
struct pef_lan_cfgparm_backup_gateway_ipaddr;
struct pef_lan_cfgparm_backup_gateway_macaddr;
struct pef_lan_cfgparm_pet_community;
struct pef_lan_cfgparm_destination_count;
struct pef_lan_cfgparm_destination_type;
struct pef_lan_cfgparm_destination_ipaddr;
} __attribute__ ((packed));
struct pef_serial_config_parms { /* Serial/PPP */
struct pef_serial_cfgparm_set_in_progress;
struct pef_serial_cfgparm_auth_capabilities;
struct pef_serial_cfgparm_auth_type;
struct pef_serial_cfgparm_connection_mode;
struct pef_serial_cfgparm_idle_timeout;
struct pef_serial_cfgparm_callback_control;
struct pef_serial_cfgparm_session_termination;
struct pef_serial_cfgparm_ipmi_settings;
struct pef_serial_cfgparm_mux_control;
struct pef_serial_cfgparm_modem_ring_time;
struct pef_serial_cfgparm_modem_init_string;
struct pef_serial_cfgparm_modem_escape_sequence;
struct pef_serial_cfgparm_modem_hangup_sequence;
struct pef_serial_cfgparm_modem_dial_command;
struct pef_serial_cfgparm_page_blackout_interval;
struct pef_serial_cfgparm_pet_community;
struct pef_serial_cfgparm_destination_count;
struct pef_serial_cfgparm_destination_info;
struct pef_serial_cfgparm_call_retry_interval;
struct pef_serial_cfgparm_destination_settings;
struct pef_serial_cfgparm_dialstring_count;
struct pef_serial_cfgparm_dialstring_info;
struct pef_serial_cfgparm_ipaddr_count;
struct pef_serial_cfgparm_ipaddr_info;
struct pef_serial_cfgparm_tap_acct_count;
struct pef_serial_cfgparm_tap_acct_info;
struct pef_serial_cfgparm_tap_acct_passwords; /* WRITE only */
struct pef_serial_cfgparm_tap_pager_id_strings;
struct pef_serial_cfgparm_tap_service_settings;
struct pef_serial_cfgparm_terminal_mode_config;
struct pef_serial_cfgparm_ppp_otions;
struct pef_serial_cfgparm_ppp_primary_rmcp_port;
struct pef_serial_cfgparm_ppp_secondary_rmcp_port;
struct pef_serial_cfgparm_ppp_link_auth;
struct pef_serial_cfgparm_ppp_chap_name;
struct pef_serial_cfgparm_ppp_accm;
struct pef_serial_cfgparm_ppp_snoop_accm;
struct pef_serial_cfgparm_ppp_acct_count;
struct pef_serial_cfgparm_ppp_acct_dialstring_selector;
struct pef_serial_cfgparm_ppp_acct_ipaddrs;
struct pef_serial_cfgparm_ppp_acct_user_names;
struct pef_serial_cfgparm_ppp_acct_user_domains;
struct pef_serial_cfgparm_ppp_acct_user_passwords; /* WRITE only */
struct pef_serial_cfgparm_ppp_acct_auth_settings;
struct pef_serial_cfgparm_ppp_acct_connect_hold_times;
struct pef_serial_cfgparm_ppp_udp_proxy_ipheader;
struct pef_serial_cfgparm_ppp_udp_proxy_xmit_bufsize;
struct pef_serial_cfgparm_ppp_udp_proxy_recv_bufsize;
struct pef_serial_cfgparm_ppp_remote_console_ipaddr;
} __attribute__ ((packed));
#endif
#define IPMI_CMD_GET_PEF_CAPABILITIES 0x10
#define IPMI_CMD_GET_PEF_CONFIG_PARMS 0x13
#define IPMI_CMD_GET_LAST_PROCESSED_EVT_ID 0x15
#define IPMI_CMD_GET_SYSTEM_GUID 0x37
#define IPMI_CMD_GET_CHANNEL_INFO 0x42
#define IPMI_CMD_LAN_GET_CONFIG 0x02
#define IPMI_CMD_SERIAL_GET_CONFIG 0x11
const char * ipmi_pef_bit_desc(struct bit_desc_map * map, uint32_t val);
void ipmi_pef_print_flags(struct bit_desc_map * map, flg_e type, uint32_t val);
void ipmi_pef_print_dec(const char * text, uint32_t val);
void ipmi_pef_print_hex(const char * text, uint32_t val);
void ipmi_pef_print_1xd(const char * text, uint32_t val);
void ipmi_pef_print_2xd(const char * text, uint8_t u1, uint8_t u2);
void ipmi_pef_print_str(const char * text, const char * val);
int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv);
#endif /* IPMI_PEF_H */

View File

@ -0,0 +1,90 @@
/*
(C) Kontron
*/
#ifndef _IPMI_PICMG_H_
#define _IPMI_PICMG_H_
#include <ipmitool/ipmi.h>
/* PICMG commands */
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
#define PICMG_GET_ADDRESS_INFO_CMD 0x01
#define PICMG_GET_SHELF_ADDRESS_INFO_CMD 0x02
#define PICMG_SET_SHELF_ADDRESS_INFO_CMD 0x03
#define PICMG_FRU_CONTROL_CMD 0x04
#define PICMG_GET_FRU_LED_PROPERTIES_CMD 0x05
#define PICMG_GET_LED_COLOR_CAPABILITIES_CMD 0x06
#define PICMG_SET_FRU_LED_STATE_CMD 0x07
#define PICMG_GET_FRU_LED_STATE_CMD 0x08
#define PICMG_SET_IPMB_CMD 0x09
#define PICMG_SET_FRU_POLICY_CMD 0x0A
#define PICMG_GET_FRU_POLICY_CMD 0x0B
#define PICMG_FRU_ACTIVATION_CMD 0x0C
#define PICMG_GET_DEVICE_LOCATOR_RECORD_CMD 0x0D
#define PICMG_SET_PORT_STATE_CMD 0x0E
#define PICMG_GET_PORT_STATE_CMD 0x0F
#define PICMG_COMPUTE_POWER_PROPERTIES_CMD 0x10
#define PICMG_SET_POWER_LEVEL_CMD 0x11
#define PICMG_GET_POWER_LEVEL_CMD 0x12
#define PICMG_RENEGOTIATE_POWER_CMD 0x13
#define PICMG_GET_FAN_SPEED_PROPERTIES_CMD 0x14
#define PICMG_SET_FAN_LEVEL_CMD 0x15
#define PICMG_GET_FAN_LEVEL_CMD 0x16
#define PICMG_BUSED_RESOURCE_CMD 0x17
/* AMC.0 commands */
#define PICMG_AMC_SET_PORT_STATE_CMD 0x19
#define PICMG_AMC_GET_PORT_STATE_CMD 0x1A
/* Site Types */
#define PICMG_ATCA_BOARD 0x00
#define PICMG_POWER_ENTRY 0x01
#define PICMG_SHELF_FRU 0x02
#define PICMG_DEDICATED_SHMC 0x03
#define PICMG_FAN_TRAY 0x04
#define PICMG_FAN_FILTER_TRAY 0x05
#define PICMG_ALARM 0x06
#define PICMG_AMC 0x07
#define PICMG_PMC 0x08
#define PICMG_RTM 0x09
struct picmg_set_fru_activation_cmd {
unsigned char picmg_id; /* always 0*/
unsigned char fru_id; /* threshold setting mask */
unsigned char fru_state; /* fru activation/deactivation */
} __attribute__ ((packed));
/* the LED color capabilities */
static const char* led_color_str[] __attribute__((unused)) = {
"reserved",
"BLUE",
"RED",
"GREEN",
"AMBER",
"ORANGE",
"WHITE",
"reserved"
};
static const char* amc_link_type_str[] __attribute__((unused)) = {
" FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED",
" FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1",
" FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS",
" FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1",
" FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2",
" FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET",
" FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO",
" FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE",
};
int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv);
#endif

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_RAW_H
@ -40,5 +36,9 @@
#include <ipmitool/ipmi.h>
int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv);
struct ipmi_rs * ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr,
uint8_t * wdata, uint8_t wsize, uint8_t rsize);
int ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv);
int ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv);
#endif /* IPMI_RAW_H */

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_SEL_H
@ -39,6 +35,7 @@
#include <inttypes.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_sdr.h>
#define IPMI_CMD_GET_SEL_INFO 0x40
#define IPMI_CMD_GET_SEL_ALLOC_INFO 0x41
@ -61,68 +58,138 @@ enum {
};
struct sel_get_rq {
unsigned short reserve_id;
unsigned short record_id;
unsigned char offset;
unsigned char length;
uint16_t reserve_id;
uint16_t record_id;
uint8_t offset;
uint8_t length;
} __attribute__ ((packed));
struct sel_event_record {
unsigned short record_id;
unsigned char record_type;
struct standard_spec_sel_rec{
uint32_t timestamp;
unsigned short gen_id;
unsigned char evm_rev;
unsigned char sensor_type;
unsigned char sensor_num;
unsigned char event_type : 7;
unsigned char event_dir : 1;
uint16_t gen_id;
uint8_t evm_rev;
uint8_t sensor_type;
uint8_t sensor_num;
#if WORDS_BIGENDIAN
uint8_t event_dir : 1;
uint8_t event_type : 7;
#else
uint8_t event_type : 7;
uint8_t event_dir : 1;
#endif
#define DATA_BYTE2_SPECIFIED_MASK 0xc0 /* event_data[0] bit mask */
#define DATA_BYTE3_SPECIFIED_MASK 0x30 /* event_data[0] bit mask */
#define EVENT_OFFSET_MASK 0x0f /* event_data[0] bit mask */
unsigned char event_data[3];
} __attribute__ ((packed));
uint8_t event_data[3];
};
struct sel_oem_record_ts {
unsigned short next_id;
unsigned short record_id;
unsigned char record_type;
uint32_t timestamp;
unsigned char mfg_id[3];
unsigned char oem_defined[6];
} __attribute__ ((packed));
#define SEL_OEM_TS_DATA_LEN 6
#define SEL_OEM_NOTS_DATA_LEN 13
struct oem_ts_spec_sel_rec{
uint32_t timestamp;
uint8_t manf_id[3];
uint8_t oem_defined[SEL_OEM_TS_DATA_LEN];
};
struct sel_oem_record_nots {
unsigned short next_id;
unsigned short record_id;
unsigned char record_type;
unsigned char oem_defined[13];
struct oem_nots_spec_sel_rec{
uint8_t oem_defined[SEL_OEM_NOTS_DATA_LEN];
};
struct sel_event_record {
uint16_t record_id;
uint8_t record_type;
union{
struct standard_spec_sel_rec standard_type;
struct oem_ts_spec_sel_rec oem_ts_type;
struct oem_nots_spec_sel_rec oem_nots_type;
} sel_type;
} __attribute__ ((packed));
struct ipmi_event_sensor_types {
unsigned char code;
unsigned char offset;
uint8_t code;
uint8_t offset;
#define ALL_OFFSETS_SPECIFIED 0xff
unsigned char data;
unsigned char class;
uint8_t data;
uint8_t class;
const char * type;
const char * desc;
};
/* The sel module uses the "iana" number to select the appropriate array at run time
This table if for iana number 15000 ( Kontron ), you can add you own OEM sensor types
using a similar constuct, look for switch(iana) in ipmi_sel.c
*/
static struct ipmi_event_sensor_types oem_kontron_event_types[] __attribute__((unused)) = {
/* event type details uses an oem event type */
{ 0xC0 , 0xFF , 0xff, IPMI_EVENT_CLASS_DISCRETE , "OEM Firmware Info", NULL },
{ 0xC0 , 0xFF , 0xff, IPMI_EVENT_CLASS_DISCRETE , "OEM Firmware Info", NULL },
{ 0xC1 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Push Button" },
{ 0xC1 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Bridge Reset" },
{ 0xC1 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Backplane" },
{ 0xC1 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Hotswap Fault" },
{ 0xC1 , 0x04 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Hotswap Healty" },
{ 0xC1 , 0x05 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Unknown" },
{ 0xC1 , 0x06 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "ITP" },
{ 0xC1 , 0x07 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Hardware Watchdog" },
{ 0xC1 , 0x08 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Software Reset" },
/* Uses standard digital reading type */
{ 0xC2 , 0xFF , 0xff, IPMI_EVENT_CLASS_DIGITAL , "SDRR Init Agent", NULL },
/* based on PICMG IPMB-0 Link state sensor */
{ 0xC3 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "IPMB-L Link State", "IPMB L Disabled" },
{ 0xC3 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "IPMB-L Link State", "IPMB L Enabled" },
{ 0xC4 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Push Button" },
{ 0xC4 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Hardware Power Failure" },
{ 0xC4 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Unknown" },
{ 0xC4 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Hardware Watchdog" },
{ 0xC4 , 0x04 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Soft Reset" },
{ 0xC4 , 0x05 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Warm Reset" },
{ 0xC4 , 0x06 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Cold Reset" },
{ 0xC4 , 0x07 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "IPMI Command" },
{ 0xC4 , 0x08 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Setup Reset (Save CMOS)" },
{ 0xC4 , 0x09 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Power Up Reset" },
/* event type details uses a standard */
{ 0xC5 , 0xFF , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Information Agent", NULL },
{ 0xC6 , 0x0E , 0xff, IPMI_EVENT_CLASS_DISCRETE , "POST Value", "Post Error (see data2)" },
{ 0xC7 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Upgrade" },
{ 0xC7 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Rollback(error)" },
{ 0xC7 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Errors (watchdog)" },
{ 0xC7 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Manual Rollback" },
{ 0xC7 , 0x08 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "Firmware Watchdog Bite, reset occured" },
{ 0xC8 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Not Loaded" },
{ 0xC8 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Initializing" },
{ 0xC8 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Ready" },
{ 0xC8 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Failure (see data2)" },
{ 0xC9 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Diagnostic Status", "Started" },
{ 0xC9 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Diagnostic Status", "Pass" },
{ 0xC9 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Diagnostic Status", "Fail" },
/* END */
{ 0x00, 0x00, 0xff, 0x00, NULL, NULL },
};
static struct ipmi_event_sensor_types generic_event_types[] __attribute__((unused)) = {
/* Threshold Based States */
{ 0x01, 0x00, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going low" },
{ 0x01, 0x01, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going high" },
{ 0x01, 0x02, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going low" },
{ 0x01, 0x03, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going high" },
{ 0x01, 0x04, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going low" },
{ 0x01, 0x05, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going high" },
{ 0x01, 0x06, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going low" },
{ 0x01, 0x07, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going high" },
{ 0x01, 0x08, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going low" },
{ 0x01, 0x09, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going high" },
{ 0x01, 0x0a, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable - going low" },
{ 0x01, 0x0b, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable - going high" },
{ 0x01, 0x00, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical going low " },
{ 0x01, 0x01, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical going high" },
{ 0x01, 0x02, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical going low " },
{ 0x01, 0x03, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical going high" },
{ 0x01, 0x04, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable going low " },
{ 0x01, 0x05, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable going high" },
{ 0x01, 0x06, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical going low " },
{ 0x01, 0x07, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical going high" },
{ 0x01, 0x08, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical going low " },
{ 0x01, 0x09, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical going high" },
{ 0x01, 0x0a, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable going low " },
{ 0x01, 0x0b, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable going high" },
/* DMI-based "usage state" States */
{ 0x02, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Idle" },
{ 0x02, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Active" },
@ -138,7 +205,7 @@ static struct ipmi_event_sensor_types generic_event_types[] __attribute__((unuse
{ 0x06, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Lags" },
/* Severity Event States */
{ 0x07, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to OK" },
{ 0x07, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critial from OK" },
{ 0x07, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical from OK" },
{ 0x07, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from less severe" },
{ 0x07, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable from less severe" },
{ 0x07, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical from more severe" },
@ -147,8 +214,8 @@ static struct ipmi_event_sensor_types generic_event_types[] __attribute__((unuse
{ 0x07, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Monitor" },
{ 0x07, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Informational" },
/* Availability Status States */
{ 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Removed/Absent" },
{ 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Inserted/Present" },
{ 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Absent" },
{ 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Present" },
{ 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Disabled" },
{ 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Enabled" },
{ 0x0a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Running" },
@ -190,11 +257,11 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x05, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "I/O Card area intrusion" },
{ 0x05, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Processor area intrusion" },
{ 0x05, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "System unplugged from LAN" },
{ 0x05, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Unauthorized dock/undock" },
{ 0x05, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Unauthorized dock" },
{ 0x05, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "FAN area intrusion" },
{ 0x06, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Front Panel Lockout violation attempted" },
{ 0x06, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password viiolation - user password" },
{ 0x06, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - user password" },
{ 0x06, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - setup password" },
{ 0x06, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - network boot password" },
{ 0x06, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Other pre-boot password violation" },
@ -210,6 +277,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x07, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Presence detected" },
{ 0x07, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Disabled" },
{ 0x07, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Terminator presence detected" },
{ 0x07, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Throttled" },
{ 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Presence detected" },
{ 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Failure detected" },
@ -217,6 +285,10 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x08, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply AC lost" },
{ 0x08, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC lost or out-of-range" },
{ 0x08, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC out-of-range, but present" },
{ 0x08, 0x06, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Vendor Mismatch" },
{ 0x08, 0x06, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Revision Mismatch" },
{ 0x08, 0x06, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Processor Missing" },
{ 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error" },
{ 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power off/down" },
{ 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power cycle" },
@ -236,42 +308,119 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x0c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Scrub Failed" },
{ 0x0c, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Device Disabled" },
{ 0x0c, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC logging limit reached" },
{ 0x0c, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Presence Detected" },
{ 0x0c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Configuration Error" },
{ 0x0c, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Spare" },
{ 0x0c, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Throttled" },
{ 0x0d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Present" },
{ 0x0d, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Fault" },
{ 0x0d, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Predictive Failure" },
{ 0x0d, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Hot Spare" },
{ 0x0d, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Parity Check In Progress" },
{ 0x0d, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "In Critical Array" },
{ 0x0d, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "In Failed Array" },
{ 0x0d, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Rebuild In Progress" },
{ 0x0d, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Rebuild Aborted" },
{ 0x0d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", NULL },
{ 0x0e, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "POST Memory Resize", NULL },
{ 0x0f, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Error" },
{ 0x0f, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Hang" },
{ 0x0f, 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 1" },
{ 0x0f, 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 2" },
{ 0x0f, 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 3" },
{ 0x0f, 0x02, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 4" },
{ 0x0f, 0x02, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 5" },
{ 0x0f, 0x02, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "System Boot Initiated" },
{ 0x0f, 0x00, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unspecified" },
{ 0x0f, 0x00, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No system memory installed" },
{ 0x0f, 0x00, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No usable system memory" },
{ 0x0f, 0x00, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable IDE device failure" },
{ 0x0f, 0x00, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable system-board failure" },
{ 0x0f, 0x00, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable diskette failure" },
{ 0x0f, 0x00, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable hard-disk controller failure" },
{ 0x0f, 0x00, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable PS/2 or USB keyboard failure" },
{ 0x0f, 0x00, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Removable boot media not found" },
{ 0x0f, 0x00, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable video controller failure" },
{ 0x0f, 0x00, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No video device selected" },
{ 0x0f, 0x00, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "BIOS corruption detected" },
{ 0x0f, 0x00, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "CPU voltage mismatch" },
{ 0x0f, 0x00, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "CPU speed mismatch failure" },
{ 0x0f, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unknown Error" },
{ 0x0f, 0x01, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Unspecified" },
{ 0x0f, 0x01, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Memory initialization" },
{ 0x0f, 0x01, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Hard-disk initialization" },
{ 0x0f, 0x01, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Secondary CPU Initialization" },
{ 0x0f, 0x01, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "User authentication" },
{ 0x0f, 0x01, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "User-initiated system setup" },
{ 0x0f, 0x01, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "USB resource configuration" },
{ 0x0f, 0x01, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "PCI resource configuration" },
{ 0x0f, 0x01, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Option ROM initialization" },
{ 0x0f, 0x01, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Video initialization" },
{ 0x0f, 0x01, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Cache initialization" },
{ 0x0f, 0x01, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "SMBus initialization" },
{ 0x0f, 0x01, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Keyboard controller initialization" },
{ 0x0f, 0x01, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Management controller initialization" },
{ 0x0f, 0x01, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Docking station attachment" },
{ 0x0f, 0x01, 0x0f, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Enabling docking station" },
{ 0x0f, 0x01, 0x10, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Docking station ejection" },
{ 0x0f, 0x01, 0x11, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Disabling docking station" },
{ 0x0f, 0x01, 0x12, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Calling operating system wake-up vector" },
{ 0x0f, 0x01, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "System boot initiated" },
{ 0x0f, 0x01, 0x14, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Motherboard initialization" },
{ 0x0f, 0x01, 0x15, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "reserved" },
{ 0x0f, 0x01, 0x16, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Floppy initialization" },
{ 0x0f, 0x01, 0x17, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Keyboard test" },
{ 0x0f, 0x01, 0x18, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Pointing device test" },
{ 0x0f, 0x01, 0x19, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Primary CPU initialization" },
{ 0x0f, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Unknown Hang" },
{ 0x0f, 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Unspecified" },
{ 0x0f, 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Memory initialization" },
{ 0x0f, 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Hard-disk initialization" },
{ 0x0f, 0x02, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Secondary CPU Initialization" },
{ 0x0f, 0x02, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "User authentication" },
{ 0x0f, 0x02, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "User-initiated system setup" },
{ 0x0f, 0x02, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "USB resource configuration" },
{ 0x0f, 0x02, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "PCI resource configuration" },
{ 0x0f, 0x02, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Option ROM initialization" },
{ 0x0f, 0x02, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Video initialization" },
{ 0x0f, 0x02, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Cache initialization" },
{ 0x0f, 0x02, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "SMBus initialization" },
{ 0x0f, 0x02, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Keyboard controller initialization" },
{ 0x0f, 0x02, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Management controller initialization" },
{ 0x0f, 0x02, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Docking station attachment" },
{ 0x0f, 0x02, 0x0f, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Enabling docking station" },
{ 0x0f, 0x02, 0x10, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Docking station ejection" },
{ 0x0f, 0x02, 0x11, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Disabling docking station" },
{ 0x0f, 0x02, 0x12, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Calling operating system wake-up vector" },
{ 0x0f, 0x02, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "System boot initiated" },
{ 0x0f, 0x02, 0x14, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Motherboard initialization" },
{ 0x0f, 0x02, 0x15, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "reserved" },
{ 0x0f, 0x02, 0x16, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Floppy initialization" },
{ 0x0f, 0x02, 0x17, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Keyboard test" },
{ 0x0f, 0x02, 0x18, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Pointing device test" },
{ 0x0f, 0x02, 0x19, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Primary CPU initialization" },
{ 0x0f, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Unknown Progress" },
{ 0x10, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Correctable memory error logging disabled" },
{ 0x10, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Event logging disabled" },
{ 0x10, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log area reset/cleared" },
{ 0x10, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "All event logging disabled" },
{ 0x10, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log full" },
{ 0x10, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log almost full" },
{ 0x11, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "BIOS Reset" },
{ 0x11, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Reset" },
{ 0x11, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Shut Down" },
{ 0x11, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Down" },
{ 0x11, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Cycle" },
{ 0x11, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS NMI/diag Interrupt" },
{ 0x11, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS NMI/Diag Interrupt" },
{ 0x11, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Expired" },
{ 0x11, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS pre-timeout Interrupt" },
{ 0x12, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "System Reconfigured" },
{ 0x12, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "OEM System boot event" },
{ 0x12, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Undetermined system hardware failure" },
{ 0x12, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Entry added to auxillary log" },
{ 0x12, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Entry added to auxiliary log" },
{ 0x12, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "PEF Action" },
{ 0x12, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Timestamp Clock Sync." },
{ 0x12, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Timestamp Clock Sync" },
{ 0x13, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Front Panel NMI" },
{ 0x13, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "NMI/Diag Interrupt" },
{ 0x13, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Timeout" },
{ 0x13, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "I/O Channel check NMI" },
{ 0x13, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Software NMI" },
@ -281,10 +430,13 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x13, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Correctable error" },
{ 0x13, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Uncorrectable error" },
{ 0x13, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Fatal NMI" },
{ 0x13, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Fatal Error" },
{ 0x14, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Power Button pressed" },
{ 0x14, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Sleep Button pressed" },
{ 0x14, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Reset Button pressed" },
{ 0x14, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "FRU Latch" },
{ 0x14, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "FRU Service" },
{ 0x15, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module/Board", NULL },
{ 0x16, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Microcontroller/Coprocessor", NULL },
@ -292,7 +444,10 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x18, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chassis", NULL },
{ 0x19, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", NULL },
{ 0x1a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL },
{ 0x1b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", NULL },
{ 0x1b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Connected" },
{ 0x1b, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Config Error" },
{ 0x1c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Terminator", NULL },
{ 0x1d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by power up" },
@ -300,6 +455,9 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x1d, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by warm reset" },
{ 0x1d, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "User requested PXE boot" },
{ 0x1d, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Automatic boot to diagnostic" },
{ 0x1d, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "OS initiated hard reset" },
{ 0x1d, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "OS initiated warm reset" },
{ 0x1d, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "System Restart" },
{ 0x1e, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "No bootable media" },
{ 0x1e, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Non-bootable disk in drive" },
@ -315,18 +473,23 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x1f, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "ROM boot completed" },
{ 0x1f, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "boot completed - device not specified" },
{ 0x20, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Critical Stop", "Stop during OS load/init" },
{ 0x20, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Critical Stop", "Run-time stop" },
{ 0x20, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Error during system startup" },
{ 0x20, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Run-time critical stop" },
{ 0x20, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "OS graceful stop" },
{ 0x20, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "OS graceful shutdown" },
{ 0x20, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "PEF initiated soft shutdown" },
{ 0x20, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Agent not responding" },
{ 0x21, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Fault Status asserted" },
{ 0x21, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Identify Status asserted" },
{ 0x21, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector Device installed/attached" },
{ 0x21, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device installation" },
{ 0x21, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device removal" },
{ 0x21, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot Power is off" },
{ 0x21, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector device removal request" },
{ 0x21, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Interlock asserted" },
{ 0x21, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot is disabled" },
{ 0x21, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Fault Status" },
{ 0x21, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Identify Status" },
{ 0x21, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Device Installed" },
{ 0x21, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Ready for Device Installation" },
{ 0x21, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Ready for Device Removal" },
{ 0x21, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot Power is Off" },
{ 0x21, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Device Removal Request" },
{ 0x21, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Interlock" },
{ 0x21, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot is Disabled" },
{ 0x21, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Spare Device" },
{ 0x22, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S0/G0: working" },
{ 0x22, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" },
@ -371,18 +534,66 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x28, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Controller access degraded or unavailable" },
{ 0x28, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller off-line" },
{ 0x28, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller unavailable" },
{ 0x28, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Sensor failure" },
{ 0x28, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "FRU failure" },
{ 0x29, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Low" },
{ 0x29, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Failed" },
{ 0x29, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Presence Detected" },
{ 0x2b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware change detected" },
{ 0x2b, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected" },
{ 0x2b, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware incompatibility detected" },
{ 0x2b, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software incompatibility detected" },
{ 0x2b, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Invalid or unsupported hardware version" },
{ 0x2b, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Invalid or unsupported firmware or software version" },
{ 0x2b, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware change success" },
{ 0x2b, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success" },
{ 0x2c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Not Installed" },
{ 0x2c, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Inactive" },
{ 0x2c, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Activation Requested" },
{ 0x2c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Activation in Progress" },
{ 0x2c, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Active" },
{ 0x2c, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Deactivation Requested" },
{ 0x2c, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Deactivation in Progress" },
{ 0x2c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Communication lost" },
{ 0xF0, 0x00, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M0" },
{ 0xF0, 0x01, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M1" },
{ 0xF0, 0x02, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M2" },
{ 0xF0, 0x03, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M3" },
{ 0xF0, 0x04, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M4" },
{ 0xF0, 0x05, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M5" },
{ 0xF0, 0x06, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M6" },
{ 0xF0, 0x06, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M7" },
{ 0xF1, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A disabled, IPMB-B disabled" },
{ 0xF1, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A enabled, IPMB-B disabled" },
{ 0xF1, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A disabled, IPMB-B enabled" },
{ 0xF1, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A enabled, IPMP-B enabled" },
{ 0xF2, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Module Handle Closed" },
{ 0xF2, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Module Handle Opened" },
{ 0xF2, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Quiesced" },
{ 0xC0, 0x00, 0xff, 0x00, "OEM", "OEM Specific" },
{ 0x00, 0x00, 0x00, 0x00, NULL, NULL },
};
int ipmi_sel_main(struct ipmi_intf *, int, char **);
void ipmi_sel_print_std_entry(struct sel_event_record * evt);
void ipmi_sel_print_std_entry_verbose(struct sel_event_record * evt);
void ipmi_get_event_desc(struct sel_event_record * rec, char ** desc);
const char * ipmi_sel_get_sensor_type(unsigned char code);
void ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt);
void ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt);
void ipmi_sel_print_extended_entry(struct ipmi_intf * intf, struct sel_event_record * evt);
void ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt);
void ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc);
const char * ipmi_sel_get_sensor_type(uint8_t code);
const char * ipmi_sel_get_sensor_type_offset(uint8_t code, uint8_t offset);
uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel_event_record * evt);
char * get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf);
char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
int ipmi_sel_oem_init(const char * filename);
#endif /* IPMI_SEL_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_SENSOR_H
@ -40,13 +36,7 @@
#include <math.h>
#include <ipmitool/bswap.h>
#include <ipmitool/ipmi.h>
/* ipmi sensor commands */
#define GET_SENSOR_READING 0x2d
#define GET_SENSOR_FACTORS 0x23
#define SET_SENSOR_THRESHOLDS 0x26
#define GET_SENSOR_THRESHOLDS 0x27
#define GET_SENSOR_TYPE 0x2f
#include <ipmitool/ipmi_sdr.h>
/* threshold specification bits for analog sensors for get sensor threshold command
* and set sensor threshold command
@ -76,19 +66,19 @@
#define STATE_14_ASSERTED 0x40
struct sensor_set_thresh_rq {
unsigned char sensor_num; /* sensor # */
unsigned char set_mask; /* threshold setting mask */
unsigned char lower_non_crit; /* new lower non critical threshold*/
unsigned char lower_crit; /* new lower critical threshold*/
unsigned char lower_non_recov; /* new lower non recoverable threshold*/
unsigned char upper_non_crit; /* new upper non critical threshold*/
unsigned char upper_crit; /* new upper critical threshold*/
unsigned char upper_non_recov; /* new upper non recoverable threshold*/
uint8_t sensor_num; /* sensor # */
uint8_t set_mask; /* threshold setting mask */
uint8_t lower_non_crit; /* new lower non critical threshold*/
uint8_t lower_crit; /* new lower critical threshold*/
uint8_t lower_non_recov; /* new lower non recoverable threshold*/
uint8_t upper_non_crit; /* new upper non critical threshold*/
uint8_t upper_crit; /* new upper critical threshold*/
uint8_t upper_non_recov; /* new upper non recoverable threshold*/
} __attribute__ ((packed));
int ipmi_sensor_main(struct ipmi_intf *, int, char **);
void ipmi_sensor_print_full(struct ipmi_intf *, struct sdr_record_full_sensor *);
void ipmi_sensor_print_compact(struct ipmi_intf *, struct sdr_record_compact_sensor *);
int ipmi_sensor_print_full(struct ipmi_intf *, struct sdr_record_full_sensor *);
int ipmi_sensor_print_compact(struct ipmi_intf *, struct sdr_record_compact_sensor *);
#endif /* IPMI_SENSOR_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_SESSION_H
@ -49,46 +45,46 @@
*/
struct get_session_info_rsp
{
unsigned char session_handle;
uint8_t session_handle;
#if WORDS_BIGENDIAN
unsigned char __reserved1 : 2;
unsigned char session_slot_count : 6; /* 1-based */
uint8_t __reserved1 : 2;
uint8_t session_slot_count : 6; /* 1-based */
#else
unsigned char session_slot_count : 6; /* 1-based */
unsigned char __reserved1 : 2;
uint8_t session_slot_count : 6; /* 1-based */
uint8_t __reserved1 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved2 : 2;
unsigned char active_session_count : 6; /* 1-based */
uint8_t __reserved2 : 2;
uint8_t active_session_count : 6; /* 1-based */
#else
unsigned char active_session_count : 6; /* 1-based */
unsigned char __reserved2 : 2;
uint8_t active_session_count : 6; /* 1-based */
uint8_t __reserved2 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved3 : 2;
unsigned char user_id : 6;
uint8_t __reserved3 : 2;
uint8_t user_id : 6;
#else
unsigned char user_id : 6;
unsigned char __reserved3 : 2;
uint8_t user_id : 6;
uint8_t __reserved3 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved4 : 4;
unsigned char privilege_level : 4;
uint8_t __reserved4 : 4;
uint8_t privilege_level : 4;
#else
unsigned char privilege_level : 4;
unsigned char __reserved4 : 4;
uint8_t privilege_level : 4;
uint8_t __reserved4 : 4;
#endif
#if WORDS_BIGENDIAN
unsigned char auxiliary_data : 4;
unsigned char channel_number : 4;
uint8_t auxiliary_data : 4;
uint8_t channel_number : 4;
#else
unsigned char channel_number : 4;
unsigned char auxiliary_data : 4;
uint8_t channel_number : 4;
uint8_t auxiliary_data : 4;
#endif
union
@ -96,25 +92,25 @@ struct get_session_info_rsp
/* Only exists if channel type is 802.3 LAN */
struct
{
unsigned char console_ip[4]; /* MSBF */
unsigned char console_mac[6]; /* MSBF */
uint8_t console_ip[4]; /* MSBF */
uint8_t console_mac[6]; /* MSBF */
uint16_t console_port; /* LSBF */
} lan_data;
/* Only exists if channel type is async. serial modem */
struct
{
unsigned char session_channel_activity_type;
uint8_t session_channel_activity_type;
#if WORDS_BIGENDIAN
unsigned char __reserved5 : 4;
unsigned char destination_selector : 4;
uint8_t __reserved5 : 4;
uint8_t destination_selector : 4;
#else
unsigned char destination_selector : 4;
unsigned char __reserved5 : 4;
uint8_t destination_selector : 4;
uint8_t __reserved5 : 4;
#endif
unsigned char console_ip[4]; /* MSBF */
uint8_t console_ip[4]; /* MSBF */
/* Only exists if session is PPP */
uint16_t console_port; /* LSBF */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_SOL_H
@ -39,6 +35,8 @@
#include <ipmitool/ipmi.h>
#define SOL_ESCAPE_CHARACTER_DEFAULT '~'
#define SOL_KEEPALIVE_TIMEOUT 30
#define IPMI_SOL_SERIAL_ALERT_MASK_SUCCEED 0x08
#define IPMI_SOL_SERIAL_ALERT_MASK_DEFERRED 0x04
@ -48,19 +46,19 @@
struct sol_config_parameters {
unsigned char set_in_progress;
unsigned char enabled;
unsigned char force_encryption;
unsigned char force_authentication;
unsigned char privilege_level;
unsigned char character_accumulate_level;
unsigned char character_send_threshold;
unsigned char retry_count;
unsigned char retry_interval;
unsigned char non_volatile_bit_rate;
unsigned char volatile_bit_rate;
unsigned char payload_channel;
unsigned short payload_port;
uint8_t set_in_progress;
uint8_t enabled;
uint8_t force_encryption;
uint8_t force_authentication;
uint8_t privilege_level;
uint8_t character_accumulate_level;
uint8_t character_send_threshold;
uint8_t retry_count;
uint8_t retry_interval;
uint8_t non_volatile_bit_rate;
uint8_t volatile_bit_rate;
uint8_t payload_channel;
uint16_t payload_port;
};
@ -69,17 +67,17 @@ struct sol_config_parameters {
* From table 24-2 of the IPMI v2.0 spec
*/
struct activate_payload_rsp {
unsigned char auxiliary_data[4];
unsigned char inbound_payload_size[2]; /* LS byte first */
unsigned char outbound_payload_size[2]; /* LS byte first */
unsigned char payload_udp_port[2]; /* LS byte first */
unsigned char payload_vlan_number[2]; /* LS byte first */
uint8_t auxiliary_data[4];
uint8_t inbound_payload_size[2]; /* LS byte first */
uint8_t outbound_payload_size[2]; /* LS byte first */
uint8_t payload_udp_port[2]; /* LS byte first */
uint8_t payload_vlan_number[2]; /* LS byte first */
} __attribute__ ((packed));
int ipmi_sol_main(struct ipmi_intf *, int, char **);
int ipmi_get_sol_info(struct ipmi_intf * intf,
unsigned char channel,
uint8_t channel,
struct sol_config_parameters * params);

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_STRINGS_H
@ -39,12 +35,26 @@
#include <ipmitool/helper.h>
extern const struct valstr completion_code_vals[];
extern const struct valstr entity_id_vals[];
extern const struct valstr entity_device_type_vals[];
extern const struct valstr ipmi_netfn_vals[];
extern const struct valstr ipmi_channel_activity_type_vals[];
extern const struct valstr ipmi_privlvl_vals[];
extern const struct valstr impi_bit_rate_vals[];
extern const struct valstr ipmi_set_in_progress_vals[];
extern const struct valstr ipmi_authtype_session_vals[];
extern const struct valstr ipmi_authtype_vals[];
extern const struct valstr ipmi_channel_protocol_vals[];
extern const struct valstr ipmi_channel_medium_vals[];
extern const struct valstr ipmi_chassis_power_control_vals[];
extern const struct valstr ipmi_auth_algorithms[];
extern const struct valstr ipmi_integrity_algorithms[];
extern const struct valstr ipmi_encryption_algorithms[];
extern const struct valstr ipmi_oem_info[];
extern const struct oemvalstr ipmi_oem_sdr_type_vals[];
#endif /*IPMI_STRINGS_H*/

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_SUNOEM_H
#define IPMI_SUNOEM_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_sdr.h>
#define IPMI_NETFN_SUNOEM 0x2e
#define IPMI_SUNOEM_SET_SSH_KEY 0x01
#define IPMI_SUNOEM_DEL_SSH_KEY 0x02
#define IPMI_SUNOEM_GET_HEALTH_STATUS 0x10
#define IPMI_SUNOEM_SET_FAN_SPEED 0x20
#define IPMI_SUNOEM_LED_GET 0x21
#define IPMI_SUNOEM_LED_SET 0x22
int ipmi_sunoem_main(struct ipmi_intf *, int, char **);
struct ipmi_rs * sunoem_led_get(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype);
struct ipmi_rs * sunoem_led_set(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype, int ledmode);
#endif /*IPMI_SUNOEM_H*/

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2005 Tyan Computer Corp. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_TSOL_H
#define IPMI_TSOL_H
#include <ipmitool/ipmi.h>
#define IPMI_TSOL_CMD_SENDKEY 0x03
#define IPMI_TSOL_CMD_START 0x06
#define IPMI_TSOL_CMD_STOP 0x02
#define IPMI_TSOL_DEF_PORT 6230
int ipmi_tsol_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_TSOL_H */

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMI_USER_H
@ -48,41 +44,41 @@
*/
struct user_access_rsp {
#if WORDS_BIGENDIAN
unsigned char __reserved1 : 2;
unsigned char maximum_ids : 6;
uint8_t __reserved1 : 2;
uint8_t maximum_ids : 6;
#else
unsigned char maximum_ids : 6;
unsigned char __reserved1 : 2;
uint8_t maximum_ids : 6;
uint8_t __reserved1 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved2 : 2;
unsigned char enabled_user_count : 6;
uint8_t __reserved2 : 2;
uint8_t enabled_user_count : 6;
#else
unsigned char enabled_user_count : 6;
unsigned char __reserved2 : 2;
uint8_t enabled_user_count : 6;
uint8_t __reserved2 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved3 : 2;
unsigned char fixed_name_count : 6;
uint8_t __reserved3 : 2;
uint8_t fixed_name_count : 6;
#else
unsigned char fixed_name_count : 6;
unsigned char __reserved3 : 2;
uint8_t fixed_name_count : 6;
uint8_t __reserved3 : 2;
#endif
#if WORDS_BIGENDIAN
unsigned char __reserved4 : 1;
unsigned char no_callin_access : 1;
unsigned char link_auth_access : 1;
unsigned char ipmi_messaging_access : 1;
unsigned char channel_privilege_limit : 4;
uint8_t __reserved4 : 1;
uint8_t no_callin_access : 1;
uint8_t link_auth_access : 1;
uint8_t ipmi_messaging_access : 1;
uint8_t channel_privilege_limit : 4;
#else
unsigned char channel_privilege_limit : 4;
unsigned char ipmi_messaging_access : 1;
unsigned char link_auth_access : 1;
unsigned char no_callin_access : 1;
unsigned char __reserved4 : 1;
uint8_t channel_privilege_limit : 4;
uint8_t ipmi_messaging_access : 1;
uint8_t link_auth_access : 1;
uint8_t no_callin_access : 1;
uint8_t __reserved4 : 1;
#endif
} __attribute__ ((packed));

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#ifndef IPMITOOL_LOG_H

View File

@ -27,19 +27,19 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
INCLUDES = -I$(top_srcdir)/include
MAINTAINERCLEANFILES = Makefile.in
noinst_LTLIBRARIES = libipmitool.la
libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_isol.c \
ipmi_lanp.c ipmi_fru.c ipmi_chassis.c ipmi_bmc.c log.c \
dimm_spd.c ipmi_sensor.c ipmi_channel.c ipmi_event.c \
ipmi_session.c ipmi_strings.c ipmi_user.c ipmi_raw.c
libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_pef.c \
ipmi_lanp.c ipmi_fru.c ipmi_chassis.c ipmi_mc.c log.c \
dimm_spd.c ipmi_sensor.c ipmi_channel.c ipmi_event.c \
ipmi_session.c ipmi_strings.c ipmi_user.c ipmi_raw.c \
ipmi_oem.c ipmi_isol.c ipmi_sunoem.c ipmi_fwum.c ipmi_picmg.c \
ipmi_main.c ipmi_tsol.c ipmi_firewall.c ipmi_kontronoem.c \
ipmi_hpmfwupg.c
libipmitool_la_LDFLAGS = -export-dynamic
libipmitool_la_LIBADD = -lm
libipmitool_la_DEPENDENCIES =

View File

@ -28,13 +28,11 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <ipmitool/ipmi.h>
#include <ipmitool/log.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_fru.h>
@ -670,13 +668,75 @@ const struct valstr jedec_id5_vals[] = {
{ 0x00, NULL },
};
void ipmi_spd_print(struct ipmi_intf * intf, unsigned char id)
int
ipmi_spd_print(uint8_t *spd_data, int len)
{
int size;
if (len < 92)
return -1; /* we need first 91 bytes to do our thing */
size = spd_data[5] * (spd_data[31] << 2);
printf(" Memory Size : %d MB\n", size);
printf(" Memory Type : %s\n",
val2str(spd_data[2], spd_memtype_vals));
printf(" Voltage Intf : %s\n",
val2str(spd_data[8], spd_voltage_vals));
printf(" Error Detect/Cor : %s\n",
val2str(spd_data[11], spd_config_vals));
/* handle jedec table bank continuation values */
printf(" Manufacturer : ");
if (spd_data[64] != 0x7f)
printf("%s\n",
val2str(spd_data[64], jedec_id1_vals));
else {
if (spd_data[65] != 0x7f)
printf("%s\n",
val2str(spd_data[65], jedec_id2_vals));
else {
if (spd_data[66] != 0x7f)
printf("%s\n",
val2str(spd_data[66], jedec_id3_vals));
else {
if (spd_data[67] != 0x7f)
printf("%s\n",
val2str(spd_data[67],
jedec_id4_vals));
else
printf("%s\n",
val2str(spd_data[68],
jedec_id5_vals));
}
}
}
if (spd_data[73]) {
char part[19];
memcpy(part, spd_data+73, 18);
part[18] = 0;
printf(" Part Number : %s\n", part);
}
printf(" Serial Number : %02x%02x%02x%02x\n",
spd_data[95], spd_data[96], spd_data[97], spd_data[98]);
if (verbose) {
printf("\n");
printbuf(spd_data, len, "SPD DATA");
}
return 0;
}
int
ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct fru_info fru;
unsigned char spd_data[256], msg_data[4];
int len, offset, size;
uint8_t spd_data[256], msg_data[4];
int len, offset;
msg_data[0] = id;
@ -687,14 +747,26 @@ void ipmi_spd_print(struct ipmi_intf * intf, unsigned char id)
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
return;
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return -1;
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
if (verbose > 1)
printf("fru.size = %d bytes (accessed by %s)\n",
fru.size, fru.access ? "words" : "bytes");
lprintf(LOG_DEBUG, "fru.size = %d bytes (accessed by %s)",
fru.size, fru.access ? "words" : "bytes");
if (fru.size < 1) {
lprintf(LOG_ERR, " Invalid FRU size %d", fru.size);
return -1;
}
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
@ -711,57 +783,28 @@ void ipmi_spd_print(struct ipmi_intf * intf, unsigned char id)
msg_data[3] = 32;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
printf(" Error while reading FRU data.\n");
return;
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return -1;
}
if (rsp->ccode == 0xc3) {
printf(" Timeout while reading FRU data. (Device not present?)\n");
return;
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
/* Timeouts are acceptable. No DIMM in the socket */
if (rsp->ccode == 0xc3)
return 1;
return -1;
}
if (rsp->ccode)
break;
len = rsp->data[0];
memcpy(&spd_data[offset], rsp->data + 1, len);
offset += len;
} while (offset < fru.size);
if (verbose)
printbuf(spd_data, offset, "SPD DATA");
/* now print spd info */
ipmi_spd_print(spd_data, offset);
if (offset < 92)
return; /* we need first 91 bytes to do our thing */
size = spd_data[5] * (spd_data[31] << 2);
printf(" Memory Size : %d MB\n", size);
printf(" Memory Type : %s\n", val2str(spd_data[2], spd_memtype_vals));
printf(" Voltage Intf : %s\n", val2str(spd_data[8], spd_voltage_vals));
printf(" Error Detect/Cor : %s\n", val2str(spd_data[11], spd_config_vals));
/* handle jedec table bank continuation values */
printf(" Manufacturer : ");
if (spd_data[64] != 0x7f)
printf("%s\n", val2str(spd_data[64], jedec_id1_vals));
else {
if (spd_data[65] != 0x7f)
printf("%s\n", val2str(spd_data[65], jedec_id2_vals));
else {
if (spd_data[66] != 0x7f)
printf("%s\n", val2str(spd_data[66], jedec_id3_vals));
else {
if (spd_data[67] != 0x7f)
printf("%s\n", val2str(spd_data[67], jedec_id4_vals));
else
printf("%s\n", val2str(spd_data[68], jedec_id5_vals));
}
}
}
if (spd_data[73]) {
char part[19];
memcpy(part, spd_data+73, 18);
part[18] = 0;
printf(" Part Number : %s\n", part);
}
return 0;
}

View File

@ -28,41 +28,55 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h> /* For TIOCNOTTY */
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <signal.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <strings.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ipmitool/helper.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
uint32_t buf2long(unsigned char * buf)
#ifdef HAVE_PATHS_H
# include <paths.h>
#else
# define _PATH_VARRUN "/var/run/"
#endif
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
extern int verbose;
uint32_t buf2long(uint8_t * buf)
{
return (uint32_t)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
}
unsigned short buf2short(unsigned char * buf)
uint16_t buf2short(uint8_t * buf)
{
return (unsigned short)(buf[1] << 8 | buf[0]);
return (uint16_t)(buf[1] << 8 | buf[0]);
}
const char * buf2str(unsigned char * buf, int len)
const char * buf2str(uint8_t * buf, int len)
{
static char str[1024];
int i;
if (!len || len > 1024)
if (len <= 0 || len > 1024)
return NULL;
memset(str, 0, 1024);
@ -75,87 +89,203 @@ const char * buf2str(unsigned char * buf, int len)
return (const char *)str;
}
void printbuf(const unsigned char * buf, int len, const char * desc)
void printbuf(const uint8_t * buf, int len, const char * desc)
{
int i;
if (!len)
if (len <= 0)
return;
printf("%s (%d bytes)\n", desc, len);
if (verbose < 1)
return;
fprintf(stderr, "%s (%d bytes)\r\n", desc, len);
for (i=0; i<len; i++) {
if (((i%16) == 0) && (i != 0))
printf("\n");
printf(" %2.2x", buf[i]);
fprintf(stderr, "\r\n");
fprintf(stderr, " %2.2x", buf[i]);
}
printf("\n");
fprintf(stderr, "\r\n");
}
const char * val2str(unsigned short val, const struct valstr *vs)
const char * val2str(uint16_t val, const struct valstr *vs)
{
static char un_str[16];
int i = 0;
static char un_str[32];
int i;
while (vs[i].str) {
for (i = 0; vs[i].str != NULL; i++) {
if (vs[i].val == val)
return vs[i].str;
i++;
}
memset(un_str, 0, 16);
snprintf(un_str, 16, "Unknown (0x%02x)", val);
memset(un_str, 0, 32);
snprintf(un_str, 32, "Unknown (0x%x)", val);
return un_str;
}
unsigned short str2val(const char *str, const struct valstr *vs)
const char * oemval2str(uint16_t oem, uint16_t val,
const struct oemvalstr *vs)
{
int i = 0;
static char un_str[32];
int i;
while (vs[i].str) {
if (!strncasecmp(vs[i].str, str, strlen(str)))
for (i = 0; vs[i].oem != 0x00 && vs[i].str != NULL; i++) {
/* FIXME: for now on we assume PICMG capability on all IANAs */
if
(
(
vs[i].oem == oem
||
vs[i].oem == IPMI_OEM_PICMG
)
&&
vs[i].val == val
)
{
return vs[i].str;
}
}
memset(un_str, 0, 32);
snprintf(un_str, 32, "OEM reserved #%02x", val);
return un_str;
}
uint16_t str2val(const char *str, const struct valstr *vs)
{
int i;
for (i = 0; vs[i].str != NULL; i++) {
if (strncasecmp(vs[i].str, str, __maxlen(str, vs[i].str)) == 0)
return vs[i].val;
i++;
}
return 0;
return vs[i].val;
}
void signal_handler(int sig, void * handler)
/* print_valstr - print value string list to log or stdout
*
* @vs: value string list to print
* @title: name of this value string list
* @loglevel: what log level to print, -1 for stdout
*/
void
print_valstr(const struct valstr * vs, const char * title, int loglevel)
{
struct sigaction act;
int i;
if (!sig || !handler)
if (vs == NULL)
return;
memset(&act, 0, sizeof(act));
act.sa_handler = handler;
act.sa_flags = 0;
if (sigemptyset(&act.sa_mask) < 0) {
psignal(sig, "unable to empty signal set");
return;
if (title != NULL) {
if (loglevel < 0)
printf("\n%s:\n\n", title);
else
lprintf(loglevel, "\n%s:\n", title);
}
if (sigaction(sig, &act, NULL) < 0) {
psignal(sig, "unable to register handler");
return;
if (loglevel < 0) {
printf(" VALUE\tHEX\tSTRING\n");
printf("==============================================\n");
} else {
lprintf(loglevel, " VAL\tHEX\tSTRING");
lprintf(loglevel, "==============================================");
}
for (i = 0; vs[i].str != NULL; i++) {
if (loglevel < 0) {
if (vs[i].val < 256)
printf(" %d\t0x%02x\t%s\n", vs[i].val, vs[i].val, vs[i].str);
else
printf(" %d\t0x%04x\t%s\n", vs[i].val, vs[i].val, vs[i].str);
} else {
if (vs[i].val < 256)
lprintf(loglevel, " %d\t0x%02x\t%s", vs[i].val, vs[i].val, vs[i].str);
else
lprintf(loglevel, " %d\t0x%04x\t%s", vs[i].val, vs[i].val, vs[i].str);
}
}
if (loglevel < 0)
printf("\n");
else
lprintf(loglevel, "");
}
unsigned char ipmi_csum(unsigned char * d, int s)
/* print_valstr_2col - print value string list in two columns to log or stdout
*
* @vs: value string list to print
* @title: name of this value string list
* @loglevel: what log level to print, -1 for stdout
*/
void
print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
{
unsigned char c = 0;
int i;
if (vs == NULL)
return;
if (title != NULL) {
if (loglevel < 0)
printf("\n%s:\n\n", title);
else
lprintf(loglevel, "\n%s:\n", title);
}
for (i = 0; vs[i].str != NULL; i++) {
if (vs[i+1].str == NULL) {
/* last one */
if (loglevel < 0) {
printf(" %4d %-32s\n", vs[i].val, vs[i].str);
} else {
lprintf(loglevel, " %4d %-32s\n", vs[i].val, vs[i].str);
}
}
else {
if (loglevel < 0) {
printf(" %4d %-32s %4d %-32s\n",
vs[i].val, vs[i].str, vs[i+1].val, vs[i+1].str);
} else {
lprintf(loglevel, " %4d %-32s %4d %-32s\n",
vs[i].val, vs[i].str, vs[i+1].val, vs[i+1].str);
}
i++;
}
}
if (loglevel < 0)
printf("\n");
else
lprintf(loglevel, "");
}
/* ipmi_csum - calculate an ipmi checksum
*
* @d: buffer to check
* @s: position in buffer to start checksum from
*/
uint8_t
ipmi_csum(uint8_t * d, int s)
{
uint8_t c = 0;
for (; s > 0; s--, d++)
c += *d;
return -c;
}
/* safely open a file for reading or writing
* file: filename
* rw: read-write flag, 1=write
/* ipmi_open_file - safely open a file for reading or writing
*
* @file: filename
* @rw: read-write flag, 1=write
*
* returns pointer to file handler on success
* returns NULL on error
*/
FILE * ipmi_open_file(const char * file, int rw)
FILE *
ipmi_open_file(const char * file, int rw)
{
struct stat st1, st2;
FILE * fp;
@ -165,51 +295,78 @@ FILE * ipmi_open_file(const char * file, int rw)
if (rw) {
/* does not exist, ok to create */
fp = fopen(file, "w");
if (!fp) {
printf("ERROR: Unable to open file %s for write: %s\n",
file, strerror(errno));
if (fp == NULL) {
lperror(LOG_ERR, "Unable to open file %s "
"for write", file);
return NULL;
}
/* created ok, now return the descriptor */
return fp;
} else {
printf("ERROR: File %s does not exist\n", file);
lprintf(LOG_ERR, "File %s does not exist", file);
return NULL;
}
}
#ifndef ENABLE_FILE_SECURITY
if (!rw) {
/* on read skip the extra checks */
fp = fopen(file, "r");
if (fp == NULL) {
lperror(LOG_ERR, "Unable to open file %s", file);
return NULL;
}
return fp;
}
#endif
/* it exists - only regular files, not links */
if (!S_ISREG(st1.st_mode)) {
printf("ERROR: File %s has invalid mode: %d\n", file, st1.st_mode);
if (S_ISREG(st1.st_mode) == 0) {
lprintf(LOG_ERR, "File %s has invalid mode: %d",
file, st1.st_mode);
return NULL;
}
/* allow only files with 1 link (itself) */
if (st1.st_nlink != 1) {
printf("ERROR: File %s has invalid link count: %d != 1\n",
lprintf(LOG_ERR, "File %s has invalid link count: %d != 1",
file, (int)st1.st_nlink);
return NULL;
}
fp = fopen(file, rw ? "w+" : "r");
if (!fp) {
printf("ERROR: Unable to open file %s: %s\n",
file, strerror(errno));
if (fp == NULL) {
lperror(LOG_ERR, "Unable to open file %s", file);
return NULL;
}
/* stat again */
if (fstat(fileno(fp), &st2) < 0) {
printf("ERROR: Unable to stat file %s: %s\n",
file, strerror(errno));
lperror(LOG_ERR, "Unable to stat file %s", file);
fclose(fp);
return NULL;
}
/* verify inode, owner, link count */
if (st2.st_ino != st1.st_ino ||
st2.st_uid != st1.st_uid ||
st2.st_nlink != 1) {
printf("ERROR: Unable to verify file %s\n", file);
/* verify inode */
if (st1.st_ino != st2.st_ino) {
lprintf(LOG_ERR, "File %s has invalid inode: %d != %d",
file, st1.st_ino, st2.st_ino);
fclose(fp);
return NULL;
}
/* verify owner */
if (st1.st_uid != st2.st_uid) {
lprintf(LOG_ERR, "File %s has invalid user id: %d != %d",
file, st1.st_uid, st2.st_uid);
fclose(fp);
return NULL;
}
/* verify inode */
if (st2.st_nlink != 1) {
lprintf(LOG_ERR, "File %s has invalid link count: %d != 1",
file, st2.st_nlink);
fclose(fp);
return NULL;
}
@ -217,3 +374,67 @@ FILE * ipmi_open_file(const char * file, int rw)
return fp;
}
void
ipmi_start_daemon(struct ipmi_intf *intf)
{
pid_t pid;
int fd;
#ifdef SIGHUP
sigset_t sighup;
#endif
/* if we are started from init no need to become daemon */
if (getppid() == 1)
return;
#ifdef SIGHUP
sigemptyset(&sighup);
sigaddset(&sighup, SIGHUP);
if (sigprocmask(SIG_UNBLOCK, &sighup, NULL) < 0)
fprintf(stderr, "ERROR: could not unblock SIGHUP signal\n");
signal(SIGHUP, SIG_IGN);
#endif
#ifdef SIGTTOU
signal(SIGTTOU, SIG_IGN);
#endif
#ifdef SIGTTIN
signal(SIGTTIN, SIG_IGN);
#endif
#ifdef SIGQUIT
signal(SIGQUIT, SIG_IGN);
#endif
#ifdef SIGTSTP
signal(SIGTSTP, SIG_IGN);
#endif
pid = (pid_t) fork();
if (pid < 0 || pid > 0)
exit(0);
#if defined(SIGTSTP) && defined(TIOCNOTTY)
if (setpgid(0, getpid()) == -1)
exit(1);
if ((fd = open(_PATH_TTY, O_RDWR)) >= 0) {
ioctl(fd, TIOCNOTTY, NULL);
close(fd);
}
#else
if (setpgid(0, 0) == -1)
exit(1);
pid = (pid_t) fork();
if (pid < 0 || pid > 0)
exit(0);
#endif
chdir("/");
umask(0);
for (fd=0; fd<64; fd++) {
if (fd != intf->fd)
close(fd);
}
open("/dev/null", O_RDWR);
dup(0);
dup(0);
}

View File

@ -1,395 +0,0 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_bmc.h>
extern int verbose;
const struct valstr completion_code_vals[] = {
{ 0x00, "Command completed normally" },
{ 0xc0, "Node busy" },
{ 0xc1, "Invalid command" },
{ 0xc2, "Invalid command on LUN" },
{ 0xc3, "Timeout" },
{ 0xc4, "Out of space" },
{ 0xc5, "Reservation cancelled or invalid" },
{ 0xc6, "Request data truncated" },
{ 0xc7, "Request data length invalid" },
{ 0xc8, "Request data field length limit exceeded" },
{ 0xc9, "Parameter out of range" },
{ 0xca, "Cannot return number of requested data bytes" },
{ 0xcb, "Requested sensor, data, or record not found" },
{ 0xcc, "Invalid data field in request" },
{ 0xcd, "Command illegal for specified sensor or record type" },
{ 0xce, "Command response could not be provided" },
{ 0xcf, "Cannot execute duplicated request" },
{ 0xd0, "SDR Repository in update mode" },
{ 0xd1, "Device firmeware in update mode" },
{ 0xd2, "BMC initialization in progress" },
{ 0xd3, "Destination unavailable" },
{ 0xd4, "Insufficient priviledge level" },
{ 0xd5, "Command not supported in present state" },
{ 0xff, "Unspecified error" },
{ 0x00, NULL }
};
static int ipmi_bmc_reset(struct ipmi_intf * intf, int cmd)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = cmd;
req.msg.data_len = 0;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
printf("Error in BMC Reset Command\n");
return -1;
}
if (rsp->ccode) {
printf("BMC Reset Command returned %x\n", rsp->ccode);
return -1;
}
return 0;
}
struct bmc_enables_data {
#if WORDS_BIGENDIAN
unsigned char oem2 : 1;
unsigned char oem1 : 1;
unsigned char oem0 : 1;
unsigned char __reserved : 1;
unsigned char system_event_log : 1;
unsigned char event_msgbuf : 1;
unsigned char event_msgbuf_intr : 1;
unsigned char receive_msg_intr : 1;
#else
unsigned char receive_msg_intr : 1;
unsigned char event_msgbuf_intr : 1;
unsigned char event_msgbuf : 1;
unsigned char system_event_log : 1;
unsigned char __reserved : 1;
unsigned char oem0 : 1;
unsigned char oem1 : 1;
unsigned char oem2 : 1;
#endif
} __attribute__ ((packed));
struct bitfield_data {
const char * name;
const char * desc;
uint32_t mask;
int write;
};
struct bitfield_data bmc_enables_bf[] = {
{
name: "recv_msg_intr",
desc: "Receive Message Queue Interrupt",
mask: 1<<0,
write: 1,
},
{
name: "event_msg_intr",
desc: "Event Message Buffer Full Interrupt",
mask: 1<<1,
write: 1,
},
{
name: "event_msg",
desc: "Event Message Buffer",
mask: 1<<2,
write: 1,
},
{
name: "system_event_log",
desc: "System Event Logging",
mask: 1<<3,
write: 1,
},
{
name: "oem0",
desc: "OEM 0",
mask: 1<<5,
write: 1,
},
{
name: "oem1",
desc: "OEM 1",
mask: 1<<6,
write: 1,
},
{
name: "oem2",
desc: "OEM 2",
mask: 1<<7,
write: 1,
},
{ NULL },
};
static void printf_bmc_usage()
{
struct bitfield_data * bf;
printf("BMC Commands:\n");
printf(" reset <warm|cold>\n");
printf(" info\n");
printf(" getenables\n");
printf(" setenables <option=on|off> ...\n");
for (bf = bmc_enables_bf; bf->name; bf++) {
if (!bf->write)
continue;
printf(" %-20s %s\n", bf->name, bf->desc);
}
}
static int ipmi_bmc_get_enables(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct bitfield_data * bf;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_GLOBAL_ENABLES;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
printf("Error in BMC Get Global Enables Command\n");
return -1;
}
if (rsp->ccode) {
printf("BMC Get Global Enables command failed: %s\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
for (bf = bmc_enables_bf; bf->name; bf++) {
printf("%-40s : %sabled\n", bf->desc,
rsp->data[0] & bf->mask ? "en" : "dis");
}
return 0;
}
static int ipmi_bmc_set_enables(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct bitfield_data * bf;
unsigned char en;
int i;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
if (argc < 1 || !strncmp(argv[0], "help", 4)) {
printf_bmc_usage();
return 0;
}
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_GLOBAL_ENABLES;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
printf("Error in BMC Get Global Enables Command\n");
return -1;
}
if (rsp->ccode) {
printf("BMC Get Global Enables command failed: %s\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
en = rsp->data[0];
for (i = 0; i < argc; i++) {
for (bf = bmc_enables_bf; bf->name; bf++) {
int nl = strlen(bf->name);
if (!strncmp(argv[i], bf->name, nl)) {
if (!strncmp(argv[i]+nl+1, "off", 3)) {
printf("Disabling %s\n", bf->desc);
en &= ~bf->mask;
}
else if (!strncmp(argv[i]+nl+1, "on", 2)) {
printf("Enabling %s\n", bf->desc);
en |= bf->mask;
}
else {
printf("Unrecognized option: %s\n", argv[i]);
}
}
}
}
if (en == rsp->data[0]) {
printf("\nNothing to change...\n");
ipmi_bmc_get_enables(intf);
return 0;
}
req.msg.cmd = BMC_SET_GLOBAL_ENABLES;
req.msg.data = &en;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (!rsp)
printf("Error in BMC Set Global Enables Command\n");
else if (rsp->ccode)
printf("BMC Set Global Enables command failed: %s\n",
val2str(rsp->ccode, completion_code_vals));
else {
printf("\nVerifying...\n");
ipmi_bmc_get_enables(intf);
}
return 0;
}
/* IPM Device, Get Device ID Command - Additional Device Support */
const char *ipm_dev_adtl_dev_support[8] = {
"Sensor Device", /* bit 0 */
"SDR Repository Device", /* bit 1 */
"SEL Device", /* bit 2 */
"FRU Inventory Device", /* ... */
"IPMB Event Receiver",
"IPMB Event Generator",
"Bridge",
"Chassis Device" /* bit 7 */
};
static int ipmi_bmc_get_deviceid(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct ipm_devid_rsp *devid;
int i;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_DEVICE_ID;
req.msg.data_len = 0;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
printf("Error in BMC Get Device ID Command\n");
return -1;
}
if (rsp->ccode) {
printf("BMC Get Device ID returned %x\n", rsp->ccode);
return -1;
}
devid = (struct ipm_devid_rsp *) rsp->data;
printf("Device ID : %i\n",
devid->device_id);
printf("Device Revision : %i\n",
devid->device_revision & IPM_DEV_DEVICE_ID_REV_MASK);
printf("Firmware Revision : %u.%x\n",
devid->fw_rev1 & IPM_DEV_FWREV1_MAJOR_MASK,
devid->fw_rev2);
printf("IPMI Version : %x.%x\n",
IPM_DEV_IPMI_VERSION_MAJOR(devid->ipmi_version),
IPM_DEV_IPMI_VERSION_MINOR(devid->ipmi_version));
printf("Manufacturer ID : %lu\n",
(long)IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id));
printf("Product ID : %u (0x%02x%02x)\n",
buf2short((unsigned char *)(devid->product_id)),
devid->product_id[1], devid->product_id[0]);
printf("Device Available : %s\n",
(devid->fw_rev1 & IPM_DEV_FWREV1_AVAIL_MASK) ?
"no" : "yes");
printf("Provides Device SDRs : %s\n",
(devid->device_revision & IPM_DEV_DEVICE_ID_SDR_MASK) ?
"yes" : "no");
printf("Additional Device Support :\n");
for (i = 0; i < IPM_DEV_ADTL_SUPPORT_BITS; i++) {
if (devid->adtl_device_support & (1 << i)) {
printf(" %s\n", ipm_dev_adtl_dev_support[i]);
}
}
printf("Aux Firmware Rev Info : \n");
/* These values could be looked-up by vendor if documented,
* so we put them on individual lines for better treatment later
*/
printf(" 0x%02x\n 0x%02x\n 0x%02x\n 0x%02x\n",
devid->aux_fw_rev[0], devid->aux_fw_rev[1],
devid->aux_fw_rev[2], devid->aux_fw_rev[3]);
return 0;
}
int ipmi_bmc_main(struct ipmi_intf * intf, int argc, char ** argv)
{
if (!argc || !strncmp(argv[0], "help", 4)) {
printf_bmc_usage();
return 0;
}
else if (!strncmp(argv[0], "reset", 5)) {
if (argc < 2 || !strncmp(argv[1], "help", 4)) {
printf("reset commands: warm, cold\n");
}
else if (!strncmp(argv[1], "cold", 4)) {
ipmi_bmc_reset(intf, BMC_COLD_RESET);
}
else if (!strncmp(argv[1], "warm", 4)) {
ipmi_bmc_reset(intf, BMC_WARM_RESET);
}
else {
printf("reset commands: warm, cold\n");
}
}
else if (!strncmp(argv[0], "info", 4)) {
ipmi_bmc_get_deviceid(intf);
}
else if (!strncmp(argv[0], "getenables", 7)) {
ipmi_bmc_get_enables(intf);
}
else if (!strncmp(argv[0], "setenables", 7)) {
ipmi_bmc_set_enables(intf, argc-1, &(argv[1]));
}
return 0;
}

View File

@ -1,4 +1,4 @@
/*
/* -*-mode: C; indent-tabs-mode: t; -*-
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -28,95 +28,53 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi_lanp.h>
#include <ipmitool/ipmi_channel.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_constants.h>
extern int csv_output;
extern int verbose;
void printf_channel_usage (void);
extern const struct valstr ipmi_authtype_vals[];
static const struct valstr ipmi_channel_protocol_vals[] = {
{ 0x00, "reserved" },
{ 0x01, "IPMB-1.0" },
{ 0x02, "ICMB-1.0" },
{ 0x03, "reserved" },
{ 0x04, "IPMI-SMBus" },
{ 0x05, "KCS" },
{ 0x06, "SMIC" },
{ 0x07, "BT-10" },
{ 0x08, "BT-15" },
{ 0x09, "TMode" },
{ 0x1c, "OEM 1" },
{ 0x1d, "OEM 2" },
{ 0x1e, "OEM 3" },
{ 0x1f, "OEM 4" },
{ 0x00, NULL },
};
static const struct valstr ipmi_channel_medium_vals[] = {
{ 0x00, "reserved" },
{ 0x01, "IPMB (I2C)" },
{ 0x02, "ICMB v1.0" },
{ 0x03, "ICMB v0.9" },
{ 0x04, "802.3 LAN" },
{ 0x05, "Serial/Modem" },
{ 0x06, "Other LAN" },
{ 0x07, "PCI SMBus" },
{ 0x08, "SMBus v1.0/v1.1" },
{ 0x09, "SMBus v2.0" },
{ 0x0a, "USB 1.x" },
{ 0x0b, "USB 2.x" },
{ 0x0c, "System Interface" },
{ 0x00, NULL },
};
/**
* ipmi_1_5_authtypes
*
* Create a string describing the supported authentication types as
* specificed by the parameter n
*/
const char * ipmi_1_5_authtypes(unsigned char n)
static const char *
ipmi_1_5_authtypes(uint8_t n)
{
unsigned int i;
uint32_t i;
static char supportedTypes[128];
bzero(supportedTypes, 128);
i = 0;
while (ipmi_authtype_vals[i].val)
{
if (n & ipmi_authtype_vals[i].val)
{
for (i = 0; ipmi_authtype_vals[i].val != 0; i++) {
if (n & ipmi_authtype_vals[i].val) {
strcat(supportedTypes, ipmi_authtype_vals[i].str);
strcat(supportedTypes, " ");
}
++i;
}
return supportedTypes;
@ -130,16 +88,16 @@ const char * ipmi_1_5_authtypes(unsigned char n)
* return 0 on success
* -1 on failure
*/
int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
unsigned char channel,
unsigned char priv)
int
ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
uint8_t channel,
uint8_t priv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct get_channel_auth_cap_rsp auth_cap;
uint8_t msg_data[2];
unsigned char msg_data[2];
msg_data[0] = channel | 0x80; // Ask for IPMI v2 data as well
msg_data[1] = priv;
@ -151,8 +109,7 @@ int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
{
if ((rsp == NULL) || (rsp->ccode > 0)) {
/*
* It's very possible that this failed because we asked for IPMI v2 data
* Ask again, without requesting IPMI v2 data
@ -160,16 +117,19 @@ int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
msg_data[0] &= 0x7F;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x Get Channel Authentication Capabilities Command (0x%x)\n",
rsp ? rsp->ccode : 0, channel);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Authentication Capabilities");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Channel Authentication Capabilities failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
}
memcpy(&auth_cap, rsp->data, sizeof(struct get_channel_auth_cap_rsp));
printf("Channel number : %d\n",
auth_cap.channel_number);
printf("IPMI v1.5 auth types : %s\n",
@ -180,9 +140,9 @@ int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
(auth_cap.kg_status) ? "non-zero" : "default (all zeroes)");
printf("Per message authentication : %sabled\n",
(auth_cap.per_message_auth) ? "en" : "dis");
(auth_cap.per_message_auth) ? "dis" : "en");
printf("User level authentication : %sabled\n",
(auth_cap.user_level_auth) ? "en" : "dis");
(auth_cap.user_level_auth) ? "dis" : "en");
printf("Non-null user names exist : %s\n",
(auth_cap.non_null_usernames) ? "yes" : "no");
@ -191,8 +151,7 @@ int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
printf("Anonymous login enabled : %s\n",
(auth_cap.anon_login_enabled) ? "yes" : "no");
if (auth_cap.v20_data_available)
{
if (auth_cap.v20_data_available) {
printf("Channel supports IPMI v1.5 : %s\n",
(auth_cap.ipmiv15_support) ? "yes" : "no");
printf("Channel supports IPMI v2.0 : %s\n",
@ -203,8 +162,7 @@ int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
* If there is support for an OEM authentication type, there is some
* information.
*/
if (auth_cap.enabled_auth_types & IPMI_1_5_AUTH_TYPE_BIT_OEM)
{
if (auth_cap.enabled_auth_types & IPMI_1_5_AUTH_TYPE_BIT_OEM) {
printf("IANA Number for OEM : %d\n",
auth_cap.oem_id[0] |
auth_cap.oem_id[1] << 8 |
@ -226,11 +184,12 @@ int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
*
*/
int
ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char rqdata[2];
uint8_t rqdata[2];
uint8_t medium;
struct get_channel_info_rsp channel_info;
struct get_channel_access_rsp channel_access;
@ -241,17 +200,18 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x Get Channel Info Command (0x%x)\n",
rsp ? rsp->ccode : 0, channel);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Info");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Channel Info failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
memcpy(&channel_info, rsp->data, sizeof(struct get_channel_info_rsp));
printf("Channel 0x%x info:\n", channel_info.channel_number);
printf(" Channel Medium Type : %s\n",
@ -262,16 +222,16 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
printf(" Session Support : ");
switch (channel_info.session_support) {
case 0x00:
case 0x0:
printf("session-less\n");
break;
case 0x40:
case 0x1:
printf("single-session\n");
break;
case 0x80:
case 0x2:
printf("multi-session\n");
break;
case 0xc0:
case 0x3:
default:
printf("session-based\n");
break;
@ -286,6 +246,12 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
channel_info.vendor_id[2] << 16);
/* only proceed if this is LAN channel */
medium = ipmi_get_channel_medium(intf, channel);
if (medium != IPMI_CHANNEL_MEDIUM_LAN &&
medium != IPMI_CHANNEL_MEDIUM_LAN_OTHER) {
return 0;
}
memset(&req, 0, sizeof(req));
rqdata[0] = channel & 0xf;
@ -299,7 +265,13 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
req.msg.data_len = 2;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Access (volatile)");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Channel Access (volatile) failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -337,7 +309,13 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
rqdata[1] = 0x40; /* 0x40=non-volatile */
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Access (non-volatile)");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Channel Access (non-volatile) failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -370,21 +348,19 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
break;
}
return 0;
return 0;
}
static int
ipmi_get_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned char userid)
ipmi_get_user_access(struct ipmi_intf * intf, uint8_t channel, uint8_t userid)
{
struct ipmi_rs * rsp;
struct ipmi_rq req1, req2;
unsigned char rqdata[2];
uint8_t rqdata[2];
struct get_user_access_rsp user_access;
int curr_uid, max_uid = 0, init = 1;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
curr_uid = userid ? userid : 1;
curr_uid = userid ? : 1;
memset(&req1, 0, sizeof(req1));
req1.msg.netfn = IPMI_NETFN_APP;
@ -404,39 +380,53 @@ ipmi_get_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned ch
rqdata[1] = curr_uid & 0x3f;
rsp = intf->sendrecv(intf, &req1);
if (!rsp || rsp->ccode) {
printf("Error:%x Get User Access Command (0x%x)\n",
rsp ? rsp->ccode : 0, channel);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get User Access (channel %d id %d)",
rqdata[0], rqdata[1]);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get User Access (channel %d id %d) failed: %s",
rqdata[0], rqdata[1],
val2str(rsp->ccode, completion_code_vals));
return -1;
}
memcpy(&user_access, rsp->data, sizeof(struct get_user_access_rsp));
rqdata[0] = curr_uid & 0x3f;
rsp = intf->sendrecv(intf, &req2);
if (!rsp || rsp->ccode) {
printf("Error:%x Get User Name Command (0x%x)\n",
rsp ? rsp->ccode : 0, channel);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get User Name (id %d)", rqdata[0]);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get User Name (id %d) failed: %s",
rqdata[0], val2str(rsp->ccode, completion_code_vals));
return -1;
}
if (init)
{
if (init) {
printf("Maximum User IDs : %d\n", user_access.max_user_ids);
printf("Enabled User IDs : %d\n", user_access.enabled_user_ids);
max_uid = user_access.max_user_ids;
init = 0;
}
printf("\nUser ID : %d\n", curr_uid);
printf("\n");
printf("User ID : %d\n", curr_uid);
printf("User Name : %s\n", rsp->data);
printf("Fixed Name : %s\n", curr_uid <= user_access.fixed_user_ids ? "Yes" : "No");
printf("Access Available : %s\n", user_access.callin_callback ? "callback" : "call-in / callback");
printf("Link Authentication : %sabled\n", user_access.link_auth ? "en" : "dis");
printf("IPMI Messaging : %sabled\n", user_access.ipmi_messaging ? "en" : "dis");
printf("Privilege Level : %s\n", val2str(user_access.privilege_limit, ipmi_privlvl_vals));
printf("Fixed Name : %s\n",
(curr_uid <= user_access.fixed_user_ids) ? "Yes" : "No");
printf("Access Available : %s\n",
(user_access.callin_callback) ? "callback" : "call-in / callback");
printf("Link Authentication : %sabled\n",
(user_access.link_auth) ? "en" : "dis");
printf("IPMI Messaging : %sabled\n",
(user_access.ipmi_messaging) ? "en" : "dis");
printf("Privilege Level : %s\n",
val2str(user_access.privilege_limit, ipmi_privlvl_vals));
curr_uid ++;
@ -445,26 +435,24 @@ ipmi_get_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned ch
return 0;
}
static void
static int
ipmi_set_user_access(struct ipmi_intf * intf, int argc, char ** argv)
{
unsigned char channel, userid;
uint8_t channel, userid;
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char rqdata[2];
uint8_t rqdata[2];
struct get_user_access_rsp user_access;
struct set_user_access_data set_access;
int i;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
if (argc < 3 || !strncmp(argv[0], "help", 4)) {
if ((argc < 3) || (strncmp(argv[0], "help", 4) == 0)) {
printf_channel_usage();
return;
return 0;
}
channel = (unsigned char)strtol(argv[0], NULL, 0);
userid = (unsigned char)strtol(argv[1], NULL, 0);
channel = (uint8_t)strtol(argv[0], NULL, 0);
userid = (uint8_t)strtol(argv[1], NULL, 0);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
@ -476,14 +464,21 @@ ipmi_set_user_access(struct ipmi_intf * intf, int argc, char ** argv)
rqdata[1] = userid & 0x3f;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x Get User Access Command (0x%x)\n",
rsp ? rsp->ccode : 0, channel);
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get User Access (channel %d id %d)",
rqdata[0], rqdata[1]);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get User Access (channel %d id %d) failed: %s",
rqdata[0], rqdata[1],
val2str(rsp->ccode, completion_code_vals));
return -1;
}
memcpy(&user_access, rsp->data, sizeof(struct get_user_access_rsp));
memset(&set_access, 0, sizeof(set_access));
set_access.change_bits = 1;
set_access.callin_callback = user_access.callin_callback;
set_access.link_auth = user_access.link_auth;
@ -495,55 +490,308 @@ ipmi_set_user_access(struct ipmi_intf * intf, int argc, char ** argv)
for (i = 2; i < argc; i ++)
{
if (!strncmp(argv[i], "callin=", 7)) {
set_access.callin_callback = !strncmp (argv[i]+7, "off", 3);
if (strncmp(argv[i], "callin=", 7) == 0) {
set_access.callin_callback = !(strncmp (argv[i]+7, "off", 3));
}
else if (!strncmp(argv[i], "link=", 5)) {
else if (strncmp(argv[i], "link=", 5) == 0) {
set_access.link_auth = strncmp (argv[i]+5, "off", 3);
}
else if (!strncmp(argv[i], "ipmi=", 5)) {
else if (strncmp(argv[i], "ipmi=", 5) == 0) {
set_access.ipmi_messaging = strncmp (argv[i]+5, "off", 3);
}
else if (!strncmp(argv[i], "privilege=", 10)) {
else if (strncmp(argv[i], "privilege=", 10) == 0) {
set_access.privilege_limit = strtol (argv[i]+10, NULL, 0);
}
else {
printf ("Invalid option: %s\n", argv [i]);
return;
return -1;
}
}
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = IPMI_SET_USER_ACCESS;
req.msg.data = (unsigned char *) &set_access;
req.msg.data = (uint8_t *) &set_access;
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x Set User Access Command (0x%x)\n",
rsp ? rsp->ccode : 0, channel);
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Set User Access (channel %d id %d)",
set_access.channel, set_access.user_id);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set User Access (channel %d id %d) failed: %s",
set_access.channel, set_access.user_id,
val2str(rsp->ccode, completion_code_vals));
return -1;
}
return;
return 0;
}
static const char *
iana_string(uint32_t iana)
{
static char s[10];
if (iana)
{
sprintf(s, "%06x", iana);
return s;
}
else
return "N/A";
}
static int
ipmi_get_channel_cipher_suites(struct ipmi_intf * intf,
const char * payload_type,
uint8_t channel)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t oem_record;
uint8_t rqdata[3];
uint32_t iana;
uint8_t auth_alg, integrity_alg, crypt_alg;
uint8_t cipher_suite_id;
uint8_t list_index = 0;
uint8_t cipher_suite_data[1024]; // 0x40 sets * 16 bytes per set
uint16_t offset = 0;
uint16_t cipher_suite_data_length = 0; // how much was returned, total
memset(cipher_suite_data, 0, sizeof(cipher_suite_data));
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; // 0x06
req.msg.cmd = IPMI_GET_CHANNEL_CIPHER_SUITES; // 0x54
req.msg.data = rqdata;
req.msg.data_len = 3;
rqdata[0] = channel;
rqdata[1] = ((strncmp(payload_type, "ipmi", 4) == 0)? 0: 1);
rqdata[2] = 0x80; // Always ask for cipher suite format
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
// Grab the returned channel number once. We assume it's the same
// in future calls.
if (rsp->data_len >= 1)
channel = rsp->data[0];
while ((rsp->data_len > 1) && (rsp->data_len == 17) && (list_index < 0x3F))
{
//
// We got back cipher suite data -- store it.
//printf("copying data to offset %d\n", offset);
//printbuf(rsp->data + 1, rsp->data_len - 1, "this is the data");
memcpy(cipher_suite_data + offset, rsp->data + 1, rsp->data_len - 1);
offset += rsp->data_len - 1;
//
// Increment our list for the next call
//
++list_index;
rqdata[2] = (rqdata[2] & 0x80) + list_index;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
}
/* Copy last chunk */
if(rsp->data_len > 1)
{
//
// We got back cipher suite data -- store it.
//printf("copying data to offset %d\n", offset);
//printbuf(rsp->data + 1, rsp->data_len - 1, "this is the data");
memcpy(cipher_suite_data + offset, rsp->data + 1, rsp->data_len - 1);
offset += rsp->data_len - 1;
}
//
// We can chomp on all our data now.
//
cipher_suite_data_length = offset;
offset = 0;
if (! csv_output)
printf("ID IANA Auth Alg Integrity Alg Confidentiality Alg\n");
while (offset < cipher_suite_data_length)
{
if (cipher_suite_data[offset++] == 0xC0)
{
oem_record = 0; // standard type
iana = 0;
// Verify that we have at least a full record left
if ((cipher_suite_data_length - offset) < 4) // id + 3 algs
{
lprintf(LOG_ERR, "Incomplete data record in cipher suite data");
return -1;
}
cipher_suite_id = cipher_suite_data[offset++];
}
else if (cipher_suite_data[offset++] == 0xC1)
{
oem_record = 1; // OEM record type
// Verify that we have at least a full record left
if ((cipher_suite_data_length - offset) < 4) // id + iana + 3 algs
{
lprintf(LOG_ERR, "Incomplete data record in cipher suite data");
return -1;
}
cipher_suite_id = cipher_suite_data[offset++];
//
// Grab the IANA
//
iana =
cipher_suite_data[offset] |
(cipher_suite_data[offset + 1] << 8) |
(cipher_suite_data[offset + 2] << 16);
offset += 3;
}
else
{
lprintf(LOG_ERR, "Bad start of record byte in cipher suite data");
return -1;
}
//
// Grab the algorithms for this cipher suite. I guess we can't be
// sure of what order they'll come in. Also, I suppose we default
// to the NONE algorithm if one were absent. This part of the spec is
// poorly written -- I have read the errata document. For now, I'm only
// allowing one algorithm per type (auth, integrity, crypt) because I
// don't I understand how it could be otherwise.
//
auth_alg = IPMI_AUTH_RAKP_NONE;
integrity_alg = IPMI_INTEGRITY_NONE;
crypt_alg = IPMI_CRYPT_NONE;
while (((cipher_suite_data[offset] & 0xC0) != 0xC0) &&
((cipher_suite_data_length - offset) > 0))
{
switch (cipher_suite_data[offset] & 0xC0)
{
case 0x00:
// Authentication algorithm specifier
auth_alg = cipher_suite_data[offset++] & 0x3F;
break;
case 0x40:
// Interity algorithm specifier
integrity_alg = cipher_suite_data[offset++] & 0x3F;
break;
case 0x80:
// Confidentiality algorithm specifier
crypt_alg = cipher_suite_data[offset++] & 0x3F;
break;
}
}
//
// We have everything we need to spit out a cipher suite record
//
printf((csv_output? "%d,%s,%s,%s,%s\n" :
"%-4d %-7s %-15s %-15s %-15s\n"),
cipher_suite_id,
iana_string(iana),
val2str(auth_alg, ipmi_auth_algorithms),
val2str(integrity_alg, ipmi_integrity_algorithms),
val2str(crypt_alg, ipmi_encryption_algorithms));
}
return 0;
}
uint8_t
ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct get_channel_info_rsp info;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = IPMI_GET_CHANNEL_INFO;
req.msg.data = &channel;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get Channel Info command failed");
return -1;
}
if (rsp->ccode > 0) {
if (rsp->ccode == 0xcc)
return IPMI_CHANNEL_MEDIUM_RESERVED;
lprintf(LOG_INFO, "Get Channel Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IPMI_CHANNEL_MEDIUM_RESERVED;
}
memcpy(&info, rsp->data, sizeof(struct get_channel_info_rsp));
lprintf(LOG_DEBUG, "Channel type: %s",
val2str(info.channel_medium, ipmi_channel_medium_vals));
return info.channel_medium;
}
uint8_t
ipmi_current_channel_medium(struct ipmi_intf * intf)
{
return ipmi_get_channel_medium(intf, 0xE);
}
void
printf_channel_usage()
{
printf("Channel Commands: authcap <channel number> <max privilege>\n");
printf(" getaccess <channel number> [user id]\n");
printf(" setaccess <channel number> <user id> [callin=on|off] [ipmi=on|off] [link=on|off] [privilege=level]\n");
printf(" info [channel number]\n");
printf("\n");
printf("Possible privilege levels are:\n");
printf(" 1 Callback level\n");
printf(" 2 User level\n");
printf(" 3 Operator level\n");
printf(" 4 Administrator level\n");
printf(" 5 OEM Proprietary level\n");
printf(" 15 No access\n");
lprintf(LOG_NOTICE, "Channel Commands: authcap <channel number> <max privilege>");
lprintf(LOG_NOTICE, " getaccess <channel number> [user id]");
lprintf(LOG_NOTICE, " setaccess <channel number> "
"<user id> [callin=on|off] [ipmi=on|off] [link=on|off] [privilege=level]");
lprintf(LOG_NOTICE, " info [channel number]");
lprintf(LOG_NOTICE, " getciphers <ipmi | sol> [channel]\n");
lprintf(LOG_NOTICE, "Possible privilege levels are:");
lprintf(LOG_NOTICE, " 1 Callback level");
lprintf(LOG_NOTICE, " 2 User level");
lprintf(LOG_NOTICE, " 3 Operator level");
lprintf(LOG_NOTICE, " 4 Administrator level");
lprintf(LOG_NOTICE, " 5 OEM Proprietary level");
lprintf(LOG_NOTICE, " 15 No access");
}
@ -552,53 +800,69 @@ ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int retval = 0;
if (!argc || !strncmp(argv[0], "help", 4))
if ((argc == 0) || (strncmp(argv[0], "help", 4) == 0))
{
printf_channel_usage();
}
else if (!strncmp(argv[0], "authcap", 7))
else if (strncmp(argv[0], "authcap", 7) == 0)
{
if (argc != 3)
printf_channel_usage();
else
retval = ipmi_get_channel_auth_cap(intf,
(unsigned char)strtol(argv[1], NULL, 0),
(unsigned char)strtol(argv[2], NULL, 0));
(uint8_t)strtol(argv[1], NULL, 0),
(uint8_t)strtol(argv[2], NULL, 0));
}
else if (!strncmp(argv[0], "getaccess", 10))
else if (strncmp(argv[0], "getaccess", 10) == 0)
{
if (argc < 2 || argc > 3)
if ((argc < 2) || (argc > 3))
printf_channel_usage();
else {
unsigned char ch = (unsigned char)strtol(argv[1], NULL, 0);
unsigned char id = 0;
uint8_t ch = (uint8_t)strtol(argv[1], NULL, 0);
uint8_t id = 0;
if (argc == 3)
id = (unsigned char)strtol(argv[2], NULL, 0);
id = (uint8_t)strtol(argv[2], NULL, 0);
retval = ipmi_get_user_access(intf, ch, id);
}
}
else if (!strncmp(argv[0], "setaccess", 9))
else if (strncmp(argv[0], "setaccess", 9) == 0)
{
ipmi_set_user_access(intf, argc-1, &(argv[1]));
retval = ipmi_set_user_access(intf, argc-1, &(argv[1]));
}
else if (!strncmp(argv[0], "info", 4))
else if (strncmp(argv[0], "info", 4) == 0)
{
if (argc > 2)
printf_channel_usage();
else {
unsigned char ch = 0xe;
uint8_t ch = 0xe;
if (argc == 2)
ch = (unsigned char)strtol(argv[1], NULL, 0);
ch = (uint8_t)strtol(argv[1], NULL, 0);
retval = ipmi_get_channel_info(intf, ch);
}
}
// it channel getciphers <ipmi | sol> [channel]
else if (strncmp(argv[0], "getciphers", 10) == 0)
{
if ((argc < 2) || (argc > 3) ||
(strncmp(argv[1], "ipmi", 4) && strncmp(argv[1], "sol", 3)))
printf_channel_usage();
else
{
uint8_t ch = 0xe;
if (argc == 3)
ch = (uint8_t)strtol(argv[2], NULL, 0);
retval = ipmi_get_channel_cipher_suites(intf,
argv[1], // ipmi | sol
ch);
}
}
else
{
printf("Invalid CHANNEL command: %s\n", argv[0]);
printf_channel_usage();
retval = 1;
retval = -1;
}
return retval;
}

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
@ -40,12 +36,15 @@
#include <ipmitool/helper.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_chassis.h>
extern int verbose;
static int ipmi_chassis_power_status(struct ipmi_intf * intf)
int
ipmi_chassis_power_status(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@ -56,33 +55,38 @@ static int ipmi_chassis_power_status(struct ipmi_intf * intf)
req.msg.data_len = 0;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("error in Chassis Status Command\n");
return 0;
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to get Chassis Power Status");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Chassis Power Status failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Chassis Power is %s\n", (rsp->data[0] & 0x1) ? "on" : "off");
return rsp->data[0] & 0x1;
return rsp->data[0] & 1;
}
static const struct valstr ipmi_chassis_power_control_vals[] = {
{ 0x00, "Down/Off" },
{ 0x01, "Up/On" },
{ 0x02, "Cycle" },
{ 0x03, "Reset" },
{ 0x04, "Pulse" },
{ 0x05, "Soft" },
{ 0x00, NULL },
};
static int
ipmi_chassis_print_power_status(struct ipmi_intf * intf)
{
int ps = ipmi_chassis_power_status(intf);
static void ipmi_chassis_power_control(struct ipmi_intf * intf, unsigned char ctl)
if (ps < 0)
return -1;
printf("Chassis Power is %s\n", ps ? "on" : "off");
return 0;
}
int
ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_CHASSIS;
req.msg.cmd = 0x2;
@ -90,44 +94,53 @@ static void ipmi_chassis_power_control(struct ipmi_intf * intf, unsigned char ct
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Unable to set Chassis Power Control to %s\n",
val2str(ctl, ipmi_chassis_power_control_vals));
} else {
printf("Chassis Power Control: %s\n",
val2str(ctl, ipmi_chassis_power_control_vals));
intf->abort = 1;
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to set Chassis Power Control to %s",
val2str(ctl, ipmi_chassis_power_control_vals));
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set Chassis Power Control to %s failed: %s",
val2str(ctl, ipmi_chassis_power_control_vals),
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Chassis Power Control: %s\n",
val2str(ctl, ipmi_chassis_power_control_vals));
#if 0 /* this can cause sessions to hang around after power commands */
/* sessions often get lost when changing chassis power */
intf->abort = 1;
#endif
return 0;
}
static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
static int
ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
{
struct ipmi_rq req;
struct ipmi_rs * rsp;
struct {
unsigned char interval;
unsigned char force_on;
uint8_t interval;
uint8_t force_on;
} identify_data;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_CHASSIS;
req.msg.cmd = 0x4;
if (arg) {
if (!strcmp(arg, "force")){
identify_data.interval = 0;
identify_data.force_on = 1;
} else {
identify_data.interval = (unsigned char)atoi(arg);
identify_data.force_on = 0;
}
req.msg.data = (unsigned char *)&identify_data;
if (arg != NULL) {
if (strncmp(arg, "force", 5) == 0) {
identify_data.interval = 0;
identify_data.force_on = 1;
} else {
identify_data.interval = (uint8_t)atoi(arg);
identify_data.force_on = 0;
}
req.msg.data = (uint8_t *)&identify_data;
/* The Force Identify On byte is optional and not
* supported by all devices-- if force is not specified,
* we pass only one data byte; if specified, we pass two
@ -137,34 +150,41 @@ static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
}
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("ERROR:%x Chassis Identify Command\n", rsp->ccode);
if (identify_data.force_on) {
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to set Chassis Identify");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set Chassis Identify failed: %s",
val2str(rsp->ccode, completion_code_vals));
if (identify_data.force_on != 0) {
/* Intel SE7501WV2 F/W 1.2 returns CC 0xC7, but
* the IPMI v1.5 spec does not standardize a CC
* if unsupported, so we warn
*/
printf("Chassis may not support Force Identify On\n");
lprintf(LOG_WARNING, "Chassis may not support Force Identify On\n");
}
return;
return -1;
}
printf("Chassis identify interval: ");
if (!arg) {
if (arg == NULL) {
printf("default (15 seconds)\n");
} else {
if (identify_data.force_on) {
printf("indefinate\n");
if (identify_data.force_on != 0) {
printf("indefinite\n");
} else {
if (identify_data.interval) {
printf("%i seconds\n", identify_data.interval);
} else {
if (identify_data.interval == 0)
printf("off\n");
}
else
printf("%i seconds\n", identify_data.interval);
}
}
return 0;
}
static void ipmi_chassis_poh(struct ipmi_intf * intf)
static int
ipmi_chassis_poh(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@ -175,17 +195,26 @@ static void ipmi_chassis_poh(struct ipmi_intf * intf)
req.msg.cmd = 0xf;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to get Chassis Power-On-Hours");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Chassis Power-On-Hours failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
memcpy(&count, rsp->data+1, 4);
printf("POH Counter : %li hours total (%li days, %li hours)\n",
(long)count, (long)(count / 24), (long)(count % 24));
return 0;
}
static void ipmi_chassis_restart_cause(struct ipmi_intf * intf)
static int
ipmi_chassis_restart_cause(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@ -195,9 +224,15 @@ static void ipmi_chassis_restart_cause(struct ipmi_intf * intf)
req.msg.cmd = 0x7;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to get Chassis Restart Cause");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Chassis Restart Cause failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("System restart cause: ");
@ -233,11 +268,14 @@ static void ipmi_chassis_restart_cause(struct ipmi_intf * intf)
printf("power-cycle via PEF\n");
break;
default:
printf("error!\n");
printf("invalid\n");
}
return 0;
}
static void ipmi_chassis_status(struct ipmi_intf * intf)
static int
ipmi_chassis_status(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@ -247,8 +285,15 @@ static void ipmi_chassis_status(struct ipmi_intf * intf)
req.msg.cmd = 0x1;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Error sending Chassis Status command");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Error sending Chassis Status command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
/* byte 1 */
printf("System Power : %s\n", (rsp->data[0] & 0x1) ? "on" : "off");
@ -292,31 +337,100 @@ static void ipmi_chassis_status(struct ipmi_intf * intf)
printf("Drive Fault : %s\n", (rsp->data[2] & 0x4) ? "true" : "false");
printf("Cooling/Fan Fault : %s\n", (rsp->data[2] & 0x8) ? "true" : "false");
if (rsp->data_len > 3)
{
/* optional byte 4 */
if (rsp->data[3] == 0) {
printf("Front Panel Control : none\n");
} else {
printf("Sleep Button Disable : %s\n", (rsp->data[3] & 0x80) ? "allowed" : "not allowed");
printf("Diag Button Disable : %s\n", (rsp->data[3] & 0x40) ? "allowed" : "not allowed");
printf("Reset Button Disable : %s\n", (rsp->data[3] & 0x20) ? "allowed" : "not allowed");
printf("Power Button Disable : %s\n", (rsp->data[3] & 0x10) ? "allowed" : "not allowed");
printf("Sleep Button Disabled: %s\n", (rsp->data[3] & 0x80) ? "true" : "false");
printf("Diag Button Disabled : %s\n", (rsp->data[3] & 0x40) ? "true" : "false");
printf("Reset Button Disabled: %s\n", (rsp->data[3] & 0x20) ? "true" : "false");
printf("Power Button Disabled: %s\n", (rsp->data[3] & 0x10) ? "true" : "false");
}
if (rsp->data_len > 3) {
/* optional byte 4 */
if (rsp->data[3] == 0) {
printf("Front Panel Control : none\n");
} else {
printf("Sleep Button Disable : %s\n", (rsp->data[3] & 0x80) ? "allowed" : "not allowed");
printf("Diag Button Disable : %s\n", (rsp->data[3] & 0x40) ? "allowed" : "not allowed");
printf("Reset Button Disable : %s\n", (rsp->data[3] & 0x20) ? "allowed" : "not allowed");
printf("Power Button Disable : %s\n", (rsp->data[3] & 0x10) ? "allowed" : "not allowed");
printf("Sleep Button Disabled: %s\n", (rsp->data[3] & 0x80) ? "true" : "false");
printf("Diag Button Disabled : %s\n", (rsp->data[3] & 0x40) ? "true" : "false");
printf("Reset Button Disabled: %s\n", (rsp->data[3] & 0x20) ? "true" : "false");
printf("Power Button Disabled: %s\n", (rsp->data[3] & 0x10) ? "true" : "false");
}
}
return 0;
}
static void ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char param, unsigned char * data, int len)
static int
ipmi_chassis_selftest(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char msg_data[16];
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = 0x4;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error sending Get Self Test command");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Error sending Get Self Test command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Self Test Results : ");
switch (rsp->data[0]) {
case 0x55:
printf("passed\n");
break;
case 0x56:
printf("not implemented\n");
break;
case 0x57:
{
int i;
const struct valstr broken_dev_vals[] = {
{ 0, "firmware corrupted" },
{ 1, "boot block corrupted" },
{ 2, "FRU Internal Use Area corrupted" },
{ 3, "SDR Repository empty" },
{ 4, "IPMB not responding" },
{ 5, "cannot access BMC FRU" },
{ 6, "cannot access SDR Repository" },
{ 7, "cannot access SEL Device" },
{ 0xff, NULL },
};
printf("device error\n");
for (i=0; i<8; i++) {
if (rsp->data[1] & (1<<i)) {
printf(" [%s]\n",
val2str(i, broken_dev_vals));
}
}
}
break;
case 0x58:
printf("Fatal hardware error: %02xh\n", rsp->data[1]);
break;
default:
printf("Device-specific failure %02xh:%02xh\n",
rsp->data[0], rsp->data[1]);
break;
}
return 0;
}
static int
ipmi_chassis_set_bootparam(struct ipmi_intf * intf, uint8_t param, uint8_t * data, int len)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[16];
memset(msg_data, 0, 16);
msg_data[0] = param & 0x7f;
@ -329,26 +443,35 @@ static void ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char pa
req.msg.data_len = len + 1;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error setting Chassis Boot Parameter %d\n", param);
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Error setting Chassis Boot Parameter %d", param);
return -1;
}
if (rsp->ccode > 0) {
if (param != 0) {
lprintf(LOG_ERR, "Set Chassis Boot Parameter %d failed: %s",
param, val2str(rsp->ccode, completion_code_vals));
}
return -1;
}
printf("Chassis Set Boot Param %d to %s\n", param, data);
lprintf(LOG_DEBUG, "Chassis Set Boot Parameter %d to %s", param, buf2str(data, len));
return 0;
}
static void ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
static int
ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char msg_data[3];
uint8_t msg_data[3];
if (!arg)
return;
if (arg == NULL)
return -1;
memset(msg_data, 0, 3);
msg_data[0] = (unsigned char)atoi(arg) & 0x7f;
msg_data[0] = (uint8_t)atoi(arg) & 0x7f;
msg_data[1] = 0;
msg_data[2] = 0;
@ -359,8 +482,15 @@ static void ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
req.msg.data_len = 3;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Error Getting Chassis Boot Parameter %s", arg);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Chassis Boot Parameter %s failed: %s",
arg, val2str(rsp->ccode, completion_code_vals));
return -1;
}
if (verbose > 2)
printbuf(rsp->data, rsp->data_len, "Boot Option");
@ -369,53 +499,121 @@ static void ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
printf("Boot parameter %d is %s\n", rsp->data[1] & 0x7f,
(rsp->data[1] & 0x80) ? "invalid/locked" : "valid/unlocked");
printf("Boot parameter data: %s\n", buf2str(rsp->data+2, rsp->data_len - 2));
return 0;
}
static void ipmi_chassis_set_bootflag(struct ipmi_intf * intf, char * arg)
static int
ipmi_chassis_set_bootdev(struct ipmi_intf * intf, char * arg, uint8_t *iflags)
{
unsigned char flags[5];
uint8_t flags[5];
int rc = 0;
int use_progress = 1;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
if (!arg) {
printf("Error: no bootflag argument supplied\n");
return;
if (use_progress) {
/* set set-in-progress flag */
memset(flags, 0, 5);
flags[0] = 0x01;
rc = ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS, flags, 1);
if (rc < 0)
use_progress = 0;
}
if (!strncmp(arg, "force_pxe", 9)) {
flags[1] = 0x04; // 00000100
}
else if (!strncmp(arg, "force_disk", 10)) {
flags[1] = 0x08; // 00001000
}
else if (!strncmp(arg, "force_diag", 10)) {
flags[1] = 0x10; // 00010000
}
else if (!strncmp(arg, "force_cdrom", 11)) {
flags[1] = 0x14; // 00010100
}
else if (!strncmp(arg, "force_floppy", 12)) {
flags[1] = 0x3c; // 00111100
memset(flags, 0, 5);
flags[0] = 0x01;
flags[1] = 0x01;
rc = ipmi_chassis_set_bootparam(intf, IPMI_CHASSIS_BOOTPARAM_INFO_ACK,
flags, 2);
if (rc < 0) {
if (use_progress) {
/* set-in-progress = set-complete */
memset(flags, 0, 5);
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
return -1;
}
if (iflags == NULL)
memset(flags, 0, 5);
else
memcpy(flags, iflags, sizeof (flags));
if (arg == NULL)
flags[1] = 0x00;
else if (strncmp(arg, "none", 4) == 0)
flags[1] = 0x00;
else if (strncmp(arg, "pxe", 3) == 0 ||
strncmp(arg, "force_pxe", 9) == 0)
flags[1] = 0x04;
else if (strncmp(arg, "disk", 4) == 0 ||
strncmp(arg, "force_disk", 10) == 0)
flags[1] = 0x08;
else if (strncmp(arg, "safe", 4) == 0 ||
strncmp(arg, "force_safe", 10) == 0)
flags[1] = 0x0c;
else if (strncmp(arg, "diag", 4) == 0 ||
strncmp(arg, "force_diag", 10) == 0)
flags[1] = 0x10;
else if (strncmp(arg, "cdrom", 5) == 0 ||
strncmp(arg, "force_cdrom", 11) == 0)
flags[1] = 0x14;
else if (strncmp(arg, "floppy", 6) == 0 ||
strncmp(arg, "force_floppy", 12) == 0)
flags[1] = 0x3c;
else if (strncmp(arg, "bios", 4) == 0 ||
strncmp(arg, "force_bios", 10) == 0)
flags[1] = 0x18;
else {
printf("Invalid bootflag: %s\n", arg);
return;
lprintf(LOG_ERR, "Invalid argument: %s", arg);
if (use_progress) {
/* set-in-progress = set-complete */
memset(flags, 0, 5);
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
return -1;
}
flags[0] = 0x80; /* set flag valid bit */
ipmi_chassis_set_bootparam(intf, 5, flags, 5);
/* set flag valid bit */
flags[0] |= 0x80;
flags[0] = 0x08; /* don't automatically clear boot flag valid bit in 60 seconds */
ipmi_chassis_set_bootparam(intf, 3, flags, 1);
rc = ipmi_chassis_set_bootparam(intf, IPMI_CHASSIS_BOOTPARAM_BOOT_FLAGS,
flags, 5);
if (rc == 0) {
if (use_progress) {
/* set-in-progress = commit-write */
memset(flags, 0, 5);
flags[0] = 0x02;
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
printf("Set Boot Device to %s\n", arg);
}
if (use_progress) {
/* set-in-progress = set-complete */
memset(flags, 0, 5);
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
return rc;
}
static void ipmi_chassis_power_policy(struct ipmi_intf * intf, unsigned char policy)
static int
ipmi_chassis_power_policy(struct ipmi_intf * intf, uint8_t policy)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_CHASSIS;
req.msg.cmd = 0x6;
@ -423,14 +621,15 @@ static void ipmi_chassis_power_policy(struct ipmi_intf * intf, unsigned char pol
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (!rsp)
return;
if (rsp->ccode > 0) {
printf("BMC Power Restore Policy command failed: %s\n",
val2str(rsp->ccode, completion_code_vals));
return;
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in Power Restore Policy command");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Power Restore Policy command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
if (policy == IPMI_CHASSIS_POLICY_NO_CHANGE) {
printf("Supported chassis power policy: ");
@ -458,121 +657,287 @@ static void ipmi_chassis_power_policy(struct ipmi_intf * intf, unsigned char pol
printf("unknown\n");
}
}
return 0;
}
int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
int
ipmi_power_main(struct ipmi_intf * intf, int argc, char ** argv)
{
if (!argc || !strncmp(argv[0], "help", 4)) {
printf("Chassis Commands: status, power, identify, policy, restart_cause, poh\n");
int rc = 0;
uint8_t ctl = 0;
if ((argc < 1) || (strncmp(argv[0], "help", 4) == 0)) {
lprintf(LOG_NOTICE, "chassis power Commands: status, on, off, cycle, reset, diag, soft");
return 0;
}
else if (!strncmp(argv[0], "status", 6)) {
ipmi_chassis_status(intf);
if (strncmp(argv[0], "status", 6) == 0) {
rc = ipmi_chassis_print_power_status(intf);
return rc;
}
if ((strncmp(argv[0], "up", 2) == 0) || (strncmp(argv[0], "on", 2) == 0))
ctl = IPMI_CHASSIS_CTL_POWER_UP;
else if ((strncmp(argv[0], "down", 4) == 0) || (strncmp(argv[0], "off", 3) == 0))
ctl = IPMI_CHASSIS_CTL_POWER_DOWN;
else if (strncmp(argv[0], "cycle", 5) == 0)
ctl = IPMI_CHASSIS_CTL_POWER_CYCLE;
else if (strncmp(argv[0], "reset", 5) == 0)
ctl = IPMI_CHASSIS_CTL_HARD_RESET;
else if (strncmp(argv[0], "diag", 4) == 0)
ctl = IPMI_CHASSIS_CTL_PULSE_DIAG;
else if ((strncmp(argv[0], "acpi", 4) == 0) || (strncmp(argv[0], "soft", 4) == 0))
ctl = IPMI_CHASSIS_CTL_ACPI_SOFT;
else {
lprintf(LOG_ERR, "Invalid chassis power command: %s", argv[0]);
return -1;
}
else if (!strncmp(argv[0], "power", 5)) {
unsigned char ctl = 0;
if (argc < 2 || !strncmp(argv[1], "help", 4)) {
printf("chassis power Commands: status, on, off, cycle, reset, diag, soft\n");
rc = ipmi_chassis_power_control(intf, ctl);
return rc;
}
int
ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
if ((argc == 0) || (strncmp(argv[0], "help", 4) == 0)) {
lprintf(LOG_NOTICE, "Chassis Commands: status, power, identify, policy, restart_cause, poh, bootdev, bootparam, selftest");
}
else if (strncmp(argv[0], "status", 6) == 0) {
rc = ipmi_chassis_status(intf);
}
else if (strncmp(argv[0], "selftest", 8) == 0) {
rc = ipmi_chassis_selftest(intf);
}
else if (strncmp(argv[0], "power", 5) == 0) {
uint8_t ctl = 0;
if ((argc < 2) || (strncmp(argv[1], "help", 4) == 0)) {
lprintf(LOG_NOTICE, "chassis power Commands: status, on, off, cycle, reset, diag, soft");
return 0;
}
if (!strncmp(argv[1], "status", 6)) {
ipmi_chassis_power_status(intf);
return 0;
if (strncmp(argv[1], "status", 6) == 0) {
rc = ipmi_chassis_print_power_status(intf);
return rc;
}
if (!strncmp(argv[1], "up", 2) || !strncmp(argv[1], "on", 2))
if ((strncmp(argv[1], "up", 2) == 0) || (strncmp(argv[1], "on", 2) == 0))
ctl = IPMI_CHASSIS_CTL_POWER_UP;
else if (!strncmp(argv[1], "down", 4) || !strncmp(argv[1], "off", 3))
else if ((strncmp(argv[1], "down", 4) == 0) || (strncmp(argv[1], "off", 3) == 0))
ctl = IPMI_CHASSIS_CTL_POWER_DOWN;
else if (!strncmp(argv[1], "cycle", 5))
else if (strncmp(argv[1], "cycle", 5) == 0)
ctl = IPMI_CHASSIS_CTL_POWER_CYCLE;
else if (!strncmp(argv[1], "reset", 5))
else if (strncmp(argv[1], "reset", 5) == 0)
ctl = IPMI_CHASSIS_CTL_HARD_RESET;
else if (!strncmp(argv[1], "diag", 5))
else if (strncmp(argv[1], "diag", 4) == 0)
ctl = IPMI_CHASSIS_CTL_PULSE_DIAG;
else if (!strncmp (argv[1], "acpi", 4) || !strncmp(argv[1], "soft", 4))
else if ((strncmp(argv[1], "acpi", 4) == 0) || (strncmp(argv[1], "soft", 4) == 0))
ctl = IPMI_CHASSIS_CTL_ACPI_SOFT;
else {
printf("Invalid chassis power command: %s\n", argv[1]);
lprintf(LOG_ERR, "Invalid chassis power command: %s", argv[1]);
return -1;
}
ipmi_chassis_power_control(intf, ctl);
rc = ipmi_chassis_power_control(intf, ctl);
}
else if (!strncmp(argv[0], "identify", 8)) {
else if (strncmp(argv[0], "identify", 8) == 0) {
if (argc < 2) {
ipmi_chassis_identify(intf, NULL);
rc = ipmi_chassis_identify(intf, NULL);
}
else if (!strncmp(argv[1], "help", 4)) {
printf("chassis identify <interval>\n");
printf(" default is 15 seconds\n");
printf(" 0 to turn off\n");
printf(" force to turn on indefinitely\n");
else if (strncmp(argv[1], "help", 4) == 0) {
lprintf(LOG_NOTICE, "chassis identify <interval>");
lprintf(LOG_NOTICE, " default is 15 seconds");
lprintf(LOG_NOTICE, " 0 to turn off");
lprintf(LOG_NOTICE, " force to turn on indefinitely");
} else {
ipmi_chassis_identify(intf, argv[1]);
rc = ipmi_chassis_identify(intf, argv[1]);
}
}
else if (!strncmp(argv[0], "poh", 3)) {
ipmi_chassis_poh(intf);
else if (strncmp(argv[0], "poh", 3) == 0) {
rc = ipmi_chassis_poh(intf);
}
else if (!strncmp(argv[0], "restart_cause", 13)) {
ipmi_chassis_restart_cause(intf);
else if (strncmp(argv[0], "restart_cause", 13) == 0) {
rc = ipmi_chassis_restart_cause(intf);
}
else if (!strncmp(argv[0], "policy", 4)) {
if (argc < 2 || !strncmp(argv[1], "help", 4)) {
printf("chassis policy <state>\n");
printf(" list : return supported policies\n");
printf(" always-on : turn on when power is restored\n");
printf(" previous : return to previous state when power is restored\n");
printf(" always-off : stay off after power is restored\n");
else if (strncmp(argv[0], "policy", 4) == 0) {
if ((argc < 2) || (strncmp(argv[1], "help", 4) == 0)) {
lprintf(LOG_NOTICE, "chassis policy <state>");
lprintf(LOG_NOTICE, " list : return supported policies");
lprintf(LOG_NOTICE, " always-on : turn on when power is restored");
lprintf(LOG_NOTICE, " previous : return to previous state when power is restored");
lprintf(LOG_NOTICE, " always-off : stay off after power is restored");
} else {
unsigned char ctl;
if (!strncmp(argv[1], "list", 4))
uint8_t ctl;
if (strncmp(argv[1], "list", 4) == 0)
ctl = IPMI_CHASSIS_POLICY_NO_CHANGE;
else if (!strncmp(argv[1], "always-on", 9))
else if (strncmp(argv[1], "always-on", 9) == 0)
ctl = IPMI_CHASSIS_POLICY_ALWAYS_ON;
else if (!strncmp(argv[1], "previous", 8))
else if (strncmp(argv[1], "previous", 8) == 0)
ctl = IPMI_CHASSIS_POLICY_PREVIOUS;
else if (!strncmp(argv[1], "always-off", 10))
else if (strncmp(argv[1], "always-off", 10) == 0)
ctl = IPMI_CHASSIS_POLICY_ALWAYS_OFF;
else {
printf("invalid chassis policy: %s\n", argv[1]);
lprintf(LOG_ERR, "Invalid chassis policy: %s", argv[1]);
return -1;
}
ipmi_chassis_power_policy(intf, ctl);
rc = ipmi_chassis_power_policy(intf, ctl);
}
}
else if (!strncmp(argv[0], "bootparam", 7)) {
if (argc < 3 || !strncmp(argv[1], "help", 4)) {
printf("bootparam get|set <option> [value ...]\n");
else if (strncmp(argv[0], "bootparam", 9) == 0) {
if ((argc < 3) || (strncmp(argv[1], "help", 4) == 0)) {
lprintf(LOG_NOTICE, "bootparam get <param #>");
lprintf(LOG_NOTICE, "bootparam set bootflag <flag>");
lprintf(LOG_NOTICE, " force_pxe : Force PXE boot");
lprintf(LOG_NOTICE, " force_disk : Force boot from default Hard-drive");
lprintf(LOG_NOTICE, " force_safe : Force boot from default Hard-drive, request Safe Mode");
lprintf(LOG_NOTICE, " force_diag : Force boot from Diagnostic Partition");
lprintf(LOG_NOTICE, " force_cdrom : Force boot from CD/DVD");
lprintf(LOG_NOTICE, " force_bios : Force boot into BIOS Setup");
}
else {
if (!strncmp(argv[1], "get", 3)) {
ipmi_chassis_get_bootparam(intf, argv[2]);
if (strncmp(argv[1], "get", 3) == 0) {
rc = ipmi_chassis_get_bootparam(intf, argv[2]);
}
else if (!strncmp(argv[1], "set", 3)) {
else if (strncmp(argv[1], "set", 3) == 0) {
if (argc < 4) {
printf("bootparam set <option> [value ...]\n");
lprintf(LOG_NOTICE, "bootparam set <option> [value ...]");
} else {
if (!strncmp(argv[2], "bootflag", 8)) {
ipmi_chassis_set_bootflag(intf, argv[3]);
}
else {
printf("bootparam set <option> [value ...]\n");
}
if (strncmp(argv[2], "bootflag", 8) == 0)
rc = ipmi_chassis_set_bootdev(intf, argv[3], NULL);
else
lprintf(LOG_NOTICE, "bootparam set <option> [value ...]");
}
}
else {
printf("bootparam get|set <option> [value]\n");
else
lprintf(LOG_NOTICE, "bootparam get|set <option> [value ...]");
}
}
else if (strncmp(argv[0], "bootdev", 7) == 0) {
if ((argc < 2) || (strncmp(argv[1], "help", 4) == 0)) {
lprintf(LOG_NOTICE, "bootdev <device> [clear-cmos=yes|no]");
lprintf(LOG_NOTICE, "bootdev <device> [options=help,...]");
lprintf(LOG_NOTICE, " none : Do not change boot device order");
lprintf(LOG_NOTICE, " pxe : Force PXE boot");
lprintf(LOG_NOTICE, " disk : Force boot from default Hard-drive");
lprintf(LOG_NOTICE, " safe : Force boot from default Hard-drive, request Safe Mode");
lprintf(LOG_NOTICE, " diag : Force boot from Diagnostic Partition");
lprintf(LOG_NOTICE, " cdrom : Force boot from CD/DVD");
lprintf(LOG_NOTICE, " bios : Force boot into BIOS Setup");
lprintf(LOG_NOTICE, " floppy: Force boot from Floppy/primary removable media");
} else {
if (argc < 3)
rc = ipmi_chassis_set_bootdev(intf, argv[1], NULL);
else if (strncmp(argv[2], "clear-cmos=", 11) == 0) {
if (strncmp(argv[2]+11, "yes", 3) == 0) {
uint8_t flags[5] = {0, (1<<7), 0, 0, 0};
rc = ipmi_chassis_set_bootdev(intf, argv[1], flags);
} else
rc = ipmi_chassis_set_bootdev(intf, argv[1], NULL);
}
else if (strncmp(argv[2], "options=", 8) == 0) {
char *token;
char *saveptr = NULL;
int optionError = 0;
unsigned char flags[5];
static struct {
char *name;
int i;
unsigned char mask;
unsigned char value;
char *desc;
} options[] = {
/* data 1 */
{"valid", 0, (1<<7), (1<<7),
"Boot flags valid"},
{"persistent", 0, (1<<6), (1<<6),
"Changes are persistent for all future boots"},
{"efiboot", 0, (1<<5), (1<<5),
"Extensible Firmware Interface Boot (EFI)"},
/* data 2 */
{"clear-cmos", 1, (1<<7), (1<<7),
"CMOS clear"},
{"lockkbd", 1, (1<<6), (1<<6),
"Lock Keyboard"},
/* data2[5:2] is parsed elsewhere */
{"screenblank", 1, (1<<1), (1<<1),
"Screen Blank"},
{"lockoutreset", 1, (1<<0), (1<<0),
"Lock out Resetbuttons"},
/* data 3 */
{"lockout_power", 2, (1<<7), (1<<7),
"Lock out (power off/sleep request) via Power Button"},
{"verbose=default", 2, (3<<5), (0<<5),
"Request quiet BIOS display"},
{"verbose=no", 2, (3<<5), (1<<5),
"Request quiet BIOS display"},
{"verbose=yes", 2, (3<<5), (2<<5),
"Request verbose BIOS display"},
{"force_pet", 2, (1<<4), (1<<4),
"Force progress event traps"},
{"upw_bypass", 2, (1<<3), (1<<3),
"User password bypass"},
{"lockout_sleep", 2, (1<<2), (1<<2),
"Log Out Sleep Button"},
{"cons_redirect=default", 2, (3<<0), (0<<0),
"Console redirection occurs per BIOS configuration setting"},
{"cons_redirect=skip", 2, (3<<0), (1<<0),
"Suppress (skip) console redirection if enabled"},
{"cons_redirect=enable", 2, (3<<0), (2<<0),
"Suppress (skip) console redirection if enabled"},
/* data 4 */
/* data4[7:4] reserved */
/* data4[3] BIOS Shared Mode Override, not implemented here */
/* data4[2:0] BIOS Mux Control Override, not implemented here */
/* data5 reserved */
{NULL} /* End marker */
}, *op;
memset(&flags[0], 0, sizeof(flags));
token = strtok_r(argv[2] + 8, ",", &saveptr);
while (token != NULL) {
int i;
if (strcmp(token, "help") == 0) {
optionError = 1;
break;
}
for (op = options; op->name != NULL; ++op) {
if (strcmp(token, op->name) == 0) {
flags[op->i] &= op->mask;
flags[op->i] |= op->value;
break;
}
}
if (op->name == NULL) {
/* Option not found */
optionError = 1;
lprintf(LOG_ERR, "Invalid option: %s", token);
}
token = strtok_r(NULL, ",", &saveptr);
}
if (optionError) {
lprintf(LOG_NOTICE, "Legal options are:");
lprintf(LOG_NOTICE, "\thelp:\tprint this message");
for (op = options; op->name != NULL; ++op) {
lprintf(LOG_NOTICE, "\t%s:\t%s", op->name, op->desc);
}
return (-1);
}
rc = ipmi_chassis_set_bootdev(intf, argv[1], flags);
}
else
rc = ipmi_chassis_set_bootdev(intf, argv[1], NULL);
}
}
else {
printf("Invalid Chassis command: %s\n", argv[0]);
lprintf(LOG_ERR, "Invalid Chassis command: %s", argv[0]);
return -1;
}
return 0;
return rc;
}

View File

@ -28,109 +28,610 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <ctype.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi_sel.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_channel.h>
#include <ipmitool/ipmi_event.h>
#include <ipmitool/ipmi_sdr.h>
static void
ipmi_event_msg_print(struct ipmi_intf * intf, struct platform_event_msg * pmsg)
{
struct sel_event_record sel_event;
memset(&sel_event, 0, sizeof(struct sel_event_record));
sel_event.record_id = 0;
sel_event.sel_type.standard_type.gen_id = 2;
sel_event.sel_type.standard_type.evm_rev = pmsg->evm_rev;
sel_event.sel_type.standard_type.sensor_type = pmsg->sensor_type;
sel_event.sel_type.standard_type.sensor_num = pmsg->sensor_num;
sel_event.sel_type.standard_type.event_type = pmsg->event_type;
sel_event.sel_type.standard_type.event_dir = pmsg->event_dir;
sel_event.sel_type.standard_type.event_data[0] = pmsg->event_data[0];
sel_event.sel_type.standard_type.event_data[1] = pmsg->event_data[1];
sel_event.sel_type.standard_type.event_data[2] = pmsg->event_data[2];
if (verbose)
ipmi_sel_print_extended_entry_verbose(intf, &sel_event);
else
ipmi_sel_print_extended_entry(intf, &sel_event);
}
static int
ipmi_send_platform_event(struct ipmi_intf * intf, int num)
ipmi_send_platform_event(struct ipmi_intf * intf, struct platform_event_msg * emsg)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char rqdata[8];
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
uint8_t rqdata[8];
uint8_t chmed;
memset(&req, 0, sizeof(req));
memset(rqdata, 0, 8);
printf("Sending ");
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = 0x02;
req.msg.data = rqdata;
chmed = ipmi_current_channel_medium(intf);
if (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM) {
/* system interface, need extra generator ID */
req.msg.data_len = 8;
rqdata[0] = 0x20;
memcpy(rqdata+1, emsg, sizeof(struct platform_event_msg));
}
else {
req.msg.data_len = 7;
memcpy(rqdata, emsg, sizeof(struct platform_event_msg));
}
ipmi_event_msg_print(intf, emsg);
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Platform Event Message command failed");
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Platform Event Message command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
return 0;
}
#define EVENT_THRESH_STATE_LNC_LO 0
#define EVENT_THRESH_STATE_LNC_HI 1
#define EVENT_THRESH_STATE_LCR_LO 2
#define EVENT_THRESH_STATE_LCR_HI 3
#define EVENT_THRESH_STATE_LNR_LO 4
#define EVENT_THRESH_STATE_LNR_HI 5
#define EVENT_THRESH_STATE_UNC_LO 6
#define EVENT_THRESH_STATE_UNC_HI 7
#define EVENT_THRESH_STATE_UCR_LO 8
#define EVENT_THRESH_STATE_UCR_HI 9
#define EVENT_THRESH_STATE_UNR_LO 10
#define EVENT_THRESH_STATE_UNR_HI 11
static const struct valstr ipmi_event_thresh_lo[] = {
{ EVENT_THRESH_STATE_LNC_LO, "lnc" },
{ EVENT_THRESH_STATE_LCR_LO, "lcr" },
{ EVENT_THRESH_STATE_LNR_LO, "lnr" },
{ EVENT_THRESH_STATE_UNC_LO, "unc" },
{ EVENT_THRESH_STATE_UCR_LO, "ucr" },
{ EVENT_THRESH_STATE_UNR_LO, "unr" },
{ 0, NULL },
};
static const struct valstr ipmi_event_thresh_hi[] = {
{ EVENT_THRESH_STATE_LNC_HI, "lnc" },
{ EVENT_THRESH_STATE_LCR_HI, "lcr" },
{ EVENT_THRESH_STATE_LNR_HI, "lnr" },
{ EVENT_THRESH_STATE_UNC_HI, "unc" },
{ EVENT_THRESH_STATE_UCR_HI, "ucr" },
{ EVENT_THRESH_STATE_UNR_HI, "unr" },
{ 0, NULL },
};
static int
ipmi_send_platform_event_num(struct ipmi_intf * intf, int num)
{
struct platform_event_msg emsg;
memset(&emsg, 0, sizeof(struct platform_event_msg));
/* IPMB/LAN/etc */
switch (num) {
case 1: /* temperature */
printf("Temperature - Upper Critical - Going High");
rqdata[0] = 0x04; /* EvMRev */
rqdata[1] = 0x01; /* Sensor Type */
rqdata[2] = 0x30; /* Sensor # */
rqdata[3] = 0x01; /* Event Dir / Event Type */
rqdata[4] = 0x59; /* Event Data 1 */
rqdata[5] = 0x00; /* Event Data 2 */
rqdata[6] = 0x00; /* Event Data 3 */
printf("Sending SAMPLE event: Temperature - "
"Upper Critical - Going High\n");
emsg.evm_rev = 0x04;
emsg.sensor_type = 0x01;
emsg.sensor_num = 0x30;
emsg.event_dir = EVENT_DIR_ASSERT;
emsg.event_type = 0x01;
emsg.event_data[0] = EVENT_THRESH_STATE_UCR_HI;
emsg.event_data[1] = 0xff;
emsg.event_data[2] = 0xff;
break;
case 2: /* voltage error */
printf("Voltage Threshold - Lower Critical - Going Low");
rqdata[0] = 0x04; /* EvMRev */
rqdata[1] = 0x02; /* Sensor Type */
rqdata[2] = 0x60; /* Sensor # */
rqdata[3] = 0x01; /* Event Dir / Event Type */
rqdata[4] = 0x52; /* Event Data 1 */
rqdata[5] = 0x00; /* Event Data 2 */
rqdata[6] = 0x00; /* Event Data 3 */
printf("Sending SAMPLE event: Voltage Threshold - "
"Lower Critical - Going Low\n");
emsg.evm_rev = 0x04;
emsg.sensor_type = 0x02;
emsg.sensor_num = 0x60;
emsg.event_dir = EVENT_DIR_ASSERT;
emsg.event_type = 0x01;
emsg.event_data[0] = EVENT_THRESH_STATE_LCR_LO;
emsg.event_data[1] = 0xff;
emsg.event_data[2] = 0xff;
break;
case 3: /* correctable ECC */
printf("Memory - Correctable ECC");
rqdata[0] = 0x04; /* EvMRev */
rqdata[1] = 0x0c; /* Sensor Type */
rqdata[2] = 0x01; /* Sensor # */
rqdata[3] = 0x6f; /* Event Dir / Event Type */
rqdata[4] = 0x00; /* Event Data 1 */
rqdata[5] = 0x00; /* Event Data 2 */
rqdata[6] = 0x00; /* Event Data 3 */
printf("Sending SAMPLE event: Memory - Correctable ECC\n");
emsg.evm_rev = 0x04;
emsg.sensor_type = 0x0c;
emsg.sensor_num = 0x53;
emsg.event_dir = EVENT_DIR_ASSERT;
emsg.event_type = 0x6f;
emsg.event_data[0] = 0x00;
emsg.event_data[1] = 0xff;
emsg.event_data[2] = 0xff;
break;
default:
printf("Invalid event number: %d\n", num);
lprintf(LOG_ERR, "Invalid event number: %d", num);
return -1;
}
printf(" event to BMC\n");
return ipmi_send_platform_event(intf, &emsg);
}
static int
ipmi_event_find_offset(uint8_t code,
struct ipmi_event_sensor_types * evt,
char * desc)
{
if (desc == NULL || code == 0)
return 0x00;
while (evt->type) {
if (evt->code == code && evt->desc != NULL &&
strncasecmp(desc, evt->desc, __maxlen(desc, evt->desc)) == 0)
return evt->offset;
evt++;
}
lprintf(LOG_WARN, "Unable to find matching event offset for '%s'", desc);
return -1;
}
static void
print_sensor_states(uint8_t sensor_type, uint8_t event_type)
{
printf("Sensor States: \n ");
ipmi_sdr_print_discrete_state_mini("\n ", sensor_type,
event_type, 0xff, 0xff);
printf("\n");
}
static int
ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * evdir)
{
struct ipmi_rs * rsp;
struct sdr_record_list * sdr;
struct platform_event_msg emsg;
int off;
if (id == NULL) {
lprintf(LOG_ERR, "No sensor ID supplied");
return -1;
}
memset(&emsg, 0, sizeof(struct platform_event_msg));
emsg.evm_rev = 0x04;
if (evdir == NULL)
emsg.event_dir = EVENT_DIR_ASSERT;
else if (strncasecmp(evdir, "assert", 6) == 0)
emsg.event_dir = EVENT_DIR_ASSERT;
else if (strncasecmp(evdir, "deassert", 8) == 0)
emsg.event_dir = EVENT_DIR_DEASSERT;
else {
lprintf(LOG_ERR, "Invalid event direction %s. Must be 'assert' or 'deassert'", evdir);
return -1;
}
printf("Finding sensor %s... ", id);
sdr = ipmi_sdr_find_sdr_byid(intf, id);
if (sdr == NULL) {
printf("not found!\n");
return -1;
}
printf("ok\n");
switch (sdr->type)
{
case SDR_RECORD_TYPE_FULL_SENSOR:
emsg.sensor_type = sdr->record.full->sensor.type;
emsg.sensor_num = sdr->record.full->keys.sensor_num;
emsg.event_type = sdr->record.full->event_type;
break;
case SDR_RECORD_TYPE_COMPACT_SENSOR:
emsg.sensor_type = sdr->record.compact->sensor.type;
emsg.sensor_num = sdr->record.compact->keys.sensor_num;
emsg.event_type = sdr->record.compact->event_type;
break;
default:
lprintf(LOG_ERR, "Unknown sensor type for id '%s'", id);
return -1;
}
emsg.event_data[1] = 0xff;
emsg.event_data[2] = 0xff;
switch (emsg.event_type)
{
/*
* Threshold Class
*/
case 1:
{
int dir = 0;
int hilo = 0;
off = 1;
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
printf("Sensor States:\n");
printf(" lnr : Lower Non-Recoverable \n");
printf(" lcr : Lower Critical\n");
printf(" lnc : Lower Non-Critical\n");
printf(" unc : Upper Non-Critical\n");
printf(" ucr : Upper Critical\n");
printf(" unr : Upper Non-Recoverable\n");
return -1;
}
if (0 != strncasecmp(state, "lnr", 3) &&
0 != strncasecmp(state, "lcr", 3) &&
0 != strncasecmp(state, "lnc", 3) &&
0 != strncasecmp(state, "unc", 3) &&
0 != strncasecmp(state, "ucr", 3) &&
0 != strncasecmp(state, "unr", 3))
{
lprintf(LOG_ERR, "Invalid threshold identifier %s", state);
return -1;
}
if (state[0] == 'u')
hilo = 1;
else
hilo = 0;
if (emsg.event_dir == EVENT_DIR_ASSERT)
dir = hilo;
else
dir = !hilo;
if ((emsg.event_dir == EVENT_DIR_ASSERT && hilo == 1) ||
(emsg.event_dir == EVENT_DIR_DEASSERT && hilo == 0))
emsg.event_data[0] = (uint8_t)(str2val(state, ipmi_event_thresh_hi) & 0xf);
else if ((emsg.event_dir == EVENT_DIR_ASSERT && hilo == 0) ||
(emsg.event_dir == EVENT_DIR_DEASSERT && hilo == 1))
emsg.event_data[0] = (uint8_t)(str2val(state, ipmi_event_thresh_lo) & 0xf);
else {
lprintf(LOG_ERR, "Invalid Event\n");
return -1;
}
rsp = ipmi_sdr_get_sensor_thresholds(intf, emsg.sensor_num);
if (rsp != NULL && rsp->ccode == 0) {
/* threshold reading */
emsg.event_data[2] = rsp->data[(emsg.event_data[0] / 2) + 1];
rsp = ipmi_sdr_get_sensor_hysteresis(intf, emsg.sensor_num);
if (rsp != NULL && rsp->ccode == 0)
off = dir ? rsp->data[0] : rsp->data[1];
if (off <= 0)
off = 1;
/* trigger reading */
if (dir) {
if ((emsg.event_data[2] + off) > 0xff)
emsg.event_data[1] = 0xff;
else
emsg.event_data[1] = emsg.event_data[2] + off;
}
else {
if ((emsg.event_data[2] - off) < 0)
emsg.event_data[1] = 0;
else
emsg.event_data[1] = emsg.event_data[2] - off;
}
/* trigger in byte 2, threshold in byte 3 */
emsg.event_data[0] |= 0x50;
}
}
break;
/*
* Digital Discrete
*/
case 3: case 4: case 5: case 6: case 8: case 9:
{
int x;
const char * digi_on[] = { "present", "assert", "limit",
"fail", "yes", "on", "up" };
const char * digi_off[] = { "absent", "deassert", "nolimit",
"nofail", "no", "off", "down" };
/*
* print list of available states for this sensor
*/
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
print_sensor_states(emsg.sensor_type, emsg.event_type);
printf("Sensor State Shortcuts:\n");
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
printf(" %-9s %-9s\n", digi_on[x], digi_off[x]);
}
return 0;
}
off = 0;
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
if (strncasecmp(state, digi_on[x], strlen(digi_on[x])) == 0) {
emsg.event_data[0] = 1;
off = 1;
break;
}
else if (strncasecmp(state, digi_off[x], strlen(digi_off[x])) == 0) {
emsg.event_data[0] = 0;
off = 1;
break;
}
}
if (off == 0) {
off = ipmi_event_find_offset(
emsg.event_type, generic_event_types, state);
if (off < 0)
return -1;
emsg.event_data[0] = off;
}
}
break;
/*
* Generic Discrete
*/
case 2: case 7: case 10: case 11: case 12:
{
/*
* print list of available states for this sensor
*/
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
print_sensor_states(emsg.sensor_type, emsg.event_type);
return 0;
}
off = ipmi_event_find_offset(
emsg.event_type, generic_event_types, state);
if (off < 0)
return -1;
emsg.event_data[0] = off;
}
break;
/*
* Sensor-Specific Discrete
*/
case 0x6f:
{
/*
* print list of available states for this sensor
*/
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
print_sensor_states(emsg.sensor_type, emsg.event_type);
return 0;
}
off = ipmi_event_find_offset(
emsg.sensor_type, sensor_specific_types, state);
if (off < 0)
return -1;
emsg.event_data[0] = off;
}
break;
default:
return -1;
}
return ipmi_send_platform_event(intf, &emsg);
}
static int
ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
{
FILE * fp;
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct sel_event_record sel_event;
uint8_t rqdata[8];
char buf[1024];
char * ptr, * tok;
int i, j;
uint8_t chmed;
int rc = 0;
if (file == NULL)
return -1;
memset(rqdata, 0, 8);
/* setup Platform Event Message command */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = 0x02;
req.msg.data = rqdata;
req.msg.data_len = 7;
chmed = ipmi_current_channel_medium(intf);
if (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM) {
/* system interface, need extra generator ID */
rqdata[0] = 0x20;
req.msg.data_len = 8;
}
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x Platform Event Message Command\n", rsp?rsp->ccode:0);
fp = ipmi_open_file_read(file);
if (fp == NULL)
return -1;
while (feof(fp) == 0) {
if (fgets(buf, 1024, fp) == NULL)
continue;
/* clip off optional comment tail indicated by # */
ptr = strchr(buf, '#');
if (ptr)
*ptr = '\0';
else
ptr = buf + strlen(buf);
/* clip off trailing and leading whitespace */
ptr--;
while (isspace((int)*ptr) && ptr >= buf)
*ptr-- = '\0';
ptr = buf;
while (isspace((int)*ptr))
ptr++;
if (strlen(ptr) == 0)
continue;
/* parse the event, 7 bytes with optional comment */
/* 0x00 0x00 0x00 0x00 0x00 0x00 0x00 # event */
i = 0;
tok = strtok(ptr, " ");
while (tok) {
if (i == 7)
break;
j = i++;
if (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM)
j++;
rqdata[j] = (uint8_t)strtol(tok, NULL, 0);
tok = strtok(NULL, " ");
}
if (i < 7) {
lprintf(LOG_ERR, "Invalid Event: %s",
buf2str(rqdata, sizeof(rqdata)));
continue;
}
memset(&sel_event, 0, sizeof(struct sel_event_record));
sel_event.record_id = 0;
sel_event.sel_type.standard_type.gen_id = 2;
j = (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM) ? 1 : 0;
sel_event.sel_type.standard_type.evm_rev = rqdata[j++];
sel_event.sel_type.standard_type.sensor_type = rqdata[j++];
sel_event.sel_type.standard_type.sensor_num = rqdata[j++];
sel_event.sel_type.standard_type.event_type = rqdata[j] & 0x7f;
sel_event.sel_type.standard_type.event_dir = (rqdata[j++] & 0x80) >> 7;
sel_event.sel_type.standard_type.event_data[0] = rqdata[j++];
sel_event.sel_type.standard_type.event_data[1] = rqdata[j++];
sel_event.sel_type.standard_type.event_data[2] = rqdata[j++];
ipmi_sel_print_std_entry(intf, &sel_event);
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Platform Event Message command failed");
rc = -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Platform Event Message command failed: %s",
val2str(rsp->ccode, completion_code_vals));
rc = -1;
}
}
return 0;
fclose(fp);
return rc;
}
int ipmi_event_main(struct ipmi_intf * intf, int argc, char ** argv)
static void
ipmi_event_usage(void)
{
unsigned char c;
if (!argc || !strncmp(argv[0], "help", 4)) {
printf("usage: event <num>\n");
printf(" 1 : Temperature - Upper Critical - Going High\n");
printf(" 2 : Voltage Threshold - Lower Critical - Going Low\n");
printf(" 3 : Memory - Correctable ECC\n");
} else {
c = (unsigned char)strtol(argv[0], NULL, 0);
ipmi_send_platform_event(intf, c);
}
return 0;
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, "usage: event <num>");
lprintf(LOG_NOTICE, " Send generic test events");
lprintf(LOG_NOTICE, " 1 : Temperature - Upper Critical - Going High");
lprintf(LOG_NOTICE, " 2 : Voltage Threshold - Lower Critical - Going Low");
lprintf(LOG_NOTICE, " 3 : Memory - Correctable ECC");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, "usage: event file <filename>");
lprintf(LOG_NOTICE, " Read and generate events from file");
lprintf(LOG_NOTICE, " Use the 'sel save' command to generate from SEL");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, "usage: event <sensorid> <state> [event_dir]");
lprintf(LOG_NOTICE, " sensorid : Sensor ID to use for event data");
lprintf(LOG_NOTICE, " state : Sensor state, use 'list' to see possible states for sensor");
lprintf(LOG_NOTICE, " event_dir : assert, deassert [default=assert]");
lprintf(LOG_NOTICE, "");
}
int
ipmi_event_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
ipmi_event_usage();
return 0;
}
if (strncmp(argv[0], "file", 4) == 0) {
if (argc < 2) {
ipmi_event_usage();
return 0;
}
return ipmi_event_fromfile(intf, argv[1]);
}
if (strlen(argv[0]) == 1) {
switch (argv[0][0]) {
case '1': return ipmi_send_platform_event_num(intf, 1);
case '2': return ipmi_send_platform_event_num(intf, 2);
case '3': return ipmi_send_platform_event_num(intf, 3);
}
}
if (argc < 2)
rc = ipmi_event_fromsensor(intf, argv[0], NULL, NULL);
else if (argc < 3)
rc = ipmi_event_fromsensor(intf, argv[0], argv[1], NULL);
else
rc = ipmi_event_fromsensor(intf, argv[0], argv[1], argv[2]);
return rc;
}

1136
ipmitool/lib/ipmi_firewall.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1624
ipmitool/lib/ipmi_fwum.c Normal file

File diff suppressed because it is too large Load Diff

2398
ipmitool/lib/ipmi_hpmfwupg.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
@ -39,13 +35,24 @@
#include <stdio.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_isol.h>
const struct valstr ipmi_isol_baud_vals[] = {
{ ISOL_BAUD_RATE_9600, "9600" },
{ ISOL_BAUD_RATE_19200, "19200" },
{ ISOL_BAUD_RATE_38400, "38400" },
{ ISOL_BAUD_RATE_57600, "57600" },
{ ISOL_BAUD_RATE_115200, "115200" },
{ 0x00, NULL }
};
extern int verbose;
static int ipmi_isol_setup(struct ipmi_intf * intf)
static int ipmi_isol_setup(struct ipmi_intf * intf, char baudsetting)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@ -65,17 +72,17 @@ static int ipmi_isol_setup(struct ipmi_intf * intf)
req.msg.data_len = 3;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
printf("Error in Set ISOL Config Command\n");
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in Set ISOL Config Command");
return -1;
}
if (rsp->ccode == 0xc1) {
printf("Serial Over Lan not supported!\n");
lprintf(LOG_ERR, "IPMI v1.5 Serial Over Lan (ISOL) not supported!");
return -1;
}
if (rsp->ccode) {
printf("Set Serial Over Lan Config returned %x\n", rsp->ccode);
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Error in Set ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -90,8 +97,13 @@ static int ipmi_isol_setup(struct ipmi_intf * intf)
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x in Get ISOL Config command\n", rsp?rsp->ccode:0);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -108,8 +120,13 @@ static int ipmi_isol_setup(struct ipmi_intf * intf)
req.msg.data_len = 3;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x in Set ISOL Config (Authentication) command\n", rsp?rsp->ccode:0);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in Set ISOL Config (Authentication) Command");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Error in Set ISOL Config (Authentication) Command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -118,27 +135,57 @@ static int ipmi_isol_setup(struct ipmi_intf * intf)
memset(data, 0, 6);
data[0] = 0x00;
data[1] = ISOL_BAUD_RATE_PARAM;
data[2] = ISOL_PREFERRED_BAUD_RATE;
data[2] = baudsetting;
req.msg.cmd = SET_ISOL_CONFIG;
req.msg.data_len = 3;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x in Set ISOL Config (Baud Rate) command\n", rsp?rsp->ccode:0);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in Set ISOL Config (Baud Rate) Command");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Error in Set ISOL Config (Baud Rate) Command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Set ISOL Baud Rate to %s\n",
val2str(baudsetting, ipmi_isol_baud_vals));
return 0;
}
int ipmi_isol_main(struct ipmi_intf * intf, int argc, char ** argv)
{
if (!argc || !strncmp(argv[0], "help", 4)) {
printf("ISOL Commands: setup\n");
int ret = 0;
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
lprintf(LOG_NOTICE, "ISOL Commands: setup <baud>");
lprintf(LOG_NOTICE, "ISOL Baud Rates: 9600, 19200, 38400, 57600, 115200");
return 0;
}
else if (!strncmp(argv[0], "setup", 5)) {
ipmi_isol_setup(intf);
if (strncmp(argv[0], "setup", 5) == 0) {
if (strncmp(argv[1], "9600", 4) == 0) {
ret = ipmi_isol_setup(intf, ISOL_BAUD_RATE_9600);
}
else if (strncmp(argv[1], "19200", 5) == 0) {
ret = ipmi_isol_setup(intf, ISOL_BAUD_RATE_19200);
}
else if (strncmp(argv[1], "38400", 5) == 0) {
ret = ipmi_isol_setup(intf, ISOL_BAUD_RATE_38400);
}
else if (strncmp(argv[1], "57600", 5) == 0) {
ret = ipmi_isol_setup(intf, ISOL_BAUD_RATE_57600);
}
else if (strncmp(argv[1], "115200", 6) == 0) {
ret = ipmi_isol_setup(intf, ISOL_BAUD_RATE_115200);
}
else {
lprintf(LOG_ERR, "ISOL - Unsupported baud rate: %s", argv[1]);
ret = -1;
}
}
return 0;
return ret;
}

View File

@ -0,0 +1,586 @@
/*
* Copyright (c) 2004 Kontron Canada, Inc. All Rights Reserved.
*
* Base on code from
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
/*
* Tue Mar 7 14:36:12 2006
* <stephane.filion@ca.kontron.com>
*
* This code implements an Kontron OEM proprietary commands.
*/
#include <string.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_fru.h>
extern int verbose;
extern int read_fru_area(struct ipmi_intf * intf, struct fru_info *fru,
uint8_t id, uint32_t offset, uint32_t length,
uint8_t *frubuf);
extern int write_fru_area(struct ipmi_intf * intf, struct fru_info *fru,
unsigned char id, unsigned int soffset,
unsigned int doffset, unsigned int length,
unsigned char *pFrubuf);
extern char * get_fru_area_str(uint8_t * data, uint32_t * offset);
static void ipmi_kontron_help(void);
static int ipmi_kontron_set_serial_number(struct ipmi_intf * intf);
static int ipmi_kontron_set_mfg_date (struct ipmi_intf * intf);
int
ipmi_kontronoem_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
if (argc == 0)
ipmi_kontron_help();
else if (strncmp(argv[0], "help", 4) == 0)
ipmi_kontron_help();
else if(!strncmp(argv[0], "setsn", 5))
{
if(argc >= 1)
{
if(ipmi_kontron_set_serial_number(intf) > 0)
{
printf("FRU serial number setted successfully\n");
}
else
{
printf("FRU serial number set failed\n");
}
}
else
{
printf("fru setsn\n");
}
}
else if(!strncmp(argv[0], "setmfgdate", 5))
{
if(argc >= 1)
{
if(ipmi_kontron_set_mfg_date(intf) > 0)
{
printf("FRU manufacturing date setted successfully\n");
}
else
{
printf("FRU manufacturing date set failed\n");
}
}
else
{
printf("fru setmfgdate\n");
}
}
else
{
printf("Invalid Kontron command: %s", argv[0]);
ipmi_kontron_help();
rc = -1;
}
return rc;
}
static void ipmi_kontron_help(void)
{
printf("Kontron Commands: setsn setmfgdate\n");
}
/* ipmi_fru_set_serial_number - Set the Serial Number in FRU
*
* @intf: ipmi interface
* @id: fru id
*
* returns -1 on error
* returns 1 if successful
*/
static int
ipmi_kontron_set_serial_number(struct ipmi_intf * intf)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
struct fru_info fru;
struct fru_header header;
uint8_t msg_data[4];
char *sn;
uint8_t sn_size, checksum;
uint8_t *fru_data;
char *fru_area;
uint32_t fru_data_offset, fru_data_offset_tmp, board_sec_len, prod_sec_len, i;
sn = NULL;
fru_data = NULL;
memset(msg_data, 0, 4);
msg_data[0] = 0xb4;
msg_data[1] = 0x90;
msg_data[2] = 0x91;
msg_data[3] = 0x8b;
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E;
req.msg.cmd = 0x0C;
req.msg.data = msg_data;
req.msg.data_len = 4;
/* Set Lun, necessary for this oem command */
req.msg.lun = 0x03;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
return -11;
}
if (rsp->ccode > 0)
{
printf(" This option is not implemented for this board\n");
return -1;
}
sn_size = rsp->data_len;
sn = malloc(sn_size + 1);
if(sn == NULL)
{
printf("Out of memory!");
return -1;
}
memset(sn, 0, sn_size + 1);
memcpy(sn, rsp->data, sn_size);
if(verbose >= 1)
{
printf("Original serial number is : [%s]\n", sn);
}
memset(msg_data, 0, 4);
msg_data[0] = 0;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_INFO;
req.msg.data = msg_data;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
free(sn);
return -1;
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
return(-1);
}
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
if (fru.size < 1) {
printf(" Invalid FRU size %d", fru.size);
free(sn);
return -1;
}
/*
* retrieve the FRU header
*/
msg_data[0] = 0;
msg_data[1] = 0;
msg_data[2] = 0;
msg_data[3] = 8;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_DATA;
req.msg.data = msg_data;
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
free(sn);
return(-1);
}
if (rsp->ccode > 0)
{
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
return(-1);
}
if (verbose > 1)
printbuf(rsp->data, rsp->data_len, "FRU DATA");
memcpy(&header, rsp->data + 1, 8);
if (header.version != 1)
{
printf(" Unknown FRU header version 0x%02x",
header.version);
free(sn);
return(-1);
}
/* Set the Board Section */
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
fru_data = malloc( fru.size);
if(fru_data == NULL)
{
printf("Out of memory!");
free(sn);
return(-1);
}
memset(fru_data, 0, fru.size);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.board * 8) ,board_sec_len , fru_data) < 0)
{
free(sn);
free(fru_data);
return(-1);
}
/*Position at Board Manufacturer*/
fru_data_offset = (header.offset.board * 8) + 6;
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Board Product Name*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
fru_data_offset_tmp = fru_data_offset;
/*Position at Serial Number*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
fru_data_offset ++;
if(strlen(fru_area) != sn_size)
{
printf("The length of the serial number in the FRU Board Area is wrong.\n");
free(sn);
free(fru_data);
return(-1);
}
/* Copy the new serial number in the board section saved in memory*/
memcpy(fru_data + fru_data_offset, sn, sn_size);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.board * 8); i < (((header.offset.board * 8)+board_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.board * 8)+board_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.board * 8), (header.offset.board * 8), board_sec_len, fru_data) < 0)
{
free(sn);
free(fru_data);
return(-1);
}
/* Set the Product Section */
prod_sec_len = (header.offset.multi * 8) - (header.offset.product * 8);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.product * 8) ,prod_sec_len , fru_data) < 0)
{
free(sn);
free(fru_data);
return(-1);
}
/*Position at Product Manufacturer*/
fru_data_offset = (header.offset.product * 8) + 3;
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Name*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Part*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Version*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
fru_data_offset_tmp = fru_data_offset;
/*Position at Serial Number*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
fru_data_offset ++;
if(strlen(fru_area) != sn_size)
{
free(sn);
free(fru_data);
printf("The length of the serial number in the FRU Product Area is wrong.\n");
return(-1);
}
/* Copy the new serial number in the product section saved in memory*/
memcpy(fru_data + fru_data_offset, sn, sn_size);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.product * 8); i < (((header.offset.product * 8)+prod_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.product * 8)+prod_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.product * 8), (header.offset.product * 8), prod_sec_len, fru_data) < 0)
{
free(sn);
free(fru_data);
return -1;
}
free(sn);
free(fru_data);
return(1);
}
/* ipmi_fru_set_mfg_date - Set the Manufacturing Date in FRU
*
* @intf: ipmi interface
* @id: fru id
*
* returns -1 on error
* returns 1 if successful
*/
static int
ipmi_kontron_set_mfg_date (struct ipmi_intf * intf)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
struct fru_info fru;
struct fru_header header;
uint8_t msg_data[4];
uint8_t mfg_date[3];
uint32_t board_sec_len, i;
uint8_t *fru_data, checksum;
memset(msg_data, 0, 4);
msg_data[0] = 0xb4;
msg_data[1] = 0x90;
msg_data[2] = 0x91;
msg_data[3] = 0x8b;
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E;
req.msg.cmd = 0x0E;
req.msg.data = msg_data;
req.msg.data_len = 4;
/* Set Lun temporary, necessary for this oem command */
req.msg.lun = 0x03;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf("Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0)
{
printf("This option is not implemented for this board\n");
return(-1);
}
if(rsp->data_len != 3)
{
printf("Invalid response for the Manufacturing date\n");
return(-1);
}
memset(mfg_date, 0, 3);
memcpy(mfg_date, rsp->data, 3);
memset(msg_data, 0, 4);
msg_data[0] = 0;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_INFO;
req.msg.data = msg_data;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
}
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
if (fru.size < 1) {
printf(" Invalid FRU size %d", fru.size);
return(-1);
}
/*
* retrieve the FRU header
*/
msg_data[0] = 0;
msg_data[1] = 0;
msg_data[2] = 0;
msg_data[3] = 8;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_DATA;
req.msg.data = msg_data;
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0)
{
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
}
if (verbose > 1)
printbuf(rsp->data, rsp->data_len, "FRU DATA");
memcpy(&header, rsp->data + 1, 8);
if (header.version != 1)
{
printf(" Unknown FRU header version 0x%02x",
header.version);
return(-1);
}
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
fru_data = malloc( fru.size);
if(fru_data == NULL)
{
printf("Out of memory!");
return(-1);
}
memset(fru_data, 0, fru.size);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.board * 8) ,board_sec_len , fru_data) < 0)
{
free(fru_data);
return(-1);
}
/* Copy the new manufacturing date in the board section saved in memory*/
memcpy(fru_data + (header.offset.board * 8) + 3, mfg_date, 3);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.board * 8); i < (((header.offset.board * 8)+board_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.board * 8)+board_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.board * 8), (header.offset.board * 8), board_sec_len, fru_data) < 0)
{
free(fru_data);
return(-1);
}
free(fru_data);
return(1);
}

File diff suppressed because it is too large Load Diff

645
ipmitool/lib/ipmi_main.c Normal file
View File

@ -0,0 +1,645 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <signal.h>
#include <string.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_session.h>
#include <ipmitool/ipmi_sdr.h>
#include <ipmitool/ipmi_sel.h>
#include <ipmitool/ipmi_fru.h>
#include <ipmitool/ipmi_sol.h>
#include <ipmitool/ipmi_isol.h>
#include <ipmitool/ipmi_lanp.h>
#include <ipmitool/ipmi_chassis.h>
#include <ipmitool/ipmi_mc.h>
#include <ipmitool/ipmi_firewall.h>
#include <ipmitool/ipmi_sensor.h>
#include <ipmitool/ipmi_channel.h>
#include <ipmitool/ipmi_session.h>
#include <ipmitool/ipmi_event.h>
#include <ipmitool/ipmi_user.h>
#include <ipmitool/ipmi_raw.h>
#include <ipmitool/ipmi_pef.h>
#include <ipmitool/ipmi_oem.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef ENABLE_ALL_OPTIONS
# define OPTION_STRING "I:hVvcgsEao:H:d:P:f:U:p:C:L:A:t:m:S:l:b:e:k:O:"
#else
# define OPTION_STRING "I:hVvcH:f:U:p:d:S:"
#endif
extern int verbose;
extern int csv_output;
extern const struct valstr ipmi_privlvl_vals[];
extern const struct valstr ipmi_authtype_session_vals[];
/* defined in ipmishell.c */
#ifdef HAVE_READLINE
extern int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv);
#endif
extern int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv);
extern int ipmi_exec_main(struct ipmi_intf * intf, int argc, char ** argv);
/* ipmi_password_file_read - Open file and read password from it
*
* @filename: file name to read from
*
* returns pointer to allocated buffer containing password
* (caller is expected to free when finished)
* returns NULL on error
*/
static char *
ipmi_password_file_read(char * filename)
{
FILE * fp;
char * pass = NULL;
int l;
pass = malloc(16);
if (pass == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return NULL;
}
fp = ipmi_open_file_read((const char *)filename);
if (fp == NULL) {
lprintf(LOG_ERR, "Unable to open password file %s",
filename);
return NULL;
}
/* read in id */
if (fgets(pass, 16, fp) == NULL) {
lprintf(LOG_ERR, "Unable to read password from file %s",
filename);
fclose(fp);
return NULL;
}
/* remove trailing whitespace */
l = strcspn(pass, " \r\n\t");
if (l > 0) {
pass[l] = '\0';
}
fclose(fp);
return pass;
}
/*
* Print all the commands in the above table to stderr
* used for help text on command line and shell
*/
void
ipmi_cmd_print(struct ipmi_cmd * cmdlist)
{
struct ipmi_cmd * cmd;
int hdr = 0;
if (cmdlist == NULL)
return;
for (cmd=cmdlist; cmd->func != NULL; cmd++) {
if (cmd->desc == NULL)
continue;
if (hdr == 0) {
lprintf(LOG_NOTICE, "Commands:");
hdr = 1;
}
lprintf(LOG_NOTICE, "\t%-12s %s", cmd->name, cmd->desc);
}
lprintf(LOG_NOTICE, "");
}
/* ipmi_cmd_run - run a command from list based on parameters
* called from main()
*
* 1. iterate through ipmi_cmd_list matching on name
* 2. call func() for that command
*
* @intf: ipmi interface
* @name: command name
* @argc: command argument count
* @argv: command argument list
*
* returns value from func() of that commnad if found
* returns -1 if command is not found
*/
int
ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv)
{
struct ipmi_cmd * cmd = intf->cmdlist;
/* hook to run a default command if nothing specified */
if (name == NULL) {
if (cmd->func == NULL || cmd->name == NULL)
return -1;
else if (strncmp(cmd->name, "default", 7) == 0)
return cmd->func(intf, 0, NULL);
else {
lprintf(LOG_ERR, "No command provided!");
ipmi_cmd_print(intf->cmdlist);
return -1;
}
}
for (cmd=intf->cmdlist; cmd->func != NULL; cmd++) {
if (strncmp(name, cmd->name, __maxlen(cmd->name, name)) == 0)
break;
}
if (cmd->func == NULL) {
cmd = intf->cmdlist;
if (strncmp(cmd->name, "default", 7) == 0)
return cmd->func(intf, argc+1, argv-1);
lprintf(LOG_ERR, "Invalid command: %s", name);
ipmi_cmd_print(intf->cmdlist);
return -1;
}
return cmd->func(intf, argc, argv);
}
static void
ipmi_option_usage(const char * progname, struct ipmi_cmd * cmdlist, struct ipmi_intf_support * intflist)
{
lprintf(LOG_NOTICE, "%s version %s\n", progname, VERSION);
lprintf(LOG_NOTICE, "usage: %s [options...] <command>\n", progname);
lprintf(LOG_NOTICE, " -h This help");
lprintf(LOG_NOTICE, " -V Show version information");
lprintf(LOG_NOTICE, " -v Verbose (can use multiple times)");
lprintf(LOG_NOTICE, " -c Display output in comma separated format");
lprintf(LOG_NOTICE, " -d N Specify a /dev/ipmiN device to use (default=0)");
lprintf(LOG_NOTICE, " -I intf Interface to use");
lprintf(LOG_NOTICE, " -H hostname Remote host name for LAN interface");
lprintf(LOG_NOTICE, " -p port Remote RMCP port [default=623]");
lprintf(LOG_NOTICE, " -U username Remote session username");
lprintf(LOG_NOTICE, " -f file Read remote session password from file");
lprintf(LOG_NOTICE, " -S sdr Use local file for remote SDR cache");
#ifdef ENABLE_ALL_OPTIONS
lprintf(LOG_NOTICE, " -a Prompt for remote password");
lprintf(LOG_NOTICE, " -e char Set SOL escape character");
lprintf(LOG_NOTICE, " -C ciphersuite Cipher suite to be used by lanplus interface");
lprintf(LOG_NOTICE, " -k key Use Kg key for IPMIv2 authentication");
lprintf(LOG_NOTICE, " -L level Remote session privilege level [default=ADMINISTRATOR]");
lprintf(LOG_NOTICE, " Append a '+' to use name/privilege lookup in RAKP1");
lprintf(LOG_NOTICE, " -A authtype Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM");
lprintf(LOG_NOTICE, " -P password Remote session password");
lprintf(LOG_NOTICE, " -E Read password from IPMI_PASSWORD environment variable");
lprintf(LOG_NOTICE, " -m address Set local IPMB address");
lprintf(LOG_NOTICE, " -b channel Set destination channel for bridged request");
lprintf(LOG_NOTICE, " -l lun Set destination lun for raw commands");
lprintf(LOG_NOTICE, " -t address Bridge request to remote target address");
lprintf(LOG_NOTICE, " -o oemtype Setup for OEM (use 'list' to see available OEM types)");
lprintf(LOG_NOTICE, " -O seloem Use file for OEM SEL event descriptions");
#endif
lprintf(LOG_NOTICE, "");
ipmi_intf_print(intflist);
if (cmdlist != NULL)
ipmi_cmd_print(cmdlist);
}
/* ipmi_parse_options - helper function to handle parsing command line options
*
* @argc: count of options
* @argv: list of options
* @cmdlist: list of supported commands
* @intflist: list of supported interfaces
*
* returns 0 on success
* returns -1 on error
*/
int
ipmi_main(int argc, char ** argv,
struct ipmi_cmd * cmdlist,
struct ipmi_intf_support * intflist)
{
struct ipmi_intf * intf = NULL;
struct ipmi_intf_support * sup;
int privlvl = 0;
uint8_t target_addr = 0;
uint8_t target_channel = 0;
uint8_t target_lun = 0;
uint8_t my_addr = 0;
uint8_t lookupbit = 0x10; /* use name-only lookup by default */
int authtype = -1;
char * tmp = NULL;
char * hostname = NULL;
char * username = NULL;
char * password = NULL;
char * intfname = NULL;
char * progname = NULL;
char * oemtype = NULL;
char * sdrcache = NULL;
char * kgkey = NULL;
char * seloem = NULL;
int port = 0;
int devnum = 0;
int cipher_suite_id = 3; /* See table 22-19 of the IPMIv2 spec */
int argflag, i, found;
int rc = -1;
char sol_escape_char = SOL_ESCAPE_CHARACTER_DEFAULT;
/* save program name */
progname = strrchr(argv[0], '/');
progname = ((progname == NULL) ? argv[0] : progname+1);
while ((argflag = getopt(argc, (char **)argv, OPTION_STRING)) != -1)
{
switch (argflag) {
case 'I':
intfname = strdup(optarg);
if (intfname == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
if (intflist != NULL) {
found = 0;
for (sup=intflist; sup->name != NULL; sup++) {
if (strncmp(sup->name, intfname, strlen(intfname)) == 0 &&
strncmp(sup->name, intfname, strlen(sup->name)) == 0 &&
sup->supported == 1)
found = 1;
}
if (!found) {
lprintf(LOG_ERR, "Interface %s not supported", intfname);
goto out_free;
}
}
break;
case 'h':
ipmi_option_usage(progname, cmdlist, intflist);
rc = 0;
goto out_free;
break;
case 'V':
printf("%s version %s\n", progname, VERSION);
rc = 0;
goto out_free;
break;
case 'd':
devnum = atoi(optarg);
break;
case 'p':
port = atoi(optarg);
break;
case 'C':
cipher_suite_id = atoi(optarg);
break;
case 'v':
verbose++;
break;
case 'c':
csv_output = 1;
break;
case 'H':
hostname = strdup(optarg);
if (hostname == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
break;
case 'f':
if (password)
free(password);
password = ipmi_password_file_read(optarg);
if (password == NULL)
lprintf(LOG_ERR, "Unable to read password "
"from file %s", optarg);
break;
case 'a':
#ifdef HAVE_GETPASSPHRASE
tmp = getpassphrase("Password: ");
#else
tmp = getpass("Password: ");
#endif
if (tmp != NULL) {
if (password)
free(password);
password = strdup(tmp);
if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
}
break;
case 'k':
kgkey = strdup(optarg);
if (kgkey == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
break;
case 'U':
username = strdup(optarg);
if (username == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
break;
case 'S':
sdrcache = strdup(optarg);
if (sdrcache == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
break;
#ifdef ENABLE_ALL_OPTIONS
case 'o':
oemtype = strdup(optarg);
if (oemtype == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
if (strncmp(oemtype, "list", 4) == 0 ||
strncmp(oemtype, "help", 4) == 0) {
ipmi_oem_print();
goto out_free;
}
break;
case 'g':
/* backwards compatible oem hack */
oemtype = strdup("intelwv2");
break;
case 's':
/* backwards compatible oem hack */
oemtype = strdup("supermicro");
break;
case 'P':
if (password)
free(password);
password = strdup(optarg);
if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
/* Prevent password snooping with ps */
i = strlen(optarg);
memset(optarg, 'X', i);
break;
case 'E':
if ((tmp = getenv("IPMITOOL_PASSWORD")))
{
if (password)
free(password);
password = strdup(tmp);
if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
}
else if ((tmp = getenv("IPMI_PASSWORD")))
{
if (password)
free(password);
password = strdup(tmp);
if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
}
else {
lprintf(LOG_WARN, "Unable to read password from environment");
}
break;
case 'L':
i = strlen(optarg);
if ((i > 0) && (optarg[i-1] == '+')) {
lookupbit = 0;
optarg[i-1] = 0;
}
privlvl = str2val(optarg, ipmi_privlvl_vals);
if (privlvl == 0xFF) {
lprintf(LOG_WARN, "Invalid privilege level %s", optarg);
}
break;
case 'A':
authtype = str2val(optarg, ipmi_authtype_session_vals);
break;
case 't':
target_addr = (uint8_t)strtol(optarg, NULL, 0);
break;
case 'b':
target_channel = (uint8_t)strtol(optarg, NULL, 0);
break;
case 'l':
target_lun = (uint8_t)strtol(optarg, NULL, 0);
break;
case 'm':
my_addr = (uint8_t)strtol(optarg, NULL, 0);
break;
case 'e':
sol_escape_char = optarg[0];
break;
case 'O':
seloem = strdup(optarg);
if (seloem == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
break;
#endif
default:
ipmi_option_usage(progname, cmdlist, intflist);
goto out_free;
}
}
/* check for command before doing anything */
if (argc-optind > 0 &&
strncmp(argv[optind], "help", 4) == 0) {
ipmi_cmd_print(cmdlist);
rc = 0;
goto out_free;
}
/*
* If the user has specified a hostname (-H option)
* then this is a remote access session.
*
* If no password was specified by any other method
* and the authtype was not explicitly set to NONE
* then prompt the user.
*/
if (hostname != NULL && password == NULL &&
(authtype != IPMI_SESSION_AUTHTYPE_NONE || authtype < 0)) {
#ifdef HAVE_GETPASSPHRASE
tmp = getpassphrase("Password: ");
#else
tmp = getpass("Password: ");
#endif
if (tmp != NULL) {
password = strdup(tmp);
if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
}
}
/* if no interface was specified but a
* hostname was then use LAN by default
* otherwise the default is hardcoded
* to use the first entry in the list
*/
if (intfname == NULL && hostname != NULL) {
intfname = strdup("lan");
if (intfname == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
}
/* load interface */
intf = ipmi_intf_load(intfname);
if (intf == NULL) {
lprintf(LOG_ERR, "Error loading interface %s", intfname);
goto out_free;
}
/* setup log */
log_init(progname, 0, verbose);
/* run OEM setup if found */
if (oemtype != NULL &&
ipmi_oem_setup(intf, oemtype) < 0) {
lprintf(LOG_ERR, "OEM setup for \"%s\" failed", oemtype);
goto out_free;
}
/* set session variables */
if (hostname != NULL)
ipmi_intf_session_set_hostname(intf, hostname);
if (username != NULL)
ipmi_intf_session_set_username(intf, username);
if (password != NULL)
ipmi_intf_session_set_password(intf, password);
if (kgkey != NULL)
ipmi_intf_session_set_kgkey(intf, kgkey);
if (port > 0)
ipmi_intf_session_set_port(intf, port);
if (authtype >= 0)
ipmi_intf_session_set_authtype(intf, (uint8_t)authtype);
if (privlvl > 0)
ipmi_intf_session_set_privlvl(intf, (uint8_t)privlvl);
else
ipmi_intf_session_set_privlvl(intf,
IPMI_SESSION_PRIV_ADMIN); /* default */
ipmi_intf_session_set_lookupbit(intf, lookupbit);
ipmi_intf_session_set_sol_escape_char(intf, sol_escape_char);
ipmi_intf_session_set_cipher_suite_id(intf, cipher_suite_id);
/* setup destination lun if given */
intf->target_lun = target_lun ;
/* setup destination channel if given */
intf->target_channel = target_channel ;
intf->devnum = devnum;
/* setup IPMB local and target address if given */
intf->my_addr = my_addr ? : IPMI_BMC_SLAVE_ADDR;
if (target_addr > 0) {
/* need to open the interface first */
if (intf->open != NULL)
intf->open(intf);
intf->target_addr = target_addr;
/* must be admin level to do this over lan */
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
}
/* parse local SDR cache if given */
if (sdrcache != NULL) {
ipmi_sdr_list_cache_fromfile(intf, sdrcache);
}
/* Parse SEL OEM file if given */
if (seloem != NULL) {
ipmi_sel_oem_init(seloem);
}
intf->cmdlist = cmdlist;
/* now we finally run the command */
if (argc-optind > 0)
rc = ipmi_cmd_run(intf, argv[optind], argc-optind-1, &(argv[optind+1]));
else
rc = ipmi_cmd_run(intf, NULL, 0, NULL);
/* clean repository caches */
ipmi_cleanup(intf);
/* call interface close function if available */
if (intf->opened > 0 && intf->close != NULL)
intf->close(intf);
out_free:
log_halt();
if (intfname != NULL)
free(intfname);
if (hostname != NULL)
free(hostname);
if (username != NULL)
free(username);
if (password != NULL)
free(password);
if (oemtype != NULL)
free(oemtype);
if (seloem != NULL)
free(seloem);
return rc;
}

576
ipmitool/lib/ipmi_mc.c Normal file
View File

@ -0,0 +1,576 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/bswap.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_mc.h>
#include <ipmitool/ipmi_strings.h>
extern int verbose;
/* ipmi_mc_reset - attempt to reset an MC
*
* @intf: ipmi interface
* @cmd: reset command to send
* BMC_WARM_RESET or
* BMC_COLD_RESET
*
* returns 0 on success
* returns -1 on error
*/
static int
ipmi_mc_reset(struct ipmi_intf * intf, int cmd)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
intf->open(intf);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = cmd;
req.msg.data_len = 0;
if (cmd == BMC_COLD_RESET)
intf->noanswer = 1;
rsp = intf->sendrecv(intf, &req);
if (cmd == BMC_COLD_RESET)
intf->abort = 1;
printf("Sent %s reset command to MC\n",
(cmd == BMC_WARM_RESET) ? "warm" : "cold");
return 0;
}
struct bmc_enables_data {
#if WORDS_BIGENDIAN
uint8_t oem2 : 1;
uint8_t oem1 : 1;
uint8_t oem0 : 1;
uint8_t __reserved : 1;
uint8_t system_event_log : 1;
uint8_t event_msgbuf : 1;
uint8_t event_msgbuf_intr : 1;
uint8_t receive_msg_intr : 1;
#else
uint8_t receive_msg_intr : 1;
uint8_t event_msgbuf_intr : 1;
uint8_t event_msgbuf : 1;
uint8_t system_event_log : 1;
uint8_t __reserved : 1;
uint8_t oem0 : 1;
uint8_t oem1 : 1;
uint8_t oem2 : 1;
#endif
} __attribute__ ((packed));
struct bitfield_data {
const char * name;
const char * desc;
uint32_t mask;
};
struct bitfield_data mc_enables_bf[] = {
{
name: "recv_msg_intr",
desc: "Receive Message Queue Interrupt",
mask: 1<<0,
},
{
name: "event_msg_intr",
desc: "Event Message Buffer Full Interrupt",
mask: 1<<1,
},
{
name: "event_msg",
desc: "Event Message Buffer",
mask: 1<<2,
},
{
name: "system_event_log",
desc: "System Event Logging",
mask: 1<<3,
},
{
name: "oem0",
desc: "OEM 0",
mask: 1<<5,
},
{
name: "oem1",
desc: "OEM 1",
mask: 1<<6,
},
{
name: "oem2",
desc: "OEM 2",
mask: 1<<7,
},
{ NULL },
};
static void
printf_mc_usage(void)
{
struct bitfield_data * bf;
printf("MC Commands:\n");
printf(" reset <warm|cold>\n");
printf(" info\n");
printf(" selftest\n");
printf(" getenables\n");
printf(" setenables <option=on|off> ...\n");
for (bf = mc_enables_bf; bf->name != NULL; bf++) {
printf(" %-20s %s\n", bf->name, bf->desc);
}
}
/* ipmi_mc_get_enables - print out MC enables
*
* @intf: ipmi inteface
*
* returns 0 on success
* returns -1 on error
*/
static int
ipmi_mc_get_enables(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct bitfield_data * bf;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_GLOBAL_ENABLES;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get Global Enables command failed");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Global Enables command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
for (bf = mc_enables_bf; bf->name != NULL; bf++) {
printf("%-40s : %sabled\n", bf->desc,
rsp->data[0] & bf->mask ? "en" : "dis");
}
return 0;
}
/* ipmi_mc_set_enables - set MC enable flags
*
* @intf: ipmi inteface
* @argc: argument count
* @argv: argument list
*
* returns 0 on success
* returns -1 on error
*/
static int
ipmi_mc_set_enables(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct bitfield_data * bf;
uint8_t en;
int i;
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
printf_mc_usage();
return 0;
}
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_GLOBAL_ENABLES;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get Global Enables command failed");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Global Enables command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
en = rsp->data[0];
for (i = 0; i < argc; i++) {
for (bf = mc_enables_bf; bf->name != NULL; bf++) {
int nl = strlen(bf->name);
if (strncmp(argv[i], bf->name, nl) != 0)
continue;
if (strncmp(argv[i]+nl+1, "off", 3) == 0) {
printf("Disabling %s\n", bf->desc);
en &= ~bf->mask;
}
else if (strncmp(argv[i]+nl+1, "on", 2) == 0) {
printf("Enabling %s\n", bf->desc);
en |= bf->mask;
}
else {
lprintf(LOG_ERR, "Unrecognized option: %s", argv[i]);
}
}
}
if (en == rsp->data[0]) {
printf("\nNothing to change...\n");
ipmi_mc_get_enables(intf);
return 0;
}
req.msg.cmd = BMC_SET_GLOBAL_ENABLES;
req.msg.data = &en;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Set Global Enables command failed");
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set Global Enables command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("\nVerifying...\n");
ipmi_mc_get_enables(intf);
return 0;
}
/* IPM Device, Get Device ID Command - Additional Device Support */
const char *ipm_dev_adtl_dev_support[8] = {
"Sensor Device", /* bit 0 */
"SDR Repository Device", /* bit 1 */
"SEL Device", /* bit 2 */
"FRU Inventory Device", /* ... */
"IPMB Event Receiver",
"IPMB Event Generator",
"Bridge",
"Chassis Device" /* bit 7 */
};
/* ipmi_mc_get_deviceid - print information about this MC
*
* @intf: ipmi interface
*
* returns 0 on success
* returns -1 on error
*/
static int
ipmi_mc_get_deviceid(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct ipm_devid_rsp *devid;
int i;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_DEVICE_ID;
req.msg.data_len = 0;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get Device ID command failed");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Device ID command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
devid = (struct ipm_devid_rsp *) rsp->data;
printf("Device ID : %i\n",
devid->device_id);
printf("Device Revision : %i\n",
devid->device_revision & IPM_DEV_DEVICE_ID_REV_MASK);
printf("Firmware Revision : %u.%x\n",
devid->fw_rev1 & IPM_DEV_FWREV1_MAJOR_MASK,
devid->fw_rev2);
printf("IPMI Version : %x.%x\n",
IPM_DEV_IPMI_VERSION_MAJOR(devid->ipmi_version),
IPM_DEV_IPMI_VERSION_MINOR(devid->ipmi_version));
printf("Manufacturer ID : %lu\n",
(long)IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id));
printf("Manufacturer Name : %s\n",
val2str( (long)IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id),
ipmi_oem_info) );
printf("Product ID : %u (0x%02x%02x)\n",
buf2short((uint8_t *)(devid->product_id)),
devid->product_id[1], devid->product_id[0]);
printf("Device Available : %s\n",
(devid->fw_rev1 & IPM_DEV_FWREV1_AVAIL_MASK) ?
"no" : "yes");
printf("Provides Device SDRs : %s\n",
(devid->device_revision & IPM_DEV_DEVICE_ID_SDR_MASK) ?
"yes" : "no");
printf("Additional Device Support :\n");
for (i = 0; i < IPM_DEV_ADTL_SUPPORT_BITS; i++) {
if (devid->adtl_device_support & (1 << i)) {
printf(" %s\n", ipm_dev_adtl_dev_support[i]);
}
}
printf("Aux Firmware Rev Info : \n");
/* These values could be looked-up by vendor if documented,
* so we put them on individual lines for better treatment later
*/
printf(" 0x%02x\n 0x%02x\n 0x%02x\n 0x%02x\n",
devid->aux_fw_rev[0], devid->aux_fw_rev[1],
devid->aux_fw_rev[2], devid->aux_fw_rev[3]);
return 0;
}
struct ipmi_guid {
uint32_t time_low; /* timestamp low field */
uint16_t time_mid; /* timestamp middle field */
uint16_t time_hi_and_version; /* timestamp high field and version number */
uint8_t clock_seq_hi_variant;/* clock sequence high field and variant */
uint8_t clock_seq_low; /* clock sequence low field */
uint8_t node[6]; /* node */
} __attribute__((packed));
/* ipmi_mc_get_guid - print this MC GUID
*
* @intf: ipmi interface
*
* returns 0 on success
* returns -1 on error
*/
static int
ipmi_mc_get_guid(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct ipmi_guid guid;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_GUID;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get GUID command failed");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get GUID command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
if (rsp->data_len == sizeof(struct ipmi_guid)) {
char tbuf[40];
time_t s;
memset(tbuf, 0, 40);
memset(&guid, 0, sizeof(struct ipmi_guid));
memcpy(&guid, rsp->data, rsp->data_len);
printf("System GUID : %08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x\n",
guid.time_low, guid.time_mid, guid.time_hi_and_version,
guid.clock_seq_hi_variant << 8 | guid.clock_seq_low,
guid.node[5], guid.node[4], guid.node[3],
guid.node[2], guid.node[1], guid.node[0]);
s = (time_t)BSWAP_32(guid.time_low);
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&s));
printf("Timestamp : %s\n", tbuf);
}
else {
lprintf(LOG_ERR, "Invalid GUID length %d", rsp->data_len);
}
return 0;
}
/* ipmi_mc_get_selftest - returns and print selftest results
*
* @intf: ipmi interface
*/
static int ipmi_mc_get_selftest(struct ipmi_intf * intf)
{
int rv = 0;
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct ipm_selftest_rsp *sft_res;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = BMC_GET_SELF_TEST;
req.msg.data_len = 0;
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
lprintf(LOG_ERR, "No response from devices\n");
return -1;
}
if (rsp->ccode) {
lprintf(LOG_ERR, "Bad response: (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
sft_res = (struct ipm_selftest_rsp *) rsp->data;
if (sft_res->code == IPM_SFT_CODE_OK) {
printf("Selftest: passed\n");
rv = 0;
}
else if (sft_res->code == IPM_SFT_CODE_NOT_IMPLEMENTED) {
printf("Selftest: not implemented\n");
rv = -1;
}
else if (sft_res->code == IPM_SFT_CODE_DEV_CORRUPTED) {
printf("Selftest: device corrupted\n");
rv = -1;
if (sft_res->test & IPM_SELFTEST_SEL_ERROR) {
printf(" -> SEL device not accessible\n");
}
if (sft_res->test & IPM_SELFTEST_SDR_ERROR) {
printf(" -> SDR repository not accesible\n");
}
if (sft_res->test & IPM_SELFTEST_FRU_ERROR) {
printf("FRU device not accessible\n");
}
if (sft_res->test & IPM_SELFTEST_IPMB_ERROR) {
printf("IPMB signal lines do not respond\n");
}
if (sft_res->test & IPM_SELFTEST_SDRR_EMPTY) {
printf("SDR repository empty\n");
}
if (sft_res->test & IPM_SELFTEST_INTERNAL_USE) {
printf("Internal Use Area corrupted\n");
}
if (sft_res->test & IPM_SELFTEST_FW_BOOTBLOCK) {
printf("Controller update boot block corrupted\n");
}
if (sft_res->test & IPM_SELFTEST_FW_CORRUPTED) {
printf("controller operational firmware corrupted\n");
}
}
else if (sft_res->code == IPM_SFT_CODE_FATAL_ERROR) {
printf("Selftest : fatal error\n");
printf("Failure code : %02x\n", sft_res->test);
rv = -1;
}
else if (sft_res->code == IPM_SFT_CODE_RESERVED) {
printf("Selftest: N/A");
rv = -1;
}
else {
printf("Selttest : device specific\n");
printf("Failure code : %02x\n", sft_res->test);
rv = 0;
}
return rv;
}
/* ipmi_mc_main - top-level handler for MC functions
*
* @intf: ipmi interface
* @argc: number of arguments
* @argv: argument list
*
* returns 0 on success
* returns -1 on error
*/
int
ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
printf_mc_usage();
}
else if (strncmp(argv[0], "reset", 5) == 0) {
if (argc < 2 || strncmp(argv[1], "help", 4) == 0) {
lprintf(LOG_ERR, "reset commands: warm, cold");
}
else if (strncmp(argv[1], "cold", 4) == 0) {
rc = ipmi_mc_reset(intf, BMC_COLD_RESET);
}
else if (strncmp(argv[1], "warm", 4) == 0) {
rc = ipmi_mc_reset(intf, BMC_WARM_RESET);
}
else {
lprintf(LOG_ERR, "reset commands: warm, cold");
}
}
else if (strncmp(argv[0], "info", 4) == 0) {
rc = ipmi_mc_get_deviceid(intf);
}
else if (strncmp(argv[0], "guid", 4) == 0) {
rc = ipmi_mc_get_guid(intf);
}
else if (strncmp(argv[0], "getenables", 10) == 0) {
rc = ipmi_mc_get_enables(intf);
}
else if (strncmp(argv[0], "setenables", 10) == 0) {
rc = ipmi_mc_set_enables(intf, argc-1, &(argv[1]));
}
else if (!strncmp(argv[0], "selftest", 8)) {
rc = ipmi_mc_get_selftest(intf);
}
else {
lprintf(LOG_ERR, "Invalid mc/bmc command: %s", argv[0]);
rc = -1;
}
return rc;
}

160
ipmitool/lib/ipmi_oem.c Normal file
View File

@ -0,0 +1,160 @@
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <string.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_constants.h>
#include <ipmitool/log.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi_sel.h>
static int ipmi_oem_supermicro(struct ipmi_intf * intf);
static int ipmi_oem_ibm(struct ipmi_intf * intf);
static struct ipmi_oem_handle ipmi_oem_list[] = {
{
name: "supermicro",
desc: "Supermicro IPMIv1.5 BMC with OEM LAN authentication support",
setup: ipmi_oem_supermicro,
},
{
name: "intelwv2",
desc: "Intel SE7501WV2 IPMIv1.5 BMC with extra LAN communication support",
},
{
name: "intelplus",
desc: "Intel IPMI 2.0 BMC with RMCP+ communication support",
},
{
name: "icts",
desc: "IPMI 2.0 ICTS compliance support",
},
{
name: "ibm",
desc: "IBM OEM support",
setup: ipmi_oem_ibm,
},
{ 0 }
};
/* Supermicro IPMIv2 BMCs use OEM authtype */
static int
ipmi_oem_supermicro(struct ipmi_intf * intf)
{
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
return 0;
}
static int
ipmi_oem_ibm(struct ipmi_intf * intf)
{
char * filename;
if ((filename = getenv("IPMI_OEM_IBM_DATAFILE")) == NULL) {
lprintf(LOG_ERR, "Unable to read IPMI_OEM_IBM_DATAFILE from environment");
return -1;
}
return ipmi_sel_oem_init((const char *)filename);
}
/* ipmi_oem_print - print list of OEM handles
*/
void
ipmi_oem_print(void)
{
struct ipmi_oem_handle * oem;
lprintf(LOG_NOTICE, "\nOEM Support:");
for (oem=ipmi_oem_list; oem->name != NULL && oem->desc != NULL; oem++) {
lprintf(LOG_NOTICE, "\t%-12s %s", oem->name, oem->desc);
}
lprintf(LOG_NOTICE, "");
}
/* ipmi_oem_setup - do initial setup of OEM handle
*
* @intf: ipmi interface
* @oemtype: OEM handle name
*
* returns 0 on success
* returns -1 on error
*/
int
ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
{
struct ipmi_oem_handle * oem;
int rc = 0;
if (strncmp(oemtype, "help", 4) == 0 ||
strncmp(oemtype, "list", 4) == 0 ||
oemtype == NULL) {
ipmi_oem_print();
return -1;
}
for (oem=ipmi_oem_list; oem->name != NULL; oem++) {
if (strncmp(oemtype, oem->name, strlen(oem->name)) == 0)
break;
}
if (oem->name == NULL)
return -1;
/* save pointer for later use */
intf->oem = oem;
/* run optional setup function if it is defined */
if (oem->setup != NULL) {
lprintf(LOG_DEBUG, "Running OEM setup for \"%s\"", oem->desc);
rc = oem->setup(intf);
}
return rc;
}
/* ipmi_oem_active - used to determine if a particular OEM type is set
*
* @intf: ipmi interface
* @oemtype: string containing name of ipmi handle to check
*
* returns 1 if requested ipmi handle is active
* returns 0 otherwise
*/
int
ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype)
{
if (intf->oem == NULL)
return 0;
if (strncmp(intf->oem->name, oemtype, strlen(oemtype)) == 0)
return 1;
return 0;
}

872
ipmitool/lib/ipmi_pef.c Normal file
View File

@ -0,0 +1,872 @@
/*
* Copyright (c) 2004 Dell Computers. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Dell Computers, or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* DELL COMPUTERS ("DELL") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* DELL OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <string.h>
#include <math.h>
#include <time.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_pef.h>
extern int verbose;
/*
// common kywd/value printf() templates
*/
static const char * pef_fld_fmts[][2] = {
{"%-*s : %u\n", " | %u"}, /* F_DEC: unsigned value */
{"%-*s : %d\n", " | %d"}, /* F_INT: signed value */
{"%-*s : %s\n", " | %s"}, /* F_STR: string value */
{"%-*s : 0x%x\n", " | 0x%x"}, /* F_HEX: "N hex digits" */
{"%-*s : 0x%04x\n", " | 0x%04x"}, /* F_2XD: "2 hex digits" */
{"%-*s : 0x%02x\n", " | 0x%02x"}, /* F_1XD: "1 hex digit" */
{"%-*s : %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
" | %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"},
};
typedef enum {
F_DEC,
F_INT,
F_STR,
F_HEX,
F_2XD,
F_1XD,
F_UID,
} fmt_e;
#define KYWD_LENGTH 24
static int first_field = 1;
static const char * pef_flag_fmts[][3] = {
{"", "false", "true"},
{"supported", "un", ""},
{"active", "in", ""},
{"abled", "dis", "en"},
};
static const char * listitem[] = {" | %s", ",%s", "%s"};
const char *
ipmi_pef_bit_desc(struct bit_desc_map * map, uint32_t value)
{ /*
// return description/text label(s) for the given value.
// NB: uses a static buffer
*/
static char buf[128];
char * p;
struct desc_map * pmap;
uint32_t match, index;
*(p = buf) = '\0';
index = 2;
for (pmap=map->desc_maps; pmap && pmap->desc; pmap++) {
if (map->desc_map_type == BIT_DESC_MAP_LIST)
match = (value == pmap->mask);
else
match = ((value & pmap->mask) == pmap->mask);
if (match) {
sprintf(p, listitem[index], pmap->desc);
p = strchr(p, '\0');
if (map->desc_map_type != BIT_DESC_MAP_ALL)
break;
index = 1;
}
}
if (p == buf)
return("None");
return((const char *)buf);
}
void
ipmi_pef_print_flags(struct bit_desc_map * map, flg_e type, uint32_t val)
{ /*
// print features/flags, using val (a bitmask), according to map.
// observe the verbose flag, and print any labels, etc. based on type
*/
struct desc_map * pmap;
uint32_t maskval, index;
index = 0;
for (pmap=map->desc_maps; pmap && pmap->desc; pmap++) {
maskval = (val & pmap->mask);
if (verbose)
printf("%-*s : %s%s\n", KYWD_LENGTH,
ipmi_pef_bit_desc(map, pmap->mask),
pef_flag_fmts[type][1 + (maskval != 0)],
pef_flag_fmts[type][0]);
else if (maskval != 0) {
printf(listitem[index], ipmi_pef_bit_desc(map, maskval));
index = 1;
}
}
}
static void
ipmi_pef_print_field(const char * fmt[2], const char * label, unsigned long val)
{ /*
// print a 'field' (observes 'verbose' flag)
*/
if (verbose)
printf(fmt[0], KYWD_LENGTH, label, val);
else if (first_field)
printf(&fmt[1][2], val); /* skip field separator */
else
printf(fmt[1], val);
first_field = 0;
}
void
ipmi_pef_print_dec(const char * text, uint32_t val)
{ /* unsigned */
ipmi_pef_print_field(pef_fld_fmts[F_DEC], text, val);
}
void
ipmi_pef_print_int(const char * text, uint32_t val)
{ /* signed */
ipmi_pef_print_field(pef_fld_fmts[F_INT], text, val);
}
void
ipmi_pef_print_hex(const char * text, uint32_t val)
{ /* hex */
ipmi_pef_print_field(pef_fld_fmts[F_HEX], text, val);
}
void
ipmi_pef_print_str(const char * text, const char * val)
{ /* string */
ipmi_pef_print_field(pef_fld_fmts[F_STR], text, (unsigned long)val);
}
void
ipmi_pef_print_2xd(const char * text, uint8_t u1, uint8_t u2)
{ /* 2 hex digits */
uint32_t val = ((u1 << 8) + u2) & 0xffff;
ipmi_pef_print_field(pef_fld_fmts[F_2XD], text, val);
}
void
ipmi_pef_print_1xd(const char * text, uint32_t val)
{ /* 1 hex digit */
ipmi_pef_print_field(pef_fld_fmts[F_1XD], text, val);
}
static struct ipmi_rs *
ipmi_pef_msg_exchange(struct ipmi_intf * intf, struct ipmi_rq * req, char * txt)
{ /*
// common IPMItool rqst/resp handling
*/
struct ipmi_rs * rsp = intf->sendrecv(intf, req);
if (!rsp)
return(NULL);
if (rsp->ccode) {
lprintf(LOG_ERR, " **Error %x in '%s' command",
rsp ? rsp->ccode : 0, txt);
return(NULL);
}
if (verbose > 2)
printbuf(rsp->data, rsp->data_len, txt);
return(rsp);
}
static uint8_t
ipmi_pef_get_policy_table(struct ipmi_intf * intf,
struct pef_cfgparm_policy_table_entry ** table)
{ /*
// get the PEF policy table: allocate space, fillin, and return its size
// NB: the caller must free the returned area (when returned size > 0)
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_cfgparm_selector psel;
struct pef_cfgparm_policy_table_entry * ptbl, * ptmp;
uint32_t i;
uint8_t tbl_size;
memset(&psel, 0, sizeof(psel));
psel.id = PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_SIZE;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = IPMI_CMD_GET_PEF_CONFIG_PARMS;
req.msg.data = (uint8_t *)&psel;
req.msg.data_len = sizeof(psel);
rsp = ipmi_pef_msg_exchange(intf, &req, "Alert policy table size");
if (!rsp)
return(0);
tbl_size = (rsp->data[1] & PEF_POLICY_TABLE_SIZE_MASK);
i = (tbl_size * sizeof(struct pef_cfgparm_policy_table_entry));
if (!i
|| (ptbl = (struct pef_cfgparm_policy_table_entry *)malloc(i)) == NULL)
return(0);
memset(&psel, 0, sizeof(psel));
psel.id = PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_ENTRY;
for (ptmp=ptbl, i=1; i<=tbl_size; i++) {
psel.set = (i & PEF_POLICY_TABLE_ID_MASK);
rsp = ipmi_pef_msg_exchange(intf, &req, "Alert policy table entry");
if (!rsp
|| i != (rsp->data[1] & PEF_POLICY_TABLE_ID_MASK)) {
lprintf(LOG_ERR, " **Error retrieving %s",
"Alert policy table entry");
free(ptbl);
ptbl = NULL;
tbl_size = 0;
break;
}
memcpy(ptmp, &rsp->data[1], sizeof(*ptmp));
ptmp++;
}
*table = ptbl;
return(tbl_size);
}
static void
ipmi_pef_print_lan_dest(struct ipmi_intf * intf, uint8_t ch, uint8_t dest)
{ /*
// print LAN alert destination info
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_lan_cfgparm_selector lsel;
struct pef_lan_cfgparm_dest_type * ptype;
struct pef_lan_cfgparm_dest_info * pinfo;
char buf[32];
uint8_t tbl_size, dsttype, timeout, retries;
memset(&lsel, 0, sizeof(lsel));
lsel.id = PEF_LAN_CFGPARM_ID_DEST_COUNT;
lsel.ch = ch;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_CMD_LAN_GET_CONFIG;
req.msg.data = (uint8_t *)&lsel;
req.msg.data_len = sizeof(lsel);
rsp = ipmi_pef_msg_exchange(intf, &req, "Alert destination count");
if (!rsp) {
lprintf(LOG_ERR, " **Error retrieving %s",
"Alert destination count");
return;
}
tbl_size = (rsp->data[1] & PEF_LAN_DEST_TABLE_SIZE_MASK);
//if (tbl_size == 0 || dest == 0) /* LAN alerting not supported */
// return;
lsel.id = PEF_LAN_CFGPARM_ID_DESTTYPE;
lsel.set = dest;
rsp = ipmi_pef_msg_exchange(intf, &req, "Alert destination type");
if (!rsp || rsp->data[1] != lsel.set) {
lprintf(LOG_ERR, " **Error retrieving %s",
"Alert destination type");
return;
}
ptype = (struct pef_lan_cfgparm_dest_type *)&rsp->data[1];
dsttype = (ptype->dest_type & PEF_LAN_DEST_TYPE_MASK);
timeout = ptype->alert_timeout;
retries = (ptype->retries & PEF_LAN_RETRIES_MASK);
ipmi_pef_print_str("Alert destination type",
ipmi_pef_bit_desc(&pef_b2s_lan_desttype, dsttype));
if (dsttype == PEF_LAN_DEST_TYPE_PET) {
lsel.id = PEF_LAN_CFGPARM_ID_PET_COMMUNITY;
lsel.set = 0;
rsp = ipmi_pef_msg_exchange(intf, &req, "PET community");
if (!rsp)
lprintf(LOG_ERR, " **Error retrieving %s",
"PET community");
else {
rsp->data[19] = '\0';
ipmi_pef_print_str("PET Community", (const char *)&rsp->data[1]);
}
}
ipmi_pef_print_dec("ACK timeout/retry (secs)", timeout);
ipmi_pef_print_dec("Retries", retries);
lsel.id = PEF_LAN_CFGPARM_ID_DESTADDR;
lsel.set = dest;
rsp = ipmi_pef_msg_exchange(intf, &req, "Alert destination info");
if (!rsp || rsp->data[1] != lsel.set)
lprintf(LOG_ERR, " **Error retrieving %s",
"Alert destination info");
else {
pinfo = (struct pef_lan_cfgparm_dest_info *)&rsp->data[1];
sprintf(buf, "%u.%u.%u.%u",
pinfo->ip[0], pinfo->ip[1], pinfo->ip[2], pinfo->ip[3]);
ipmi_pef_print_str("IP address", buf);
sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
pinfo->mac[0], pinfo->mac[1], pinfo->mac[2],
pinfo->mac[3], pinfo->mac[4], pinfo->mac[5]);
ipmi_pef_print_str("MAC address", buf);
}
}
static void
ipmi_pef_print_serial_dest_dial(struct ipmi_intf * intf, char * label,
struct pef_serial_cfgparm_selector * ssel)
{ /*
// print a dial string
*/
#define BLOCK_SIZE 16
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_serial_cfgparm_selector tmp;
char * p, strval[(6 * BLOCK_SIZE) + 1];
memset(&tmp, 0, sizeof(tmp));
tmp.id = PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING_COUNT;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_CMD_SERIAL_GET_CONFIG;
req.msg.data = (uint8_t *)&tmp;
req.msg.data_len = sizeof(tmp);
rsp = ipmi_pef_msg_exchange(intf, &req, "Dial string count");
if (!rsp || (rsp->data[1] & PEF_SERIAL_DIAL_STRING_COUNT_MASK) == 0)
return; /* sssh, not supported */
memcpy(&tmp, ssel, sizeof(tmp));
tmp.id = PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING;
tmp.block = 1;
memset(strval, 0, sizeof(strval));
p = strval;
for (;;) {
rsp = ipmi_pef_msg_exchange(intf, &req, label);
if (!rsp
|| (rsp->data[1] != ssel->id)
|| (rsp->data[2] != tmp.block)) {
lprintf(LOG_ERR, " **Error retrieving %s", label);
return;
}
memcpy(p, &rsp->data[3], BLOCK_SIZE);
if (strchr(p, '\0') <= (p + BLOCK_SIZE))
break;
if ((p += BLOCK_SIZE) >= &strval[sizeof(strval)-1])
break;
tmp.block++;
}
ipmi_pef_print_str(label, strval);
#undef BLOCK_SIZE
}
static void
ipmi_pef_print_serial_dest_tap(struct ipmi_intf * intf,
struct pef_serial_cfgparm_selector * ssel)
{ /*
// print TAP destination info
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_serial_cfgparm_selector tmp;
struct pef_serial_cfgparm_tap_svc_settings * pset;
uint8_t dialstr_id, setting_id;
memset(&tmp, 0, sizeof(tmp));
tmp.id = PEF_SERIAL_CFGPARM_ID_TAP_ACCT_COUNT;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_CMD_SERIAL_GET_CONFIG;
req.msg.data = (uint8_t *)&tmp;
req.msg.data_len = sizeof(tmp);
rsp = ipmi_pef_msg_exchange(intf, &req, "Number of TAP accounts");
if (!rsp || (rsp->data[1] & PEF_SERIAL_TAP_ACCT_COUNT_MASK) == 0)
return; /* sssh, not supported */
memcpy(&tmp, ssel, sizeof(tmp));
tmp.id = PEF_SERIAL_CFGPARM_ID_TAP_ACCT_INFO;
rsp = ipmi_pef_msg_exchange(intf, &req, "TAP account info");
if (!rsp || (rsp->data[1] != tmp.set)) {
lprintf(LOG_ERR, " **Error retrieving %s",
"TAP account info");
return;
}
dialstr_id = (rsp->data[2] & PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_MASK);
dialstr_id >>= PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_SHIFT;
setting_id = (rsp->data[2] & PEF_SERIAL_TAP_ACCT_INFO_SVC_SETTINGS_ID_MASK);
tmp.set = dialstr_id;
ipmi_pef_print_serial_dest_dial(intf, "TAP Dial string", &tmp);
tmp.set = setting_id;
rsp = ipmi_pef_msg_exchange(intf, &req, "TAP service settings");
if (!rsp || (rsp->data[1] != tmp.set)) {
lprintf(LOG_ERR, " **Error retrieving %s",
"TAP service settings");
return;
}
pset = (struct pef_serial_cfgparm_tap_svc_settings *)&rsp->data[1];
ipmi_pef_print_str("TAP confirmation",
ipmi_pef_bit_desc(&pef_b2s_tap_svc_confirm, pset->confirmation_flags));
/* TODO : additional TAP settings? */
}
static void
ipmi_pef_print_serial_dest_ppp(struct ipmi_intf * intf,
struct pef_serial_cfgparm_selector * ssel)
{ /*
// print PPP destination info
*/
/* TODO */
}
static void
ipmi_pef_print_serial_dest_callback(struct ipmi_intf * intf,
struct pef_serial_cfgparm_selector * ssel)
{ /*
// print callback destination info
*/
/* TODO */
}
static void
ipmi_pef_print_serial_dest(struct ipmi_intf * intf, uint8_t ch, uint8_t dest)
{ /*
// print Serial/PPP alert destination info
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_serial_cfgparm_selector ssel;
uint8_t tbl_size, wrk;
struct pef_serial_cfgparm_dest_info * pinfo;
memset(&ssel, 0, sizeof(ssel));
ssel.id = PEF_SERIAL_CFGPARM_ID_DEST_COUNT;
ssel.ch = ch;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_CMD_SERIAL_GET_CONFIG;
req.msg.data = (uint8_t *)&ssel;
req.msg.data_len = sizeof(ssel);
rsp = ipmi_pef_msg_exchange(intf, &req, "Alert destination count");
if (!rsp) {
lprintf(LOG_ERR, " **Error retrieving %s",
"Alert destination count");
return;
}
tbl_size = (rsp->data[1] & PEF_SERIAL_DEST_TABLE_SIZE_MASK);
if (!dest || tbl_size == 0) /* Page alerting not supported */
return;
ssel.id = PEF_SERIAL_CFGPARM_ID_DESTINFO;
ssel.set = dest;
rsp = ipmi_pef_msg_exchange(intf, &req, "Alert destination info");
if (!rsp || rsp->data[1] != ssel.set)
lprintf(LOG_ERR, " **Error retrieving %s",
"Alert destination info");
else {
pinfo = (struct pef_serial_cfgparm_dest_info *)rsp->data;
wrk = (pinfo->dest_type & PEF_SERIAL_DEST_TYPE_MASK);
ipmi_pef_print_str("Alert destination type",
ipmi_pef_bit_desc(&pef_b2s_serial_desttype, wrk));
ipmi_pef_print_dec("ACK timeout (secs)",
pinfo->alert_timeout);
ipmi_pef_print_dec("Retries",
(pinfo->retries & PEF_SERIAL_RETRIES_MASK));
switch (wrk) {
case PEF_SERIAL_DEST_TYPE_DIAL:
ipmi_pef_print_serial_dest_dial(intf, "Serial dial string", &ssel);
break;
case PEF_SERIAL_DEST_TYPE_TAP:
ipmi_pef_print_serial_dest_tap(intf, &ssel);
break;
case PEF_SERIAL_DEST_TYPE_PPP:
ipmi_pef_print_serial_dest_ppp(intf, &ssel);
break;
case PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK:
case PEF_SERIAL_DEST_TYPE_PPP_CALLBACK:
ipmi_pef_print_serial_dest_callback(intf, &ssel);
break;
}
}
}
static void
ipmi_pef_print_dest(struct ipmi_intf * intf, uint8_t ch, uint8_t dest)
{ /*
// print generic alert destination info
*/
ipmi_pef_print_dec("Destination ID", dest);
}
void
ipmi_pef_print_event_info(struct pef_cfgparm_filter_table_entry * pef, char * buf)
{ /*
// print PEF entry Event info: class, severity, trigger, etc.
*/
static char * classes[] = {"Discrete", "Threshold", "OEM"};
uint16_t offmask;
char * p;
int i;
uint8_t t;
ipmi_pef_print_str("Event severity",
ipmi_pef_bit_desc(&pef_b2s_severities, pef->entry.severity));
t = pef->entry.event_trigger;
if (t == PEF_EVENT_TRIGGER_THRESHOLD)
i = 1;
else if (t > PEF_EVENT_TRIGGER_SENSOR_SPECIFIC)
i = 2;
else
i = 0;
ipmi_pef_print_str("Event class", classes[i]);
offmask = ((pef->entry.event_data_1_offset_mask[1] << 8)
+ pef->entry.event_data_1_offset_mask[0]);
if (offmask == 0xffff || t == PEF_EVENT_TRIGGER_MATCH_ANY)
strcpy(buf, "Any");
else if (t == PEF_EVENT_TRIGGER_UNSPECIFIED)
strcpy(buf, "Unspecified");
else if (t == PEF_EVENT_TRIGGER_SENSOR_SPECIFIC)
strcpy(buf, "Sensor-specific");
else if (t > PEF_EVENT_TRIGGER_SENSOR_SPECIFIC)
strcpy(buf, "OEM");
else {
sprintf(buf, "(0x%02x/0x%04x)", t, offmask);
p = strchr(buf, '\0');
for (i=0; i<PEF_B2S_GENERIC_ER_ENTRIES; i++) {
if (offmask & 1) {
sprintf(p, ",%s", ipmi_pef_bit_desc(pef_b2s_generic_ER[t-1], i));
p = strchr(p, '\0');
}
offmask >>= 1;
}
}
ipmi_pef_print_str("Event trigger(s)", buf);
}
static void
ipmi_pef_print_entry(struct ipmi_rs * rsp, uint8_t id,
struct pef_cfgparm_filter_table_entry * pef)
{ /*
// print a PEF table entry
*/
uint8_t wrk, set;
char buf[128];
ipmi_pef_print_dec("PEF table entry", id);
wrk = !!(pef->entry.config & PEF_CONFIG_ENABLED);
sprintf(buf, "%sactive", (wrk ? "" : "in"));
if (pef->entry.config & PEF_CONFIG_PRECONFIGURED)
strcat(buf, ", pre-configured");
ipmi_pef_print_str("Status", buf);
if (wrk != 0) {
ipmi_pef_print_1xd("Version", rsp->data[0]);
ipmi_pef_print_str("Sensor type",
ipmi_pef_bit_desc(&pef_b2s_sensortypes, pef->entry.sensor_type));
if (pef->entry.sensor_number == PEF_SENSOR_NUMBER_MATCH_ANY)
ipmi_pef_print_str("Sensor number", "Any");
else
ipmi_pef_print_dec("Sensor number", pef->entry.sensor_number);
ipmi_pef_print_event_info(pef, buf);
ipmi_pef_print_str("Action",
ipmi_pef_bit_desc(&pef_b2s_actions, pef->entry.action));
if (pef->entry.action & PEF_ACTION_ALERT) {
set = (pef->entry.policy_number & PEF_POLICY_NUMBER_MASK);
ipmi_pef_print_int("Policy set", set);
}
}
}
static void
ipmi_pef_list_entries(struct ipmi_intf * intf)
{ /*
// list all PEF table entries
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_cfgparm_selector psel;
struct pef_cfgparm_filter_table_entry * pcfg;
uint32_t i;
uint8_t max_filters;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = IPMI_CMD_GET_PEF_CAPABILITIES;
rsp = ipmi_pef_msg_exchange(intf, &req, "PEF capabilities");
if (!rsp
|| (max_filters = ((struct pef_capabilities *)rsp->data)->tblsize) == 0)
return; /* sssh, not supported */
memset(&psel, 0, sizeof(psel));
psel.id = PEF_CFGPARM_ID_PEF_FILTER_TABLE_ENTRY;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = IPMI_CMD_GET_PEF_CONFIG_PARMS;
req.msg.data = (uint8_t *)&psel;
req.msg.data_len = sizeof(psel);
for (i=1; i<=max_filters; i++) {
if (i > 1)
printf("\n");
psel.set = (i & PEF_FILTER_TABLE_ID_MASK);
rsp = ipmi_pef_msg_exchange(intf, &req, "PEF table entry");
if (!rsp
|| (psel.set != (rsp->data[1] & PEF_FILTER_TABLE_ID_MASK))) {
lprintf(LOG_ERR, " **Error retrieving %s",
"PEF table entry");
continue;
}
pcfg = (struct pef_cfgparm_filter_table_entry *)&rsp->data[1];
first_field = 1;
ipmi_pef_print_entry(rsp, psel.set, pcfg);
}
}
static void
ipmi_pef_list_policies(struct ipmi_intf * intf)
{ /*
// list PEF alert policies
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_cfgparm_policy_table_entry * ptbl, * ptmp;
uint32_t i;
uint8_t wrk, ch, medium, tbl_size;
tbl_size = ipmi_pef_get_policy_table(intf, &ptbl);
if (!tbl_size)
return;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = IPMI_CMD_GET_CHANNEL_INFO;
req.msg.data = &ch;
req.msg.data_len = sizeof(ch);
for (ptmp=ptbl, i=1; i<=tbl_size; i++, ptmp++) {
if ((ptmp->entry.policy & PEF_POLICY_ENABLED) == PEF_POLICY_ENABLED) {
if (i > 1)
printf("\n");
first_field = 1;
ipmi_pef_print_dec("Alert policy table entry",
(ptmp->data1 & PEF_POLICY_TABLE_ID_MASK));
ipmi_pef_print_dec("Policy set",
(ptmp->entry.policy & PEF_POLICY_ID_MASK) >> PEF_POLICY_ID_SHIFT);
ipmi_pef_print_str("Policy entry rule",
ipmi_pef_bit_desc(&pef_b2s_policies, (ptmp->entry.policy & PEF_POLICY_FLAGS_MASK)));
if (ptmp->entry.alert_string_key & PEF_POLICY_EVENT_SPECIFIC) {
ipmi_pef_print_str("Event-specific", "true");
// continue;
}
wrk = ptmp->entry.chan_dest;
/* channel/description */
ch = (wrk & PEF_POLICY_CHANNEL_MASK) >> PEF_POLICY_CHANNEL_SHIFT;
rsp = ipmi_pef_msg_exchange(intf, &req, "Channel info");
if (!rsp || rsp->data[0] != ch) {
lprintf(LOG_ERR, " **Error retrieving %s",
"Channel info");
continue;
}
medium = rsp->data[1];
ipmi_pef_print_dec("Channel number", ch);
ipmi_pef_print_str("Channel medium",
ipmi_pef_bit_desc(&pef_b2s_ch_medium, medium));
/* destination/description */
wrk &= PEF_POLICY_DESTINATION_MASK;
switch (medium) {
case PEF_CH_MEDIUM_TYPE_LAN:
ipmi_pef_print_lan_dest(intf, ch, wrk);
break;
case PEF_CH_MEDIUM_TYPE_SERIAL:
ipmi_pef_print_serial_dest(intf, ch, wrk);
break;
default:
ipmi_pef_print_dest(intf, ch, wrk);
break;
}
}
}
free(ptbl);
}
static void
ipmi_pef_get_status(struct ipmi_intf * intf)
{ /*
// report the PEF status
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_cfgparm_selector psel;
char tbuf[40];
uint32_t timei;
time_t ts;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = IPMI_CMD_GET_LAST_PROCESSED_EVT_ID;
rsp = ipmi_pef_msg_exchange(intf, &req, "Last S/W processed ID");
if (!rsp) {
lprintf(LOG_ERR, " **Error retrieving %s",
"Last S/W processed ID");
return;
}
memcpy(&timei, rsp->data, sizeof(timei));
#if WORDS_BIGENDIAN
timei = BSWAP_32(timei);
#endif
ts = (time_t)timei;
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&ts));
ipmi_pef_print_str("Last SEL addition", tbuf);
ipmi_pef_print_2xd("Last SEL record ID", rsp->data[5], rsp->data[4]);
ipmi_pef_print_2xd("Last S/W processed ID", rsp->data[7], rsp->data[6]);
ipmi_pef_print_2xd("Last BMC processed ID", rsp->data[9], rsp->data[8]);
memset(&psel, 0, sizeof(psel));
psel.id = PEF_CFGPARM_ID_PEF_CONTROL;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = IPMI_CMD_GET_PEF_CONFIG_PARMS;
req.msg.data = (uint8_t *)&psel;
req.msg.data_len = sizeof(psel);
rsp = ipmi_pef_msg_exchange(intf, &req, "PEF control");
if (!rsp) {
lprintf(LOG_ERR, " **Error retrieving %s",
"PEF control");
return;
}
ipmi_pef_print_flags(&pef_b2s_control, P_ABLE, rsp->data[1]);
psel.id = PEF_CFGPARM_ID_PEF_ACTION;
rsp = ipmi_pef_msg_exchange(intf, &req, "PEF action");
if (!rsp) {
lprintf(LOG_ERR, " **Error retrieving %s",
"PEF action");
return;
}
ipmi_pef_print_flags(&pef_b2s_actions, P_ACTV, rsp->data[1]);
}
static void
ipmi_pef_get_info(struct ipmi_intf * intf)
{ /*
// report PEF capabilities + System GUID
*/
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct pef_capabilities * pcap;
struct pef_cfgparm_selector psel;
struct pef_cfgparm_policy_table_entry * ptbl;
uint8_t * uid;
uint8_t actions, tbl_size;
if ((tbl_size = ipmi_pef_get_policy_table(intf, &ptbl)) > 0)
free(ptbl);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = IPMI_CMD_GET_PEF_CAPABILITIES;
rsp = ipmi_pef_msg_exchange(intf, &req, "PEF capabilities");
if (!rsp)
return;
pcap = (struct pef_capabilities *)rsp->data;
ipmi_pef_print_1xd("Version", pcap->version);
ipmi_pef_print_dec("PEF table size", pcap->tblsize);
ipmi_pef_print_dec("Alert policy table size", tbl_size);
actions = pcap->actions;
memset(&psel, 0, sizeof(psel));
psel.id = PEF_CFGPARM_ID_SYSTEM_GUID;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = IPMI_CMD_GET_PEF_CONFIG_PARMS;
req.msg.data = (uint8_t *)&psel;
req.msg.data_len = sizeof(psel);
rsp = ipmi_pef_msg_exchange(intf, &req, "System GUID");
uid = NULL;
if (rsp && (rsp->data[1] & PEF_SYSTEM_GUID_USED_IN_PET))
uid = &rsp->data[2];
else {
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = IPMI_CMD_GET_SYSTEM_GUID;
rsp = ipmi_pef_msg_exchange(intf, &req, "System GUID");
if (rsp)
uid = &rsp->data[0];
}
if (uid) { /* got GUID? */
if (verbose)
printf(pef_fld_fmts[F_UID][0], KYWD_LENGTH, "System GUID",
uid[0], uid[1], uid[2], uid[3], uid[4], uid[5], uid[6], uid[7],
uid[8], uid[9], uid[10],uid[11],uid[12],uid[13],uid[14],uid[15]);
else
printf(pef_fld_fmts[F_UID][1],
uid[0], uid[1], uid[2], uid[3], uid[4], uid[5], uid[6], uid[7],
uid[8], uid[9], uid[10],uid[11],uid[12],uid[13],uid[14],uid[15]);
}
ipmi_pef_print_flags(&pef_b2s_actions, P_SUPP, actions);
}
int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv)
{ /*
// PEF subcommand handling
*/
int help = 0;
int rc = 0;
if (!argc || !strncmp(argv[0], "info", 4))
ipmi_pef_get_info(intf);
else if (!strncmp(argv[0], "help", 4))
help = 1;
else if (!strncmp(argv[0], "status", 6))
ipmi_pef_get_status(intf);
else if (!strncmp(argv[0], "policy", 6))
ipmi_pef_list_policies(intf);
else if (!strncmp(argv[0], "list", 4))
ipmi_pef_list_entries(intf);
else {
help = 1;
rc = -1;
lprintf(LOG_ERR, "Invalid PEF command: '%s'\n", argv[0]);
}
if (help)
lprintf(LOG_NOTICE, "PEF commands: info status policy list");
else if (!verbose)
printf("\n");
return rc;
}

1075
ipmitool/lib/ipmi_picmg.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <string.h>
@ -39,60 +35,317 @@
#include <stdio.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/log.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_raw.h>
#include <ipmitool/ipmi_fru.h>
#include <ipmitool/ipmi_strings.h>
int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
#define IPMI_I2C_MASTER_MAX_SIZE 0x40 /* 64 bytes */
/* ipmi_master_write_read - Perform I2C write/read transactions
*
* This function performs an I2C master write-read function through
* IPMI interface. It has a maximum transfer size of 32 bytes.
*
* @intf: ipmi interface
* @bus: channel number, i2c bus id and type
* @addr: i2c slave address
* @wdata: data to write
* @wsize: length of data to write (max 64 bytes)
* @rsize: length of data to read (max 64 bytes)
*
* Returns pointer to IPMI Response
*/
struct ipmi_rs *
ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr,
uint8_t * wdata, uint8_t wsize, uint8_t rsize)
{
struct ipmi_rq req;
struct ipmi_rs * rsp;
uint8_t rqdata[IPMI_I2C_MASTER_MAX_SIZE + 3];
if (rsize > IPMI_I2C_MASTER_MAX_SIZE) {
lprintf(LOG_ERR, "Master Write-Read: Too many bytes (%d) to read", rsize);
return NULL;
}
if (wsize > IPMI_I2C_MASTER_MAX_SIZE) {
lprintf(LOG_ERR, "Master Write-Read: Too many bytes (%d) to write", wsize);
return NULL;
}
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = 0x52; /* master write-read */
req.msg.data = rqdata;
req.msg.data_len = 3;
memset(rqdata, 0, IPMI_I2C_MASTER_MAX_SIZE + 3);
rqdata[0] = bus; /* channel number, bus id, bus type */
rqdata[1] = addr; /* slave address */
rqdata[2] = rsize; /* number of bytes to read */
if (wsize > 0) {
/* copy in data to write */
memcpy(rqdata+3, wdata, wsize);
req.msg.data_len += wsize;
lprintf(LOG_DEBUG, "Writing %d bytes to i2cdev %02Xh", wsize, addr);
}
if (rsize > 0) {
lprintf(LOG_DEBUG, "Reading %d bytes from i2cdev %02Xh", rsize, addr);
}
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "I2C Master Write-Read command failed");
return NULL;
}
else if (rsp->ccode > 0) {
switch (rsp->ccode) {
case 0x81:
lprintf(LOG_ERR, "I2C Master Write-Read command failed: Lost Arbitration");
break;
case 0x82:
lprintf(LOG_ERR, "I2C Master Write-Read command failed: Bus Error");
break;
case 0x83:
lprintf(LOG_ERR, "I2C Master Write-Read command failed: NAK on Write");
break;
case 0x84:
lprintf(LOG_ERR, "I2C Master Write-Read command failed: Truncated Read");
break;
default:
lprintf(LOG_ERR, "I2C Master Write-Read command failed: %s",
val2str(rsp->ccode, completion_code_vals));
break;
}
return NULL;
}
return rsp;
}
#define RAW_SPD_SIZE 256
int
ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs *rsp;
uint8_t i2cbus = 0;
uint8_t i2caddr = 0;
uint8_t spd_data[RAW_SPD_SIZE];
int i;
memset(spd_data, 0, RAW_SPD_SIZE);
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
lprintf(LOG_NOTICE, "usage: spd <i2cbus> <i2caddr>");
return 0;
}
i2cbus = (uint8_t)strtoul(argv[0], NULL, 0);
i2caddr = (uint8_t)strtoul(argv[1], NULL, 0);
i2cbus = ((i2cbus & 7) << 1) | 1;
for (i = 0; i < RAW_SPD_SIZE; i+= IPMI_I2C_MASTER_MAX_SIZE) {
rsp = ipmi_master_write_read(intf, i2cbus, i2caddr,
(uint8_t *)&i, 1, IPMI_I2C_MASTER_MAX_SIZE);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
return -1;
}
memcpy(spd_data+i, rsp->data, IPMI_I2C_MASTER_MAX_SIZE);
}
ipmi_spd_print(spd_data, i);
return 0;
}
static void rawi2c_usage(void)
{
lprintf(LOG_NOTICE, "usage: i2c [bus=public|# [chan=#]] <i2caddr> <read bytes> [write data]");
lprintf(LOG_NOTICE, " bus=public is default");
lprintf(LOG_NOTICE, " chan=0 is default, bus= must be specified to use chan=");
}
int
ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char netfn, cmd;
int i;
unsigned char data[32];
uint8_t wdata[IPMI_I2C_MASTER_MAX_SIZE];
uint8_t i2caddr = 0;
uint8_t rsize = 0;
uint8_t wsize = 0;
unsigned int rbus = 0;
uint8_t bus = 0;
int i = 0;
if (argc < 2 || !strncmp(argv[0], "help", 4)) {
printf("RAW Commands: raw <netfn> <cmd> [data]\n");
/* handle bus= argument */
if (argc > 2 && strncmp(argv[0], "bus=", 4) == 0) {
i = 1;
if (strncmp(argv[0], "bus=public", 10) == 0)
bus = 0;
else if (sscanf(argv[0], "bus=%u", &rbus) == 1)
bus = ((rbus & 7) << 1) | 1;
else
bus = 0;
/* handle channel= argument
* the bus= argument must be supplied first on command line */
if (argc > 3 && strncmp(argv[1], "chan=", 5) == 0) {
i = 2;
if (sscanf(argv[1], "chan=%u", &rbus) == 1)
bus |= rbus << 4;
}
}
if ((argc-i) < 2 || strncmp(argv[0], "help", 4) == 0) {
rawi2c_usage();
return 0;
}
else if (argc-i-2 > IPMI_I2C_MASTER_MAX_SIZE) {
lprintf(LOG_ERR, "Raw command input limit (%d bytes) exceeded",
IPMI_I2C_MASTER_MAX_SIZE);
return -1;
}
netfn = (unsigned char)strtol(argv[0], NULL, 0);
cmd = (unsigned char)strtol(argv[1], NULL, 0);
i2caddr = (uint8_t)strtoul(argv[i++], NULL, 0);
rsize = (uint8_t)strtoul(argv[i++], NULL, 0);
if (i2caddr == 0) {
lprintf(LOG_ERR, "Invalid I2C address 0");
rawi2c_usage();
return -1;
}
memset(wdata, 0, IPMI_I2C_MASTER_MAX_SIZE);
for (; i < argc; i++) {
uint8_t val = (uint8_t)strtol(argv[i], NULL, 0);
wdata[i-2] = val;
wsize++;
}
lprintf(LOG_INFO, "RAW I2C REQ (i2caddr=%x readbytes=%d writebytes=%d)",
i2caddr, rsize, wsize);
printbuf(wdata, wsize, "WRITE DATA");
rsp = ipmi_master_write_read(intf, bus, i2caddr, wdata, wsize, rsize);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
return -1;
}
if (wsize > 0) {
if (verbose || rsize == 0)
printf("Wrote %d bytes to I2C device %02Xh\n", wsize, i2caddr);
}
if (rsize > 0) {
if (verbose || wsize == 0)
printf("Read %d bytes from I2C device %02Xh\n", rsp->data_len, i2caddr);
if (rsp->data_len < rsize)
return -1;
/* print the raw response buffer */
for (i=0; i<rsp->data_len; i++) {
if (((i%16) == 0) && (i != 0))
printf("\n");
printf(" %2.2x", rsp->data[i]);
}
printf("\n");
if (rsp->data_len <= 4) {
uint32_t bit;
int j;
for (i = 0; i < rsp->data_len; i++) {
for (j = 1, bit = 0x80; bit > 0; bit /= 2, j++) {
printf("%s", (rsp->data[i] & bit) ? "1" : "0");
}
printf(" ");
}
printf("\n");
}
}
return 0;
}
int
ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t netfn, cmd, lun;
int i;
uint8_t data[256];
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
lprintf(LOG_NOTICE, "RAW Commands: raw <netfn> <cmd> [data]");
print_valstr(ipmi_netfn_vals, "Network Function Codes", LOG_NOTICE);
lprintf(LOG_NOTICE, "(can also use raw hex values)");
return -1;
}
else if (argc > sizeof(data))
{
lprintf(LOG_NOTICE, "Raw command input limit (256 bytes) exceeded");
return -1;
}
ipmi_intf_session_set_timeout(intf, 15);
ipmi_intf_session_set_retry(intf, 1);
lun = intf->target_lun;
netfn = str2val(argv[0], ipmi_netfn_vals);
if (netfn == 0xff) {
netfn = (uint8_t)strtol(argv[0], NULL, 0);
}
cmd = (uint8_t)strtol(argv[1], NULL, 0);
memset(data, 0, sizeof(data));
memset(&req, 0, sizeof(req));
req.msg.netfn = netfn;
req.msg.lun = lun;
req.msg.cmd = cmd;
req.msg.data = data;
for (i=2; i<argc; i++) {
unsigned char val = (unsigned char)strtol(argv[i], NULL, 0);
uint8_t val = (uint8_t)strtol(argv[i], NULL, 0);
req.msg.data[i-2] = val;
req.msg.data_len++;
}
if (verbose && req.msg.data_len) {
for (i=0; i<req.msg.data_len; i++) {
if (((i%16) == 0) && (i != 0))
printf("\n");
printf(" %2.2x", req.msg.data[i]);
}
printf("\n");
}
if (verbose)
printf("RAW REQ (netfn=0x%x cmd=0x%x data_len=%d)\n",
req.msg.netfn, req.msg.cmd, req.msg.data_len);
lprintf(LOG_INFO,
"RAW REQ (channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x data_len=%d)",
intf->target_channel & 0x0f, req.msg.netfn,req.msg.lun ,
req.msg.cmd, req.msg.data_len);
printbuf(req.msg.data, req.msg.data_len, "RAW REQUEST");
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x sending RAW command\n",
rsp ? rsp->ccode : 0);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to send RAW command "
"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x)",
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to send RAW command "
"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x rsp=0x%x): %s",
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd, rsp->ccode,
val2str(rsp->ccode, completion_code_vals));
return -1;
}
if (verbose)
printf("RAW RSP (%d bytes)\n", rsp->data_len);
lprintf(LOG_INFO, "RAW RSP (%d bytes)", rsp->data_len);
/* print the raw response buffer */
for (i=0; i<rsp->data_len; i++) {
if (((i%16) == 0) && (i != 0))
printf("\n");
@ -102,4 +355,3 @@ int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,26 +28,23 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi_lanp.h>
#include <ipmitool/ipmi_session.h>
#include <ipmitool/ipmi_strings.h>
@ -262,7 +259,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char rqdata[5]; // max length of the variable length request
uint8_t rqdata[5]; // max length of the variable length request
struct get_session_info_rsp session_info;
memset(&req, 0, sizeof(req));
@ -293,24 +290,33 @@ ipmi_get_session_info(struct ipmi_intf * intf,
break;
case IPMI_SESSION_REQUEST_BY_HANDLE:
rqdata[0] = 0xFE;
rqdata[1] = (unsigned char)id_or_handle;
rqdata[1] = (uint8_t)id_or_handle;
req.msg.data_len = 2;
break;
case IPMI_SESSION_REQUEST_ALL:
break;
}
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
printf("Error:%x Get Session Info Command\n", rsp ? rsp->ccode : 0);
if ((session_request_type == IPMI_SESSION_REQUEST_CURRENT) &&
(strncmp(intf->name, "intf_lan", 8)))
printf("It is likely that the channel in use does not support sessions\n");
if (rsp == NULL)
{
lprintf(LOG_ERR, "Get Session Info command failed");
retval = -1;
}
else if (rsp->ccode > 0)
{
lprintf(LOG_ERR, "Get Session Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
retval = -1;
}
if (retval < 0)
{
if ((session_request_type == IPMI_SESSION_REQUEST_CURRENT) &&
(strncmp(intf->name, "lan", 3) != 0))
lprintf(LOG_ERR, "It is likely that the channel in use "
"does not support sessions");
}
else
{
memcpy(&session_info, rsp->data, rsp->data_len);
@ -326,20 +332,27 @@ ipmi_get_session_info(struct ipmi_intf * intf,
rqdata[0] = i++;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode || (rsp->data_len < 3))
if (rsp == NULL)
{
if (!rsp || (rsp->ccode != 0xCC))
{
printf("Error:%x Get Session Info Command\n", rsp ? rsp->ccode : 0);
retval = -1;
}
lprintf(LOG_ERR, "Get Session Info command failed");
retval = -1;
break;
}
else
else if (rsp->ccode > 0 && rsp->ccode != 0xCC && rsp->ccode != 0xCB)
{
memcpy(&session_info, rsp->data, rsp->data_len);
print_session_info(&session_info, rsp->data_len);
lprintf(LOG_ERR, "Get Session Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
retval = -1;
break;
}
else if (rsp->data_len < 3)
{
retval = -1;
break;
}
memcpy(&session_info, rsp->data, rsp->data_len);
print_session_info(&session_info, rsp->data_len);
} while (i <= session_info.session_slot_count);
break;
@ -350,10 +363,10 @@ ipmi_get_session_info(struct ipmi_intf * intf,
void
printf_session_usage()
static void
printf_session_usage(void)
{
printf("Session Commands: info <active | all | id 0xnnnnnnnn | handle 0xnn>\n");
lprintf(LOG_NOTICE, "Session Commands: info <active | all | id 0xnnnnnnnn | handle 0xnn>");
}
@ -362,31 +375,27 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int retval = 0;
if (!argc || !strncmp(argv[0], "help", 4))
if (argc == 0 || strncmp(argv[0], "help", 4) == 0)
{
printf_session_usage();
retval = 1;
}
else if (!strncmp(argv[0], "info", 4))
else if (strncmp(argv[0], "info", 4) == 0)
{
if ((argc < 2) || !strncmp(argv[1], "help", 4))
if ((argc < 2) || strncmp(argv[1], "help", 4) == 0)
{
printf_session_usage();
retval = 1;
}
else
{
Ipmi_Session_Request_Type session_request_type = 0;
uint32_t id_or_handle = 0;
if (!strncmp(argv[1], "active", 6))
if (strncmp(argv[1], "active", 6) == 0)
session_request_type = IPMI_SESSION_REQUEST_CURRENT;
else if (!strncmp(argv[1], "all", 3))
else if (strncmp(argv[1], "all", 3) == 0)
session_request_type = IPMI_SESSION_REQUEST_ALL;
else if (!strncmp(argv[1], "id", 2))
else if (strncmp(argv[1], "id", 2) == 0)
{
if (argc >= 3)
{
@ -395,12 +404,12 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
}
else
{
printf("Missing id argument\n");
lprintf(LOG_ERR, "Missing id argument");
printf_session_usage();
retval = 1;
retval = -1;
}
}
else if (!strncmp(argv[1], "handle", 6))
else if (strncmp(argv[1], "handle", 6) == 0)
{
if (argc >= 3)
{
@ -409,20 +418,20 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
}
else
{
printf("Missing handle argument\n");
lprintf(LOG_ERR, "Missing handle argument");
printf_session_usage();
retval = 1;
retval = -1;
}
}
else
{
printf("Invalid SESSION info parameter: %s\n", argv[1]);
lprintf(LOG_ERR, "Invalid SESSION info parameter: %s", argv[1]);
printf_session_usage();
retval = 1;
retval = -1;
}
if (! retval)
if (retval == 0)
retval = ipmi_get_session_info(intf,
session_request_type,
id_or_handle);
@ -430,9 +439,9 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
}
else
{
printf("Invalid SESSION command: %s\n", argv[0]);
lprintf(LOG_ERR, "Invalid SESSION command: %s", argv[0]);
printf_session_usage();
retval = 1;
retval = -1;
}
return retval;

File diff suppressed because it is too large Load Diff

View File

@ -28,25 +28,55 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stddef.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_constants.h>
#include <ipmitool/ipmi_sensor.h>
#include <ipmitool/ipmi_sel.h> /* for IPMI_OEM */
const struct valstr ipmi_oem_info[] = {
const struct valstr ipmi_channel_activity_type_vals[] = {
{ 0, "IPMI Messaging session active" },
{ 1, "Callback Messaging session active" },
{ 2, "Dial-out Alert active" },
{ 3, "TAP Page Active" },
{ 0x00, NULL },
{ IPMI_OEM_UNKNOWN, "Unknown" },
{ IPMI_OEM_SUN, "Sun Microsystems" },
{ IPMI_OEM_INTEL, "Intel Corporation" },
{ IPMI_OEM_TYAN, "Tyan Computer Corporation" },
{ IPMI_OEM_NEWISYS, "Newisys" },
{ IPMI_OEM_SUPERMICRO, "Supermicro" },
{ IPMI_OEM_GOOGLE, "Google" },
{ IPMI_OEM_KONTRON, "Kontron" },
{ IPMI_OEM_NOKIA, "Nokia" },
{ 0xffff , NULL },
};
const struct oemvalstr ipmi_oem_sdr_type_vals[] = {
/* Keep OEM grouped together */
{ IPMI_OEM_KONTRON , 0xC0 , "OEM Firmware Info" },
{ IPMI_OEM_KONTRON , 0xC2 , "OEM Init Agent" },
{ IPMI_OEM_KONTRON , 0xC3 , "OEM IPMBL Link State" },
{ IPMI_OEM_KONTRON , 0xC4 , "OEM Board Reset" },
{ IPMI_OEM_KONTRON , 0xC5 , "OEM FRU Information Agent" },
{ IPMI_OEM_KONTRON , 0xC6 , "OEM POST Value Sensor" },
{ IPMI_OEM_KONTRON , 0xC7 , "OEM FWUM Status" },
{ IPMI_OEM_KONTRON , 0xC8 , "OEM Switch Mngt Software Status" },
{ IPMI_OEM_PICMG , 0xF0 , "PICMG FRU Hotswap" },
{ IPMI_OEM_PICMG , 0xF1 , "PICMG IPMB0 Link State" },
{ 0xffff, 0x00, NULL }
};
const struct valstr ipmi_netfn_vals[] = {
{ IPMI_NETFN_CHASSIS, "Chassis" },
{ IPMI_NETFN_BRIDGE, "Bridge" },
{ IPMI_NETFN_SE, "SensorEvent" },
{ IPMI_NETFN_APP, "Application" },
{ IPMI_NETFN_FIRMWARE, "Firmware" },
{ IPMI_NETFN_STORAGE, "Storage" },
{ IPMI_NETFN_TRANSPORT, "Transport" },
{ 0xff, NULL },
};
/*
* From table 26-4 of the IPMI v2 specification
@ -61,6 +91,14 @@ const struct valstr impi_bit_rate_vals[] = {
{ 0x00, NULL },
};
const struct valstr ipmi_channel_activity_type_vals[] = {
{ 0, "IPMI Messaging session active" },
{ 1, "Callback Messaging session active" },
{ 2, "Dial-out Alert active" },
{ 3, "TAP Page Active" },
{ 0x00, NULL },
};
const struct valstr ipmi_privlvl_vals[] = {
{ IPMI_SESSION_PRIV_CALLBACK, "CALLBACK" },
@ -69,7 +107,7 @@ const struct valstr ipmi_privlvl_vals[] = {
{ IPMI_SESSION_PRIV_ADMIN, "ADMINISTRATOR" },
{ IPMI_SESSION_PRIV_OEM, "OEM" },
{ 0xF, "NO ACCESS" },
{ 0, NULL },
{ 0xFF, NULL },
};
@ -87,7 +125,7 @@ const struct valstr ipmi_authtype_session_vals[] = {
{ IPMI_SESSION_AUTHTYPE_MD5, "MD5" },
{ IPMI_SESSION_AUTHTYPE_PASSWORD, "PASSWORD" },
{ IPMI_SESSION_AUTHTYPE_OEM, "OEM" },
{ 0, NULL },
{ 0xFF, NULL },
};
@ -99,3 +137,210 @@ const struct valstr ipmi_authtype_vals[] = {
{ IPMI_1_5_AUTH_TYPE_BIT_OEM, "OEM" },
{ 0, NULL },
};
const struct valstr entity_id_vals[] = {
{ 0x00, "Unspecified" },
{ 0x01, "Other" },
{ 0x02, "Unknown" },
{ 0x03, "Processor" },
{ 0x04, "Disk or Disk Bay" },
{ 0x05, "Peripheral Bay" },
{ 0x06, "System Management Module" },
{ 0x07, "System Board" },
{ 0x08, "Memory Module" },
{ 0x09, "Processor Module" },
{ 0x0a, "Power Supply" },
{ 0x0b, "Add-in Card" },
{ 0x0c, "Front Panel Board" },
{ 0x0d, "Back Panel Board" },
{ 0x0e, "Power System Board" },
{ 0x0f, "Drive Backplane" },
{ 0x10, "System Internal Expansion Board" },
{ 0x11, "Other System Board" },
{ 0x12, "Processor Board" },
{ 0x13, "Power Unit" },
{ 0x14, "Power Module" },
{ 0x15, "Power Management" },
{ 0x16, "Chassis Back Panel Board" },
{ 0x17, "System Chassis" },
{ 0x18, "Sub-Chassis" },
{ 0x19, "Other Chassis Board" },
{ 0x1a, "Disk Drive Bay" },
{ 0x1b, "Peripheral Bay" },
{ 0x1c, "Device Bay" },
{ 0x1d, "Fan Device" },
{ 0x1e, "Cooling Unit" },
{ 0x1f, "Cable/Interconnect" },
{ 0x20, "Memory Device" },
{ 0x21, "System Management Software" },
{ 0x22, "BIOS" },
{ 0x23, "Operating System" },
{ 0x24, "System Bus" },
{ 0x25, "Group" },
{ 0x26, "Remote Management Device" },
{ 0x27, "External Environment" },
{ 0x28, "Battery" },
{ 0x29, "Processing Blade" },
{ 0x2A, "Connectivity Switch" },
{ 0x2B, "Processor/Memory Module" },
{ 0x2C, "I/O Module" },
{ 0x2D, "Processor/IO Module" },
{ 0x2E, "Management Controller Firmware" },
{ 0x2F, "IPMI Channel" },
{ 0x30, "PCI Bus" },
{ 0x31, "PCI Express Bus" },
{ 0x32, "SCSI Bus (parallel)" },
{ 0x33, "SATA/SAS Bus" },
{ 0x34, "Processor/Front-Side Bus" },
/* PICMG */
{ 0xA0, "PICMG Front Board" },
{ 0xC0, "PICMG Rear Transition Module" },
{ 0xC1, "PICMG AdvancedMC Module" },
{ 0xF0, "PICMG Shelf Management Controller" },
{ 0xF1, "PICMG Filtration Unit" },
{ 0xF2, "PICMG Shelf FRU Information" },
{ 0xF3, "PICMG Alarm Panel" },
{ 0x00, NULL },
};
const struct valstr entity_device_type_vals[] = {
{ 0x00, "Reserved" },
{ 0x01, "Reserved" },
{ 0x02, "DS1624 temperature sensor" },
{ 0x03, "DS1621 temperature sensor" },
{ 0x04, "LM75 Temperature Sensor" },
{ 0x05, "Heceta ASIC" },
{ 0x06, "Reserved" },
{ 0x07, "Reserved" },
{ 0x08, "EEPROM, 24C01" },
{ 0x09, "EEPROM, 24C02" },
{ 0x0a, "EEPROM, 24C04" },
{ 0x0b, "EEPROM, 24C08" },
{ 0x0c, "EEPROM, 24C16" },
{ 0x0d, "EEPROM, 24C17" },
{ 0x0e, "EEPROM, 24C32" },
{ 0x0f, "EEPROM, 24C64" },
{ 0x1000, "IPMI FRU Inventory" },
{ 0x1001, "DIMM Memory ID" },
{ 0x1002, "IPMI FRU Inventory" },
{ 0x1003, "System Processor Cartridge FRU" },
{ 0x11, "Reserved" },
{ 0x12, "Reserved" },
{ 0x13, "Reserved" },
{ 0x14, "PCF 8570 256 byte RAM" },
{ 0x15, "PCF 8573 clock/calendar" },
{ 0x16, "PCF 8574A I/O Port" },
{ 0x17, "PCF 8583 clock/calendar" },
{ 0x18, "PCF 8593 clock/calendar" },
{ 0x19, "Clock calendar" },
{ 0x1a, "PCF 8591 A/D, D/A Converter" },
{ 0x1b, "I/O Port" },
{ 0x1c, "A/D Converter" },
{ 0x1d, "D/A Converter" },
{ 0x1e, "A/D, D/A Converter" },
{ 0x1f, "LCD Controller/Driver" },
{ 0x20, "Core Logic (Chip set) Device" },
{ 0x21, "LMC6874 Intelligent Battery controller" },
{ 0x22, "Intelligent Batter controller" },
{ 0x23, "Combo Management ASIC" },
{ 0x24, "Maxim 1617 Temperature Sensor" },
{ 0xbf, "Other/Unspecified" },
{ 0x00, NULL },
};
const struct valstr ipmi_channel_protocol_vals[] = {
{ 0x00, "reserved" },
{ 0x01, "IPMB-1.0" },
{ 0x02, "ICMB-1.0" },
{ 0x03, "reserved" },
{ 0x04, "IPMI-SMBus" },
{ 0x05, "KCS" },
{ 0x06, "SMIC" },
{ 0x07, "BT-10" },
{ 0x08, "BT-15" },
{ 0x09, "TMode" },
{ 0x1c, "OEM 1" },
{ 0x1d, "OEM 2" },
{ 0x1e, "OEM 3" },
{ 0x1f, "OEM 4" },
{ 0x00, NULL },
};
const struct valstr ipmi_channel_medium_vals[] = {
{ IPMI_CHANNEL_MEDIUM_RESERVED, "reserved" },
{ IPMI_CHANNEL_MEDIUM_IPMB_I2C, "IPMB (I2C)" },
{ IPMI_CHANNEL_MEDIUM_ICMB_1, "ICMB v1.0" },
{ IPMI_CHANNEL_MEDIUM_ICMB_09, "ICMB v0.9" },
{ IPMI_CHANNEL_MEDIUM_LAN, "802.3 LAN" },
{ IPMI_CHANNEL_MEDIUM_SERIAL, "Serial/Modem" },
{ IPMI_CHANNEL_MEDIUM_LAN_OTHER,"Other LAN" },
{ IPMI_CHANNEL_MEDIUM_SMBUS_PCI,"PCI SMBus" },
{ IPMI_CHANNEL_MEDIUM_SMBUS_1, "SMBus v1.0/v1.1" },
{ IPMI_CHANNEL_MEDIUM_SMBUS_2, "SMBus v2.0" },
{ IPMI_CHANNEL_MEDIUM_USB_1, "USB 1.x" },
{ IPMI_CHANNEL_MEDIUM_USB_2, "USB 2.x" },
{ IPMI_CHANNEL_MEDIUM_SYSTEM, "System Interface" },
{ 0x00, NULL },
};
const struct valstr completion_code_vals[] = {
{ 0x00, "Command completed normally" },
{ 0xc0, "Node busy" },
{ 0xc1, "Invalid command" },
{ 0xc2, "Invalid command on LUN" },
{ 0xc3, "Timeout" },
{ 0xc4, "Out of space" },
{ 0xc5, "Reservation cancelled or invalid" },
{ 0xc6, "Request data truncated" },
{ 0xc7, "Request data length invalid" },
{ 0xc8, "Request data field length limit exceeded" },
{ 0xc9, "Parameter out of range" },
{ 0xca, "Cannot return number of requested data bytes" },
{ 0xcb, "Requested sensor, data, or record not found" },
{ 0xcc, "Invalid data field in request" },
{ 0xcd, "Command illegal for specified sensor or record type" },
{ 0xce, "Command response could not be provided" },
{ 0xcf, "Cannot execute duplicated request" },
{ 0xd0, "SDR Repository in update mode" },
{ 0xd1, "Device firmeware in update mode" },
{ 0xd2, "BMC initialization in progress" },
{ 0xd3, "Destination unavailable" },
{ 0xd4, "Insufficient privilege level" },
{ 0xd5, "Command not supported in present state" },
{ 0xff, "Unspecified error" },
{ 0x00, NULL }
};
const struct valstr ipmi_chassis_power_control_vals[] = {
{ IPMI_CHASSIS_CTL_POWER_DOWN, "Down/Off" },
{ IPMI_CHASSIS_CTL_POWER_UP, "Up/On" },
{ IPMI_CHASSIS_CTL_POWER_CYCLE, "Cycle" },
{ IPMI_CHASSIS_CTL_HARD_RESET, "Reset" },
{ IPMI_CHASSIS_CTL_PULSE_DIAG, "Diag" },
{ IPMI_CHASSIS_CTL_ACPI_SOFT, "Soft" },
{ 0x00, NULL },
};
const struct valstr ipmi_auth_algorithms[] = {
{ IPMI_AUTH_RAKP_NONE, "none" },
{ IPMI_AUTH_RAKP_HMAC_SHA1, "hmac_sha1" },
{ IPMI_AUTH_RAKP_HMAC_MD5, "hmac_md5" },
{ 0x00, NULL }
};
const struct valstr ipmi_integrity_algorithms[] = {
{ IPMI_INTEGRITY_NONE, "none" },
{ IPMI_INTEGRITY_HMAC_SHA1_96, "hmac_sha1_96" },
{ IPMI_INTEGRITY_HMAC_MD5_128, "hmac_md5_128" },
{ IPMI_INTEGRITY_MD5_128 , "md5_128" },
{ 0x00, NULL }
};
const struct valstr ipmi_encryption_algorithms[] = {
{ IPMI_CRYPT_NONE, "none" },
{ IPMI_CRYPT_AES_CBC_128, "aes_cbc_128" },
{ IPMI_CRYPT_XRC4_128, "xrc4_128" },
{ IPMI_CRYPT_XRC4_40, "xrc4_40" },
{ 0x00, NULL }
};

849
ipmitool/lib/ipmi_sunoem.c Normal file
View File

@ -0,0 +1,849 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <ctype.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi_sel.h>
#include <ipmitool/ipmi_sdr.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_channel.h>
#include <ipmitool/ipmi_sunoem.h>
#include <ipmitool/ipmi_raw.h>
static const struct valstr sunoem_led_type_vals[] = {
{ 0, "OK2RM" },
{ 1, "SERVICE" },
{ 2, "ACT" },
{ 3, "LOCATE" },
{ 0xFF, NULL },
};
static const struct valstr sunoem_led_mode_vals[] = {
{ 0, "OFF" },
{ 1, "ON" },
{ 2, "STANDBY" },
{ 3, "SLOW" },
{ 4, "FAST" },
{ 0xFF, NULL },
};
static const struct valstr sunoem_led_mode_optvals[] = {
{ 0, "STEADY_OFF" },
{ 1, "STEADY_ON" },
{ 2, "STANDBY_BLINK" },
{ 3, "SLOW_BLINK" },
{ 4, "FAST_BLINK" },
{ 0xFF, NULL },
};
int is_sbcmd = 0;
static void
ipmi_sunoem_usage(void)
{
lprintf(LOG_NOTICE, "usage: sunoem <command> [option...]");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " fan speed <0-100>");
lprintf(LOG_NOTICE, " Set system fan speed (PWM duty cycle)");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sshkey set <userid> <id_rsa.pub>");
lprintf(LOG_NOTICE, " Set ssh key for a userid into authorized_keys,");
lprintf(LOG_NOTICE, " view users with 'user list' command.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sshkey del <userid>");
lprintf(LOG_NOTICE, " Delete ssh key for userid from authorized_keys,");
lprintf(LOG_NOTICE, " view users with 'user list' command.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " led get <sensorid> [ledtype]");
lprintf(LOG_NOTICE, " Read status of LED found in Generic Device Locator.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " led set <sensorid> <ledmode> [ledtype]");
lprintf(LOG_NOTICE, " Set mode of LED found in Generic Device Locator.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sbled get <sensorid> [ledtype]");
lprintf(LOG_NOTICE, " Read status of LED found in Generic Device Locator");
lprintf(LOG_NOTICE, " for Sun Blade Modular Systems.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sbled set <sensorid> <ledmode> [ledtype]");
lprintf(LOG_NOTICE, " Set mode of LED found in Generic Device Locator");
lprintf(LOG_NOTICE, " for Sun Blade Modular Systems.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " Use 'sdr list generic' command to get list of Generic");
lprintf(LOG_NOTICE, " Devices that are controllable LEDs.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " Required SIS LED Mode:");
lprintf(LOG_NOTICE, " OFF Off");
lprintf(LOG_NOTICE, " ON Steady On");
lprintf(LOG_NOTICE, " STANDBY 100ms on 2900ms off blink rate");
lprintf(LOG_NOTICE, " SLOW 1HZ blink rate");
lprintf(LOG_NOTICE, " FAST 4HZ blink rate");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " Optional SIS LED Type:");
lprintf(LOG_NOTICE, " OK2RM OK to Remove");
lprintf(LOG_NOTICE, " SERVICE Service Required");
lprintf(LOG_NOTICE, " ACT Activity");
lprintf(LOG_NOTICE, " LOCATE Locate");
lprintf(LOG_NOTICE, "");
}
/*
* IPMI Request Data: 1 byte
*
* [byte 0] FanSpeed Fan speed as percentage
*/
static int
ipmi_sunoem_fan_speed(struct ipmi_intf * intf, uint8_t speed)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
/*
* sunoem fan speed <percent>
*/
if (speed > 100) {
lprintf(LOG_NOTICE, "Invalid fan speed: %d", speed);
return -1;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_SET_FAN_SPEED;
req.msg.data = &speed;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set Fan Speed command failed");
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Set Fan Speed command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Set Fan speed to %d%%\n", speed);
return 0;
}
static void
__sdr_list_empty(struct sdr_record_list * head)
{
struct sdr_record_list * e, * f;
for (e = head; e != NULL; e = f) {
f = e->next;
free(e);
}
head = NULL;
}
static void
led_print(const char * name, uint8_t state)
{
if (csv_output)
printf("%s,%s\n", name, val2str(state, sunoem_led_mode_vals));
else
printf("%-16s | %s\n", name, val2str(state, sunoem_led_mode_vals));
}
struct ipmi_rs *
sunoem_led_get(struct ipmi_intf * intf,
struct sdr_record_generic_locator * dev,
int ledtype)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t rqdata[7];
int rqdata_len = 5;
if (dev == NULL)
return NULL;
rqdata[0] = dev->dev_slave_addr;
if (ledtype == 0xFF)
rqdata[1] = dev->oem;
else
rqdata[1] = ledtype;
rqdata[2] = dev->dev_access_addr;
rqdata[3] = dev->oem;
if (is_sbcmd) {
rqdata[4] = dev->entity.id;
rqdata[5] = dev->entity.instance;
rqdata[6] = 0;
rqdata_len = 7;
}
else {
rqdata[4] = 0;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_GET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Get LED command failed");
return NULL;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Get LED command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return NULL;
}
return rsp;
}
struct ipmi_rs *
sunoem_led_set(struct ipmi_intf * intf,
struct sdr_record_generic_locator * dev,
int ledtype, int ledmode)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t rqdata[9];
int rqdata_len = 7;
if (dev == NULL)
return NULL;
rqdata[0] = dev->dev_slave_addr;
if (ledtype == 0xFF)
rqdata[1] = dev->oem;
else
rqdata[1] = ledtype;
rqdata[2] = dev->dev_access_addr;
rqdata[3] = dev->oem;
rqdata[4] = ledmode;
if (is_sbcmd) {
rqdata[5] = dev->entity.id;
rqdata[6] = dev->entity.instance;
rqdata[7] = 0;
rqdata[8] = 0;
rqdata_len = 9;
}
else {
rqdata[5] = 0;
rqdata[6] = 0;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_SET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed");
return NULL;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return NULL;
}
return rsp;
}
static void
sunoem_led_get_byentity(struct ipmi_intf * intf, uint8_t entity_id,
uint8_t entity_inst, int ledtype)
{
struct ipmi_rs * rsp;
struct sdr_record_list *elist, *e;
struct entity_id entity;
if (entity_id == 0)
return;
/* lookup sdrs with this entity */
memset(&entity, 0, sizeof(struct entity_id));
entity.id = entity_id;
entity.instance = entity_inst;
elist = ipmi_sdr_find_sdr_byentity(intf, &entity);
/* for each generic sensor set its led state */
for (e = elist; e != NULL; e = e->next) {
if (e->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
rsp = sunoem_led_get(intf, e->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)e->record.genloc->id_string, rsp->data[0]);
}
}
__sdr_list_empty(elist);
}
static void
sunoem_led_set_byentity(struct ipmi_intf * intf, uint8_t entity_id,
uint8_t entity_inst, int ledtype, int ledmode)
{
struct ipmi_rs * rsp;
struct sdr_record_list *elist, *e;
struct entity_id entity;
if (entity_id == 0)
return;
/* lookup sdrs with this entity */
memset(&entity, 0, sizeof(struct entity_id));
entity.id = entity_id;
entity.instance = entity_inst;
elist = ipmi_sdr_find_sdr_byentity(intf, &entity);
/* for each generic sensor set its led state */
for (e = elist; e != NULL; e = e->next) {
if (e->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
rsp = sunoem_led_set(intf, e->record.genloc, ledtype, ledmode);
if (rsp && rsp->data_len == 0) {
led_print((const char *)e->record.genloc->id_string, ledmode);
}
}
__sdr_list_empty(elist);
}
/*
* IPMI Request Data: 5 bytes
*
* [byte 0] devAddr Value from the "Device Slave Address" field in
* LED's Generic Device Locator record in the SDR
* [byte 1] led LED Type: OK2RM, ACT, LOCATE, SERVICE
* [byte 2] ctrlrAddr Controller address; value from the "Device
* Access Address" field, 0x20 if the LED is local
* [byte 3] hwInfo The OEM field from the SDR record
* [byte 4] force 1 = directly access the device
* 0 = go thru its controller
* Ignored if LED is local
*
* The format below is for Sun Blade Modular systems only
* [byte 4] entityID The entityID field from the SDR record
* [byte 5] entityIns The entityIns field from the SDR record
* [byte 6] force 1 = directly access the device
* 0 = go thru its controller
* Ignored if LED is local
*/
static int
ipmi_sunoem_led_get(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct sdr_record_list *sdr;
struct sdr_record_list *alist, *a;
struct sdr_record_entity_assoc *assoc;
int ledtype = 0xFF;
int i;
/*
* sunoem led/sbled get <id> [type]
*/
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
if (argc > 1) {
ledtype = str2val(argv[1], sunoem_led_type_vals);
if (ledtype == 0xFF)
lprintf(LOG_ERR, "Unknow ledtype, will use data from the SDR oem field");
}
if (strncasecmp(argv[0], "all", 3) == 0) {
/* do all generic sensors */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
if (a->record.genloc->entity.logical)
continue;
rsp = sunoem_led_get(intf, a->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)a->record.genloc->id_string, rsp->data[0]);
}
}
__sdr_list_empty(alist);
return 0;
}
/* look up generic device locator record in SDR */
sdr = ipmi_sdr_find_sdr_byid(intf, argv[0]);
if (sdr == NULL) {
lprintf(LOG_ERR, "No Sensor Data Record found for %s", argv[0]);
return -1;
}
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
lprintf(LOG_ERR, "Invalid SDR type %d", sdr->type);
return -1;
}
if (!sdr->record.genloc->entity.logical) {
/*
* handle physical entity
*/
rsp = sunoem_led_get(intf, sdr->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)sdr->record.genloc->id_string, rsp->data[0]);
}
return 0;
}
/*
* handle logical entity for LED grouping
*/
lprintf(LOG_INFO, "LED %s is logical device", argv[0]);
/* get entity assoc records */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_ENTITY_ASSOC);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_ENTITY_ASSOC)
continue;
assoc = a->record.entassoc;
if (assoc == NULL)
continue;
/* check that the entity id/instance matches our generic record */
if (assoc->entity.id != sdr->record.genloc->entity.id ||
assoc->entity.instance != sdr->record.genloc->entity.instance)
continue;
if (assoc->flags.isrange) {
/*
* handle ranged entity associations
*
* the test for non-zero entity id is handled in
* sunoem_led_get_byentity()
*/
/* first range set - id 1 and 2 must be equal */
if (assoc->entity_id_1 == assoc->entity_id_2)
for (i = assoc->entity_inst_1; i <= assoc->entity_inst_2; i++)
sunoem_led_get_byentity(intf, assoc->entity_id_1, i, ledtype);
/* second range set - id 3 and 4 must be equal */
if (assoc->entity_id_3 == assoc->entity_id_4)
for (i = assoc->entity_inst_3; i <= assoc->entity_inst_4; i++)
sunoem_led_get_byentity(intf, assoc->entity_id_3, i, ledtype);
}
else {
/*
* handle entity list
*/
sunoem_led_get_byentity(intf, assoc->entity_id_1,
assoc->entity_inst_1, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_2,
assoc->entity_inst_2, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_3,
assoc->entity_inst_3, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_4,
assoc->entity_inst_4, ledtype);
}
}
__sdr_list_empty(alist);
return 0;
}
/*
* IPMI Request Data: 7 bytes
*
* [byte 0] devAddr Value from the "Device Slave Address" field in
* LED's Generic Device Locator record in the SDR
* [byte 1] led LED Type: OK2RM, ACT, LOCATE, SERVICE
* [byte 2] ctrlrAddr Controller address; value from the "Device
* Access Address" field, 0x20 if the LED is local
* [byte 3] hwInfo The OEM field from the SDR record
* [byte 4] mode LED Mode: OFF, ON, STANDBY, SLOW, FAST
* [byte 5] force TRUE - directly access the device
* FALSE - go thru its controller
* Ignored if LED is local
* [byte 6] role Used by BMC for authorization purposes
*
* The format below is for Sun Blade Modular systems only
* [byte 5] entityID The entityID field from the SDR record
* [byte 6] entityIns The entityIns field from the SDR record
* [byte 7] force TRUE - directly access the device
* FALSE - go thru its controller
* Ignored if LED is local
* [byte 8] role Used by BMC for authorization purposes
*
*
* IPMI Response Data: 1 byte
*
* [byte 0] mode LED Mode: OFF, ON, STANDBY, SLOW, FAST
*/
static int
ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct sdr_record_list *sdr;
struct sdr_record_list *alist, *a;
struct sdr_record_entity_assoc *assoc;
int ledmode;
int ledtype = 0xFF;
int i;
/*
* sunoem led/sbled set <id> <mode> [type]
*/
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
ledmode = str2val(argv[1], sunoem_led_mode_vals);
if (ledmode == 0xFF) {
ledmode = str2val(argv[1], sunoem_led_mode_optvals);
if (ledmode == 0xFF) {
lprintf(LOG_NOTICE, "Invalid LED Mode: %s", argv[1]);
return -1;
}
}
if (argc > 3) {
ledtype = str2val(argv[2], sunoem_led_type_vals);
if (ledtype == 0xFF)
lprintf(LOG_ERR, "Unknow ledtype, will use data from the SDR oem field");
}
if (strncasecmp(argv[0], "all", 3) == 0) {
/* do all generic sensors */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
if (a->record.genloc->entity.logical)
continue;
rsp = sunoem_led_set(intf, a->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) {
led_print((const char *)a->record.genloc->id_string, ledmode);
}
}
__sdr_list_empty(alist);
return 0;
}
/* look up generic device locator records in SDR */
sdr = ipmi_sdr_find_sdr_byid(intf, argv[0]);
if (sdr == NULL) {
lprintf(LOG_ERR, "No Sensor Data Record found for %s",
argv[0]);
return -1;
}
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
lprintf(LOG_ERR, "Invalid SDR type %d", sdr->type);
return -1;
}
if (!sdr->record.genloc->entity.logical) {
/*
* handle physical entity
*/
rsp = sunoem_led_set(intf, sdr->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) {
led_print(argv[0], ledmode);
}
return 0;
}
/*
* handle logical entity for LED grouping
*/
lprintf(LOG_INFO, "LED %s is logical device", argv[0]);
/* get entity assoc records */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_ENTITY_ASSOC);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_ENTITY_ASSOC)
continue;
assoc = a->record.entassoc;
if (assoc == NULL)
continue;
/* check that the entity id/instance matches our generic record */
if (assoc->entity.id != sdr->record.genloc->entity.id ||
assoc->entity.instance != sdr->record.genloc->entity.instance)
continue;
if (assoc->flags.isrange) {
/*
* handle ranged entity associations
*
* the test for non-zero entity id is handled in
* sunoem_led_get_byentity()
*/
/* first range set - id 1 and 2 must be equal */
if (assoc->entity_id_1 == assoc->entity_id_2)
for (i = assoc->entity_inst_1; i <= assoc->entity_inst_2; i++)
sunoem_led_set_byentity(intf, assoc->entity_id_1, i, ledtype, ledmode);
/* second range set - id 3 and 4 must be equal */
if (assoc->entity_id_3 == assoc->entity_id_4)
for (i = assoc->entity_inst_3; i <= assoc->entity_inst_4; i++)
sunoem_led_set_byentity(intf, assoc->entity_id_3, i, ledtype, ledmode);
}
else {
/*
* handle entity list
*/
sunoem_led_set_byentity(intf, assoc->entity_id_1,
assoc->entity_inst_1, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_2,
assoc->entity_inst_2, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_3,
assoc->entity_inst_3, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_4,
assoc->entity_inst_4, ledtype, ledmode);
}
}
__sdr_list_empty(alist);
return 0;
}
static int
ipmi_sunoem_sshkey_del(struct ipmi_intf * intf, uint8_t uid)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_DEL_SSH_KEY;
req.msg.data = &uid;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d", uid);
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d: %s", uid,
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Deleted SSH key for user id %d\n", uid);
return 0;
}
#define SSHKEY_BLOCK_SIZE 64
static int
ipmi_sunoem_sshkey_set(struct ipmi_intf * intf, uint8_t uid, char * ifile)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
FILE * fp;
int count;
uint16_t i_size, r, size;
uint8_t wbuf[SSHKEY_BLOCK_SIZE + 3];
if (ifile == NULL) {
lprintf(LOG_ERR, "Invalid or misisng input filename");
return -1;
}
fp = ipmi_open_file_read(ifile);
if (fp == NULL) {
lprintf(LOG_ERR, "Unable to open file %s for reading", ifile);
return -1;
}
printf("Setting SSH key for user id %d...", uid);
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_SET_SSH_KEY;
req.msg.data = wbuf;
fseek(fp, 0, SEEK_END);
size = ftell(fp);
fseek(fp, 0, SEEK_SET);
for (r = 0; r < size; r += i_size) {
i_size = size - r;
if (i_size > SSHKEY_BLOCK_SIZE)
i_size = SSHKEY_BLOCK_SIZE;
memset(wbuf, 0, SSHKEY_BLOCK_SIZE);
fseek(fp, r, SEEK_SET);
count = fread(wbuf+3, 1, i_size, fp);
if (count != i_size) {
lprintf(LOG_ERR, "Unable to read %d bytes from file %s", i_size, ifile);
fclose(fp);
return -1;
}
printf(".");
fflush(stdout);
wbuf[0] = uid;
if ((r + SSHKEY_BLOCK_SIZE) >= size)
wbuf[1] = 0xff;
else
wbuf[1] = (uint8_t)(r / SSHKEY_BLOCK_SIZE);
wbuf[2] = i_size;
req.msg.data_len = i_size + 3;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to set ssh key for UID %d", uid);
break;
}
}
printf("done\n");
fclose(fp);
return 0;
}
int
ipmi_sunoem_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
if (strncmp(argv[0], "fan", 3) == 0) {
uint8_t pct;
if (argc < 2) {
ipmi_sunoem_usage();
return -1;
}
else if (strncmp(argv[1], "speed", 5) == 0) {
if (argc < 3) {
ipmi_sunoem_usage();
return -1;
}
pct = (uint8_t)strtol(argv[2], NULL, 0);
rc = ipmi_sunoem_fan_speed(intf, pct);
}
else {
ipmi_sunoem_usage();
return -1;
}
}
if ((strncmp(argv[0], "led", 3) == 0) || (strncmp(argv[0], "sbled", 5) == 0)) {
if (argc < 2) {
ipmi_sunoem_usage();
return -1;
}
if (strncmp(argv[0], "sbled", 5) == 0) {
is_sbcmd = 1;
}
if (strncmp(argv[1], "get", 3) == 0) {
if (argc < 3) {
char * arg[] = { "all" };
rc = ipmi_sunoem_led_get(intf, 1, arg);
} else {
rc = ipmi_sunoem_led_get(intf, argc-2, &(argv[2]));
}
}
else if (strncmp(argv[1], "set", 3) == 0) {
if (argc < 4) {
ipmi_sunoem_usage();
return -1;
}
rc = ipmi_sunoem_led_set(intf, argc-2, &(argv[2]));
}
else {
ipmi_sunoem_usage();
return -1;
}
}
if (strncmp(argv[0], "sshkey", 6) == 0) {
if (argc < 2) {
ipmi_sunoem_usage();
return -1;
}
else if (strncmp(argv[1], "del", 3) == 0) {
uint8_t uid;
if (argc < 3) {
ipmi_sunoem_usage();
return -1;
}
uid = (uint8_t)strtoul(argv[2], NULL, 0);
rc = ipmi_sunoem_sshkey_del(intf, uid);
}
else if (strncmp(argv[1], "set", 3) == 0) {
uint8_t uid;
if (argc < 4) {
ipmi_sunoem_usage();
return -1;
}
uid = (uint8_t)strtoul(argv[2], NULL, 0);
rc = ipmi_sunoem_sshkey_set(intf, uid, argv[3]);
}
}
return rc;
}

588
ipmitool/lib/ipmi_tsol.c Normal file
View File

@ -0,0 +1,588 @@
/*
* Copyright (c) 2005 Tyan Computer Corp. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/poll.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <signal.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined(HAVE_TERMIOS_H)
# include <termios.h>
#elif defined (HAVE_SYS_TERMIOS_H)
# include <sys/termios.h>
#endif
#include <ipmitool/log.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_tsol.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/bswap.h>
static struct timeval _start_keepalive;
static struct termios _saved_tio;
static struct winsize _saved_winsize;
static int _in_raw_mode = 0;
static int _altterm = 0;
extern int verbose;
static int
ipmi_tsol_command(struct ipmi_intf * intf, char *recvip, int port, unsigned char cmd)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
unsigned char data[6];
unsigned ip1, ip2, ip3, ip4;
if (sscanf(recvip, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4) != 4) {
lprintf(LOG_ERR, "Invalid IP address: %s", recvip);
return -1;
}
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_TSOL;
req.msg.cmd = cmd;
req.msg.data_len = 6;
req.msg.data = data;
memset(data, 0, sizeof(data));
data[0] = ip1;
data[1] = ip2;
data[2] = ip3;
data[3] = ip4;
data[4] = (port & 0xff00) >> 8;
data[5] = (port & 0xff);
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to perform TSOL command");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to perform TSOL command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
return 0;
}
static int
ipmi_tsol_start(struct ipmi_intf * intf, char *recvip, int port)
{
return ipmi_tsol_command(intf, recvip, port, IPMI_TSOL_CMD_START);
}
static int
ipmi_tsol_stop(struct ipmi_intf * intf, char *recvip, int port)
{
return ipmi_tsol_command(intf, recvip, port, IPMI_TSOL_CMD_STOP);
}
static int
ipmi_tsol_send_keystroke(struct ipmi_intf * intf, char *buff, int length)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char data[16];
static unsigned char keyseq = 0;
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_TSOL;
req.msg.cmd = IPMI_TSOL_CMD_SENDKEY;
req.msg.data_len = length + 2;
req.msg.data = data;
memset(data, 0, sizeof(data));
data[0] = length + 1;
memcpy(data + 1, buff, length);
data[length + 1] = keyseq++;
rsp = intf->sendrecv(intf, &req);
if (verbose) {
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to send keystroke");
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to send keystroke: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
}
return length;
}
static int
tsol_keepalive(struct ipmi_intf * intf)
{
struct timeval end;
gettimeofday(&end, 0);
if (end.tv_sec - _start_keepalive.tv_sec <= 30)
return 0;
intf->keepalive(intf);
gettimeofday(&_start_keepalive, 0);
return 0;
}
static void
print_escape_seq(struct ipmi_intf *intf)
{
lprintf(LOG_NOTICE,
" %c. - terminate connection\r\n"
" %c^Z - suspend ipmitool\r\n"
" %c^X - suspend ipmitool, but don't restore tty on restart\r\n"
" %c? - this message\r\n"
" %c%c - send the escape character by typing it twice\r\n"
" (Note that escapes are only recognized immediately after newline.)\r",
intf->session->sol_escape_char,
intf->session->sol_escape_char,
intf->session->sol_escape_char,
intf->session->sol_escape_char,
intf->session->sol_escape_char,
intf->session->sol_escape_char);
}
static int
leave_raw_mode(void)
{
if (!_in_raw_mode)
return -1;
else if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1)
lperror(LOG_ERR, "tcsetattr(stdin)");
else if (tcsetattr(fileno(stdout), TCSADRAIN, &_saved_tio) == -1)
lperror(LOG_ERR, "tcsetattr(stdout)");
else
_in_raw_mode = 0;
return 0;
}
static int
enter_raw_mode(void)
{
struct termios tio;
if (tcgetattr(fileno(stdout), &_saved_tio) < 0) {
lperror(LOG_ERR, "tcgetattr failed");
return -1;
}
tio = _saved_tio;
if (_altterm) {
tio.c_iflag &= (ISTRIP | IGNBRK );
tio.c_cflag &= ~(CSIZE | PARENB | IXON | IXOFF | IXANY);
tio.c_cflag |= (CS8 |CREAD) | (IXON|IXOFF|IXANY);
tio.c_lflag &= 0;
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 0;
} else {
tio.c_iflag |= IGNPAR;
tio.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF);
tio.c_lflag &= ~(ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL | IEXTEN);
tio.c_oflag &= ~OPOST;
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 0;
}
if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) < 0)
lperror(LOG_ERR, "tcsetattr(stdin)");
else if (tcsetattr(fileno(stdout), TCSADRAIN, &tio) < 0)
lperror(LOG_ERR, "tcsetattr(stdout)");
else
_in_raw_mode = 1;
return 0;
}
static void
suspend_self(int restore_tty)
{
leave_raw_mode();
kill(getpid(), SIGTSTP);
if (restore_tty)
enter_raw_mode();
}
static int
do_inbuf_actions(struct ipmi_intf *intf, char *in_buff, int len)
{
static int in_esc = 0;
static int last_was_cr = 1;
int i;
for(i = 0; i < len ;) {
if (!in_esc) {
if (last_was_cr &&
(in_buff[i] == intf->session->sol_escape_char)) {
in_esc = 1;
memmove(in_buff, in_buff + 1, len - i - 1);
len--;
continue;
}
}
if (in_esc) {
if (in_buff[i] == intf->session->sol_escape_char) {
in_esc = 0;
i++;
continue;
}
switch (in_buff[i]) {
case '.':
printf("%c. [terminated ipmitool]\r\n",
intf->session->sol_escape_char);
return -1;
case 'Z' - 64:
printf("%c^Z [suspend ipmitool]\r\n",
intf->session->sol_escape_char);
suspend_self(1); /* Restore tty back to raw */
break;
case 'X' - 64:
printf("%c^X [suspend ipmitool]\r\n",
intf->session->sol_escape_char);
suspend_self(0); /* Don't restore to raw mode */
break;
case '?':
printf("%c? [ipmitool help]\r\n",
intf->session->sol_escape_char);
print_escape_seq(intf);
break;
}
memmove(in_buff, in_buff + 1, len - i - 1);
len--;
in_esc = 0;
continue;
}
last_was_cr = (in_buff[i] == '\r' || in_buff[i] == '\n');
i++;
}
return len;
}
static void
do_terminal_cleanup(void)
{
if (_saved_winsize.ws_row > 0 && _saved_winsize.ws_col > 0)
ioctl(fileno(stdout), TIOCSWINSZ, &_saved_winsize);
leave_raw_mode();
if (errno)
lprintf(LOG_ERR, "Exiting due to error %d -> %s",
errno, strerror(errno));
}
static void
set_terminal_size(int rows, int cols)
{
struct winsize winsize;
if (rows <= 0 || cols <= 0)
return;
/* save initial winsize */
ioctl(fileno(stdout), TIOCGWINSZ, &_saved_winsize);
/* set new winsize */
winsize.ws_row = rows;
winsize.ws_col = cols;
ioctl(fileno(stdout), TIOCSWINSZ, &winsize);
}
static void
print_tsol_usage(void)
{
struct winsize winsize;
lprintf(LOG_NOTICE, "Usage: tsol [recvip] [port=NUM] [ro|rw] [rows=NUM] [cols=NUM] [altterm]");
lprintf(LOG_NOTICE, " recvip Receiver IP Address [default=local]");
lprintf(LOG_NOTICE, " port=NUM Receiver UDP Port [default=%d]",
IPMI_TSOL_DEF_PORT);
lprintf(LOG_NOTICE, " ro|rw Set Read-Only or Read-Write [default=rw]");
ioctl(fileno(stdout), TIOCGWINSZ, &winsize);
lprintf(LOG_NOTICE, " rows=NUM Set terminal rows [default=%d]",
winsize.ws_row);
lprintf(LOG_NOTICE, " cols=NUM Set terminal columns [default=%d]",
winsize.ws_col);
lprintf(LOG_NOTICE, " altterm Alternate terminal setup [default=off]");
}
int
ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
{
struct pollfd fds_wait[3], fds_data_wait[3], *fds;
struct sockaddr_in sin, myaddr;
socklen_t mylen;
char *recvip = NULL;
char out_buff[IPMI_BUF_SIZE * 8], in_buff[IPMI_BUF_SIZE];
char buff[IPMI_BUF_SIZE + 4];
int fd_socket, result, i;
int out_buff_fill, in_buff_fill;
int ip1, ip2, ip3, ip4;
int read_only = 0, rows = 0, cols = 0;
int port = IPMI_TSOL_DEF_PORT;
if (strlen(intf->name) == 3 && strncmp(intf->name, "lan", 3) != 0) {
lprintf(LOG_ERR, "Error: Tyan SOL is only available over lan interface");
return -1;
}
for (i = 0; i<argc; i++) {
if (sscanf(argv[i], "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4) == 4)
recvip = strdup(argv[i]);
else if (sscanf(argv[i], "port=%d", &ip1) == 1)
port = ip1;
else if (sscanf(argv[i], "rows=%d", &ip1) == 1)
rows = ip1;
else if (sscanf(argv[i], "cols=%d", &ip1) == 1)
cols = ip1;
else if (strlen(argv[i]) == 2 && strncmp(argv[i], "ro", 2) == 0)
read_only = 1;
else if (strlen(argv[i]) == 2 && strncmp(argv[i], "rw", 2) == 0)
read_only = 0;
else if (strlen(argv[i]) == 7 && strncmp(argv[i], "altterm", 7) == 0)
_altterm = 1;
else if (strlen(argv[i]) == 4 && strncmp(argv[i], "help", 4) == 0) {
print_tsol_usage();
return 0;
}
else {
print_tsol_usage();
return 0;
}
}
/* create udp socket to receive the packet */
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
result = inet_pton(AF_INET, (const char *)intf->session->hostname,
&intf->session->addr.sin_addr);
if (result <= 0) {
struct hostent *host = gethostbyname((const char *)intf->session->hostname);
if (host == NULL ) {
lprintf(LOG_ERR, "Address lookup for %s failed",
intf->session->hostname);
return -1;
}
intf->session->addr.sin_family = host->h_addrtype;
memcpy(&intf->session->addr.sin_addr, host->h_addr, host->h_length);
}
fd_socket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd_socket < 0) {
lprintf(LOG_ERR, "Can't open port %d", port);
return -1;
}
bind(fd_socket, (struct sockaddr *)&sin, sizeof(sin));
/*
* retrieve local IP address if not supplied on command line
*/
if (recvip == NULL) {
result = intf->open(intf); /* must connect first */
if (result < 0)
return -1;
mylen = sizeof(myaddr);
if (getsockname(intf->fd, (struct sockaddr *)&myaddr, &mylen) < 0) {
lperror(LOG_ERR, "getsockname failed");
return -1;
}
recvip = inet_ntoa(myaddr.sin_addr);
if (recvip == NULL) {
lprintf(LOG_ERR, "Unable to find local IP address");
return -1;
}
}
printf("[Starting %sSOL with receiving address %s:%d]\r\n",
read_only ? "Read-only " : "", recvip, port);
set_terminal_size(rows, cols);
enter_raw_mode();
/*
* talk to smdc to start Console redirect - IP address and port as parameter
* ipmitool -I lan -H 192.168.168.227 -U Administrator raw 0x30 0x06 0xC0 0xA8 0xA8 0x78 0x1A 0x0A
*/
result = ipmi_tsol_start(intf, recvip, port);
if (result < 0) {
lprintf(LOG_ERR, "Error starting SOL");
return -1;
}
printf("[SOL Session operational. Use %c? for help]\r\n",
intf->session->sol_escape_char);
gettimeofday(&_start_keepalive, 0);
fds_wait[0].fd = fd_socket;
fds_wait[0].events = POLLIN;
fds_wait[0].revents = 0;
fds_wait[1].fd = fileno(stdin);
fds_wait[1].events = POLLIN;
fds_wait[1].revents = 0;
fds_wait[2].fd = -1;
fds_wait[2].events = 0;
fds_wait[2].revents = 0;
fds_data_wait[0].fd = fd_socket;
fds_data_wait[0].events = POLLIN | POLLOUT;
fds_data_wait[0].revents = 0;
fds_data_wait[1].fd = fileno(stdin);
fds_data_wait[1].events = POLLIN;
fds_data_wait[1].revents = 0;
fds_data_wait[2].fd = fileno(stdout);
fds_data_wait[2].events = POLLOUT;
fds_data_wait[2].revents = 0;
out_buff_fill = 0;
in_buff_fill = 0;
fds = fds_wait;
for (;;) {
result = poll(fds, 3, 15*1000);
if (result < 0)
break;
/* send keepalive packet */
tsol_keepalive(intf);
if ((fds[0].revents & POLLIN) && (sizeof(out_buff) > out_buff_fill)){
socklen_t sin_len = sizeof(sin);
result = recvfrom(fd_socket, buff, sizeof(out_buff) - out_buff_fill + 4, 0,
(struct sockaddr *)&sin, &sin_len);
/* read the data from udp socket, skip some bytes in the head */
if((result - 4) > 0 ){
int length = result - 4;
#if 1
length = (unsigned char)buff[2] & 0xff;
length *= 256;
length += ((unsigned char)buff[3] & 0xff);
if ((length <= 0) || (length > (result - 4)))
length = result - 4;
#endif
memcpy(out_buff + out_buff_fill, buff + 4, length);
out_buff_fill += length;
}
}
if ((fds[1].revents & POLLIN) && (sizeof(in_buff) > in_buff_fill)) {
result = read(fileno(stdin), in_buff + in_buff_fill,
sizeof(in_buff) - in_buff_fill); // read from keyboard
if (result > 0) {
int bytes;
bytes = do_inbuf_actions(intf, in_buff + in_buff_fill, result);
if(bytes < 0) {
result = ipmi_tsol_stop(intf, recvip, port);
do_terminal_cleanup();
return result;
}
if (read_only)
bytes = 0;
in_buff_fill += bytes;
}
}
if ((fds[2].revents & POLLOUT) && out_buff_fill) {
result = write(fileno(stdout), out_buff, out_buff_fill); // to screen
if (result > 0) {
out_buff_fill -= result;
if (out_buff_fill) {
memmove(out_buff, out_buff + result, out_buff_fill);
}
}
}
if ((fds[0].revents & POLLOUT) && in_buff_fill) {
/*
* translate key and send that to SMDC using IPMI
* ipmitool -I lan -H 192.168.168.227 -U Administrator raw 0x30 0x03 0x04 0x1B 0x5B 0x43
*/
result = ipmi_tsol_send_keystroke(intf, in_buff, __min(in_buff_fill,14));
if (result > 0) {
gettimeofday(&_start_keepalive, 0);
in_buff_fill -= result;
if (in_buff_fill) {
memmove(in_buff, in_buff + result, in_buff_fill);
}
}
}
fds = (in_buff_fill || out_buff_fill )?
fds_data_wait : fds_wait;
}
return 0;
}

View File

@ -28,22 +28,19 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_user.h>
@ -75,15 +72,14 @@ extern int csv_output;
*/
static int
ipmi_get_user_access(
struct ipmi_intf * intf,
unsigned char channel_number,
unsigned char user_id,
struct user_access_rsp * user_access)
struct ipmi_intf *intf,
uint8_t channel_number,
uint8_t user_id,
struct user_access_rsp *user_access)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char msg_data[2];
uint8_t msg_data[2];
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
@ -95,13 +91,18 @@ ipmi_get_user_access(
/* The channel number will remain constant throughout this function */
msg_data[0] = channel_number;
msg_data[1] = user_id;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
{
printf("Error:%x Get User Access Command (user 0x%x)\n",
rsp ? rsp->ccode : 0, msg_data[1]);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get User Access command failed "
"(channel %d, user %d)", channel_number, user_id);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get User Access command failed "
"(channel %d, user %d): %s", channel_number, user_id,
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -127,29 +128,36 @@ ipmi_get_user_access(
*/
static int
ipmi_get_user_name(
struct ipmi_intf * intf,
unsigned char user_id,
char * user_name)
struct ipmi_intf *intf,
uint8_t user_id,
char *user_name)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char msg_data[1];
uint8_t msg_data[1];
memset(user_name, 0, 17);
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
req.msg.cmd = IPMI_GET_USER_NAME; /* 0x45 */
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
req.msg.cmd = IPMI_GET_USER_NAME; /* 0x45 */
req.msg.data = msg_data;
req.msg.data_len = 1;
msg_data[0] = user_id;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
{
printf("Error:%x Get User Name Command (user 0x%x)\n",
rsp ? rsp->ccode : 0, msg_data[0]);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get User Name command failed (user %d)",
user_id);
return -1;
}
if (rsp->ccode > 0) {
if (rsp->ccode == 0xcc)
return 0;
lprintf(LOG_ERR, "Get User Name command failed (user %d): %s",
user_id, val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -163,7 +171,7 @@ ipmi_get_user_name(
static void
dump_user_access(
unsigned char user_id,
uint8_t user_id,
const char * user_name,
struct user_access_rsp * user_access)
{
@ -175,7 +183,6 @@ dump_user_access(
"Channel Priv Limit\n");
printed_header = 1;
}
printf("%-4d%-17s%-8s%-11s%-11s%-s\n",
user_id,
@ -191,9 +198,9 @@ dump_user_access(
static void
dump_user_access_csv(
unsigned char user_id,
const char * user_name,
struct user_access_rsp * user_access)
uint8_t user_id,
const char *user_name,
struct user_access_rsp *user_access)
{
printf("%d,%s,%s,%s,%s,%s\n",
user_id,
@ -209,13 +216,13 @@ dump_user_access_csv(
static int
ipmi_print_user_list(
struct ipmi_intf * intf,
unsigned char channel_number)
struct ipmi_intf *intf,
uint8_t channel_number)
{
/* This is where you were! */
char user_name[17];
struct user_access_rsp user_access;
unsigned char current_user_id = 1;
uint8_t current_user_id = 1;
do
@ -231,8 +238,7 @@ ipmi_print_user_list(
current_user_id,
user_name))
return -1;
if ((current_user_id == 0) ||
user_access.link_auth_access ||
user_access.ipmi_messaging_access ||
@ -249,8 +255,8 @@ ipmi_print_user_list(
++current_user_id;
} while((current_user_id < user_access.maximum_ids) &&
(current_user_id < 63)); /* Absolute maximum allowed by spec */
} while((current_user_id <= user_access.maximum_ids) &&
(current_user_id <= 63)); /* Absolute maximum allowed by spec */
return 0;
@ -261,7 +267,7 @@ ipmi_print_user_list(
static int
ipmi_print_user_summary(
struct ipmi_intf * intf,
unsigned char channel_number)
uint8_t channel_number)
{
struct user_access_rsp user_access;
@ -298,13 +304,13 @@ ipmi_print_user_summary(
*/
static int
ipmi_user_set_username(
struct ipmi_intf * intf,
unsigned char user_id,
const char * name)
struct ipmi_intf *intf,
uint8_t user_id,
const char *name)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char msg_data[17];
uint8_t msg_data[17];
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
@ -316,22 +322,65 @@ ipmi_user_set_username(
/* The channel number will remain constant throughout this function */
msg_data[0] = user_id;
memset(msg_data + 1, 0, 16);
strcpy(msg_data + 1, name);
strcpy((char *)(msg_data + 1), name);
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
{
printf("Error:%x Set User Name Command\n",
rsp ? rsp->ccode : 0);
if (rsp == NULL) {
lprintf(LOG_ERR, "Set User Name command failed (user %d, name %s)",
user_id, name);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set User Name command failed (user %d, name %s): %s",
user_id, name, val2str(rsp->ccode, completion_code_vals));
return -1;
}
return 0;
}
static int
ipmi_user_set_userpriv(
struct ipmi_intf *intf,
uint8_t channel,
uint8_t user_id,
const unsigned char privLevel)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
uint8_t msg_data[4];
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; /* 0x06 */
req.msg.cmd = IPMI_SET_USER_ACCESS; /* 0x43 */
req.msg.data = msg_data;
req.msg.data_len = 4;
/* The channel number will remain constant throughout this function */
msg_data[0] = (channel & 0x0f);
msg_data[0] |= 0x90; /* enable ipmi messaging */
msg_data[1] = (user_id & 0x3f);
msg_data[2] = (privLevel & 0x0f);
msg_data[3] = 0;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
lprintf(LOG_ERR, "Set Privilege Level command failed (user %d)",
user_id);
return -1;
}
if (rsp->ccode > 0)
{
lprintf(LOG_ERR, "Set Privilege Level command failed (user %d): %s",
user_id, val2str(rsp->ccode, completion_code_vals));
return -1;
}
return 0;
}
/*
* ipmi_user_set_password
@ -342,20 +391,19 @@ ipmi_user_set_username(
*/
static int
ipmi_user_set_password(
struct ipmi_intf * intf,
unsigned char user_id,
unsigned char operation,
const char * password,
int is_twenty_byte_password)
struct ipmi_intf * intf,
uint8_t user_id,
uint8_t operation,
const char *password,
int is_twenty_byte_password)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
char * msg_data;
int ret = 0;
uint8_t * msg_data;
int password_length = (is_twenty_byte_password? 20 : 16);
msg_data = (char*)malloc(password_length + 2);
msg_data = (uint8_t*)malloc(password_length + 2);
memset(&req, 0, sizeof(req));
@ -367,28 +415,31 @@ ipmi_user_set_password(
/* The channel number will remain constant throughout this function */
msg_data[0] = user_id;
if (is_twenty_byte_password)
msg_data[0] |= 0x80;
msg_data[1] = operation;
memset(msg_data + 2, 0, password_length);
if (password)
strncpy(msg_data + 2, password, password_length);
if (password != NULL)
strncpy((char *)(msg_data + 2), password, password_length);
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode)
{
printf("Error:%x Set User Password Command\n",
rsp ? rsp->ccode : 0);
ret = (rsp? rsp->ccode : -1);
if (rsp == NULL) {
lprintf(LOG_ERR, "Set User Password command failed (user %d)",
user_id);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set User Password command failed (user %d): %s",
user_id, val2str(rsp->ccode, completion_code_vals));
return rsp->ccode;
}
return ret;
return 0;
}
@ -401,7 +452,7 @@ ipmi_user_set_password(
static int
ipmi_user_test_password(
struct ipmi_intf * intf,
unsigned char user_id,
uint8_t user_id,
const char * password,
int is_twenty_byte_password)
{
@ -413,45 +464,47 @@ ipmi_user_test_password(
password,
is_twenty_byte_password);
if (! ret)
switch (ret) {
case 0:
printf("Success\n");
else if (ret == 0x80)
break;
case 0x80:
printf("Failure: password incorrect\n");
else if (ret == 0x81)
break;
case 0x81:
printf("Failure: wrong password size\n");
else
break;
default:
printf("Unknown error\n");
}
return (ret ? -1 : 0);
return ((ret == 0) ? 0 : -1);
}
/*
* print_user_usage
*/
void
print_user_usage()
static void
print_user_usage(void)
{
printf("\n");
printf("User Commands: summary [<channel number>]\n");
printf(" list [<channel number>]\n");
printf(" set name <user id> <username>\n");
printf(" set password <user id> [<password>]\n");
printf(" disable <user id> [<channel number>]\n");
printf(" enable <user id> [<channel number>]\n");
printf(" test <user id> <16|20> [<password]>\n");
printf("\n");
lprintf(LOG_NOTICE, "User Commands: summary [<channel number>]");
lprintf(LOG_NOTICE, " list [<channel number>]");
lprintf(LOG_NOTICE, " set name <user id> <username>");
lprintf(LOG_NOTICE, " set password <user id> [<password>]");
lprintf(LOG_NOTICE, " disable <user id>");
lprintf(LOG_NOTICE, " enable <user id>");
lprintf(LOG_NOTICE, " priv <user id> <privilege level> [<channel number>]");
lprintf(LOG_NOTICE, " test <user id> <16|20> [<password]>\n");
}
const char *
ipmi_user_build_password_prompt(unsigned char user_id)
ipmi_user_build_password_prompt(uint8_t user_id)
{
static char prompt[128];
sprintf(prompt, "Password for user %d: ", user_id);
memset(prompt, 0, 128);
snprintf(prompt, 128, "Password for user %d: ", user_id);
return prompt;
}
@ -467,27 +520,28 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int retval = 0;
ipmi_intf_session_set_privlvl(intf, IPMI_SESSION_PRIV_ADMIN);
/*
* Help
*/
if (!argc || !strncmp(argv[0], "help", 4))
if (argc == 0 || strncmp(argv[0], "help", 4) == 0)
{
print_user_usage();
}
/*
* Summary
*/
else if (!strncmp(argv[0], "summary", 7)) {
unsigned char channel;
else if (strncmp(argv[0], "summary", 7) == 0)
{
uint8_t channel;
if (argc == 1)
channel = 0x0E; /* Ask about the current channel */
else if (argc == 2)
channel = (unsigned char)strtol(argv[1], NULL, 0);
channel = (uint8_t)strtol(argv[1], NULL, 0);
else
{
print_user_usage();
print_user_usage();
return -1;
}
@ -498,16 +552,17 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
/*
* List
*/
else if (!strncmp(argv[0], "list", 4)) {
unsigned char channel;
else if (strncmp(argv[0], "list", 4) == 0)
{
uint8_t channel;
if (argc == 1)
channel = 0x0E; /* Ask about the current channel */
else if (argc == 2)
channel = (unsigned char)strtol(argv[1], NULL, 0);
channel = (uint8_t)strtol(argv[1], NULL, 0);
else
{
print_user_usage();
print_user_usage();
return -1;
}
@ -519,21 +574,21 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
/*
* Test
*/
else if (!strncmp(argv[0], "test", 4))
else if (strncmp(argv[0], "test", 4) == 0)
{
// a little fucking irritating, isn't it
if ((argc == 3 || argc == 4) &&
((!strncmp(argv[2], "16", 2)) ||
(!strncmp(argv[2], "20", 2))))
((strncmp(argv[2], "16", 2) == 0) ||
(strncmp(argv[2], "20", 2) == 0)))
{
char * password = NULL;
int password_length = atoi(argv[2]);
unsigned char user_id = (unsigned char)strtol(argv[1],
NULL,
0);
if (! user_id)
uint8_t user_id = (uint8_t)strtol(argv[1],
NULL,
0);
if (user_id == 0)
{
printf("Error. Invalid user ID: %d\n", user_id);
lprintf(LOG_ERR, "Invalid user ID: %d", user_id);
return -1;
}
@ -545,22 +600,22 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
char * tmp;
const char * password_prompt =
ipmi_user_build_password_prompt(user_id);
#ifdef HAVE_GETPASSPHRASE
if ((tmp = getpassphrase (password_prompt)))
tmp = getpassphrase (password_prompt);
#else
if ((tmp = (char*)getpass(password_prompt)))
tmp = (char*)getpass (password_prompt);
#endif
{
if (tmp != NULL)
password = strdup(tmp);
if (password == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return -1;
}
}
else
password = argv[3];
retval = ipmi_user_test_password(intf,
user_id,
password,
@ -575,25 +630,24 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
}
}
/*
* Set
*/
else if (!strncmp(argv[0], "set", 3))
else if (strncmp(argv[0], "set", 3) == 0)
{
/*
* Set Password
*/
if ((argc >= 3) &&
(! strcmp("password", argv[1])))
(strncmp("password", argv[1], 8) == 0))
{
char * password = NULL;
unsigned char user_id = (unsigned char)strtol(argv[2],
NULL,
0);
if (! user_id)
uint8_t user_id = (uint8_t)strtol(argv[2],
NULL,
0);
if (user_id == 0)
{
printf("Error. Invalid user ID: %d\n", user_id);
lprintf(LOG_ERR, "Invalid user ID: %d", user_id);
return -1;
}
@ -607,25 +661,36 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
ipmi_user_build_password_prompt(user_id);
#ifdef HAVE_GETPASSPHRASE
if ((tmp = getpassphrase (password_prompt)))
tmp = getpassphrase (password_prompt);
#else
if ((tmp = (char*)getpass (password_prompt)))
tmp = (char*)getpass (password_prompt);
#endif
if (tmp != NULL)
{
password = strdup(tmp);
if (password == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return -1;
}
#ifdef HAVE_GETPASSPHRASE
if ((tmp = getpassphrase (password_prompt)))
tmp = getpassphrase (password_prompt);
#else
if ((tmp = (char*)getpass (password_prompt)))
tmp = (char*)getpass (password_prompt);
#endif
if (tmp != NULL)
{
if (strlen(password) != strlen(tmp))
{
if (strcmp(password, tmp))
{
printf("Error. Passwords to not match.\n");
return -1;
}
lprintf(LOG_ERR, "Passwords do not match");
return -1;
}
if (strncmp(password, tmp, strlen(tmp)))
{
lprintf(LOG_ERR, "Passwords to not match");
return -1;
}
}
}
}
else
@ -633,10 +698,9 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
if (strlen(password) > 20)
{
printf("Error. Password is too long (> 20 bytes).\n");
lprintf(LOG_ERR, "Password is too long (> 20 bytes)");
return -1;
}
retval = ipmi_user_set_password(intf,
user_id,
@ -644,13 +708,12 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
password,
strlen(password) > 16);
}
/*
* Set Name
*/
else if ((argc >= 2) &&
(! strcmp("name", argv[1])))
(strncmp("name", argv[1], 4) == 0))
{
if (argc != 4)
{
@ -659,9 +722,9 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
}
retval = ipmi_user_set_username(intf,
(unsigned char)strtol(argv[2],
NULL,
0),
(uint8_t)strtol(argv[2],
NULL,
0),
argv[3]);
}
else
@ -671,15 +734,45 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
}
}
else if (strncmp(argv[0], "priv", 4) == 0)
{
uint8_t user_id;
uint8_t priv_level;
uint8_t channel = 0x0e; /* Use channel running on */
if (argc != 3 && argc != 4)
{
print_user_usage();
return -1;
}
if (argc == 4)
{
channel = (uint8_t)strtol(argv[3], NULL, 0);
channel = (channel & 0x0f);
}
user_id = (uint8_t)strtol(argv[1], NULL, 0);
priv_level = (uint8_t)strtol(argv[2], NULL, 0);
priv_level = (priv_level & 0x0f);
if (user_id == 0)
{
lprintf(LOG_ERR, "Invalid user ID: %d", user_id);
return -1;
}
retval = ipmi_user_set_userpriv(intf,channel,user_id,priv_level);
}
/*
* Disable / Enable
*/
else if ((!strncmp(argv[0], "disable", 7)) ||
(!strncmp(argv[0], "enable", 6)))
else if ((strncmp(argv[0], "disable", 7) == 0) ||
(strncmp(argv[0], "enable", 6) == 0))
{
unsigned char user_id;
unsigned char operation;
uint8_t user_id;
uint8_t operation;
char null_password[16]; /* Not used, but required */
memset(null_password, 0, sizeof(null_password));
@ -690,18 +783,18 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
return -1;
}
user_id = (unsigned char)strtol(argv[1],
NULL,
0);
if (! user_id)
user_id = (uint8_t)strtol(argv[1],
NULL,
0);
if (user_id == 0)
{
printf("Error. Invalid user ID: %d\n", user_id);
lprintf(LOG_ERR, "Invalid user ID: %d", user_id);
return -1;
}
operation = (!strncmp(argv[0], "disable", 7))?
IPMI_PASSWORD_DISABLE_USER: IPMI_PASSWORD_ENABLE_USER;
operation = (strncmp(argv[0], "disable", 7) == 0) ?
IPMI_PASSWORD_DISABLE_USER : IPMI_PASSWORD_ENABLE_USER;
retval = ipmi_user_set_password(intf,
user_id,
@ -709,13 +802,11 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
null_password,
0); /* This field is ignored */
}
else
{
print_user_usage();
retval = -1;
lprintf(LOG_ERR, "Invalid user command: '%s'\n", argv[0]);
print_user_usage();
}
return retval;

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <unistd.h>
@ -74,7 +70,7 @@ void lprintf(int level, const char * format, ...)
if (logpriv->daemon)
syslog(level, "%s", logmsg);
else
printf("%s\n", logmsg);
fprintf(stderr, "%s\r\n", logmsg);
return;
}
@ -96,7 +92,7 @@ void lperror(int level, const char * format, ...)
if (logpriv->daemon)
syslog(level, "%s: %s", logmsg, strerror(errno));
else
fprintf(stderr, "%s: %s\n", logmsg, strerror(errno));
fprintf(stderr, "%s: %s\r\n", logmsg, strerror(errno));
return;
}
@ -116,6 +112,9 @@ void log_init(const char * name, int isdaemon, int verbose)
logpriv->name = strdup(name);
else
logpriv->name = strdup(LOG_NAME_DEFAULT);
if (logpriv->name == NULL)
fprintf(stderr, "ipmitool: malloc failure\r\n");
logpriv->daemon = isdaemon;
logpriv->level = verbose + LOG_NOTICE;
@ -140,6 +139,7 @@ void log_halt(void)
closelog();
free(logpriv);
logpriv = NULL;
}
int log_level_get(void)

View File

@ -27,10 +27,6 @@
# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed or intended for use
# in the design, construction, operation or maintenance of any nuclear
# facility.
INCLUDES = -I$(top_srcdir)/include
SUBDIRS = plugins
@ -40,12 +36,8 @@ MAINTAINERCLEANFILES = Makefile.in
ipmitool_SOURCES = ipmitool.c ipmishell.c
ipmitool_LDADD = $(top_builddir)/lib/libipmitool.la plugins/libintf.la
if IPMIEVD
ipmievd_SOURCES = ipmievd.c
ipmievd_LDADD = $(top_builddir)/lib/libipmitool.la plugins/libintf.la
endif
EXTRA_DIST = ipmievd.c
bin_PROGRAMS = ipmitool @IPMIEVD_BIN@
EXTRA_PROGRAMS = ipmitool ipmievd
bin_PROGRAMS = ipmitool
sbin_PROGRAMS = ipmievd

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdio.h>
@ -44,93 +40,285 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/poll.h>
#include <signal.h>
#include <config.h>
#ifdef HAVE_OPENIPMI_H
# include <linux/ipmi.h>
#else
# include "plugins/open/open.h"
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#ifdef HAVE_PATHS_H
# include <paths.h>
#else
# define _PATH_VARRUN "/var/run/"
#endif
#ifdef IPMI_INTF_OPEN
# if defined(HAVE_OPENIPMI_H)
# if defined(HAVE_LINUX_COMPILER_H)
# include <linux/compiler.h>
# endif
# include <linux/ipmi.h>
# elif defined(HAVE_FREEBSD_IPMI_H)
# include <sys/ipmi.h>
# else
# include "plugins/open/open.h"
# endif
# include <sys/poll.h>
#endif /* IPMI_INTF_OPEN */
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_sel.h>
#include <ipmitool/ipmi_sdr.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_main.h>
extern int errno;
#define DEFAULT_PIDFILE _PATH_VARRUN "ipmievd.pid"
char pidfile[64];
/* global variables */
int verbose = 0;
int csv_output = 0;
uint16_t selwatch_count = 0; /* number of entries in the SEL */
uint16_t selwatch_lastid = 0; /* current last entry in the SEL */
int selwatch_timeout = 10; /* default to 10 seconds */
static void daemonize(void)
/* event interface definition */
struct ipmi_event_intf {
char name[16];
char desc[128];
char prefix[72];
int (*setup)(struct ipmi_event_intf * eintf);
int (*wait)(struct ipmi_event_intf * eintf);
int (*read)(struct ipmi_event_intf * eintf);
int (*check)(struct ipmi_event_intf * eintf);
void (*log)(struct ipmi_event_intf * eintf, struct sel_event_record * evt);
struct ipmi_intf * intf;
};
static void log_event(struct ipmi_event_intf * eintf, struct sel_event_record * evt);
/* ~~~~~~~~~~~~~~~~~~~~~~ openipmi ~~~~~~~~~~~~~~~~~~~~ */
#ifdef IPMI_INTF_OPEN
static int openipmi_setup(struct ipmi_event_intf * eintf);
static int openipmi_wait(struct ipmi_event_intf * eintf);
static int openipmi_read(struct ipmi_event_intf * eintf);
static struct ipmi_event_intf openipmi_event_intf = {
name: "open",
desc: "OpenIPMI asyncronous notification of events",
prefix: "",
setup: openipmi_setup,
wait: openipmi_wait,
read: openipmi_read,
log: log_event,
};
#endif
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~ selwatch ~~~~~~~~~~~~~~~~~~~~ */
static int selwatch_setup(struct ipmi_event_intf * eintf);
static int selwatch_wait(struct ipmi_event_intf * eintf);
static int selwatch_read(struct ipmi_event_intf * eintf);
static int selwatch_check(struct ipmi_event_intf * eintf);
static struct ipmi_event_intf selwatch_event_intf = {
name: "sel",
desc: "Poll SEL for notification of events",
setup: selwatch_setup,
wait: selwatch_wait,
read: selwatch_read,
check: selwatch_check,
log: log_event,
};
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
struct ipmi_event_intf * ipmi_event_intf_table[] = {
#ifdef IPMI_INTF_OPEN
&openipmi_event_intf,
#endif
&selwatch_event_intf,
NULL
};
/*************************************************************************/
static void
ipmievd_usage(void)
{
pid_t pid;
int fd;
#ifdef SIGHUP
sigset_t sighup;
#endif
/* if we are started from init no need to become daemon */
if (getppid() == 1)
return;
#ifdef SIGHUP
sigemptyset(&sighup);
sigaddset(&sighup, SIGHUP);
if (sigprocmask(SIG_UNBLOCK, &sighup, nil) < 0)
fprintf(stderr, "ERROR: could not unblock SIGHUP signal\n");
SIG_IGNORE(SIGHUP);
#endif
#ifdef SIGTTOU
SIG_IGNORE(SIGTTOU);
#endif
#ifdef SIGTTIN
SIG_IGNORE(SIGTTIN);
#endif
#ifdef SIGQUIT
SIG_IGNORE(SIGQUIT);
#endif
#ifdef SIGTSTP
SIG_IGNORE(SIGTSTP);
#endif
pid = (pid_t) fork();
if (pid < 0 || pid > 0)
exit(0);
#if defined(SIGTSTP) && defined(TIOCNOTTY)
if (setpgid(0, getpid()) == -1)
exit(1);
if ((fd = open(_PATH_TTY, O_RDWR)) >= 0) {
ioctl(fd, TIOCNOTTY, NULL);
close(fd);
}
#else
if (setpgrp() == -1)
exit(1);
pid = (pid_t) fork();
if (pid < 0 || pid > 0)
exit(0);
#endif
chdir("/");
umask(0);
for (fd=0; fd<64; fd++)
close(fd);
open("/dev/null", O_RDWR);
dup(0);
dup(0);
lprintf(LOG_NOTICE, "Options:");
lprintf(LOG_NOTICE, "\ttimeout=# Time between checks for SEL polling method [default=10]");
lprintf(LOG_NOTICE, "\tdaemon Become a daemon [default]");
lprintf(LOG_NOTICE, "\tnodaemon Do NOT become a daemon");
}
static int enable_event_msg_buffer(struct ipmi_intf * intf)
/* ipmi_intf_load - Load an event interface from the table above
* If no interface name is given return first entry
*
* @name: interface name to try and load
*
* returns pointer to inteface structure if found
* returns NULL on error
*/
static struct ipmi_event_intf *
ipmi_event_intf_load(char * name)
{
struct ipmi_event_intf ** intf;
struct ipmi_event_intf * i;
if (name == NULL) {
i = ipmi_event_intf_table[0];
return i;
}
for (intf = ipmi_event_intf_table;
((intf != NULL) && (*intf != NULL));
intf++) {
i = *intf;
if (strncmp(name, i->name, strlen(name)) == 0) {
return i;
}
}
return NULL;
}
static void
log_event(struct ipmi_event_intf * eintf, struct sel_event_record * evt)
{
char *desc;
const char *type;
struct sdr_record_list * sdr;
struct ipmi_intf * intf = eintf->intf;
float trigger_reading = 0.0;
float threshold_reading = 0.0;
if (evt == NULL)
return;
if (evt->record_type == 0xf0) {
lprintf(LOG_ALERT, "%sLinux kernel panic: %.11s",
eintf->prefix, (char *) evt + 5);
return;
}
else if (evt->record_type >= 0xc0) {
lprintf(LOG_NOTICE, "%sIPMI Event OEM Record %02x",
eintf->prefix, evt->record_type);
return;
}
type = ipmi_sel_get_sensor_type_offset(evt->sel_type.standard_type.sensor_type,
evt->sel_type.standard_type.event_data[0]);
ipmi_get_event_desc(intf, evt, &desc);
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sel_type.standard_type.sensor_num,
evt->sel_type.standard_type.sensor_type);
if (sdr == NULL) {
/* could not find matching SDR record */
if (desc) {
lprintf(LOG_NOTICE, "%s%s sensor - %s",
eintf->prefix, type, desc);
free(desc);
} else {
lprintf(LOG_NOTICE, "%s%s sensor %02x",
eintf->prefix, type,
evt->sel_type.standard_type.sensor_num);
}
return;
}
switch (sdr->type) {
case SDR_RECORD_TYPE_FULL_SENSOR:
if (evt->sel_type.standard_type.event_type == 1) {
/*
* Threshold Event
*/
/* trigger reading in event data byte 2 */
if (((evt->sel_type.standard_type.event_data[0] >> 6) & 3) == 1) {
trigger_reading = sdr_convert_sensor_reading(
sdr->record.full, evt->sel_type.standard_type.event_data[1]);
}
/* trigger threshold in event data byte 3 */
if (((evt->sel_type.standard_type.event_data[0] >> 4) & 3) == 1) {
threshold_reading = sdr_convert_sensor_reading(
sdr->record.full, evt->sel_type.standard_type.event_data[2]);
}
lprintf(LOG_NOTICE, "%s%s sensor %s %s (Reading %.*f %s Threshold %.*f %s)",
eintf->prefix,
type,
sdr->record.full->id_string,
desc ? : "",
(trigger_reading==(int)trigger_reading) ? 0 : 2,
trigger_reading,
((evt->sel_type.standard_type.event_data[0] & 0xf) % 2) ? ">" : "<",
(threshold_reading==(int)threshold_reading) ? 0 : 2,
threshold_reading,
ipmi_sdr_get_unit_string(sdr->record.full->unit.modifier,
sdr->record.full->unit.type.base,
sdr->record.full->unit.type.modifier));
}
else if ((evt->sel_type.standard_type.event_type >= 0x2 && evt->sel_type.standard_type.event_type <= 0xc) ||
(evt->sel_type.standard_type.event_type == 0x6f)) {
/*
* Discrete Event
*/
lprintf(LOG_NOTICE, "%s%s sensor %s %s",
eintf->prefix, type, sdr->record.full->id_string, desc ? : "");
if (((evt->sel_type.standard_type.event_data[0] >> 6) & 3) == 1) {
/* previous state and/or severity in event data byte 2 */
}
}
else if (evt->sel_type.standard_type.event_type >= 0x70 && evt->sel_type.standard_type.event_type <= 0x7f) {
/*
* OEM Event
*/
lprintf(LOG_NOTICE, "%s%s sensor %s %s",
eintf->prefix, type, sdr->record.full->id_string, desc ? : "");
}
break;
case SDR_RECORD_TYPE_COMPACT_SENSOR:
if (evt->sel_type.standard_type.event_type == 0x6f) {
lprintf(LOG_NOTICE, "%s%s sensor %s - %s %s",
eintf->prefix,
type, sdr->record.compact->id_string,
desc ? : "",
evt->sel_type.standard_type.event_dir ? "Deasserted" : "Asserted");
} else {
lprintf(LOG_NOTICE, "%s%s sensor %s - %s",
eintf->prefix, type,
sdr->record.compact->id_string, desc ? : "");
}
break;
default:
lprintf(LOG_NOTICE, "%s%s sensor - %s",
eintf->prefix, type,
evt->sel_type.standard_type.sensor_num, desc ? : "");
break;
}
if (desc)
free(desc);
}
/*************************************************************************/
/*************************************************************************/
/** OpenIPMI Functions **/
/*************************************************************************/
#ifdef IPMI_INTF_OPEN
static int
openipmi_enable_event_msg_buffer(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
unsigned char bmc_global_enables;
uint8_t bmc_global_enables;
/* we must read/modify/write bmc global enables */
memset(&req, 0, sizeof(req));
@ -138,9 +326,13 @@ static int enable_event_msg_buffer(struct ipmi_intf * intf)
req.msg.cmd = 0x2f; /* Get BMC Global Enables */
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
lprintf(LOG_WARNING, "Get BMC Global Enables command filed [ccode %02x]",
rsp ? rsp->ccode : 0);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get BMC Global Enables command failed");
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get BMC Global Enables command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -150,9 +342,13 @@ static int enable_event_msg_buffer(struct ipmi_intf * intf)
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (!rsp || rsp->ccode) {
lprintf(LOG_WARNING, "Set BMC Global Enables command failed [ccode %02x]",
rsp ? rsp->ccode : 0);
if (rsp == NULL) {
lprintf(LOG_ERR, "Set BMC Global Enables command failed");
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Set BMC Global Enables command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
@ -161,161 +357,84 @@ static int enable_event_msg_buffer(struct ipmi_intf * intf)
return 0;
}
static void log_event(struct sel_event_record * evt)
static int
openipmi_setup(struct ipmi_event_intf * eintf)
{
char *desc;
int i, r;
if (!evt)
return;
if (evt->record_type == 0xf0)
lprintf(LOG_ALERT, "Linux kernel panic: %.11s", (char *) evt + 5);
else if (evt->record_type >= 0xc0)
lprintf(LOG_NOTICE, "IPMI Event OEM Record %02x", evt->record_type);
else {
ipmi_get_event_desc(evt, &desc);
if (desc) {
lprintf(LOG_NOTICE, "%s Sensor %02x - %s",
ipmi_sel_get_sensor_type(evt->sensor_type),
evt->sensor_num, desc);
free(desc);
}
/* enable event message buffer */
lprintf(LOG_DEBUG, "Enabling event message buffer");
r = openipmi_enable_event_msg_buffer(eintf->intf);
if (r < 0) {
lprintf(LOG_ERR, "Could not enable event message buffer");
return -1;
}
/* enable OpenIPMI event receiver */
lprintf(LOG_DEBUG, "Enabling event receiver");
i = 1;
r = ioctl(eintf->intf->fd, IPMICTL_SET_GETS_EVENTS_CMD, &i);
if (r != 0) {
lperror(LOG_ERR, "Could not enable event receiver");
return -1;
}
return 0;
}
static void read_event(struct ipmi_intf * intf)
static int
openipmi_read(struct ipmi_event_intf * eintf)
{
struct ipmi_addr addr;
struct ipmi_recv recv;
unsigned char data[80];
uint8_t data[80];
int rv;
recv.addr = (char *) &addr;
recv.addr = (unsigned char *) &addr;
recv.addr_len = sizeof(addr);
recv.msg.data = data;
recv.msg.data_len = sizeof(data);
rv = ioctl(intf->fd, IPMICTL_RECEIVE_MSG_TRUNC, &recv);
rv = ioctl(eintf->intf->fd, IPMICTL_RECEIVE_MSG_TRUNC, &recv);
if (rv < 0) {
switch (errno) {
case EINTR:
return; /* abort */
return 0; /* abort */
case EMSGSIZE:
recv.msg.data_len = sizeof(data); /* truncated */
break;
default:
lperror(LOG_ERR, "Unable to receive IPMI message");
return;
return -1;
}
}
if (!recv.msg.data || recv.msg.data_len == 0) {
lprintf(LOG_ERR, "No data in event");
return;
return -1;
}
if (recv.recv_type != IPMI_ASYNC_EVENT_RECV_TYPE) {
lprintf(LOG_ERR, "Type %x is not an event", recv.recv_type);
return;
return -1;
}
lprintf(LOG_DEBUG, "netfn:%x cmd:%x ccode:%d",
recv.msg.netfn, recv.msg.cmd, recv.msg.data[0]);
log_event((struct sel_event_record *)recv.msg.data);
eintf->log(eintf, (struct sel_event_record *)recv.msg.data);
return 0;
}
static int do_exit(struct ipmi_intf * intf, int rv)
static int
openipmi_wait(struct ipmi_event_intf * eintf)
{
if (intf)
intf->close(intf);
log_halt();
exit(rv);
}
static void usage(void)
{
fprintf(stderr, "usage: ipmievd [-hvd]\n");
fprintf(stderr, "\n");
fprintf(stderr, " -h This help\n");
fprintf(stderr, " -v Verbose (can use multiple times)\n");
fprintf(stderr, " -s Do NOT daemonize\n");
fprintf(stderr, "\n");
}
int main(int argc, char ** argv)
{
struct ipmi_intf * intf;
int r, a;
int i = 1;
int daemon = 1;
struct pollfd pfd;
/* make sure we have UID 0 */
if (geteuid() || getuid()) {
fprintf(stderr, "Inadequate privledges\n");
do_exit(NULL, EXIT_FAILURE);
}
while ((a = getopt(argc, (char **)argv, "hvs")) != -1) {
switch (a) {
case 'h':
usage();
do_exit(NULL, EXIT_SUCCESS);
break;
case 'v':
verbose++;
break;
case 's':
daemon = 0;
break;
default:
usage();
do_exit(NULL, EXIT_FAILURE);
}
}
if (daemon)
daemonize();
log_init("ipmievd", daemon, verbose);
/* load interface */
lprintf(LOG_DEBUG, "Loading OpenIPMI interface");
intf = ipmi_intf_load("open");
if (!intf) {
lprintf(LOG_ERR, "Unable to load OpenIPMI interface");
do_exit(NULL, EXIT_FAILURE);
}
/* open connection to openipmi device */
lprintf(LOG_DEBUG, "Connecting to OpenIPMI device");
r = intf->open(intf);
if (r < 0) {
lprintf(LOG_ERR, "Unable to open OpenIPMI device");
do_exit(NULL, EXIT_FAILURE);
}
/* enable event message buffer */
lprintf(LOG_DEBUG, "Enabling event message buffer");
r = enable_event_msg_buffer(intf);
if (r < 0) {
lprintf(LOG_ERR, "Could not enable event message buffer");
do_exit(intf, EXIT_FAILURE);
}
/* enable OpenIPMI event receiver */
lprintf(LOG_DEBUG, "Enabling event receiver");
r = ioctl(intf->fd, IPMICTL_SET_GETS_EVENTS_CMD, &i);
if (r != 0) {
lperror(LOG_ERR, "Could not enable event receiver");
do_exit(intf, EXIT_FAILURE);
}
lprintf(LOG_NOTICE, "Waiting for events...");
int r;
for (;;) {
pfd.fd = intf->fd; /* wait on openipmi device */
pfd.events = POLLIN; /* wait for input */
pfd.fd = eintf->intf->fd; /* wait on openipmi device */
pfd.events = POLLIN; /* wait for input */
r = poll(&pfd, 1, -1);
switch (r) {
@ -324,14 +443,349 @@ int main(int argc, char ** argv)
break;
case -1:
lperror(LOG_CRIT, "Unable to read from IPMI device");
do_exit(intf, EXIT_FAILURE);
break;
return -1;
default:
if (pfd.revents && POLLIN)
read_event(intf);
if (pfd.revents & POLLIN)
eintf->read(eintf);
}
}
lprintf(LOG_DEBUG, "Shutting down...");
do_exit(intf, EXIT_SUCCESS);
return 0;
}
#endif /* IPMI_INTF_OPEN */
/*************************************************************************/
/*************************************************************************/
/** SEL Watch Functions **/
/*************************************************************************/
static uint16_t
selwatch_get_count(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = IPMI_CMD_GET_SEL_INFO;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get SEL Info command failed");
return 0;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return 0;
}
lprintf(LOG_DEBUG, "SEL count is %d", buf2short(rsp->data+1));
return buf2short(rsp->data+1);
}
static uint16_t
selwatch_get_lastid(struct ipmi_intf * intf)
{
int next_id = 0;
uint16_t curr_id = 0;
struct sel_event_record evt;
if (selwatch_count == 0)
return 0;
while (next_id != 0xffff) {
curr_id = next_id;
lprintf(LOG_DEBUG, "SEL Next ID: %04x", curr_id);
next_id = ipmi_sel_get_std_entry(intf, curr_id, &evt);
if (next_id < 0)
break;
if (next_id == 0) {
/*
* usually next_id of zero means end but
* retry because some hardware has quirks
* and will return 0 randomly.
*/
next_id = ipmi_sel_get_std_entry(intf, curr_id, &evt);
if (next_id <= 0)
break;
}
}
lprintf(LOG_DEBUG, "SEL lastid is %04x", curr_id);
return curr_id;
}
static int
selwatch_setup(struct ipmi_event_intf * eintf)
{
/* save current sel record count */
selwatch_count = selwatch_get_count(eintf->intf);
lprintf(LOG_DEBUG, "Current SEL count is %d", selwatch_count);
/* save current last record ID */
selwatch_lastid = selwatch_get_lastid(eintf->intf);
lprintf(LOG_DEBUG, "Current SEL lastid is %04x", selwatch_lastid);
return 0;
}
/* selwatch_check - check for waiting events
*
* this is done by reading sel info and comparing
* the sel count value to what we currently know
*/
static int
selwatch_check(struct ipmi_event_intf * eintf)
{
uint16_t old_count = selwatch_count;
selwatch_count = selwatch_get_count(eintf->intf);
if (selwatch_count == 0) {
lprintf(LOG_DEBUG, "SEL count is 0 (old=%d), resetting lastid to 0", old_count);
selwatch_lastid = 0;
} else if (selwatch_count < old_count) {
selwatch_lastid = selwatch_get_lastid(eintf->intf);
lprintf(LOG_DEBUG, "SEL count lowered, new SEL lastid is %04x", selwatch_lastid);
}
return (selwatch_count > old_count);
}
static int
selwatch_read(struct ipmi_event_intf * eintf)
{
uint16_t curr_id = 0;
int next_id = selwatch_lastid;
struct sel_event_record evt;
if (selwatch_count == 0)
return -1;
while (next_id != 0xffff) {
curr_id = next_id;
lprintf(LOG_DEBUG, "SEL Read ID: %04x", curr_id);
next_id = ipmi_sel_get_std_entry(eintf->intf, curr_id, &evt);
if (next_id < 0)
break;
if (next_id == 0) {
/*
* usually next_id of zero means end but
* retry because some hardware has quirks
* and will return 0 randomly.
*/
next_id = ipmi_sel_get_std_entry(eintf->intf, curr_id, &evt);
if (next_id <= 0)
break;
}
if (curr_id != selwatch_lastid)
eintf->log(eintf, &evt);
else if (curr_id == 0)
eintf->log(eintf, &evt);
}
selwatch_lastid = curr_id;
return 0;
}
static int
selwatch_wait(struct ipmi_event_intf * eintf)
{
for (;;) {
if (eintf->check(eintf) > 0) {
lprintf(LOG_DEBUG, "New Events");
eintf->read(eintf);
}
sleep(selwatch_timeout);
}
}
/*************************************************************************/
static void
ipmievd_cleanup(int signal)
{
struct stat st1;
if (lstat(pidfile, &st1) == 0) {
/* cleanup daemon pidfile */
(void)unlink(pidfile);
}
exit(EXIT_SUCCESS);
}
int
ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
{
int i, rc;
int daemon = 1;
struct sigaction act;
memset(pidfile, 0, 64);
sprintf(pidfile, "%s%d", DEFAULT_PIDFILE, eintf->intf->devnum);
lprintf(LOG_NOTICE, "ipmievd: using pidfile %s", pidfile);
for (i = 0; i < argc; i++) {
if (strncasecmp(argv[i], "help", 4) == 0) {
ipmievd_usage();
return 0;
}
if (strncasecmp(argv[i], "daemon", 6) == 0) {
daemon = 1;
}
else if (strncasecmp(argv[i], "nodaemon", 8) == 0) {
daemon = 0;
}
else if (strncasecmp(argv[i], "daemon=", 7) == 0) {
if (strncasecmp(argv[i]+7, "on", 2) == 0 ||
strncasecmp(argv[i]+7, "yes", 3) == 0)
daemon = 1;
else if (strncasecmp(argv[i]+7, "off", 3) == 0 ||
strncasecmp(argv[i]+7, "no", 2) == 0)
daemon = 0;
}
else if (strncasecmp(argv[i], "timeout=", 8) == 0) {
selwatch_timeout = strtoul(argv[i]+8, NULL, 0);
}
else if (strncasecmp(argv[i], "pidfile=", 8) == 0) {
memset(pidfile, 0, 64);
strncpy(pidfile, argv[i]+8,
__min(strlen((const char *)(argv[i]+8)), 63));
}
}
/*
* We need to open interface before forking daemon
* so error messages are not lost to syslog and
* return code is successfully returned to initscript
*/
if (eintf->intf->open(eintf->intf) < 0) {
lprintf(LOG_ERR, "Unable to open interface");
return -1;
}
if (daemon) {
FILE *fp;
struct stat st1;
ipmi_start_daemon(eintf->intf);
if (lstat(pidfile, &st1) == 0) {
/* already exists, erase first */
if (unlink(pidfile) != 0) {
lprintf(LOG_WARN, "Unable to erase pidfile");
}
}
fp = ipmi_open_file_write(pidfile);
if (fp != NULL) {
fprintf(fp, "%d\n", (int)getpid());
fclose(fp);
}
}
/* register signal handler for cleanup */
act.sa_handler = ipmievd_cleanup;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
sigaction(SIGQUIT, &act, NULL);
sigaction(SIGTERM, &act, NULL);
log_halt();
log_init("ipmievd", daemon, verbose);
/* generate SDR cache for fast lookups */
lprintf(LOG_NOTICE, "Reading sensors...");
ipmi_sdr_list_cache(eintf->intf);
lprintf(LOG_DEBUG, "Sensors cached");
/* call event handler setup routine */
if (eintf->setup != NULL) {
rc = eintf->setup(eintf);
if (rc < 0) {
lprintf(LOG_ERR, "Error setting up Event Interface %s", eintf->name);
return -1;
}
}
lprintf(LOG_NOTICE, "Waiting for events...");
/* now launch event wait loop */
if (eintf->wait != NULL) {
rc = eintf->wait(eintf);
if (rc < 0) {
lprintf(LOG_ERR, "Error waiting for events!");
return -1;
}
}
return 0;
}
int
ipmievd_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_event_intf * eintf;
eintf = ipmi_event_intf_load("sel");
if (eintf == NULL) {
lprintf(LOG_ERR, "Unable to load event interface");
return -1;
}
eintf->intf = intf;
if (intf->session != NULL) {
snprintf(eintf->prefix,
strlen((const char *)intf->session->hostname) + 3,
"%s: ", intf->session->hostname);
}
return ipmievd_main(eintf, argc, argv);
}
int
ipmievd_open_main(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_event_intf * eintf;
/* only one interface works for this */
if (strncmp(intf->name, "open", 4) != 0) {
lprintf(LOG_ERR, "Invalid Interface for OpenIPMI Event Handler: %s", intf->name);
return -1;
}
eintf = ipmi_event_intf_load("open");
if (eintf == NULL) {
lprintf(LOG_ERR, "Unable to load event interface");
return -1;
}
eintf->intf = intf;
return ipmievd_main(eintf, argc, argv);
}
struct ipmi_cmd ipmievd_cmd_list[] = {
#ifdef IPMI_INTF_OPEN
{ ipmievd_open_main, "open", "Use OpenIPMI for asyncronous notification of events" },
#endif
{ ipmievd_sel_main, "sel", "Poll SEL for notification of events" },
{ NULL }
};
int main(int argc, char ** argv)
{
int rc;
rc = ipmi_main(argc, argv, ipmievd_cmd_list, NULL);
if (rc < 0)
exit(EXIT_FAILURE);
else
exit(EXIT_SUCCESS);
}

View File

@ -28,10 +28,6 @@
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
#include <stdio.h>
@ -42,25 +38,29 @@
#include <ctype.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_session.h>
#include <ipmitool/ipmi_main.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#define EXEC_BUF_SIZE 1024
#define EXEC_ARG_SIZE 32
extern void ipmi_cmd_print(void);
extern int ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv);
#define EXEC_BUF_SIZE 2048
#define EXEC_ARG_SIZE 64
extern const struct valstr ipmi_privlvl_vals[];
extern const struct valstr ipmi_authtype_session_vals[];
#ifdef HAVE_READLINE
/* avoid warnings errors due to non-ANSI type declarations in readline.h */
#define _FUNCTION_DEF
#define USE_VARARGS
#define PREFER_STDARG
#include <readline/readline.h>
#include <readline/history.h>
#define RL_PROMPT "ipmitool> "
@ -77,11 +77,16 @@ static int rl_event_keepalive(void)
{
static int internal_timer = 0;
if (!shell_intf)
if (shell_intf == NULL)
return -1;
if (!shell_intf->keepalive)
if (shell_intf->keepalive == NULL)
return 0;
#if defined (RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0402
if (internal_timer++ < RL_TIMEOUT)
#else
/* In readline < 4.2 keyboard timeout hardcoded to 0.1 second */
if (internal_timer++ < RL_TIMEOUT * 10)
#endif
return 0;
internal_timer = 0;
@ -92,7 +97,7 @@ static int rl_event_keepalive(void)
int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv)
{
char *pbuf, **ap, *__argv[20];
char *ptr, *pbuf, **ap, *__argv[EXEC_ARG_SIZE];
int __argc, rc=0;
rl_readline_name = "ipmitool";
@ -106,8 +111,11 @@ int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv)
/* hook to keep lan sessions active */
shell_intf = intf;
rl_event_hook = rl_event_keepalive;
/* set to 1 second */
rl_set_keyboard_input_timeout(1000*1000);
#if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0402
/* There is a bug in readline 4.2 and later (at least on FreeBSD and NetBSD):
* timeout equal or greater than 1 second causes an infinite loop. */
rl_set_keyboard_input_timeout(1000 * 1000 - 1);
#endif
}
while ((pbuf = (char *)readline(RL_PROMPT)) != NULL) {
@ -115,78 +123,143 @@ int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv)
free(pbuf);
continue;
}
if (!strncmp(pbuf, "quit", 4) || !strncmp(pbuf, "exit", 4)) {
if (strncmp(pbuf, "quit", 4) == 0 ||
strncmp(pbuf, "exit", 4) == 0) {
free(pbuf);
return 0;
}
if (!strncmp(pbuf, "help", 4) || !strncmp(pbuf, "?", 1)) {
ipmi_cmd_print();
if (strncmp(pbuf, "help", 4) == 0 ||
strncmp(pbuf, "?", 1) == 0) {
ipmi_cmd_print(intf->cmdlist);
free(pbuf);
continue;
}
/* for the all-important up arrow :) */
add_history(pbuf);
/* change "" and '' with spaces in the middle to ~ */
ptr = pbuf;
while (*ptr != '\0') {
if (*ptr == '"') {
ptr++;
while (*ptr != '"') {
if (isspace((int)*ptr))
*ptr = '~';
ptr++;
}
}
if (*ptr == '\'') {
ptr++;
while (*ptr != '\'') {
if (isspace((int)*ptr))
*ptr = '~';
ptr++;
}
}
ptr++;
}
__argc = 0;
ap = __argv;
for (*ap = strtok(pbuf, " \t"); *ap != NULL; *ap = strtok(NULL, " \t")) {
for (*ap = strtok(pbuf, " \t");
*ap != NULL;
*ap = strtok(NULL, " \t")) {
__argc++;
ptr = *ap;
if (*ptr == '\'') {
memmove(ptr, ptr+1, strlen(ptr));
while (*ptr != '\'') {
if (*ptr == '~')
*ptr = ' ';
ptr++;
}
*ptr = '\0';
}
if (*ptr == '"') {
memmove(ptr, ptr+1, strlen(ptr));
while (*ptr != '"') {
if (*ptr == '~')
*ptr = ' ';
ptr++;
}
*ptr = '\0';
}
if (**ap != '\0') {
if (++ap >= &__argv[20])
if (++ap >= &__argv[EXEC_ARG_SIZE])
break;
}
}
if (__argc && __argv[0])
rc = ipmi_cmd_run(intf, __argv[0], __argc-1, &(__argv[1]));
rc = ipmi_cmd_run(intf,
__argv[0],
__argc-1,
&(__argv[1]));
free(pbuf);
}
}
printf("\n");
return rc;
}
#else /* HAVE_READLINE */
int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv)
int
ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv)
{
printf("Compiled without readline support, shell is disabled.\n");
lprintf(LOG_ERR, "Compiled without readline, shell is disabled");
return -1;
}
#endif /* HAVE_READLINE */
static void ipmi_set_usage(void)
int ipmi_echo_main(struct ipmi_intf * intf, int argc, char ** argv)
{
printf("Usage: set <option> <value>\n\n");
printf("Options are:\n");
printf(" hostname <host> Session hostname\n");
printf(" username <user> Session username\n");
printf(" password <pass> Session password\n");
printf(" privlvl <level> Session privilege level force\n");
printf(" authtype <type> Authentication type force\n");
printf(" localaddr <addr> Local IPMB address\n");
printf(" targetaddr <addr> Remote target IPMB address\n");
printf(" port <port> Remote RMCP port\n");
printf(" csv [level] enable output in comma separated format\n");
printf(" verbose [level] Verbose level\n");
int i;
for (i=0; i<argc; i++) {
printf("%s ", argv[i]);
}
printf("\n");
return 0;
}
static void
ipmi_set_usage(void)
{
lprintf(LOG_NOTICE, "Usage: set <option> <value>\n");
lprintf(LOG_NOTICE, "Options are:");
lprintf(LOG_NOTICE, " hostname <host> Session hostname");
lprintf(LOG_NOTICE, " username <user> Session username");
lprintf(LOG_NOTICE, " password <pass> Session password");
lprintf(LOG_NOTICE, " privlvl <level> Session privilege level force");
lprintf(LOG_NOTICE, " authtype <type> Authentication type force");
lprintf(LOG_NOTICE, " localaddr <addr> Local IPMB address");
lprintf(LOG_NOTICE, " targetaddr <addr> Remote target IPMB address");
lprintf(LOG_NOTICE, " port <port> Remote RMCP port");
lprintf(LOG_NOTICE, " csv [level] enable output in comma separated format");
lprintf(LOG_NOTICE, " verbose [level] Verbose level");
lprintf(LOG_NOTICE, "");
}
int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
{
if (!argc || !strncmp(argv[0], "help", 4)) {
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
ipmi_set_usage();
return -1;
}
/* these options can have no arguments */
if (!strncmp(argv[0], "verbose", 7)) {
if (strncmp(argv[0], "verbose", 7) == 0) {
verbose = (argc > 1) ? atoi(argv[1]) : verbose+1;
return 0;
}
if (!strncmp(argv[0], "csv", 3)) {
if (strncmp(argv[0], "csv", 3) == 0) {
csv_output = (argc > 1) ? atoi(argv[1]) : 1;
return 0;
}
@ -197,43 +270,54 @@ int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv)
return -1;
}
if (!strncmp(argv[0], "host", 4) || !strncmp(argv[0], "hostname", 8)) {
if (strncmp(argv[0], "host", 4) == 0 ||
strncmp(argv[0], "hostname", 8) == 0) {
ipmi_intf_session_set_hostname(intf, argv[1]);
printf("Set session hostname to %s\n", intf->session->hostname);
}
else if (!strncmp(argv[0], "user", 4) || !strncmp(argv[0], "username", 8)) {
else if (strncmp(argv[0], "user", 4) == 0 ||
strncmp(argv[0], "username", 8) == 0) {
ipmi_intf_session_set_username(intf, argv[1]);
printf("Set session username to %s\n", intf->session->username);
}
else if (!strncmp(argv[0], "pass", 4) || !strncmp(argv[0], "password", 8)) {
else if (strncmp(argv[0], "pass", 4) == 0 ||
strncmp(argv[0], "password", 8) == 0) {
ipmi_intf_session_set_password(intf, argv[1]);
printf("Set session password\n");
}
else if (!strncmp(argv[0], "authtype", 8)) {
unsigned char authtype;
authtype = (unsigned char)str2val(argv[1], ipmi_authtype_session_vals);
ipmi_intf_session_set_authtype(intf, authtype);
printf("Set session authtype to %s\n",
val2str(intf->session->authtype_set, ipmi_authtype_session_vals));
else if (strncmp(argv[0], "authtype", 8) == 0) {
int authtype;
authtype = str2val(argv[1], ipmi_authtype_session_vals);
if (authtype == 0xFF) {
lprintf(LOG_ERR, "Invalid authtype: %s", argv[1]);
} else {
ipmi_intf_session_set_authtype(intf, authtype);
printf("Set session authtype to %s\n",
val2str(intf->session->authtype_set, ipmi_authtype_session_vals));
}
}
else if (!strncmp(argv[0], "privlvl", 7)) {
unsigned char privlvl;
privlvl = (unsigned char)str2val(argv[1], ipmi_privlvl_vals);
ipmi_intf_session_set_privlvl(intf, privlvl);
printf("Set session privilege level to %s\n",
val2str(intf->session->privlvl, ipmi_privlvl_vals));
else if (strncmp(argv[0], "privlvl", 7) == 0) {
int privlvl;
privlvl = str2val(argv[1], ipmi_privlvl_vals);
if (privlvl == 0xFF) {
lprintf(LOG_ERR, "Invalid privilege level: %s", argv[1]);
} else {
ipmi_intf_session_set_privlvl(intf, privlvl);
printf("Set session privilege level to %s\n",
val2str(intf->session->privlvl, ipmi_privlvl_vals));
}
}
else if (!strncmp(argv[0], "port", 4)) {
else if (strncmp(argv[0], "port", 4) == 0) {
int port = atoi(argv[1]);
ipmi_intf_session_set_port(intf, port);
printf("Set session port to %d\n", intf->session->port);
}
else if (!strncmp(argv[0], "localaddr", 9)) {
intf->my_addr = (unsigned char)strtol(argv[1], NULL, 0);
else if (strncmp(argv[0], "localaddr", 9) == 0) {
intf->my_addr = (uint8_t)strtol(argv[1], NULL, 0);
printf("Set local IPMB address to 0x%02x\n", intf->my_addr);
}
else if (!strncmp(argv[0], "targetaddr", 10)) {
intf->target_addr = (unsigned char)strtol(argv[1], NULL, 0);
else if (strncmp(argv[0], "targetaddr", 10) == 0) {
intf->target_addr = (uint8_t)strtol(argv[1], NULL, 0);
printf("Set remote IPMB address to 0x%02x\n", intf->target_addr);
}
else {
@ -247,23 +331,23 @@ int ipmi_exec_main(struct ipmi_intf * intf, int argc, char ** argv)
{
FILE * fp;
char buf[EXEC_BUF_SIZE];
char * ptr, * tok, * ret;
char * ptr, * tok, * ret, * tmp;
int __argc, i, r;
char * __argv[EXEC_ARG_SIZE];
int rc=0;
if (argc < 1) {
printf("Usage: exec <filename>\n");
lprintf(LOG_ERR, "Usage: exec <filename>");
return -1;
}
fp = ipmi_open_file_read(argv[0]);
if (!fp)
if (fp == NULL)
return -1;
while (!feof(fp)) {
while (feof(fp) == 0) {
ret = fgets(buf, EXEC_BUF_SIZE, fp);
if (!ret)
if (ret == NULL)
continue;
/* clip off optional comment tail indicated by # */
@ -273,23 +357,67 @@ int ipmi_exec_main(struct ipmi_intf * intf, int argc, char ** argv)
else
ptr = buf + strlen(buf);
/* change "" and '' with spaces in the middle to ~ */
ptr = buf;
while (*ptr != '\0') {
if (*ptr == '"') {
ptr++;
while (*ptr != '"') {
if (isspace((int)*ptr))
*ptr = '~';
ptr++;
}
}
if (*ptr == '\'') {
ptr++;
while (*ptr != '\'') {
if (isspace((int)*ptr))
*ptr = '~';
ptr++;
}
}
ptr++;
}
/* clip off trailing and leading whitespace */
ptr--;
while (isspace(*ptr) && ptr >= buf)
while (isspace((int)*ptr) && ptr >= buf)
*ptr-- = '\0';
ptr = buf;
while (isspace(*ptr))
while (isspace((int)*ptr))
ptr++;
if (!strlen(ptr))
if (strlen(ptr) == 0)
continue;
/* parse it and make argument list */
__argc = 0;
tok = strtok(ptr, " ");
while (tok) {
if (__argc < EXEC_ARG_SIZE)
for (tok = strtok(ptr, " "); tok != NULL; tok = strtok(NULL, " ")) {
if (__argc < EXEC_ARG_SIZE) {
__argv[__argc++] = strdup(tok);
tok = strtok(NULL, " ");
if (__argv[__argc-1] == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return -1;
}
tmp = __argv[__argc-1];
if (*tmp == '\'') {
memmove(tmp, tmp+1, strlen(tmp));
while (*tmp != '\'') {
if (*tmp == '~')
*tmp = ' ';
tmp++;
}
*tmp = '\0';
}
if (*tmp == '"') {
memmove(tmp, tmp+1, strlen(tmp));
while (*tmp != '"') {
if (*tmp == '~')
*tmp = ' ';
tmp++;
}
*tmp = '\0';
}
}
}
/* now run the command, save the result if not successful */
@ -307,6 +435,5 @@ int ipmi_exec_main(struct ipmi_intf * intf, int argc, char ** argv)
}
fclose(fp);
return 0;
return rc;
}

Some files were not shown because too many files have changed in this diff Show More