brintos

brintos / linux-shallow public Read only

0
0
Text · 3.9 KiB · 08cd022 Raw
159 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef B43legacy_PIO_H_3#define B43legacy_PIO_H_4 5#include "b43legacy.h"6 7#include <linux/interrupt.h>8#include <linux/list.h>9#include <linux/skbuff.h>10 11 12#define B43legacy_PIO_TXCTL		0x0013#define B43legacy_PIO_TXDATA		0x0214#define B43legacy_PIO_TXQBUFSIZE	0x0415#define B43legacy_PIO_RXCTL		0x0816#define B43legacy_PIO_RXDATA		0x0A17 18#define B43legacy_PIO_TXCTL_WRITELO	(1 << 0)19#define B43legacy_PIO_TXCTL_WRITEHI	(1 << 1)20#define B43legacy_PIO_TXCTL_COMPLETE	(1 << 2)21#define B43legacy_PIO_TXCTL_INIT	(1 << 3)22#define B43legacy_PIO_TXCTL_SUSPEND	(1 << 7)23 24#define B43legacy_PIO_RXCTL_DATAAVAILABLE	(1 << 0)25#define B43legacy_PIO_RXCTL_READY		(1 << 1)26 27/* PIO constants */28#define B43legacy_PIO_MAXTXDEVQPACKETS	3129#define B43legacy_PIO_TXQADJUST		8030 31/* PIO tuning knobs */32#define B43legacy_PIO_MAXTXPACKETS	25633 34 35 36#ifdef CONFIG_B43LEGACY_PIO37 38 39struct b43legacy_pioqueue;40struct b43legacy_xmitstatus;41 42struct b43legacy_pio_txpacket {43	struct b43legacy_pioqueue *queue;44	struct sk_buff *skb;45	struct list_head list;46};47 48#define pio_txpacket_getindex(packet) ((int)((packet) - \49			      (packet)->queue->tx_packets_cache))50 51struct b43legacy_pioqueue {52	struct b43legacy_wldev *dev;53	u16 mmio_base;54 55	bool tx_suspended;56	bool tx_frozen;57	bool need_workarounds; /* Workarounds needed for core.rev < 3 */58 59	/* Adjusted size of the device internal TX buffer. */60	u16 tx_devq_size;61	/* Used octets of the device internal TX buffer. */62	u16 tx_devq_used;63	/* Used packet slots in the device internal TX buffer. */64	u8 tx_devq_packets;65	/* Packets from the txfree list can66	 * be taken on incoming TX requests.67	 */68	struct list_head txfree;69	unsigned int nr_txfree;70	/* Packets on the txqueue are queued,71	 * but not completely written to the chip, yet.72	 */73	struct list_head txqueue;74	/* Packets on the txrunning queue are completely75	 * posted to the device. We are waiting for the txstatus.76	 */77	struct list_head txrunning;78	struct tasklet_struct txtask;79	struct b43legacy_pio_txpacket80			 tx_packets_cache[B43legacy_PIO_MAXTXPACKETS];81};82 83static inline84u16 b43legacy_pio_read(struct b43legacy_pioqueue *queue,85		     u16 offset)86{87	return b43legacy_read16(queue->dev, queue->mmio_base + offset);88}89 90static inline91void b43legacy_pio_write(struct b43legacy_pioqueue *queue,92		       u16 offset, u16 value)93{94	b43legacy_write16(queue->dev, queue->mmio_base + offset, value);95}96 97 98int b43legacy_pio_init(struct b43legacy_wldev *dev);99void b43legacy_pio_free(struct b43legacy_wldev *dev);100 101int b43legacy_pio_tx(struct b43legacy_wldev *dev,102		   struct sk_buff *skb);103void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,104				 const struct b43legacy_txstatus *status);105void b43legacy_pio_rx(struct b43legacy_pioqueue *queue);106 107/* Suspend TX queue in hardware. */108void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue);109void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue);110/* Suspend (freeze) the TX tasklet (software level). */111void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev);112void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev);113 114#else /* CONFIG_B43LEGACY_PIO */115 116static inline117int b43legacy_pio_init(struct b43legacy_wldev *dev)118{119	return 0;120}121static inline122void b43legacy_pio_free(struct b43legacy_wldev *dev)123{124}125static inline126int b43legacy_pio_tx(struct b43legacy_wldev *dev,127		   struct sk_buff *skb)128{129	return 0;130}131static inline132void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,133				 const struct b43legacy_txstatus *status)134{135}136static inline137void b43legacy_pio_rx(struct b43legacy_pioqueue *queue)138{139}140static inline141void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue)142{143}144static inline145void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue)146{147}148static inline149void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev)150{151}152static inline153void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev)154{155}156 157#endif /* CONFIG_B43LEGACY_PIO */158#endif /* B43legacy_PIO_H_ */159