linux/drivers/net/wireless/broadcom/b43/dma.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*

  Broadcom B43 wireless driver

  DMA ringbuffer and descriptor allocation/management

  Copyright (c) 2005, 2006 Michael Buesch <[email protected]>

  Some code in this file is derived from the b44.c driver
  Copyright (C) 2002 David S. Miller
  Copyright (C) Pekka Pietikainen


*/

#include "b43.h"
#include "dma.h"
#include "main.h"
#include "debugfs.h"
#include "xmit.h"

#include <linux/dma-mapping.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/skbuff.h>
#include <linux/etherdevice.h>
#include <linux/slab.h>
#include <asm/div64.h>


/* Required number of TX DMA slots per TX frame.
 * This currently is 2, because we put the header and the ieee80211 frame
 * into separate slots. */
#define TX_SLOTS_PER_FRAME

static u32 b43_dma_address(struct b43_dma *dma, dma_addr_t dmaaddr,
			   enum b43_addrtype addrtype)
{}

/* 32bit DMA ops. */
static
struct b43_dmadesc_generic *op32_idx2desc(struct b43_dmaring *ring,
					  int slot,
					  struct b43_dmadesc_meta **meta)
{}

static void op32_fill_descriptor(struct b43_dmaring *ring,
				 struct b43_dmadesc_generic *desc,
				 dma_addr_t dmaaddr, u16 bufsize,
				 int start, int end, int irq)
{}

static void op32_poke_tx(struct b43_dmaring *ring, int slot)
{}

static void op32_tx_suspend(struct b43_dmaring *ring)
{}

static void op32_tx_resume(struct b43_dmaring *ring)
{}

static int op32_get_current_rxslot(struct b43_dmaring *ring)
{}

static void op32_set_current_rxslot(struct b43_dmaring *ring, int slot)
{}

static const struct b43_dma_ops dma32_ops =;

/* 64bit DMA ops. */
static
struct b43_dmadesc_generic *op64_idx2desc(struct b43_dmaring *ring,
					  int slot,
					  struct b43_dmadesc_meta **meta)
{}

static void op64_fill_descriptor(struct b43_dmaring *ring,
				 struct b43_dmadesc_generic *desc,
				 dma_addr_t dmaaddr, u16 bufsize,
				 int start, int end, int irq)
{}

static void op64_poke_tx(struct b43_dmaring *ring, int slot)
{}

static void op64_tx_suspend(struct b43_dmaring *ring)
{}

static void op64_tx_resume(struct b43_dmaring *ring)
{}

static int op64_get_current_rxslot(struct b43_dmaring *ring)
{}

static void op64_set_current_rxslot(struct b43_dmaring *ring, int slot)
{}

static const struct b43_dma_ops dma64_ops =;

static inline int free_slots(struct b43_dmaring *ring)
{}

static inline int next_slot(struct b43_dmaring *ring, int slot)
{}

static inline int prev_slot(struct b43_dmaring *ring, int slot)
{}

#ifdef CONFIG_B43_DEBUG
static void update_max_used_slots(struct b43_dmaring *ring,
				  int current_used_slots)
{}
#else
static inline
    void update_max_used_slots(struct b43_dmaring *ring, int current_used_slots)
{
}
#endif /* DEBUG */

/* Request a slot for usage. */
static inline int request_slot(struct b43_dmaring *ring)
{}

static u16 b43_dmacontroller_base(enum b43_dmatype type, int controller_idx)
{}

static inline
    dma_addr_t map_descbuffer(struct b43_dmaring *ring,
			      unsigned char *buf, size_t len, int tx)
{}

static inline
    void unmap_descbuffer(struct b43_dmaring *ring,
			  dma_addr_t addr, size_t len, int tx)
{}

static inline
    void sync_descbuffer_for_cpu(struct b43_dmaring *ring,
				 dma_addr_t addr, size_t len)
{}

static inline
    void sync_descbuffer_for_device(struct b43_dmaring *ring,
				    dma_addr_t addr, size_t len)
{}

static inline
    void free_descriptor_buffer(struct b43_dmaring *ring,
				struct b43_dmadesc_meta *meta)
{}

static int alloc_ringmemory(struct b43_dmaring *ring)
{}

