iPXE
Data Structures | Macros | Typedefs | Functions | Variables
prism2.c File Reference
#include <etherboot.h>
#include <nic.h>
#include <ipxe/pci.h>
#include <ipxe/ethernet.h>
#include "wlan_compat.h"
#include "p80211hdr.h"
#include "hfa384x.h"
#include <errno.h>

Go to the source code of this file.

Data Structures

struct  hfa384x
 
struct  wlan_llc
 
struct  wlan_snap
 
struct  wlan_80211hdr
 

Macros

#define MAX_JOIN_INFO_COUNT   2
 
#define WLAN_HOSTIF   WLAN_PLX
 
#define __LINUX_WLAN__
 
#define __I386__
 
#define BAP_TIMEOUT   ( 5000 )
 
#define __le16_to_cpu(x)   (x)
 
#define __le32_to_cpu(x)   (x)
 
#define __cpu_to_le16(x)   (x)
 
#define __cpu_to_le32(x)   (x)
 
#define hfa384x2host_16(n)   (__le16_to_cpu((uint16_t)(n)))
 
#define hfa384x2host_32(n)   (__le32_to_cpu((uint32_t)(n)))
 
#define host2hfa384x_16(n)   (__cpu_to_le16((uint16_t)(n)))
 
#define host2hfa384x_32(n)   (__cpu_to_le32((uint32_t)(n)))
 
#define PLX_LOCAL_CONFIG_REGISTER_BASE   ( PCI_BASE_ADDRESS_1 )
 
#define PLX_LOCAL_ADDRESS_SPACE_0_BASE   ( PCI_BASE_ADDRESS_2 )
 
#define PLX_LOCAL_ADDRESS_SPACE_1_BASE   ( PCI_BASE_ADDRESS_3 )
 
#define PLX_LOCAL_ADDRESS_SPACE_2_BASE   ( PCI_BASE_ADDRESS_4 )
 
#define PLX_LOCAL_ADDRESS_SPACE_3_BASE   ( PCI_BASE_ADDRESS_5 )
 
#define PRISM2_PLX_ATTR_MEM_BASE   ( PLX_LOCAL_ADDRESS_SPACE_0_BASE )
 
#define PRISM2_PLX_IO_BASE   ( PLX_LOCAL_ADDRESS_SPACE_1_BASE )
 
#define PRISM2_PCI_MEM_BASE   ( PCI_BASE_ADDRESS_0 )
 
#define CISTPL_VERS_1   ( 0x15 )
 
#define CISTPL_END   ( 0xff )
 
#define CIS_STEP   ( 2 )
 
#define CISTPL_HEADER_LEN   ( 2 * CIS_STEP )
 
#define CISTPL_LEN_OFF   ( 1 * CIS_STEP )
 
#define CISTPL_VERS_1_STR_OFF   ( 4 * CIS_STEP )
 
#define COR_OFFSET   ( 0x3e0 ) /* COR attribute offset of Prism2 PC card */
 
#define COR_VALUE   ( 0x41 ) /* Enable PC card with irq in level trigger (but interrupts disabled) */
 
#define WLAN_IEEE_OUI_LEN   3
 

Typedefs

typedef struct hfa384x hfa384x_t
 
typedef struct wlan_llc wlan_llc_t
 
typedef struct wlan_snap wlan_snap_t
 
typedef struct wlan_80211hdr wlan_80211hdr_t
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
static uint16_t hfa384x_getreg (hfa384x_t *hw, unsigned int reg)
 
static void hfa384x_setreg (hfa384x_t *hw, uint16_t val, unsigned int reg)
 
static uint16_t hfa384x_getreg_noswap (hfa384x_t *hw, unsigned int reg)
 
static void hfa384x_setreg_noswap (hfa384x_t *hw, uint16_t val, unsigned int reg)
 
static int hfa384x_docmd_wait (hfa384x_t *hw, uint16_t cmd, uint16_t parm0, uint16_t parm1, uint16_t parm2)
 
static int hfa384x_prepare_bap (hfa384x_t *hw, uint16_t id, uint16_t offset)
 
