59 #ifndef _AIC7XXX_LINUX_H_
60 #define _AIC7XXX_LINUX_H_
62 #include <linux/types.h>
66 #include <linux/pci.h>
68 #include <linux/module.h>
69 #include <linux/slab.h>
70 #include <asm/byteorder.h>
73 #include <scsi/scsi.h>
83 #define AIC_LIB_PREFIX ahc
96 #ifdef CONFIG_AIC7XXX_DEBUG_ENABLE
97 #ifdef CONFIG_AIC7XXX_DEBUG_MASK
99 #define AHC_DEBUG_OPTS CONFIG_AIC7XXX_DEBUG_MASK
115 #define ahc_htobe16(x) cpu_to_be16(x)
116 #define ahc_htobe32(x) cpu_to_be32(x)
117 #define ahc_htobe64(x) cpu_to_be64(x)
118 #define ahc_htole16(x) cpu_to_le16(x)
119 #define ahc_htole32(x) cpu_to_le32(x)
120 #define ahc_htole64(x) cpu_to_le64(x)
122 #define ahc_be16toh(x) be16_to_cpu(x)
123 #define ahc_be32toh(x) be32_to_cpu(x)
124 #define ahc_be64toh(x) be64_to_cpu(x)
125 #define ahc_le16toh(x) le16_to_cpu(x)
126 #define ahc_le32toh(x) le32_to_cpu(x)
127 #define ahc_le64toh(x) le64_to_cpu(x)
167 #define BUS_DMA_WAITOK 0x0
168 #define BUS_DMA_NOWAIT 0x1
169 #define BUS_DMA_ALLOCNOW 0x2
170 #define BUS_DMA_LOAD_SEGS 0x4
175 #define BUS_SPACE_MAXADDR 0xFFFFFFFF
176 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
177 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
209 #define BUS_DMASYNC_PREREAD 0x01
210 #define BUS_DMASYNC_POSTREAD 0x02
211 #define BUS_DMASYNC_PREWRITE 0x04
212 #define BUS_DMASYNC_POSTWRITE 0x08
222 #define ahc_dmamap_sync(ahc, dma_tag, dmamap, offset, len, op)
225 #ifdef CONFIG_AIC7XXX_REG_PRETTY_PRINT
226 #define AIC_DEBUG_REGISTERS 1
228 #define AIC_DEBUG_REGISTERS 0
241 #define AIC7XXX_DRIVER_VERSION "7.0"
293 #define AHC_TAG_SUCCESS_INTERVAL 50
315 #define AHC_LOCK_TAGS_COUNT 50
327 #define AHC_OTAG_THRESH 500
365 #define AHC_LINUX_NOIRQ ((uint32_t)~0)
412 spin_unlock_irqrestore(&ahc->
platform_data->spin_lock, *flags);
425 #define PCIR_DEVVENDOR 0x00
426 #define PCIR_VENDOR 0x00
427 #define PCIR_DEVICE 0x02
428 #define PCIR_COMMAND 0x04
429 #define PCIM_CMD_PORTEN 0x0001
430 #define PCIM_CMD_MEMEN 0x0002
431 #define PCIM_CMD_BUSMASTEREN 0x0004
432 #define PCIM_CMD_MWRICEN 0x0010
433 #define PCIM_CMD_PERRESPEN 0x0040
434 #define PCIM_CMD_SERRESPEN 0x0100
435 #define PCIR_STATUS 0x06
436 #define PCIR_REVID 0x08
437 #define PCIR_PROGIF 0x09
438 #define PCIR_SUBCLASS 0x0a
439 #define PCIR_CLASS 0x0b
440 #define PCIR_CACHELNSZ 0x0c
441 #define PCIR_LATTIMER 0x0d
442 #define PCIR_HEADERTYPE 0x0e
443 #define PCIM_MFDEV 0x80
444 #define PCIR_BIST 0x0f
445 #define PCIR_CAP_PTR 0x34
448 #define PCIR_MAPS 0x10
449 #define PCIR_SUBVEND_0 0x2c
450 #define PCIR_SUBDEV_0 0x2e
489 static inline int ahc_get_pci_function(ahc_dev_softc_t);
491 ahc_get_pci_function(ahc_dev_softc_t pci)
496 static inline int ahc_get_pci_slot(ahc_dev_softc_t);
498 ahc_get_pci_slot(ahc_dev_softc_t pci)
503 static inline int ahc_get_pci_bus(ahc_dev_softc_t);
505 ahc_get_pci_bus(ahc_dev_softc_t pci)
507 return (pci->
bus->number);
517 static inline void ahc_flush_device_writes(
struct ahc_softc *);
519 ahc_flush_device_writes(
struct ahc_softc *ahc)
532 static inline void ahc_set_transaction_status(
struct scb *,
uint32_t);
534 static inline void ahc_set_scsi_status(
struct scb *,
uint32_t);
536 static inline uint32_t ahc_get_transaction_status(
struct scb *);
538 static inline uint32_t ahc_get_scsi_status(
struct scb *);
539 static inline void ahc_set_transaction_tag(
struct scb *,
int,
u_int);
540 static inline u_long ahc_get_transfer_length(
struct scb *);
541 static inline int ahc_get_transfer_dir(
struct scb *);
542 static inline void ahc_set_residual(
struct scb *,
u_long);
543 static inline void ahc_set_sense_residual(
struct scb *
scb,
u_long resid);
544 static inline u_long ahc_get_residual(
struct scb *);
545 static inline u_long ahc_get_sense_residual(
struct scb *);
546 static inline int ahc_perform_autosense(
struct scb *);
549 static inline void ahc_notify_xfer_settings_change(
struct ahc_softc *,
551 static inline void ahc_platform_scb_free(
struct ahc_softc *ahc,
553 static inline void ahc_freeze_scb(
struct scb *
scb);
559 cmd->
result |= status << 16;
565 ahc_cmd_set_transaction_status(scb->
io_ctx,status);
578 ahc_cmd_set_scsi_status(scb->
io_ctx, status);
590 return (ahc_cmd_get_transaction_status(scb->
io_ctx));
596 return (cmd->
result & 0xFFFF);
600 uint32_t ahc_get_scsi_status(
struct scb *scb)
602 return (ahc_cmd_get_scsi_status(scb->
io_ctx));
615 u_long ahc_get_transfer_length(
struct scb *scb)
621 int ahc_get_transfer_dir(
struct scb *scb)
627 void ahc_set_residual(
struct scb *scb,
u_long resid)
629 scsi_set_resid(scb->
io_ctx, resid);
633 void ahc_set_sense_residual(
struct scb *scb,
u_long resid)
639 u_long ahc_get_residual(
struct scb *scb)
641 return scsi_get_resid(scb->
io_ctx);
645 u_long ahc_get_sense_residual(
struct scb *scb)
651 int ahc_perform_autosense(
struct scb *scb)
662 ahc_get_sense_bufsize(
struct ahc_softc *ahc,
struct scb *scb)
668 ahc_notify_xfer_settings_change(
struct ahc_softc *ahc,
675 ahc_platform_scb_free(
struct ahc_softc *ahc,
struct scb *scb)
684 ahc_freeze_scb(
struct scb *scb)
707 #define AHC_PCI_CONFIG 1
709 #define AHC_PCI_CONFIG 0
711 #define bootverbose aic7xxx_verbose