summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjimharris <jimharris@FreeBSD.org>2014-05-07 16:57:33 +0000
committerjimharris <jimharris@FreeBSD.org>2014-05-07 16:57:33 +0000
commit34268f6d136b44bdbfd77ad42e19e907ac6493fb (patch)
treedc1d1ebd0e6460458da9697bd58163fc85cf022a /sys/dev
parent636363f8c23b878677cc1532f36a8515566b1e80 (diff)
downloadFreeBSD-src-34268f6d136b44bdbfd77ad42e19e907ac6493fb.zip
FreeBSD-src-34268f6d136b44bdbfd77ad42e19e907ac6493fb.tar.gz
MFC r263276:
Base the max number of SG elements on MAXPHYS.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isci/scil/sati_util.h11
-rw-r--r--sys/dev/isci/scil/sci_controller_constants.h9
-rw-r--r--sys/dev/isci/scil/sci_util.h10
-rw-r--r--sys/dev/isci/scil/scic_sds_request.h3
4 files changed, 14 insertions, 19 deletions
diff --git a/sys/dev/isci/scil/sati_util.h b/sys/dev/isci/scil/sati_util.h
index 0f141df..5b4ac47 100644
--- a/sys/dev/isci/scil/sati_util.h
+++ b/sys/dev/isci/scil/sati_util.h
@@ -62,6 +62,8 @@
* structure data, fill in sense data, etc.
*/
+#include <sys/param.h>
+
#include <dev/isci/scil/sati_types.h>
#include <dev/isci/scil/sati_translator_sequence.h>
@@ -144,15 +146,6 @@
#define ATA_MICROCODE_OFFSET_DOWNLOAD 0x03
#define ATA_MICROCODE_DOWNLOAD_SAVE 0x07
-#ifndef MIN
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#endif
-
-#ifndef MAX
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#endif
-
-
void sati_ata_non_data_command(
void * ata_io,
SATI_TRANSLATOR_SEQUENCE_T * sequence
diff --git a/sys/dev/isci/scil/sci_controller_constants.h b/sys/dev/isci/scil/sci_controller_constants.h
index 36740f7..c4e97f6 100644
--- a/sys/dev/isci/scil/sci_controller_constants.h
+++ b/sys/dev/isci/scil/sci_controller_constants.h
@@ -54,6 +54,8 @@
#ifndef _SCI_CONTROLLER_CONSTANTS_H_
#define _SCI_CONTROLLER_CONSTANTS_H_
+#include <sys/param.h>
+
/**
* @file
*
@@ -148,8 +150,13 @@ extern "C" {
/**
* This constant defines the maximum number of Scatter-Gather Elements
* to be used by any SCI component.
+ *
+ * Note: number of elements must be an even number, since descriptors
+ * posted to hardware always contain pairs of elements (with second
+ * element set to zeroes if not needed).
*/
-#define SCI_MAX_SCATTER_GATHER_ELEMENTS 130
+#define __MAXPHYS_ELEMENTS ((MAXPHYS / PAGE_SIZE) + 1)
+#define SCI_MAX_SCATTER_GATHER_ELEMENTS ((__MAXPHYS_ELEMENTS + 1) & ~0x1)
#endif
#ifndef SCI_MIN_SCATTER_GATHER_ELEMENTS
diff --git a/sys/dev/isci/scil/sci_util.h b/sys/dev/isci/scil/sci_util.h
index 25a19ae..f7c14ac 100644
--- a/sys/dev/isci/scil/sci_util.h
+++ b/sys/dev/isci/scil/sci_util.h
@@ -54,20 +54,14 @@
#ifndef _SCI_UTIL_H_
#define _SCI_UTIL_H_
+#include <sys/param.h>
+
#include <dev/isci/scil/sci_types.h>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
-#ifndef MIN
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#endif
-
-#ifndef MAX
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#endif
-
/**
* Normal byte swap macro
*/
diff --git a/sys/dev/isci/scil/scic_sds_request.h b/sys/dev/isci/scil/scic_sds_request.h
index bb8083e..1940721 100644
--- a/sys/dev/isci/scil/scic_sds_request.h
+++ b/sys/dev/isci/scil/scic_sds_request.h
@@ -65,6 +65,8 @@
extern "C" {
#endif // __cplusplus
+#include <sys/param.h>
+
#include <dev/isci/scil/scic_io_request.h>
#include <dev/isci/scil/sci_base_request.h>
@@ -331,7 +333,6 @@ extern SCIC_SDS_IO_REQUEST_STATE_HANDLER_T
#define scic_sds_request_get_task_context(request) \
((request)->task_context_buffer)
-#define CACHE_LINE_SIZE (64)
#define scic_sds_request_align_task_context_buffer(address) \
((SCU_TASK_CONTEXT_T *)( \
(((POINTER_UINT)(address)) + (CACHE_LINE_SIZE - 1)) \
OpenPOWER on IntegriCloud