BNX2X: usability fixups

For whatever reason, we can run with the max number of queues on ether0,
but not on ether1.  From poking around, this happened once we started
attaching after resetting both NIC functions (ether0 and ether1).  I had
tried this at one point, but it didn't work.  For whateve reason, it
does now.

But ether1 will still die with the same old MC assert - unless both NICs
are limited to 1 queue.  Then they both work fine.  Note that if the
NICs have different values for NQ (say, 15 for ether0 and 1 for ether1),
*ether0* will get the MC assert.

Other changes include making sure init only happens when we actually
have a bnx2x NIC (by contrast, pnp always happens), and cleaning up the
print debugging.

Unfortunately, we don't have a way to send parameters to attach yet, so
you'll have to manually toggle the debug level if you want to debug
while attaching.
diff --git a/kern/drivers/net/bnx2x/bnx2x.h b/kern/drivers/net/bnx2x/bnx2x.h
index 1aec4b4..dc8b116 100644
--- a/kern/drivers/net/bnx2x/bnx2x.h
+++ b/kern/drivers/net/bnx2x/bnx2x.h
@@ -62,6 +62,7 @@
 #define BNX2X_MSG_DMAE			0x0080000 /* was: NETIF_MSG_HW */
 #define BNX2X_MSG_SP			0x0100000 /* was: NETIF_MSG_INTR */
 #define BNX2X_MSG_FP			0x0200000 /* was: NETIF_MSG_INTR */
+#define BNX2X_MSG_INFO			0x0400000
 #define BNX2X_MSG_IOV			0x0800000
 #define BNX2X_MSG_PTP			0x1000000
 #define BNX2X_MSG_IDLE			0x2000000 /* used for idle check*/
@@ -116,7 +117,7 @@
 	pr_err("[%s:%d]" fmt, __func__, __LINE__, ##__VA_ARGS__)
 
 /* before we have a dev->name use dev_info() */
-#define BNX2X_DEV_INFO(fmt, ...) pr_info(fmt, ##__VA_ARGS__)
+#define BNX2X_DEV_INFO(fmt, ...) DP(BNX2X_MSG_INFO, fmt, ##__VA_ARGS__)
 
 /* Error handling */
 void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int);
diff --git a/kern/drivers/net/bnx2x/bnx2x_cmn.c b/kern/drivers/net/bnx2x/bnx2x_cmn.c
index ec5cb0c..021b19a 100644
--- a/kern/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/kern/drivers/net/bnx2x/bnx2x_cmn.c
@@ -60,9 +60,6 @@
 		nq = 1;
 
 	nq = CLAMP(nq, 1, BNX2X_MAX_QUEUES(bp));
-	/* AKAROS_PORT XME.  For some reason, we can't handle 8 queues.  The linux
-	 * driver can...  We can handle 4 *total* queues, one per function. */
-	nq = MIN(nq, 2);
 	return nq;
 }
 
diff --git a/kern/drivers/net/bnx2x/bnx2x_dev.c b/kern/drivers/net/bnx2x/bnx2x_dev.c
index 9c9303a..60e276b 100644
--- a/kern/drivers/net/bnx2x/bnx2x_dev.c
+++ b/kern/drivers/net/bnx2x/bnx2x_dev.c
@@ -317,9 +317,6 @@
 	bnx2x_open(ctlr->edev);
 	bnx2x_set_rx_mode(edev);
 
-	/* shut it up for now.  too much stats output */
-	ctlr->msg_enable = 0;
-
 	ctlr->attached = TRUE;
 	qunlock(&ctlr->alock);
 	/* not sure if we'll need/want any of the other 9ns stuff */
@@ -381,8 +378,6 @@
 	struct bnx2x *ctlr;
 	const struct pci_device_id *pci_id;
 
-	bnx2x_init();
-
 	STAILQ_FOREACH(pcidev, &pci_devices, all_dev) {
 		/* This checks that pcidev is a Network Controller for Ethernet */
 		if (pcidev->class != 0x02 || pcidev->subclass != 0x00)
@@ -393,6 +388,9 @@
 		if (!pci_id)
 			continue;
 
+		/* only run bnx2x's __init method once we know we have one */
+		run_once(bnx2x_init());
+
 		printk("bnx2x driver found 0x%04x:%04x at %02x:%02x.%x\n",
 			   pcidev->ven_id, pcidev->dev_id,
 			   pcidev->bus, pcidev->dev, pcidev->func);
diff --git a/kern/drivers/net/bnx2x/bnx2x_main.c b/kern/drivers/net/bnx2x/bnx2x_main.c
index c01293e..d108d99 100644
--- a/kern/drivers/net/bnx2x/bnx2x_main.c
+++ b/kern/drivers/net/bnx2x/bnx2x_main.c
@@ -53,7 +53,7 @@
 MODULE_FIRMWARE(FW_FILE_NAME_E1H);
 MODULE_FIRMWARE(FW_FILE_NAME_E2);
 
-int bnx2x_num_queues;
+int bnx2x_num_queues = 16;	// AKAROS_PORT try for the max
 module_param_named(num_queues, bnx2x_num_queues, int, S_IRUGO);
 MODULE_PARM_DESC(num_queues,
 		 " Set number of queues (default is as a number of CPUs)");
@@ -75,7 +75,8 @@
 module_param(mrrs, int, S_IRUGO);
 MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)");
 
-static int debug;
+/* Set this for debugging during boot */
+static int debug; // = 0xffffffff & ~BNX2X_MSG_DMAE;
 module_param(debug, int, S_IRUGO);
 MODULE_PARM_DESC(debug, " Default debug msglevel");
 
@@ -10964,8 +10965,7 @@
 	val3 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[8]);
 	val4 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[12]);
 
-	dev_info(&bp->pdev->dev, "part number %X-%X-%X-%X\n",
-		 val, val2, val3, val4);
+	BNX2X_DEV_INFO("part number %x-%x-%x-%x\n", val, val2, val3, val4);
 }
 
 #define IGU_FID(val)	GET_FIELD((val), IGU_REG_MAPPING_MEMORY_FID)
@@ -12952,7 +12952,6 @@
 	dev->dcbnl_ops = &bnx2x_dcbnl_ops;
 #endif
 
-	warn("NEED TO DO MII STUFF");
 #if 0 // AKAROS_PORT MII XME
 	/* get_port_hwinfo() will set prtad and mmds properly */
 	bp->mdio.prtad = MDIO_PRTAD_NONE;
@@ -13269,7 +13268,6 @@
 		dev_info(&pdev->dev, "no msix capability found\n");
 		return 1 + cnic_cnt;
 	}
-	dev_info(&pdev->dev, "msix capability found\n");
 
 	/*
 	 * The value in the PCI configuration space is the index of the last
@@ -13429,7 +13427,7 @@
 
 	bp->igu_sb_cnt = max_non_def_sbs;
 	bp->igu_base_addr = IS_VF(bp) ? PXP_VF_ADDR_IGU_START : BAR_IGU_INTMEM;
-	bp->msg_enable = 0xffffffff & ~BNX2X_MSG_DMAE;
+	bp->msg_enable = debug;
 	bp->cnic_support = cnic_cnt;
 	bp->cnic_probe = bnx2x_cnic_probe;