linux/drivers/scsi/myrb.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers
 *
 * Copyright 2017 Hannes Reinecke, SUSE Linux GmbH <[email protected]>
 *
 * Based on the original DAC960 driver,
 * Copyright 1998-2001 by Leonard N. Zubkoff <[email protected]>
 * Portions Copyright 2002 by Mylex (An IBM Business Unit)
 *
 */

#include <linux/module.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/raid_class.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_tcq.h>
#include "myrb.h"

static struct raid_template *myrb_raid_template;

static void myrb_monitor(struct work_struct *work);
static inline void myrb_translate_devstate(void *DeviceState);

static inline int myrb_logical_channel(struct Scsi_Host *shost)
{}

static struct myrb_devstate_name_entry {} myrb_devstate_name_list[] =;

static const char *myrb_devstate_name(enum myrb_devstate state)
{}

static struct myrb_raidlevel_name_entry {} myrb_raidlevel_name_list[] =;

static const char *myrb_raidlevel_name(enum myrb_raidlevel level)
{}

/*
 * myrb_create_mempools - allocates auxiliary data structures
 *
 * Return: true on success, false otherwise.
 */
static bool myrb_create_mempools(struct pci_dev *pdev, struct myrb_hba *cb)
{}

/*
 * myrb_destroy_mempools - tears down the memory pools for the controller
 */
static void myrb_destroy_mempools(struct myrb_hba *cb)
{}

/*
 * myrb_reset_cmd - reset command block
 */
static inline void myrb_reset_cmd(struct myrb_cmdblk *cmd_blk)
{}

/*
 * myrb_qcmd - queues command block for execution
 */
static void myrb_qcmd(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk)
{}

/*
 * myrb_exec_cmd - executes command block and waits for completion.
 *
 * Return: command status
 */
static unsigned short myrb_exec_cmd(struct myrb_hba *cb,
		struct myrb_cmdblk *cmd_blk)
{}

/*
 * myrb_exec_type3 - executes a type 3 command and waits for completion.
 *
 * Return: command status
 */
static unsigned short myrb_exec_type3(struct myrb_hba *cb,
		enum myrb_cmd_opcode op, dma_addr_t addr)
{}

/*
 * myrb_exec_type3D - executes a type 3D command and waits for completion.
 *
 * Return: command status
 */
static unsigned short myrb_exec_type3D(struct myrb_hba *cb,
		enum myrb_cmd_opcode op, struct scsi_device *sdev,
		struct myrb_pdev_state *pdev_info)
{}

static char *myrb_event_msg[] =;

/**
 * myrb_get_event - get event log from HBA
 * @cb: pointer to the hba structure
 * @event: number of the event
 *
 * Execute a type 3E command and logs the event message
 */
static void myrb_get_event(struct myrb_hba *cb, unsigned int event)
{}

/*
 * myrb_get_errtable - retrieves the error table from the controller
 *
 * Executes a type 3 command and logs the error table from the controller.
 */
static void myrb_get_errtable(struct myrb_hba *cb)
{}

/*
 * myrb_get_ldev_info - retrieves the logical device table from the controller
 *
 * Executes a type 3 command and updates the logical device table.
 *
 * Return: command status
 */
static unsigned short myrb_get_ldev_info(struct myrb_hba *cb)
{}

/*
 * myrb_get_rbld_progress - get rebuild progress information
 *
 * Executes a type 3 command and returns the rebuild progress
 * information.
 *
 * Return: command status
 */
static unsigned short myrb_get_rbld_progress(struct myrb_hba *cb,
		struct myrb_rbld_progress *rbld)
{}

/*
 * myrb_update_rbld_progress - updates the rebuild status
 *
 * Updates the rebuild status for the attached logical devices.
 */
static void myrb_update_rbld_progress(struct myrb_hba *cb)
{}

/*
 * myrb_get_cc_progress - retrieve the rebuild status
 *
 * Execute a type 3 Command and fetch the rebuild / consistency check
 * status.
 */
