static __constructor void ar5212_ctor(void) { register_regs(ar5212regs, N(ar5212regs), MAC5212, PHYANY); register_keycache(128, MAC5212, PHYANY); register_range(0x9800, 0x987c, DUMP_BASEBAND, MAC5212, PHYANY); register_range(0x9900, 0x995c, DUMP_BASEBAND, MAC5212, PHYANY); register_range(0x9c00, 0x9c1c, DUMP_BASEBAND, MAC5212, PHYANY); register_range(0xa180, 0xa238, DUMP_BASEBAND, MAC5212, PHYANY); register_range(0xa258, 0xa26c, DUMP_BASEBAND, SREV(7,8), SREV(15,15), PHYANY); }
static void ath_hal_dumpkeycache(FILE *fd, int nkeys) { static const char *keytypenames[] = { "WEP-40", /* AR_KEYTABLE_TYPE_40 */ "WEP-104", /* AR_KEYTABLE_TYPE_104 */ "#2", "WEP-128", /* AR_KEYTABLE_TYPE_128 */ "TKIP", /* AR_KEYTABLE_TYPE_TKIP */ "AES-OCB", /* AR_KEYTABLE_TYPE_AES */ "AES-CCM", /* AR_KEYTABLE_TYPE_CCM */ "CLR", /* AR_KEYTABLE_TYPE_CLR */ }; int micEnabled = SREV(state.revs.ah_macVersion, state.revs.ah_macRev) < SREV(4,8) ? 0 : OS_REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_CRPT_MIC_ENABLE; u_int8_t mac[IEEE80211_ADDR_LEN]; u_int8_t ismic[128/NBBY]; int entry; int first = 1; memset(ismic, 0, sizeof(ismic)); for (entry = 0; entry < nkeys; entry++) { u_int32_t macLo, macHi, type; u_int32_t key0, key1, key2, key3, key4; macHi = OS_REG_READ(ah, AR_KEYTABLE_MAC1(entry)); if ((macHi & AR_KEYTABLE_VALID) == 0 && isclr(ismic, entry)) continue; macLo = OS_REG_READ(ah, AR_KEYTABLE_MAC0(entry)); macHi <<= 1; if (macLo & (1<<31)) macHi |= 1; macLo <<= 1; mac[4] = macHi & 0xff; mac[5] = macHi >> 8; mac[0] = macLo & 0xff; mac[1] = macLo >> 8; mac[2] = macLo >> 16; mac[3] = macLo >> 24; type = OS_REG_READ(ah, AR_KEYTABLE_TYPE(entry)); if ((type & 7) == AR_KEYTABLE_TYPE_TKIP && micEnabled) setbit(ismic, entry+64); key0 = OS_REG_READ(ah, AR_KEYTABLE_KEY0(entry)); key1 = OS_REG_READ(ah, AR_KEYTABLE_KEY1(entry)); key2 = OS_REG_READ(ah, AR_KEYTABLE_KEY2(entry)); key3 = OS_REG_READ(ah, AR_KEYTABLE_KEY3(entry)); key4 = OS_REG_READ(ah, AR_KEYTABLE_KEY4(entry)); if (first) { fprintf(fd, "\n"); first = 0; } fprintf(fd, "KEY[%03u] MAC %s %-7s %02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x\n" , entry , ether_sprintf(mac) , isset(ismic, entry) ? "MIC" : keytypenames[type & 7] , (key0 >> 0) & 0xff , (key0 >> 8) & 0xff , (key0 >> 16) & 0xff , (key0 >> 24) & 0xff , (key1 >> 0) & 0xff , (key1 >> 8) & 0xff , (key2 >> 0) & 0xff , (key2 >> 8) & 0xff , (key2 >> 16) & 0xff , (key2 >> 24) & 0xff , (key3 >> 0) & 0xff , (key3 >> 8) & 0xff , (key4 >> 0) & 0xff , (key4 >> 8) & 0xff , (key4 >> 16) & 0xff , (key4 >> 24) & 0xff ); } }
DEFVOID(AR_D_TXBLK_DATA, "D_DATA"), #endif DEFVOID(AR_D_TXBLK_CLR, "D_CLR"), DEFVOID(AR_D_TXBLK_SET, "D_SET"), DEFBASIC(AR_RC, "RC"), DEFBASICfmt(AR_SCR, "SCR", "\20\22SLDTP\23SLDWP\24SLEPOL\25MIBIE"), DEFBASIC(AR_INTPEND, "INTPEND"), DEFBASIC(AR_SFR, "SFR"), DEFBASIC(AR_PCICFG, "PCICFG"), DEFBASIC(AR_GPIOCR, "GPIOCR"), DEFBASIC(AR_GPIODO, "GPIODO"), DEFBASIC(AR_GPIODI, "GPIODI"), DEFBASIC(AR_SREV, "SREV"), DEFBASICx(AR_PCIE_PMC, "PCIEPMC", SREV(4,8), SREV(13,7)), DEFBASICx(AR_PCIE_SERDES, "SERDES", SREV(4,8), SREV(13,7)), DEFBASICx(AR_PCIE_SERDES2, "SERDES2", SREV(4,8), SREV(13,7)), DEFVOID(AR_EEPROM_ADDR, "EEADDR"), DEFVOID(AR_EEPROM_DATA, "EEDATA"), DEFVOID(AR_EEPROM_CMD, "EECMD"), DEFVOID(AR_EEPROM_STS, "EESTS"), DEFVOID(AR_EEPROM_CFG, "EECFG"), DEFBASIC(AR_STA_ID0, "STA_ID0"), DEFBASICfmt(AR_STA_ID1, "STA_ID1", "\20\21STA_AP\22ADHOC\23PWR_SAV\24KSRCHDIS\25PCF\26USE_DEFANT" "\27UPD_DEFANT\30RTS_USE_DEF\31ACKCTS_6MB\32BASE_RATE11B\33USE_DA_SG" "\34CRPT_MIC_ENABLE\35KSRCH_MODE\36PRE_SEQNUM\37CBCIV_ENDIAN" "\40MCAST_KSRCH"), DEFBASIC(AR_BSS_ID0, "BSS_ID0"), DEFBASIC(AR_BSS_ID1, "BSS_ID1"),