ath9k: kill ath9k's memzero() and use memset() instead
[safe/jmp/linux-2.6] / drivers / net / wireless / hermes.h
index ad28e32..8b13c8f 100644 (file)
 #define HERMES_802_11_OFFSET           (14)
 #define HERMES_802_3_OFFSET            (14+32)
 #define HERMES_802_2_OFFSET            (14+32+14)
+#define HERMES_TXCNTL2_OFFSET          (HERMES_802_3_OFFSET - 2)
 
 #define HERMES_RXSTAT_ERR              (0x0003)
 #define        HERMES_RXSTAT_BADCRC            (0x0001)
 #define        HERMES_RXSTAT_UNDECRYPTABLE     (0x0002)
+#define        HERMES_RXSTAT_MIC               (0x0010)        /* Frame contains MIC */
 #define        HERMES_RXSTAT_MACPORT           (0x0700)
 #define HERMES_RXSTAT_PCF              (0x1000)        /* Frame was received in CF period */
+#define        HERMES_RXSTAT_MIC_KEY_ID        (0x1800)        /* MIC key used */
 #define        HERMES_RXSTAT_MSGTYPE           (0xE000)
 #define        HERMES_RXSTAT_1042              (0x2000)        /* RFC-1042 frame */
 #define        HERMES_RXSTAT_TUNNEL            (0x4000)        /* bridge-tunnel encoded frame */
 #define        HERMES_RXSTAT_WMP               (0x6000)        /* Wavelan-II Management Protocol frame */
 
+/* Shift amount for key ID in RXSTAT and TXCTRL */
+#define        HERMES_MIC_KEY_ID_SHIFT         11
+
 struct hermes_tx_descriptor {
        __le16 status;
        __le16 reserved1;
@@ -208,6 +214,8 @@ struct hermes_tx_descriptor {
 #define HERMES_TXCTRL_TX_OK            (0x0002)        /* ?? interrupt on Tx complete */
 #define HERMES_TXCTRL_TX_EX            (0x0004)        /* ?? interrupt on Tx exception */
 #define HERMES_TXCTRL_802_11           (0x0008)        /* We supply 802.11 header */
+#define HERMES_TXCTRL_MIC              (0x0010)        /* 802.3 + TKIP */
+#define HERMES_TXCTRL_MIC_KEY_ID       (0x1800)        /* MIC Key ID mask */
 #define HERMES_TXCTRL_ALT_RTRY         (0x0020)
 
 /* Inquiry constants and data types */
@@ -302,6 +310,40 @@ union hermes_scan_info {
        struct symbol_scan_apinfo       s;
 };
 
+/* Extended scan struct for HERMES_INQ_CHANNELINFO.
+ * wl_lkm calls this an ACS scan (Automatic Channel Select).
+ * Keep out of union hermes_scan_info because it is much bigger than
+ * the older scan structures. */
+struct agere_ext_scan_info {
+       __le16  reserved0;
+
+       u8      noise;
+       u8      level;
+       u8      rx_flow;
+       u8      rate;
+       __le16  reserved1[2];
+
+       __le16  frame_control;
+       __le16  dur_id;
+       u8      addr1[ETH_ALEN];
+       u8      addr2[ETH_ALEN];
+       u8      bssid[ETH_ALEN];
+       __le16  sequence;
+       u8      addr4[ETH_ALEN];
+
+       __le16  data_length;
+
+       /* Next 3 fields do not get filled in. */
+       u8      daddr[ETH_ALEN];
+       u8      saddr[ETH_ALEN];
+       __le16  len_type;
+
+       __le64  timestamp;
+       __le16  beacon_interval;
+       __le16  capabilities;
+       u8      data[316];
+} __attribute__ ((packed));
+
 #define HERMES_LINKSTATUS_NOT_CONNECTED   (0x0000)  
 #define HERMES_LINKSTATUS_CONNECTED       (0x0001)
 #define HERMES_LINKSTATUS_DISCONNECTED    (0x0002)
@@ -328,16 +370,6 @@ struct hermes_multicast {
        u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN];
 } __attribute__ ((packed));
 
-// #define HERMES_DEBUG_BUFFER 1
-#define HERMES_DEBUG_BUFSIZE 4096
-struct hermes_debug_entry {
-       int bap;
-       u16 id, offset;
-       int cycles;
-};
-
-#ifdef __KERNEL__
-
 /* Timeouts */
 #define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */
 
@@ -347,14 +379,7 @@ typedef struct hermes {
        int reg_spacing;
 #define HERMES_16BIT_REGSPACING        0
 #define HERMES_32BIT_REGSPACING        1
-
        u16 inten; /* Which interrupts should be enabled? */
-
-#ifdef HERMES_DEBUG_BUFFER
-       struct hermes_debug_entry dbuf[HERMES_DEBUG_BUFSIZE];
-       unsigned long dbufp;
-       unsigned long profile[HERMES_BAP_BUSY_TIMEOUT+1];
-#endif
 } hermes_t;
 
 /* Register access convenience macros */
@@ -370,11 +395,14 @@ void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing);
 int hermes_init(hermes_t *hw);
 int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
                      struct hermes_response *resp);
+int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
+                      u16 parm0, u16 parm1, u16 parm2,
+                      struct hermes_response *resp);
 int hermes_allocate(hermes_t *hw, u16 size, u16 *fid);
 
-int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len,
+int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
                       u16 id, u16 offset);
-int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len,
+int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
                        u16 id, u16 offset);
 int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen,
                    u16 *length, void *buf);
@@ -423,10 +451,13 @@ static inline void hermes_read_words(struct hermes *hw, int off, void *buf, unsi
        ioread16_rep(hw->iobase + off, buf, count);
 }
 
-static inline void hermes_write_words(struct hermes *hw, int off, const void *buf, unsigned count)
+static inline void hermes_write_bytes(struct hermes *hw, int off,
+                                     const char *buf, unsigned count)
 {
        off = off << hw->reg_spacing;
-       iowrite16_rep(hw->iobase + off, buf, count);
+       iowrite16_rep(hw->iobase + off, buf, count >> 1);
+       if (unlikely(count & 1))
+               iowrite8(buf[count - 1], hw->iobase + off);
 }
 
 static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count)
@@ -460,21 +491,4 @@ static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word)
        return HERMES_WRITE_RECORD(hw, bap, rid, &rec);
 }
 
-#else /* ! __KERNEL__ */
-
-/* These are provided for the benefit of userspace drivers and testing programs
-   which use ioperm() or iopl() */
-
-#define hermes_read_reg(base, off) (inw((base) + (off)))
-#define hermes_write_reg(base, off, val) (outw((val), (base) + (off)))
-
-#define hermes_read_regn(base, name) (hermes_read_reg((base), HERMES_##name))
-#define hermes_write_regn(base, name, val) (hermes_write_reg((base), HERMES_##name, (val)))
-
-/* Note that for the next two, the count is in 16-bit words, not bytes */
-#define hermes_read_data(base, off, buf, count) (insw((base) + (off), (buf), (count)))
-#define hermes_write_data(base, off, buf, count) (outsw((base) + (off), (buf), (count)))
-
-#endif /* ! __KERNEL__ */
-
 #endif  /* _HERMES_H */