summaryrefslogtreecommitdiff
path: root/drivers/net/e1000.h
diff options
context:
space:
mode:
authorKyle Moffett <Kyle.D.Moffett@boeing.com>2011-10-18 11:05:26 +0000
committerWolfgang Denk <wd@denx.de>2011-10-28 00:34:40 +0200
commitd60626f8c11e3d76cb53c3ba16249c7b054c5a1e (patch)
treef9260dd7a19b36635941cc813d428b01e2fb4ca2 /drivers/net/e1000.h
parent987b43a1d722a136a0f0e401f06695acce9daa0d (diff)
downloadu-boot-imx-d60626f8c11e3d76cb53c3ba16249c7b054c5a1e.zip
u-boot-imx-d60626f8c11e3d76cb53c3ba16249c7b054c5a1e.tar.gz
u-boot-imx-d60626f8c11e3d76cb53c3ba16249c7b054c5a1e.tar.bz2
e1000: Restructure and streamline PCI device probing
By allocating the e1000 device structures much earlier, we can easily generate better error messages and siginficantly clean things up. The only user-visable change (aside from reworded error messages) is that a detected e1000 device which fails to initialize due to software or hardware error will still be allocated a device number. As one example, consider a system with 2 e1000 PCI devices where the first controller has a corrupted EEPROM. Using the old code the second controller would be "e1000#0", while with this change it would be "e1000#1". This change should hopefully make such EEPROM errors much more straightforward to handle correctly in boot scripts and the like. It is also necessary for a followup patch which allows SPI programming of an e1000 controller's EEPROM even if the checksum is invalid. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com> Cc: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers/net/e1000.h')
-rw-r--r--drivers/net/e1000.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
index 5a02dc3..b4e9cf2 100644
--- a/drivers/net/e1000.h
+++ b/drivers/net/e1000.h
@@ -41,16 +41,18 @@
#include <asm/io.h>
#include <pci.h>
-#define E1000_ERR(args...) printf("e1000: " args)
+#define E1000_ERR(NIC, fmt, args...) \
+ printf("e1000: %s: ERROR: " fmt, (NIC)->name ,##args)
#ifdef E1000_DEBUG
-#define E1000_DBG(args...) printf("e1000: " args)
-#define DEBUGOUT(fmt,args...) printf(fmt ,##args)
-#define DEBUGFUNC() printf("%s\n", __FUNCTION__);
+#define E1000_DBG(NIC, fmt, args...) \
+ printf("e1000: %s: DEBUG: " fmt, (NIC)->name ,##args)
+#define DEBUGOUT(fmt, args...) printf(fmt ,##args)
+#define DEBUGFUNC() printf("%s\n", __func__);
#else
-#define E1000_DBG(args...)
-#define DEBUGFUNC()
-#define DEBUGOUT(fmt,args...)
+#define E1000_DBG(HW, args...) do { } while (0)
+#define DEBUGFUNC() do { } while (0)
+#define DEBUGOUT(fmt, args...) do { } while (0)
#endif
/* Forward declarations of structures used by the shared code */
@@ -1047,6 +1049,9 @@ typedef enum {
/* Structure containing variables used by the shared code (e1000_hw.c) */
struct e1000_hw {
+ struct eth_device *nic;
+ unsigned int cardnum;
+
pci_dev_t pdev;
uint8_t *hw_addr;
e1000_mac_type mac_type;