1
linux/drivers/char/ipmi/kcs_bmc.h
Andrew Jeffery 28651e6c42 ipmi: kcs_bmc: Allow clients to control KCS IRQ state
Add a mechanism for controlling whether the client associated with a
KCS device will receive Input Buffer Full (IBF) and Output Buffer Empty
(OBE) events. This enables an abstract implementation of poll() for KCS
devices.

A wart in the implementation is that the ASPEED KCS devices don't
support an OBE interrupt for the BMC. Instead we pretend it has one by
polling the status register waiting for the Output Buffer Full (OBF) bit
to clear, and generating an event when OBE is observed.

Cc: CS20 KWLiu <KWLIU@nuvoton.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Zev Weiss <zweiss@equinix.com>
Message-Id: <20210608104757.582199-10-andrew@aj.id.au>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-21 19:50:28 -05:00

47 lines
809 B
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015-2018, Intel Corporation.
*/
#ifndef __KCS_BMC_H__
#define __KCS_BMC_H__
#include <linux/list.h>
#define KCS_BMC_EVENT_TYPE_OBE BIT(0)
#define KCS_BMC_EVENT_TYPE_IBF BIT(1)
#define KCS_BMC_STR_OBF BIT(0)
#define KCS_BMC_STR_IBF BIT(1)
#define KCS_BMC_STR_CMD_DAT BIT(3)
/* IPMI 2.0 - 9.5, KCS Interface Registers
* @idr: Input Data Register
* @odr: Output Data Register
* @str: Status Register
*/
struct kcs_ioreg {
u32 idr;
u32 odr;
u32 str;
};
struct kcs_bmc_device_ops;
struct kcs_bmc_client;
struct kcs_bmc_device {
struct list_head entry;
struct device *dev;
u32 channel;
struct kcs_ioreg ioreg;
const struct kcs_bmc_device_ops *ops;
spinlock_t lock;
struct kcs_bmc_client *client;
};
#endif /* __KCS_BMC_H__ */