Lines Matching defs:sc

49 	struct cn30xxpip_softc *sc;
52 sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
53 if (sc == NULL)
56 sc->sc_port = aa->aa_port;
57 sc->sc_regt = aa->aa_regt;
58 sc->sc_tag_type = aa->aa_tag_type;
59 sc->sc_receive_group = aa->aa_receive_group;
60 sc->sc_ip_offset = aa->aa_ip_offset;
62 status = bus_space_map(sc->sc_regt, PIP_BASE, PIP_SIZE, 0,
63 &sc->sc_regh);
67 status = bus_space_subregion(sc->sc_regt, sc->sc_regh,
68 PIP_STAT_BASE(sc->sc_port), PIP_STAT_SIZE, &sc->sc_regh_stat);
72 *rsc = sc;
75 #define _PIP_RD8(sc, off) \
76 bus_space_read_8((sc)->sc_regt, (sc)->sc_regh, (off))
77 #define _PIP_WR8(sc, off, v) \
78 bus_space_write_8((sc)->sc_regt, (sc)->sc_regh, (off), (v))
80 #define _PIP_STAT_RD8(sc, off) \
81 bus_space_read_8((sc)->sc_regt, (sc)->sc_regh_stat, (off))
82 #define _PIP_STAT_WR8(sc, off, v) \
83 bus_space_write_8((sc)->sc_regt, (sc)->sc_regh_stat, (off), (v))
86 cn30xxpip_port_config(struct cn30xxpip_softc *sc)
101 SET(prt_cfg, (sc->sc_port << 24) & PIP_PRT_CFGN_QOS);
127 SET(prt_tag, sc->sc_receive_group & PIP_PRT_TAGN_GRP);
130 SET(ip_offset, (sc->sc_ip_offset / 8) & PIP_IP_OFFSET_MASK_OFFSET);
132 _PIP_WR8(sc, PIP_PRT_CFG0_OFFSET + (8 * sc->sc_port), prt_cfg);
133 _PIP_WR8(sc, PIP_PRT_TAG0_OFFSET + (8 * sc->sc_port), prt_tag);
134 _PIP_WR8(sc, PIP_IP_OFFSET_OFFSET, ip_offset);
140 cn30xxpip_prt_cfg_enable(struct cn30xxpip_softc *sc, uint64_t prt_cfg,
145 tmp = _PIP_RD8(sc, PIP_PRT_CFG0_OFFSET + (8 * sc->sc_port));
150 _PIP_WR8(sc, PIP_PRT_CFG0_OFFSET + (8 * sc->sc_port), tmp);
154 cn30xxpip_stats_init(struct cn30xxpip_softc *sc)
157 _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, 1);
159 _PIP_STAT_WR8(sc, PIP_STAT0_PRT, 0);
160 _PIP_STAT_WR8(sc, PIP_STAT1_PRT, 0);
161 _PIP_STAT_WR8(sc, PIP_STAT2_PRT, 0);
162 _PIP_STAT_WR8(sc, PIP_STAT3_PRT, 0);
163 _PIP_STAT_WR8(sc, PIP_STAT4_PRT, 0);
164 _PIP_STAT_WR8(sc, PIP_STAT5_PRT, 0);
165 _PIP_STAT_WR8(sc, PIP_STAT6_PRT, 0);
166 _PIP_STAT_WR8(sc, PIP_STAT7_PRT, 0);
167 _PIP_STAT_WR8(sc, PIP_STAT8_PRT, 0);
168 _PIP_STAT_WR8(sc, PIP_STAT9_PRT, 0);
173 cn30xxpip_kstat_read(struct cn30xxpip_softc *sc, struct kstat_kv *kvs)
177 val = _PIP_STAT_RD8(sc, PIP_STAT0_PRT);
181 val = _PIP_STAT_RD8(sc, PIP_STAT1_PRT);
184 val = _PIP_STAT_RD8(sc, PIP_STAT2_PRT);
188 val = _PIP_STAT_RD8(sc, PIP_STAT3_PRT);
192 val = _PIP_STAT_RD8(sc, PIP_STAT4_PRT);
196 val = _PIP_STAT_RD8(sc, PIP_STAT5_PRT);
200 val = _PIP_STAT_RD8(sc, PIP_STAT6_PRT);
204 val = _PIP_STAT_RD8(sc, PIP_STAT7_PRT);
208 val = _PIP_STAT_RD8(sc, PIP_STAT8_PRT);
212 val = _PIP_STAT_RD8(sc, PIP_STAT9_PRT);