linux/drivers/scsi/aacraid/linit.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *	Adaptec AAC series RAID controller driver
 *	(c) Copyright 2001 Red Hat Inc.
 *
 * based on the old aacraid driver that is..
 * Adaptec aacraid device driver for Linux.
 *
 * Copyright (c) 2000-2010 Adaptec, Inc.
 *               2010-2015 PMC-Sierra, Inc. ([email protected])
 *		 2016-2017 Microsemi Corp. ([email protected])
 *
 * Module Name:
 *   linit.c
 *
 * Abstract: Linux Driver entry module for Adaptec RAID Array Controller
 */


#include <linux/compat.h>
#include <linux/blkdev.h>
#include <linux/completion.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/syscalls.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/msdos_partition.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/scsicam.h>
#include <scsi/scsi_eh.h>

#include "aacraid.h"

#define AAC_DRIVER_VERSION
#ifndef AAC_DRIVER_BRANCH
#define AAC_DRIVER_BRANCH
#endif
#define AAC_DRIVERNAME

#ifdef AAC_DRIVER_BUILD
#define _str(x)
#define str(x)
#define AAC_DRIVER_FULL_VERSION
#else
#define AAC_DRIVER_FULL_VERSION
#endif

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

static DEFINE_MUTEX(aac_mutex);
static LIST_HEAD(aac_devices);
static int aac_cfg_major =;
char aac_driver_version[] =;

/*
 * Because of the way Linux names scsi devices, the order in this table has
 * become important.  Check for on-board Raid first, add-in cards second.
 *
 * Note: The last field is used to index into aac_drivers below.
 */
static const struct pci_device_id aac_pci_tbl[] =;
MODULE_DEVICE_TABLE(pci, aac_pci_tbl);

/*
 * dmb - For now we add the number of channels to this structure.
 * In the future we should add a fib that reports the number of channels
 * for the card.  At that time we can remove the channels from here
 */
static struct aac_driver_ident aac_drivers[] =;

/**
 *	aac_queuecommand	-	queue a SCSI command
 *	@shost:		Scsi host to queue command on
 *	@cmd:		SCSI command to queue
 *
 *	Queues a command for execution by the associated Host Adapter.
 *
 *	TODO: unify with aac_scsi_cmd().
 */

static int aac_queuecommand(struct Scsi_Host *shost,
			    struct scsi_cmnd *cmd)
{}

/**
 *	aac_info		-	Returns the host adapter name
 *	@shost:		Scsi host to report on
 *
 *	Returns a static string describing the device in question
 */

static const char *aac_info(struct Scsi_Host *shost)
{}

/**
 *	aac_get_driver_ident
 *	@devtype: index into lookup table
 *
 *	Returns a pointer to the entry in the driver lookup table.
 */

struct aac_driver_ident* aac_get_driver_ident(int devtype)
{}

/**
 *	aac_biosparm	-	return BIOS parameters for disk
 *	@sdev: The scsi device corresponding to the disk
 *	@bdev: the block device corresponding to the disk
 *	@capacity: the sector capacity of the disk
 *	@geom: geometry block to fill in
 *
 *	Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk.
 *	The default disk geometry is 64 heads, 32 sectors, and the appropriate
 *	number of cylinders so as not to exceed drive capacity.  In order for
 *	disks equal to or larger than 1 GB to be addressable by the BIOS
 *	without exceeding the BIOS limitation of 1024 cylinders, Extended
 *	Translation should be enabled.   With Extended Translation enabled,
 *	drives between 1 GB inclusive and 2 GB exclusive are given a disk
 *	geometry of 128 heads and 32 sectors, and drives above 2 GB inclusive
 *	are given a disk geometry of 255 heads and 63 sectors.  However, if
 *	the BIOS detects that the Extended Translation setting does not match
 *	the geometry in the partition table, then the translation inferred
 *	from the partition table will be used by the BIOS, and a warning may
 *	be displayed.
 */

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

/**
 *	aac_slave_configure		-	compute queue depths
 *	@sdev:	SCSI device we are considering
 *
 *	Selects queue depths for each target device based on the host adapter's
 *	total capacity and the queue depth supported by the target device.
 *	A queue depth of one automatically disables tagged queueing.
 */

static int aac_slave_configure(struct scsi_device *sdev)
{}

/**
 *	aac_change_queue_depth		-	alter queue depths
 *	@sdev:	SCSI device we are considering
 *	@depth:	desired queue depth
 *
 *	Alters queue depths for target device based on the host adapter's
 *	total capacity and the queue depth supported by the target device.
 */

static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
{}

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

static struct device_attribute aac_raid_level_attr =;

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

static struct device_attribute aac_unique_id_attr =;



static struct attribute *aac_dev_attrs[] =;

ATTRIBUTE_GROUPS();