static int hfa384x_copy_from_bap (hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
 
static int hfa384x_copy_to_bap (hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
 
static int hfa384x_cmd_access (hfa384x_t *hw, uint16_t write, uint16_t rid)
 
static int hfa384x_drvr_getconfig (hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len)
 
static int hfa384x_drvr_setconfig (hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len)
 
static int hfa384x_drvr_setconfig16 (hfa384x_t *hw, uint16_t rid, uint16_t *val)
 
static int hfa384x_wait_for_event (hfa384x_t *hw, uint16_t event_mask, uint16_t event_ack, int wait, int timeout, const char *descr)
 
static int prism2_poll (struct nic *nic, int retrieve)
 
static void prism2_transmit (struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
 
static void prism2_disable (struct nic *nic __unused)
 
static void prism2_irq (struct nic *nic __unused, irq_action_t action __unused)
 
static int prism2_probe (struct nic *nic, hfa384x_t *hw)
 

Variables

static const char hardcoded_ssid [] = ""
 
static hfa384x_t hw_global
 
static const wlan_llc_t wlan_llc_snap = { 0xaa, 0xaa, 0x03 }
 
static struct nic_operations prism2_operations
 

Macro Definition Documentation

◆ MAX_JOIN_INFO_COUNT

#define MAX_JOIN_INFO_COUNT   2

Definition at line 49 of file prism2.c.

◆ WLAN_HOSTIF

#define WLAN_HOSTIF   WLAN_PLX

Definition at line 56 of file prism2.c.

◆ __LINUX_WLAN__

#define __LINUX_WLAN__

Definition at line 64 of file prism2.c.

◆ __I386__

#define __I386__

Definition at line 66 of file prism2.c.

◆ BAP_TIMEOUT

#define BAP_TIMEOUT   ( 5000 )

Definition at line 70 of file prism2.c.

◆ __le16_to_cpu

#define __le16_to_cpu (   x)    (x)

Definition at line 77 of file prism2.c.

◆ __le32_to_cpu

#define __le32_to_cpu (   x)    (x)

Definition at line 78 of file prism2.c.

◆ __cpu_to_le16

#define __cpu_to_le16 (   x)    (x)

Definition at line 79 of file prism2.c.

◆ __cpu_to_le32

#define __cpu_to_le32 (   x)    (x)

Definition at line 80 of file prism2.c.

◆ hfa384x2host_16

#define hfa384x2host_16 (   n)    (__le16_to_cpu((uint16_t)(n)))

Definition at line 82 of file prism2.c.

◆ hfa384x2host_32

#define hfa384x2host_32 (   n)    (__le32_to_cpu((uint32_t)(n)))

Definition at line 83 of file prism2.c.

◆ host2hfa384x_16

#define host2hfa384x_16 (   n)    (__cpu_to_le16((uint16_t)(n)))

Definition at line 84 of file prism2.c.

◆ host2hfa384x_32

#define host2hfa384x_32 (   n)    (__cpu_to_le32((uint32_t)(n)))

Definition at line 85 of file prism2.c.

◆ PLX_LOCAL_CONFIG_REGISTER_BASE

#define PLX_LOCAL_CONFIG_REGISTER_BASE   ( PCI_BASE_ADDRESS_1 )

Definition at line 92 of file prism2.c.

◆ PLX_LOCAL_ADDRESS_SPACE_0_BASE

#define PLX_LOCAL_ADDRESS_SPACE_0_BASE   ( PCI_BASE_ADDRESS_2 )

Definition at line 93 of file prism2.c.

◆ PLX_LOCAL_ADDRESS_SPACE_1_BASE

#define PLX_LOCAL_ADDRESS_SPACE_1_BASE   ( PCI_BASE_ADDRESS_3 )

Definition at line 94 of file prism2.c.

◆ PLX_LOCAL_ADDRESS_SPACE_2_BASE

#define PLX_LOCAL_ADDRESS_SPACE_2_BASE   ( PCI_BASE_ADDRESS_4 )

Definition at line 95 of file prism2.c.

◆ PLX_LOCAL_ADDRESS_SPACE_3_BASE

#define PLX_LOCAL_ADDRESS_SPACE_3_BASE   ( PCI_BASE_ADDRESS_5 )

Definition at line 96 of file prism2.c.

◆ PRISM2_PLX_ATTR_MEM_BASE

#define PRISM2_PLX_ATTR_MEM_BASE   ( PLX_LOCAL_ADDRESS_SPACE_0_BASE )

Definition at line 98 of file prism2.c.

◆ PRISM2_PLX_IO_BASE

#define PRISM2_PLX_IO_BASE   ( PLX_LOCAL_ADDRESS_SPACE_1_BASE )

Definition at line 99 of file prism2.c.

◆ PRISM2_PCI_MEM_BASE

#define PRISM2_PCI_MEM_BASE   ( PCI_BASE_ADDRESS_0 )

Definition at line 101 of file prism2.c.

◆ CISTPL_VERS_1

#define CISTPL_VERS_1   ( 0x15 )

Definition at line 108 of file prism2.c.

◆ CISTPL_END

#define CISTPL_END   ( 0xff )

Definition at line 109 of file prism2.c.

◆ CIS_STEP

#define CIS_STEP   ( 2 )

Definition at line 111 of file prism2.c.

◆ CISTPL_HEADER_LEN

#define CISTPL_HEADER_LEN   ( 2 * CIS_STEP )

Definition at line 112 of file prism2.c.

◆ CISTPL_LEN_OFF

#define CISTPL_LEN_OFF   ( 1 * CIS_STEP )

Definition at line 113 of file prism2.c.

◆ CISTPL_VERS_1_STR_OFF

#define CISTPL_VERS_1_STR_OFF   ( 4 * CIS_STEP )

Definition at line 114 of file prism2.c.

◆ COR_OFFSET

#define COR_OFFSET   ( 0x3e0 ) /* COR attribute offset of Prism2 PC card */

Definition at line 121 of file prism2.c.

◆ COR_VALUE

#define COR_VALUE   ( 0x41 ) /* Enable PC card with irq in level trigger (but interrupts disabled) */

Definition at line 122 of file prism2.c.

◆ WLAN_IEEE_OUI_LEN

#define WLAN_IEEE_OUI_LEN   3

Definition at line 159 of file prism2.c.

Typedef Documentation

◆ hfa384x_t

typedef struct hfa384x hfa384x_t

◆ wlan_llc_t

typedef struct wlan_llc wlan_llc_t

◆ wlan_snap_t

typedef struct wlan_snap wlan_snap_t

◆ wlan_80211hdr_t

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ hfa384x_getreg()

static uint16_t hfa384x_getreg ( hfa384x_t hw,
unsigned int  reg 
)
inlinestatic

Definition at line 183 of file prism2.c.

184 {
185 #if (WLAN_HOSTIF == WLAN_PLX)
186  return inw ( hw->iobase + reg );
187 #elif (WLAN_HOSTIF == WLAN_PCI)
188  return readw ( hw->membase + reg );
189 #endif
190 }
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
Definition: hw.c:16
static unsigned int unsigned int reg
Definition: intel.h:245

References inw(), readw(), and reg.

Referenced by hfa384x_docmd_wait(), hfa384x_getreg_noswap(), hfa384x_prepare_bap(), hfa384x_wait_for_event(), prism2_poll(), prism2_probe(), and prism2_transmit().

◆ hfa384x_setreg()

static void hfa384x_setreg ( hfa384x_t hw,
uint16_t  val,
unsigned int  reg 
)
inlinestatic

Definition at line 193 of file prism2.c.

194 {
195 #if (WLAN_HOSTIF == WLAN_PLX)
196  outw ( val, hw->iobase + reg );
197 #elif (WLAN_HOSTIF == WLAN_PCI)
198  writew ( val, hw->membase + reg );
199 #endif
200  return;
201 }
#define outw(data, io_addr)
Definition: io.h:319
Definition: hw.c:16
static unsigned int unsigned int reg
Definition: intel.h:245
void __asmcall int val
Definition: setjmp.h:28
#define writew
Definition: w89c840.c:159

References outw, reg, val, and writew.

Referenced by hfa384x_docmd_wait(), hfa384x_prepare_bap(), hfa384x_setreg_noswap(), hfa384x_wait_for_event(), prism2_poll(), and prism2_probe().

◆ hfa384x_getreg_noswap()

static uint16_t hfa384x_getreg_noswap ( hfa384x_t hw,
unsigned int  reg 
)
inlinestatic

Definition at line 207 of file prism2.c.

208 {
209  return hfa384x_getreg ( hw, reg );
210 }
Definition: hw.c:16
static unsigned int unsigned int reg
Definition: intel.h:245
static uint16_t hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:183

References hfa384x_getreg(), and reg.

Referenced by hfa384x_copy_from_bap(), and hfa384x_copy_to_bap().

◆ hfa384x_setreg_noswap()

static void hfa384x_setreg_noswap ( hfa384x_t hw,
uint16_t  val,
unsigned int  reg 
)
inlinestatic

Definition at line 211 of file prism2.c.

212 {
213  hfa384x_setreg ( hw, val, reg );
214 }
Definition: hw.c:16
static void hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg)
Definition: prism2.c:193
static unsigned int unsigned int reg
Definition: intel.h:245
void __asmcall int val
Definition: setjmp.h:28

References hfa384x_setreg(), reg, and val.

Referenced by hfa384x_copy_to_bap().

◆ hfa384x_docmd_wait()

static int hfa384x_docmd_wait ( hfa384x_t hw,
uint16_t  cmd,
uint16_t  parm0,
uint16_t  parm1,
uint16_t  parm2 
)
static

Definition at line 238 of file prism2.c.

239 {
240  uint16_t reg = 0;
241  uint16_t counter = 0;
242 
243  /* wait for the busy bit to clear */
244  counter = 0;
246  while ( HFA384x_CMD_ISBUSY(reg) && (counter < 10) ) {
248  counter++;
249  udelay(10);
250  }
251  if (HFA384x_CMD_ISBUSY(reg)) {
252  printf("hfa384x_cmd timeout(1), reg=0x%0hx.\n", reg);
253  return -ETIMEDOUT;
254  }
255 
256  /* busy bit clear, write command */
260  hw->lastcmd = cmd;
262 
263  /* Now wait for completion */
264  counter = 0;
266  /* Initialization is the problem. It takes about
267  100ms. "normal" commands are typically is about
268  200-400 us (I've never seen less than 200). Longer
269  is better so that we're not hammering the bus. */
270  while ( !HFA384x_EVSTAT_ISCMD(reg) && (counter < 5000)) {
272  counter++;
273  udelay(200);
274  }
275  if ( ! HFA384x_EVSTAT_ISCMD(reg) ) {
276  printf("hfa384x_cmd timeout(2), reg=0x%0hx.\n", reg);
277  return -ETIMEDOUT;
278  }
279 
280  /* Read status and response */
281  hw->status = hfa384x_getreg(hw, HFA384x_STATUS);
282  hw->resp0 = hfa384x_getreg(hw, HFA384x_RESP0);
283  hw->resp1 = hfa384x_getreg(hw, HFA384x_RESP1);
284  hw->resp2 = hfa384x_getreg(hw, HFA384x_RESP2);
286  return HFA384x_STATUS_RESULT_GET(hw->status);
287 }
unsigned short uint16_t
Definition: stdint.h:11
#define HFA384x_CMD
Definition: hfa384x.h:788
#define HFA384x_EVSTAT
Definition: hfa384x.h:806
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define HFA384x_PARAM2
Definition: hfa384x.h:791
#define HFA384x_PARAM1
Definition: hfa384x.h:790
#define HFA384x_CMD_ISBUSY(value)
Definition: hfa384x.h:822
#define HFA384x_EVACK_CMD
Definition: hfa384x.h:333
Definition: hw.c:16
#define HFA384x_RESP0
Definition: hfa384x.h:793
#define HFA384x_RESP2
Definition: hfa384x.h:795
#define HFA384x_STATUS
Definition: hfa384x.h:792
#define HFA384x_RESP1
Definition: hfa384x.h:794
#define HFA384x_STATUS_RESULT_GET(value)
Definition: hfa384x.h:838
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
#define HFA384x_EVSTAT_ISCMD(value)
Definition: hfa384x.h:853
static void hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg)
Definition: prism2.c:193
static unsigned int unsigned int reg
Definition: intel.h:245
static uint16_t hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:183
#define HFA384x_PARAM0
Definition: hfa384x.h:789
struct golan_eqe_cmd cmd
Definition: CIB_PRM.h:29
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:669
#define HFA384x_EVACK
Definition: hfa384x.h:808

References cmd, ETIMEDOUT, HFA384x_CMD, HFA384x_CMD_ISBUSY, HFA384x_EVACK, HFA384x_EVACK_CMD, HFA384x_EVSTAT, HFA384x_EVSTAT_ISCMD, hfa384x_getreg(), HFA384x_PARAM0, HFA384x_PARAM1, HFA384x_PARAM2, HFA384x_RESP0, HFA384x_RESP1, HFA384x_RESP2, hfa384x_setreg(), HFA384x_STATUS, HFA384x_STATUS_RESULT_GET, printf(), reg, and udelay().

Referenced by hfa384x_cmd_access(), prism2_probe(), and prism2_transmit().

◆ hfa384x_prepare_bap()

static int hfa384x_prepare_bap ( hfa384x_t hw,
uint16_t  id,
uint16_t  offset 
)
static

Definition at line 300 of file prism2.c.

301 {
302  int result = 0;
303  uint16_t reg;
304  uint16_t i;
305 
306  /* Validate offset, buf, and len */
307  if ( (offset > HFA384x_BAP_OFFSET_MAX) || (offset % 2) ) {
308  result = -EINVAL;
309  } else {
310  /* Write fid/rid and offset */
312  udelay(10);
314  /* Wait for offset[busy] to clear (see BAP_TIMEOUT) */
315  i = 0;
316  do {
318  if ( i > 0 ) udelay(2);
319  i++;
320  } while ( i < BAP_TIMEOUT && HFA384x_OFFSET_ISBUSY(reg));
321  if ( i >= BAP_TIMEOUT ) {
322  /* failure */
323  result = reg;
324  } else if ( HFA384x_OFFSET_ISERR(reg) ){
325  /* failure */
326  result = reg;
327  }
328  }
329  return result;
330 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
unsigned short uint16_t
Definition: stdint.h:11
#define HFA384x_BAP_OFFSET_MAX
Definition: hfa384x.h:71
#define HFA384x_OFFSET_ISBUSY(value)
Definition: hfa384x.h:843
Definition: hw.c:16
int result
Definition: bigint.h:148
#define BAP_TIMEOUT
Definition: prism2.c:70
#define HFA384x_OFFSET0
Definition: hfa384x.h:801
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
#define HFA384x_SELECT0
Definition: hfa384x.h:800
static void hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg)
Definition: prism2.c:193
static unsigned int unsigned int reg
Definition: intel.h:245
#define HFA384x_OFFSET_ISERR(value)
Definition: hfa384x.h:844
static uint16_t hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:183

References BAP_TIMEOUT, EINVAL, HFA384x_BAP_OFFSET_MAX, hfa384x_getreg(), HFA384x_OFFSET0, HFA384x_OFFSET_ISBUSY, HFA384x_OFFSET_ISERR, HFA384x_SELECT0, hfa384x_setreg(), offset, reg, result, and udelay().

Referenced by hfa384x_copy_from_bap(), and hfa384x_copy_to_bap().

◆ hfa384x_copy_from_bap()

static int hfa384x_copy_from_bap ( hfa384x_t hw,
uint16_t  id,
uint16_t  offset,
void *  buf,
unsigned int  len 
)
static

Definition at line 344 of file prism2.c.

346 {
347  int result = 0;
348  uint8_t *d = (uint8_t*)buf;
349  uint16_t i;
350  uint16_t reg = 0;
351 
352  /* Prepare BAP */
353  result = hfa384x_prepare_bap ( hw, id, offset );
354  if ( result == 0 ) {
355  /* Read even(len) buf contents from data reg */
356  for ( i = 0; i < (len & 0xfffe); i+=2 ) {
358  }
359  /* If len odd, handle last byte */
360  if ( len % 2 ){
362  d[len-1] = ((uint8_t*)(&reg))[0];
363  }
364  }
365  if (result) {
366  printf ( "copy_from_bap(%#hx, %#hx, %d) failed, result=%#hx\n", id, offset, len, result);
367  }
368  return result;
369 }
static uint16_t hfa384x_getreg_noswap(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:207
static int hfa384x_prepare_bap(hfa384x_t *hw, uint16_t id, uint16_t offset)
Definition: prism2.c:300
unsigned short uint16_t
Definition: stdint.h:11
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define HFA384x_DATA0
Definition: hfa384x.h:802
Definition: hw.c:16
int result
Definition: bigint.h:148
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
static unsigned int unsigned int reg
Definition: intel.h:245
unsigned char uint8_t
Definition: stdint.h:10
uint32_t len
Length.
Definition: ena.h:14

References HFA384x_DATA0, hfa384x_getreg_noswap(), hfa384x_prepare_bap(), len, offset, printf(), reg, and result.

Referenced by hfa384x_drvr_getconfig(), prism2_poll(), prism2_probe(), and prism2_transmit().

◆ hfa384x_copy_to_bap()

static int hfa384x_copy_to_bap ( hfa384x_t hw,
uint16_t  id,
uint16_t  offset,
void *  buf,
unsigned int  len 
)
static

Definition at line 383 of file prism2.c.

385 {
386  int result = 0;
387  uint8_t *d = (uint8_t*)buf;
388  uint16_t i;
389  uint16_t savereg;
390 
391  /* Prepare BAP */
392  result = hfa384x_prepare_bap ( hw, id, offset );
393  if ( result == 0 ) {
394  /* Write even(len) buf contents to data reg */
395  for ( i = 0; i < (len & 0xfffe); i+=2 ) {
397  }
398  /* If len odd, handle last byte */
399  if ( len % 2 ){
401  result = hfa384x_prepare_bap ( hw, id, offset + (len & 0xfffe) );
402  if ( result == 0 ) {
403  ((uint8_t*)(&savereg))[0] = d[len-1];
405  }
406  }
407  }
408  if (result) {
409  printf ( "copy_to_bap(%#hx, %#hx, %d) failed, result=%#hx\n", id, offset, len, result);
410  }
411  return result;
412 }
static uint16_t hfa384x_getreg_noswap(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:207
static int hfa384x_prepare_bap(hfa384x_t *hw, uint16_t id, uint16_t offset)
Definition: prism2.c:300
unsigned short uint16_t
Definition: stdint.h:11
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define HFA384x_DATA0
Definition: hfa384x.h:802
Definition: hw.c:16
int result
Definition: bigint.h:148
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
static void hfa384x_setreg_noswap(hfa384x_t *hw, uint16_t val, unsigned int reg)
Definition: prism2.c:211
unsigned char uint8_t
Definition: stdint.h:10
uint32_t len
Length.
Definition: ena.h:14

References HFA384x_DATA0, hfa384x_getreg_noswap(), hfa384x_prepare_bap(), hfa384x_setreg_noswap(), len, offset, printf(), and result.

Referenced by hfa384x_drvr_setconfig(), and prism2_transmit().

◆ hfa384x_cmd_access()

static int hfa384x_cmd_access ( hfa384x_t hw,
uint16_t  write,
uint16_t  rid 
)
inlinestatic

Definition at line 426 of file prism2.c.

427 {
429 }
#define HFA384x_CMD_WRITE_SET(value)
Definition: hfa384x.h:832
Definition: hw.c:16
device nvs write
Definition: threewire.h:61
static int hfa384x_docmd_wait(hfa384x_t *hw, uint16_t cmd, uint16_t parm0, uint16_t parm1, uint16_t parm2)
Definition: prism2.c:238
#define HFA384x_CMD_CMDCODE_SET(value)
Definition: hfa384x.h:836
#define HFA384x_CMDCODE_ACCESS
Definition: hfa384x.h:359

References HFA384x_CMD_CMDCODE_SET, HFA384x_CMD_WRITE_SET, HFA384x_CMDCODE_ACCESS, hfa384x_docmd_wait(), and write.

Referenced by hfa384x_drvr_getconfig(), and hfa384x_drvr_setconfig().

◆ hfa384x_drvr_getconfig()

static int hfa384x_drvr_getconfig ( hfa384x_t hw,
uint16_t  rid,
void *  buf,
uint16_t  len 
)
static

Definition at line 445 of file prism2.c.

446 {
447  int result = 0;
448  hfa384x_rec_t rec;
449 
450  /* Request read of RID */
451  result = hfa384x_cmd_access( hw, 0, rid);
452  if ( result ) {
453  printf("Call to hfa384x_cmd_access failed\n");
454  return -1;
455  }
456  /* Copy out record length */
457  result = hfa384x_copy_from_bap( hw, rid, 0, &rec, sizeof(rec));
458  if ( result ) {
459  return -1;
460  }
461  /* Validate the record length */
462  if ( ((hfa384x2host_16(rec.reclen)-1)*2) != len ) { /* note body len calculation in bytes */
463  printf ( "RID len mismatch, rid=%#hx hlen=%d fwlen=%d\n", rid, len, (hfa384x2host_16(rec.reclen)-1)*2);
464  return -1;
465  }
466  /* Copy out record data */
467  result = hfa384x_copy_from_bap( hw, rid, sizeof(rec), buf, len);
468  return result;
469 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
Definition: hw.c:16
int result
Definition: bigint.h:148
uint16_t reclen
Definition: hfa384x.h:951
uint32_t len
Length.
Definition: ena.h:14
#define hfa384x2host_16(n)
Definition: prism2.c:82
static int hfa384x_cmd_access(hfa384x_t *hw, uint16_t write, uint16_t rid)
Definition: prism2.c:426
static int hfa384x_copy_from_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
Definition: prism2.c:344

References hfa384x2host_16, hfa384x_cmd_access(), hfa384x_copy_from_bap(), len, printf(), hfa384x_record::reclen, and result.

Referenced by prism2_probe().

◆ hfa384x_drvr_setconfig()

static int hfa384x_drvr_setconfig ( hfa384x_t hw,
uint16_t  rid,
void *  buf,
uint16_t  len 
)
static

Definition at line 518 of file prism2.c.

519 {
520  int result = 0;
521  hfa384x_rec_t rec;
522 
523  rec.rid = host2hfa384x_16(rid);
524  rec.reclen = host2hfa384x_16((len/2) + 1); /* note conversion to words, +1 for rid field */
525  /* write the record header */
526  result = hfa384x_copy_to_bap( hw, rid, 0, &rec, sizeof(rec));
527  if ( result ) {
528  printf("Failure writing record header\n");
529  return -1;
530  }
531  /* write the record data (if there is any) */
532  if ( len > 0 ) {
533  result = hfa384x_copy_to_bap( hw, rid, sizeof(rec), buf, len);
534  if ( result ) {
535  printf("Failure writing record data\n");
536  return -1;
537  }
538  }
539  /* Trigger setting of record */
540  result = hfa384x_cmd_access( hw, 1, rid);
541  return result;
542 }
#define host2hfa384x_16(n)
Definition: prism2.c:84
static int hfa384x_copy_to_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
Definition: prism2.c:383
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
Definition: hw.c:16
int result
Definition: bigint.h:148
uint16_t reclen
Definition: hfa384x.h:951
uint16_t rid
Definition: hfa384x.h:952
uint32_t len
Length.
Definition: ena.h:14
static int hfa384x_cmd_access(hfa384x_t *hw, uint16_t write, uint16_t rid)
Definition: prism2.c:426

References hfa384x_cmd_access(), hfa384x_copy_to_bap(), host2hfa384x_16, len, printf(), hfa384x_record::reclen, result, and hfa384x_record::rid.

Referenced by hfa384x_drvr_setconfig16(), and prism2_probe().

◆ hfa384x_drvr_setconfig16()

static int hfa384x_drvr_setconfig16 ( hfa384x_t hw,
uint16_t  rid,
uint16_t val 
)
static

Definition at line 555 of file prism2.c.

556 {
557  uint16_t value;
559  return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(uint16_t));
560 }
#define host2hfa384x_16(n)
Definition: prism2.c:84
unsigned short uint16_t
Definition: stdint.h:11
Definition: hw.c:16
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
static int hfa384x_drvr_setconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len)
Definition: prism2.c:518
void __asmcall int val
Definition: setjmp.h:28

References hfa384x_drvr_setconfig(), host2hfa384x_16, val, and value.

Referenced by prism2_probe().

◆ hfa384x_wait_for_event()

static int hfa384x_wait_for_event ( hfa384x_t hw,
uint16_t  event_mask,
uint16_t  event_ack,
int  wait,
int  timeout,
const char *  descr 
)
static

Definition at line 587 of file prism2.c.

588 {
589  uint16_t reg;
590  int count = 0;
591 
592  do {
594  if ( count > 0 ) udelay(wait);
595  count++;
596  } while ( !(reg & event_mask) && count < timeout);
597  if ( count >= timeout ) {
598  printf("hfa384x: Timed out waiting for %s\n", descr);
599  return 0; /* Return failure */
600  }
601  /* Acknowledge all events that we were waiting on */
602  hfa384x_setreg(hw, reg & ( event_mask | event_ack ), HFA384x_EVACK);
603  return reg;
604 }
unsigned short uint16_t
Definition: stdint.h:11
#define HFA384x_EVSTAT
Definition: hfa384x.h:806
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
Definition: hw.c:16
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
static void hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg)
Definition: prism2.c:193
static unsigned int unsigned int reg
Definition: intel.h:245
static uint16_t hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:183
uint16_t count
Number of entries.
Definition: ena.h:22
void timeout(int)
#define HFA384x_EVACK
Definition: hfa384x.h:808

References count, HFA384x_EVACK, HFA384x_EVSTAT, hfa384x_getreg(), hfa384x_setreg(), printf(), reg, timeout(), and udelay().

Referenced by prism2_probe(), and prism2_transmit().

◆ prism2_poll()

static int prism2_poll ( struct nic nic,
int  retrieve 
)
static

Definition at line 609 of file prism2.c.

610 {
611  uint16_t reg;
612  uint16_t rxfid;
615  hfa384x_t *hw = &hw_global;
616 
617  /* Check for received packet */
619  if ( ! HFA384x_EVSTAT_ISRX(reg) ) {
620  /* No packet received - return 0 */
621  return 0;
622  }
623 
624  if ( ! retrieve ) return 1;
625 
626  /* Acknowledge RX event */
628  /* Get RX FID */
629  rxfid = hfa384x_getreg(hw, HFA384x_RXFID);
630  /* Get the descriptor (including headers) */
631  result = hfa384x_copy_from_bap(hw, rxfid, 0, &rxdesc, sizeof(rxdesc));
632  if ( result ) {
633  return 0; /* fail */
634  }
635  /* Byte order convert once up front. */
637  rxdesc.time = hfa384x2host_32(rxdesc.time);
638  rxdesc.data_len = hfa384x2host_16(rxdesc.data_len);
639 
640  /* Fill in nic->packetlen */
641  nic->packetlen = rxdesc.data_len;
642  if ( nic->packetlen > 0 ) {
643  /* Fill in nic->packet */
644  /*
645  * NOTE: Packets as received have an 8-byte header (LLC+SNAP(?)) terminating with the packet type.
646  * Etherboot expects a 14-byte header terminating with the packet type (it ignores the rest of the
647  * header), so we use a quick hack to achieve this.
648  */
651  if ( result ) {
652  return 0; /* fail */
653  }
654  }
655  return 1; /* Packet successfully received */
656 }
unsigned short uint16_t
Definition: stdint.h:11
#define HFA384x_RXFID
Definition: hfa384x.h:797
#define HFA384x_EVSTAT
Definition: hfa384x.h:806
#define HFA384x_EVSTAT_ISRX(value)
Definition: hfa384x.h:857
Definition: hw.c:16
#define HFA384x_EVACK_RX_SET(value)
Definition: hfa384x.h:901
volatile unsigned long status
Definition: davicom.c:110
int result
Definition: bigint.h:148
#define ETH_HLEN
Definition: if_ether.h:9
#define HFA384x_RX_DATA_OFF
Definition: hfa384x.h:1731
static hfa384x_t hw_global
Definition: prism2.c:143
#define hfa384x2host_32(n)
Definition: prism2.c:83
unsigned int packetlen
Definition: nic.h:54
static void hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg)
Definition: prism2.c:193
static unsigned int unsigned int reg
Definition: intel.h:245
Definition: nic.h:49
unsigned char * packet
Definition: nic.h:53
static uint16_t hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:183
#define hfa384x2host_16(n)
Definition: prism2.c:82
static int hfa384x_copy_from_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
Definition: prism2.c:344
#define HFA384x_EVACK
Definition: hfa384x.h:808

