• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asus-wl-520gu-7.0.1.45/src/shared/

Lines Matching refs:osh

57 static int initvars_srom_sb(sb_t *sbh, osl_t *osh, void *curmap, char **vars, uint *count);
60 static int initvars_cis_pcmcia(sb_t *sbh, osl_t *osh, char **vars, uint *count);
64 static int sprom_cmd_pcmcia(osl_t *osh, uint8 cmd);
65 static int sprom_read_pcmcia(osl_t *osh, uint16 addr, uint16 *data);
66 static int sprom_write_pcmcia(osl_t *osh, uint16 addr, uint16 data);
67 static int sprom_read_pci(osl_t *osh, uint16 *sprom, uint wordoff, uint16 *buf, uint nwords,
70 static int initvars_table(osl_t *osh, char *start, char *end, char **vars, uint *count);
71 static int initvars_flash(sb_t *sbh, osl_t *osh, char **vp, uint len);
74 static int get_sb_pcmcia_srom(sb_t *sbh, osl_t *osh, uint8 *pcmregs,
76 static int set_sb_pcmcia_srom(sb_t *sbh, osl_t *osh, uint8 *pcmregs,
78 static uint srom_size(sb_t *sbh, osl_t *osh);
128 BCMINITFN(srom_var_init)(sb_t *sbh, uint bustype, void *curmap, osl_t *osh,
141 return initvars_srom_sb(sbh, osh, curmap, vars, count);
148 return initvars_cis_pcmcia(sbh, osh, vars, count);
159 srom_read(sb_t *sbh, uint bustype, void *curmap, osl_t *osh,
178 if (sprom_read_pci(osh, srom, off, buf, nw, FALSE))
182 if (sprom_read_pcmcia(osh, (uint16)(off + i), (uint16 *)(buf + i)))
200 rc = get_sb_pcmcia_srom(sbh, osh, regs, byteoff, buf, nbytes);
220 srom_write(sb_t *sbh, uint bustype, void *curmap, osl_t *osh,
261 if (srom_read(sbh, bustype, curmap, osh, 0, crc_range, image))
266 if (srom_read(sbh, bustype, curmap, osh, 0, crc_range, image))
284 val32 = OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32));
286 OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32);
290 W_REG(osh, &srom[i], image[i]);
294 OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32 &
298 if (sprom_cmd_pcmcia(osh, SROM_WEN))
303 sprom_write_pcmcia(osh, (uint16)(i), image[i]);
307 if (sprom_cmd_pcmcia(osh, SROM_WDS))
324 rc = set_sb_pcmcia_srom(sbh, osh, regs, byteoff, buf, nbytes);
343 #define SB_PCMCIA_READ(osh, regs, fcr) \
344 R_REG(osh, (volatile uint8 *)(regs) + 0x600 + (fcr) - 0x700 / 2)
345 #define SB_PCMCIA_WRITE(osh, regs, fcr, v) \
346 W_REG(osh, (volatile uint8 *)(regs) + 0x600 + (fcr) - 0x700 / 2, v)
350 srom_cmd_sb_pcmcia(osl_t *osh, uint8 *pcmregs, uint8 cmd)
356 SB_PCMCIA_WRITE(osh, pcmregs, SROM_CS, cmd);
360 status = SB_PCMCIA_READ(osh, pcmregs, SROM_CS);
372 srom_read_sb_pcmcia(osl_t *osh, uint8 *pcmregs, uint16 addr, uint16 *data)
380 SB_PCMCIA_WRITE(osh, pcmregs, SROM_ADDRH, addr_h);
381 SB_PCMCIA_WRITE(osh, pcmregs, SROM_ADDRL, addr_l);
384 if (srom_cmd_sb_pcmcia(osh, pcmregs, SROM_READ))
388 data_h = SB_PCMCIA_READ(osh, pcmregs, SROM_DATAH);
389 data_l = SB_PCMCIA_READ(osh, pcmregs, SROM_DATAL);
397 srom_write_sb_pcmcia(osl_t *osh, uint8 *pcmregs, uint16 addr, uint16 data)
406 SB_PCMCIA_WRITE(osh, pcmregs, SROM_ADDRH, addr_h);
407 SB_PCMCIA_WRITE(osh, pcmregs, SROM_ADDRL, addr_l);
413 SB_PCMCIA_WRITE(osh, pcmregs, SROM_DATAH, data_h);
414 SB_PCMCIA_WRITE(osh, pcmregs, SROM_DATAL, data_l);
417 rc = srom_cmd_sb_pcmcia(osh, pcmregs, SROM_WRITE);
427 get_sb_pcmcia_srom(sb_t *sbh, osl_t *osh, uint8 *pcmregs,
437 if ((nw = srom_size(sbh, osh)) == 0) {
451 if (srom_read_sb_pcmcia(osh, pcmregs, (uint16)woff, &srom[i])) {
467 set_sb_pcmcia_srom(sb_t *sbh, osl_t *osh, uint8 *pcmregs,
479 if ((nw = srom_size(sbh, osh)) == 0) {
491 if (srom_cmd_sb_pcmcia(osh, pcmregs, SROM_WEN)) {
500 if (srom_write_sb_pcmcia(osh, pcmregs, (uint16)woff, srom[i])) {
510 if (srom_read_sb_pcmcia(osh, pcmregs, (uint16)woff, &word)) {
519 if (srom_write_sb_pcmcia(osh, pcmregs, (uint16)(woff - 1), word)) {
526 if (srom_cmd_sb_pcmcia(osh, pcmregs, SROM_WDS)) {
538 srom_parsecis(osl_t *osh, uint8 *pcis[], uint ciscnt, char **vars, uint *count)
555 base = MALLOC(osh, MAXSZ_NVRAM_VARS);
893 new_buf = (char*)MALLOC(osh, varsize);
897 MFREE(osh, base, MAXSZ_NVRAM_VARS);
911 sprom_cmd_pcmcia(osl_t *osh, uint8 cmd)
917 OSL_PCMCIA_WRITE_ATTR(osh, SROM_CS, &cmd, 1);
921 OSL_PCMCIA_READ_ATTR(osh, SROM_CS, &status, 1);
931 sprom_read_pcmcia(osl_t *osh, uint16 addr, uint16 *data)
939 OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
940 OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
943 if (sprom_cmd_pcmcia(osh, SROM_READ))
948 OSL_PCMCIA_READ_ATTR(osh, SROM_DATAH, &data_h, 1);
949 OSL_PCMCIA_READ_ATTR(osh, SROM_DATAL, &data_l, 1);
957 sprom_write_pcmcia(osl_t *osh, uint16 addr, uint16 data)
967 OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
968 OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
971 OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAH, &data_h, 1);
972 OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAL, &data_l, 1);
975 return sprom_cmd_pcmcia(osh, SROM_WRITE);
983 sprom_read_pci(osl_t *osh, uint16 *sprom, uint wordoff, uint16 *buf, uint nwords, bool check_crc)
991 buf[i] = R_REG(osh, &sprom[wordoff + i]);
993 buf[i] = R_REG(osh, &sprom[wordoff + i]);
1022 BCMINITFN(initvars_table)(osl_t *osh, char *start, char *end, char **vars, uint *count)
1028 char *vp = MALLOC(osh, c);
1050 initvars_flash(sb_t *sbh, osl_t *osh, char **base, uint len)
1060 if (!(flash = MALLOC(osh, NVRAM_SPACE)))
1098 exit: MFREE(osh, flash, NVRAM_SPACE);
1110 osl_t *osh = sb_osh(sbh);
1117 base = vp = MALLOC(osh, MAXSZ_NVRAM_VARS);
1122 if ((err = initvars_flash(sbh, osh, &vp, MAXSZ_NVRAM_VARS)) == 0)
1123 err = initvars_table(osh, base, vp, vars, count);
1125 MFREE(osh, base, MAXSZ_NVRAM_VARS);
1657 osl_t *osh = sb_osh(sbh);
1668 srom = MALLOC(osh, SROM_MAX);
1673 err = sprom_read_pci(osh, (void *)((int8 *)curmap + PCI_BAR0_SPROM_OFFSET), 0, srom,
1679 err = sprom_read_pci(osh, (void *)((int8 *)curmap + PCI_BAR0_SPROM_OFFSET), 0,
1696 val = OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32));
1738 base = vp = MALLOC(osh, MAXSZ_NVRAM_VARS);
1747 if ((err = initvars_flash(sbh, osh, &vp, MAXSZ_NVRAM_VARS)))
1765 err = initvars_table(osh, base, vp, vars, count);
1773 MFREE(osh, base, MAXSZ_NVRAM_VARS);
1775 MFREE(osh, srom, SROM_MAX);
1784 initvars_cis_pcmcia(sb_t *sbh, osl_t *osh, char **vars, uint *count)
1792 if ((cis = MALLOC(osh, data_sz)) == NULL)
1796 if (srom_read(sbh, PCMCIA_BUS, (void *)NULL, osh, 0, data_sz, (uint16 *)cis)) {
1797 MFREE(osh, cis, data_sz);
1803 OSL_PCMCIA_READ_ATTR(osh, 0, cis, data_sz);
1805 rc = srom_parsecis(osh, &cis, 1, vars, count);
1807 MFREE(osh, cis, data_sz);
1814 BCMINITFN(initvars_srom_sb)(sb_t *sbh, osl_t *osh, void *curmap, char **vars, uint *varsz)
1831 if ((sz = srom_size(sbh, osh)) != 0) {
1848 (sz = srom_size(sbh, osh)) != 0) {
1863 if ((srom = (uint16 *)MALLOC(osh, sz)) == NULL)
1873 rc = srom_read(sbh, SB_BUS, curmap, osh, 0, sz, srom);
1907 rc = srom_parsecis(osh, cis, ciss, vars, varsz);
1911 MFREE(osh, srom, sz);
1934 srom_size(sb_t *sbh, osl_t *osh)
1954 if (!(R_REG(osh, &pcmregs->corestatus) & CS_PCMCIAMODE))
1957 switch (SB_PCMCIA_READ(osh, pcmregs, SROM_INFO) & SRI_SZ_MASK) {