static int aac_ioctl(struct scsi_device *sdev, unsigned int cmd,
		     void __user *arg)
{}

struct fib_count_data {};

static bool fib_count_iter(struct scsi_cmnd *scmnd, void *data)
{}

/* Called during SCSI EH, so we don't need to block requests */
static int get_num_of_incomplete_fibs(struct aac_dev *aac)
{}

static int aac_eh_abort(struct scsi_cmnd* cmd)
{}

static u8 aac_eh_tmf_lun_reset_fib(struct aac_hba_map_info *info,
				   struct fib *fib, u64 tmf_lun)
{}

static u8 aac_eh_tmf_hard_reset_fib(struct aac_hba_map_info *info,
				    struct fib *fib)
{}

static void aac_tmf_callback(void *context, struct fib *fibptr)
{}

/*
 *	aac_eh_dev_reset	- Device reset command handling
 *	@scsi_cmd:	SCSI command block causing the reset
 *
 */
static int aac_eh_dev_reset(struct scsi_cmnd *cmd)
{}

/*
 *	aac_eh_target_reset	- Target reset command handling
 *	@scsi_cmd:	SCSI command block causing the reset
 *
 */
static int aac_eh_target_reset(struct scsi_cmnd *cmd)
{}

/*
 *	aac_eh_bus_reset	- Bus reset command handling
 *	@scsi_cmd:	SCSI command block causing the reset
 *
 */
static int aac_eh_bus_reset(struct scsi_cmnd* cmd)
{}

/*
 *	aac_eh_host_reset	- Host reset command handling
 *	@scsi_cmd:	SCSI command block causing the reset
 *
 */
static int aac_eh_host_reset(struct scsi_cmnd *cmd)
{}

/**
 *	aac_cfg_open		-	open a configuration file
 *	@inode: inode being opened
 *	@file: file handle attached
 *
 *	Called when the configuration device is opened. Does the needed
 *	set up on the handle and then returns
 *
 *	Bugs: This needs extending to check a given adapter is present
 *	so we can support hot plugging, and to ref count adapters.
 */

static int aac_cfg_open(struct inode *inode, struct file *file)
{}

/**
 *	aac_cfg_ioctl		-	AAC configuration request
 *	@file: file handle
 *	@cmd: ioctl command code
 *	@arg: argument
 *
 *	Handles a configuration ioctl. Currently this involves wrapping it
 *	up and feeding it into the nasty windowsalike glue layer.
 *
 *	Bugs: Needs locking against parallel ioctls lower down
 *	Bugs: Needs to handle hot plugging
 */

static long aac_cfg_ioctl(struct file *file,
		unsigned int cmd, unsigned long arg)
{}

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

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

static ssize_t aac_show_flags(struct device *cdev,
			      struct device_attribute *attr, char *buf)
{}

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

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

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

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

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

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

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

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

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

static struct device_attribute aac_model =;
static struct device_attribute aac_vendor =;
static struct device_attribute aac_flags =;
static struct device_attribute aac_kernel_version =;
static struct device_attribute aac_monitor_version =;
static struct device_attribute aac_bios_version =;
static struct device_attribute aac_lld_version =;
static struct device_attribute aac_serial_number =;
static struct device_attribute aac_max_channel =;
static struct device_attribute aac_max_id =;
static struct device_attribute aac_reset =;

static struct attribute *aac_host_attrs[] =;

ATTRIBUTE_GROUPS();

ssize_t aac_get_serial_number(struct device *device, char *buf)
{}

static const struct file_operations aac_cfg_fops =;

static const struct scsi_host_template aac_driver_template =;

static void __aac_shutdown(struct aac_dev * aac)
{}
static void aac_init_char(void)
{}

void aac_reinit_aif(struct aac_dev *aac, unsigned int index)
{}

static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void aac_release_resources(struct aac_dev *aac)
{}

static int aac_acquire_resources(struct aac_dev *dev)
{}

static int __maybe_unused aac_suspend(struct device *dev)
{}

static int __maybe_unused aac_resume(struct device *dev)
{}

static void aac_shutdown(struct pci_dev *dev)
{}

static void aac_remove_one(struct pci_dev *pdev)
{}

static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
					pci_channel_state_t error)
{}

static pci_ers_result_t aac_pci_mmio_enabled(struct pci_dev *pdev)
{}

static pci_ers_result_t aac_pci_slot_reset(struct pci_dev *pdev)
{}


static void aac_pci_resume(struct pci_dev *pdev)
{}

static struct pci_error_handlers aac_pci_err_handler =;

static SIMPLE_DEV_PM_OPS(aac_pm_ops, aac_suspend, aac_resume);

static struct pci_driver aac_pci_driver =;

static int __init aac_init(void)
{}

static void __exit aac_exit(void)
{}

module_init();
module_exit(aac_exit);