References ETH_HLEN, hfa384x2host_16, hfa384x2host_32, hfa384x_copy_from_bap(), HFA384x_EVACK, HFA384x_EVACK_RX_SET, HFA384x_EVSTAT, HFA384x_EVSTAT_ISRX, hfa384x_getreg(), HFA384x_RX_DATA_OFF, HFA384x_RXFID, hfa384x_setreg(), hw_global, nic::packet, nic::packetlen, reg, result, and rxdesc::status.

◆ prism2_transmit()

static void prism2_transmit ( struct nic nic,
const char *  d,
unsigned int  t,
unsigned int  s,
const char *  p 
)
static

Definition at line 661 of file prism2.c.

667 {
668  hfa384x_t *hw = &hw_global;
670  wlan_80211hdr_t p80211hdr = { wlan_llc_snap, {{0,0,0},0} };
671  uint16_t fid;
673  int result;
674 
675  // Request FID allocation
677  if (result != 0) {
678  printf("hfa384x: Tx FID allocate command failed: Aborting transmit..\n");
679  return;
680  }
681  if ( !hfa384x_wait_for_event(hw, HFA384x_EVSTAT_ALLOC, HFA384x_EVACK_INFO, 10, 50, "Tx FID to be allocated\n" ) ) return;
683 
684  /* Build Tx frame structure */
685  memset(&txdesc, 0, sizeof(txdesc));
690  WLAN_SET_FC_TODS(1) );
691  memcpy(txdesc.address1, hw->bssid, WLAN_ADDR_LEN);
692  memcpy(txdesc.address2, nic->node_addr, WLAN_ADDR_LEN);
693  memcpy(txdesc.address3, d, WLAN_ADDR_LEN);
694  txdesc.data_len = host2hfa384x_16( sizeof(txdesc) + sizeof(p80211hdr) + s );
695  /* Set up SNAP header */
696  /* Let OUI default to RFC1042 (0x000000) */
697  p80211hdr.snap.type = htons(t);
698 
699  /* Copy txdesc, p80211hdr and payload parts to FID */
700  result = hfa384x_copy_to_bap(hw, fid, 0, &txdesc, sizeof(txdesc));
701  if ( result ) return; /* fail */
702  result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc), &p80211hdr, sizeof(p80211hdr) );
703  if ( result ) return; /* fail */
704  result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc) + sizeof(p80211hdr), (uint8_t*)p, s );
705  if ( result ) return; /* fail */
706 
707  /* Issue Tx command */
709  if ( result != 0 ) {
710  printf("hfa384x: Transmit failed with result %#hx.\n", result);
711  return;
712  }
713 
714  /* Wait for transmit completion (or exception) */
716  200, 500, "Tx to complete\n" );
717  if ( !result ) return; /* timeout failure */
720  printf ( "Tx exception occurred with fid %#hx\n", fid );
721  result = hfa384x_copy_from_bap(hw, fid, 0, &status, sizeof(status));
722  if ( result ) return; /* fail */
723  printf("hfa384x: Tx error occurred (status %#hx):\n", status);
724  if ( HFA384x_TXSTATUS_ISACKERR(status) ) { printf(" ...acknowledgement error\n"); }
725  if ( HFA384x_TXSTATUS_ISFORMERR(status) ) { printf(" ...format error\n"); }
726  if ( HFA384x_TXSTATUS_ISDISCON(status) ) { printf(" ...disconnected error\n"); }
727  if ( HFA384x_TXSTATUS_ISAGEDERR(status) ) { printf(" ...AGED error\n"); }
728  if ( HFA384x_TXSTATUS_ISRETRYERR(status) ) { printf(" ...retry error\n"); }
729  return; /* fail */
730  }
731 }
#define host2hfa384x_16(n)
Definition: prism2.c:84
#define HFA384x_TX_STRUCTYPE_SET(v)
Definition: hfa384x.h:1689
static int hfa384x_copy_to_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
Definition: prism2.c:383
unsigned short uint16_t
Definition: stdint.h:11
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define HFA384x_TXSTATUS_ISDISCON(v)
Definition: hfa384x.h:1671
#define HFA384x_TX_TXOK_SET(v)
Definition: hfa384x.h:1693
#define HFA384x_TXSTATUS_ISFORMERR(v)
Definition: hfa384x.h:1670
#define WLAN_SET_FC_FSTYPE(n)
Definition: p80211hdr.h:185
#define HFA384x_EVSTAT_TXEXC
Definition: hfa384x.h:309
#define HFA384x_EVSTAT_TX
Definition: hfa384x.h:310
#define HFA384x_CMDCODE_TX
Definition: hfa384x.h:351
#define WLAN_FSTYPE_DATAONLY
Definition: p80211hdr.h:139
#define host2ieee16(n)
Definition: wlan_compat.h:497
wlan_snap_t snap
Definition: prism2.c:169
#define HFA384x_EVACK_INFO
Definition: hfa384x.h:331
Definition: hw.c:16
#define HFA384x_TX_TXEX_SET(v)
Definition: hfa384x.h:1691
#define WLAN_FTYPE_DATA
Definition: p80211hdr.h:112
#define HFA384x_TXSTATUS_ISAGEDERR(v)
Definition: hfa384x.h:1672
uint8_t status
Status.
Definition: ena.h:16
void * memcpy(void *dest, const void *src, size_t len) __nonnull
int result
Definition: bigint.h:148
#define HFA384x_ALLOCFID
Definition: hfa384x.h:798
#define WLAN_ADDR_LEN
Definition: p80211hdr.h:80
static hfa384x_t hw_global
Definition: prism2.c:143
#define HFA384x_TXCOMPLFID
Definition: hfa384x.h:799
#define HFA384x_TX_MACPORT_SET(v)
Definition: hfa384x.h:1683
#define HFA384x_TXSTATUS_ISRETRYERR(v)
Definition: hfa384x.h:1673
#define WLAN_SET_FC_FTYPE(n)
Definition: p80211hdr.h:184
uint16_t type
Definition: prism2.c:163
unsigned char uint8_t
Definition: stdint.h:10
#define HFA384x_TXSTATUS_ISACKERR(v)
Definition: hfa384x.h:1669
static int hfa384x_docmd_wait(hfa384x_t *hw, uint16_t cmd, uint16_t parm0, uint16_t parm1, uint16_t parm2)
Definition: prism2.c:238
Definition: nic.h:49
#define WLAN_SET_FC_TODS(n)
Definition: p80211hdr.h:186
static const wlan_llc_t wlan_llc_snap
Definition: prism2.c:157
unsigned char * node_addr
Definition: nic.h:52
static uint16_t hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:183
#define HFA384x_EVSTAT_ISTXEXC(value)
Definition: hfa384x.h:855
static int hfa384x_wait_for_event(hfa384x_t *hw, uint16_t event_mask, uint16_t event_ack, int wait, int timeout, const char *descr)
Definition: prism2.c:587
#define HFA384x_CMDCODE_ALLOC
Definition: hfa384x.h:350
#define HFA384x_DRVR_TXBUF_MAX
Definition: hfa384x.h:81
static int hfa384x_copy_from_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
Definition: prism2.c:344
#define htons(value)
Definition: byteswap.h:135
#define HFA384x_EVSTAT_ALLOC
Definition: hfa384x.h:308
#define HFA384x_CMD_CMDCODE_SET(value)
Definition: hfa384x.h:836
void * memset(void *dest, int character, size_t len) __nonnull

