diff options
-rw-r--r-- | drivers/net/bnx2x_main.c | 61 | ||||
-rw-r--r-- | drivers/net/bnx2x_reg.h | 13 |
2 files changed, 72 insertions, 2 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 312f652872b4..ea7d86d2da92 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -7006,6 +7006,64 @@ reset_task_exit: | |||
7006 | * Init service functions | 7006 | * Init service functions |
7007 | */ | 7007 | */ |
7008 | 7008 | ||
7009 | static inline u32 bnx2x_get_pretend_reg(struct bnx2x *bp, int func) | ||
7010 | { | ||
7011 | switch (func) { | ||
7012 | case 0: return PXP2_REG_PGL_PRETEND_FUNC_F0; | ||
7013 | case 1: return PXP2_REG_PGL_PRETEND_FUNC_F1; | ||
7014 | case 2: return PXP2_REG_PGL_PRETEND_FUNC_F2; | ||
7015 | case 3: return PXP2_REG_PGL_PRETEND_FUNC_F3; | ||
7016 | case 4: return PXP2_REG_PGL_PRETEND_FUNC_F4; | ||
7017 | case 5: return PXP2_REG_PGL_PRETEND_FUNC_F5; | ||
7018 | case 6: return PXP2_REG_PGL_PRETEND_FUNC_F6; | ||
7019 | case 7: return PXP2_REG_PGL_PRETEND_FUNC_F7; | ||
7020 | default: | ||
7021 | BNX2X_ERR("Unsupported function index: %d\n", func); | ||
7022 | return (u32)(-1); | ||
7023 | } | ||
7024 | } | ||
7025 | |||
7026 | static void bnx2x_undi_int_disable_e1h(struct bnx2x *bp, int orig_func) | ||
7027 | { | ||
7028 | u32 reg = bnx2x_get_pretend_reg(bp, orig_func), new_val; | ||
7029 | |||
7030 | /* Flush all outstanding writes */ | ||
7031 | mmiowb(); | ||
7032 | |||
7033 | /* Pretend to be function 0 */ | ||
7034 | REG_WR(bp, reg, 0); | ||
7035 | /* Flush the GRC transaction (in the chip) */ | ||
7036 | new_val = REG_RD(bp, reg); | ||
7037 | if (new_val != 0) { | ||
7038 | BNX2X_ERR("Hmmm... Pretend register wasn't updated: (0,%d)!\n", | ||
7039 | new_val); | ||
7040 | BUG(); | ||
7041 | } | ||
7042 | |||
7043 | /* From now we are in the "like-E1" mode */ | ||
7044 | bnx2x_int_disable(bp); | ||
7045 | |||
7046 | /* Flush all outstanding writes */ | ||
7047 | mmiowb(); | ||
7048 | |||
7049 | /* Restore the original funtion settings */ | ||
7050 | REG_WR(bp, reg, orig_func); | ||
7051 | new_val = REG_RD(bp, reg); | ||
7052 | if (new_val != orig_func) { | ||
7053 | BNX2X_ERR("Hmmm... Pretend register wasn't updated: (%d,%d)!\n", | ||
7054 | orig_func, new_val); | ||
7055 | BUG(); | ||
7056 | } | ||
7057 | } | ||
7058 | |||
7059 | static inline void bnx2x_undi_int_disable(struct bnx2x *bp, int func) | ||
7060 | { | ||
7061 | if (CHIP_IS_E1H(bp)) | ||
7062 | bnx2x_undi_int_disable_e1h(bp, func); | ||
7063 | else | ||
7064 | bnx2x_int_disable(bp); | ||
7065 | } | ||
7066 | |||
7009 | static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | 7067 | static void __devinit bnx2x_undi_unload(struct bnx2x *bp) |
7010 | { | 7068 | { |
7011 | u32 val; | 7069 | u32 val; |
@@ -7056,8 +7114,7 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | |||
7056 | /* now it's safe to release the lock */ | 7114 | /* now it's safe to release the lock */ |
7057 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | 7115 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); |
7058 | 7116 | ||
7059 | REG_WR(bp, (BP_PORT(bp) ? HC_REG_CONFIG_1 : | 7117 | bnx2x_undi_int_disable(bp, func); |
7060 | HC_REG_CONFIG_0), 0x1000); | ||
7061 | 7118 | ||
7062 | /* close input traffic and wait for it */ | 7119 | /* close input traffic and wait for it */ |
7063 | /* Do not rcv packets to BRB */ | 7120 | /* Do not rcv packets to BRB */ |
diff --git a/drivers/net/bnx2x_reg.h b/drivers/net/bnx2x_reg.h index 0be77c5bcefa..b654d5d2a92b 100644 --- a/drivers/net/bnx2x_reg.h +++ b/drivers/net/bnx2x_reg.h | |||
@@ -2061,6 +2061,19 @@ | |||
2061 | #define PXP2_REG_PGL_INT_XSDM_5 0x1204e8 | 2061 | #define PXP2_REG_PGL_INT_XSDM_5 0x1204e8 |
2062 | #define PXP2_REG_PGL_INT_XSDM_6 0x1204ec | 2062 | #define PXP2_REG_PGL_INT_XSDM_6 0x1204ec |
2063 | #define PXP2_REG_PGL_INT_XSDM_7 0x1204f0 | 2063 | #define PXP2_REG_PGL_INT_XSDM_7 0x1204f0 |
2064 | /* [RW 3] this field allows one function to pretend being another function | ||
2065 | when accessing any BAR mapped resource within the device. the value of | ||
2066 | the field is the number of the function that will be accessed | ||
2067 | effectively. after software write to this bit it must read it in order to | ||
2068 | know that the new value is updated */ | ||
2069 | #define PXP2_REG_PGL_PRETEND_FUNC_F0 0x120674 | ||
2070 | #define PXP2_REG_PGL_PRETEND_FUNC_F1 0x120678 | ||
2071 | #define PXP2_REG_PGL_PRETEND_FUNC_F2 0x12067c | ||
2072 | #define PXP2_REG_PGL_PRETEND_FUNC_F3 0x120680 | ||
2073 | #define PXP2_REG_PGL_PRETEND_FUNC_F4 0x120684 | ||
2074 | #define PXP2_REG_PGL_PRETEND_FUNC_F5 0x120688 | ||
2075 | #define PXP2_REG_PGL_PRETEND_FUNC_F6 0x12068c | ||
2076 | #define PXP2_REG_PGL_PRETEND_FUNC_F7 0x120690 | ||
2064 | /* [R 1] this bit indicates that a read request was blocked because of | 2077 | /* [R 1] this bit indicates that a read request was blocked because of |
2065 | bus_master_en was deasserted */ | 2078 | bus_master_en was deasserted */ |
2066 | #define PXP2_REG_PGL_READ_BLOCKED 0x120568 | 2079 | #define PXP2_REG_PGL_READ_BLOCKED 0x120568 |