xref: /openbmc/google-ipmi-sys/pcie_i2c.hpp (revision 444b5ea4)
1a2056e9cSWilly Tu // Copyright 2021 Google LLC
2a2056e9cSWilly Tu //
3a2056e9cSWilly Tu // Licensed under the Apache License, Version 2.0 (the "License");
4a2056e9cSWilly Tu // you may not use this file except in compliance with the License.
5a2056e9cSWilly Tu // You may obtain a copy of the License at
6a2056e9cSWilly Tu //
7a2056e9cSWilly Tu //      http://www.apache.org/licenses/LICENSE-2.0
8a2056e9cSWilly Tu //
9a2056e9cSWilly Tu // Unless required by applicable law or agreed to in writing, software
10a2056e9cSWilly Tu // distributed under the License is distributed on an "AS IS" BASIS,
11a2056e9cSWilly Tu // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12a2056e9cSWilly Tu // See the License for the specific language governing permissions and
13a2056e9cSWilly Tu // limitations under the License.
14a2056e9cSWilly Tu 
152d4836dbSJaghathiswari Rankappagounder Natarajan #pragma once
162d4836dbSJaghathiswari Rankappagounder Natarajan 
1749f23ad9SPatrick Venture #include "handler.hpp"
1849f23ad9SPatrick Venture 
192c9e1625SWilliam A. Kennington III #include <ipmid/api.h>
202d4836dbSJaghathiswari Rankappagounder Natarajan 
21ff3cd8e9SWilly Tu #include <ipmid/api-types.hpp>
22*444b5ea4SPatrick Williams 
23b4e3704cSWilly Tu #include <span>
24ff3cd8e9SWilly Tu 
252d4836dbSJaghathiswari Rankappagounder Natarajan namespace google
262d4836dbSJaghathiswari Rankappagounder Natarajan {
272d4836dbSJaghathiswari Rankappagounder Natarajan namespace ipmi
282d4836dbSJaghathiswari Rankappagounder Natarajan {
292d4836dbSJaghathiswari Rankappagounder Natarajan 
30ff3cd8e9SWilly Tu struct PcieSlotCountReply
31ff3cd8e9SWilly Tu {
32ff3cd8e9SWilly Tu     uint8_t value;
33ff3cd8e9SWilly Tu } __attribute__((packed));
34ff3cd8e9SWilly Tu 
35ff3cd8e9SWilly Tu struct PcieSlotI2cBusMappingReply
36ff3cd8e9SWilly Tu {
37ff3cd8e9SWilly Tu     uint8_t i2c_bus_number;
38ff3cd8e9SWilly Tu     uint8_t pcie_slot_name_len;
39ff3cd8e9SWilly Tu } __attribute__((packed));
40ff3cd8e9SWilly Tu 
412d4836dbSJaghathiswari Rankappagounder Natarajan //  Handle the pcie slot count command.
422d4836dbSJaghathiswari Rankappagounder Natarajan //  Sys can query the number of pcie slots.
43b4e3704cSWilly Tu Resp pcieSlotCount(std::span<const uint8_t> data, HandlerInterface* handler);
442d4836dbSJaghathiswari Rankappagounder Natarajan 
452d4836dbSJaghathiswari Rankappagounder Natarajan // Handle the pcie slot to i2c bus mapping command.
462d4836dbSJaghathiswari Rankappagounder Natarajan // Sys can query which i2c bus is routed to which pcie slot.
47b4e3704cSWilly Tu Resp pcieSlotI2cBusMapping(std::span<const uint8_t> data,
48ff3cd8e9SWilly Tu                            HandlerInterface* handler);
492d4836dbSJaghathiswari Rankappagounder Natarajan 
502d4836dbSJaghathiswari Rankappagounder Natarajan } // namespace ipmi
512d4836dbSJaghathiswari Rankappagounder Natarajan } // namespace google
52