0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Use is subject to license terms.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Copyright (c) 2004, 2005
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Redistribution and use in source and binary forms, with or without
bb5e3b2f129cc39517b925419c22f69a378ec023eh * modification, are permitted provided that the following conditions
bb5e3b2f129cc39517b925419c22f69a378ec023eh * are met:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * 1. Redistributions of source code must retain the above copyright
bb5e3b2f129cc39517b925419c22f69a378ec023eh * notice unmodified, this list of conditions, and the following
bb5e3b2f129cc39517b925419c22f69a378ec023eh * disclaimer.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * 2. Redistributions in binary form must reproduce the above copyright
bb5e3b2f129cc39517b925419c22f69a378ec023eh * notice, this list of conditions and the following disclaimer in the
bb5e3b2f129cc39517b925419c22f69a378ec023eh * documentation and/or other materials provided with the distribution.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bb5e3b2f129cc39517b925419c22f69a378ec023eh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
bb5e3b2f129cc39517b925419c22f69a378ec023eh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
bb5e3b2f129cc39517b925419c22f69a378ec023eh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
bb5e3b2f129cc39517b925419c22f69a378ec023eh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
bb5e3b2f129cc39517b925419c22f69a378ec023eh * SUCH DAMAGE.
924f3e72988efae04c4357a6686a06ba300bab18eh * for net80211 kernel usage
bb5e3b2f129cc39517b925419c22f69a378ec023eh * minimal size reserved in tx-ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh * PIO access attributor for registers
bb5e3b2f129cc39517b925419c22f69a378ec023eh * DMA access attributor for descriptors
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Describes the chip's DMA engine
bb5e3b2f129cc39517b925419c22f69a378ec023eh 0 /* flags */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic const struct ieee80211_rateset ipw2200_rateset_11a = { 8,
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic const struct ieee80211_rateset ipw2200_rateset_11b = { 4,
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic const struct ieee80211_rateset ipw2200_rateset_11g = { 12,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Used by multi function thread
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ipw2200 specific hardware operations
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void ipw2200_master_stop(struct ipw2200_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void ipw2200_ring_hwsetup(struct ipw2200_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * GLD specific operations
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic int ipw2200_m_stat(void *arg, uint_t stat, uint64_t *val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic int ipw2200_m_unicst(void *arg, const uint8_t *macaddr);
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic int ipw2200_m_multicst(void *arg, boolean_t add, const uint8_t *m);
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void ipw2200_m_ioctl(void *arg, queue_t *wq, mblk_t *mp);
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing Chinastatic int ipw2200_m_setprop(void *arg, const char *pr_name,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China mac_prop_id_t wldp_pr_num, uint_t wldp_length, const void *wldp_buf);
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing Chinastatic int ipw2200_m_getprop(void *arg, const char *pr_name,
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer mac_prop_id_t wldp_pr_num, uint_t wldp_length, void *wldp_buf);
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyerstatic void ipw2200_m_propinfo(void *arg, const char *pr_name,
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer mac_prop_id_t wldp_pr_num, mac_prop_info_handle_t mph);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Interrupt and Data transferring operations
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic int ipw2200_send(struct ieee80211com *ic, mblk_t *mp, uint8_t type);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * WiFi specific operations
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IOCTL Handler
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic int ipw2200_ioctl(struct ipw2200_softc *sc, queue_t *q, mblk_t *m);
924f3e72988efae04c4357a6686a06ba300bab18eh * net80211 functions
924f3e72988efae04c4357a6686a06ba300bab18ehextern uint8_t ieee80211_crypto_getciphertype(ieee80211com_t *ic);
924f3e72988efae04c4357a6686a06ba300bab18ehextern void ieee80211_notify_node_join(ieee80211com_t *ic,
924f3e72988efae04c4357a6686a06ba300bab18ehextern void ieee80211_notify_node_leave(ieee80211com_t *ic,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Mac Call Back entries
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer MC_IOCTL | MC_SETPROP | MC_GETPROP | MC_PROPINFO,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China ipw2200_m_ioctl,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China ipw2200_m_setprop,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * DEBUG Facility
bb5e3b2f129cc39517b925419c22f69a378ec023eh * supported debug marks are:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_CSR
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_TABLE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_HWCAP
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_TX
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_INIT
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_FW
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_NOTIF
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_SCAN
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_IOCTL
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_RING
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_INT
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_RX
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_DMA
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_GLD
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_WIFI
bb5e3b2f129cc39517b925419c22f69a378ec023eh * | IPW2200_DBG_SOFTINT
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * | IPW2200_DBG_SUSPEND
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China * | IPW2200_DBG_BRUSSELS
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Global tunning parameter to work around unknown hardware issues
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic uint32_t delay_fatal_recover = 100000 * 20; /* 2s */
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_dbg(dev_info_t *dip, int level, const char *fmt, ...)
bb5e3b2f129cc39517b925419c22f69a378ec023eh cmn_err(level, "%s%d: %s", IPW2200_DRV_NAME, instance, buf);
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * Set up pci
922d2c76afbee21520ffa2088c4e60dcb80d3945ehipw2200_setup_pci(dev_info_t *dip, struct ipw2200_softc *sc)
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * Map config spaces register to read the vendor id, device id, sub
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * vendor id, and sub device id.
922d2c76afbee21520ffa2088c4e60dcb80d3945eh err = ddi_regs_map_setup(dip, IPW2200_PCI_CFG_RNUM, ®s,
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_attach(): unable to map spaces regs\n"));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_setup_pci(): vendor = 0x%04x, devic = 0x%04x,"
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "subversion = 0x%04x, subdev = 0x%04x",
922d2c76afbee21520ffa2088c4e60dcb80d3945eh sc->sc_vendor, sc->sc_device, sc->sc_subven, sc->sc_subdev));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Device operations
922d2c76afbee21520ffa2088c4e60dcb80d3945eh switch (cmd) {
922d2c76afbee21520ffa2088c4e60dcb80d3945eh sc = ddi_get_soft_state(ipw2200_ssp, ddi_get_instance(dip));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * set up pci
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_attach(): resume failure\n"));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * resume hardware.
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * If it was on runnning status, reset to INIT state
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_attach(): resume successful\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): unable to allocate soft state\n"));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh /* set up pci, put reg+0x41 0 */
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_attach(): unable to setup pci\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Map operating registers
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ddi_regs_map_setup(dip, IPW2200_PCI_CSR_RNUM, &sc->sc_regs,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): ddi_regs_map_setup() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Reset the chip
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): ipw2200_chip_reset() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Get the hardware configuration, including the MAC address
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Then, init all the rings needed.
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): ipw2200_ring_init() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Initialize mutexs and condvars
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): ddi_get_iblock_cookie() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * interrupt lock
bb5e3b2f129cc39517b925419c22f69a378ec023eh cv_init(&sc->sc_fw_cond, "firmware-ok", CV_DRIVER, NULL);
bb5e3b2f129cc39517b925419c22f69a378ec023eh cv_init(&sc->sc_cmd_status_cond, "cmd-status-ring", CV_DRIVER, NULL);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * command ring lock
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx ring lock
924f3e72988efae04c4357a6686a06ba300bab18eh * rescheduled lock
924f3e72988efae04c4357a6686a06ba300bab18eh mutex_init(&sc->sc_resched_lock, "reschedule-lock", MUTEX_DRIVER,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * multi-function lock, may acquire this during interrupt
bb5e3b2f129cc39517b925419c22f69a378ec023eh mutex_init(&sc->sc_mflock, "function-lock", MUTEX_DRIVER,
924f3e72988efae04c4357a6686a06ba300bab18eh * Initialize the WiFi part
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set mac addr
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set supported .11a rates and channel - (2915ABG only)
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* .11a rates */
bb5e3b2f129cc39517b925419c22f69a378ec023eh ic->ic_sup_rates[IEEE80211_MODE_11A] = ipw2200_rateset_11a;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* .11a channels */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set supported .11b and .11g rates
bb5e3b2f129cc39517b925419c22f69a378ec023eh ic->ic_sup_rates[IEEE80211_MODE_11B] = ipw2200_rateset_11b;
bb5e3b2f129cc39517b925419c22f69a378ec023eh ic->ic_sup_rates[IEEE80211_MODE_11G] = ipw2200_rateset_11g;
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set supported .11b and .11g channels(1 through 14)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IBSS channal undefined for now
bb5e3b2f129cc39517b925419c22f69a378ec023eh * init generic layer, then override state transition machine
924f3e72988efae04c4357a6686a06ba300bab18eh * different instance has different WPA door
924f3e72988efae04c4357a6686a06ba300bab18eh ieee80211_register_door(ic, ddi_driver_name(dip), instance);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Override 80211 default routines
bb5e3b2f129cc39517b925419c22f69a378ec023eh ieee80211_media_init(ic); /* initial the node table and bss */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Add the interrupt handler
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): ddi_add_intr() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Initialize pointer to device specific functions
bb5e3b2f129cc39517b925419c22f69a378ec023eh if (err != 0) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): mac_alloc() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Register the macp to mac
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): mac_register() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Create minor node of type DDI_NT_NET_WIFI
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_attach(): ddi_create_minor_node() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Cache firmware will always be true
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Notify link is down now
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Create the mf thread to handle the link status,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * recovery fatal error, etc.
922d2c76afbee21520ffa2088c4e60dcb80d3945eh sc = ddi_get_soft_state(ipw2200_ssp, ddi_get_instance(dip));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh switch (cmd) {
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_detach(): suspend\n"));
42516a0c6ebf6e259c2abcd1ca315fec43268f39xinghua wen - Sun Microsystems - Beijing China err = mac_disable(sc->sc_ic.ic_mach);
42516a0c6ebf6e259c2abcd1ca315fec43268f39xinghua wen - Sun Microsystems - Beijing China if (err != DDI_SUCCESS)
42516a0c6ebf6e259c2abcd1ca315fec43268f39xinghua wen - Sun Microsystems - Beijing China return (err);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Destroy the mf_thread
bb5e3b2f129cc39517b925419c22f69a378ec023eh if (cv_wait_sig(&sc->sc_mfthread_cv, &sc->sc_mflock) == 0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Unregister from the MAC layer subsystem
42516a0c6ebf6e259c2abcd1ca315fec43268f39xinghua wen - Sun Microsystems - Beijing China (void) mac_unregister(sc->sc_ic.ic_mach);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Detach ieee80211
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * quiesce(9E) entry point.
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * This function is called when the system is single-threaded at high
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * PIL with preemption disabled. Therefore, this function must not be
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * This function returns DDI_SUCCESS on success, or DDI_FAILURE on failure.
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * DDI_FAILURE indicates an error condition and should almost never happen.
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing Chinaipw2200_quiesce(dev_info_t *dip)
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China return (DDI_FAILURE);
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China /* by pass any messages, if it's quiesce */
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China ipw2200_debug = 0;
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * No more blocking is allowed while we are in the
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * quiesce(9E) entry point.
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China sc->sc_flags |= IPW2200_FLAG_QUIESCED;
14d912249090fc833b92625af4f618803de6a6c6fei feng - Sun Microsystems - Beijing China * Disable and mask all interrupts.
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China ipw2200_master_stop(sc);
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China ipw2200_csr_put32(sc, IPW2200_CSR_RST, IPW2200_RST_SW_RESET);
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_stop(): enter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_RST, IPW2200_RST_SW_RESET);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Reset ring
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China IPW2200_DBG(IPW2200_DBG_HWCAP, (sc->sc_dip, CE_CONT,
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China "ipw2200_stop(): exit\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set the IBSS mode channel: Tx power
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting .11b channels Tx power\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting .11g channels Tx power\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set MAC address
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting MAC address to "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "%02x:%02x:%02x:%02x:%02x:%02x\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh ic->ic_macaddr[3], ic->ic_macaddr[4], ic->ic_macaddr[5]));
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_MAC_ADDRESS, ic->ic_macaddr,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set basic system config settings: configuration(capabilities)
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Configuring adapter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set power mode
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting power mode to %u\n", LE_32(data)));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set supported rates
bb5e3b2f129cc39517b925419c22f69a378ec023eh rs.nrates = ic->ic_sup_rates[IEEE80211_MODE_11G].ir_nrates;
bb5e3b2f129cc39517b925419c22f69a378ec023eh (void) memcpy(rs.rates, ic->ic_sup_rates[IEEE80211_MODE_11G].ir_rates,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting .11g supported rates(%u)\n", rs.nrates));
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_RATES, &rs, sizeof (rs), 0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh rs.nrates = ic->ic_sup_rates[IEEE80211_MODE_11A].ir_nrates;
bb5e3b2f129cc39517b925419c22f69a378ec023eh (void) memcpy(rs.rates, ic->ic_sup_rates[IEEE80211_MODE_11A].ir_rates,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting .11a supported rates(%u)\n", rs.nrates));
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_RATES, &rs, sizeof (rs), 0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set RTS(request-to-send) threshold
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting RTS threshold to %u\n", LE_32(data)));
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_RTS_THRESHOLD, &data,
bb5e3b2f129cc39517b925419c22f69a378ec023eh sizeof (data), 0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set fragmentation threshold
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting fragmentation threshold to %u\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_FRAG_THRESHOLD, &data,
bb5e3b2f129cc39517b925419c22f69a378ec023eh sizeof (data), 0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set desired ESSID if we have
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting desired ESSID to "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "(%u),%c%c%c%c%c%c%c%c\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_ESSID, ic->ic_des_essid,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set WEP initial vector(random seed)
bb5e3b2f129cc39517b925419c22f69a378ec023eh (void) random_get_pseudo_bytes((uint8_t *)&data, sizeof (data));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Setting initialization vector to %u\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_IV, &data, sizeof (data), 0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Set WEP if any
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IEEE80211_WEP_NKID; i++) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_config(): Enabling adapter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh return (ipw2200_cmd(sc, IPW2200_CMD_ENABLE, NULL, 0, 0));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * DMA sync
bb5e3b2f129cc39517b925419c22f69a378ec023eh sc->sc_cmd_cur = RING_FORWARD(sc->sc_cmd_cur, 1, IPW2200_CMD_RING_SIZE);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_CMD_WRITE_INDEX, sc->sc_cmd_cur);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Wait for command done
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* pending */
d3d50737e566cade9a08d73d2af95105ac7cd960Rafael Vanoni if (cv_reltimedwait(&sc->sc_cmd_status_cond, &sc->sc_ilock,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_cmd(): cmd-done=%s\n", sc->sc_done[idx] ? "yes" : "no"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * If init failed, it will call stop internally. Therefore, it's unnecessary
bb5e3b2f129cc39517b925419c22f69a378ec023eh * to call ipw2200_stop() when this subroutine is failed. Otherwise, it may
bb5e3b2f129cc39517b925419c22f69a378ec023eh * be called twice.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * No firmware is available, failed
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_init(): no firmware is available\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_init(): could not reset adapter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Load boot code
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_load_fw(sc, sc->sc_fw.boot_base, sc->sc_fw.boot_size);
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_init(): could not load boot code\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Load boot microcode
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_load_uc(sc, sc->sc_fw.uc_base, sc->sc_fw.uc_size);
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_init(): could not load microcode\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Load firmware
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_load_fw(sc, sc->sc_fw.fw_base, sc->sc_fw.fw_size);
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_init(): could not load firmware\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Hardware will be enabled after configuration
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_init(): device configuration failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * workround to prevent too many h/w error.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * delay for a while till h/w is stable.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * get hardware configurations from EEPROM embedded within PRO/2200
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Get mac address
bb5e3b2f129cc39517b925419c22f69a378ec023eh * formatted MAC address string
bb5e3b2f129cc39517b925419c22f69a378ec023eh "%02x:%02x:%02x:%02x:%02x:%02x",
bb5e3b2f129cc39517b925419c22f69a378ec023eh * all ipw2200 interrupts will be masked by this routine
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh * disable interrupts
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_RST, IPW2200_RST_STOP_MASTER);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * wait long enough to ensure hardware stop successfully.
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* wait for a while */
faceed938d6ba7344a332694084d213905e93375fei feng - Sun Microsystems - Beijing China if (ntries == 500)
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_master_stop(): timeout\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * all ipw2200 interrupts will be masked by this routine
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Move adapter to DO state
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_CTL, tmp | IPW2200_CTL_INIT);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Initialize Phase-Locked Level (PLL)
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_READ_INT, IPW2200_READ_INT_INIT_HOST);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Wait for clock stabilization
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_chip_reset(): timeout\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_RST, tmp | IPW2200_RST_SW_RESET);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_CTL, tmp | IPW2200_CTL_INIT);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * clear NIC memory
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < 0xc000; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * This function is used by wificonfig/dladm to get the current
bb5e3b2f129cc39517b925419c22f69a378ec023eh * radio status, it is off/on
bb5e3b2f129cc39517b925419c22f69a378ec023eh * This function is used to get the statistic
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_get_statistic(): fw doesn't download yet."));
bb5e3b2f129cc39517b925419c22f69a378ec023eh size = min(ipw2200_csr_get32(sc, IPW2200_CSR_TABLE0_SIZE), 128 - 1);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_getbuf32(sc, IPW2200_CSR_TABLE0_BASE, &buf[1], size);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * To retrieve the statistic information into proper places. There are
bb5e3b2f129cc39517b925419c22f69a378ec023eh * lot of information. These table will be read once a second.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Hopefully, it will not effect the performance.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * For the tx/crc information, we can get them from chip directly;
bb5e3b2f129cc39517b925419c22f69a378ec023eh * For the rx/wep error/(rts) related information, leave them net80211.
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* WIFI_STAT_TX_FRAGS */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* WIFI_STAT_MCAST_TX */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* WIFI_STAT_TX_RETRANS */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* WIFI_STAT_TX_FAILED */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* MAC_STAT_OBYTES */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * DMA region alloc subroutine
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_dma_region_alloc(struct ipw2200_softc *sc, struct dma_region *dr,
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ddi_dma_alloc_handle(dip, &ipw2200_dma_attr, DDI_DMA_SLEEP, NULL,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_dma_region_alloc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ddi_dma_alloc_handle() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ddi_dma_mem_alloc(dr->dr_hnd, size, &ipw2200_dma_accattr,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_dma_region_alloc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ddi_dma_mem_alloc() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_dma_region_alloc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ddi_dma_addr_bind_handle() failed\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_dma_region_alloc(): get physical-base=0x%08x\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx desc ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx buffer array
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_TX_RING_SIZE; i++) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_dma_region_alloc(sc, &sc->sc_dma_txbufs[i],
bb5e3b2f129cc39517b925419c22f69a378ec023eh while (i >= 0) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh * rx buffer array
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_RX_RING_SIZE; i++) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_dma_region_alloc(sc, &sc->sc_dma_rxbufs[i],
bb5e3b2f129cc39517b925419c22f69a378ec023eh while (i >= 0) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh * cmd desc ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2200_CMD_RING_SIZE * sizeof (struct ipw2200_cmd_desc),
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_RX_RING_SIZE; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_TX_RING_SIZE; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx ring desc
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_TX_RING_SIZE; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_RX_RING_SIZE; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * command ring desc
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx desc ring & buffer array
bb5e3b2f129cc39517b925419c22f69a378ec023eh sc->sc_txdsc = (struct ipw2200_tx_desc *)sc->sc_dma_txdsc.dr_base;
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_TX_RING_SIZE; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023eh sc->sc_txbufs[i] = (uint8_t *)sc->sc_dma_txbufs[i].dr_base;
bb5e3b2f129cc39517b925419c22f69a378ec023eh * rx buffer array
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_RX_RING_SIZE; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023eh sc->sc_rxbufs[i] = (uint8_t *)sc->sc_dma_rxbufs[i].dr_base;
bb5e3b2f129cc39517b925419c22f69a378ec023eh * command desc ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh sc->sc_cmdsc = (struct ipw2200_cmd_desc *)sc->sc_dma_cmdsc.dr_base;
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx, rx rings and command initialization
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh * command desc ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_CMD_BASE, sc->sc_dma_cmdsc.dr_pbase);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_CMD_SIZE, IPW2200_CMD_RING_SIZE);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_CMD_WRITE_INDEX, sc->sc_cmd_cur);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx desc ring. only tx1 is used, tx2, tx3, and tx4 are unused
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX1_BASE, sc->sc_dma_txdsc.dr_pbase);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX1_SIZE, IPW2200_TX_RING_SIZE);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX1_WRITE_INDEX, sc->sc_tx_cur);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx2, tx3, tx4 is not used
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX2_BASE, sc->sc_dma_txdsc.dr_pbase);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX2_SIZE, IPW2200_TX_RING_SIZE);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX3_BASE, sc->sc_dma_txdsc.dr_pbase);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX3_SIZE, IPW2200_TX_RING_SIZE);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX4_BASE, sc->sc_dma_txdsc.dr_pbase);
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX4_SIZE, IPW2200_TX_RING_SIZE);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * rx buffer ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i < IPW2200_RX_RING_SIZE; i++)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * all rx buffer are empty, rx-rd-index == 0 && rx-wr-index == N-1
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_start_scan(): start scanning \n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * start scanning
bb5e3b2f129cc39517b925419c22f69a378ec023eh scan.type = (ic->ic_des_esslen != 0) ? IPW2200_SCAN_TYPE_BDIRECTED :
bb5e3b2f129cc39517b925419c22f69a378ec023eh scan.dwelltime = LE_16(40); /* The interval is set up to 40 */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Compact supported channel number(5G) into a single buffer
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Compact supported channel number(2G) into a single buffer
bb5e3b2f129cc39517b925419c22f69a378ec023eh for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh return (ipw2200_cmd(sc, IPW2200_CMD_SCAN, &scan, sizeof (scan), 1));
924f3e72988efae04c4357a6686a06ba300bab18eh /* already associated */
924f3e72988efae04c4357a6686a06ba300bab18eh return (-1);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set the confiuration
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* enable b/g auto-detection */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set the essid, may be null/hidden AP
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_auth_and_assoc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "setting ESSID to(%u),%c%c%c%c%c%c%c%c\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_ESSID, in->in_essid,
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set the rate: the rate set has already been ''negocitated''
bb5e3b2f129cc39517b925419c22f69a378ec023eh (void) memcpy(rs.rates, in->in_rates.ir_rates, in->in_rates.ir_nrates);
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_auth_and_assoc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "setting negotiated rates to(nrates = %u)\n", rs.nrates));
bb5e3b2f129cc39517b925419c22f69a378ec023eh err = ipw2200_cmd(sc, IPW2200_CMD_SET_RATES, &rs, sizeof (rs), 1);
924f3e72988efae04c4357a6686a06ba300bab18eh * invoke command associate
924f3e72988efae04c4357a6686a06ba300bab18eh * set opt_ie to h/w if associated is WPA, opt_ie has been verified
924f3e72988efae04c4357a6686a06ba300bab18eh * by net80211 kernel module.
924f3e72988efae04c4357a6686a06ba300bab18eh "ipw2200_auth_and_assoc(): "
924f3e72988efae04c4357a6686a06ba300bab18eh "set wpa_ie and wpa_ie_len to h/w. "
924f3e72988efae04c4357a6686a06ba300bab18eh "length is %d\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[0] = %02X - element vendor\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[1] = %02X - length\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[2,3,4] = %02X %02X %02X - oui\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[5] = %02X - oui type\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[6,7] = %02X %02X - spec version \n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[8,9,10,11] = %02X %02X %02X %02X - gk cipher\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[12,13] = %02X %02X - pairwise key cipher(1)\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[14,15,16,17] = %02X %02X %02X %02X - ciphers\n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[18,19] = %02X %02X - authselcont(1) \n"
924f3e72988efae04c4357a6686a06ba300bab18eh "opt_ie[20,21,22,23] = %02X %02X %02X %02X - authsels\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh * set the sensitive
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_auth_and_assoc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "setting sensitivity to rssi:(%u)\n", (uint8_t)in->in_rssi));
924f3e72988efae04c4357a6686a06ba300bab18eh * set mode and channel for assocation command
bb5e3b2f129cc39517b925419c22f69a378ec023eh * use the value set to ic_bss to retraive current sharedmode
bb5e3b2f129cc39517b925419c22f69a378ec023eh assoc.auth = (ic->ic_def_txkey << 4) | IPW2200_AUTH_SHARED;
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_auth_and_assoc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "associate to shared key mode, set thru. ioctl"));
924f3e72988efae04c4357a6686a06ba300bab18eh assoc.policy = LE_16(IPW2200_POLICY_WPA); /* RSN/WPA active */
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_auth_and_assoc(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "associate to bssid(%2x:%2x:%2x:%2x:%2x:%2x:), "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "chan(%u), auth(%u)\n",
924f3e72988efae04c4357a6686a06ba300bab18eh * Send the dis-association command to h/w, will receive notification to claim
924f3e72988efae04c4357a6686a06ba300bab18eh * the connection is dis-associated. So, it's not marked as disassociated this
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* ARGSUSED */
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_newstate(struct ieee80211com *ic, enum ieee80211_state state, int arg)
bb5e3b2f129cc39517b925419c22f69a378ec023eh switch (state) {
924f3e72988efae04c4357a6686a06ba300bab18eh * The firmware will fail if we are already associated
bb5e3b2f129cc39517b925419c22f69a378ec023eh * We can send data now; update the fastpath with our
bb5e3b2f129cc39517b925419c22f69a378ec023eh * current associated BSSID and other relevant settings.
924f3e72988efae04c4357a6686a06ba300bab18eh * notify to update the link, and WPA
bb5e3b2f129cc39517b925419c22f69a378ec023eh if ((ic->ic_state != IEEE80211_S_RUN) && (state == IEEE80211_S_RUN)) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_newstat(): %s -> %s\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh * GLD operations
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* ARGSUSED */
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2200_DBG(IPW2200_DBG_GLD, (((struct ipw2200_softc *)arg)->sc_dip,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_stat(): enter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Some of below statistic data are from hardware, some from net80211
bb5e3b2f129cc39517b925419c22f69a378ec023eh switch (stat) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Get below from hardware statistic, retraive net80211 value once 1s
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Get blow information from net80211
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Need be supported later
bb5e3b2f129cc39517b925419c22f69a378ec023eh return (0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* ARGSUSED */
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_m_multicst(void *arg, boolean_t add, const uint8_t *mca)
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* not supported */
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2200_DBG(IPW2200_DBG_GLD, (((struct ipw2200_softc *)arg)->sc_dip,
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_multicst(): enter\n"));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh return (0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Multithread handler for linkstatus, fatal error recovery, get statistic
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_thread(): enter, linkstate %d\n", sc->sc_linkstate));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * when radio is off or SUSPEND status, nothing to do
bb5e3b2f129cc39517b925419c22f69a378ec023eh * notify the link state
bb5e3b2f129cc39517b925419c22f69a378ec023eh if (ic->ic_mach && (sc->sc_flags & IPW2200_FLAG_LINK_CHANGE)) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_thread(): link status --> %d\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh * recovery fatal error
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_thread(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "try to recover fatal hw error\n"));
924f3e72988efae04c4357a6686a06ba300bab18eh /* stop again */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * workround. Delay for a while after init especially
bb5e3b2f129cc39517b925419c22f69a378ec023eh * when something wrong happened already.
982d85fc28969b583003622c0bd41d9db0ccecd7eh * Init scan will recovery the original connection if
982d85fc28969b583003622c0bd41d9db0ccecd7eh * the original state is run
bb5e3b2f129cc39517b925419c22f69a378ec023eh * get statistic, the value will be retrieved by m_stat
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_start(): enter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * initialize ipw2200 hardware, everything ok will start scan
982d85fc28969b583003622c0bd41d9db0ccecd7eh * set the state machine to INIT
924f3e72988efae04c4357a6686a06ba300bab18eh * fix KCF bug. - workaround, need to fix it in net80211
922d2c76afbee21520ffa2088c4e60dcb80d3945eh return (0);
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_stop(): enter\n"));
982d85fc28969b583003622c0bd41d9db0ccecd7eh * set the state machine to INIT
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_unicst(): enter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_unicst(): GLD setting MAC address to "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "%02x:%02x:%02x:%02x:%02x:%02x\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_unicst(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "device configuration failed\n"));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh return (0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* not supported */
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_promisc(): enter. "
922d2c76afbee21520ffa2088c4e60dcb80d3945eh return (0);
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * when driver in on suspend state, freemsgchain directly
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_m_tx(): suspend status, discard msg\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * No data frames go out unless we're associated; this
bb5e3b2f129cc39517b925419c22f69a378ec023eh * should not happen as the 802.11 layer does not enable
bb5e3b2f129cc39517b925419c22f69a378ec023eh * the xmit queue until we enter the RUN state.
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_tx(): discard msg, ic_state = %u\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh return (mp);
924f3e72988efae04c4357a6686a06ba300bab18eh * ipw2200_send(): send data. softway to handle crypto_encap.
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_send(ieee80211com_t *ic, mblk_t *mp, uint8_t type)
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* tmp pointer, used to pack header and payload */
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_send(): enter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh if ((type & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_DATA) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh * skip all management frames since ipw2200 won't generate any
bb5e3b2f129cc39517b925419c22f69a378ec023eh * management frames. Therefore, drop this package.
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * when sending data, system runs into suspend status,
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * return fail directly
bb5e3b2f129cc39517b925419c22f69a378ec023eh * need 1 empty descriptor
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_send(): no enough descriptors(%d)\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_send(): tx-free=%d,tx-curr=%d\n",
924f3e72988efae04c4357a6686a06ba300bab18eh * put the mp into one blk, and use it to do the crypto_encap
924f3e72988efae04c4357a6686a06ba300bab18eh * if necessaary.
924f3e72988efae04c4357a6686a06ba300bab18eh if (m == NULL) { /* can not alloc buf, drop this package */
924f3e72988efae04c4357a6686a06ba300bab18eh "ipw2200_send(): msg allocation failed\n"));
924f3e72988efae04c4357a6686a06ba300bab18eh * find tx_node, and encapsulate the data
bb5e3b2f129cc39517b925419c22f69a378ec023eh if (in == NULL) { /* can not find the tx node, drop the package */
924f3e72988efae04c4357a6686a06ba300bab18eh if (k == NULL) { /* can not get the key, drop packages */
924f3e72988efae04c4357a6686a06ba300bab18eh "ipw2200_send(): "
924f3e72988efae04c4357a6686a06ba300bab18eh "Encrypting 802.11 frame failed\n"));
924f3e72988efae04c4357a6686a06ba300bab18eh * get txdsc
bb5e3b2f129cc39517b925419c22f69a378ec023eh * extract header from message
bb5e3b2f129cc39517b925419c22f69a378ec023eh * extract payload from message
924f3e72988efae04c4357a6686a06ba300bab18eh /* always set it to none wep, because it's handled by software */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * DMA sync: buffer and desc
bb5e3b2f129cc39517b925419c22f69a378ec023eh sc->sc_tx_cur = RING_FORWARD(sc->sc_tx_cur, 1, IPW2200_TX_RING_SIZE);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * update txcur
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_TX1_WRITE_INDEX, sc->sc_tx_cur);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * success, free the original message
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IOCTL handlers
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_m_ioctl(): enter\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Check whether or not need to handle this in net80211
bb5e3b2f129cc39517b925419c22f69a378ec023eh if (ipw2200_ioctl(sc, q, m) == IEEE80211_IOCTL_NOT_REQUIRED)
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_ioctl(struct ipw2200_softc *sc, queue_t *q, mblk_t *m)
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_ioctl(): ioctl buffer too short, %u\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Buf not enough, do not need net80211 either
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Validate the command
bb5e3b2f129cc39517b925419c22f69a378ec023eh switch (cmd) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Unknown cmd, do not need net80211 either
eae72b5b807baa9116e64502cbb278edf15f3146Sebastien Roy if (need_privilege && (ret = secpolicy_dl_config(iocp->ioc_cr)) != 0) {
eae72b5b807baa9116e64502cbb278edf15f3146Sebastien Roy * privilege check fail, do not need net80211 either
bb5e3b2f129cc39517b925419c22f69a378ec023eh * sanity check
bb5e3b2f129cc39517b925419c22f69a378ec023eh if (iocp->ioc_count == 0 || iocp->ioc_count < sizeof (wldp_t) ||
bb5e3b2f129cc39517b925419c22f69a378ec023eh * invalid format, do not need net80211 either
bb5e3b2f129cc39517b925419c22f69a378ec023eh * assuming single data block
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_ioctl(): go to call miocack with "
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IEEE80211_IOCTL - need net80211 handle
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_getset(struct ipw2200_softc *sc, mblk_t *m, uint32_t cmd,
bb5e3b2f129cc39517b925419c22f69a378ec023eh switch (id) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh case WL_DESIRED_RATES: /* hardware doesn't support fix-rates */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * The wifi IOCTL net80211 supported:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_ESSID:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_BSSID:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_WEP_KEY_TAB:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_WEP_KEY_ID:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_AUTH_MODE:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_ENCRYPTION:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_BSS_TYPE:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_ESS_LIST:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_LINKSTATUS:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_RSSI:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_SCAN:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_LOAD_DEFAULTS:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * case WL_DISASSOCIATE:
9e2cd38c103ae52a41b09823a11c9b5c059555f0eh * When radio is off, need to ignore all ioctl. What need to
9e2cd38c103ae52a41b09823a11c9b5c059555f0eh * do is to check radio status firstly. If radio is ON, pass
9e2cd38c103ae52a41b09823a11c9b5c059555f0eh * it to net80211, otherwise, return to upper layer directly.
9e2cd38c103ae52a41b09823a11c9b5c059555f0eh * Considering the WL_SUCCESS also means WL_CONNECTED for
9e2cd38c103ae52a41b09823a11c9b5c059555f0eh * checking linkstatus, one exception for WL_LINKSTATUS is to
9e2cd38c103ae52a41b09823a11c9b5c059555f0eh * let net80211 handle it.
9e2cd38c103ae52a41b09823a11c9b5c059555f0eh "iwi: radio is OFF\n"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh return (0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * we will overwrite everything
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China * Call back functions for get/set proporty
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing Chinaipw2200_m_getprop(void *arg, const char *pr_name, mac_prop_id_t wldp_pr_num,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China struct ipw2200_softc *sc = (struct ipw2200_softc *)arg;
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China struct ieee80211com *ic = &sc->sc_ic;
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China switch (wldp_pr_num) {
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China /* mac_prop_id */
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China case MAC_PROP_WL_DESIRED_RATES:
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China IPW2200_DBG(IPW2200_DBG_BRUSSELS, (sc->sc_dip, CE_CONT,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China "ipw2200_m_getprop(): Not Support DESIRED_RATES\n"));
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China case MAC_PROP_WL_RADIO:
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China *(wl_linkstatus_t *)wldp_buf = ipw2200_radio_status(sc);
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China /* go through net80211 */
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer err = ieee80211_getprop(ic, pr_name, wldp_pr_num,
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyeripw2200_m_propinfo(void *arg, const char *pr_name,
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer mac_prop_id_t wlpd_pr_num, mac_prop_info_handle_t mph)
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer struct ipw2200_softc *sc = (struct ipw2200_softc *)arg;
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer ieee80211_propinfo(ic, pr_name, wlpd_pr_num, mph);
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing Chinaipw2200_m_setprop(void *arg, const char *pr_name, mac_prop_id_t wldp_pr_num,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China uint_t wldp_length, const void *wldp_buf)
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China struct ipw2200_softc *sc = (struct ipw2200_softc *)arg;
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China struct ieee80211com *ic = &sc->sc_ic;
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China switch (wldp_pr_num) {
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China /* mac_prop_id */
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China case MAC_PROP_WL_DESIRED_RATES:
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China IPW2200_DBG(IPW2200_DBG_BRUSSELS, (sc->sc_dip, CE_CONT,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China "ipw2200_m_setprop(): Not Support DESIRED_RATES\n"));
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China case MAC_PROP_WL_RADIO:
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China IPW2200_DBG(IPW2200_DBG_BRUSSELS, (sc->sc_dip, CE_CONT,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China "ipw2200_m_setprop(): Not Support RADIO\n"));
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China /* go through net80211 */
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China err = ieee80211_setprop(ic, pr_name, wldp_pr_num, wldp_length,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China if (err == ENETRESET) {
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China if (sc->sc_flags & IPW2200_FLAG_RUNNING) {
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China (void) ipw2200_m_start(sc);
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China (void) ieee80211_new_state(ic,
7efa17f5f4c3cc113e1b0a1e86f43d4bf2ede8fafei feng - Sun Microsystems - Beijing China IEEE80211_S_SCAN, -1);
bb5e3b2f129cc39517b925419c22f69a378ec023ehiwi_wificfg_radio(struct ipw2200_softc *sc, uint32_t cmd, wldp_t *outfp)
bb5e3b2f129cc39517b925419c22f69a378ec023eh switch (cmd) {
bb5e3b2f129cc39517b925419c22f69a378ec023eh outfp->wldp_length = WIFI_BUF_OFFSET + sizeof (wl_linkstatus_t);
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* return success, but with result NOTSUPPORTED */
bb5e3b2f129cc39517b925419c22f69a378ec023eh return (0);
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* End of IOCTL Handlers */
bb5e3b2f129cc39517b925419c22f69a378ec023eh if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_MGT)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * assume the message contains only 1 block
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_rcv_frame(struct ipw2200_softc *sc, struct ipw2200_frame *frame)
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_frame(): bad frame length=%u\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_frame(): chan = %d, length = %d\n", frame->chan, len));
924f3e72988efae04c4357a6686a06ba300bab18eh * Skip the frame header, get the real data from the input
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_frame(): "
924f3e72988efae04c4357a6686a06ba300bab18eh "type = %x, subtype = %x, i_fc[1] = %x, "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ni_esslen:%d, ni_essid[0-5]:%c%c%c%c%c%c\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_frame(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "cannot allocate receive message(%u)\n",
bb5e3b2f129cc39517b925419c22f69a378ec023ehstatic void
bb5e3b2f129cc39517b925419c22f69a378ec023ehipw2200_rcv_notif(struct ipw2200_softc *sc, struct ipw2200_notif *notif)
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_notif(): association=%u,%u\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_notif(): authentication=%u\n", auth->state));
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_notif(): "
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_notif(): scan-channel=%u\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_notif():scan-completed,(%u,%u)\n",
bb5e3b2f129cc39517b925419c22f69a378ec023eh * scan complete
bb5e3b2f129cc39517b925419c22f69a378ec023eh * just ignore
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_rcv_notif(): unknown notification type(%u)\n",
922d2c76afbee21520ffa2088c4e60dcb80d3945eh struct ipw2200_softc *sc = (struct ipw2200_softc *)(uintptr_t)arg;
922d2c76afbee21520ffa2088c4e60dcb80d3945eh /* when it is on suspend, unclaim all interrupt directly */
922d2c76afbee21520ffa2088c4e60dcb80d3945eh /* unclaim interrupt when it is not for iwi */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * mask all interrupts
bb5e3b2f129cc39517b925419c22f69a378ec023eh * acknowledge all fired interrupts
bb5e3b2f129cc39517b925419c22f69a378ec023eh "ipw2200_intr(): enter. interrupt fired, int=0x%08x\n", ireg));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * inform mfthread to recover hw error by stopping it
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * Radio OFF
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_intr(): radio is OFF\n"));
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * Stop hardware, will notify LINK is down.
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * Need a better scan solution to ensure
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * table has right value.
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * CMD intr
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_intr(): cmd-ring,i=%u,ridx=%u,len=%u\n",
922d2c76afbee21520ffa2088c4e60dcb80d3945eh if (len > 0) {
922d2c76afbee21520ffa2088c4e60dcb80d3945eh for (; i != ridx;
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_intr(): rx-ring,widx=%u,ridx=%u\n",
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * DMA sync
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * Get rx header(hdr) and rx data(p) from rxbuf
922d2c76afbee21520ffa2088c4e60dcb80d3945eh p += sizeof (struct ipw2200_hdr);
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_intr(): Rx hdr type %u\n",
922d2c76afbee21520ffa2088c4e60dcb80d3945eh (struct ipw2200_frame *)p);
922d2c76afbee21520ffa2088c4e60dcb80d3945eh (struct ipw2200_notif *)p);
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_intr(): unknown Rx hdr type %u\n",
922d2c76afbee21520ffa2088c4e60dcb80d3945eh * write sc_rx_cur backward 1 step into RX_WRITE_INDEX
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_intr(): tx-ring,ridx=%u,len=%u\n",
922d2c76afbee21520ffa2088c4e60dcb80d3945eh "ipw2200_intr(): Need Reschedule!"));
bb5e3b2f129cc39517b925419c22f69a378ec023eh * enable all interrupts
bb5e3b2f129cc39517b925419c22f69a378ec023eh ipw2200_csr_put32(sc, IPW2200_CSR_INTR_MASK, IPW2200_INTR_MASK_ALL);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Module Loading Data & Entry Points
bb5e3b2f129cc39517b925419c22f69a378ec023ehDDI_DEFINE_STREAM_OPS(ipw2200_devops, nulldev, nulldev, ipw2200_attach,