linux/drivers/char/ipmi/ipmi_smic_sm.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * ipmi_smic_sm.c
 *
 * The state-machine driver for an IPMI SMIC driver
 *
 * It started as a copy of Corey Minyard's driver for the KSC interface
 * and the kernel patch "mmcdev-patch-245" by HP
 *
 * modified by:	Hannes Schulz <[email protected]>
 *		[email protected]
 *
 *
 * Corey Minyard's driver for the KSC interface has the following
 * copyright notice:
 *   Copyright 2002 MontaVista Software Inc.
 *
 * the kernel patch "mmcdev-patch-245" by HP has the following
 * copyright notice:
 * (c) Copyright 2001 Grant Grundler (c) Copyright
 * 2001 Hewlett-Packard Company
 */

#define DEBUG

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

/* smic_debug is a bit-field
 *	SMIC_DEBUG_ENABLE -	turned on for now
 *	SMIC_DEBUG_MSG -	commands and their responses
 *	SMIC_DEBUG_STATES -	state machine
*/
#define SMIC_DEBUG_STATES
#define SMIC_DEBUG_MSG
#define SMIC_DEBUG_ENABLE

static int smic_debug =;
module_param(smic_debug, int, 0644);
MODULE_PARM_DESC();

enum smic_states {};

#define MAX_SMIC_READ_SIZE
#define MAX_SMIC_WRITE_SIZE
#define SMIC_MAX_ERROR_RETRIES

/* Timeouts in microseconds. */
#define SMIC_RETRY_TIMEOUT

/* SMIC Flags Register Bits */
#define SMIC_RX_DATA_READY
#define SMIC_TX_DATA_READY

/*
 * SMIC_SMI and SMIC_EVM_DATA_AVAIL are only used by
 * a few systems, and then only by Systems Management
 * Interrupts, not by the OS.  Always ignore these bits.
 *
 */
#define SMIC_SMI
#define SMIC_EVM_DATA_AVAIL
#define SMIC_SMS_DATA_AVAIL
#define SMIC_FLAG_BSY

/* SMIC Error Codes */
#define EC_NO_ERROR
#define EC_ABORTED
#define EC_ILLEGAL_CONTROL
#define EC_NO_RESPONSE
#define EC_ILLEGAL_COMMAND
#define EC_BUFFER_FULL

struct si_sm_data {};

static unsigned int init_smic_data(struct si_sm_data *smic,
				   struct si_sm_io *io)
{}

static int start_smic_transaction(struct si_sm_data *smic,
				  unsigned char *data, unsigned int size)
{}

static int smic_get_result(struct si_sm_data *smic,
			   unsigned char *data, unsigned int length)
{}

static inline unsigned char read_smic_flags(struct si_sm_data *smic)
{}

static inline unsigned char read_smic_status(struct si_sm_data *smic)
{}

static inline unsigned char read_smic_data(struct si_sm_data *smic)
{}

static inline void write_smic_flags(struct si_sm_data *smic,
				    unsigned char   flags)
{}

static inline void write_smic_control(struct si_sm_data *smic,
				      unsigned char   control)
{}

static inline void write_si_sm_data(struct si_sm_data *smic,
				    unsigned char   data)
{}

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

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

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

/*  SMIC Control/Status Code Components */
#define SMIC_GET_STATUS
#define SMIC_READY
#define SMIC_WR_START
#define SMIC_WR_NEXT
#define SMIC_WR_END
#define SMIC_RD_START
#define SMIC_RD_NEXT
#define SMIC_RD_END
#define SMIC_CODE_MASK

#define SMIC_CONTROL
#define SMIC_STATUS
#define SMIC_CS_MASK

#define SMIC_SMS
#define SMIC_SMM
#define SMIC_STREAM_MASK

/*  SMIC Control Codes */
#define SMIC_CC_SMS_GET_STATUS
#define SMIC_CC_SMS_WR_START
#define SMIC_CC_SMS_WR_NEXT
#define SMIC_CC_SMS_WR_END
#define SMIC_CC_SMS_RD_START
#define SMIC_CC_SMS_RD_NEXT
#define SMIC_CC_SMS_RD_END

#define SMIC_CC_SMM_GET_STATUS
#define SMIC_CC_SMM_WR_START
#define SMIC_CC_SMM_WR_NEXT
#define SMIC_CC_SMM_WR_END
#define SMIC_CC_SMM_RD_START
#define SMIC_CC_SMM_RD_NEXT
#define SMIC_CC_SMM_RD_END

/*  SMIC Status Codes */
#define SMIC_SC_SMS_READY
#define SMIC_SC_SMS_WR_START
#define SMIC_SC_SMS_WR_NEXT
#define SMIC_SC_SMS_WR_END
#define SMIC_SC_SMS_RD_START
#define SMIC_SC_SMS_RD_NEXT
#define SMIC_SC_SMS_RD_END

#define SMIC_SC_SMM_READY
#define SMIC_SC_SMM_WR_START
#define SMIC_SC_SMM_WR_NEXT
#define SMIC_SC_SMM_WR_END
#define SMIC_SC_SMM_RD_START
#define SMIC_SC_SMM_RD_NEXT
#define SMIC_SC_SMM_RD_END

/* these are the control/status codes we actually use
	SMIC_CC_SMS_GET_STATUS	0x40
	SMIC_CC_SMS_WR_START	0x41
	SMIC_CC_SMS_WR_NEXT	0x42
	SMIC_CC_SMS_WR_END	0x43
	SMIC_CC_SMS_RD_START	0x44
	SMIC_CC_SMS_RD_NEXT	0x45
	SMIC_CC_SMS_RD_END	0x46

	SMIC_SC_SMS_READY	0xC0
	SMIC_SC_SMS_WR_START	0xC1
	SMIC_SC_SMS_WR_NEXT	0xC2
	SMIC_SC_SMS_WR_END	0xC3
	SMIC_SC_SMS_RD_START	0xC4
	SMIC_SC_SMS_RD_NEXT	0xC5
	SMIC_SC_SMS_RD_END	0xC6
*/

static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
{}

static int smic_detect(struct si_sm_data *smic)
{}

static void smic_cleanup(struct si_sm_data *kcs)
{}

static int smic_size(void)
{}

const struct si_sm_handlers smic_smi_handlers =;