em(4): Give preference to emx(4) based on PCI ids.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 1 Mar 2009 10:04:43 +0000 (18:04 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 1 Mar 2009 10:06:32 +0000 (18:06 +0800)
sys/dev/netif/em/if_em.c
sys/dev/netif/em/if_em.h

index 742a2cd..1d8a175 100644 (file)
 #define EM_NAME        "Intel(R) PRO/1000 Network Connection "
 #define EM_VER " 6.9.6"
 
-#define EM_DEVICE(id)  \
-       { EM_VENDOR_ID, E1000_DEV_ID_##id, EM_NAME #id EM_VER }
-#define EM_DEVICE_NULL { 0, 0, NULL }
+#define _EM_DEVICE(id, ret)    \
+       { EM_VENDOR_ID, E1000_DEV_ID_##id, ret, EM_NAME #id EM_VER }
+#define EM_EMX_DEVICE(id)      _EM_DEVICE(id, -100)
+#define EM_DEVICE(id)          _EM_DEVICE(id, 0)
+#define EM_DEVICE_NULL { 0, 0, 0, NULL }
 
 static const struct em_vendor_info em_vendor_info_array[] = {
        EM_DEVICE(82540EM),
@@ -188,29 +190,29 @@ static const struct em_vendor_info em_vendor_info_array[] = {
        EM_DEVICE(82547EI_MOBILE),
        EM_DEVICE(82547GI),
 
-       EM_DEVICE(82571EB_COPPER),
-       EM_DEVICE(82571EB_FIBER),
-       EM_DEVICE(82571EB_SERDES),
-       EM_DEVICE(82571EB_SERDES_DUAL),
-       EM_DEVICE(82571EB_SERDES_QUAD),
-       EM_DEVICE(82571EB_QUAD_COPPER),
-       EM_DEVICE(82571EB_QUAD_COPPER_LP),
-       EM_DEVICE(82571EB_QUAD_FIBER),
-       EM_DEVICE(82571PT_QUAD_COPPER),
-
-       EM_DEVICE(82572EI_COPPER),
-       EM_DEVICE(82572EI_FIBER),
-       EM_DEVICE(82572EI_SERDES),
-       EM_DEVICE(82572EI),
-
-       EM_DEVICE(82573E),
-       EM_DEVICE(82573E_IAMT),
-       EM_DEVICE(82573L),
-
-       EM_DEVICE(80003ES2LAN_COPPER_SPT),
-       EM_DEVICE(80003ES2LAN_SERDES_SPT),
-       EM_DEVICE(80003ES2LAN_COPPER_DPT),
-       EM_DEVICE(80003ES2LAN_SERDES_DPT),
+       EM_EMX_DEVICE(82571EB_COPPER),
+       EM_EMX_DEVICE(82571EB_FIBER),
+       EM_EMX_DEVICE(82571EB_SERDES),
+       EM_EMX_DEVICE(82571EB_SERDES_DUAL),
+       EM_EMX_DEVICE(82571EB_SERDES_QUAD),
+       EM_EMX_DEVICE(82571EB_QUAD_COPPER),
+       EM_EMX_DEVICE(82571EB_QUAD_COPPER_LP),
+       EM_EMX_DEVICE(82571EB_QUAD_FIBER),
+       EM_EMX_DEVICE(82571PT_QUAD_COPPER),
+
+       EM_EMX_DEVICE(82572EI_COPPER),
+       EM_EMX_DEVICE(82572EI_FIBER),
+       EM_EMX_DEVICE(82572EI_SERDES),
+       EM_EMX_DEVICE(82572EI),
+
+       EM_EMX_DEVICE(82573E),
+       EM_EMX_DEVICE(82573E_IAMT),
+       EM_EMX_DEVICE(82573L),
+
+       EM_EMX_DEVICE(80003ES2LAN_COPPER_SPT),
+       EM_EMX_DEVICE(80003ES2LAN_SERDES_SPT),
+       EM_EMX_DEVICE(80003ES2LAN_COPPER_DPT),
+       EM_EMX_DEVICE(80003ES2LAN_SERDES_DPT),
 
        EM_DEVICE(ICH8_IGP_M_AMT),
        EM_DEVICE(ICH8_IGP_AMT),
@@ -230,7 +232,7 @@ static const struct em_vendor_info em_vendor_info_array[] = {
        EM_DEVICE(ICH9_IFE_G),
        EM_DEVICE(ICH9_BM),
 
-       EM_DEVICE(82574L),
+       EM_EMX_DEVICE(82574L),
 
        EM_DEVICE(ICH10_R_BM_LM),
        EM_DEVICE(ICH10_R_BM_LF),
@@ -399,7 +401,7 @@ em_probe(device_t dev)
                if (vid == ent->vendor_id && did == ent->device_id) {
                        device_set_desc(dev, ent->desc);
                        device_set_async_attach(dev, TRUE);
-                       return (0);
+                       return (ent->ret);
                }
        }
        return (ENXIO);
index 613821f..69ce83e 100644 (file)
@@ -415,6 +415,7 @@ struct adapter {
 struct em_vendor_info {
        uint16_t        vendor_id;
        uint16_t        device_id;
+       int             ret;
        const char      *desc;
 };