diff --git a/sys/dev/ntb/ntb_hw/ntb_hw.c b/sys/dev/ntb/ntb_hw/ntb_hw.c index b45e8258f3c0..7395fe0daf79 100644 --- a/sys/dev/ntb/ntb_hw/ntb_hw.c +++ b/sys/dev/ntb/ntb_hw/ntb_hw.c @@ -1050,12 +1050,18 @@ ntb_handle_link_event(struct ntb_softc *ntb, int link_state) static void ntb_hw_link_up(struct ntb_softc *ntb) { + uint32_t cntl; - if (ntb->conn_type == NTB_CONN_TRANSPARENT) + if (ntb->conn_type == NTB_CONN_TRANSPARENT) { ntb_handle_link_event(ntb, NTB_LINK_UP); - else - ntb_reg_write(4, ntb->reg_ofs.lnk_cntl, - NTB_CNTL_BAR23_SNOOP | NTB_CNTL_BAR45_SNOOP); + return; + } + + cntl = ntb_reg_read(4, ntb->reg_ofs.lnk_cntl); + cntl &= ~(NTB_CNTL_LINK_DISABLE | NTB_CNTL_CFG_LOCK); + cntl |= NTB_CNTL_P2S_BAR23_SNOOP | NTB_CNTL_S2P_BAR23_SNOOP; + cntl |= NTB_CNTL_P2S_BAR45_SNOOP | NTB_CNTL_S2P_BAR45_SNOOP; + ntb_reg_write(4, ntb->reg_ofs.lnk_cntl, cntl); } static void @@ -1069,8 +1075,9 @@ ntb_hw_link_down(struct ntb_softc *ntb) } cntl = ntb_reg_read(4, ntb->reg_ofs.lnk_cntl); - cntl &= ~(NTB_CNTL_BAR23_SNOOP | NTB_CNTL_BAR45_SNOOP); - cntl |= NTB_CNTL_LINK_DISABLE; + cntl &= ~(NTB_CNTL_P2S_BAR23_SNOOP | NTB_CNTL_S2P_BAR23_SNOOP); + cntl &= ~(NTB_CNTL_P2S_BAR45_SNOOP | NTB_CNTL_S2P_BAR45_SNOOP); + cntl |= NTB_CNTL_LINK_DISABLE | NTB_CNTL_CFG_LOCK; ntb_reg_write(4, ntb->reg_ofs.lnk_cntl, cntl); } diff --git a/sys/dev/ntb/ntb_hw/ntb_regs.h b/sys/dev/ntb/ntb_hw/ntb_regs.h index d97d504b7db7..ad6a2a671126 100644 --- a/sys/dev/ntb/ntb_hw/ntb_regs.h +++ b/sys/dev/ntb/ntb_hw/ntb_regs.h @@ -116,11 +116,13 @@ #define SOC_LTSSMSTATEJMP_FORCEDETECT (1 << 2) #define SOC_IBIST_ERR_OFLOW 0x7fff7fff -#define NTB_CNTL_CFG_LOCK (1 << 0) -#define NTB_CNTL_LINK_DISABLE (1 << 1) -#define NTB_CNTL_BAR23_SNOOP (1 << 2) -#define NTB_CNTL_BAR45_SNOOP (1 << 6) -#define SOC_CNTL_LINK_DOWN (1 << 16) +#define NTB_CNTL_CFG_LOCK (1 << 0) +#define NTB_CNTL_LINK_DISABLE (1 << 1) +#define NTB_CNTL_S2P_BAR23_SNOOP (1 << 2) +#define NTB_CNTL_P2S_BAR23_SNOOP (1 << 4) +#define NTB_CNTL_S2P_BAR45_SNOOP (1 << 6) +#define NTB_CNTL_P2S_BAR45_SNOOP (1 << 8) +#define SOC_CNTL_LINK_DOWN (1 << 16) #define XEON_PBAR23SZ_OFFSET 0x00d0 #define XEON_PBAR45SZ_OFFSET 0x00d1