References HFA384x_ALLOCFID, HFA384x_CMD_CMDCODE_SET, HFA384x_CMDCODE_ALLOC, HFA384x_CMDCODE_TX, hfa384x_copy_from_bap(), hfa384x_copy_to_bap(), hfa384x_docmd_wait(), HFA384x_DRVR_TXBUF_MAX, HFA384x_EVACK_INFO, HFA384x_EVSTAT_ALLOC, HFA384x_EVSTAT_ISTXEXC, HFA384x_EVSTAT_TX, HFA384x_EVSTAT_TXEXC, hfa384x_getreg(), HFA384x_TX_MACPORT_SET, HFA384x_TX_STRUCTYPE_SET, HFA384x_TX_TXEX_SET, HFA384x_TX_TXOK_SET, HFA384x_TXCOMPLFID, HFA384x_TXSTATUS_ISACKERR, HFA384x_TXSTATUS_ISAGEDERR, HFA384x_TXSTATUS_ISDISCON, HFA384x_TXSTATUS_ISFORMERR, HFA384x_TXSTATUS_ISRETRYERR, hfa384x_wait_for_event(), host2hfa384x_16, host2ieee16, htons, hw_global, memcpy(), memset(), nic::node_addr, printf(), result, wlan_80211hdr::snap, status, wlan_snap::type, WLAN_ADDR_LEN, WLAN_FSTYPE_DATAONLY, WLAN_FTYPE_DATA, wlan_llc_snap, WLAN_SET_FC_FSTYPE, WLAN_SET_FC_FTYPE, and WLAN_SET_FC_TODS.

