| commit | fd0f1cf99b2ef022fc36a2ff8c1d8040ccddc4ec | [log] [tgz] |
|---|---|---|
| author | Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> | Fri Jan 18 15:31:07 2019 -0800 |
| committer | Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> | Fri Jan 18 15:42:10 2019 -0800 |
| tree | a55d18f39a28609e48332f5bb9cbde3129081b2b | |
| parent | 3c7037a728b7e6f6c808b5694bf8ebf14df255a7 [diff] |
google-ipmi-sys: Add "Entity Id:Entity Instance" mapping to Entity name
Say the system has a JSON file like :
{
"cpu": [
{"instance": 1, "name": "CPU0"},
{"instance": 2, "name": "CPU1"}
],
"memory_module": [
{"instance": 1, "name": "DIMM_A1"},
{"instance": 2, "name": "DIMM_A2"},
{"instance": 3, "name": "DIMM_B1"},
{"instance": 4, "name": "DIMM_B2"},
{"instance": 5, "name": "DIMM_C1"},
{"instance": 6, "name": "DIMM_C2"},
{"instance": 7, "name": "DIMM_D1"},
{"instance": 8, "name": "DIMM_D2"},
{"instance": 9, "name": "DIMM_E1"},
{"instance": 10, "name": "DIMM_E2"},
{"instance": 11, "name": "DIMM_F1"},
],
"add_in_card": [
{"instance": 1, "name": "slot1"},
{"instance": 2, "name": "slot2"},
{"instance": 3, "name": "slot3"},
{"instance": 4, "name": "slot5"}
],
"storage_device": [
{"instance": 1, "name": "SATA0"},
{"instance": 2, "name": "SATA1"},
{"instance": 3, "name": "SATA2"},
{"instance": 4, "name": "SATA3"}
]
}
The system can query the BMC for an Entity name given the Entity ID and Entity Instance.
Tested:
Yes;
1) Sending GetEntityName command; Expecting error since entity ID and
entity instance are not specified.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xc7): Request data length invalid
2) Sending GetEntityName command; Expecting error since entity instance
is not specified.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x01
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xc7): Request data length invalid
3) Sending GetEntityName command; Expecting error since Entity Id = 0x07
is not supported.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x07 0x01
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xcc): Invalid data field in request
4) Sending GetEntityName command; Expecting error since Entity Instance
= 0x06 is not added in the JSON file.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x3
0x06
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xcc): Invalid data field in request
5) Sending GetEntityName command; Expecting success.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x3
0x01
79 2b 00 06 04 43 50 55 30
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x0B
0x01
79 2b 00 06 05 73 6c 6f 74 31
root@adler:~#
Change-Id: Idf6caae863acacd62460cbb7f73bf56fc927bcff
Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
There are and will be a variety of sys specific commands.
The cablecheck command checks whether the BMC is seeing traffic between itself and the host's NIC. Sys specifies which if_name is expected to be connected. The BMC presently only checks traffic on the interface specified. There are now ethernet statistics available over IPMI, which can be checked directly in lieu of this.
Request
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x00 | Subcommand |
| 0x01 | If_name length | Where you expect the cable, eth0 or eth1, etc |
| 0x02 ... | The name | The string, not null-terminated |
Response
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x00 | Subcommand |
| 0x01 | 0x00/0x01 | 0 for false, 1 for true |
Any CPLD on the system that can only be read directly via the BMC can have its version exported to Sys via the cpld version command.
Request
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x01 | Subcommand |
| 0x01 | CPLD ID | A one-byte identifier for the CPLD file to read, unsigned byte. |
Response
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x01 | Subcommand |
| 0x01 | Major | Major version |
| 0x02 | Minor | Minor Version |
| 0x03 | Sub 1 | Third version number |
| 0x04 | Sub 2 | Fourth version number |
Per the above, if the version number doesn't fit in a byte it'll be cast to size.
The BMC itself must have hard-coded into the image, which ethernet device is connected to the host NIC. This is true also in the mapping of ethernet device to channel number. The channel number is used to configure the ethernet device over IPMI, instead of the interface name. This is because we leverage the current IPMI command set to read and write the networking configuration. Sys can be programmed already to have this information in the board protobuf, however, this information -- can be read from the BMC over IPMI.
Request
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x02 | Subcommand |
Response
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x02 | Subcommand |
| 0x01 | Channel number | The IPMI channel number for use with the network configuration commands (such as reading the MAC or IP address of the BMC). |
| 0x02 | if_name length | The length of the if_name in bytes. |
| 0x03... | if_name | The interface name, not null-terminated |
Sys needs to be able to tell the BMC to reset the host but given a delay in seconds.
Request
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x03 | Subcommand |
| 0x01..0x04 | Seconds to delay (uint32) |
Response
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x03 | Subcommand |
Sys can get the total number of PCIe slots from BMC using this command. When BMC receives this command, BMC can enumerate over all the PCIe slots and create a hashmap with all the available PCIe slot name - I2C bus number mappings. BMC can then send the total number of PCIe slots as part of this command response.
Request
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x04 | Subcommand |
Response
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x04 | Subcommand |
| 0x01 | Total number of PCIe slots | Total number of PCIe slots |
If Sys gets N total slots as part of the above command, then Sys can send this command N times with Entry IDs ranging from 0 to N - 1. Say, Sys sends this command with Entry ID as 1, BMC can go and fetch the first PCIe slot name - I2C bus number mapping from the hashmap created above and then send the PCIe slot name and I2C bus number as part of the command response.
Request
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x05 | Subcommand |
| 0x01 | Entry ID | Entry ID ranging from 0 to N - 1 |
Response
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x05 | Subcommand |
| 0x01 | I2C bus number | The I2C bus number which is input to the above PCIe slot |
| 0x02 | PCIe slot name length | The PCIe slot name length |
| 0x03... | PCIe slot name | The PCIe slot name without null terminator |
Gsys can get the "Entity ID:Entity Instance" to Entity name mapping from BMC using this command. When BMC receives this command, BMC can check the related JSON file and then send the name for that particular entity as this command response.
Request
| Byte(s) | Value | Data |
|---|---|---|
| 0x00 | 0x06 | Subcommand |
| 0x01 | Entity ID | Entity ID |
| 0x02 | Entity Instance | Entity Instance |
Response
|Byte(s) |Value |Data |0x00|0x06|Subcommand |0x01|Entity name length (say N)|Entity name length |0x02...0x02 + N - 1|Entity name|Entity name without null terminator