#include "aic79xx_osm.h"
#include "aic79xx_inline.h"
#include <scsi/scsicam.h>
static struct scsi_transport_template *ahd_linux_transport_template = …;
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/slab.h>
#define AHD_LINUX_ERR_THRESH …
#ifdef CONFIG_AIC79XX_RESET_DELAY_MS
#define AIC79XX_RESET_DELAY …
#else
#define AIC79XX_RESET_DELAY …
#endif
adapter_tag_info_t;
#ifdef CONFIG_AIC79XX_CMDS_PER_DEVICE
#define AIC79XX_CMDS_PER_DEVICE …
#else
#define AIC79XX_CMDS_PER_DEVICE …
#endif
#define AIC79XX_CONFIGED_TAG_COMMANDS …
static adapter_tag_info_t aic79xx_tag_info[] = …;
struct ahd_linux_iocell_opts
{ … };
#define AIC79XX_DEFAULT_PRECOMP …
#define AIC79XX_DEFAULT_SLEWRATE …
#define AIC79XX_DEFAULT_AMPLITUDE …
#define AIC79XX_DEFAULT_IOOPTS …
#define AIC79XX_PRECOMP_INDEX …
#define AIC79XX_SLEWRATE_INDEX …
#define AIC79XX_AMPLITUDE_INDEX …
static struct ahd_linux_iocell_opts aic79xx_iocell_info[] __ro_after_init = …;
#define DID_UNDERFLOW …
void
ahd_print_path(struct ahd_softc *ahd, struct scb *scb)
{ … }
static uint32_t aic79xx_no_reset;
static uint32_t aic79xx_extended;
static uint32_t aic79xx_pci_parity = …;
uint32_t aic79xx_allow_memio = …;
static uint32_t aic79xx_seltime;
static uint32_t aic79xx_periodic_otag;
uint32_t aic79xx_slowcrc;
static char *aic79xx = …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_VERSION(…);
module_param(aic79xx, charp, 0444);
MODULE_PARM_DESC(…) …;
static void ahd_linux_handle_scsi_status(struct ahd_softc *,
struct scsi_device *,
struct scb *);
static void ahd_linux_queue_cmd_complete(struct ahd_softc *ahd,
struct scsi_cmnd *cmd);
static int ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd);
static void ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd);
static u_int ahd_linux_user_tagdepth(struct ahd_softc *ahd,
struct ahd_devinfo *devinfo);
static void ahd_linux_device_queue_depth(struct scsi_device *);
static int ahd_linux_run_command(struct ahd_softc*,
struct ahd_linux_device *,
struct scsi_cmnd *);
static void ahd_linux_setup_tag_info_global(char *p);
static int aic79xx_setup(char *c);
static void ahd_freeze_simq(struct ahd_softc *ahd);
static void ahd_release_simq(struct ahd_softc *ahd);
static int ahd_linux_unit;
void ahd_delay(long);
void
ahd_delay(long usec)
{ … }
uint8_t ahd_inb(struct ahd_softc * ahd, long port);
void ahd_outb(struct ahd_softc * ahd, long port, uint8_t val);
void ahd_outw_atomic(struct ahd_softc * ahd,
long port, uint16_t val);
void ahd_outsb(struct ahd_softc * ahd, long port,
uint8_t *, int count);
void ahd_insb(struct ahd_softc * ahd, long port,
uint8_t *, int count);
uint8_t
ahd_inb(struct ahd_softc * ahd, long port)
{ … }
#if 0
static uint16_t
ahd_inw_atomic(struct ahd_softc * ahd, long port)
{
uint8_t x;
if (ahd->tags[0] == BUS_SPACE_MEMIO) {
x = readw(ahd->bshs[0].maddr + port);
} else {
x = inw(ahd->bshs[(port) >> 8].ioport + ((port) & 0xFF));
}
mb();
return (x);
}
#endif
void
ahd_outb(struct ahd_softc * ahd, long port, uint8_t val)
{ … }
void
ahd_outw_atomic(struct ahd_softc * ahd, long port, uint16_t val)
{ … }
void
ahd_outsb(struct ahd_softc * ahd, long port, uint8_t *array, int count)
{ … }
void
ahd_insb(struct ahd_softc * ahd, long port, uint8_t *array, int count)
{ … }
uint32_t
ahd_pci_read_config(ahd_dev_softc_t pci, int reg, int width)
{ … }
void
ahd_pci_write_config(ahd_dev_softc_t pci, int reg, uint32_t value, int width)
{ … }
static void ahd_linux_unmap_scb(struct ahd_softc*, struct scb*);
static void
ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
{ … }
static inline unsigned int ahd_build_scsiid(struct ahd_softc *ahd,
struct scsi_device *sdev)
{ … }
static const char *
ahd_linux_info(struct Scsi_Host *host)
{ … }
static int ahd_linux_queue_lck(struct scsi_cmnd *cmd)
{ … }
static DEF_SCSI_QCMD(ahd_linux_queue)
static struct scsi_target **
ahd_linux_target_in_softc(struct scsi_target *starget)
{ … }
static int
ahd_linux_target_alloc(struct scsi_target *starget)
{ … }
static void
ahd_linux_target_destroy(struct scsi_target *starget)
{ … }
static int
ahd_linux_slave_alloc(struct scsi_device *sdev)
{ … }
static int
ahd_linux_slave_configure(struct scsi_device *sdev)
{ … }
#if defined(__i386__)
static int
ahd_linux_biosparam(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int geom[])
{
int heads;
int sectors;
int cylinders;
int extended;
struct ahd_softc *ahd;
ahd = *((struct ahd_softc **)sdev->host->hostdata);
if (scsi_partsize(bdev, capacity, geom))
return 0;
heads = 64;
sectors = 32;
cylinders = aic_sector_div(capacity, heads, sectors);
if (aic79xx_extended != 0)
extended = 1;
else
extended = (ahd->flags & AHD_EXTENDED_TRANS_A) != 0;
if (extended && cylinders >= 1024) {
heads = 255;
sectors = 63;
cylinders = aic_sector_div(capacity, heads, sectors);
}
geom[0] = heads;
geom[1] = sectors;
geom[2] = cylinders;
return (0);
}
#endif
static int
ahd_linux_abort(struct scsi_cmnd *cmd)
{ … }
static int
ahd_linux_dev_reset(struct scsi_cmnd *cmd)
{ … }
static int
ahd_linux_bus_reset(struct scsi_cmnd *cmd)
{ … }
struct scsi_host_template aic79xx_driver_template = …;
int
ahd_dma_tag_create(struct ahd_softc *ahd, bus_dma_tag_t parent,
bus_size_t alignment, bus_size_t boundary,
dma_addr_t lowaddr, dma_addr_t highaddr,
bus_dma_filter_t *filter, void *filterarg,
bus_size_t maxsize, int nsegments,
bus_size_t maxsegsz, int flags, bus_dma_tag_t *ret_tag)
{ … }
void
ahd_dma_tag_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat)
{ … }
int
ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr,
int flags, bus_dmamap_t *mapp)
{ … }
void
ahd_dmamem_free(struct ahd_softc *ahd, bus_dma_tag_t dmat,
void* vaddr, bus_dmamap_t map)
{ … }
int
ahd_dmamap_load(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map,
void *buf, bus_size_t buflen, bus_dmamap_callback_t *cb,
void *cb_arg, int flags)
{ … }
void
ahd_dmamap_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
{ … }
int
ahd_dmamap_unload(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map)
{ … }
static void
ahd_linux_setup_iocell_info(u_long index, int instance, int targ, int32_t value)
{ … }
static void
ahd_linux_setup_tag_info_global(char *p)
{ … }
static void
ahd_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value)
{ … }
static char *
ahd_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth,
void (*callback)(u_long, int, int, int32_t),
u_long callback_arg)
{ … }
static int
aic79xx_setup(char *s)
{ … }
__setup(…);
uint32_t aic79xx_verbose;
int
ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *template)
{ … }
static void
ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd)
{ … }
int
ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
{ … }
void
ahd_platform_free(struct ahd_softc *ahd)
{ … }
void
ahd_platform_init(struct ahd_softc *ahd)
{ … }
void
ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
{ … }
void
ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
struct ahd_devinfo *devinfo, ahd_queue_alg alg)
{ … }
int
ahd_platform_abort_scbs(struct ahd_softc *ahd, int target, char channel,
int lun, u_int tag, role_t role, uint32_t status)
{ … }
static u_int
ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
{ … }
static void
ahd_linux_device_queue_depth(struct scsi_device *sdev)
{ … }
static int
ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
struct scsi_cmnd *cmd)
{ … }
irqreturn_t
ahd_linux_isr(int irq, void *dev_id)
{ … }
void
ahd_send_async(struct ahd_softc *ahd, char channel,
u_int target, u_int lun, ac_code code)
{ … }
void
ahd_done(struct ahd_softc *ahd, struct scb *scb)
{ … }
static void
ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
struct scsi_device *sdev, struct scb *scb)
{ … }
static void
ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
{ … }
static void
ahd_freeze_simq(struct ahd_softc *ahd)
{ … }
static void
ahd_release_simq(struct ahd_softc *ahd)
{ … }
static int
ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd)
{ … }
static void ahd_linux_set_width(struct scsi_target *starget, int width)
{ … }
static void ahd_linux_set_period(struct scsi_target *starget, int period)
{ … }
static void ahd_linux_set_offset(struct scsi_target *starget, int offset)
{ … }
static void ahd_linux_set_dt(struct scsi_target *starget, int dt)
{ … }
static void ahd_linux_set_qas(struct scsi_target *starget, int qas)
{ … }
static void ahd_linux_set_iu(struct scsi_target *starget, int iu)
{ … }
static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm)
{ … }
static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow)
{ … }
static void ahd_linux_set_rti(struct scsi_target *starget, int rti)
{ … }
static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp)
{ … }
static void ahd_linux_set_hold_mcs(struct scsi_target *starget, int hold)
{ … }
static void ahd_linux_get_signalling(struct Scsi_Host *shost)
{ … }
static struct spi_function_template ahd_linux_transport_functions = …;
static int __init
ahd_linux_init(void)
{ … }
static void __exit
ahd_linux_exit(void)
{ … }
module_init(…) …;
module_exit(ahd_linux_exit);