iwlagn: simplify error table reading
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-commands.h
index 0edba8a..7aea7b3 100644 (file)
@@ -422,49 +422,61 @@ struct iwl_tx_ant_config_cmd {
  *
  * 2)  error_event_table_ptr indicates base of the error log.  This contains
  *     information about any uCode error that occurs.  For agn, the format
- *     of the error log is:
- *
- *     __le32 valid;        (nonzero) valid, (0) log is empty
- *     __le32 error_id;     type of error
- *     __le32 pc;           program counter
- *     __le32 blink1;       branch link
- *     __le32 blink2;       branch link
- *     __le32 ilink1;       interrupt link
- *     __le32 ilink2;       interrupt link
- *     __le32 data1;        error-specific data
- *     __le32 data2;        error-specific data
- *     __le32 line;         source code line of error
- *     __le32 bcon_time;    beacon timer
- *     __le32 tsf_low;      network timestamp function timer
- *     __le32 tsf_hi;       network timestamp function timer
- *     __le32 gp1;          GP1 timer register
- *     __le32 gp2;          GP2 timer register
- *     __le32 gp3;          GP3 timer register
- *     __le32 ucode_ver;    uCode version
- *     __le32 hw_ver;       HW Silicon version
- *     __le32 brd_ver;      HW board version
- *     __le32 log_pc;       log program counter
- *     __le32 frame_ptr;    frame pointer
- *     __le32 stack_ptr;    stack pointer
- *     __le32 hcmd;         last host command
- *     __le32 isr0;         isr status register LMPM_NIC_ISR0: rxtx_flag
- *     __le32 isr1;         isr status register LMPM_NIC_ISR1: host_flag
- *     __le32 isr2;         isr status register LMPM_NIC_ISR2: enc_flag
- *     __le32 isr3;         isr status register LMPM_NIC_ISR3: time_flag
- *     __le32 isr4;         isr status register LMPM_NIC_ISR4: wico interrupt
- *     __le32 isr_pref;     isr status register LMPM_NIC_PREF_STAT
- *     __le32 wait_event;   wait event() caller address
- *     __le32 l2p_control;  L2pControlField
- *     __le32 l2p_duration; L2pDurationField
- *     __le32 l2p_mhvalid;  L2pMhValidBits
- *     __le32 l2p_addr_match; L2pAddrMatchStat
- *     __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
- *     __le32 u_timestamp;  indicate when the date and time of the compilation
- *     __le32 reserved;
+ *     of the error log is defined by struct iwl_error_event_table.
  *
  * The Linux driver can print both logs to the system log when a uCode error
  * occurs.
  */
+
+/*
+ * Note: This structure is read from the device with IO accesses,
+ * and the reading already does the endian conversion. As it is
+ * read with u32-sized accesses, any members with a different size
+ * need to be ordered correctly though!
+ */
+struct iwl_error_event_table {
+       u32 valid;              /* (nonzero) valid, (0) log is empty */
+       u32 error_id;           /* type of error */
+       u32 pc;                 /* program counter */
+       u32 blink1;             /* branch link */
+       u32 blink2;             /* branch link */
+       u32 ilink1;             /* interrupt link */
+       u32 ilink2;             /* interrupt link */
+       u32 data1;              /* error-specific data */
+       u32 data2;              /* error-specific data */
+       u32 line;               /* source code line of error */
+       u32 bcon_time;          /* beacon timer */
+       u32 tsf_low;            /* network timestamp function timer */
+       u32 tsf_hi;             /* network timestamp function timer */
+       u32 gp1;                /* GP1 timer register */
+       u32 gp2;                /* GP2 timer register */
+       u32 gp3;                /* GP3 timer register */
+       u32 ucode_ver;          /* uCode version */
+       u32 hw_ver;             /* HW Silicon version */
+       u32 brd_ver;            /* HW board version */
+       u32 log_pc;             /* log program counter */
+       u32 frame_ptr;          /* frame pointer */
+       u32 stack_ptr;          /* stack pointer */
+       u32 hcmd;               /* last host command header */
+#if 0
+       /* no need to read the remainder, we don't use the values */
+       u32 isr0;               /* isr status register LMPM_NIC_ISR0: rxtx_flag */
+       u32 isr1;               /* isr status register LMPM_NIC_ISR1: host_flag */
+       u32 isr2;               /* isr status register LMPM_NIC_ISR2: enc_flag */
+       u32 isr3;               /* isr status register LMPM_NIC_ISR3: time_flag */
+       u32 isr4;               /* isr status register LMPM_NIC_ISR4: wico interrupt */
+       u32 isr_pref;           /* isr status register LMPM_NIC_PREF_STAT */
+       u32 wait_event;         /* wait event() caller address */
+       u32 l2p_control;        /* L2pControlField */
+       u32 l2p_duration;       /* L2pDurationField */
+       u32 l2p_mhvalid;        /* L2pMhValidBits */
+       u32 l2p_addr_match;     /* L2pAddrMatchStat */
+       u32 lmpm_pmg_sel;       /* indicate which clocks are turned on (LMPM_PMG_SEL) */
+       u32 u_timestamp;        /* indicate when the date and time of the compilation */
+       u32 flow_handler;       /* FH read/write pointers, RX credit */
+#endif
+} __packed;
+
 struct iwl_alive_resp {
        u8 ucode_minor;
        u8 ucode_major;