[ath_hal] [ath_hal_ar9300] Fix endian macros to work in and out of kernel tree.
Yes, people shouldn't use bitfields in C for structure parsing. If someone ever wants a cleanup task then it'd be great to remove them from this vendor code and other places in the ar9285/ar9287 HALs. Alas, here we are. AH_BYTE_ORDER wasn't defined and neither were the two values it could be. So when compiling ath_ee_print_9300 it'd default to the big endian struct layout and get a WHOLE lot of stuff wrong. So: * move AH_BYTE_ORDER into ath_hal/ah.h where it can be used by everyone. * ensure that AH_BYTE_ORDER is actually defined before using it! This should work on both big and little endian platforms.
This commit is contained in:
parent
16ade779ef
commit
41137b0604
@ -19,18 +19,14 @@
|
||||
|
||||
#include "ar9300_freebsd_inc.h"
|
||||
|
||||
#define AH_BIG_ENDIAN 4321
|
||||
#define AH_LITTLE_ENDIAN 1234
|
||||
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
#define AH_BYTE_ORDER AH_BIG_ENDIAN
|
||||
#else
|
||||
#define AH_BYTE_ORDER AH_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
/* XXX doesn't belong here */
|
||||
#define AR_EEPROM_MODAL_SPURS 5
|
||||
|
||||
/* Ensure that AH_BYTE_ORDER is defined */
|
||||
#ifndef AH_BYTE_ORDER
|
||||
#error AH_BYTE_ORDER needs to be defined!
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (a) this should be N(a),
|
||||
* (b) FreeBSD does define nitems,
|
||||
@ -43,10 +39,8 @@
|
||||
#include "ah_devid.h"
|
||||
#include "ar9300eep.h" /* For Eeprom definitions */
|
||||
|
||||
|
||||
#define AR9300_MAGIC 0x19741014
|
||||
|
||||
|
||||
/* MAC register values */
|
||||
|
||||
#define INIT_CONFIG_STATUS 0x00000000
|
||||
|
@ -18,13 +18,17 @@
|
||||
#define _ATH_AR9300_EEP_H_
|
||||
|
||||
#include "opt_ah.h"
|
||||
|
||||
#include "ah.h"
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#pragma pack (push, ar9300, 1)
|
||||
#endif
|
||||
|
||||
/* Ensure that AH_BYTE_ORDER is defined */
|
||||
#ifndef AH_BYTE_ORDER
|
||||
#error AH_BYTE_ORDER needs to be defined!
|
||||
#endif
|
||||
|
||||
/* FreeBSD extras - should be in ah_eeprom.h ? */
|
||||
#define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001
|
||||
#define AR_EEPROM_EEPCAP_AES_DIS 0x0002
|
||||
@ -345,11 +349,13 @@ typedef struct CalCtlEdgePwr {
|
||||
u_int8_t flag :2,
|
||||
t_power :6;
|
||||
} __packed CAL_CTL_EDGE_PWR;
|
||||
#else
|
||||
#elif AH_BYTE_ORDER == AH_LITTLE_ENDIAN
|
||||
typedef struct CalCtlEdgePwr {
|
||||
u_int8_t t_power :6,
|
||||
flag :2;
|
||||
} __packed CAL_CTL_EDGE_PWR;
|
||||
#else
|
||||
#error AH_BYTE_ORDER undefined!
|
||||
#endif
|
||||
|
||||
typedef struct ospCalCtlData_5G {
|
||||
|
@ -32,6 +32,18 @@
|
||||
|
||||
#include "ah_osdep.h"
|
||||
|
||||
/*
|
||||
* Endianness macros; used by various structures and code.
|
||||
*/
|
||||
#define AH_BIG_ENDIAN 4321
|
||||
#define AH_LITTLE_ENDIAN 1234
|
||||
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
#define AH_BYTE_ORDER AH_BIG_ENDIAN
|
||||
#else
|
||||
#define AH_BYTE_ORDER AH_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The maximum number of TX/RX chains supported.
|
||||
* This is intended to be used by various statistics gathering operations
|
||||
|
Loading…
x
Reference in New Issue
Block a user