#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/compat.h>
#include <linux/blktrace_api.h>
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/completion.h>
#include <linux/moduleparam.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_transport_sas.h>
#include <scsi/scsi_dbg.h>
#include <linux/cciss_ioctl.h>
#include <linux/string.h>
#include <linux/bitmap.h>
#include <linux/atomic.h>
#include <linux/jiffies.h>
#include <linux/percpu-defs.h>
#include <linux/percpu.h>
#include <asm/unaligned.h>
#include <asm/div64.h>
#include "hpsa_cmd.h"
#include "hpsa.h"
#define HPSA_DRIVER_VERSION …
#define DRIVER_NAME …
#define HPSA …
#define CLEAR_EVENT_WAIT_INTERVAL …
#define MODE_CHANGE_WAIT_INTERVAL …
#define MAX_CLEAR_EVENT_WAIT …
#define MAX_MODE_CHANGE_WAIT …
#define MAX_IOCTL_CONFIG_WAIT …
#define MAX_CMD_RETRIES …
#define HPSA_EH_PTRAID_TIMEOUT …
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_VERSION(…);
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;
static int hpsa_simple_mode;
module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
static const struct pci_device_id hpsa_pci_device_id[] = …;
MODULE_DEVICE_TABLE(pci, hpsa_pci_device_id);
static struct board_type products[] = …;
static struct scsi_transport_template *hpsa_sas_transport_template;
static int hpsa_add_sas_host(struct ctlr_info *h);
static void hpsa_delete_sas_host(struct ctlr_info *h);
static int hpsa_add_sas_device(struct hpsa_sas_node *hpsa_sas_node,
struct hpsa_scsi_dev_t *device);
static void hpsa_remove_sas_device(struct hpsa_scsi_dev_t *device);
static struct hpsa_scsi_dev_t
*hpsa_find_device_by_sas_rphy(struct ctlr_info *h,
struct sas_rphy *rphy);
#define SCSI_CMD_BUSY …
static const struct scsi_cmnd hpsa_cmd_busy;
#define SCSI_CMD_IDLE …
static const struct scsi_cmnd hpsa_cmd_idle;
static int number_of_controllers;
static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id);
static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id);
static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
void __user *arg);
static int hpsa_passthru_ioctl(struct ctlr_info *h,
IOCTL_Command_struct *iocommand);
static int hpsa_big_passthru_ioctl(struct ctlr_info *h,
BIG_IOCTL_Command_struct *ioc);
#ifdef CONFIG_COMPAT
static int hpsa_compat_ioctl(struct scsi_device *dev, unsigned int cmd,
void __user *arg);
#endif
static void cmd_free(struct ctlr_info *h, struct CommandList *c);
static struct CommandList *cmd_alloc(struct ctlr_info *h);
static void cmd_tagged_free(struct ctlr_info *h, struct CommandList *c);
static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h,
struct scsi_cmnd *scmd);
static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
void *buff, size_t size, u16 page_code, unsigned char *scsi3addr,
int cmd_type);
static void hpsa_free_cmd_pool(struct ctlr_info *h);
#define VPD_PAGE …
#define HPSA_SIMPLE_ERROR_BITS …
static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
static void hpsa_scan_start(struct Scsi_Host *);
static int hpsa_scan_finished(struct Scsi_Host *sh,
unsigned long elapsed_time);
static int hpsa_change_queue_depth(struct scsi_device *sdev, int qdepth);
static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd);
static int hpsa_slave_alloc(struct scsi_device *sdev);
static int hpsa_slave_configure(struct scsi_device *sdev);
static void hpsa_slave_destroy(struct scsi_device *sdev);
static void hpsa_update_scsi_devices(struct ctlr_info *h);
static int check_for_unit_attention(struct ctlr_info *h,
struct CommandList *c);
static void check_ioctl_unit_attention(struct ctlr_info *h,
struct CommandList *c);
static void calc_bucket_map(int *bucket, int num_buckets,
int nsgs, int min_blocks, u32 *bucket_map);
static void hpsa_free_performant_mode(struct ctlr_info *h);
static int hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h);
static inline u32 next_command(struct ctlr_info *h, u8 q);
static int hpsa_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
u32 *cfg_base_addr, u64 *cfg_base_addr_index,
u64 *cfg_offset);
static int hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
unsigned long *memory_bar);
static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
bool *legacy_board);
static int wait_for_device_to_become_ready(struct ctlr_info *h,
unsigned char lunaddr[],
int reply_queue);
static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
int wait_for_ready);
static inline void finish_cmd(struct CommandList *c);
static int hpsa_wait_for_mode_change_ack(struct ctlr_info *h);
#define BOARD_NOT_READY …
#define BOARD_READY …
static void hpsa_drain_accel_commands(struct ctlr_info *h);
static void hpsa_flush_cache(struct ctlr_info *h);
static int hpsa_scsi_ioaccel_queue_command(struct ctlr_info *h,
struct CommandList *c, u32 ioaccel_handle, u8 *cdb, int cdb_len,
u8 *scsi3addr, struct hpsa_scsi_dev_t *phys_disk);
static void hpsa_command_resubmit_worker(struct work_struct *work);
static u32 lockup_detected(struct ctlr_info *h);
static int detect_controller_lockup(struct ctlr_info *h);
static void hpsa_disable_rld_caching(struct ctlr_info *h);
static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
struct ReportExtendedLUNdata *buf, int bufsize);
static bool hpsa_vpd_page_supported(struct ctlr_info *h,
unsigned char scsi3addr[], u8 page);
static int hpsa_luns_changed(struct ctlr_info *h);
static bool hpsa_cmd_dev_match(struct ctlr_info *h, struct CommandList *c,
struct hpsa_scsi_dev_t *dev,
unsigned char *scsi3addr);
static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
{ … }
static inline struct ctlr_info *shost_to_hba(struct Scsi_Host *sh)
{ … }
static inline bool hpsa_is_cmd_idle(struct CommandList *c)
{ … }
static void decode_sense_data(const u8 *sense_data, int sense_data_len,
u8 *sense_key, u8 *asc, u8 *ascq)
{ … }
static int check_for_unit_attention(struct ctlr_info *h,
struct CommandList *c)
{ … }
static int check_for_busy(struct ctlr_info *h, struct CommandList *c)
{ … }
static u32 lockup_detected(struct ctlr_info *h);
static ssize_t host_show_lockup_detected(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t host_store_hp_ssd_smart_path_status(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t host_store_raid_offload_debug(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t host_store_rescan(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static void hpsa_turn_off_ioaccel_for_device(struct hpsa_scsi_dev_t *device)
{ … }
static ssize_t host_show_firmware_revision(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t host_show_commands_outstanding(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t host_show_transport_mode(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t host_show_hp_ssd_smart_path_status(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static u32 unresettable_controller[] = …;
static u32 soft_unresettable_controller[] = …;
static int board_id_in_array(u32 a[], int nelems, u32 board_id)
{ … }
static int ctlr_is_hard_resettable(u32 board_id)
{ … }
static int ctlr_is_soft_resettable(u32 board_id)
{ … }
static int ctlr_is_resettable(u32 board_id)
{ … }
static ssize_t host_show_resettable(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static inline int is_logical_dev_addr_mode(unsigned char scsi3addr[])
{ … }
static const char * const raid_label[] = …;
#define HPSA_RAID_0 …
#define HPSA_RAID_4 …
#define HPSA_RAID_1 …
#define HPSA_RAID_5 …
#define HPSA_RAID_51 …
#define HPSA_RAID_6 …
#define HPSA_RAID_ADM …
#define RAID_UNKNOWN …
#define PHYSICAL_DRIVE …
static inline bool is_logical_device(struct hpsa_scsi_dev_t *device)
{ … }
static ssize_t raid_level_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t lunid_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t unique_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t sas_address_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t host_show_hp_ssd_smart_path_enabled(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
#define MAX_PATHS …
static ssize_t path_info_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t host_show_ctlr_num(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t host_show_legacy_board(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(raid_level);
static DEVICE_ATTR_RO(lunid);
static DEVICE_ATTR_RO(unique_id);
static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
static DEVICE_ATTR_RO(sas_address);
static DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO,
host_show_hp_ssd_smart_path_enabled, NULL);
static DEVICE_ATTR_RO(path_info);
static DEVICE_ATTR(hp_ssd_smart_path_status, S_IWUSR|S_IRUGO|S_IROTH,
host_show_hp_ssd_smart_path_status,
host_store_hp_ssd_smart_path_status);
static DEVICE_ATTR(raid_offload_debug, S_IWUSR, NULL,
host_store_raid_offload_debug);
static DEVICE_ATTR(firmware_revision, S_IRUGO,
host_show_firmware_revision, NULL);
static DEVICE_ATTR(commands_outstanding, S_IRUGO,
host_show_commands_outstanding, NULL);
static DEVICE_ATTR(transport_mode, S_IRUGO,
host_show_transport_mode, NULL);
static DEVICE_ATTR(resettable, S_IRUGO,
host_show_resettable, NULL);
static DEVICE_ATTR(lockup_detected, S_IRUGO,
host_show_lockup_detected, NULL);
static DEVICE_ATTR(ctlr_num, S_IRUGO,
host_show_ctlr_num, NULL);
static DEVICE_ATTR(legacy_board, S_IRUGO,
host_show_legacy_board, NULL);
static struct attribute *hpsa_sdev_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static struct attribute *hpsa_shost_attrs[] = …;
ATTRIBUTE_GROUPS(…);
#define HPSA_NRESERVED_CMDS …
static const struct scsi_host_template hpsa_driver_template = …;
static inline u32 next_command(struct ctlr_info *h, u8 q)
{ … }
#define DEFAULT_REPLY_QUEUE …
static void set_performant_mode(struct ctlr_info *h, struct CommandList *c,
int reply_queue)
{ … }
static void set_ioaccel1_performant_mode(struct ctlr_info *h,
struct CommandList *c,
int reply_queue)
{ … }
static void set_ioaccel2_tmf_performant_mode(struct ctlr_info *h,
struct CommandList *c,
int reply_queue)
{ … }
static void set_ioaccel2_performant_mode(struct ctlr_info *h,
struct CommandList *c,
int reply_queue)
{ … }
static int is_firmware_flash_cmd(u8 *cdb)
{ … }
#define HEARTBEAT_SAMPLE_INTERVAL_DURING_FLASH …
#define HEARTBEAT_SAMPLE_INTERVAL …
#define HPSA_EVENT_MONITOR_INTERVAL …
static void dial_down_lockup_detection_during_fw_flash(struct ctlr_info *h,
struct CommandList *c)
{ … }
static void dial_up_lockup_detection_on_fw_flash_complete(struct ctlr_info *h,
struct CommandList *c)
{ … }
static void __enqueue_cmd_and_start_io(struct ctlr_info *h,
struct CommandList *c, int reply_queue)
{ … }
static void enqueue_cmd_and_start_io(struct ctlr_info *h, struct CommandList *c)
{ … }
static inline int is_hba_lunid(unsigned char scsi3addr[])
{ … }
static inline int is_scsi_rev_5(struct ctlr_info *h)
{ … }
static int hpsa_find_target_lun(struct ctlr_info *h,
unsigned char scsi3addr[], int bus, int *target, int *lun)
{ … }
static void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
struct hpsa_scsi_dev_t *dev, char *description)
{ … }
static int hpsa_scsi_add_entry(struct ctlr_info *h,
struct hpsa_scsi_dev_t *device,
struct hpsa_scsi_dev_t *added[], int *nadded)
{ … }
static void hpsa_scsi_update_entry(struct ctlr_info *h,
int entry, struct hpsa_scsi_dev_t *new_entry)
{ … }
static void hpsa_scsi_replace_entry(struct ctlr_info *h,
int entry, struct hpsa_scsi_dev_t *new_entry,
struct hpsa_scsi_dev_t *added[], int *nadded,
struct hpsa_scsi_dev_t *removed[], int *nremoved)
{ … }
static void hpsa_scsi_remove_entry(struct ctlr_info *h, int entry,
struct hpsa_scsi_dev_t *removed[], int *nremoved)
{ … }
#define SCSI3ADDR_EQ(a, b) …
static void fixup_botched_add(struct ctlr_info *h,
struct hpsa_scsi_dev_t *added)
{ … }
static inline int device_is_the_same(struct hpsa_scsi_dev_t *dev1,
struct hpsa_scsi_dev_t *dev2)
{ … }
static inline int device_updated(struct hpsa_scsi_dev_t *dev1,
struct hpsa_scsi_dev_t *dev2)
{ … }
static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
struct hpsa_scsi_dev_t *haystack[], int haystack_size,
int *index)
{ … }
static void hpsa_monitor_offline_device(struct ctlr_info *h,
unsigned char scsi3addr[])
{ … }
static void hpsa_show_volume_status(struct ctlr_info *h,
struct hpsa_scsi_dev_t *sd)
{ … }
static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h,
struct hpsa_scsi_dev_t *dev[], int ndevices,
struct hpsa_scsi_dev_t *logical_drive)
{ … }
static void hpsa_update_log_drive_phys_drive_ptrs(struct ctlr_info *h,
struct hpsa_scsi_dev_t *dev[], int ndevices)
{ … }
static int hpsa_add_device(struct ctlr_info *h, struct hpsa_scsi_dev_t *device)
{ … }
static int hpsa_find_outstanding_commands_for_dev(struct ctlr_info *h,
struct hpsa_scsi_dev_t *dev)
{ … }
#define NUM_WAIT …
static void hpsa_wait_for_outstanding_commands_for_dev(struct ctlr_info *h,
struct hpsa_scsi_dev_t *device)
{ … }
static void hpsa_remove_device(struct ctlr_info *h,
struct hpsa_scsi_dev_t *device)
{ … }
static void adjust_hpsa_scsi_table(struct ctlr_info *h,
struct hpsa_scsi_dev_t *sd[], int nsds)
{ … }
static struct hpsa_scsi_dev_t *lookup_hpsa_scsi_dev(struct ctlr_info *h,
int bus, int target, int lun)
{ … }
static int hpsa_slave_alloc(struct scsi_device *sdev)
{ … }
#define CTLR_TIMEOUT …
static int hpsa_slave_configure(struct scsi_device *sdev)
{ … }
static void hpsa_slave_destroy(struct scsi_device *sdev)
{ … }
static void hpsa_free_ioaccel2_sg_chain_blocks(struct ctlr_info *h)
{ … }
static int hpsa_allocate_ioaccel2_sg_chain_blocks(struct ctlr_info *h)
{ … }
static void hpsa_free_sg_chain_blocks(struct ctlr_info *h)
{ … }
static int hpsa_alloc_sg_chain_blocks(struct ctlr_info *h)
{ … }
static int hpsa_map_ioaccel2_sg_chain_block(struct ctlr_info *h,
struct io_accel2_cmd *cp, struct CommandList *c)
{ … }
static void hpsa_unmap_ioaccel2_sg_chain_block(struct ctlr_info *h,
struct io_accel2_cmd *cp)
{ … }
static int hpsa_map_sg_chain_block(struct ctlr_info *h,
struct CommandList *c)
{ … }
static void hpsa_unmap_sg_chain_block(struct ctlr_info *h,
struct CommandList *c)
{ … }
static int handle_ioaccel_mode2_error(struct ctlr_info *h,
struct CommandList *c,
struct scsi_cmnd *cmd,
struct io_accel2_cmd *c2,
struct hpsa_scsi_dev_t *dev)
{ … }
static void hpsa_cmd_resolve_events(struct ctlr_info *h,
struct CommandList *c)
{ … }
static void hpsa_cmd_resolve_and_free(struct ctlr_info *h,
struct CommandList *c)
{ … }
static void hpsa_cmd_free_and_done(struct ctlr_info *h,
struct CommandList *c, struct scsi_cmnd *cmd)
{ … }
static void hpsa_retry_cmd(struct ctlr_info *h, struct CommandList *c)
{ … }
static void process_ioaccel2_completion(struct ctlr_info *h,
struct CommandList *c, struct scsi_cmnd *cmd,
struct hpsa_scsi_dev_t *dev)
{ … }
static int hpsa_evaluate_tmf_status(struct ctlr_info *h,
struct CommandList *cp)
{ … }
static void complete_scsi_command(struct CommandList *cp)
{ … }
static void hpsa_pci_unmap(struct pci_dev *pdev, struct CommandList *c,
int sg_used, enum dma_data_direction data_direction)
{ … }
static int hpsa_map_one(struct pci_dev *pdev,
struct CommandList *cp,
unsigned char *buf,
size_t buflen,
enum dma_data_direction data_direction)
{ … }
#define NO_TIMEOUT …
#define DEFAULT_TIMEOUT …
static int hpsa_scsi_do_simple_cmd_core(struct ctlr_info *h,
struct CommandList *c, int reply_queue, unsigned long timeout_msecs)
{ … }
static int hpsa_scsi_do_simple_cmd(struct ctlr_info *h, struct CommandList *c,
int reply_queue, unsigned long timeout_msecs)
{ … }
static u32 lockup_detected(struct ctlr_info *h)
{ … }
#define MAX_DRIVER_CMD_RETRIES …
static int hpsa_scsi_do_simple_cmd_with_retry(struct ctlr_info *h,
struct CommandList *c, enum dma_data_direction data_direction,
unsigned long timeout_msecs)
{ … }
static void hpsa_print_cmd(struct ctlr_info *h, char *txt,
struct CommandList *c)
{ … }
static void hpsa_scsi_interpret_error(struct ctlr_info *h,
struct CommandList *cp)
{ … }
static int hpsa_do_receive_diagnostic(struct ctlr_info *h, u8 *scsi3addr,
u8 page, u8 *buf, size_t bufsize)
{ … }
static u64 hpsa_get_enclosure_logical_identifier(struct ctlr_info *h,
u8 *scsi3addr)
{ … }
static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
u16 page, unsigned char *buf,
unsigned char bufsize)
{ … }
static int hpsa_send_reset(struct ctlr_info *h, struct hpsa_scsi_dev_t *dev,
u8 reset_type, int reply_queue)
{ … }
static bool hpsa_cmd_dev_match(struct ctlr_info *h, struct CommandList *c,
struct hpsa_scsi_dev_t *dev,
unsigned char *scsi3addr)
{ … }
static int hpsa_do_reset(struct ctlr_info *h, struct hpsa_scsi_dev_t *dev,
u8 reset_type, int reply_queue)
{ … }
static void hpsa_get_raid_level(struct ctlr_info *h,
unsigned char *scsi3addr, unsigned char *raid_level)
{ … }
#define HPSA_MAP_DEBUG
#ifdef HPSA_MAP_DEBUG
static void hpsa_debug_map_buff(struct ctlr_info *h, int rc,
struct raid_map_data *map_buff)
{ … }
#else
static void hpsa_debug_map_buff(__attribute__((unused)) struct ctlr_info *h,
__attribute__((unused)) int rc,
__attribute__((unused)) struct raid_map_data *map_buff)
{
}
#endif
static int hpsa_get_raid_map(struct ctlr_info *h,
unsigned char *scsi3addr, struct hpsa_scsi_dev_t *this_device)
{ … }
static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h,
unsigned char scsi3addr[], u16 bmic_device_index,
struct bmic_sense_subsystem_info *buf, size_t bufsize)
{ … }
static int hpsa_bmic_id_controller(struct ctlr_info *h,
struct bmic_identify_controller *buf, size_t bufsize)
{ … }
static int hpsa_bmic_id_physical_device(struct ctlr_info *h,
unsigned char scsi3addr[], u16 bmic_device_index,
struct bmic_identify_physical_device *buf, size_t bufsize)
{ … }
static void hpsa_get_enclosure_info(struct ctlr_info *h,
unsigned char *scsi3addr,
struct ReportExtendedLUNdata *rlep, int rle_index,
struct hpsa_scsi_dev_t *encl_dev)
{ … }
static u64 hpsa_get_sas_address_from_report_physical(struct ctlr_info *h,
unsigned char *scsi3addr)
{ … }
static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr,
struct hpsa_scsi_dev_t *dev)
{ … }
static void hpsa_ext_ctrl_present(struct ctlr_info *h,
struct ReportExtendedLUNdata *physdev)
{ … }
static bool hpsa_vpd_page_supported(struct ctlr_info *h,
unsigned char scsi3addr[], u8 page)
{ … }
static void hpsa_get_ioaccel_status(struct ctlr_info *h,
unsigned char *scsi3addr, struct hpsa_scsi_dev_t *this_device)
{ … }
static int hpsa_get_device_id(struct ctlr_info *h, unsigned char *scsi3addr,
unsigned char *device_id, int index, int buflen)
{ … }
static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
void *buf, int bufsize,
int extended_response)
{ … }
static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
struct ReportExtendedLUNdata *buf, int bufsize)
{ … }
static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h,
struct ReportLUNdata *buf, int bufsize)
{ … }
static inline void hpsa_set_bus_target_lun(struct hpsa_scsi_dev_t *device,
int bus, int target, int lun)
{ … }
static int hpsa_get_volume_status(struct ctlr_info *h,
unsigned char scsi3addr[])
{ … }
static unsigned char hpsa_volume_offline(struct ctlr_info *h,
unsigned char scsi3addr[])
{ … }
static int hpsa_update_device_info(struct ctlr_info *h,
unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device,
unsigned char *is_OBDR_device)
{ … }
static void figure_bus_target_lun(struct ctlr_info *h,
u8 *lunaddrbytes, struct hpsa_scsi_dev_t *device)
{ … }
static int figure_external_status(struct ctlr_info *h, int raid_ctlr_position,
int i, int nphysicals, int nlocal_logicals)
{ … }
static int hpsa_gather_lun_info(struct ctlr_info *h,
struct ReportExtendedLUNdata *physdev, u32 *nphysicals,
struct ReportLUNdata *logdev, u32 *nlogicals)
{ … }
static u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position,
int i, int nphysicals, int nlogicals,
struct ReportExtendedLUNdata *physdev_list,
struct ReportLUNdata *logdev_list)
{ … }
static void hpsa_get_ioaccel_drive_info(struct ctlr_info *h,
struct hpsa_scsi_dev_t *dev,
struct ReportExtendedLUNdata *rlep, int rle_index,
struct bmic_identify_physical_device *id_phys)
{ … }
static void hpsa_get_path_info(struct hpsa_scsi_dev_t *this_device,
struct ReportExtendedLUNdata *rlep, int rle_index,
struct bmic_identify_physical_device *id_phys)
{ … }
static int hpsa_set_local_logical_count(struct ctlr_info *h,
struct bmic_identify_controller *id_ctlr,
u32 *nlocals)
{ … }
static bool hpsa_is_disk_spare(struct ctlr_info *h, u8 *lunaddrbytes)
{ … }
#define RPL_DEV_FLAG_NON_DISK …
#define RPL_DEV_FLAG_UNCONFIG_DISK_REPORTING_SUPPORTED …
#define RPL_DEV_FLAG_UNCONFIG_DISK …
#define BMIC_DEVICE_TYPE_ENCLOSURE …
static bool hpsa_skip_device(struct ctlr_info *h, u8 *lunaddrbytes,
struct ext_report_lun_entry *rle)
{ … }
static void hpsa_update_scsi_devices(struct ctlr_info *h)
{ … }
static void hpsa_set_sg_descriptor(struct SGDescriptor *desc,
struct scatterlist *sg)
{ … }
static int hpsa_scatter_gather(struct ctlr_info *h,
struct CommandList *cp,
struct scsi_cmnd *cmd)
{ … }
static inline void warn_zero_length_transfer(struct ctlr_info *h,
u8 *cdb, int cdb_len,
const char *func)
{ … }
#define IO_ACCEL_INELIGIBLE …
static bool is_zero_length_transfer(u8 *cdb)
{ … }
static int fixup_ioaccel_cdb(u8 *cdb, int *cdb_len)
{ … }
static int hpsa_scsi_ioaccel1_queue_command(struct ctlr_info *h,
struct CommandList *c, u32 ioaccel_handle, u8 *cdb, int cdb_len,
u8 *scsi3addr, struct hpsa_scsi_dev_t *phys_disk)
{ … }
static int hpsa_scsi_ioaccel_direct_map(struct ctlr_info *h,
struct CommandList *c)
{ … }
static void set_encrypt_ioaccel2(struct ctlr_info *h,
struct CommandList *c, struct io_accel2_cmd *cp)
{ … }
static int hpsa_scsi_ioaccel2_queue_command(struct ctlr_info *h,
struct CommandList *c, u32 ioaccel_handle, u8 *cdb, int cdb_len,
u8 *scsi3addr, struct hpsa_scsi_dev_t *phys_disk)
{ … }
static int hpsa_scsi_ioaccel_queue_command(struct ctlr_info *h,
struct CommandList *c, u32 ioaccel_handle, u8 *cdb, int cdb_len,
u8 *scsi3addr, struct hpsa_scsi_dev_t *phys_disk)
{ … }
static void raid_map_helper(struct raid_map_data *map,
int offload_to_mirror, u32 *map_index, u32 *current_group)
{ … }
static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
struct CommandList *c)
{ … }
static int hpsa_ciss_submit(struct ctlr_info *h,
struct CommandList *c, struct scsi_cmnd *cmd,
struct hpsa_scsi_dev_t *dev)
{ … }
static void hpsa_cmd_init(struct ctlr_info *h, int index,
struct CommandList *c)
{ … }
static void hpsa_preinitialize_commands(struct ctlr_info *h)
{ … }
static inline void hpsa_cmd_partial_init(struct ctlr_info *h, int index,
struct CommandList *c)
{ … }
static int hpsa_ioaccel_submit(struct ctlr_info *h,
struct CommandList *c, struct scsi_cmnd *cmd,
bool retry)
{ … }
static void hpsa_command_resubmit_worker(struct work_struct *work)
{ … }
static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
{ … }
static void hpsa_scan_complete(struct ctlr_info *h)
{ … }
static void hpsa_scan_start(struct Scsi_Host *sh)
{ … }
static int hpsa_change_queue_depth(struct scsi_device *sdev, int qdepth)
{ … }
static int hpsa_scan_finished(struct Scsi_Host *sh,
unsigned long elapsed_time)
{ … }
static int hpsa_scsi_host_alloc(struct ctlr_info *h)
{ … }
static int hpsa_scsi_add_host(struct ctlr_info *h)
{ … }
static int hpsa_get_cmd_index(struct scsi_cmnd *scmd)
{ … }
static int hpsa_send_test_unit_ready(struct ctlr_info *h,
struct CommandList *c, unsigned char lunaddr[],
int reply_queue)
{ … }
static int hpsa_wait_for_test_unit_ready(struct ctlr_info *h,
struct CommandList *c,
unsigned char lunaddr[], int reply_queue)
{ … }
static int wait_for_device_to_become_ready(struct ctlr_info *h,
unsigned char lunaddr[],
int reply_queue)
{ … }
static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
{ … }
static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h,
struct scsi_cmnd *scmd)
{ … }
static void cmd_tagged_free(struct ctlr_info *h, struct CommandList *c)
{ … }
static struct CommandList *cmd_alloc(struct ctlr_info *h)
{ … }
static void cmd_free(struct ctlr_info *h, struct CommandList *c)
{ … }
#ifdef CONFIG_COMPAT
static int hpsa_ioctl32_passthru(struct scsi_device *dev, unsigned int cmd,
void __user *arg)
{ … }
static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
unsigned int cmd, void __user *arg)
{ … }
static int hpsa_compat_ioctl(struct scsi_device *dev, unsigned int cmd,
void __user *arg)
{ … }
#endif
static int hpsa_getpciinfo_ioctl(struct ctlr_info *h, void __user *argp)
{ … }
static int hpsa_getdrivver_ioctl(struct ctlr_info *h, void __user *argp)
{ … }
static int hpsa_passthru_ioctl(struct ctlr_info *h,
IOCTL_Command_struct *iocommand)
{ … }
static int hpsa_big_passthru_ioctl(struct ctlr_info *h,
BIG_IOCTL_Command_struct *ioc)
{ … }
static void check_ioctl_unit_attention(struct ctlr_info *h,
struct CommandList *c)
{ … }
static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
void __user *argp)
{ … }
static void hpsa_send_host_reset(struct ctlr_info *h, u8 reset_type)
{ … }
static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
void *buff, size_t size, u16 page_code, unsigned char *scsi3addr,
int cmd_type)
{ … }
static void __iomem *remap_pci_mem(ulong base, ulong size)
{ … }
static inline unsigned long get_next_completion(struct ctlr_info *h, u8 q)
{ … }
static inline bool interrupt_pending(struct ctlr_info *h)
{ … }
static inline long interrupt_not_for_us(struct ctlr_info *h)
{ … }
static inline int bad_tag(struct ctlr_info *h, u32 tag_index,
u32 raw_tag)
{ … }
static inline void finish_cmd(struct CommandList *c)
{ … }
static inline void process_indexed_cmd(struct ctlr_info *h,
u32 raw_tag)
{ … }
static int ignore_bogus_interrupt(struct ctlr_info *h)
{ … }
static struct ctlr_info *queue_to_hba(u8 *queue)
{ … }
static irqreturn_t hpsa_intx_discard_completions(int irq, void *queue)
{ … }
static irqreturn_t hpsa_msix_discard_completions(int irq, void *queue)
{ … }
static irqreturn_t do_hpsa_intr_intx(int irq, void *queue)
{ … }
static irqreturn_t do_hpsa_intr_msi(int irq, void *queue)
{ … }
static int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
unsigned char type)
{ … }
#define hpsa_noop(p) …
static int hpsa_controller_hard_reset(struct pci_dev *pdev,
void __iomem *vaddr, u32 use_doorbell)
{ … }
static void init_driver_version(char *driver_version, int len)
{ … }
static int write_driver_ver_to_cfgtable(struct CfgTable __iomem *cfgtable)
{ … }
static void read_driver_ver_from_cfgtable(struct CfgTable __iomem *cfgtable,
unsigned char *driver_ver)
{ … }
static int controller_reset_failed(struct CfgTable __iomem *cfgtable)
{ … }
static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev, u32 board_id)
{ … }
static void print_cfg_table(struct device *dev, struct CfgTable __iomem *tb)
{ … }
static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
{ … }
static void hpsa_disable_interrupt_mode(struct ctlr_info *h)
{ … }
static void hpsa_setup_reply_map(struct ctlr_info *h)
{ … }
static int hpsa_interrupt_mode(struct ctlr_info *h)
{ … }
static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
bool *legacy_board)
{ … }
static int hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
unsigned long *memory_bar)
{ … }
static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
int wait_for_ready)
{ … }
static int hpsa_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
u32 *cfg_base_addr, u64 *cfg_base_addr_index,
u64 *cfg_offset)
{ … }
static void hpsa_free_cfgtables(struct ctlr_info *h)
{ … }
static int hpsa_find_cfgtables(struct ctlr_info *h)
{ … }
static void hpsa_get_max_perf_mode_cmds(struct ctlr_info *h)
{ … }
static int hpsa_supports_chained_sg_blocks(struct ctlr_info *h)
{ … }
static void hpsa_find_board_params(struct ctlr_info *h)
{ … }
static inline bool hpsa_CISS_signature_present(struct ctlr_info *h)
{ … }
static inline void hpsa_set_driver_support_bits(struct ctlr_info *h)
{ … }
static inline void hpsa_p600_dma_prefetch_quirk(struct ctlr_info *h)
{ … }
static int hpsa_wait_for_clear_event_notify_ack(struct ctlr_info *h)
{ … }
static int hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
{ … }
static int hpsa_enter_simple_mode(struct ctlr_info *h)
{ … }
static void hpsa_free_pci_init(struct ctlr_info *h)
{ … }
static int hpsa_pci_init(struct ctlr_info *h)
{ … }
static void hpsa_hba_inquiry(struct ctlr_info *h)
{ … }
static int hpsa_init_reset_devices(struct pci_dev *pdev, u32 board_id)
{ … }
static void hpsa_free_cmd_pool(struct ctlr_info *h)
{ … }
static int hpsa_alloc_cmd_pool(struct ctlr_info *h)
{ … }
static void hpsa_free_irqs(struct ctlr_info *h)
{ … }
static int hpsa_request_irqs(struct ctlr_info *h,
irqreturn_t (*msixhandler)(int, void *),
irqreturn_t (*intxhandler)(int, void *))
{ … }
static int hpsa_kdump_soft_reset(struct ctlr_info *h)
{ … }
static void hpsa_free_reply_queues(struct ctlr_info *h)
{ … }
static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
{ … }
static void fail_all_outstanding_cmds(struct ctlr_info *h)
{ … }
static void set_lockup_detected_for_all_cpus(struct ctlr_info *h, u32 value)
{ … }
static void controller_lockup_detected(struct ctlr_info *h)
{ … }
static int detect_controller_lockup(struct ctlr_info *h)
{ … }
static void hpsa_set_ioaccel_status(struct ctlr_info *h)
{ … }
static void hpsa_ack_ctlr_events(struct ctlr_info *h)
{ … }
static int hpsa_ctlr_needs_rescan(struct ctlr_info *h)
{ … }
static int hpsa_offline_devices_ready(struct ctlr_info *h)
{ … }
static int hpsa_luns_changed(struct ctlr_info *h)
{ … }
static void hpsa_perform_rescan(struct ctlr_info *h)
{ … }
static void hpsa_event_monitor_worker(struct work_struct *work)
{ … }
static void hpsa_rescan_ctlr_worker(struct work_struct *work)
{ … }
static void hpsa_monitor_ctlr_worker(struct work_struct *work)
{ … }
static struct workqueue_struct *hpsa_create_controller_wq(struct ctlr_info *h,
char *name)
{ … }
static void hpda_free_ctlr_info(struct ctlr_info *h)
{ … }
static struct ctlr_info *hpda_alloc_ctlr_info(void)
{ … }
static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
static void hpsa_flush_cache(struct ctlr_info *h)
{ … }
static void hpsa_disable_rld_caching(struct ctlr_info *h)
{ … }
static void __hpsa_shutdown(struct pci_dev *pdev)
{ … }
static void hpsa_shutdown(struct pci_dev *pdev)
{ … }
static void hpsa_free_device_info(struct ctlr_info *h)
{ … }
static void hpsa_remove_one(struct pci_dev *pdev)
{ … }
static int __maybe_unused hpsa_suspend(
__attribute__((unused)) struct device *dev)
{ … }
static int __maybe_unused hpsa_resume
(__attribute__((unused)) struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(hpsa_pm_ops, hpsa_suspend, hpsa_resume);
static struct pci_driver hpsa_pci_driver = …;
static void calc_bucket_map(int bucket[], int num_buckets,
int nsgs, int min_blocks, u32 *bucket_map)
{ … }
static int hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
{ … }
static void hpsa_free_ioaccel1_cmd_and_bft(struct ctlr_info *h)
{ … }
static int hpsa_alloc_ioaccel1_cmd_and_bft(struct ctlr_info *h)
{ … }
static void hpsa_free_ioaccel2_cmd_and_bft(struct ctlr_info *h)
{ … }
static int hpsa_alloc_ioaccel2_cmd_and_bft(struct ctlr_info *h)
{ … }
static void hpsa_free_performant_mode(struct ctlr_info *h)
{ … }
static int hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
{ … }
static int is_accelerated_cmd(struct CommandList *c)
{ … }
static void hpsa_drain_accel_commands(struct ctlr_info *h)
{ … }
static struct hpsa_sas_phy *hpsa_alloc_sas_phy(
struct hpsa_sas_port *hpsa_sas_port)
{ … }
static void hpsa_free_sas_phy(struct hpsa_sas_phy *hpsa_sas_phy)
{ … }
static int hpsa_sas_port_add_phy(struct hpsa_sas_phy *hpsa_sas_phy)
{ … }
static int
hpsa_sas_port_add_rphy(struct hpsa_sas_port *hpsa_sas_port,
struct sas_rphy *rphy)
{ … }
static struct hpsa_sas_port
*hpsa_alloc_sas_port(struct hpsa_sas_node *hpsa_sas_node,
u64 sas_address)
{ … }
static void hpsa_free_sas_port(struct hpsa_sas_port *hpsa_sas_port)
{ … }
static struct hpsa_sas_node *hpsa_alloc_sas_node(struct device *parent_dev)
{ … }
static void hpsa_free_sas_node(struct hpsa_sas_node *hpsa_sas_node)
{ … }
static struct hpsa_scsi_dev_t
*hpsa_find_device_by_sas_rphy(struct ctlr_info *h,
struct sas_rphy *rphy)
{ … }
static int hpsa_add_sas_host(struct ctlr_info *h)
{ … }
static void hpsa_delete_sas_host(struct ctlr_info *h)
{ … }
static int hpsa_add_sas_device(struct hpsa_sas_node *hpsa_sas_node,
struct hpsa_scsi_dev_t *device)
{ … }
static void hpsa_remove_sas_device(struct hpsa_scsi_dev_t *device)
{ … }
static int
hpsa_sas_get_linkerrors(struct sas_phy *phy)
{ … }
static int
hpsa_sas_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier)
{ … }
static int
hpsa_sas_get_bay_identifier(struct sas_rphy *rphy)
{ … }
static int
hpsa_sas_phy_reset(struct sas_phy *phy, int hard_reset)
{ … }
static int
hpsa_sas_phy_enable(struct sas_phy *phy, int enable)
{ … }
static int
hpsa_sas_phy_setup(struct sas_phy *phy)
{ … }
static void
hpsa_sas_phy_release(struct sas_phy *phy)
{ … }
static int
hpsa_sas_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates)
{ … }
static struct sas_function_template hpsa_sas_transport_functions = …;
static int __init hpsa_init(void)
{ … }
static void __exit hpsa_cleanup(void)
{ … }
static void __attribute__((unused)) verify_offsets(void)
{ … }
module_init(…) …;
module_exit(hpsa_cleanup);