static void free_ringmemory(struct b43_dmaring *ring)
{}

/* Reset the RX DMA channel */
static int b43_dmacontroller_rx_reset(struct b43_wldev *dev, u16 mmio_base,
				      enum b43_dmatype type)
{}

/* Reset the TX DMA channel */
static int b43_dmacontroller_tx_reset(struct b43_wldev *dev, u16 mmio_base,
				      enum b43_dmatype type)
{}

/* Check if a DMA mapping address is invalid. */
static bool b43_dma_mapping_error(struct b43_dmaring *ring,
				  dma_addr_t addr,
				  size_t buffersize, bool dma_to_device)
{}

static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb)
{}

static void b43_poison_rx_buffer(struct b43_dmaring *ring, struct sk_buff *skb)
{}

static int setup_rx_descbuffer(struct b43_dmaring *ring,
			       struct b43_dmadesc_generic *desc,
			       struct b43_dmadesc_meta *meta, gfp_t gfp_flags)
{}

/* Allocate the initial descbuffers.
 * This is used for an RX ring only.
 */
static int alloc_initial_descbuffers(struct b43_dmaring *ring)
{}

/* Do initial setup of the DMA controller.
 * Reset the controller, write the ring busaddress
 * and switch the "enable" bit on.
 */
static int dmacontroller_setup(struct b43_dmaring *ring)
{}

/* Shutdown the DMA controller. */
static void dmacontroller_cleanup(struct b43_dmaring *ring)
{}

static void free_all_descbuffers(struct b43_dmaring *ring)
{}

static enum b43_dmatype b43_engine_type(struct b43_wldev *dev)
{}

/* Main initialization function. */
static
struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
				      int controller_index,
				      int for_tx,
				      enum b43_dmatype type)
{}

#define divide(a, b)

#define modulo(a, b)

/* Main cleanup function. */
static void b43_destroy_dmaring(struct b43_dmaring *ring,
				const char *ringname)
{}

#define destroy_ring(dma, ring)

void b43_dma_free(struct b43_wldev *dev)
{}

/* Some hardware with 64-bit DMA seems to be bugged and looks for translation
 * bit in low address word instead of high one.
 */
static bool b43_dma_translation_in_low_word(struct b43_wldev *dev,
					    enum b43_dmatype type)
{}

int b43_dma_init(struct b43_wldev *dev)
{}

/* Generate a cookie for the TX header. */
static u16 generate_cookie(struct b43_dmaring *ring, int slot)
{}

/* Inspect a cookie and find out to which controller/slot it belongs. */
static
struct b43_dmaring *parse_cookie(struct b43_wldev *dev, u16 cookie, int *slot)
{}

static int dma_tx_fragment(struct b43_dmaring *ring,
			   struct sk_buff *skb)
{}

static inline int should_inject_overflow(struct b43_dmaring *ring)
{}

/* Static mapping of mac80211's queues (priorities) to b43 DMA rings. */
static struct b43_dmaring *select_ring_by_priority(struct b43_wldev *dev,
						   u8 queue_prio)
{}

int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
{}

void b43_dma_handle_txstatus(struct b43_wldev *dev,
			     const struct b43_txstatus *status)
{}

static void dma_rx(struct b43_dmaring *ring, int *slot)
{}

void b43_dma_handle_rx_overflow(struct b43_dmaring *ring)
{}

void b43_dma_rx(struct b43_dmaring *ring)
{}

static void b43_dma_tx_suspend_ring(struct b43_dmaring *ring)
{}

static void b43_dma_tx_resume_ring(struct b43_dmaring *ring)
{}

void b43_dma_tx_suspend(struct b43_wldev *dev)
{}

void b43_dma_tx_resume(struct b43_wldev *dev)
{}

static void direct_fifo_rx(struct b43_wldev *dev, enum b43_dmatype type,
			   u16 mmio_base, bool enable)
{}

/* Enable/Disable Direct FIFO Receive Mode (PIO) on a RX engine.
 * This is called from PIO code, so DMA structures are not available. */
void b43_dma_direct_fifo_rx(struct b43_wldev *dev,
			    unsigned int engine_index, bool enable)
{}