linux/drivers/char/ipmi/ipmi_kcs_sm.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * ipmi_kcs_sm.c
 *
 * State machine for handling IPMI KCS interfaces.
 *
 * Author: MontaVista Software, Inc.
 *         Corey Minyard <[email protected]>
 *         [email protected]
 *
 * Copyright 2002 MontaVista Software Inc.
 */

/*
 * This state machine is taken from the state machine in the IPMI spec,
 * pretty much verbatim.  If you have questions about the states, see
 * that document.
 */

#define DEBUG

#include <linux/kernel.h> /* For printk. */
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/string.h>
#include <linux/jiffies.h>
#include <linux/ipmi_msgdefs.h>		/* for completion codes */
#include "ipmi_si_sm.h"

/* kcs_debug is a bit-field
 *	KCS_DEBUG_ENABLE -	turned on for now
 *	KCS_DEBUG_MSG    -	commands and their responses
 *	KCS_DEBUG_STATES -	state machine
 */
#define KCS_DEBUG_STATES
#define KCS_DEBUG_MSG
#define KCS_DEBUG_ENABLE

static int kcs_debug;
module_param(kcs_debug, int, 0644);
MODULE_PARM_DESC();

/* The states the KCS driver may be in. */
enum kcs_states {};

#define MAX_KCS_READ_SIZE
#define MAX_KCS_WRITE_SIZE

/* Timeouts in microseconds. */
#define IBF_RETRY_TIMEOUT
#define OBF_RETRY_TIMEOUT
#define MAX_ERROR_RETRIES
#define ERROR0_OBF_WAIT_JIFFIES

struct si_sm_data {};

static unsigned int init_kcs_data_with_state(struct si_sm_data *kcs,
				  struct si_sm_io *io, enum kcs_states state)
{}

static unsigned int init_kcs_data(struct si_sm_data *kcs,
				  struct si_sm_io *io)
{}

static inline unsigned char read_status(struct si_sm_data *kcs)
{}

static inline unsigned char read_data(struct si_sm_data *kcs)
{}

static inline void write_cmd(struct si_sm_data *kcs, unsigned char data)
{}

static inline void write_data(struct si_sm_data *kcs, unsigned char data)
{}

/* Control codes. */
#define KCS_GET_STATUS_ABORT
#define KCS_WRITE_START
#define KCS_WRITE_END
#define KCS_READ_BYTE

/* Status bits. */
#define GET_STATUS_STATE(status)
#define KCS_IDLE_STATE
#define KCS_READ_STATE
#define KCS_WRITE_STATE
#define KCS_ERROR_STATE
#define GET_STATUS_ATN(status)
#define GET_STATUS_IBF(status)
#define GET_STATUS_OBF(status)


static inline void write_next_byte(struct si_sm_data *kcs)
{}

static inline void start_error_recovery(struct si_sm_data *kcs, char *reason)
{}

static inline void read_next_byte(struct si_sm_data *kcs)
{}

static inline int check_ibf(struct si_sm_data *kcs, unsigned char status,
			    long time)
{}

static inline int check_obf(struct si_sm_data *kcs, unsigned char status,
			    long time)
{}

static void clear_obf(struct si_sm_data *kcs, unsigned char status)
{}

static void restart_kcs_transaction(struct si_sm_data *kcs)
{}

static int start_kcs_transaction(struct si_sm_data *kcs, unsigned char *data,
				 unsigned int size)
{}

static int get_kcs_result(struct si_sm_data *kcs, unsigned char *data,
			  unsigned int length)
{}

/*
 * This implements the state machine defined in the IPMI manual, see
 * that for details on how this works.  Divide that flowchart into
 * sections delimited by "Wait for IBF" and this will become clear.
 */
static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
{}

static int kcs_size(void)
{}

static int kcs_detect(struct si_sm_data *kcs)
{}

static void kcs_cleanup(struct si_sm_data *kcs)
{}

const struct si_sm_handlers kcs_smi_handlers =;