◆ prism2_disable()

static void prism2_disable ( struct nic *nic  __unused)
static

Definition at line 736 of file prism2.c.

736  {
737  /* put the card in its initial state */
738 }

Referenced by prism2_pci_disable(), and prism2_plx_disable().

◆ prism2_irq()

static void prism2_irq ( struct nic *nic  __unused,
irq_action_t action  __unused 
)
static

Definition at line 743 of file prism2.c.

744 {
745  switch ( action ) {
746  case DISABLE :
747  break;
748  case ENABLE :
749  break;
750  case FORCE :
751  break;
752  }
753 }
Definition: nic.h:35
Definition: nic.h:37
Definition: nic.h:36

References DISABLE, ENABLE, and FORCE.

◆ prism2_probe()

static int prism2_probe ( struct nic nic,
hfa384x_t hw 
)
static

Definition at line 769 of file prism2.c.

769  {
770  int result;
771  uint16_t tmp16 = 0;
772  uint16_t infofid;
773  hfa384x_InfFrame_t inf;
775  int info_count = 0;
776 
777  nic->irqno = 0;
778 
779  /* Initialize card */
780  result = hfa384x_docmd_wait(hw, HFA384x_CMDCODE_INIT, 0,0,0); /* Send initialize command */
781  if ( result ) printf ( "Initialize command returned %#hx\n", result );
782  hfa384x_setreg(hw, 0, HFA384x_INTEN); /* Disable interrupts */
783  hfa384x_setreg(hw, 0xffff, HFA384x_EVACK); /* Acknowledge any spurious events */
784 
785  DBG ( "MAC address %s\n", eth_ntoa ( nic->node_addr ) );
786 
787  /* Retrieve MAC address (and fill out nic->node_addr) */
789 
790  /* Prepare card for autojoin */
791  /* This procedure is reverse-engineered from a register-level trace of the Linux driver's join process */
792  tmp16 = WLAN_DATA_MAXLEN; /* Set maximum data length */
794  if ( result ) printf ( "Set Max Data Length command returned %#hx\n", result );
795  tmp16 = 0x000f; /* Set transmit rate(?) */
797  if ( result ) printf ( "Set Transmit Rate command returned %#hx\n", result );
798  tmp16 = HFA384x_CNFAUTHENTICATION_OPENSYSTEM; /* Set authentication type to OpenSystem */
800  if ( result ) printf ( "Set Authentication Type command returned %#hx\n", result );
801  /* Set SSID */
803  for ( tmp16=0; tmp16<sizeof(hardcoded_ssid); tmp16++ ) { ssid[2+tmp16] = hardcoded_ssid[tmp16]; }
804  ssid[0] = sizeof(hardcoded_ssid) - 1; /* Ignore terminating zero */
806  if ( result ) printf ( "Set SSID command returned %#hx\n", result );
807  tmp16 = 1; /* Set port type to ESS port */
809  if ( result ) printf ( "Set port type command returned %#hx\n", result );
810  /* Enable card */
812  if ( result ) printf ( "Enable command returned %#hx\n", result );
813 
814  do {
815  /* Increment info_count, abort if too many attempts.
816  * See comment next to definition of MAX_JOIN_INFO_COUNT for explanation.
817  */
818  info_count++;
819  if ( info_count > MAX_JOIN_INFO_COUNT ) {
820  printf ( "Too many failed attempts - aborting\n" );
821  return 0;
822  }
823 
824  /* Wait for info frame to indicate link status */
825  if ( sizeof(hardcoded_ssid) == 1 ) {
826  /* Empty SSID => join to any SSID */
827  printf ( "Attempting to autojoin to any available access point (attempt %d)...", info_count );
828  } else {
829  printf ( "Attempting to autojoin to SSID %s (attempt %d)...", &ssid[2], info_count );
830  }
831 
832  if ( !hfa384x_wait_for_event(hw, HFA384x_EVSTAT_INFO, 0, 1000, 2000, "Info event" ) ) return 0;
833  printf("done\n");
834  infofid = hfa384x_getreg(hw, HFA384x_INFOFID);
835  /* Retrieve the length */
836  result = hfa384x_copy_from_bap( hw, infofid, 0, &inf.framelen, sizeof(uint16_t));
837  if ( result ) return 0; /* fail */
838  inf.framelen = hfa384x2host_16(inf.framelen);
839  /* Retrieve the rest */
840  result = hfa384x_copy_from_bap( hw, infofid, sizeof(uint16_t),
841  &(inf.infotype), inf.framelen * sizeof(uint16_t));
842  if ( result ) return 0; /* fail */
843  if ( inf.infotype != HFA384x_IT_LINKSTATUS ) {
844  /* Not a Link Status info frame: die */
845  printf ( "Unexpected info frame type %#hx (not LinkStatus type)\n", inf.infotype );
846  return 0;
847  }
850  /* Link not connected - retry */
851  printf ( "Link not connected (status %#hx)\n", inf.info.linkstatus.linkstatus );
852  }
854 
855  /* Retrieve BSSID and print Connected message */
857 
858  DBG ( "Link connected (BSSID %s - ", eth_ntoa ( hw->bssid ) );
859  DBG ( " MAC address %s)\n", eth_ntoa (nic->node_addr ) );
860 
861  /* point to NIC specific routines */
863  return 1;
864 }
unsigned char irqno
Definition: nic.h:56
#define HFA384x_RID_CNFAUTHENTICATION
Definition: hfa384x.h:677
unsigned short uint16_t
Definition: stdint.h:11
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define HFA384x_CNFAUTHENTICATION_OPENSYSTEM
Definition: hfa384x.h:1060
#define HFA384x_RID_CURRENTBSSID
Definition: hfa384x.h:584
uint16_t linkstatus
Definition: hfa384x.h:1906
char ssid[0]
SSID data, not NUL-terminated.
Definition: ieee80211.h:16
uint16_t infotype
Definition: hfa384x.h:1987
static int hfa384x_drvr_setconfig16(hfa384x_t *hw, uint16_t rid, uint16_t *val)
Definition: prism2.c:555
#define HFA384x_INTEN
Definition: hfa384x.h:807
#define HFA384x_INFOFID
Definition: hfa384x.h:796
#define HFA384x_RID_CNFOWNMACADDR_LEN
Definition: hfa384x.h:429
Definition: hw.c:16
#define HFA384x_LINK_CONNECTED
Definition: hfa384x.h:1897
#define MAX_JOIN_INFO_COUNT
Definition: prism2.c:49
#define HFA384x_RID_TXRATECNTL
Definition: hfa384x.h:461
#define HFA384x_RID_CNFDESIREDSSID_LEN
Definition: hfa384x.h:430
static struct nic_operations prism2_operations
Definition: prism2.c:758
#define HFA384x_RID_CNFMAXDATALEN
Definition: hfa384x.h:405
int result
Definition: bigint.h:148
#define HFA384x_CMDCODE_ENABLE
Definition: hfa384x.h:345
#define HFA384x_CMDCODE_INIT
Definition: hfa384x.h:344
static const char hardcoded_ssid[]
Definition: prism2.c:38
#define WLAN_DATA_MAXLEN
Definition: p80211hdr.h:87
#define HFA384x_EVSTAT_INFO
Definition: hfa384x.h:305
#define HFA384x_RID_CNFPORTTYPE
Definition: hfa384x.h:398
static void hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg)
Definition: prism2.c:193
#define WLAN_BSSID_LEN
Definition: p80211hdr.h:82
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
static int hfa384x_drvr_setconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len)
Definition: prism2.c:518
static int hfa384x_docmd_wait(hfa384x_t *hw, uint16_t cmd, uint16_t parm0, uint16_t parm1, uint16_t parm2)
Definition: prism2.c:238
#define HFA384x_RID_CNFDESIREDSSID
Definition: hfa384x.h:400
Definition: nic.h:49
hfa384x_LinkStatus_t linkstatus
Definition: hfa384x.h:1977
#define HFA384x_RID_CNFOWNMACADDR
Definition: hfa384x.h:399
unsigned char * node_addr
Definition: nic.h:52
uint16_t framelen
Definition: hfa384x.h:1986
static uint16_t hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
Definition: prism2.c:183
hfa384x_infodata_t info
Definition: hfa384x.h:1988
static int hfa384x_wait_for_event(hfa384x_t *hw, uint16_t event_mask, uint16_t event_ack, int wait, int timeout, const char *descr)
Definition: prism2.c:587
#define hfa384x2host_16(n)
Definition: prism2.c:82
#define HFA384x_CMD_MACPORT_SET(value)
Definition: hfa384x.h:826
#define HFA384x_IT_LINKSTATUS
Definition: hfa384x.h:1758
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
struct nic_operations * nic_op
Definition: nic.h:50
static int hfa384x_drvr_getconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len)
Definition: prism2.c:445
static int hfa384x_copy_from_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, void *buf, unsigned int len)
Definition: prism2.c:344
#define HFA384x_CMD_CMDCODE_SET(value)
Definition: hfa384x.h:836
#define HFA384x_EVACK
Definition: hfa384x.h:808
void * memset(void *dest, int character, size_t len) __nonnull

