/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family * of PCI-SCSI IO processors. * * Copyright (C) 1999-2001 Gerard Roudier <[email protected]> * * This driver is derived from the Linux sym53c8xx driver. * Copyright (C) 1998-2000 Gerard Roudier * * The sym53c8xx driver is derived from the ncr53c8xx driver that had been * a port of the FreeBSD ncr driver to Linux-1.2.13. * * The original ncr driver has been written for 386bsd and FreeBSD by * Wolfgang Stanglmeier <[email protected]> * Stefan Esser <[email protected]> * Copyright (C) 1994 Wolfgang Stanglmeier * * Other major contributions: * * NVRAM detection and reading. * Copyright (C) 1997 Richard Waltham <[email protected]> * *----------------------------------------------------------------------------- */ #ifndef SYM_GLUE_H #define SYM_GLUE_H #include <linux/completion.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/pci.h> #include <linux/string.h> #include <linux/timer.h> #include <linux/types.h> #include <asm/io.h> #ifdef __sparc__ # include <asm/irq.h> #endif #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> #include <scsi/scsi_transport_spi.h> #include <scsi/scsi_host.h> #include "sym53c8xx.h" #include "sym_defs.h" #include "sym_misc.h" /* * Configuration addendum for Linux. */ #define SYM_CONF_TIMER_INTERVAL … #undef SYM_OPT_HANDLE_DEVICE_QUEUEING #define SYM_OPT_LIMIT_COMMAND_REORDERING /* * Print a message with severity. */ #define printf_emerg(args...) … #define printf_alert(args...) … #define printf_crit(args...) … #define printf_err(args...) … #define printf_warning(args...) … #define printf_notice(args...) … #define printf_info(args...) … #define printf_debug(args...) … #define printf(args...) … /* * A 'read barrier' flushes any data that have been prefetched * by the processor due to out of order execution. Such a barrier * must notably be inserted prior to looking at data that have * been DMAed, assuming that program does memory READs in proper * order and that the device ensured proper ordering of WRITEs. * * A 'write barrier' prevents any previous WRITEs to pass further * WRITEs. Such barriers must be inserted each time another agent * relies on ordering of WRITEs. * * Note that, due to posting of PCI memory writes, we also must * insert dummy PCI read transactions when some ordering involving * both directions over the PCI does matter. PCI transactions are * fully ordered in each direction. */ #define MEMORY_READ_BARRIER() … #define MEMORY_WRITE_BARRIER() … /* * IO functions definition for big/little endian CPU support. * For now, PCI chips are only supported in little endian addressing mode, */ #ifdef __BIG_ENDIAN #define readw_l2b … #define readl_l2b … #define writew_b2l … #define writel_b2l … #else /* little endian */ #define readw_raw … #define readl_raw … #define writew_raw … #define writel_raw … #endif /* endian */ #ifdef SYM_CONF_CHIP_BIG_ENDIAN #error "Chips in BIG ENDIAN addressing mode are not (yet) supported" #endif /* * If the CPU and the chip use same endian-ness addressing, * no byte reordering is needed for script patching. * Macro cpu_to_scr() is to be used for script patching. * Macro scr_to_cpu() is to be used for getting a DWORD * from the script. */ #define cpu_to_scr(dw) … #define scr_to_cpu(dw) … /* * These ones are used as return code from * error recovery handlers under Linux. */ #define SCSI_SUCCESS … #define SCSI_FAILED … /* * System specific target data structure. * None for now, under Linux. */ /* #define SYM_HAVE_STCB */ /* * System specific lun data structure. */ #define SYM_HAVE_SLCB struct sym_slcb { … }; /* * System specific command data structure. * Not needed under Linux. */ /* struct sym_sccb */ /* * System specific host data structure. */ struct sym_shcb { … }; /* * Return the name of the controller. */ #define sym_name(np) … struct sym_nvram; /* * The IO macros require a struct called 's' and are abused in sym_nvram.c */ struct sym_device { … }; /* * Driver host data structure. */ struct sym_data { … }; static inline struct sym_hcb * sym_get_hcb(struct Scsi_Host *host) { … } #include "sym_fw.h" #include "sym_hipd.h" /* * Set the status field of a CAM CCB. */ static inline void sym_set_cam_status(struct scsi_cmnd *cmd, int status) { … } /* * Get the status field of a CAM CCB. */ static inline int sym_get_cam_status(struct scsi_cmnd *cmd) { … } /* * Build CAM result for a successful IO and for a failed IO. */ static inline void sym_set_cam_result_ok(struct sym_ccb *cp, struct scsi_cmnd *cmd, int resid) { … } void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid); void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *ccb); #define sym_print_addr(cmd, arg...) … void sym_xpt_async_bus_reset(struct sym_hcb *np); int sym_setup_data_and_start (struct sym_hcb *np, struct scsi_cmnd *csio, struct sym_ccb *cp); void sym_log_bus_error(struct Scsi_Host *); void sym_dump_registers(struct Scsi_Host *); #endif /* SYM_GLUE_H */