From owner-svn-src-all@FreeBSD.ORG Tue Mar 9 19:58:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB91A1065673; Tue, 9 Mar 2010 19:58:00 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98E6B8FC18; Tue, 9 Mar 2010 19:58:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o29Jw0bl014466; Tue, 9 Mar 2010 19:58:00 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o29Jw0ag014463; Tue, 9 Mar 2010 19:58:00 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201003091958.o29Jw0ag014463@svn.freebsd.org> From: Weongyo Jeong Date: Tue, 9 Mar 2010 19:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204922 - in head/sys/dev: bwn siba X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2010 19:58:00 -0000 Author: weongyo Date: Tue Mar 9 19:58:00 2010 New Revision: 204922 URL: http://svn.freebsd.org/changeset/base/204922 Log: o uses bus accessor macros to read values from ivar so no more values are referenced directly from ivar pointer. It's to do like what other buses do. [1] o changes exported prototypes. It doesn't use struct siba_* structures anymore that instead of it it uses only device_t. o removes duplicate code and debug messages. o style(9) Pointed out by: imp [1] Modified: head/sys/dev/bwn/if_bwn.c head/sys/dev/bwn/if_bwnvar.h head/sys/dev/siba/siba_bwn.c head/sys/dev/siba/siba_core.c head/sys/dev/siba/sibavar.h Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Tue Mar 9 19:57:44 2010 (r204921) +++ head/sys/dev/bwn/if_bwn.c Tue Mar 9 19:58:00 2010 (r204922) @@ -134,7 +134,7 @@ SYSCTL_INT(_hw_bwn, OID_AUTO, wme, CTLFL static int bwn_attach_pre(struct bwn_softc *); static int bwn_attach_post(struct bwn_softc *); -static void bwn_sprom_bugfixes(struct siba_softc *); +static void bwn_sprom_bugfixes(device_t); static void bwn_init(void *); static int bwn_init_locked(struct bwn_softc *); static int bwn_ioctl(struct ifnet *, u_long, caddr_t); @@ -205,7 +205,6 @@ static void bwn_stop_locked(struct bwn_s static int bwn_core_init(struct bwn_mac *); static void bwn_core_start(struct bwn_mac *); static void bwn_core_exit(struct bwn_mac *); -static void bwn_fix_imcfglobug(struct bwn_mac *); static void bwn_bt_disable(struct bwn_mac *); static int bwn_chip_init(struct bwn_mac *); static uint64_t bwn_hf_read(struct bwn_mac *); @@ -225,7 +224,6 @@ static int bwn_fw_loadinitvals(struct bw static int bwn_phy_init(struct bwn_mac *); static void bwn_set_txantenna(struct bwn_mac *, int); static void bwn_set_opmode(struct bwn_mac *); -static void bwn_gpio_cleanup(struct bwn_mac *); static void bwn_rate_write(struct bwn_mac *, uint16_t, int); static uint8_t bwn_plcp_getcck(const uint8_t); static uint8_t bwn_plcp_getofdm(const uint8_t); @@ -910,13 +908,12 @@ static const struct siba_devid bwn_devs[ static int bwn_probe(device_t dev) { - struct siba_dev_softc *sd = device_get_ivars(dev); int i; for (i = 0; i < sizeof(bwn_devs) / sizeof(bwn_devs[0]); i++) { - if (sd->sd_id.sd_vendor == bwn_devs[i].sd_vendor && - sd->sd_id.sd_device == bwn_devs[i].sd_device && - sd->sd_id.sd_rev == bwn_devs[i].sd_rev) + if (siba_get_vendor(dev) == bwn_devs[i].sd_vendor && + siba_get_device(dev) == bwn_devs[i].sd_device && + siba_get_revid(dev) == bwn_devs[i].sd_rev) return (BUS_PROBE_DEFAULT); } @@ -928,12 +925,9 @@ bwn_attach(device_t dev) { struct bwn_mac *mac; struct bwn_softc *sc = device_get_softc(dev); - struct siba_dev_softc *sd = device_get_ivars(dev); - struct siba_softc *siba = sd->sd_bus; int error, i, msic, reg; sc->sc_dev = dev; - sc->sc_sd = sd; #ifdef BWN_DEBUG sc->sc_debug = bwn_debug; #endif @@ -942,14 +936,14 @@ bwn_attach(device_t dev) error = bwn_attach_pre(sc); if (error != 0) return (error); - bwn_sprom_bugfixes(sd->sd_bus); + bwn_sprom_bugfixes(dev); sc->sc_flags |= BWN_FLAG_ATTACHED; } if (!TAILQ_EMPTY(&sc->sc_maclist)) { - if (siba->siba_pci_did != 0x4313 && - siba->siba_pci_did != 0x431a && - siba->siba_pci_did != 0x4321) { + if (siba_get_pci_device(dev) != 0x4313 && + siba_get_pci_device(dev) != 0x431a && + siba_get_pci_device(dev) != 0x4321) { device_printf(sc->sc_dev, "skip 802.11 cores\n"); return (ENODEV); @@ -961,7 +955,6 @@ bwn_attach(device_t dev) if (mac == NULL) return (ENOMEM); mac->mac_sc = sc; - mac->mac_sd = sd; mac->mac_status = BWN_MAC_STATUS_UNINIT; if (bwn_bfp != 0) mac->mac_flags |= BWN_MAC_FLAG_BADFRAME_PREEMP; @@ -977,7 +970,7 @@ bwn_attach(device_t dev) device_printf(sc->sc_dev, "WLAN (chipid %#x rev %u) " "PHY (analog %d type %d rev %d) RADIO (manuf %#x ver %#x rev %d)\n", - sd->sd_bus->siba_chipid, sd->sd_id.sd_rev, + siba_get_chipid(sc->sc_dev), siba_get_revid(sc->sc_dev), mac->mac_phy.analog, mac->mac_phy.type, mac->mac_phy.rev, mac->mac_phy.rf_manuf, mac->mac_phy.rf_ver, mac->mac_phy.rf_rev); @@ -1065,8 +1058,6 @@ bwn_attach_post(struct bwn_softc *sc) { struct ieee80211com *ic; struct ifnet *ifp = sc->sc_ifp; - struct siba_dev_softc *sd = sc->sc_sd; - struct siba_sprom *sprom = &sd->sd_bus->siba_sprom; ic = ifp->if_l2com; ic->ic_ifp = ifp; @@ -1087,8 +1078,9 @@ bwn_attach_post(struct bwn_softc *sc) /* call MI attach routine. */ ieee80211_ifattach(ic, - bwn_is_valid_ether_addr(sprom->mac_80211a) ? sprom->mac_80211a : - sprom->mac_80211bg); + bwn_is_valid_ether_addr(siba_sprom_get_mac_80211a(sc->sc_dev)) ? + siba_sprom_get_mac_80211a(sc->sc_dev) : + siba_sprom_get_mac_80211bg(sc->sc_dev)); ic->ic_headroom = sizeof(struct bwn_txhdr); @@ -1219,21 +1211,24 @@ fail: BWN_LOCK_DESTROY(sc); } static void -bwn_sprom_bugfixes(struct siba_softc *siba) +bwn_sprom_bugfixes(device_t dev) { #define BWN_ISDEV(_vendor, _device, _subvendor, _subdevice) \ - ((siba->siba_pci_vid == PCI_VENDOR_##_vendor) && \ - (siba->siba_pci_did == _device) && \ - (siba->siba_pci_subvid == PCI_VENDOR_##_subvendor) && \ - (siba->siba_pci_subdid == _subdevice)) - - if (siba->siba_board_vendor == PCI_VENDOR_APPLE && - siba->siba_board_type == 0x4e && siba->siba_board_rev > 0x40) - siba->siba_sprom.bf_lo |= BWN_BFL_PACTRL; - if (siba->siba_board_vendor == SIBA_BOARDVENDOR_DELL && - siba->siba_chipid == 0x4301 && siba->siba_board_rev == 0x74) - siba->siba_sprom.bf_lo |= BWN_BFL_BTCOEXIST; - if (siba->siba_type == SIBA_TYPE_PCI) { + ((siba_get_pci_vendor(dev) == PCI_VENDOR_##_vendor) && \ + (siba_get_pci_device(dev) == _device) && \ + (siba_get_pci_subvendor(dev) == PCI_VENDOR_##_subvendor) && \ + (siba_get_pci_subdevice(dev) == _subdevice)) + + if (siba_get_pci_subvendor(dev) == PCI_VENDOR_APPLE && + siba_get_pci_subdevice(dev) == 0x4e && + siba_get_pci_revid(dev) > 0x40) + siba_sprom_set_bf_lo(dev, + siba_sprom_get_bf_lo(dev) | BWN_BFL_PACTRL); + if (siba_get_pci_subvendor(dev) == SIBA_BOARDVENDOR_DELL && + siba_get_chipid(dev) == 0x4301 && siba_get_pci_revid(dev) == 0x74) + siba_sprom_set_bf_lo(dev, + siba_sprom_get_bf_lo(dev) | BWN_BFL_BTCOEXIST); + if (siba_get_type(dev) == SIBA_TYPE_PCI) { if (BWN_ISDEV(BROADCOM, 0x4318, ASUSTEK, 0x100f) || BWN_ISDEV(BROADCOM, 0x4320, DELL, 0x0003) || BWN_ISDEV(BROADCOM, 0x4320, HP, 0x12f8) || @@ -1241,7 +1236,8 @@ bwn_sprom_bugfixes(struct siba_softc *si BWN_ISDEV(BROADCOM, 0x4320, LINKSYS, 0x0014) || BWN_ISDEV(BROADCOM, 0x4320, LINKSYS, 0x0015) || BWN_ISDEV(BROADCOM, 0x4320, MOTOROLA, 0x7010)) - siba->siba_sprom.bf_lo &= ~BWN_BFL_BTCOEXIST; + siba_sprom_set_bf_lo(dev, + siba_sprom_get_bf_lo(dev) & ~BWN_BFL_BTCOEXIST); } #undef BWN_ISDEV } @@ -1434,7 +1430,7 @@ bwn_pio_tx_start(struct bwn_mac *mac, st tq->tq_used += roundup(m->m_pkthdr.len + BWN_HDRSIZE(mac), 4); tq->tq_free--; - if (mac->mac_sd->sd_id.sd_rev >= 8) { + if (siba_get_revid(sc->sc_dev) >= 8) { /* * XXX please removes m_defrag(9) */ @@ -1606,17 +1602,15 @@ static int bwn_attach_core(struct bwn_mac *mac) { struct bwn_softc *sc = mac->mac_sc; - struct siba_dev_softc *sd = mac->mac_sd; - struct siba_softc *siba = sd->sd_bus; int error, have_bg = 0, have_a = 0; uint32_t high; - KASSERT(sd->sd_id.sd_rev >= 5, - ("unsupported revision %d", sd->sd_id.sd_rev)); + KASSERT(siba_get_revid(sc->sc_dev) >= 5, + ("unsupported revision %d", siba_get_revid(sc->sc_dev))); - siba_powerup(siba, 0); + siba_powerup(sc->sc_dev, 0); - high = siba_read_4(sd, SIBA_TGSHIGH); + high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH); bwn_reset_core(mac, (high & BWN_TGSHIGH_HAVE_2GHZ) ? BWN_TGSLOW_SUPPORT_G : 0); error = bwn_phy_getinfo(mac, high); @@ -1625,8 +1619,9 @@ bwn_attach_core(struct bwn_mac *mac) have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0; have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0; - if (siba->siba_pci_did != 0x4312 && siba->siba_pci_did != 0x4319 && - siba->siba_pci_did != 0x4324) { + if (siba_get_pci_device(sc->sc_dev) != 0x4312 && + siba_get_pci_device(sc->sc_dev) != 0x4319 && + siba_get_pci_device(sc->sc_dev) != 0x4324) { have_a = have_bg = 0; if (mac->mac_phy.type == BWN_PHYTYPE_A) have_a = 1; @@ -1719,30 +1714,30 @@ bwn_attach_core(struct bwn_mac *mac) mac->mac_phy.switch_analog(mac, 0); - siba_dev_down(sd, 0); + siba_dev_down(sc->sc_dev, 0); fail: - siba_powerdown(siba); + siba_powerdown(sc->sc_dev); return (error); } static void bwn_reset_core(struct bwn_mac *mac, uint32_t flags) { - struct siba_dev_softc *sd = mac->mac_sd; + struct bwn_softc *sc = mac->mac_sc; uint32_t low, ctl; flags |= (BWN_TGSLOW_PHYCLOCK_ENABLE | BWN_TGSLOW_PHYRESET); - siba_dev_up(sd, flags); + siba_dev_up(sc->sc_dev, flags); DELAY(2000); - low = (siba_read_4(sd, SIBA_TGSLOW) | SIBA_TGSLOW_FGC) & + low = (siba_read_4(sc->sc_dev, SIBA_TGSLOW) | SIBA_TGSLOW_FGC) & ~BWN_TGSLOW_PHYRESET; - siba_write_4(sd, SIBA_TGSLOW, low); - siba_read_4(sd, SIBA_TGSLOW); + siba_write_4(sc->sc_dev, SIBA_TGSLOW, low); + siba_read_4(sc->sc_dev, SIBA_TGSLOW); DELAY(1000); - siba_write_4(sd, SIBA_TGSLOW, low & ~SIBA_TGSLOW_FGC); - siba_read_4(sd, SIBA_TGSLOW); + siba_write_4(sc->sc_dev, SIBA_TGSLOW, low & ~SIBA_TGSLOW_FGC); + siba_read_4(sc->sc_dev, SIBA_TGSLOW); DELAY(1000); if (mac->mac_phy.switch_analog != NULL) @@ -1759,8 +1754,6 @@ bwn_phy_getinfo(struct bwn_mac *mac, int { struct bwn_phy *phy = &mac->mac_phy; struct bwn_softc *sc = mac->mac_sc; - struct siba_dev_softc *sd = mac->mac_sd; - struct siba_softc *siba = sd->sd_bus; uint32_t tmp; /* PHY */ @@ -1779,10 +1772,10 @@ bwn_phy_getinfo(struct bwn_mac *mac, int goto unsupphy; /* RADIO */ - if (siba->siba_chipid == 0x4317) { - if (siba->siba_chiprev == 0) + if (siba_get_chipid(sc->sc_dev) == 0x4317) { + if (siba_get_chiprev(sc->sc_dev) == 0) tmp = 0x3205017f; - else if (siba->siba_chiprev == 1) + else if (siba_get_chiprev(sc->sc_dev) == 1) tmp = 0x4205017f; else tmp = 0x5205017f; @@ -1826,7 +1819,6 @@ bwn_chiptest(struct bwn_mac *mac) #define TESTVAL0 0x55aaaa55 #define TESTVAL1 0xaa5555aa struct bwn_softc *sc = mac->mac_sc; - struct siba_dev_softc *sd = mac->mac_sd; uint32_t v, backup; BWN_LOCK(sc); @@ -1842,7 +1834,8 @@ bwn_chiptest(struct bwn_mac *mac) bwn_shm_write_4(mac, BWN_SHARED, 0, backup); - if ((sd->sd_id.sd_rev >= 3) && (sd->sd_id.sd_rev <= 10)) { + if ((siba_get_revid(sc->sc_dev) >= 3) && + (siba_get_revid(sc->sc_dev) <= 10)) { BWN_WRITE_2(mac, BWN_TSF_CFP_START, 0xaaaa); BWN_WRITE_4(mac, BWN_TSF_CFP_START, 0xccccbbbb); if (BWN_READ_2(mac, BWN_TSF_CFP_START_LOW) != 0xbbbb) @@ -2070,15 +2063,17 @@ bwn_phy_g_attach(struct bwn_mac *mac) struct bwn_softc *sc = mac->mac_sc; struct bwn_phy *phy = &mac->mac_phy; struct bwn_phy_g *pg = &phy->phy_g; - struct siba_dev_softc *sd = mac->mac_sd; - struct siba_sprom *sprom = &sd->sd_bus->siba_sprom; unsigned int i; - int16_t pab0 = (int16_t)(sprom->pa0b0), pab1 = (int16_t)(sprom->pa0b1), - pab2 = (int16_t)(sprom->pa0b2); + int16_t pab0, pab1, pab2; static int8_t bwn_phy_g_tssi2dbm_table[] = BWN_PHY_G_TSSI2DBM_TABLE; - int8_t bg = (int8_t)sprom->tssi_bg; + int8_t bg; + + bg = (int8_t)siba_sprom_get_tssi_bg(sc->sc_dev); + pab0 = (int16_t)siba_sprom_get_pa0b0(sc->sc_dev); + pab1 = (int16_t)siba_sprom_get_pa0b1(sc->sc_dev); + pab2 = (int16_t)siba_sprom_get_pa0b2(sc->sc_dev); - if ((sd->sd_bus->siba_chipid == 0x4301) && (phy->rf_ver != 0x2050)) + if ((siba_get_chipid(sc->sc_dev) == 0x4301) && (phy->rf_ver != 0x2050)) device_printf(sc->sc_dev, "not supported anymore\n"); pg->pg_flags = 0; @@ -2175,8 +2170,8 @@ bwn_phy_g_prepare_hw(struct bwn_mac *mac { struct bwn_phy *phy = &mac->mac_phy; struct bwn_phy_g *pg = &phy->phy_g; + struct bwn_softc *sc = mac->mac_sc; struct bwn_txpwr_loctl *lo = &pg->pg_loctl; - struct siba_softc *bus = mac->mac_sd->sd_bus; static const struct bwn_rfatt rfatt0[] = { { 3, 0 }, { 1, 0 }, { 5, 0 }, { 7, 0 }, { 9, 0 }, { 2, 0 }, { 0, 0 }, { 4, 0 }, { 6, 0 }, { 8, 0 }, { 1, 1 }, { 2, 1 }, @@ -2204,12 +2199,12 @@ bwn_phy_g_prepare_hw(struct bwn_mac *mac /* prepare Radio Attenuation */ pg->pg_rfatt.padmix = 0; - if (bus->siba_board_vendor == SIBA_BOARDVENDOR_BCM && - bus->siba_board_type == SIBA_BOARD_BCM4309G) { - if (bus->siba_board_rev < 0x43) { + if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM && + siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BCM4309G) { + if (siba_get_pci_revid(sc->sc_dev) < 0x43) { pg->pg_rfatt.att = 2; goto done; - } else if (bus->siba_board_rev < 0x51) { + } else if (siba_get_pci_revid(sc->sc_dev) < 0x51) { pg->pg_rfatt.att = 3; goto done; } @@ -2228,24 +2223,25 @@ bwn_phy_g_prepare_hw(struct bwn_mac *mac goto done; case 1: if (phy->type == BWN_PHYTYPE_G) { - if (bus->siba_board_vendor == + if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM && - bus->siba_board_type == + siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BCM4309G && - bus->siba_board_rev >= 30) + siba_get_pci_revid(sc->sc_dev) >= 30) pg->pg_rfatt.att = 3; - else if (bus->siba_board_vendor == + else if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM && - bus->siba_board_type == SIBA_BOARD_BU4306) + siba_get_pci_subdevice(sc->sc_dev) == + SIBA_BOARD_BU4306) pg->pg_rfatt.att = 3; else pg->pg_rfatt.att = 1; } else { - if (bus->siba_board_vendor == + if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM && - bus->siba_board_type == + siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BCM4309G && - bus->siba_board_rev >= 30) + siba_get_pci_revid(sc->sc_dev) >= 30) pg->pg_rfatt.att = 7; else pg->pg_rfatt.att = 6; @@ -2253,17 +2249,18 @@ bwn_phy_g_prepare_hw(struct bwn_mac *mac goto done; case 2: if (phy->type == BWN_PHYTYPE_G) { - if (bus->siba_board_vendor == + if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM && - bus->siba_board_type == + siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BCM4309G && - bus->siba_board_rev >= 30) + siba_get_pci_revid(sc->sc_dev) >= 30) pg->pg_rfatt.att = 3; - else if (bus->siba_board_vendor == + else if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM && - bus->siba_board_type == SIBA_BOARD_BU4306) + siba_get_pci_subdevice(sc->sc_dev) == + SIBA_BOARD_BU4306) pg->pg_rfatt.att = 5; - else if (bus->siba_chipid == 0x4320) + else if (siba_get_chipid(sc->sc_dev) == 0x4320) pg->pg_rfatt.att = 4; else pg->pg_rfatt.att = 3; @@ -2547,7 +2544,6 @@ bwn_phy_g_recalc_txpwr(struct bwn_mac *m struct bwn_phy *phy = &mac->mac_phy; struct bwn_phy_g *pg = &phy->phy_g; struct bwn_softc *sc = mac->mac_sc; - struct siba_softc *siba = mac->mac_sd->sd_bus; unsigned int tssi; int cck, ofdm; int power; @@ -2570,12 +2566,13 @@ bwn_phy_g_recalc_txpwr(struct bwn_mac *m pg->pg_avgtssi = tssi; KASSERT(tssi < BWN_TSSI_MAX, ("%s:%d: fail", __func__, __LINE__)); - max = siba->siba_sprom.maxpwr_bg; - if (siba->siba_sprom.bf_lo & BWN_BFL_PACTRL) + max = siba_sprom_get_maxpwr_bg(sc->sc_dev); + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL) max -= 3; if (max >= 120) { device_printf(sc->sc_dev, "invalid max TX-power value\n"); - siba->siba_sprom.maxpwr_bg = max = 80; + max = 80; + siba_sprom_set_maxpwr_bg(sc->sc_dev, max); } power = MIN(MAX((phy->txpower < 0) ? 0 : (phy->txpower << 2), 0), max) - @@ -2619,9 +2616,8 @@ bwn_phy_g_set_txpwr(struct bwn_mac *mac) txctl = BWN_TXCTL_PA2DB | BWN_TXCTL_TXMIX; rfatt += 2; bbatt += 2; - } else if (mac->mac_sd->sd_bus->siba_sprom. - bf_lo & - BWN_BFL_PACTRL) { + } else if (siba_sprom_get_bf_lo(sc->sc_dev) & + BWN_BFL_PACTRL) { bbatt += 4 * (rfatt - 2); rfatt = 2; } @@ -2716,9 +2712,10 @@ static void bwn_phy_g_task_60s(struct bwn_mac *mac) { struct bwn_phy *phy = &mac->mac_phy; + struct bwn_softc *sc = mac->mac_sc; uint8_t old = phy->chan; - if (!(mac->mac_sd->sd_bus->siba_sprom.bf_lo & BWN_BFL_RSSI)) + if (!(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI)) return; bwn_mac_suspend(mac); @@ -3182,20 +3179,15 @@ bwn_wme_clear(struct bwn_softc *sc) static int bwn_core_init(struct bwn_mac *mac) { -#ifdef BWN_DEBUG struct bwn_softc *sc = mac->mac_sc; -#endif - struct siba_dev_softc *sd = mac->mac_sd; - struct siba_softc *siba = sd->sd_bus; - struct siba_sprom *sprom = &siba->siba_sprom; uint64_t hf; int error; KASSERT(mac->mac_status == BWN_MAC_STATUS_UNINIT, ("%s:%d: fail", __func__, __LINE__)); - siba_powerup(siba, 0); - if (!siba_dev_isup(sd)) + siba_powerup(sc->sc_dev, 0); + if (!siba_dev_isup(sc->sc_dev)) bwn_reset_core(mac, mac->mac_phy.gmode ? BWN_TGSLOW_SUPPORT_G : 0); @@ -3219,9 +3211,9 @@ bwn_core_init(struct bwn_mac *mac) mac->mac_phy.init_pre(mac); - siba_pcicore_intr(&siba->siba_pci, sd); + siba_pcicore_intr(sc->sc_dev); - bwn_fix_imcfglobug(mac); + siba_fix_imcfglobug(sc->sc_dev); bwn_bt_disable(mac); if (mac->mac_phy.prepare_hw) { error = mac->mac_phy.prepare_hw(mac); @@ -3232,11 +3224,11 @@ bwn_core_init(struct bwn_mac *mac) if (error) goto fail0; bwn_shm_write_2(mac, BWN_SHARED, BWN_SHARED_COREREV, - mac->mac_sd->sd_id.sd_rev); + siba_get_revid(sc->sc_dev)); hf = bwn_hf_read(mac); if (mac->mac_phy.type == BWN_PHYTYPE_G) { hf |= BWN_HF_GPHY_SYM_WORKAROUND; - if (sprom->bf_lo & BWN_BFL_PACTRL) + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL) hf |= BWN_HF_PAGAINBOOST_OFDM_ON; if (mac->mac_phy.rev == 1) hf |= BWN_HF_GPHY_DC_CANCELFILTER; @@ -3247,10 +3239,10 @@ bwn_core_init(struct bwn_mac *mac) if (mac->mac_phy.rf_rev == 6) hf |= BWN_HF_4318_TSSI; } - if (sprom->bf_lo & BWN_BFL_CRYSTAL_NOSLOW) + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_CRYSTAL_NOSLOW) hf |= BWN_HF_SLOWCLOCK_REQ_OFF; - if ((siba->siba_type == SIBA_TYPE_PCI) && - (siba->siba_pci.spc_dev->sd_id.sd_rev <= 10)) + if ((siba_get_type(sc->sc_dev) == SIBA_TYPE_PCI) && + (siba_get_pcicore_revid(sc->sc_dev) <= 10)) hf |= BWN_HF_PCI_SLOWCLOCK_WORKAROUND; hf &= ~BWN_HF_SKIP_CFP_UPDATE; bwn_hf_write(mac, hf); @@ -3267,7 +3259,7 @@ bwn_core_init(struct bwn_mac *mac) (mac->mac_phy.type == BWN_PHYTYPE_B) ? 0x1f : 0xf); bwn_shm_write_2(mac, BWN_SCRATCH, BWN_SCRATCH_CONT_MAX, 0x3ff); - if (siba->siba_type == SIBA_TYPE_PCMCIA || bwn_usedma == 0) + if (siba_get_type(sc->sc_dev) == SIBA_TYPE_PCMCIA || bwn_usedma == 0) bwn_pio_init(mac); else bwn_dma_init(mac); @@ -3277,7 +3269,8 @@ bwn_core_init(struct bwn_mac *mac) bwn_spu_setdelay(mac, 1); bwn_bt_enable(mac); - siba_powerup(siba, !(sprom->bf_lo & BWN_BFL_CRYSTAL_NOSLOW)); + siba_powerup(sc->sc_dev, + !(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_CRYSTAL_NOSLOW)); bwn_set_macaddr(mac); bwn_crypt_init(mac); @@ -3290,7 +3283,7 @@ bwn_core_init(struct bwn_mac *mac) fail1: bwn_chip_exit(mac); fail0: - siba_powerdown(siba); + siba_powerdown(sc->sc_dev); KASSERT(mac->mac_status == BWN_MAC_STATUS_UNINIT, ("%s:%d: fail", __func__, __LINE__)); return (error); @@ -3305,7 +3298,7 @@ bwn_core_start(struct bwn_mac *mac) KASSERT(mac->mac_status == BWN_MAC_STATUS_INITED, ("%s:%d: fail", __func__, __LINE__)); - if (mac->mac_sd->sd_id.sd_rev < 5) + if (siba_get_revid(sc->sc_dev) < 5) return; while (1) { @@ -3325,6 +3318,7 @@ bwn_core_start(struct bwn_mac *mac) static void bwn_core_exit(struct bwn_mac *mac) { + struct bwn_softc *sc = mac->mac_sc; uint32_t macctl; BWN_ASSERT_LOCKED(mac->mac_sc); @@ -3345,35 +3339,8 @@ bwn_core_exit(struct bwn_mac *mac) bwn_pio_stop(mac); bwn_chip_exit(mac); mac->mac_phy.switch_analog(mac, 0); - siba_dev_down(mac->mac_sd, 0); - siba_powerdown(mac->mac_sd->sd_bus); -} - -static void -bwn_fix_imcfglobug(struct bwn_mac *mac) -{ - struct siba_dev_softc *sd = mac->mac_sd; - struct siba_softc *siba = sd->sd_bus; - uint32_t tmp; - - if (siba->siba_pci.spc_dev == NULL) - return; - if (siba->siba_pci.spc_dev->sd_id.sd_device != SIBA_DEVID_PCI || - siba->siba_pci.spc_dev->sd_id.sd_rev > 5) - return; - - tmp = siba_read_4(sd, SIBA_IMCFGLO) & - ~(SIBA_IMCFGLO_REQTO | SIBA_IMCFGLO_SERTO); - switch (siba->siba_type) { - case SIBA_TYPE_PCI: - case SIBA_TYPE_PCMCIA: - tmp |= 0x32; - break; - case SIBA_TYPE_SSB: - tmp |= 0x53; - break; - } - siba_write_4(sd, SIBA_IMCFGLO, tmp); + siba_dev_down(sc->sc_dev, 0); + siba_powerdown(sc->sc_dev); } static void @@ -3388,6 +3355,7 @@ bwn_bt_disable(struct bwn_mac *mac) static int bwn_chip_init(struct bwn_mac *mac) { + struct bwn_softc *sc = mac->mac_sc; struct bwn_phy *phy = &mac->mac_phy; uint32_t macctl; int error; @@ -3410,13 +3378,13 @@ bwn_chip_init(struct bwn_mac *mac) error = bwn_fw_loadinitvals(mac); if (error) { - bwn_gpio_cleanup(mac); + siba_gpio_set(sc->sc_dev, 0); return (error); } phy->switch_analog(mac, 1); error = bwn_phy_init(mac); if (error) { - bwn_gpio_cleanup(mac); + siba_gpio_set(sc->sc_dev, 0); return (error); } if (phy->set_im) @@ -3428,7 +3396,7 @@ bwn_chip_init(struct bwn_mac *mac) if (phy->type == BWN_PHYTYPE_B) BWN_WRITE_2(mac, 0x005e, BWN_READ_2(mac, 0x005e) | 0x0004); BWN_WRITE_4(mac, 0x0100, 0x01000000); - if (mac->mac_sd->sd_id.sd_rev < 5) + if (siba_get_revid(sc->sc_dev) < 5) BWN_WRITE_4(mac, 0x010c, 0x01000000); BWN_WRITE_4(mac, BWN_MACCTL, @@ -3438,7 +3406,7 @@ bwn_chip_init(struct bwn_mac *mac) bwn_shm_write_2(mac, BWN_SHARED, 0x0074, 0x0000); bwn_set_opmode(mac); - if (mac->mac_sd->sd_id.sd_rev < 3) { + if (siba_get_revid(sc->sc_dev) < 3) { BWN_WRITE_2(mac, 0x060e, 0x0000); BWN_WRITE_2(mac, 0x0610, 0x8000); BWN_WRITE_2(mac, 0x0604, 0x0000); @@ -3454,10 +3422,9 @@ bwn_chip_init(struct bwn_mac *mac) BWN_WRITE_4(mac, BWN_DMA3_INTR_MASK, 0x0001dc00); BWN_WRITE_4(mac, BWN_DMA4_INTR_MASK, 0x0000dc00); BWN_WRITE_4(mac, BWN_DMA5_INTR_MASK, 0x0000dc00); - siba_write_4(mac->mac_sd, SIBA_TGSLOW, - siba_read_4(mac->mac_sd, SIBA_TGSLOW) | 0x00100000); - BWN_WRITE_2(mac, BWN_POWERUP_DELAY, - mac->mac_sd->sd_bus->siba_cc.scc_powerup_delay); + siba_write_4(sc->sc_dev, SIBA_TGSLOW, + siba_read_4(sc->sc_dev, SIBA_TGSLOW) | 0x00100000); + BWN_WRITE_2(mac, BWN_POWERUP_DELAY, siba_get_cc_powerdelay(sc->sc_dev)); return (error); } @@ -3619,13 +3586,14 @@ bwn_pio_set_txqueue(struct bwn_mac *mac, int index) { struct bwn_pio_txpkt *tp; + struct bwn_softc *sc = mac->mac_sc; unsigned int i; tq->tq_base = bwn_pio_idx2base(mac, index) + BWN_PIO_TXQOFFSET(mac); tq->tq_index = index; tq->tq_free = BWN_PIO_MAX_TXPACKETS; - if (mac->mac_sd->sd_id.sd_rev >= 8) + if (siba_get_revid(sc->sc_dev) >= 8) tq->tq_size = 1920; else { tq->tq_size = bwn_pio_read_2(mac, tq, BWN_PIO_TXQBUFSIZE); @@ -3664,7 +3632,7 @@ bwn_pio_idx2base(struct bwn_mac *mac, in BWN_PIO11_BASE5, }; - if (mac->mac_sd->sd_id.sd_rev >= 11) { + if (siba_get_revid(sc->sc_dev) >= 11) { if (index >= N(bases_rev11)) device_printf(sc->sc_dev, "%s: warning\n", __func__); return (bases_rev11[index]); @@ -3678,9 +3646,10 @@ static void bwn_pio_setupqueue_rx(struct bwn_mac *mac, struct bwn_pio_rxqueue *prq, int index) { + struct bwn_softc *sc = mac->mac_sc; prq->prq_mac = mac; - prq->prq_rev = mac->mac_sd->sd_id.sd_rev; + prq->prq_rev = siba_get_revid(sc->sc_dev); prq->prq_base = bwn_pio_idx2base(mac, index) + BWN_PIO_RXQOFFSET(mac); bwn_dma_rxdirectfifo(mac, index, 1); } @@ -4027,6 +3996,7 @@ bwn_dma_32_setdesc(struct bwn_dma_ring * int start, int end, int irq) { struct bwn_dmadesc32 *descbase = dr->dr_ring_descbase; + struct bwn_softc *sc = dr->dr_mac->mac_sc; uint32_t addr, addrext, ctl; int slot; @@ -4036,7 +4006,7 @@ bwn_dma_32_setdesc(struct bwn_dma_ring * addr = (uint32_t) (dmaaddr & ~SIBA_DMA_TRANSLATION_MASK); addrext = (uint32_t) (dmaaddr & SIBA_DMA_TRANSLATION_MASK) >> 30; - addr |= siba_dma_translation(dr->dr_mac->mac_sd); + addr |= siba_dma_translation(sc->sc_dev); ctl = bufsize & BWN_DMA32_DCTL_BYTECNT; if (slot == dr->dr_numslots - 1) ctl |= BWN_DMA32_DCTL_DTABLEEND; @@ -4115,6 +4085,7 @@ bwn_dma_64_setdesc(struct bwn_dma_ring * int start, int end, int irq) { struct bwn_dmadesc64 *descbase = dr->dr_ring_descbase; + struct bwn_softc *sc = dr->dr_mac->mac_sc; int slot; uint32_t ctl0 = 0, ctl1 = 0; uint32_t addrlo, addrhi; @@ -4128,7 +4099,7 @@ bwn_dma_64_setdesc(struct bwn_dma_ring * addrhi = (((uint64_t) dmaaddr >> 32) & ~SIBA_DMA_TRANSLATION_MASK); addrext = (((uint64_t) dmaaddr >> 32) & SIBA_DMA_TRANSLATION_MASK) >> 30; - addrhi |= (siba_dma_translation(dr->dr_mac->mac_sd) << 1); + addrhi |= (siba_dma_translation(sc->sc_dev) << 1); if (slot == dr->dr_numslots - 1) ctl0 |= BWN_DMA64_DCTL0_DTABLEEND; if (start) @@ -4238,9 +4209,10 @@ bwn_dma_allocringmemory(struct bwn_dma_r static void bwn_dma_setup(struct bwn_dma_ring *dr) { + struct bwn_softc *sc = dr->dr_mac->mac_sc; uint64_t ring64; uint32_t addrext, ring32, value; - uint32_t trans = siba_dma_translation(dr->dr_mac->mac_sd); + uint32_t trans = siba_dma_translation(sc->sc_dev); if (dr->dr_tx) { dr->dr_curslot = -1; @@ -4536,18 +4508,18 @@ bwn_spu_setdelay(struct bwn_mac *mac, in static void bwn_bt_enable(struct bwn_mac *mac) { - struct siba_sprom *sprom = &mac->mac_sd->sd_bus->siba_sprom; + struct bwn_softc *sc = mac->mac_sc; uint64_t hf; if (bwn_bluetooth == 0) return; - if ((sprom->bf_lo & BWN_BFL_BTCOEXIST) == 0) + if ((siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_BTCOEXIST) == 0) return; if (mac->mac_phy.type != BWN_PHYTYPE_B && !mac->mac_phy.gmode) return; hf = bwn_hf_read(mac); - if (sprom->bf_lo & BWN_BFL_BTCMOD) + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_BTCMOD) hf |= BWN_HF_BT_COEXISTALT; else hf |= BWN_HF_BT_COEXIST; @@ -4584,25 +4556,25 @@ bwn_clear_keys(struct bwn_mac *mac) static void bwn_crypt_init(struct bwn_mac *mac) { + struct bwn_softc *sc = mac->mac_sc; - mac->mac_max_nr_keys = (mac->mac_sd->sd_id.sd_rev >= 5) ? 58 : 20; + mac->mac_max_nr_keys = (siba_get_revid(sc->sc_dev) >= 5) ? 58 : 20; KASSERT(mac->mac_max_nr_keys <= N(mac->mac_key), ("%s:%d: fail", __func__, __LINE__)); mac->mac_ktp = bwn_shm_read_2(mac, BWN_SHARED, BWN_SHARED_KEY_TABLEP); mac->mac_ktp *= 2; - if (mac->mac_sd->sd_id.sd_rev >= 5) { - BWN_WRITE_2(mac, BWN_RCMTA_COUNT, - mac->mac_max_nr_keys - 8); - } + if (siba_get_revid(sc->sc_dev) >= 5) + BWN_WRITE_2(mac, BWN_RCMTA_COUNT, mac->mac_max_nr_keys - 8); bwn_clear_keys(mac); } static void bwn_chip_exit(struct bwn_mac *mac) { + struct bwn_softc *sc = mac->mac_sc; bwn_phy_exit(mac); - bwn_gpio_cleanup(mac); + siba_gpio_set(sc->sc_dev, 0); } static int @@ -4622,33 +4594,31 @@ bwn_fw_fillinfo(struct bwn_mac *mac) static int bwn_gpio_init(struct bwn_mac *mac) { - struct siba_softc *bus = mac->mac_sd->sd_bus; - struct siba_dev_softc *sd; - uint32_t mask = 0x0000001f, set = 0x0000000f; + struct bwn_softc *sc = mac->mac_sc; + uint32_t mask = 0x1f, set = 0xf, value; BWN_WRITE_4(mac, BWN_MACCTL, BWN_READ_4(mac, BWN_MACCTL) & ~BWN_MACCTL_GPOUT_MASK); BWN_WRITE_2(mac, BWN_GPIO_MASK, BWN_READ_2(mac, BWN_GPIO_MASK) | 0x000f); - if (bus->siba_chipid == 0x4301) { + if (siba_get_chipid(sc->sc_dev) == 0x4301) { mask |= 0x0060; set |= 0x0060; } - if (bus->siba_sprom.bf_lo & BWN_BFL_PACTRL) { + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL) { BWN_WRITE_2(mac, BWN_GPIO_MASK, BWN_READ_2(mac, BWN_GPIO_MASK) | 0x0200); mask |= 0x0200; set |= 0x0200; } - if (mac->mac_sd->sd_id.sd_rev >= 2) + if (siba_get_revid(sc->sc_dev) >= 2) mask |= 0x0010; - sd = (bus->siba_cc.scc_dev != NULL) ? bus->siba_cc.scc_dev : - bus->siba_pci.spc_dev; - if (sd == NULL) + + value = siba_gpio_get(sc->sc_dev); + if (value == -1) return (0); - siba_write_4(sd, BWN_GPIOCTL, - (siba_read_4(sd, BWN_GPIOCTL) & mask) | set); + siba_gpio_set(sc->sc_dev, (value & mask) | set); return (0); } @@ -4749,15 +4719,15 @@ bwn_set_opmode(struct bwn_mac *mac) ctl &= ~BWN_MACCTL_STA; ctl |= sc->sc_filters; - if (mac->mac_sd->sd_id.sd_rev <= 4) + if (siba_get_revid(sc->sc_dev) <= 4) ctl |= BWN_MACCTL_PROMISC; BWN_WRITE_4(mac, BWN_MACCTL, ctl); cfp_pretbtt = 2; if ((ctl & BWN_MACCTL_STA) && !(ctl & BWN_MACCTL_HOSTAP)) { - if (mac->mac_sd->sd_bus->siba_chipid == 0x4306 && - mac->mac_sd->sd_bus->siba_chiprev == 3) + if (siba_get_chipid(sc->sc_dev) == 0x4306 && + siba_get_chiprev(sc->sc_dev) == 3) cfp_pretbtt = 100; else cfp_pretbtt = 50; @@ -4765,19 +4735,6 @@ bwn_set_opmode(struct bwn_mac *mac) BWN_WRITE_2(mac, 0x612, cfp_pretbtt); } -static void -bwn_gpio_cleanup(struct bwn_mac *mac) -{ - struct siba_softc *bus = mac->mac_sd->sd_bus; - struct siba_dev_softc *gpiodev, *pcidev = NULL; - - pcidev = bus->siba_pci.spc_dev; - gpiodev = bus->siba_cc.scc_dev ? bus->siba_cc.scc_dev : pcidev; - if (!gpiodev) - return; - siba_write_4(gpiodev, BWN_GPIOCTL, 0); -} - static int bwn_dma_gettype(struct bwn_mac *mac) { @@ -4810,6 +4767,7 @@ bwn_phy_g_init_sub(struct bwn_mac *mac) { struct bwn_phy *phy = &mac->mac_phy; struct bwn_phy_g *pg = &phy->phy_g; + struct bwn_softc *sc = mac->mac_sc; uint16_t i, tmp; if (phy->rev == 1) @@ -4872,7 +4830,7 @@ bwn_phy_g_init_sub(struct bwn_mac *mac) BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x36), 0x0fff, (pg->pg_loctl.tx_bias << 12)); } - if (mac->mac_sd->sd_bus->siba_sprom.bf_lo & BWN_BFL_PACTRL) + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL) BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8075); else BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x807f); @@ -4885,7 +4843,7 @@ bwn_phy_g_init_sub(struct bwn_mac *mac) BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8078); } - if (!(mac->mac_sd->sd_bus->siba_sprom.bf_lo & BWN_BFL_RSSI)) { + if (!(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI)) { for (i = 0; i < 64; i++) { BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_CTRL, i); BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_DATA, @@ -4904,8 +4862,8 @@ bwn_phy_g_init_sub(struct bwn_mac *mac) if (phy->rf_rev == 8) BWN_PHY_WRITE(mac, BWN_PHY_EXTG(0x05), 0x3230); bwn_phy_hwpctl_init(mac); - if ((mac->mac_sd->sd_bus->siba_chipid == 0x4306 - && mac->mac_sd->sd_bus->siba_chippkg == 2) || 0) { + if ((siba_get_chipid(sc->sc_dev) == 0x4306 + && siba_get_chippkg(sc->sc_dev) == 2) || 0) { BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0xbfff); BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xc3), 0x7fff); } @@ -4923,16 +4881,16 @@ bwn_has_hwpctl(struct bwn_mac *mac) static void bwn_phy_init_b5(struct bwn_mac *mac) { - struct siba_softc *bus = mac->mac_sd->sd_bus; struct bwn_phy *phy = &mac->mac_phy; struct bwn_phy_g *pg = &phy->phy_g; + struct bwn_softc *sc = mac->mac_sc; uint16_t offset, value; uint8_t old_channel; if (phy->analog == 1) BWN_RF_SET(mac, 0x007a, 0x0050); - if ((bus->siba_board_vendor != SIBA_BOARDVENDOR_BCM) && - (bus->siba_board_type != SIBA_BOARD_BU4306)) { + if ((siba_get_pci_subvendor(sc->sc_dev) != SIBA_BOARDVENDOR_BCM) && + (siba_get_pci_subdevice(sc->sc_dev) != SIBA_BOARD_BU4306)) { value = 0x2120; for (offset = 0x00a8; offset < 0x00c7; offset++) { BWN_PHY_WRITE(mac, offset, value); @@ -5021,6 +4979,7 @@ bwn_loopback_calcgain(struct bwn_mac *ma { struct bwn_phy *phy = &mac->mac_phy; struct bwn_phy_g *pg = &phy->phy_g; + struct bwn_softc *sc = mac->mac_sc; uint16_t backup_phy[16] = { 0 }; uint16_t backup_radio[3]; uint16_t backup_bband; @@ -5099,7 +5058,7 @@ bwn_loopback_calcgain(struct bwn_mac *ma BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0100); BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xcfff); - if (mac->mac_sd->sd_bus->siba_sprom.bf_lo & BWN_BFL_EXTLNA) { + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) { if (phy->rev >= 7) { BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0800); BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x8000); @@ -5399,6 +5358,7 @@ bwn_phy_init_b6(struct bwn_mac *mac) { struct bwn_phy *phy = &mac->mac_phy; struct bwn_phy_g *pg = &phy->phy_g; + struct bwn_softc *sc = mac->mac_sc; uint16_t offset, val; uint8_t old_channel; @@ -5428,7 +5388,7 @@ bwn_phy_init_b6(struct bwn_mac *mac) BWN_RF_WRITE(mac, 0x5a, 0x88); BWN_RF_WRITE(mac, 0x5b, 0x6b); BWN_RF_WRITE(mac, 0x5c, 0x0f); - if (mac->mac_sd->sd_bus->siba_sprom.bf_lo & BWN_BFL_ALTIQ) { + if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_ALTIQ) { BWN_RF_WRITE(mac, 0x5d, 0xfa); BWN_RF_WRITE(mac, 0x5e, 0xd8); } else { @@ -5509,6 +5469,7 @@ static void bwn_phy_init_a(struct bwn_mac *mac) { struct bwn_phy *phy = &mac->mac_phy; + struct bwn_softc *sc = mac->mac_sc; KASSERT(phy->type == BWN_PHYTYPE_A || phy->type == BWN_PHYTYPE_G, ("%s:%d: fail", __func__, __LINE__)); @@ -5525,7 +5486,7 @@ bwn_phy_init_a(struct bwn_mac *mac) bwn_wa_init(mac); if (phy->type == BWN_PHYTYPE_G && - (mac->mac_sd->sd_bus->siba_sprom.bf_lo & BWN_BFL_PACTRL)) + (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL)) BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x6e), 0xe000, 0x3cf); } @@ -5776,7 +5737,7 @@ static void bwn_wa_init(struct bwn_mac *mac) { struct bwn_phy *phy = &mac->mac_phy; - struct siba_softc *bus = mac->mac_sd->sd_bus; + struct bwn_softc *sc = mac->mac_sc; KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__)); @@ -5795,9 +5756,9 @@ bwn_wa_init(struct bwn_mac *mac) KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); } - if (bus->siba_board_vendor != SIBA_BOARDVENDOR_BCM || - bus->siba_board_type != SIBA_BOARD_BU4306 || - bus->siba_board_rev != 0x17) { + if (siba_get_pci_subvendor(sc->sc_dev) != SIBA_BOARDVENDOR_BCM || + siba_get_pci_subdevice(sc->sc_dev) != SIBA_BOARD_BU4306 || + siba_get_pci_revid(sc->sc_dev) != 0x17) { if (phy->rev < 2) { bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX_R1, 1, 0x0002); @@ -5806,7 +5767,8 @@ bwn_wa_init(struct bwn_mac *mac) } else { bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 1, 0x0002); bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 2, 0x0001); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***