References DBG, eth_ntoa(), hfa384x_InfFrame::framelen, hardcoded_ssid, hfa384x2host_16, HFA384x_CMD_CMDCODE_SET, HFA384x_CMD_MACPORT_SET, HFA384x_CMDCODE_ENABLE, HFA384x_CMDCODE_INIT, HFA384x_CNFAUTHENTICATION_OPENSYSTEM, hfa384x_copy_from_bap(), hfa384x_docmd_wait(), hfa384x_drvr_getconfig(), hfa384x_drvr_setconfig(), hfa384x_drvr_setconfig16(), HFA384x_EVACK, HFA384x_EVSTAT_INFO, hfa384x_getreg(), HFA384x_INFOFID, HFA384x_INTEN, HFA384x_IT_LINKSTATUS, HFA384x_LINK_CONNECTED, HFA384x_RID_CNFAUTHENTICATION, HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, HFA384x_RID_CNFMAXDATALEN, HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, HFA384x_RID_CNFPORTTYPE, HFA384x_RID_CURRENTBSSID, HFA384x_RID_TXRATECNTL, hfa384x_setreg(), hfa384x_wait_for_event(), hfa384x_InfFrame::info, hfa384x_InfFrame::infotype, nic::irqno, hfa384x_LinkStatus::linkstatus, hfa384x_infodata::linkstatus, MAX_JOIN_INFO_COUNT, memset(), nic::nic_op, nic::node_addr, printf(), prism2_operations, result, ssid, WLAN_BSSID_LEN, and WLAN_DATA_MAXLEN.

