commit | 2d4836db8b77ae001d9b0ccd3952257f9fdd71b3 | [log] [tgz] |
---|---|---|
author | Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> | Thu Nov 29 14:16:39 2018 -0800 |
committer | Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> | Thu Nov 29 14:18:07 2018 -0800 |
tree | 5eabb064115a6462757ffe5e1e2cd14f23ceee2e | |
parent | 23ef59b7b545f70976e9901b2b1a1962d73b8484 [diff] |
google-ipmi-sys: Add support for PCIE slot to I2C bus mapping Say the bmc has the following information: root@xyz:/sys/bus/i2c/devices# ls 0-0070 10-0048 4-0049 5-0062 5-0066 5-0074 i2c-1 i2c-15 i2c-18 i2c-20 i2c-4 i2c-7 1-004e 3-0054 4-004d 5-0063 5-0067 9-004c i2c-10 i2c-16 i2c-19 i2c-21 i2c-5 i2c-8 1-004f 4-0048 5-0061 5-0065 5-0072 i2c-0 i2c-14 i2c-17 i2c-2 i2c-3 i2c-6 i2c-9 root@xyz:/sys/bus/i2c/devices# cd i2c-18 root@xyz:/sys/bus/i2c/devices/i2c-18# ls delete_device i2c-dev mux_device name new_device of_node power subsystem uevent root@xyz:/sys/bus/i2c/devices/i2c-18# cd of_node root@xyz:/sys/bus/i2c/devices/i2c-18/of_node# ls root@xyz:/sys/bus/i2c/devices/i2c-18/of_node# cat pcie-slot /pcie-slot/pcie@4root@xyz:/sys/bus/i2c/devices/i2c-18/of_node# cd root@xyz:~# cd /sys/firmware/devicetree/base root@xyz:/sys/firmware/devicetree/base# ls root@xyz:/sys/firmware/devicetree/base# cd pcie-slot/ root@xyz:/sys/firmware/devicetree/base/pcie-slot# ls name pcie@1a pcie@2a pcie@4 pcie@6 root@xyz:/sys/firmware/devicetree/base/pcie-slot# cd pcie\@4 root@xyz:/sys/firmware/devicetree/base/pcie-slot/pcie@4# ls name slot-name root@xyz:/sys/firmware/devicetree/base/pcie-slot/pcie@4# cat slot-name slot4root@xyz:/sys/firmware/devicetree/base/pcie-slot/pcie@4# Then the system can send commands to 1) Get the number of pcie slots. 2) Get information about which i2c bus is routed to which pcie slot. Tested: Yes; 1) Sending GetPCIeSlotsCount command; Getting pcie slots count as 4. root@xyz:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x04 79 2b 00 04 04 3) Sending GetPCIeSlotI2cBusMapping command with entry ID 0; expecting success; received "slot5". root@xyz:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x05 0x00 79 2b 00 05 14 05 73 6c 6f 74 35 4) Sending GetPCIeSlotI2cBusMapping command with entry ID 1; expecting success; received "slot1". root@xyz:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x05 0x01 79 2b 00 05 0e 05 73 6c 6f 74 31 5) Sending GetPCIeSlotI2cBusMapping command with entry ID 2; expecting success; received "slot3". root@xyz:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x05 0x02 79 2b 00 05 12 05 73 6c 6f 74 33 6) Sending GetPCIeSlotI2cBusMapping command with entry ID 3; expecting success; received "slot2". root@xyz:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x05 0x03 79 2b 00 05 10 05 73 6c 6f 74 32 7) Sending GetPCIeSlotI2cBusMapping command with entry ID 4; expecting failure root@xyz:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x05 0x04 Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32 rsp=0xc1): Invalid command root@xyz:~# Change-Id: Id6e514bb11e8d4a00c615cffea6c2fdb6f5df03e 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 |