Skip to contentSkip to conversation

BE NIC driver - beclib functions

PATCH In review Subbu Seetharaman 1 participant 1 message May 15, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/15 BE NIC driver - beclib functions

---
 drivers/message/beclib/eq_ll.c  |  756 +++++++++++++++++++
 drivers/message/beclib/mpu_ll.c | 1567 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 2323 insertions(+), 0 deletions(-)
 create mode 100644 drivers/message/beclib/eq_ll.c
 create mode 100644 drivers/message/beclib/mpu_ll.c
drivers/message/beclib/eq_ll.c new file +756 -0
new file mode 100644
index 0000000..01c6c15
@@ -0,0 +1,756 @@
+/*
+ * Copyright (C) 2005 - 2008 ServerEngines
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or at your option any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, 5th Floor
+ * Boston, MA 02110-1301 USA
+ *
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called GPL.
+ *
+ * Contact Information:
+ * [email protected]
+ *
+ * ServerEngines
+ * 209 N. Fair Oaks Ave
+ * Sunnyvale, CA 94085
+ *
+ */
+#include "pch.h"
+
+/*
+ *============================================================================
+ *                            F I L E   S C O P E
+ *============================================================================
+ */
+
+/*!
+
+@brief
+    This routine serializes access to resources maintained through an EQ object.
+
+@param
+    eq_object      - The event queue object to acquire the lock for.
+
+@return
+
+@note
+    IRQL < DISPATCH_LEVEL
+
+*/
+
+static void _be_eq_lock(struct BE_EQ_OBJECT *eq_object)
+{
+	SA_NOT_USED(eq_object);
+}
+
+/*!
+
+@brief
+    This routine removes serialization done by EqObjectLock.
+@param
+    eq_object      - the event queue object to drop the lock for.
+@return
+@note
+    IRQL < DISPATCH_LEVEL
+*/
+static void _be_eq_unlock(struct BE_EQ_OBJECT *eq_object)
+{
+	SA_NOT_USED(eq_object);
+}
+
+static INLINE struct BE_EQ_OBJECT *
+_be_eq_id_to_object(struct BE_FUNCTION_OBJECT *pfob, u32 eq_id)
+{
+	struct BE_EQ_OBJECT *eq_cur;
+	struct BE_EQ_OBJECT *eq_ret = NULL;
+	u32 eid;
+
+	_be_function_lock(pfob);
+
+	SA_FOR_EACH_LIST_ENTRY(eq_cur, pfob->links.eq_list_head,
+			       struct BE_EQ_OBJECT, eq_list) {
+		eid = be_eq_get_id(eq_cur);
+		if (eid == eq_id) {
+			eq_ret = eq_cur;
+			break;
+		}
+	}
+
+	_be_function_unlock(pfob);
+
+	return eq_ret;
+}
+
+/*
+ *============================================================================
+ *                  P U B L I C  R O U T I N E S
+ *============================================================================
+ */
+
+/*!
+
+@brief
+    This routine creates an event queue based on the client completion
+    queue configuration information.
+
+@param
+    FunctionObject      - Handle to a function object
+@param
+    EqBaseVa            - Base VA for a the EQ ring
+@param
+    SizeEncoding        - The encoded size for the EQ entries. This value is
+			either CEV_EQ_SIZE_4 or CEV_EQ_SIZE_16
+@param
+    NumEntries          - CEV_CQ_CNT_* values.
+@param
+    Watermark           - Enables watermark based coalescing.  This parameter
+			must be of the type CEV_WMARK_* if watermarks
+			are enabled.  If watermarks to to be disabled
+			this value should be-1.
+@param
+    TimerDelay          - If a timer delay is enabled this value should be the
+			time of the delay in 8 microsecond units.  If
+			delays are not used this parameter should be
+			set to -1.
+@param
+    ppEqObject          - Internal EQ Handle returned.
+
+@return
+    BE_SUCCESS if successfull,, otherwise a useful error code is returned.
+
+@note
+    IRQL < DISPATCH_LEVEL
+
+     If the FunctionObject represents an ISCSI function, then the EQID
+     returned will be between 0-31.
+*/
+static BESTATUS
+be_eq_create_internal(struct BE_FUNCTION_OBJECT *pfob,
+		struct SA_SGL *sgl, u32 eqe_size, u32 num_entries,
+		u32 watermark,	/* CEV_WMARK_* or -1 */
+		u32 timer_delay,	/* in 8us units, or -1 */
+		bool fake_eq, struct BE_EQ_OBJECT *eq_object)
+{
+	BESTATUS status = BE_SUCCESS;
+	u32 num_entries_encoding, eqe_size_encoding, length;
+	struct IOCTL_COMMON_EQ_CREATE_AMAP *ioctl = NULL;
+	struct BE_IOCTL_COMMON_EQ_CREATE_AMAP *be_ioctl;
+	struct MCC_WRB_AMAP *wrb = NULL;
+	struct PHYS_ADDR *pa_listp;
+	u32 n, npages;
+
+	ASSERT(sgl);
+	ASSERT(eq_object);
+
+	FUNCTION_ASSERT(pfob);
+
+	/*
+	 * To avoid assuming the enumeration values are constant,
+	 * I'm using a switch statement instead of calculating this
+	 * with sa_log2.
+	 */
+	switch (num_entries) {
+	case 256:
+		num_entries_encoding = CEV_EQ_CNT_256;
+		break;
+	case 512:
+		num_entries_encoding = CEV_EQ_CNT_512;
+		break;
+	case 1024:
+		num_entries_encoding = CEV_EQ_CNT_1024;
+		break;
+	case 2048:
+		num_entries_encoding = CEV_EQ_CNT_2048;
+		break;
+	case 4096:
+		num_entries_encoding = CEV_EQ_CNT_4096;
+		break;
+	default:
+		ASSERT(0);
+		return BE_STATUS_INVALID_PARAMETER;
+	}
+
+	/*
+	 * To avoid assuming the enumeration values are constant,
+	 * I'm using a switch statement instead of calculating
+	 * this with sa_log2.
+	 */
+	switch (eqe_size) {
+	case 4:
+		eqe_size_encoding = CEV_EQ_SIZE_4;
+		break;
+	case 16:
+		eqe_size_encoding = CEV_EQ_SIZE_16;
+		break;
+	default:
+		ASSERT(0);
+		return BE_STATUS_INVALID_PARAMETER;
+	}
+
+	if ((eqe_size == 4 && num_entries < 1024) ||
+	    (eqe_size == 16 && num_entries == 4096)) {
+		TRACE(DL_ERR, "Bad EQ size. eqe_size:%d num_entries:%d",
+		      eqe_size, num_entries);
+		ASSERT(0);
+		return BE_STATUS_INVALID_PARAMETER;
+	}
+
+	sa_zero_mem(eq_object, sizeof(*eq_object));
+
+	eq_object->magic = BE_EQ_MAGIC;
+	eq_object->ref_count = 0;
+	eq_object->parent_function = pfob;
+	eq_object->eq_id = 0xFFFFFFFF;
+
+	be_lock_init(&eq_object->lock);
+
+	sa_initialize_list_head(&eq_object->cq_list_head);
+
+	length = num_entries * eqe_size;
+
+	be_lock_wrb_post(pfob);
+
+	wrb = be_function_peek_mcc_wrb(pfob);
+	if (!wrb) {
+		ASSERT(wrb);
+		TRACE(DL_ERR, "No free MCC WRBs in create EQ.");
+		status = BE_STATUS_NO_MCC_WRB;
+		goto Error;
+	}
+	/* Prepares an embedded ioctl, including request/response sizes. */
+	ioctl = BE_PREPARE_EMBEDDED_IOCTL_AMAP(pfob, wrb,
+					       COMMON_EQ_CREATE);
+
+	n = SA_PAGES_SPANNED(sa_sgl_get_offset(sgl), length);
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE, params.request.num_pages,
+					ioctl, n);
+
+	n = be_function_get_function_number(pfob);
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE, params.request.context.Func,
+					ioctl, n);
+
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+				params.request.context.valid, ioctl, 1);
+
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.request.context.Size, ioctl, eqe_size_encoding);
+
+	n = be_function_get_pd_number(pfob);
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.request.context.PD, ioctl, n);
+
+	/* Let the caller ARM the EQ with the doorbell. */
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.request.context.Armed, ioctl, 0);
+
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+		params.request.context.Count, ioctl, num_entries_encoding);
+
+	n = be_function_get_function_number(pfob) * 32;
+	AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.request.context.EventVect, ioctl, n);
+	if (fake_eq) {
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+				params.request.context.Cidx, ioctl, 0);
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+				params.request.context.Pidx, ioctl, 2);
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+				params.request.context.EPIdx, ioctl, 2);
+	}
+	if (watermark != -1) {
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+				params.request.context.WME, ioctl, 1);
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.request.context.Watermark, ioctl, watermark);
+		ASSERT(watermark <= CEV_WMARK_240);
+	} else
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+				params.request.context.WME, ioctl, 0);
+	if (timer_delay != -1) {
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+				params.request.context.TMR, ioctl, 1);
+
+		ASSERT(timer_delay <= 250);	/* max value according to EAS */
+		timer_delay = MIN(timer_delay, 250);
+
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.request.context.Delay, ioctl, timer_delay);
+	} else {
+		AMAP_SET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.request.context.TMR, ioctl, 0);
+	}
+
+	n = AMAP_WORD_OFFSET(IOCTL_COMMON_EQ_CREATE, params.request.pages);
+	pa_listp = (struct PHYS_ADDR *)((u32 *)ioctl + n);
+	be_ioctl = (struct BE_IOCTL_COMMON_EQ_CREATE_AMAP *)ioctl;
+	npages = SA_NUMBER_OF(be_ioctl->params.request.pages);
+	be_sgl_to_pa_list(sgl, pa_listp, npages);
+
+	status = be_function_post_mcc_wrb(pfob, wrb, NULL, NULL,
+				     ioctl);
+	if (status != BE_SUCCESS) {
+		TRACE(DL_ERR, "MCC to create EQ failed.");
+		goto Error;
+	}
+	/* Get the EQ id.  The MPU allocates the IDs. */
+	eq_object->eq_id = AMAP_GET_BITS_PTR(IOCTL_COMMON_EQ_CREATE,
+			params.response.eq_id, ioctl);
+
+	/* insert tracking object */
+	_be_function_add_eq(pfob, eq_object);
+
+	TRACE(DL_INFO,
+	      "eq created. function:%d pd:%d eqid:%d bytes:%d eqeBytes:%d"
+	      " wm:%d td:%d",
+	      be_function_get_function_number(pfob),
+	      be_function_get_pd_number(pfob), eq_object->eq_id,
+	      num_entries * eqe_size, eqe_size, watermark, timer_delay);
+
+Error:
+	be_unlock_wrb_post(pfob);
+	return status;
+}
+
+BESTATUS be_eq_create(struct BE_FUNCTION_OBJECT *pfob, struct SA_SGL
+		*sgl, u32 eqe_size, u32 num_entries,
+		u32 watermark,	/* CEV_WMARK_* or -1 */
+		u32 timer_delay,	/* in 8us units, or -1 */
+		struct BE_EQ_OBJECT *eq_object)
+{
+	return be_eq_create_internal(pfob,
+				     sgl,
+				     eqe_size,
+				     num_entries,
+				     watermark,
+				     timer_delay, FALSE, eq_object);
+}
+
+BESTATUS be_eq_fake_create(struct BE_FUNCTION_OBJECT *pfob,
+		u32 timer_delay,	/* in 8us units, or -1 */
+		struct BE_EQ_OBJECT *eq_object)
+{
+	struct SA_SGL sgl;
+
+	sa_sgl_create_contiguous((void *) 0xbad0000,
+				 (u64) 0xbad00000,
+				 SA_PAGE_SIZE, &sgl);
+
+	return be_eq_create_internal(pfob,
+				     &sgl,
+				     sizeof(struct EQ_ENTRY_AMAP),
+				     4096 / sizeof(struct EQ_ENTRY_AMAP),
+				     0xFFFFFFFF,
+				     timer_delay, TRUE, eq_object);
+}
+
+/*!
+
+@brief
+    Returns the EQ ID for EQ. This is the ID the chip references the queue as.
+
+@param
+    EqObject            - EQ Handle returned from EqObjectCreate.
+
+@return
+    EQ ID
+@note
+    IRQL: any
+
+*/
+u32 be_eq_get_id(struct BE_EQ_OBJECT *eq_object)
+{
+	EQ_ASSERT(eq_object);
+	return eq_object->eq_id;
+}
+
+/*!
+
+@brief
+    Sets the current callback to be invoked when a EQ entry is made available.
+    This need only be set if the owner of this EQ does not recieve the EQ
+    completions directly. i.e. it does not service interrupts.
+
+@param
+    eq_object            - EQ handle returned from eq_object_create.
+
+@param
+    callback            - function to invoke when the EQ needs processing.
+
+@param
+    context             - opaque context to pass to callback.
+
+@return
+    ptr to the previous callback.
+
+@note
+    IRQL: any
+
+    this routine is currently not synchronized w/ the DPC that may run the EQ.
+    therefore it is the callers responcibility to ensure the EQ will not
+    interrupt while this routine is executing.
+*/
+EQ_CALLBACK
+be_eq_set_callback(struct BE_EQ_OBJECT *eq_object,
+		   EQ_CALLBACK callback, void *context)
+{
+	EQ_CALLBACK old_callback;
+
+	EQ_ASSERT(eq_object);
+
+	old_callback = eq_object->callback;
+
+	eq_object->callback = callback;
+	eq_object->callback_context = context;
+
+	return old_callback;
+}
+
+/*!
+
+@brief
+    This routine handles EQ processing on EQs that were 'unrecognized' by upper
+    level drivers.  The only EQs that should be processed by this routine are
+	* iWARP EQ
+    The iWARP EQ will be delegated further for handling by the
+    iWARP device driver
+
+@param
+    FunctionObject      - Handle to a function object
+@param
+    EqId                - The Eq that has just completed processing
+
+@return
+
+@note
+    IRQL: DISPATCH_LEVEL only
+
+    This routine should be called immediately when a EQ from a ULD is not
+    recognized.
+*/
+void
+be_eq_delegate_processing(struct BE_FUNCTION_OBJECT *pfob, u32 eq_id)
+{
+	struct BE_EQ_OBJECT *eq_object;
+
+	FUNCTION_ASSERT(pfob);
+
+	eq_object = _be_eq_id_to_object(pfob, eq_id);
+
+	if (eq_object) {
+
+		eq_object->callback(pfob, eq_object,
+				    eq_object->callback_context);
+
+	} else {
+
+		TRACE(DL_WARN, "eq_id %d not found for delegation", eq_id);
+	}
+
+}
+
+/*!
+
+@brief
+    This routine adds a CQ as a dependent object on the given EQ. This will
+    cause the reference count to be incrmented and the CQ to be placed on
+    the EQ's list of active CQ objects.
+
+@param
+    eq_object            - EQ handle returned from eq_object_create.
+@param
+    cq_object            - CQ handle that is dependent on this EQ
+
+@return
+    EQ ID
+@note
+    IRQL: < DISPATCH_LEVEL
+
+*/
+void _be_eq_add_cq(struct BE_EQ_OBJECT *eq_object,
+				struct BE_CQ_OBJECT *cq_object)
+{
+	EQ_ASSERT(eq_object);
+
+	CQ_ASSERT(cq_object);
+
+	_be_eq_lock(eq_object);
+
+	be_eq_reference(eq_object);
+
+	sa_insert_tail_list(&eq_object->cq_list_head,
+			    &cq_object->cqlist_for_eq);
+
+	_be_eq_unlock(eq_object);
+}
+
+/*!
+
+@brief
+    References the given object. The object is guaranteed to remain active until
+    the reference count drops to zero.
+
+@param
+    eq_object            - CQ handle returned from cq_object_create.
+
+@return
+    returns the current reference count on the object
+
+@note
+    IRQL: any
+
+*/
+u32 be_eq_reference(struct BE_EQ_OBJECT *eq_object)
+{
+	EQ_ASSERT(eq_object);
+	return sa_atomic_increment(&eq_object->ref_count);
+}
+
+/*!
+
+@brief
+    Dereferences the given object. The object is guaranteed to remain
+    active until the reference count drops to zero.
+
+@param
+    eq_object            - CQ handle returned from cq_object_create.
+
+@return
+    returns the current reference count on the object
+
+@note
+    IRQL: any
+
+*/
+u32 be_eq_dereference(struct BE_EQ_OBJECT *eq_object)
+{
+	EQ_ASSERT(eq_object);
+	return sa_atomic_decrement(&eq_object->ref_count);
+}
+
+/*!
+@brief
+    This routine removes a CQ as a dependent object on the given EQ. This will
+    cause the reference count to be decrmented and the CQ to be removed from
+    the EQ's list of active CQ objects.
+@param
+    eq_object            - EQ handle returned from eq_object_create.
+@param
+    cq_object            - CQ handle that was dependent on this EQ
+@return
+    EQ ID
+@note
+    IRQL: < DISPATCH_LEVEL
+*/
+void
+_be_eq_remove_cq(struct BE_EQ_OBJECT *eq_object, struct BE_CQ_OBJECT *cq_object)
+{
+	EQ_ASSERT(eq_object);
+	CQ_ASSERT(cq_object);
+
+	be_eq_dereference(eq_object);
+
+	_be_eq_lock(eq_object);
+	sa_remove_entry_list(&cq_object->cqlist_for_eq);
+	_be_eq_unlock(eq_object);
+}
+
+/*!
+@brief
+    Deferences the given object. Once the object's reference count drops to
+    zero, the object is destroyed and all resources that are held by this
+    object are released.  The on-chip context is also destroyed along with
+    the queue ID, and any mappings made into the UT.
+@param
+    eq_object            - EQ handle returned from eq_object_create.
+@return
+    BE_SUCCESS if successfull, , otherwise a useful error code is returned.
+@note
+    IRQL: IRQL < DISPATCH_LEVEL
+*/
+BESTATUS be_eq_destroy(struct BE_EQ_OBJECT *eq_object)
+{
+	BESTATUS status = 0;
+
+	EQ_ASSERT(eq_object);
+
+	ASSERT(eq_object->ref_count == 0);
+	/* no CQs should reference this EQ now */
+	ASSERT(sa_is_list_empty(&eq_object->cq_list_head));
+
+	/* Send ioctl to destroy the EQ. */
+	status =
+	    be_function_ring_destroy(eq_object->parent_function,
+				     eq_object->eq_id, IOCTL_RING_TYPE_EQ);
+	ASSERT(status == 0);
+
+	/* remove from the function */
+	_be_function_remove_eq(eq_object->parent_function, eq_object);
+
+	/* zero tracking object */
+	sa_zero_mem(eq_object, sizeof(struct BE_EQ_OBJECT));
+
+	return BE_SUCCESS;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ * Function: be_eq_modify_delay
+ *   Changes the EQ delay for a group of EQs.
+ * num_eq             - The number of EQs in the eq_array to adjust.
+ * 			This also is the number of delay values in
+ * 			the eq_delay_array.
+ * eq_array           - Array of struct BE_EQ_OBJECT pointers to adjust.
+ * eq_delay_array     - Array of "num_eq" timer delays in units
+ * 			of microseconds. The be_eq_query_delay_range
+ * 			ioctl returns the resolution and range of
+ *                      legal EQ delays.
+ * callback           -
+ * callback_context   -
+ * queue_context      - Optional. Pointer to a previously allocated
+ * 			struct. If the MCC WRB ring is full, this
+ * 			structure is used to queue the operation. It
+ *                      will be posted to the MCC ring when space
+ *                      becomes available. All queued commands will
+ *                      be posted to the ring in the order they are
+ *                      received. It is always valid to pass a pointer to
+ *                      a generic BE_GENERIC_QUEUE_CONTEXT. However,
+ *                      the specific context structs
+ *                      are generally smaller than the generic struct.
+ * return pend_status - BE_SUCCESS (0) on success.
+ * 			BE_PENDING (postive value) if the IOCTL
+ *                      completion is pending. Negative error code on failure.
+ *-------------------------------------------------------------------------
+ */
+BESTATUS
+be_eq_modify_delay(struct BE_FUNCTION_OBJECT *pfob,
+		   u32 num_eq,
+		   struct BE_EQ_OBJECT **eq_array,
+		   u32 *eq_delay_array,
+		   MCC_WRB_CQE_CALLBACK callback,
+		   void *callback_context,
+		   struct BE_EQ_MODIFY_DELAY_QUEUE_CONTEXT *queue_context)
+{
+	struct IOCTL_COMMON_MODIFY_EQ_DELAY *ioctl = NULL;
+	struct MCC_WRB_AMAP *wrb = NULL;
+	BESTATUS status = 0;
+	struct BE_GENERIC_QUEUE_CONTEXT *generic_context = NULL;
+	u32 i;
+
+	be_lock_wrb_post(pfob);
+
+	wrb = be_function_peek_mcc_wrb(pfob);
+	if (!wrb) {
+		if (queue_context && callback) {
+			wrb = (struct MCC_WRB_AMAP *)
+					&queue_context->wrb_header;
+			generic_context = (struct BE_GENERIC_QUEUE_CONTEXT *)
+				queue_context;
+			generic_context->context.bytes =
+			    sizeof(*queue_context);
+		} else {
+			status = BE_STATUS_NO_MCC_WRB;
+			goto Error;
+		}
+	}
+	/* Prepares an embedded ioctl, including request/response sizes. */
+	ioctl = BE_PREPARE_EMBEDDED_IOCTL(pfob, wrb, COMMON_MODIFY_EQ_DELAY);
+
+	ASSERT(num_eq > 0);
+	ASSERT(num_eq <= SA_NUMBER_OF(ioctl->params.request.delay));
+	ioctl->params.request.num_eq = num_eq;
+	for (i = 0; i < num_eq; i++) {
+		ioctl->params.request.delay[i].eq_id =
+		    be_eq_get_id(eq_array[i]);
+		ioctl->params.request.delay[i].delay_in_microseconds =
+		    eq_delay_array[i];
+	}
+
+	/* Post the Ioctl */
+	status = be_function_post_mcc_wrb_with_queue_context(pfob, wrb,
+			generic_context, callback, callback_context, ioctl);
+
+Error:
+	be_unlock_wrb_post(pfob);
+
+	return status;
+
+}
+
+/*
+ *--------------------------------------------------------------------------
+ * Function: be_eq_query_delay_range
+ *   Queries the resolution and range allowed for EQ delay.
+ *   This is a constant set by the firmware, so it may be queried
+ *   one time at system boot. It is the same for all EQs.
+ *   This is a synchronous IOCTL.
+ * pfob     - Previously created function object
+ * eq_delay_resolution - Resolution of EQ delay in microseconds.
+ * eq_delay_max        - Max value of EQ delay in microseconds.
+ * return status       - BE_SUCCESS (0) on success. Negative
+ * 			error code on failure.
+ *--------------------------------------------------------------------------
+ */
+BESTATUS
+be_eq_query_delay_range(struct BE_FUNCTION_OBJECT *pfob,
+			u32 *eq_delay_resolution, u32 *eq_delay_max)
+{
+	struct IOCTL_COMMON_MODIFY_EQ_DELAY *ioctl = NULL;
+	struct MCC_WRB_AMAP *wrb = NULL;
+	BESTATUS status = 0;
+
+	FUNCTION_ASSERT(pfob);
+
+	ASSERT(eq_delay_resolution);
+	ASSERT(eq_delay_max);
+
+	be_lock_wrb_post(pfob);
+
+	wrb = be_function_peek_mcc_wrb(pfob);
+	if (!wrb) {
+		ASSERT(wrb);
+		TRACE(DL_ERR, "No free MCC WRBs.");
+		status = BE_STATUS_NO_MCC_WRB;
+		goto Error;
+	}
+	/* Prepares an embedded ioctl, including request/response sizes. */
+	ioctl = BE_PREPARE_EMBEDDED_IOCTL(pfob, wrb, COMMON_MODIFY_EQ_DELAY);
+
+	/* init the context */
+	ioctl->params.request.num_eq = 0;
+
+	status =
+	    be_function_post_mcc_wrb(pfob, wrb, NULL, NULL,
+				     ioctl);
+	if (status != BE_SUCCESS) {
+		TRACE(DL_ERR, "Query EQ delay range failed.");
+		goto Error;
+	}
+
+	*eq_delay_resolution =
+	    ioctl->params.response.delay_resolution_in_microseconds;
+	*eq_delay_max = ioctl->params.response.delay_max_in_microseconds;
+
+	TRACE(DL_INFO, "eq delay. function:%d pd:%d resolution:%d max:%d",
+	      be_function_get_function_number(pfob),
+	      be_function_get_pd_number(pfob),
+	      *eq_delay_resolution, *eq_delay_max);
+
+Error:
+	be_unlock_wrb_post(pfob);
+	return status;
+
+}
drivers/message/beclib/mpu_ll.c new file +1567 -0

1,567 lines not on this page · raw message

Signature · 8 lines
1.5.5

___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of
ServerEngines Corporation and is intended only for the designated recipient(s) named above. Any unauthorized
review, printing, retention, copying, disclosure or distribution is strictly prohibited.  If you are not the
intended recipient of this message, please immediately advise the sender by reply email message and
delete all copies of this message and any attachment(s). Thank you.