Skip to contentSkip to conversation

be2net: Issue fw_init/clean cmds to fw

PATCH Applied Sathya Perla 2 participants 2 messages Nov 23, 2009

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

PATCH 3/5 be2net: Issue fw_init/clean cmds to fw

These cmds are issued to the fw in probe/resume and remove/suspend paths to help fw execute some initialization and cleanup code.

This change needed the be_hw_up() code to be refactored as be_get_config().

---
 drivers/net/benet/be_cmds.c |   51 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/benet/be_cmds.h |    2 +
 drivers/net/benet/be_main.c |   50 ++++++++++++++++++++++++++++-------------
 3 files changed, 87 insertions(+), 16 deletions(-)
drivers/net/benet/be_cmds.c +51 -0
index 31980f8..2af87f1 100644
@@ -357,6 +357,57 @@ static struct be_mcc_wrb *wrb_from_mccq(struct be_adapter *adapter)
 	return wrb;
 }
 
+/* Tell fw we're about to start firing cmds by writing a
+ * special pattern across the wrb hdr; uses mbox
+ */
+int be_cmd_fw_init(struct be_adapter *adapter)
+{
+	u8 *wrb;
+	int status;
+
+	spin_lock(&adapter->mbox_lock);
+
+	wrb = (u8 *)wrb_from_mbox(adapter);
+	*wrb++ = 0xFF;
+	*wrb++ = 0x12;
+	*wrb++ = 0x34;
+	*wrb++ = 0xFF;
+	*wrb++ = 0xFF;
+	*wrb++ = 0x56;
+	*wrb++ = 0x78;
+	*wrb = 0xFF;
+
+	status = be_mbox_notify_wait(adapter);
+
+	spin_unlock(&adapter->mbox_lock);
+	return status;
+}
+
+/* Tell fw we're done with firing cmds by writing a
+ * special pattern across the wrb hdr; uses mbox
+ */
+int be_cmd_fw_clean(struct be_adapter *adapter)
+{
+	u8 *wrb;
+	int status;
+
+	spin_lock(&adapter->mbox_lock);
+
+	wrb = (u8 *)wrb_from_mbox(adapter);
+	*wrb++ = 0xFF;
+	*wrb++ = 0xAA;
+	*wrb++ = 0xBB;
+	*wrb++ = 0xFF;
+	*wrb++ = 0xFF;
+	*wrb++ = 0xCC;
+	*wrb++ = 0xDD;
+	*wrb = 0xFF;
+
+	status = be_mbox_notify_wait(adapter);
+
+	spin_unlock(&adapter->mbox_lock);
+	return status;
+}
 int be_cmd_eq_create(struct be_adapter *adapter,
 		struct be_queue_info *eq, int eq_delay)
 {
drivers/net/benet/be_cmds.h +2 -0
index 3b31abc..8ec6528 100644
@@ -851,3 +851,5 @@ extern int be_cmd_write_flashrom(struct be_adapter *adapter,
 			struct be_dma_mem *cmd, u32 flash_oper,
 			u32 flash_opcode, u32 buf_size);
 extern int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc);
+extern int be_cmd_fw_init(struct be_adapter *adapter);
+extern int be_cmd_fw_clean(struct be_adapter *adapter);
drivers/net/benet/be_main.c +34 -16

111 lines not on this page · raw message

Signature · 1 line
1.6.5.2
maintainer Applied
#1 lore raw

From: Sathya Perla <[email protected]>
Date: Mon, 23 Nov 2009 13:32:03 +0530

Quoted 6 lines

These cmds are issued to the fw in probe/resume and remove/suspend paths to help fw execute some initialization and cleanup code.

This change needed the be_hw_up() code to be refactored as be_get_config().

Applied.