static void myrb_get_cc_progress(struct myrb_hba *cb)
{}

/*
 * myrb_bgi_control - updates background initialisation status
 *
 * Executes a type 3B command and updates the background initialisation status
 */
static void myrb_bgi_control(struct myrb_hba *cb)
{}

/*
 * myrb_hba_enquiry - updates the controller status
 *
 * Executes a DAC_V1_Enquiry command and updates the controller status.
 *
 * Return: command status
 */
static unsigned short myrb_hba_enquiry(struct myrb_hba *cb)
{}

/*
 * myrb_set_pdev_state - sets the device state for a physical device
 *
 * Return: command status
 */
static unsigned short myrb_set_pdev_state(struct myrb_hba *cb,
		struct scsi_device *sdev, enum myrb_devstate state)
{}

/*
 * myrb_enable_mmio - enables the Memory Mailbox Interface
 *
 * PD and P controller types have no memory mailbox, but still need the
 * other dma mapped memory.
 *
 * Return: true on success, false otherwise.
 */
static bool myrb_enable_mmio(struct myrb_hba *cb, mbox_mmio_init_t mmio_init_fn)
{}

/*
 * myrb_get_hba_config - reads the configuration information
 *
 * Reads the configuration information from the controller and
 * initializes the controller structure.
 *
 * Return: 0 on success, errno otherwise
 */
static int myrb_get_hba_config(struct myrb_hba *cb)
{}

/*
 * myrb_unmap - unmaps controller structures
 */
static void myrb_unmap(struct myrb_hba *cb)
{}

/*
 * myrb_cleanup - cleanup controller structures
 */
static void myrb_cleanup(struct myrb_hba *cb)
{}

static int myrb_host_reset(struct scsi_cmnd *scmd)
{}

static int myrb_pthru_queuecommand(struct Scsi_Host *shost,
		struct scsi_cmnd *scmd)
{}

static void myrb_inquiry(struct myrb_hba *cb,
		struct scsi_cmnd *scmd)
{}

static void
myrb_mode_sense(struct myrb_hba *cb, struct scsi_cmnd *scmd,
		struct myrb_ldev_info *ldev_info)
{}

static void myrb_request_sense(struct myrb_hba *cb,
		struct scsi_cmnd *scmd)
{}

static void myrb_read_capacity(struct myrb_hba *cb, struct scsi_cmnd *scmd,
		struct myrb_ldev_info *ldev_info)
{}

static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
		struct scsi_cmnd *scmd)
{}

static int myrb_queuecommand(struct Scsi_Host *shost,
		struct scsi_cmnd *scmd)
{}

static int myrb_ldev_slave_alloc(struct scsi_device *sdev)
{}

static int myrb_pdev_slave_alloc(struct scsi_device *sdev)
{}

static int myrb_slave_alloc(struct scsi_device *sdev)
{}

static int myrb_slave_configure(struct scsi_device *sdev)
{}

static void myrb_slave_destroy(struct scsi_device *sdev)
{}

static int myrb_biosparam(struct scsi_device *sdev, struct block_device *bdev,
		sector_t capacity, int geom[])
{}

static ssize_t raid_state_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}

static ssize_t raid_state_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(raid_state);

static ssize_t raid_level_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(raid_level);

static ssize_t rebuild_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}

static ssize_t rebuild_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(rebuild);

static ssize_t consistency_check_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{}

static ssize_t consistency_check_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RW(consistency_check);

static ssize_t ctlr_num_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(ctlr_num);

static ssize_t firmware_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(firmware);

static ssize_t model_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(model);

static ssize_t flush_cache_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{}
static DEVICE_ATTR_WO(flush_cache);

static struct attribute *myrb_sdev_attrs[] =;

ATTRIBUTE_GROUPS();

static struct attribute *myrb_shost_attrs[] =;

ATTRIBUTE_GROUPS();

static const struct scsi_host_template myrb_template =;

/**
 * myrb_is_raid - return boolean indicating device is raid volume
 * @dev: the device struct object
 */