Referenced by prism2_pci_probe(), and prism2_plx_probe().

Variable Documentation

◆ hardcoded_ssid

const char hardcoded_ssid[] = ""
static

Definition at line 38 of file prism2.c.

Referenced by prism2_probe().

◆ hw_global

hfa384x_t hw_global
static

Definition at line 143 of file prism2.c.

Referenced by prism2_pci_probe(), prism2_plx_probe(), prism2_poll(), and prism2_transmit().

◆ wlan_llc_snap

const wlan_llc_t wlan_llc_snap = { 0xaa, 0xaa, 0x03 }
static

Definition at line 157 of file prism2.c.

Referenced by prism2_transmit().

◆ prism2_operations

struct nic_operations prism2_operations
static
Initial value:
= {
.connect = dummy_connect,
.poll = prism2_poll,
.transmit = prism2_transmit,
.irq = prism2_irq,
}
int dummy_connect(struct nic *nic __unused)
Definition: legacy.c:151
static void prism2_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
Definition: prism2.c:661
static void prism2_irq(struct nic *nic __unused, irq_action_t action __unused)
Definition: prism2.c:743
static int prism2_poll(struct nic *nic, int retrieve)
Definition: prism2.c:609

Definition at line 758 of file prism2.c.

Referenced by prism2_probe().