iwm: Add a few _prph functions needed for 9000-series chips.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
markj 2019-11-07 23:34:28 +00:00
parent 103eb8faa2
commit 12b86893ab
2 changed files with 25 additions and 0 deletions

View File

@ -185,6 +185,27 @@ iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val)
IWM_WRITE(sc, IWM_HBUS_TARG_PRPH_WDAT, val);
}
void
iwm_write_prph64(struct iwm_softc *sc, uint64_t addr, uint64_t val)
{
iwm_write_prph(sc, (uint32_t)addr, val & 0xffffffff);
iwm_write_prph(sc, (uint32_t)addr + 4, val >> 32);
}
int
iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits, uint32_t mask,
int timeout)
{
do {
if ((iwm_read_prph(sc, addr) & mask) == (bits & mask))
return (0);
DELAY(10);
timeout -= 10;
} while (timeout > 0);
return (ETIMEDOUT);
}
#ifdef IWM_DEBUG
/* iwlwifi: pcie/trans.c */
int

View File

@ -106,6 +106,10 @@
extern uint32_t iwm_read_prph(struct iwm_softc *sc, uint32_t addr);
extern void iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val);
extern void iwm_write_prph64(struct iwm_softc *sc, uint64_t addr,
uint64_t val);
extern int iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits,
uint32_t mask, int timeout);
extern int iwm_read_mem(struct iwm_softc *sc, uint32_t addr, void *buf, int dwords);
extern int iwm_write_mem(struct iwm_softc *sc, uint32_t addr, const void *buf,
int dwords);