#include <rte_malloc.h>
#include <rte_errno.h>
-#include "base/dlb2_resource.h"
+#define DLB2_USE_NEW_HEADERS /* TEMPORARY FOR MERGE */
+
+#include "base/dlb2_regs_new.h"
+#include "base/dlb2_hw_types_new.h"
+#include "base/dlb2_resource_new.h"
#include "base/dlb2_osdep.h"
-#include "base/dlb2_regs.h"
#include "dlb2_main.h"
#include "../dlb2_user.h"
#include "../dlb2_priv.h"
static void dlb2_pf_enable_pm(struct dlb2_dev *dlb2_dev)
{
- dlb2_clr_pmcsr_disable(&dlb2_dev->hw);
+ int version;
+ version = DLB2_HW_DEVICE_FROM_PCI_ID(dlb2_dev->pdev);
+
+ dlb2_clr_pmcsr_disable(&dlb2_dev->hw, version);
}
#define DLB2_READY_RETRY_LIMIT 1000
-static int dlb2_pf_wait_for_device_ready(struct dlb2_dev *dlb2_dev)
+static int dlb2_pf_wait_for_device_ready(struct dlb2_dev *dlb2_dev,
+ int dlb_version)
{
u32 retries = 0;
/* Allow at least 1s for the device to become active after power-on */
for (retries = 0; retries < DLB2_READY_RETRY_LIMIT; retries++) {
- union dlb2_cfg_mstr_cfg_diagnostic_idle_status idle;
- union dlb2_cfg_mstr_cfg_pm_status pm_st;
+ u32 idle_val;
+ u32 idle_dlb_func_idle;
+ u32 pm_st_val;
+ u32 pm_st_pmsm;
u32 addr;
- addr = DLB2_CFG_MSTR_CFG_PM_STATUS;
- pm_st.val = DLB2_CSR_RD(&dlb2_dev->hw, addr);
- addr = DLB2_CFG_MSTR_CFG_DIAGNOSTIC_IDLE_STATUS;
- idle.val = DLB2_CSR_RD(&dlb2_dev->hw, addr);
- if (pm_st.field.pmsm == 1 && idle.field.dlb_func_idle == 1)
+ addr = DLB2_CM_CFG_PM_STATUS(dlb_version);
+ pm_st_val = DLB2_CSR_RD(&dlb2_dev->hw, addr);
+ addr = DLB2_CM_CFG_DIAGNOSTIC_IDLE_STATUS(dlb_version);
+ idle_val = DLB2_CSR_RD(&dlb2_dev->hw, addr);
+ idle_dlb_func_idle = idle_val &
+ DLB2_CM_CFG_DIAGNOSTIC_IDLE_STATUS_DLB_FUNC_IDLE;
+ pm_st_pmsm = pm_st_val & DLB2_CM_CFG_PM_STATUS_PMSM;
+ if (pm_st_pmsm && idle_dlb_func_idle)
break;
rte_delay_ms(1);
{
struct dlb2_dev *dlb2_dev;
int ret = 0;
+ int dlb_version = 0;
DLB2_INFO(dlb2_dev, "probe\n");
goto dlb2_dev_malloc_fail;
}
+ dlb_version = DLB2_HW_DEVICE_FROM_PCI_ID(pdev);
+
/* PCI Bus driver has already mapped bar space into process.
* Save off our IO register and FUNC addresses.
*/
*/
dlb2_pf_enable_pm(dlb2_dev);
- ret = dlb2_pf_wait_for_device_ready(dlb2_dev);
+ ret = dlb2_pf_wait_for_device_ready(dlb2_dev, dlb_version);
if (ret)
goto wait_for_device_ready_fail;
if (ret)
goto init_driver_state_fail;
- ret = dlb2_resource_init(&dlb2_dev->hw);
+ ret = dlb2_resource_init(&dlb2_dev->hw, dlb_version);
if (ret)
goto resource_init_fail;