From 4cf0bb32a9121bc13ae5c03798870f31a0db8172 Mon Sep 17 00:00:00 2001
From: Ouyang Changchun <changchun.ouyang@intel.com>
Date: Thu, 12 Feb 2015 20:00:49 +0800
Subject: [PATCH] ixgbe/base: get X550 bus info

New function to get bus information for x550em;

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h |  1 +
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c | 23 +++++++++++++++++++++--
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h |  1 +
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
index 2ff8ecfad5..2e36dee708 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
@@ -3273,6 +3273,7 @@ enum ixgbe_bus_type {
 	ixgbe_bus_type_pci,
 	ixgbe_bus_type_pcix,
 	ixgbe_bus_type_pci_express,
+	ixgbe_bus_type_internal,
 	ixgbe_bus_type_reserved
 };
 
diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c
index a8511a0849..7d7bf9f8d6 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.c
@@ -173,8 +173,9 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	mac->ops.disable_sec_rx_path = NULL;
 	mac->ops.enable_sec_rx_path = NULL;
 
-	/* PCIe bus info not supported in X550EM */
-	mac->ops.get_bus_info = NULL;
+	/* X550EM bus type is internal*/
+	hw->bus.type = ixgbe_bus_type_internal;
+	mac->ops.get_bus_info = ixgbe_get_bus_info_X550em;
 
 	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
 	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
@@ -1772,6 +1773,24 @@ u32 ixgbe_get_supported_physical_layer_X550em(struct ixgbe_hw *hw)
 	return physical_layer;
 }
 
+/**
+ * ixgbe_get_bus_info_x550em - Set PCI bus info
+ * @hw: pointer to hardware structure
+ *
+ * Sets bus link width and speed to unknown because X550em is
+ * not a PCI device.
+ **/
+s32 ixgbe_get_bus_info_X550em(struct ixgbe_hw *hw)
+{
+
+	DEBUGFUNC("ixgbe_get_bus_info_x550em");
+
+	hw->bus.width = ixgbe_bus_width_unknown;
+	hw->bus.speed = ixgbe_bus_speed_unknown;
+
+	return IXGBE_SUCCESS;
+}
+
 /**
  * ixgbe_disable_rx_x550 - Disable RX unit
  *
diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h
index cebf1523de..eeadb34093 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_x550.h
@@ -40,6 +40,7 @@ s32 ixgbe_dmac_config_X550(struct ixgbe_hw *hw);
 s32 ixgbe_dmac_config_tcs_X550(struct ixgbe_hw *hw);
 s32 ixgbe_dmac_update_tcs_X550(struct ixgbe_hw *hw);
 
+s32 ixgbe_get_bus_info_X550em(struct ixgbe_hw *hw);
 s32 ixgbe_init_eeprom_params_X550(struct ixgbe_hw *hw);
 s32 ixgbe_update_eeprom_checksum_X550(struct ixgbe_hw *hw);
 s32 ixgbe_calc_eeprom_checksum_X550(struct ixgbe_hw *hw);
-- 
2.39.5