static int myrb_is_raid(struct device *dev)
{}

/**
 * myrb_get_resync - get raid volume resync percent complete
 * @dev: the device struct object
 */
static void myrb_get_resync(struct device *dev)
{}

/**
 * myrb_get_state - get raid volume status
 * @dev: the device struct object
 */
static void myrb_get_state(struct device *dev)
{}

static struct raid_function_template myrb_raid_functions =;

static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk,
		struct scsi_cmnd *scmd)
{}

static void myrb_handle_cmdblk(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk)
{}

static void myrb_monitor(struct work_struct *work)
{}

/*
 * myrb_err_status - reports controller BIOS messages
 *
 * Controller BIOS messages are passed through the Error Status Register
 * when the driver performs the BIOS handshaking.
 *
 * Return: true for fatal errors and false otherwise.
 */
static bool myrb_err_status(struct myrb_hba *cb, unsigned char error,
		unsigned char parm0, unsigned char parm1)
{}

/*
 * Hardware-specific functions
 */

/*
 * DAC960 LA Series Controllers
 */

static inline void DAC960_LA_hw_mbox_new_cmd(void __iomem *base)
{}

static inline void DAC960_LA_ack_hw_mbox_status(void __iomem *base)
{}

static inline void DAC960_LA_reset_ctrl(void __iomem *base)
{}

static inline void DAC960_LA_mem_mbox_new_cmd(void __iomem *base)
{}

static inline bool DAC960_LA_hw_mbox_is_full(void __iomem *base)
{}

static inline bool DAC960_LA_init_in_progress(void __iomem *base)
{}

static inline void DAC960_LA_ack_hw_mbox_intr(void __iomem *base)
{}

static inline void DAC960_LA_ack_intr(void __iomem *base)
{}

static inline bool DAC960_LA_hw_mbox_status_available(void __iomem *base)
{}

static inline void DAC960_LA_enable_intr(void __iomem *base)
{}

static inline void DAC960_LA_disable_intr(void __iomem *base)
{}

static inline void DAC960_LA_write_cmd_mbox(union myrb_cmd_mbox *mem_mbox,
		union myrb_cmd_mbox *mbox)
{}

static inline void DAC960_LA_write_hw_mbox(void __iomem *base,
		union myrb_cmd_mbox *mbox)
{}

static inline unsigned short DAC960_LA_read_status(void __iomem *base)
{}

static inline bool
DAC960_LA_read_error_status(void __iomem *base, unsigned char *error,
		unsigned char *param0, unsigned char *param1)
{}

static inline unsigned short
DAC960_LA_mbox_init(struct pci_dev *pdev, void __iomem *base,
		union myrb_cmd_mbox *mbox)
{}

static int DAC960_LA_hw_init(struct pci_dev *pdev,
		struct myrb_hba *cb, void __iomem *base)
{}

static irqreturn_t DAC960_LA_intr_handler(int irq, void *arg)
{}

static struct myrb_privdata DAC960_LA_privdata =;

/*
 * DAC960 PG Series Controllers
 */
static inline void DAC960_PG_hw_mbox_new_cmd(void __iomem *base)
{}

static inline void DAC960_PG_ack_hw_mbox_status(void __iomem *base)
{}

static inline void DAC960_PG_reset_ctrl(void __iomem *base)
{}

static inline void DAC960_PG_mem_mbox_new_cmd(void __iomem *base)
{}

static inline bool DAC960_PG_hw_mbox_is_full(void __iomem *base)
{}

static inline bool DAC960_PG_init_in_progress(void __iomem *base)
{}

static inline void DAC960_PG_ack_hw_mbox_intr(void __iomem *base)
{}

static inline void DAC960_PG_ack_intr(void __iomem *base)
{}

static inline bool DAC960_PG_hw_mbox_status_available(void __iomem *base)
{}

static inline void DAC960_PG_enable_intr(void __iomem *base)
{}

static inline void DAC960_PG_disable_intr(void __iomem *base)
{}

