Indicate hostready signal to inform the firmware that the rings have been
authorpatrick <patrick@openbsd.org>
Fri, 26 Feb 2021 00:14:28 +0000 (00:14 +0000)
committerpatrick <patrick@openbsd.org>
Fri, 26 Feb 2021 00:14:28 +0000 (00:14 +0000)
initialized.

sys/dev/pci/if_bwfm_pci.c
sys/dev/pci/if_bwfm_pci.h

index fb6014a..a05ffa9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_bwfm_pci.c,v 1.45 2021/02/26 00:07:41 patrick Exp $        */
+/*     $OpenBSD: if_bwfm_pci.c,v 1.46 2021/02/26 00:14:28 patrick Exp $        */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
  * Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
@@ -200,6 +200,7 @@ int          bwfm_pci_detach(struct device *, int);
 int             bwfm_pci_intr(void *);
 void            bwfm_pci_intr_enable(struct bwfm_pci_softc *);
 void            bwfm_pci_intr_disable(struct bwfm_pci_softc *);
+void            bwfm_pci_hostready(struct bwfm_pci_softc *);
 int             bwfm_pci_load_microcode(struct bwfm_pci_softc *, const u_char *,
                    size_t, const u_char *, size_t);
 void            bwfm_pci_select_core(struct bwfm_pci_softc *, int );
@@ -643,6 +644,7 @@ bwfm_pci_preinit(struct bwfm_softc *bwfm)
 
        bwfm_pci_select_core(sc, BWFM_AGENT_CORE_PCIE2);
        bwfm_pci_intr_enable(sc);
+       bwfm_pci_hostready(sc);
 
        /* Maps RX mbufs to a packet id and back. */
        sc->sc_rx_pkts.npkt = BWFM_NUM_RX_PKTIDS;
@@ -1066,7 +1068,7 @@ bwfm_pci_ring_bell(struct bwfm_pci_softc *sc,
     struct bwfm_pci_msgring *ring)
 {
        bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
-           BWFM_PCI_PCIE2REG_H2D_MAILBOX, 1);
+           BWFM_PCI_PCIE2REG_H2D_MAILBOX_0, 1);
 }
 
 void
@@ -1932,6 +1934,16 @@ bwfm_pci_intr_disable(struct bwfm_pci_softc *sc)
            BWFM_PCI_PCIE2REG_MAILBOXMASK, 0);
 }
 
+void
+bwfm_pci_hostready(struct bwfm_pci_softc *sc)
+{
+       if ((sc->sc_shared_flags & BWFM_SHARED_INFO_HOSTRDY_DB1) == 0)
+               return;
+
+       bus_space_write_4(sc->sc_reg_iot, sc->sc_reg_ioh,
+           BWFM_PCI_PCIE2REG_H2D_MAILBOX_1, 1);
+}
+
 /* Msgbuf protocol implementation */
 int
 bwfm_pci_msgbuf_query_dcmd(struct bwfm_softc *bwfm, int ifidx,
index 081a955..92cf426 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_bwfm_pci.h,v 1.3 2021/02/25 23:26:05 patrick Exp $ */
+/*     $OpenBSD: if_bwfm_pci.h,v 1.4 2021/02/26 00:14:28 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
  * Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
@@ -48,7 +48,8 @@
 
 #define BWFM_PCI_PCIE2REG_CONFIGADDR           0x120
 #define BWFM_PCI_PCIE2REG_CONFIGDATA           0x124
-#define BWFM_PCI_PCIE2REG_H2D_MAILBOX          0x140
+#define BWFM_PCI_PCIE2REG_H2D_MAILBOX_0                0x140
+#define BWFM_PCI_PCIE2REG_H2D_MAILBOX_1                0x144
 
 #define BWFM_PCI_CFGREG_STATUS_CMD             0x004
 #define BWFM_PCI_CFGREG_PM_CSR                 0x04C
@@ -73,6 +74,7 @@
 #define  BWFM_SHARED_INFO_VERSION_MASK                 0x00FF
 #define  BWFM_SHARED_INFO_DMA_INDEX                    0x10000
 #define  BWFM_SHARED_INFO_DMA_2B_IDX                   0x100000
+#define  BWFM_SHARED_INFO_HOSTRDY_DB1                  0x10000000
 #define BWFM_SHARED_CONSOLE_ADDR               0x14
 #define BWFM_SHARED_MAX_RXBUFPOST              0x22
 #define  BWFM_SHARED_MAX_RXBUFPOST_DEFAULT             255