Dung Cao | e71dce5 | 2021-06-11 10:23:42 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018-2021 Ampere Computing LLC |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <phosphor-logging/log.hpp> |
| 18 | #include <ipmid/api.hpp> |
| 19 | #include <ipmid/sessiondef.hpp> |
| 20 | #include <ipmid/sessionhelper.hpp> |
| 21 | #include <ipmid/types.hpp> |
| 22 | #include <ipmid/utils.hpp> |
| 23 | |
| 24 | auto ipmiAppGetSiCapabilities(uint8_t sysIfcType) |
| 25 | -> ipmi::RspType<uint8_t, uint8_t, uint8_t, uint8_t> |
| 26 | { |
| 27 | uint8_t reserved = 0x00; |
| 28 | uint8_t tranSupport; |
| 29 | uint8_t inputMsgSize; |
| 30 | uint8_t outputMsgSize; |
| 31 | switch (sysIfcType & 0xF) |
| 32 | { |
| 33 | case 0: |
| 34 | //SSIF |
| 35 | // multi-part read/write supported. Start, Middle, and End |
| 36 | // transactions supported. PEC supported. |
| 37 | tranSupport = 0x88; |
| 38 | inputMsgSize = 0xff; |
| 39 | outputMsgSize = 0xff -3; //minus 3 is to drop len, netfn, lun, cmd |
| 40 | break; |
| 41 | case 1: |
| 42 | case 2: |
| 43 | //KCS or SMIC |
| 44 | tranSupport = 0x00; |
| 45 | inputMsgSize = 0xff; |
| 46 | break; |
| 47 | default: |
| 48 | return ipmi::responseInvalidFieldRequest(); |
| 49 | } |
| 50 | |
| 51 | return ipmi::responseSuccess(reserved, tranSupport, inputMsgSize, |
| 52 | outputMsgSize); |
| 53 | } |
| 54 | |
| 55 | void registerAppFunctions() __attribute__((constructor)); |
| 56 | void registerAppFunctions() |
| 57 | { |
| 58 | // <Get System Interface Capabilities> |
| 59 | ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnApp, |
| 60 | ipmi::app::cmdGetSystemIfCapabilities, |
| 61 | ipmi::Privilege::User, ipmiAppGetSiCapabilities); |
| 62 | |
| 63 | } |
| 64 | |
| 65 | |