OpenBIC
OpenSource Bridge-IC
kcs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
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#ifndef KCS_H
18#define KCS_H
19
20#ifdef CONFIG_IPMI_KCS_ASPEED
21
22#include <stdbool.h>
23#include <stdint.h>
24#include <zephyr.h>
25#include "mctp.h"
26
27#define KCS_POLL_STACK_SIZE 4096
28#define KCS_POLLING_INTERVAL 100
29#define KCS_BUFF_SIZE 256
30#define KCS_MAX_CHANNEL_NUM 0x0F
31
32#define CMD_SYS_INFO_FW_VERSION 0x01
33#define CMD_DIMM_LOCATION 0x01
34#define KCS_TASK_NAME_LEN 32
35
36#define MAX_KCS_WORK_COUNT 5
37#define KCS_WORKER_STACK_SIZE 2048
38#define ADD_SEL_EVENT_DATA_MAX_LEN 18
39
40typedef struct _kcs_dev {
41 const struct device *dev;
42 uint8_t index;
43 k_tid_t task_tid;
44 K_KERNEL_STACK_MEMBER(task_stack, KCS_POLL_STACK_SIZE);
45 uint8_t task_name[KCS_TASK_NAME_LEN];
46 struct k_thread task_thread;
47} kcs_dev;
48
49struct kcs_request {
50 uint8_t netfn;
51 uint8_t cmd;
52 uint8_t data[0];
53};
54
55struct kcs_response {
56 uint8_t netfn;
57 uint8_t cmd;
58 uint8_t cmplt_code;
59 uint8_t data[0];
60};
61
62struct kcs_work_info {
63 union {
64 struct k_work normal_work;
65 struct k_work_delayable delay_work;
66 } work;
67 uint8_t ibuf[KCS_BUFF_SIZE];
68 uint32_t data_length;
69};
70
71typedef struct _add_sel_msg_t {
72 mctp_ext_params ext_params;
73 uint8_t event_class;
74 uint8_t event_data[ADD_SEL_EVENT_DATA_MAX_LEN]; // ADD_SEL_EVENT length is 18
75 uint8_t event_data_length;
76 uint8_t bmc_bus;
77} add_sel_msg_t;
78
79void kcs_device_init(char **config, uint8_t size);
80int kcs_write(uint8_t index, uint8_t *buf, uint32_t buf_sz);
81bool get_kcs_ok();
82void reset_kcs_ok();
83
84#endif
85
86#endif
const struct device * dev
Definition: hal_peci.c:28
K_KERNEL_STACK_MEMBER(wdt_thread_stack, WDT_THREAD_STACK_SIZE)
uint8_t netfn
Definition: ipmb.h:1
uint8_t cmd
Definition: isl69259.c:1
uint8_t data[]
Definition: isl69259.c:2
uint8_t event_class
Definition: pldm_monitor.h:2
uint16_t size
Definition: pldm_oem.h:0
uint32_t data_length
Definition: pldm_oem.h:1
uint8_t event_data[3]
Definition: storage_handler.h:15
Definition: mctp.h:98