提交 c73b9d67 编写于 作者: B Brett Rudley 提交者: Greg Kroah-Hartman

staging: brcm80211: remove bmac-only header files

Part of BMAC removal.
Signed-off-by: NBrett Rudley <brudley@broadcom.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 f3ce1ef2
/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _BCM_RPC_H_
#define _BCM_RPC_H_
#include <rpc_osl.h>
typedef struct rpc_info rpc_info_t;
typedef struct rpc_buf rpc_buf_t;
struct rpc_transport_info;
typedef void (*rpc_dispatch_cb_t) (void *ctx, struct rpc_buf *buf);
typedef void (*rpc_resync_cb_t) (void *ctx);
typedef void (*rpc_down_cb_t) (void *ctx);
typedef void (*rpc_txdone_cb_t) (void *ctx, struct rpc_buf *buf);
extern struct rpc_info *bcm_rpc_attach(void *pdev, struct osl_info *osh,
struct rpc_transport_info *rpc_th);
extern void bcm_rpc_detach(struct rpc_info *rpc);
extern void bcm_rpc_down(struct rpc_info *rpc);
extern void bcm_rpc_watchdog(struct rpc_info *rpc);
extern struct rpc_buf *bcm_rpc_buf_alloc(struct rpc_info *rpc, int len);
extern void bcm_rpc_buf_free(struct rpc_info *rpc, struct rpc_buf *b);
/* get rpc transport handle */
extern struct rpc_transport_info *bcm_rpc_tp_get(struct rpc_info *rpc);
/* callback for: data_rx, down, resync */
extern void bcm_rpc_rxcb_init(struct rpc_info *rpc, void *ctx,
rpc_dispatch_cb_t cb, void *dnctx,
rpc_down_cb_t dncb, rpc_resync_cb_t resync_cb,
rpc_txdone_cb_t);
extern void bcm_rpc_rxcb_deinit(struct rpc_info *rpci);
/* HOST or CLIENT rpc call, requiring no return value */
extern int bcm_rpc_call(struct rpc_info *rpc, struct rpc_buf *b);
/* HOST rpc call, demanding return.
* The thread may be suspended and control returns back to OS
* The thread will resume(waked up) on either the return signal received or timeout
* The implementation details depend on OS
*/
extern struct rpc_buf *bcm_rpc_call_with_return(struct rpc_info *rpc,
struct rpc_buf *b);
/* CLIENT rpc call to respond to bcm_rpc_call_with_return, requiring no return value */
extern int bcm_rpc_call_return(struct rpc_info *rpc, struct rpc_buf *retb);
extern uint bcm_rpc_buf_header_len(struct rpc_info *rpci);
#define RPC_PKTLOG_SIZE 50 /* Depth of the history */
#define RPC_PKTLOG_RD_LEN 3
#define RPC_PKTLOG_DUMP_SIZE 150 /* dump size should be more than the product of above two */
extern int bcm_rpc_pktlog_get(struct rpc_info *rpci, u32 *buf,
uint buf_size, bool send);
extern int bcm_rpc_dump(rpc_info_t *rpci, struct bcmstrbuf *b);
/* HIGH/BMAC: bit 15-8: RPC module, bit 7-0: TP module */
#define RPC_ERROR_VAL 0x0001
#define RPC_TRACE_VAL 0x0002
#define RPC_PKTTRACE_VAL 0x0004
#define RPC_PKTLOG_VAL 0x0008
extern void bcm_rpc_msglevel_set(struct rpc_info *rpci, u16 msglevel,
bool high_low);
#endif /* _BCM_RPC_H_ */
/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _bcm_rpc_tp_h_
#define _bcm_rpc_tp_h_
#include <bcm_rpc.h>
#define DBUS_RX_BUFFER_SIZE_RPC (2100) /* rxbufsize for dbus_attach, linux only for now */
#define BCM_RPC_TP_ENCAP_LEN 4 /* TP header is 4 bytes */
#define BCM_RPC_TP_HOST_AGG_MASK 0xffff0000
#define BCM_RPC_TP_HOST_AGG_SHIFT 16
#define BCM_RPC_TP_HOST_AGG_AMPDU 0x00010000 /* HOST->DNGL ampdu aggregation */
#define BCM_RPC_TP_HOST_AGG_TEST 0x00100000 /* HOST->DNGL test aggregation */
#define BCM_RPC_TP_DNGL_AGG_MASK 0x0000ffff
#define BCM_RPC_TP_DNGL_AGG_DPC 0x00000001 /* DNGL->HOST data aggregation */
#define BCM_RPC_TP_DNGL_AGG_FLOWCTL 0x00000002 /* DNGL->HOST tx flowcontrol agg */
#define BCM_RPC_TP_DNGL_AGG_TEST 0x00000010 /* DNGL->HOST test agg */
#define BCM_RPC_TP_DNGL_AGG_MAX_SFRAME 3 /* max agg subframes, must be <= USB_NTXD */
#define BCM_RPC_TP_DNGL_AGG_MAX_BYTE 4000 /* max agg bytes */
#define BCM_RPC_TP_HOST_AGG_MAX_SFRAME 3 /* max agg subframes, AMPDU only, 3 is enough */
#define BCM_RPC_TP_HOST_AGG_MAX_BYTE 3400 /* max agg bytes; to fit 2+ tcp/udp pkts. Each one:
* 802.3pkt + 802.11 hdr + rpc hdr + tp hdr < 1700B
* Need to be in sync with dongle usb rx dma
* rxbufsize(USBBULK_RXBUF_GIANT in usbdev_sb.c)
*/
/* TP-DBUS pkts flowcontrol */
#define BCM_RPC_TP_DBUS_NTXQ 50 /* queue size for TX on bulk OUT, aggregation possible */
#define BCM_RPC_TP_DBUS_NRXQ 50 /* queue size for RX on bulk IN, aggregation possible */
#define BCM_RPC_TP_DBUS_NRXQ_CTRL 1 /* queue size for RX on ctl EP0 */
#define BCM_RPC_TP_DBUS_NRXQ_PKT (BCM_RPC_TP_DBUS_NRXQ * BCM_RPC_TP_DNGL_AGG_MAX_SFRAME)
#define BCM_RPC_TP_DBUS_NTXQ_PKT (BCM_RPC_TP_DBUS_NTXQ * BCM_RPC_TP_HOST_AGG_MAX_SFRAME)
typedef struct rpc_transport_info rpc_tp_info_t;
typedef void (*rpc_tx_complete_fn_t) (void *, rpc_buf_t *, int status);
typedef void (*rpc_rx_fn_t) (void *, rpc_buf_t *);
typedef void (*rpc_txflowctl_cb_t) (void *ctx, bool on);
extern rpc_tp_info_t *bcm_rpc_tp_attach(struct osl_info *osh, void *bus);
extern void bcm_rpc_tp_detach(rpc_tp_info_t *rpcb);
extern void bcm_rpc_tp_down(rpc_tp_info_t *rpcb);
extern void bcm_rpc_tp_watchdog(rpc_tp_info_t *rpcb);
extern int bcm_rpc_tp_buf_send(rpc_tp_info_t *rpcb, rpc_buf_t *buf);
/* callback for tx_complete, rx_pkt */
extern void bcm_rpc_tp_register_cb(rpc_tp_info_t *rpcb,
rpc_tx_complete_fn_t txcmplt,
void *tx_context, rpc_rx_fn_t rxpkt,
void *rx_context, rpc_osl_t *rpc_osh);
extern void bcm_rpc_tp_deregister_cb(rpc_tp_info_t *rpcb);
/* Buffer manipulation */
extern uint bcm_rpc_buf_tp_header_len(rpc_tp_info_t *rpcb);
extern rpc_buf_t *bcm_rpc_tp_buf_alloc(rpc_tp_info_t *rpcb, int len);
extern void bcm_rpc_tp_buf_free(rpc_tp_info_t *rpcb, rpc_buf_t *buf);
extern int bcm_rpc_buf_len_get(rpc_tp_info_t *rpcb, rpc_buf_t *b);
extern int bcm_rpc_buf_len_set(rpc_tp_info_t *rpcb, rpc_buf_t *b, uint len);
extern rpc_buf_t *bcm_rpc_buf_next_get(rpc_tp_info_t *rpcb, rpc_buf_t *b);
extern void bcm_rpc_buf_next_set(rpc_tp_info_t *rpcb, rpc_buf_t *b,
rpc_buf_t *nextb);
extern unsigned char *bcm_rpc_buf_data(rpc_tp_info_t *rpcb, rpc_buf_t *b);
extern unsigned char *bcm_rpc_buf_push(rpc_tp_info_t *rpcb, rpc_buf_t *b,
uint delta);
extern unsigned char *bcm_rpc_buf_pull(rpc_tp_info_t *rpcb, rpc_buf_t *b,
uint delta);
extern void bcm_rpc_tp_buf_release(rpc_tp_info_t *rpcb, rpc_buf_t *buf);
extern void bcm_rpc_tp_buf_cnt_adjust(rpc_tp_info_t *rpcb, int adjust);
/* RPC call_with_return */
extern int bcm_rpc_tp_recv_rtn(rpc_tp_info_t *rpcb);
extern int bcm_rpc_tp_get_device_speed(rpc_tp_info_t *rpc_th);
#ifdef BCMDBG
extern int bcm_rpc_tp_dump(rpc_tp_info_t *rpcb, struct bcmstrbuf *b);
#endif
/* intercept USB pkt to parse RPC header: USB driver rx-> wl_send -> this -> wl driver */
extern void bcm_rpc_tp_rx_from_dnglbus(rpc_tp_info_t *rpc_th, struct lbuf *lb);
/* RPC callreturn pkt, go to USB driver tx */
extern int bcm_rpc_tp_send_callreturn(rpc_tp_info_t *rpc_th, rpc_buf_t *b);
extern void bcm_rpc_tp_dump(rpc_tp_info_t *rpcb);
extern void bcm_rpc_tp_txflowctl(rpc_tp_info_t *rpcb, bool state, int prio);
extern void bcm_rpc_tp_txflowctlcb_init(rpc_tp_info_t *rpc_th, void *ctx,
rpc_txflowctl_cb_t cb);
extern void bcm_rpc_tp_txflowctlcb_deinit(rpc_tp_info_t *rpc_th);
extern void bcm_rpc_tp_txq_wm_set(rpc_tp_info_t *rpc_th, u8 hiwm,
u8 lowm);
extern void bcm_rpc_tp_txq_wm_get(rpc_tp_info_t *rpc_th, u8 *hiwm,
u8 *lowm);
extern void bcm_rpc_tp_agg_set(rpc_tp_info_t *rpcb, u32 reason, bool set);
extern void bcm_rpc_tp_agg_limit_set(rpc_tp_info_t *rpc_th, u8 sf,
u16 bytes);
extern void bcm_rpc_tp_agg_limit_get(rpc_tp_info_t *rpc_th, u8 *sf,
u16 *bytes);
#define BCM_RPC_TP_MSG_LEVEL_MASK 0x00ff
/* dongle msg level */
#define RPC_TP_MSG_DNGL_ERR_VAL 0x0001 /* DNGL TP error msg */
#define RPC_TP_MSG_DNGL_DBG_VAL 0x0002 /* DNGL TP dbg msg */
#define RPC_TP_MSG_DNGL_AGG_VAL 0x0004 /* DNGL TP agg msg */
#define RPC_TP_MSG_DNGL_DEA_VAL 0x0008 /* DNGL TP deag msg */
/* host msg level */
#define RPC_TP_MSG_HOST_ERR_VAL 0x0001 /* DNGL TP error msg */
#define RPC_TP_MSG_HOST_DBG_VAL 0x0002 /* DNGL TP dbg msg */
#define RPC_TP_MSG_HOST_AGG_VAL 0x0004 /* DNGL TP agg msg */
#define RPC_TP_MSG_HOST_DEA_VAL 0x0008 /* DNGL TP deag msg */
extern void bcm_rpc_tp_msglevel_set(rpc_tp_info_t *rpc_th, u8 msglevel,
bool high_low);
#endif /* _bcm_rpc_tp_h_ */
/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _BCM_XDR_H
#define _BCM_XDR_H
/*
* bcm_xdr_buf_t
* Structure used for bookkeeping of a buffer being packed or unpacked.
* Keeps a current read/write pointer and size as well as
* the original buffer pointer and size.
*
*/
typedef struct {
u8 *buf; /* pointer to current position in origbuf */
uint size; /* current (residual) size in bytes */
u8 *origbuf; /* unmodified pointer to orignal buffer */
uint origsize; /* unmodified orignal buffer size in bytes */
} bcm_xdr_buf_t;
void bcm_xdr_buf_init(bcm_xdr_buf_t *b, void *buf, size_t len);
int bcm_xdr_pack_u32(bcm_xdr_buf_t *b, u32 val);
int bcm_xdr_unpack_u32(bcm_xdr_buf_t *b, u32 *pval);
int bcm_xdr_pack_s32(bcm_xdr_buf_t *b, s32 val);
int bcm_xdr_unpack_s32(bcm_xdr_buf_t *b, s32 *pval);
int bcm_xdr_pack_s8(bcm_xdr_buf_t *b, s8 val);
int bcm_xdr_unpack_s8(bcm_xdr_buf_t *b, s8 *pval);
int bcm_xdr_pack_opaque(bcm_xdr_buf_t *b, uint len, void *data);
int bcm_xdr_unpack_opaque(bcm_xdr_buf_t *b, uint len, void **pdata);
int bcm_xdr_unpack_opaque_cpy(bcm_xdr_buf_t *b, uint len, void *data);
int bcm_xdr_pack_opaque_varlen(bcm_xdr_buf_t *b, uint len, void *data);
int bcm_xdr_unpack_opaque_varlen(bcm_xdr_buf_t *b, uint *plen, void **pdata);
int bcm_xdr_pack_string(bcm_xdr_buf_t *b, char *str);
int bcm_xdr_unpack_string(bcm_xdr_buf_t *b, uint *plen, char **pstr);
int bcm_xdr_pack_u8_vec(bcm_xdr_buf_t *, u8 *vec, u32 elems);
int bcm_xdr_unpack_u8_vec(bcm_xdr_buf_t *, u8 *vec, u32 elems);
int bcm_xdr_pack_u16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
int bcm_xdr_unpack_u16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
int bcm_xdr_pack_u32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
int bcm_xdr_unpack_u32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
int bcm_xdr_pack_opaque_raw(bcm_xdr_buf_t *b, uint len, void *data);
int bcm_xdr_pack_opaque_pad(bcm_xdr_buf_t *b);
#endif /* _BCM_XDR_H */
/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __DBUS_H__
#define __DBUS_H__
#ifdef BCMDBG
#define DBUSERR(args) do { if (net_ratelimit()) printf args; } while (0)
#define DBUSTRACE(args)
#define DBUSDBGLOCK(args)
#else
#define DBUSTRACE(args)
#define DBUSERR(args)
#define DBUSDBGLOCK(args)
#endif
enum {
DBUS_OK = 0,
DBUS_ERR = -200,
DBUS_ERR_TIMEOUT,
DBUS_ERR_DISCONNECT,
DBUS_ERR_NODEVICE,
DBUS_ERR_UNSUPPORTED,
DBUS_ERR_PENDING,
DBUS_ERR_NOMEM,
DBUS_ERR_TXFAIL,
DBUS_ERR_TXTIMEOUT,
DBUS_ERR_TXDROP,
DBUS_ERR_RXFAIL,
DBUS_ERR_RXDROP,
DBUS_ERR_TXCTLFAIL,
DBUS_ERR_RXCTLFAIL,
DBUS_ERR_REG_PARAM,
DBUS_STATUS_CANCELLED
};
#define ERR_CBMASK_TXFAIL 0x00000001
#define ERR_CBMASK_RXFAIL 0x00000002
#define ERR_CBMASK_ALL 0xFFFFFFFF
#define DBUS_CBCTL_WRITE 0
#define DBUS_CBCTL_READ 1
#define DBUS_TX_RETRY_LIMIT 3 /* retries for failed txirb */
#define DBUS_TX_TIMEOUT_INTERVAL 250 /* timeout for txirb complete, in ms */
#define DBUS_BUFFER_SIZE_TX 5000
#define DBUS_BUFFER_SIZE_RX 5000
#define DBUS_BUFFER_SIZE_TX_NOAGG 2048
#define DBUS_BUFFER_SIZE_RX_NOAGG 2048
/* DBUS types */
enum {
DBUS_USB,
DBUS_SDIO,
DBUS_SPI,
DBUS_UNKNOWN
};
enum dbus_state {
DBUS_STATE_DL_PENDING,
DBUS_STATE_DL_DONE,
DBUS_STATE_UP,
DBUS_STATE_DOWN,
DBUS_STATE_PNP_FWDL,
DBUS_STATE_DISCONNECT
};
enum dbus_pnp_state {
DBUS_PNP_DISCONNECT,
DBUS_PNP_SLEEP,
DBUS_PNP_RESUME
};
typedef enum _DEVICE_SPEED {
INVALID_SPEED = -1,
LOW_SPEED = 1, /* USB 1.1: 1.5 Mbps */
FULL_SPEED, /* USB 1.1: 12 Mbps */
HIGH_SPEED, /* USB 2.0: 480 Mbps */
SUPER_SPEED, /* USB 3.0: 4.8 Gbps */
} DEVICE_SPEED;
typedef struct {
int bustype;
int vid;
int pid;
int devid;
int chiprev; /* chip revsion number */
int mtu;
int nchan; /* Data Channels */
} dbus_attrib_t;
/* FIX: Account for errors related to DBUS;
* Let upper layer account for packets/bytes
*/
typedef struct {
u32 rx_errors;
u32 tx_errors;
u32 rx_dropped;
u32 tx_dropped;
} dbus_stats_t;
/*
* Configurable BUS parameters
*/
typedef struct {
bool rxctl_deferrespok;
} dbus_config_t;
struct dbus_callbacks;
struct exec_parms;
typedef void *(*probe_cb_t) (void *arg, const char *desc, u32 bustype,
u32 hdrlen);
typedef void (*disconnect_cb_t) (void *arg);
typedef void *(*exec_cb_t) (struct exec_parms *args);
/* Client callbacks registered during dbus_attach() */
typedef struct dbus_callbacks {
void (*send_complete) (void *cbarg, void *info, int status);
void (*recv_buf) (void *cbarg, u8 *buf, int len);
void (*recv_pkt) (void *cbarg, void *pkt);
void (*txflowcontrol) (void *cbarg, bool onoff);
void (*errhandler) (void *cbarg, int err);
void (*ctl_complete) (void *cbarg, int type, int status);
void (*state_change) (void *cbarg, int state);
void *(*pktget) (void *cbarg, uint len, bool send);
void (*pktfree) (void *cbarg, void *p, bool send);
} dbus_callbacks_t;
struct dbus_pub;
struct bcmstrbuf;
struct dbus_irb;
struct dbus_irb_rx;
struct dbus_irb_tx;
struct dbus_intf_callbacks;
typedef struct {
void *(*attach) (struct dbus_pub *pub, void *cbarg,
struct dbus_intf_callbacks *cbs);
void (*detach) (struct dbus_pub *pub, void *bus);
int (*up) (void *bus);
int (*down) (void *bus);
int (*send_irb) (void *bus, struct dbus_irb_tx *txirb);
int (*recv_irb) (void *bus, struct dbus_irb_rx *rxirb);
int (*cancel_irb) (void *bus, struct dbus_irb_tx *txirb);
int (*send_ctl) (void *bus, u8 *buf, int len);
int (*recv_ctl) (void *bus, u8 *buf, int len);
int (*get_stats) (void *bus, dbus_stats_t *stats);
int (*get_attrib) (void *bus, dbus_attrib_t *attrib);
int (*pnp) (void *bus, int event);
int (*remove) (void *bus);
int (*resume) (void *bus);
int (*suspend) (void *bus);
int (*stop) (void *bus);
int (*reset) (void *bus);
/* Access to bus buffers directly */
void *(*pktget) (void *bus, int len);
void (*pktfree) (void *bus, void *pkt);
int (*iovar_op) (void *bus, const char *name, void *params, int plen,
void *arg, int len, bool set);
void (*dump) (void *bus, struct bcmstrbuf *strbuf);
int (*set_config) (void *bus, dbus_config_t *config);
int (*get_config) (void *bus, dbus_config_t *config);
bool(*device_exists) (void *bus);
bool(*dlneeded) (void *bus);
int (*dlstart) (void *bus, u8 *fw, int len);
int (*dlrun) (void *bus);
bool(*recv_needed) (void *bus);
void *(*exec_rxlock) (void *bus, exec_cb_t func,
struct exec_parms *args);
void *(*exec_txlock) (void *bus, exec_cb_t func,
struct exec_parms *args);
int (*tx_timer_init) (void *bus);
int (*tx_timer_start) (void *bus, uint timeout);
int (*tx_timer_stop) (void *bus);
int (*sched_dpc) (void *bus);
int (*lock) (void *bus);
int (*unlock) (void *bus);
int (*sched_probe_cb) (void *bus);
int (*shutdown) (void *bus);
int (*recv_stop) (void *bus);
int (*recv_resume) (void *bus);
/* Add from the bottom */
} dbus_intf_t;
typedef struct dbus_pub {
struct osl_info *osh;
dbus_stats_t stats;
dbus_attrib_t attrib;
enum dbus_state busstate;
DEVICE_SPEED device_speed;
int ntxq, nrxq, rxsize;
void *bus;
struct shared_info *sh;
} dbus_pub_t;
#define BUS_INFO(bus, type) (((type *) bus)->pub->bus)
/*
* Public Bus Function Interface
*/
extern int dbus_register(int vid, int pid, probe_cb_t prcb,
disconnect_cb_t discb, void *prarg, void *param1,
void *param2);
extern int dbus_deregister(void);
extern const dbus_pub_t *dbus_attach(struct osl_info *osh, int rxsize, int nrxq,
int ntxq, void *cbarg,
dbus_callbacks_t *cbs,
struct shared_info *sh);
extern void dbus_detach(const dbus_pub_t *pub);
extern int dbus_up(const dbus_pub_t *pub);
extern int dbus_down(const dbus_pub_t *pub);
extern int dbus_stop(const dbus_pub_t *pub);
extern int dbus_shutdown(const dbus_pub_t *pub);
extern void dbus_flowctrl_rx(const dbus_pub_t *pub, bool on);
extern int dbus_send_buf(const dbus_pub_t *pub, u8 *buf, int len,
void *info);
extern int dbus_send_pkt(const dbus_pub_t *pub, void *pkt, void *info);
extern int dbus_send_ctl(const dbus_pub_t *pub, u8 *buf, int len);
extern int dbus_recv_ctl(const dbus_pub_t *pub, u8 *buf, int len);
extern int dbus_get_stats(const dbus_pub_t *pub, dbus_stats_t *stats);
extern int dbus_get_attrib(const dbus_pub_t *pub, dbus_attrib_t *attrib);
extern int dbus_get_device_speed(const dbus_pub_t *pub);
extern int dbus_set_config(const dbus_pub_t *pub, dbus_config_t *config);
extern int dbus_get_config(const dbus_pub_t *pub, dbus_config_t *config);
extern void *dbus_pktget(const dbus_pub_t *pub, int len);
extern void dbus_pktfree(const dbus_pub_t *pub, void *pkt);
extern int dbus_set_errmask(const dbus_pub_t *pub, u32 mask);
extern int dbus_pnp_sleep(const dbus_pub_t *pub);
extern int dbus_pnp_resume(const dbus_pub_t *pub, int *fw_reload);
extern int dbus_pnp_disconnect(const dbus_pub_t *pub);
extern int dbus_iovar_op(const dbus_pub_t *pub, const char *name,
void *params, int plen, void *arg, int len, bool set);
#ifdef BCMDBG
extern void dbus_hist_dump(const dbus_pub_t *pub, struct bcmstrbuf *b);
#endif /* BCMDBG */
/*
* Private Common Bus Interface
*/
/* IO Request Block (IRB) */
typedef struct dbus_irb {
struct dbus_irb *next; /* it's casted from dbus_irb_tx or dbus_irb_rx struct */
} dbus_irb_t;
typedef struct dbus_irb_rx {
struct dbus_irb irb; /* Must be first */
u8 *buf;
int buf_len;
int actual_len;
void *pkt;
void *info;
void *arg;
} dbus_irb_rx_t;
typedef struct dbus_irb_tx {
struct dbus_irb irb; /* Must be first */
u8 *buf;
int len;
void *pkt;
int retry_count;
void *info;
void *arg;
} dbus_irb_tx_t;
/* DBUS interface callbacks are different from user callbacks
* so, internally, different info can be passed to upper layer
*/
typedef struct dbus_intf_callbacks {
void (*send_irb_timeout) (void *cbarg, dbus_irb_tx_t *txirb);
void (*send_irb_complete) (void *cbarg, dbus_irb_tx_t *txirb,
int status);
void (*recv_irb_complete) (void *cbarg, dbus_irb_rx_t *rxirb,
int status);
void (*errhandler) (void *cbarg, int err);
void (*ctl_complete) (void *cbarg, int type, int status);
void (*state_change) (void *cbarg, int state);
bool(*isr) (void *cbarg, bool *wantdpc);
bool(*dpc) (void *cbarg, bool bounded);
void (*watchdog) (void *cbarg);
void *(*pktget) (void *cbarg, uint len, bool send);
void (*pktfree) (void *cbarg, void *p, bool send);
struct dbus_irb *(*getirb) (void *cbarg, bool send);
void (*rxerr_indicate) (void *cbarg, bool on);
} dbus_intf_callbacks_t;
/*
* Porting: To support new bus, port these functions below
*/
/*
* Bus specific Interface
* Implemented by dbus_usb.c/dbus_sdio.c
*/
extern int dbus_bus_register(int vid, int pid, probe_cb_t prcb,
disconnect_cb_t discb, void *prarg,
dbus_intf_t **intf, void *param1, void *param2);
extern int dbus_bus_deregister(void);
/*
* Bus-specific and OS-specific Interface
* Implemented by dbus_usb_[linux/ndis].c/dbus_sdio_[linux/ndis].c
*/
extern int dbus_bus_osl_register(int vid, int pid, probe_cb_t prcb,
disconnect_cb_t discb, void *prarg,
dbus_intf_t **intf, void *param1,
void *param2);
extern int dbus_bus_osl_deregister(void);
/*
* Bus-specific, OS-specific, HW-specific Interface
* Mainly for SDIO Host HW controller
*/
extern int dbus_bus_osl_hw_register(int vid, int pid, probe_cb_t prcb,
disconnect_cb_t discb, void *prarg,
dbus_intf_t **intf);
extern int dbus_bus_osl_hw_deregister(void);
#endif /* __DBUS_H__ */
/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _WLC_RPC_H_
#define _WLC_RPC_H_
#include <wlc_types.h>
/* RPC IDs, reordering is OK. This needs to be in sync with RPC_ID_TABLE below */
typedef enum {
WLRPC_NULL_ID = 0,
WLRPC_WLC_REG_READ_ID,
WLRPC_WLC_REG_WRITE_ID,
WLRPC_WLC_MHF_SET_ID,
WLRPC_WLC_MHF_GET_ID,
WLRPC_WLC_BMAC_UP_PREP_ID,
WLRPC_WLC_BMAC_UP_FINISH_ID,
WLRPC_WLC_BMAC_DOWN_PREP_ID,
WLRPC_WLC_BMAC_DOWN_FINISH_ID,
WLRPC_WLC_BMAC_WRITE_HW_BCNTEMPLATES_ID,
WLRPC_WLC_BMAC_RESET_ID,
WLRPC_WLC_DNGL_REBOOT_ID,
WLRPC_WLC_BMAC_RPC_TXQ_WM_SET_ID,
WLRPC_WLC_BMAC_RPC_TXQ_WM_GET_ID,
WLRPC_WLC_BMAC_RPC_AGG_SET_ID,
WLRPC_WLC_BMAC_RPC_MSGLEVEL_SET_ID,
WLRPC_WLC_BMAC_RPC_AGG_LIMIT_SET_ID,
WLRPC_WLC_BMAC_RPC_AGG_LIMIT_GET_ID,
WLRPC_WLC_BMAC_INIT_ID,
WLRPC_WLC_BMAC_SET_CWMIN_ID,
WLRPC_WLC_BMAC_MUTE_ID,
WLRPC_WLC_PHY_DOIOVAR_ID,
WLRPC_WLC_PHY_HOLD_UPD_ID,
WLRPC_WLC_PHY_MUTE_UPD_ID,
WLRPC_WLC_PHY_CLEAR_TSSI_ID,
WLRPC_WLC_PHY_ANT_RXDIV_GET_ID,
WLRPC_WLC_PHY_ANT_RXDIV_SET_ID,
WLRPC_WLC_PHY_PREAMBLE_SET_ID,
WLRPC_WLC_PHY_FREQTRACK_END_ID,
WLRPC_WLC_PHY_FREQTRACK_START_ID,
WLRPC_WLC_PHY_IOCTL_ID,
WLRPC_WLC_PHY_NOISE_SAMPLE_REQUEST_ID,
WLRPC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PC_WLC_PHY_RADAR_DETECT_MODE_SET_ID,
WLRPC_WLC_PHY_ACIM_NOISEM_RESET_NPHY_ID,
WLRPC_WLC_PHY_INTERFER_SET_NPHY_ID,
WLRPC_WLC_BMAC_IFSCTL_EDCRS_SET_ID,
WLRPC_WLC_PKTENGTX,
WLRPC_WLC_BMAC_SET_DEAF,
WLRPC_WLC_BMAC_CLEAR_DEAF,
WLRPC_WLC_BMAC_BTC_FLAGS_SET_ID,
WLRPC_WLC_BMAC_BTC_FLAGS_GET_ID,
WLRPC_WLC_BMAC_SET_RCMTA_TYPE_ID,
WLRPC_WLC_BMAC_BTC_FLAGS_UPD_ID,
WLRPC_WLC_BMAC_BTC_STUCKWAR_ID,
WLRPC_WLC_BMAC_CCA_STATS_READ_ID,
WLRPC_WLC_BMAC_ANTSEL_SET_ID,
WLRPC_WLC_BMAC_SET_UCODE_LOADED,
WLRPC_WLC_PHY_LDPC_SET_ID,
WLRPC_LAST
} wlc_rpc_id_t;
#if defined(BCMDBG) | 0
struct name_entry {
int id;
char *name;
};
#define NAME_ENTRY(x) {x, #x}
#define RPC_ID_TABLE { \
NAME_ENTRY(WLRPC_WLC_REG_READ_ID), \
NAME_ENTRY(WLRPC_WLC_REG_WRITE_ID), \
NAME_ENTRY(WLRPC_WLC_MHF_SET_ID), \
NAME_ENTRY(WLRPC_WLC_MHF_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_UP_PREP_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_UP_FINISH_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_DOWN_PREP_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_DOWN_FINISH_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_WRITE_HW_BCNTEMPLATES_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RESET_ID), \
NAME_ENTRY(WLRPC_WLC_DNGL_REBOOT_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RPC_TXQ_WM_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RPC_TXQ_WM_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RPC_AGG_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RPC_MSGLEVEL_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RPC_AGG_LIMIT_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RPC_AGG_LIMIT_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_INIT_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_CWMIN_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_MUTE_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_DOIOVAR_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_HOLD_UPD_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_MUTE_UPD_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_CLEAR_TSSI_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_ANT_RXDIV_GET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_ANT_RXDIV_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_PREAMBLE_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_FREQTRACK_END_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_FREQTRACK_START_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_IOCTL_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_NOISE_SAMPLE_REQUEST_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_CAL_PERICAL_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_SROMLIMIT_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_RADAR_DETECT_ENABLE_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_RADAR_DETECT_RUN_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TEST_ISON_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_COPYFROM_OBJMEM_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_COPYTO_OBJMEM_ID), \
NAME_ENTRY(WLRPC_WLC_ENABLE_MAC_ID), \
NAME_ENTRY(WLRPC_WLC_MCTRL_ID), \
NAME_ENTRY(WLRPC_WLC_CORERESET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_READ_SHM_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_READ_TSF_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_ADDRMATCH_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_CWMAX_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_RCMTA_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_SHM_ID), \
NAME_ENTRY(WLRPC_WLC_SUSPEND_MAC_AND_WAIT_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_WRITE_SHM_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_WRITE_TEMPLATE_RAM_ID), \
NAME_ENTRY(WLRPC_WLC_TX_FIFO_SUSPEND_ID), \
NAME_ENTRY(WLRPC_WLC_TX_FIFO_RESUME_ID), \
NAME_ENTRY(WLRPC_WLC_TX_FIFO_SUSPENDED_ID), \
NAME_ENTRY(WLRPC_WLC_HW_ETHERADDR_ID), \
NAME_ENTRY(WLRPC_WLC_SET_HW_ETHERADDR_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_CHANSPEC_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_TXANT_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_ANTSEL_TYPE_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_TXFIFO_ID), \
NAME_ENTRY(WLRPC_WLC_RADIO_READ_HWDISABLED_ID), \
NAME_ENTRY(WLRPC_WLC_RM_CCA_MEASURE_ID), \
NAME_ENTRY(WLRPC_WLC_SET_SHORTSLOT_ID), \
NAME_ENTRY(WLRPC_WLC_WAIT_FOR_WAKE_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_CURRENT_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_HW_CTRL_GET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_HW_CTRL_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_BSSINIT_ID), \
NAME_ENTRY(WLRPC_WLC_BAND_STF_SS_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_BAND_FIRST_CHANSPEC_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_LIMIT_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_BAND_CHANNELS_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_REVINFO_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_STATE_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_XMTFIFO_SZ_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_XMTFIFO_SZ_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_VALIDATE_CHIP_ACCESS_ID), \
NAME_ENTRY(WLRPC_WLC_RM_CCA_COMPLETE_ID), \
NAME_ENTRY(WLRPC_WLC_RECV_ID), \
NAME_ENTRY(WLRPC_WLC_DOTXSTATUS_ID), \
NAME_ENTRY(WLRPC_WLC_HIGH_DPC_ID), \
NAME_ENTRY(WLRPC_WLC_FATAL_ERROR_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_SET_CHANNEL_14_WIDE_FILTER_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_NOISE_AVG_ID), \
NAME_ENTRY(WLRPC_WLC_PHYCHAIN_INIT_ID), \
NAME_ENTRY(WLRPC_WLC_PHYCHAIN_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHYCHAIN_GET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TKIP_RIFS_WAR_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_COPYFROM_VARS_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RETRYLIMIT_UPD_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_BTC_MODE_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_BTC_MODE_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_BTC_WIRE_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_BTC_WIRE_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_NORESET_ID), \
NAME_ENTRY(WLRPC_WLC_AMPDU_TXSTATUS_COMPLETE_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_FIFOERRORS_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_TARGET_MIN_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_TARGET_MAX_ID), \
NAME_ENTRY(WLRPC_WLC_NOISE_CB_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_LED_HW_DEINIT_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_LED_HW_MASK_INIT_ID), \
NAME_ENTRY(WLRPC_WLC_PLLREQ_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_TACLEAR_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_CLK_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_OFDM_RATESET_WAR_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_BF_PREEMPT_ENABLE_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_DOIOVARS_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_DUMP_ID), \
NAME_ENTRY(WLRPC_WLC_CISWRITE_ID), \
NAME_ENTRY(WLRPC_WLC_CISDUMP_ID), \
NAME_ENTRY(WLRPC_WLC_UPDATE_PHY_MODE_ID), \
NAME_ENTRY(WLRPC_WLC_RESET_BMAC_DONE_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_LED_BLINK_EVENT_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_LED_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_LED_BLINK_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_LED_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_RATE_SHM_OFFSET_ID), \
NAME_ENTRY(WLRPC_SI_ISCORE_UP_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_PS_SWITCH_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_STF_SSMODE_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_DEBUG_ID), \
NAME_ENTRY(WLRPC_WLC_EXTLOG_MSG_ID), \
NAME_ENTRY(WLRPC_WLC_EXTLOG_CFG_ID), \
NAME_ENTRY(WLRPC_BCM_ASSERT_LOG_ID), \
NAME_ENTRY(WLRPC_BCM_ASSERT_TYPE_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_PHYCAL_CACHE_FLAG_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_GET_PHYCAL_CACHE_FLAG_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_CAL_CACHE_INIT_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_CAL_CACHE_DEINIT_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_HW_UP_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_TXPWR_PERCENT_ID), \
NAME_ENTRY(WLRPC_WLC_PHYCHAIN_ACTIVE_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_BLINK_SYNC_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_UCODE_DBGSEL_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_UCODE_DBGSEL_GET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_RADAR_DETECT_MODE_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_ACIM_NOISEM_RESET_NPHY_ID), \
NAME_ENTRY(WLRPC_WLC_PHY_INTERFER_SET_NPHY_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_IFSCTL_EDCRS_SET_ID), \
NAME_ENTRY(WLRPC_WLC_PKTENGTX), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_DEAF), \
NAME_ENTRY(WLRPC_WLC_BMAC_CLEAR_DEAF), \
NAME_ENTRY(WLRPC_WLC_BMAC_BTC_FLAGS_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_BTC_FLAGS_GET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_RCMTA_TYPE_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_CCA_STATS_READ_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_ANTSEL_SET_ID), \
NAME_ENTRY(WLRPC_WLC_BMAC_SET_UCODE_LOADED), \
NAME_ENTRY(WLRPC_WLC_PHY_LDPC_SET_ID), \
{0, NULL} \
}
static __inline char *_wlc_rpc_id_lookup(const struct name_entry *tbl, int _id)
{
const struct name_entry *elt = tbl;
static char __unknown[64];
for (; elt->name != NULL; elt++) {
if (_id == elt->id)
break;
}
if (_id == elt->id)
strncpy(__unknown, elt->name, sizeof(__unknown));
else
snprintf(__unknown, sizeof(__unknown), "ID:%d", _id);
return __unknown;
}
#define WLC_RPC_ID_LOOKUP(tbl, _id) (_wlc_rpc_id_lookup(tbl, _id))
#endif /* BCMDBG */
/* refer to txpwr_limits_t for each elements, mcs32 is the at the end for 1 byte */
#define TXPOWER_XDR_SZ (roundup(WLC_NUM_RATES_CCK, 4) + roundup(WLC_NUM_RATES_OFDM, 4) * 4 + \
roundup(WLC_NUM_RATES_MCS_1_STREAM, 4) * 6 + roundup(WLC_NUM_RATES_MCS_2_STREAM, 4) * 2 + \
roundup(1, 4))
#define wlc_rpc_txpwr_limits(b, txpwr, op, err) \
do { \
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->cck, WLC_NUM_RATES_CCK); \
ASSERT(!(err)); \
\
/* 20 MHz Legacy OFDM rates with SISO transmission */ \
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm, WLC_NUM_RATES_OFDM); \
ASSERT(!(err)); \
\
/* 20 MHz Legacy OFDM rates with CDD transmission */ \
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm_cdd, WLC_NUM_RATES_OFDM); \
ASSERT(!(err)); \
\
/* 40 MHz Legacy OFDM rates with SISO transmission */ \
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm_40_siso, WLC_NUM_RATES_OFDM); \
ASSERT(!(err)); \
\
/* 40 MHz Legacy OFDM rates with CDD transmission */ \
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm_40_cdd, WLC_NUM_RATES_OFDM); \
ASSERT(!(err)); \
\
/* 20MHz MCS rates SISO/CDD/STBC/SDM */ \
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_siso, WLC_NUM_RATES_MCS_1_STREAM); \
ASSERT(!(err)); \
\
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_cdd, WLC_NUM_RATES_MCS_1_STREAM); \
ASSERT(!(err)); \
\
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_stbc, WLC_NUM_RATES_MCS_1_STREAM); \
ASSERT(!(err)); \
\
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_mimo, WLC_NUM_RATES_MCS_2_STREAM); \
ASSERT(!(err)); \
\
/* 40MHz MCS rates SISO/CDD/STBC/SDM */ \
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_siso, WLC_NUM_RATES_MCS_1_STREAM); \
ASSERT(!(err)); \
\
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_cdd, WLC_NUM_RATES_MCS_1_STREAM); \
ASSERT(!(err)); \
\
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_stbc, WLC_NUM_RATES_MCS_1_STREAM); \
ASSERT(!(err)); \
\
(err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_mimo, WLC_NUM_RATES_MCS_2_STREAM); \
ASSERT(!(err)); \
} while (0)
typedef struct wlc_rpc_ctx {
rpc_info_t *rpc;
wlc_info_t *wlc;
wlc_hw_info_t *wlc_hw;
} wlc_rpc_ctx_t;
static inline rpc_buf_t *wlc_rpc_buf_alloc(rpc_info_t *rpc, bcm_xdr_buf_t *b,
uint len, wlc_rpc_id_t rpc_id)
{
rpc_buf_t *rpc_buf;
rpc_buf = bcm_rpc_buf_alloc(rpc, len + sizeof(u32));
if (!rpc_buf)
return NULL;
bcm_xdr_buf_init(b, bcm_rpc_buf_data(bcm_rpc_tp_get(rpc), rpc_buf),
len + sizeof(u32));
bcm_xdr_pack_u32(b, rpc_id);
return rpc_buf;
}
#if defined(BCMDBG)
static __inline wlc_rpc_id_t
wlc_rpc_id_get(struct rpc_info *rpc, rpc_buf_t *buf)
{
wlc_rpc_id_t rpc_id;
bcm_xdr_buf_t b;
bcm_xdr_buf_init(&b, bcm_rpc_buf_data(bcm_rpc_tp_get(rpc), buf),
sizeof(u32));
bcm_xdr_unpack_u32(&b, (u32 *)((unsigned long) & rpc_id));
return rpc_id;
}
#endif
static __inline int _wlc_rpc_call(struct rpc_info *rpc, rpc_buf_t *send)
{
int _err = 0;
#if defined(BCMDBG)
wlc_rpc_id_t rpc_id = wlc_rpc_id_get(rpc, send);
/* const struct name_entry rpc_name_tbl[] = RPC_ID_TABLE; */
static struct name_entry rpc_name_tbl[] = RPC_ID_TABLE;
WL_TRACE(("%s: Called id %s\n", __func__,
WLC_RPC_ID_LOOKUP(rpc_name_tbl, rpc_id)));
#endif
_err = bcm_rpc_call(rpc, send);
if (_err) {
#if defined(BCMDBG)
WL_ERROR(("%s: Call id %s FAILED\n", __func__,
WLC_RPC_ID_LOOKUP(rpc_name_tbl, rpc_id)));
#endif
_err = 0;
}
return _err;
}
#define wlc_rpc_call(rpc, send) (_wlc_rpc_call(rpc, send))
#include <sbhnddma.h>
#include <sbhndpio.h>
#include <d11.h>
extern void wlc_rpc_bmac_dispatch(wlc_rpc_ctx_t *rpc_ctx, struct rpc_buf *buf);
extern void wlc_rpc_bmac_dump_txfifohist(wlc_hw_info_t *wlc_hw,
bool dump_clear);
/* Packed structure for ease of transport across RPC bus along u32 boundary */
typedef struct wlc_rpc_txstatus {
u32 PAD_framelen;
u32 status_frameid;
u32 sequence_lasttxtime;
u32 ackphyrxsh_phyerr;
} wlc_rpc_txstatus_t;
static inline
void txstatus2rpc_txstatus(tx_status_t *txstatus,
wlc_rpc_txstatus_t *rpc_txstatus)
{
rpc_txstatus->PAD_framelen = txstatus->framelen;
rpc_txstatus->status_frameid =
(txstatus->status << 16) | txstatus->frameid;
rpc_txstatus->sequence_lasttxtime =
(txstatus->sequence << 16) | txstatus->lasttxtime;
rpc_txstatus->ackphyrxsh_phyerr =
(txstatus->ackphyrxsh << 16) | txstatus->phyerr;
}
static inline
void rpc_txstatus2txstatus(wlc_rpc_txstatus_t *rpc_txstatus,
tx_status_t *txstatus)
{
txstatus->framelen = rpc_txstatus->PAD_framelen & 0xffff;
txstatus->status = (rpc_txstatus->status_frameid >> 16) & 0xffff;
txstatus->frameid = rpc_txstatus->status_frameid & 0xffff;
txstatus->sequence = (rpc_txstatus->sequence_lasttxtime >> 16) & 0xffff;
txstatus->lasttxtime = rpc_txstatus->sequence_lasttxtime & 0xffff;
txstatus->ackphyrxsh = (rpc_txstatus->ackphyrxsh_phyerr >> 16) & 0xffff;
txstatus->phyerr = rpc_txstatus->ackphyrxsh_phyerr & 0xffff;
}
extern void wlc_bmac_dngl_reboot(rpc_info_t *rpc);
#endif /* WLC_RPC_H */
/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _wlc_rpctx_h_
#define _wlc_rpctx_h_
/* forward declaration */
struct wlc_info;
/* This controls how many packets are given to the dongle. This is required as
* NTXD needs to be power of 2 but we may not have enough memory to absorb that
* large number of frames
*/
#ifndef NRPCTXBUFPOST
#define NRPCTXBUFPOST NTXD
#endif
#define RPCTX_ENAB(pub) (false)
#define wlc_rpctx_attach(pub, wlc) (NULL)
#define wlc_rpctx_fifoinit(rpctx, fifo, ntxd) (0)
#define wlc_rpctx_detach(rpctx) ASSERT(0)
#define wlc_rpctx_txavail(rpctx, f) (false)
#define wlc_rpctx_dump(rpctx, b) (0)
#define wlc_rpctx_getnexttxp(rpctx, f) (NULL)
#define wlc_rpctx_txreclaim(rpctx) ASSERT(0)
#define wlc_rpctx_pkteng(rpctx, fifo, p) do { } while (0)
#define wlc_rpctx_tx(rpctx, f, p, c, fid, t) (0)
#define wlc_rpctx_txpktpendinc(rpctx, f, val) do { } while (0)
#define wlc_rpctx_txpktpenddec(rpctx, f, val) do { } while (0)
#define wlc_rpctx_txpktpendclr(rpctx, f) do { } while (0)
#define wlc_rpctx_txpktpend(rpctx, f, all) (0)
#endif /* _wlc_rpctx_h_ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册