summaryrefslogtreecommitdiff
path: root/drivers/scsi/isci/isci.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/isci/isci.h')
-rw-r--r--drivers/scsi/isci/isci.h90
1 files changed, 11 insertions, 79 deletions
diff --git a/drivers/scsi/isci/isci.h b/drivers/scsi/isci/isci.h
index 80cfb45f8da1..714ed926171b 100644
--- a/drivers/scsi/isci/isci.h
+++ b/drivers/scsi/isci/isci.h
@@ -78,39 +78,16 @@ enum sci_controller_mode {
SCI_MODE_SIZE /* deprecated */
};
-#define SCI_MAX_PHYS (4)
+#define SCI_MAX_PHYS (4UL)
#define SCI_MAX_PORTS SCI_MAX_PHYS
-#define SCI_MIN_SMP_PHYS (38)
#define SCI_MAX_SMP_PHYS (384) /* not silicon constrained */
-#define SCI_MAX_REMOTE_DEVICES (256)
-#define SCI_MIN_REMOTE_DEVICES (16)
-#define SCI_MAX_IO_REQUESTS (256)
-#define SCI_MIN_IO_REQUESTS (1)
+#define SCI_MAX_REMOTE_DEVICES (256UL)
+#define SCI_MAX_IO_REQUESTS (256UL)
#define SCI_MAX_MSIX_MESSAGES (2)
#define SCI_MAX_SCATTER_GATHER_ELEMENTS 130 /* not silicon constrained */
-#define SCI_MIN_SCATTER_GATHER_ELEMENTS 1
#define SCI_MAX_CONTROLLERS 2
#define SCI_MAX_DOMAINS SCI_MAX_PORTS
-/* 2 indicates the maximum number of UFs that can occur for a given IO request.
- * The hardware handles reception of additional unsolicited frames while all
- * UFs are in use, by holding off the transmitting device. This number could
- * be theoretically reduced to 1, but 2 provides for more reliable operation.
- * During SATA PIO operation, it is possible under some conditions for there to
- * be 3 separate FISes received, back to back to back (PIO Setup, Data, D2H
- * Register). It is unlikely to have all 3 pending all at once without some of
- * them already being processed.
- */
-#define SCU_MIN_UNSOLICITED_FRAMES (1)
-#define SCU_MIN_CRITICAL_NOTIFICATIONS (24)
-#define SCU_MIN_EVENTS (4)
-#define SCU_MIN_COMPLETION_QUEUE_SCRATCH (2)
-#define SCU_MIN_COMPLETION_QUEUE_ENTRIES (SCU_MIN_CRITICAL_NOTIFICATIONS \
- + SCU_MIN_EVENTS \
- + SCU_MIN_UNSOLICITED_FRAMES \
- + SCI_MIN_IO_REQUESTS \
- + SCU_MIN_COMPLETION_QUEUE_SCRATCH)
-
#define SCU_MAX_CRITICAL_NOTIFICATIONS (384)
#define SCU_MAX_EVENTS (128)
#define SCU_MAX_UNSOLICITED_FRAMES (128)
@@ -121,51 +98,6 @@ enum sci_controller_mode {
+ SCI_MAX_IO_REQUESTS \
+ SCU_MAX_COMPLETION_QUEUE_SCRATCH)
-#if !defined(ENABLE_MINIMUM_MEMORY_MODE)
-#define SCU_UNSOLICITED_FRAME_COUNT SCU_MAX_UNSOLICITED_FRAMES
-#define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MAX_CRITICAL_NOTIFICATIONS
-#define SCU_EVENT_COUNT SCU_MAX_EVENTS
-#define SCU_COMPLETION_QUEUE_SCRATCH SCU_MAX_COMPLETION_QUEUE_SCRATCH
-#define SCU_IO_REQUEST_COUNT SCI_MAX_IO_REQUESTS
-#define SCU_IO_REQUEST_SGE_COUNT SCI_MAX_SCATTER_GATHER_ELEMENTS
-#define SCU_COMPLETION_QUEUE_COUNT SCU_MAX_COMPLETION_QUEUE_ENTRIES
-#else
-#define SCU_UNSOLICITED_FRAME_COUNT SCU_MIN_UNSOLICITED_FRAMES
-#define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MIN_CRITICAL_NOTIFICATIONS
-#define SCU_EVENT_COUNT SCU_MIN_EVENTS
-#define SCU_COMPLETION_QUEUE_SCRATCH SCU_MIN_COMPLETION_QUEUE_SCRATCH
-#define SCU_IO_REQUEST_COUNT SCI_MIN_IO_REQUESTS
-#define SCU_IO_REQUEST_SGE_COUNT SCI_MIN_SCATTER_GATHER_ELEMENTS
-#define SCU_COMPLETION_QUEUE_COUNT SCU_MIN_COMPLETION_QUEUE_ENTRIES
-#endif /* !defined(ENABLE_MINIMUM_MEMORY_OPERATION) */
-
-/**
- *
- *
- * The SCU_COMPLETION_QUEUE_COUNT constant indicates the size of the completion
- * queue into which the hardware DMAs 32-bit quantas (completion entries).
- */
-
-/**
- *
- *
- * This queue must be programmed to a power of 2 size (e.g. 32, 64, 1024, etc.).
- */
-#if (SCU_COMPLETION_QUEUE_COUNT != 16) && \
- (SCU_COMPLETION_QUEUE_COUNT != 32) && \
- (SCU_COMPLETION_QUEUE_COUNT != 64) && \
- (SCU_COMPLETION_QUEUE_COUNT != 128) && \
- (SCU_COMPLETION_QUEUE_COUNT != 256) && \
- (SCU_COMPLETION_QUEUE_COUNT != 512) && \
- (SCU_COMPLETION_QUEUE_COUNT != 1024)
-#error "SCU_COMPLETION_QUEUE_COUNT must be set to a power of 2."
-#endif
-
-#if SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES
-#error "Invalid configuration of unsolicited frame constants"
-#endif /* SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES */
-
-#define SCU_MIN_UF_TABLE_ENTRIES (8)
#define SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES (4096)
#define SCU_UNSOLICITED_FRAME_BUFFER_SIZE (1024)
#define SCU_INVALID_FRAME_INDEX (0xFFFF)
@@ -173,14 +105,14 @@ enum sci_controller_mode {
#define SCU_IO_REQUEST_MAX_SGE_SIZE (0x00FFFFFF)
#define SCU_IO_REQUEST_MAX_TRANSFER_LENGTH (0x00FFFFFF)
-/*
- * Determine the size of the unsolicited frame array including
- * unused buffers. */
-#if SCU_UNSOLICITED_FRAME_COUNT <= SCU_MIN_UF_TABLE_ENTRIES
-#define SCU_UNSOLICITED_FRAME_CONTROL_ARRAY_SIZE SCU_MIN_UF_TABLE_ENTRIES
-#else
-#define SCU_UNSOLICITED_FRAME_CONTROL_ARRAY_SIZE SCU_MAX_UNSOLICITED_FRAMES
-#endif /* SCU_UNSOLICITED_FRAME_COUNT <= SCU_MIN_UF_TABLE_ENTRIES */
+static inline void check_sizes(void)
+{
+ BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_EVENTS);
+ BUILD_BUG_ON(SCU_MAX_UNSOLICITED_FRAMES <= 8);
+ BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_UNSOLICITED_FRAMES);
+ BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_COMPLETION_QUEUE_ENTRIES);
+ BUILD_BUG_ON(SCU_MAX_UNSOLICITED_FRAMES > SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES);
+}
/**
* enum sci_status - This is the general return status enumeration for non-IO,