kcs_bmc.h (d7096970075ef47c9906fd241cc4939cc11ddd01) | kcs_bmc.h (faae6e391eda73a5b9870c78349064282a625bfa) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (c) 2015-2018, Intel Corporation. 4 */ 5 6#ifndef __KCS_BMC_H__ 7#define __KCS_BMC_H__ 8 9#include <linux/miscdevice.h> 10 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (c) 2015-2018, Intel Corporation. 4 */ 5 6#ifndef __KCS_BMC_H__ 7#define __KCS_BMC_H__ 8 9#include <linux/miscdevice.h> 10 |
11#include "kcs_bmc_client.h" 12 13#define KCS_BMC_STR_OBF BIT(0) 14#define KCS_BMC_STR_IBF BIT(1) 15#define KCS_BMC_STR_CMD_DAT BIT(3) 16 |
|
11/* Different phases of the KCS BMC module. 12 * KCS_PHASE_IDLE: 13 * BMC should not be expecting nor sending any data. 14 * KCS_PHASE_WRITE_START: 15 * BMC is receiving a WRITE_START command from system software. 16 * KCS_PHASE_WRITE_DATA: 17 * BMC is receiving a data byte from system software. 18 * KCS_PHASE_WRITE_END_CMD: --- 42 unchanged lines hidden (view full) --- 61 * @str: Status Register 62 */ 63struct kcs_ioreg { 64 u32 idr; 65 u32 odr; 66 u32 str; 67}; 68 | 17/* Different phases of the KCS BMC module. 18 * KCS_PHASE_IDLE: 19 * BMC should not be expecting nor sending any data. 20 * KCS_PHASE_WRITE_START: 21 * BMC is receiving a WRITE_START command from system software. 22 * KCS_PHASE_WRITE_DATA: 23 * BMC is receiving a data byte from system software. 24 * KCS_PHASE_WRITE_END_CMD: --- 42 unchanged lines hidden (view full) --- 67 * @str: Status Register 68 */ 69struct kcs_ioreg { 70 u32 idr; 71 u32 odr; 72 u32 str; 73}; 74 |
75struct kcs_bmc_device_ops; 76 |
|
69struct kcs_bmc { 70 struct device *dev; 71 | 77struct kcs_bmc { 78 struct device *dev; 79 |
80 const struct kcs_bmc_device_ops *ops; 81 82 struct kcs_bmc_client client; 83 |
|
72 spinlock_t lock; 73 74 u32 channel; 75 int running; 76 | 84 spinlock_t lock; 85 86 u32 channel; 87 int running; 88 |
77 /* Setup by BMC KCS controller driver */ | |
78 struct kcs_ioreg ioreg; | 89 struct kcs_ioreg ioreg; |
79 u8 (*io_inputb)(struct kcs_bmc *kcs_bmc, u32 reg); 80 void (*io_outputb)(struct kcs_bmc *kcs_bmc, u32 reg, u8 b); 81 void (*io_updateb)(struct kcs_bmc *kcs_bmc, u32 reg, u8 mask, u8 val); | |
82 83 enum kcs_phases phase; 84 enum kcs_errors error; 85 86 wait_queue_head_t queue; 87 bool data_in_avail; 88 int data_in_idx; 89 u8 *data_in; 90 91 int data_out_idx; 92 int data_out_len; 93 u8 *data_out; 94 95 struct mutex mutex; 96 u8 *kbuffer; 97 98 struct miscdevice miscdev; 99}; | 90 91 enum kcs_phases phase; 92 enum kcs_errors error; 93 94 wait_queue_head_t queue; 95 bool data_in_avail; 96 int data_in_idx; 97 u8 *data_in; 98 99 int data_out_idx; 100 int data_out_len; 101 u8 *data_out; 102 103 struct mutex mutex; 104 u8 *kbuffer; 105 106 struct miscdevice miscdev; 107}; |
100 101int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc); 102int kcs_bmc_add_device(struct kcs_bmc *kcs_bmc); 103void kcs_bmc_remove_device(struct kcs_bmc *kcs_bmc); 104 105u8 kcs_bmc_read_data(struct kcs_bmc *kcs_bmc); 106void kcs_bmc_write_data(struct kcs_bmc *kcs_bmc, u8 data); 107u8 kcs_bmc_read_status(struct kcs_bmc *kcs_bmc); 108void kcs_bmc_write_status(struct kcs_bmc *kcs_bmc, u8 data); 109void kcs_bmc_update_status(struct kcs_bmc *kcs_bmc, u8 mask, u8 val); 110 | |
111#endif /* __KCS_BMC_H__ */ | 108#endif /* __KCS_BMC_H__ */ |