Skip to contentSkip to conversation

BE NIC driver - beclib functions

PATCH In review Subbu Seetharaman 1 participant 1 message Jun 3, 2008

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

PATCH 6/12 BE NIC driver - beclib functions

From: Subbu Seetharaman <[email protected]>

---
 drivers/message/beclib/chipobj_ll.c |  111 +++
 drivers/message/beclib/funcobj_ll.c | 1319 +++++++++++++++++++++++++++++++++++
 drivers/message/beclib/main_ll.c    |   39 +
 3 files changed, 1469 insertions(+), 0 deletions(-)
 create mode 100644 drivers/message/beclib/chipobj_ll.c
 create mode 100644 drivers/message/beclib/funcobj_ll.c
 create mode 100644 drivers/message/beclib/main_ll.c
drivers/message/beclib/chipobj_ll.c new file +111 -0
new file mode 100644
index 0000000..49be0ca
@@ -0,0 +1,111 @@
+/*
+ * 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 version 2
+ * as published by the Free Software Foundation.  The full GNU General
+ * Public License is included in this distribution in the file called COPYING.
+ *
+ * Contact Information:
+ * [email protected]
+ *
+ * ServerEngines
+ * 209 N. Fair Oaks Ave
+ * Sunnyvale, CA 94085
+ */
+#include "pch.h"
+
+BESTATUS be_chip_create(struct be_chip_object *chip)
+{
+	BESTATUS status = BE_SUCCESS;
+
+	ASSERT(chip);
+	memset(chip, 0, sizeof(*chip));
+
+	TRACE(DL_INFO, "Create chip object. object:0x%p", chip);
+
+	atomic_set(&chip->ref_count, 0);
+
+	INIT_LIST_HEAD(&chip->function_list_head);
+
+	spin_lock_init(&chip->lock.lock);
+
+	return status;
+}
+
+void be_chip_destroy(struct be_chip_object *chip)
+{
+	ASSERT(chip->ref_count == 0);
+
+	memset(chip, 0, sizeof(*chip));
+	TRACE(DL_INFO, "destroying chip %p", chip);
+}
+
+BESTATUS
+be_chip_insert_function_object(struct be_chip_object *chip_object,
+			       struct be_function_object *pfob)
+{
+	TRACE(DL_INFO, "Insert function into chip object.");
+
+	ASSERT(pfob->parent_chip == NULL ||
+	       pfob->parent_chip == chip_object);
+	pfob->parent_chip = chip_object;
+
+	be_chip_lock(chip_object);
+
+	atomic_inc(&chip_object->ref_count);
+	list_add_tail(&pfob->function_list, &chip_object->function_list_head);
+
+	be_chip_unlock(chip_object);
+
+	return BE_SUCCESS;
+}
+
+void
+be_chip_remove_function_object(struct be_chip_object *chip_object,
+			       struct be_function_object *pfob)
+{
+	pfob->parent_chip = NULL;
+
+	be_chip_lock(chip_object);
+
+	ASSERT(atomic_read(&chip_object->ref_count) > 0);
+	ASSERT(!list_empty(&chip_object->function_list_head));
+
+	atomic_dec(&chip_object->ref_count);
+	list_del(&pfob->function_list);
+
+	be_chip_unlock(chip_object);
+}
+
+/*!
+
+@brief
+    This routine serializes access to resources maintained
+    through a chip object.
+
+@param
+    ChipObject      - The chip object to acquire the lock for.
+
+@note
+    IRQL < DISPATCH_LEVEL
+
+*/
+void be_chip_lock(struct be_chip_object *chip_object)
+{
+	spin_lock_irqsave(&chip_object->lock.lock, chip_object->lock.irql);
+}
+
+/*!
+@brief
+    This routine removes serialization done by ChipObjectLock.
+@param
+    ChipObject      - The chip object to drop the lock for.
+@note
+    IRQL < DISPATCH_LEVEL
+*/
+void be_chip_unlock(struct be_chip_object *chip_object)
+{
+	spin_unlock_irqrestore(&chip_object->lock.lock, chip_object->lock.irql);
+}
drivers/message/beclib/funcobj_ll.c new file +1319 -0

1,319 lines not on this page · raw message

drivers/message/beclib/main_ll.c new file +39 -0
new file mode 100644
index 0000000..106b388
@@ -0,0 +1,39 @@
+/*
+ * 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 version 2
+ * as published by the Free Software Foundation.  The full GNU General
+ * Public License is included in this distribution in the file called COPYING.
+ *
+ * Contact Information:
+ * [email protected]
+ *
+ * ServerEngines
+ * 209 N. Fair Oaks Ave
+ * Sunnyvale, CA 94085
+ */
+#include "pch.h"
+
+unsigned int trace_level;
+/*!
+@brief
+    System-invoked entry point for system DLL.
+    This routine gets called once per system instantiation, is
+    responsible for registering the the driver's entry points.
+    Initialization and configuration occur elsewhere.
+@return
+    SA_SUCCESS if ok.
+@note
+    IRQL: PASSIVE_LEVEL
+    We cannot touch registers in this routine
+*/
+BESTATUS be_initialize_library(void)
+{
+	SA_TRACE(DL_NOTE, "Built on " __DATE__ " " __TIME__);
+
+	sa_trace_set_debug_level_string(DL_HW, "hw");
+
+	return BE_SUCCESS;
+}
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.