static inline void DAC960_PG_write_cmd_mbox(union myrb_cmd_mbox *mem_mbox,
		union myrb_cmd_mbox *mbox)
{}

static inline void DAC960_PG_write_hw_mbox(void __iomem *base,
		union myrb_cmd_mbox *mbox)
{}

static inline unsigned short
DAC960_PG_read_status(void __iomem *base)
{}

static inline bool
DAC960_PG_read_error_status(void __iomem *base, unsigned char *error,
		unsigned char *param0, unsigned char *param1)
{}

static inline unsigned short
DAC960_PG_mbox_init(struct pci_dev *pdev, void __iomem *base,
		union myrb_cmd_mbox *mbox)
{}

static int DAC960_PG_hw_init(struct pci_dev *pdev,
		struct myrb_hba *cb, void __iomem *base)
{}

static irqreturn_t DAC960_PG_intr_handler(int irq, void *arg)
{}

static struct myrb_privdata DAC960_PG_privdata =;


/*
 * DAC960 PD Series Controllers
 */

static inline void DAC960_PD_hw_mbox_new_cmd(void __iomem *base)
{}

static inline void DAC960_PD_ack_hw_mbox_status(void __iomem *base)
{}

static inline void DAC960_PD_reset_ctrl(void __iomem *base)
{}

static inline bool DAC960_PD_hw_mbox_is_full(void __iomem *base)
{}

static inline bool DAC960_PD_init_in_progress(void __iomem *base)
{}

static inline void DAC960_PD_ack_intr(void __iomem *base)
{}

static inline bool DAC960_PD_hw_mbox_status_available(void __iomem *base)
{}

static inline void DAC960_PD_enable_intr(void __iomem *base)
{}

static inline void DAC960_PD_disable_intr(void __iomem *base)
{}

static inline void DAC960_PD_write_cmd_mbox(void __iomem *base,
		union myrb_cmd_mbox *mbox)
{}

static inline unsigned char
DAC960_PD_read_status_cmd_ident(void __iomem *base)
{}

static inline unsigned short
DAC960_PD_read_status(void __iomem *base)
{}

static inline bool
DAC960_PD_read_error_status(void __iomem *base, unsigned char *error,
		unsigned char *param0, unsigned char *param1)
{}

static void DAC960_PD_qcmd(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk)
{}

static int DAC960_PD_hw_init(struct pci_dev *pdev,
		struct myrb_hba *cb, void __iomem *base)
{}

static irqreturn_t DAC960_PD_intr_handler(int irq, void *arg)
{}

static struct myrb_privdata DAC960_PD_privdata =;


/*
 * DAC960 P Series Controllers
 *
 * Similar to the DAC960 PD Series Controllers, but some commands have
 * to be translated.
 */

static inline void myrb_translate_enquiry(void *enq)
{}

static inline void myrb_translate_devstate(void *state)
{}

static inline void myrb_translate_to_rw_command(struct myrb_cmdblk *cmd_blk)
{}

static inline void myrb_translate_from_rw_command(struct myrb_cmdblk *cmd_blk)
{}

static void DAC960_P_qcmd(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk)
{}


static int DAC960_P_hw_init(struct pci_dev *pdev,
		struct myrb_hba *cb, void __iomem *base)
{}

static irqreturn_t DAC960_P_intr_handler(int irq, void *arg)
{}

static struct myrb_privdata DAC960_P_privdata =;

static struct myrb_hba *myrb_detect(struct pci_dev *pdev,
		const struct pci_device_id *entry)
{}

static int myrb_probe(struct pci_dev *dev, const struct pci_device_id *entry)
{}


static void myrb_remove(struct pci_dev *pdev)
{}


static const struct pci_device_id myrb_id_table[] =;

MODULE_DEVICE_TABLE(pci, myrb_id_table);

static struct pci_driver myrb_pci_driver =;

static int __init myrb_init_module(void)
{}

static void __exit myrb_cleanup_module(void)
{}

module_init();
module_exit(myrb_cleanup_module);

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();