Commit 1e1af316 authored by Jes Sorensen's avatar Jes Sorensen Committed by Linus Torvalds

[PATCH] rrunner PCI DMA mappings

This makes drivers/net/rrunner.[ch] use the PCI DMA mapping API.  It
also fixes some potential SMP bugs where spin locks were taking outside
of interrupt context without disabling interrupts.
parent c5221eba
This diff is collapsed.
...@@ -496,9 +496,9 @@ typedef struct { ...@@ -496,9 +496,9 @@ typedef struct {
} rraddr; } rraddr;
static inline void set_rraddr(rraddr *ra, volatile void *addr) static inline void set_rraddr(rraddr *ra, dma_addr_t addr)
{ {
unsigned long baddr = virt_to_bus((void *)addr); unsigned long baddr = addr;
#if (BITS_PER_LONG == 64) #if (BITS_PER_LONG == 64)
ra->addrlo = baddr; ra->addrlo = baddr;
#else #else
...@@ -509,9 +509,9 @@ static inline void set_rraddr(rraddr *ra, volatile void *addr) ...@@ -509,9 +509,9 @@ static inline void set_rraddr(rraddr *ra, volatile void *addr)
} }
static inline void set_rxaddr(struct rr_regs *regs, volatile void *addr) static inline void set_rxaddr(struct rr_regs *regs, volatile dma_addr_t addr)
{ {
unsigned long baddr = virt_to_bus((void *)addr); unsigned long baddr = addr;
#if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN) #if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
writel(baddr & 0xffffffff, &regs->RxRingHi); writel(baddr & 0xffffffff, &regs->RxRingHi);
writel(baddr >> 32, &regs->RxRingLo); writel(baddr >> 32, &regs->RxRingLo);
...@@ -526,9 +526,9 @@ static inline void set_rxaddr(struct rr_regs *regs, volatile void *addr) ...@@ -526,9 +526,9 @@ static inline void set_rxaddr(struct rr_regs *regs, volatile void *addr)
} }
static inline void set_infoaddr(struct rr_regs *regs, volatile void *addr) static inline void set_infoaddr(struct rr_regs *regs, volatile dma_addr_t addr)
{ {
unsigned long baddr = virt_to_bus((void *)addr); unsigned long baddr = addr;
#if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN) #if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
writel(baddr & 0xffffffff, &regs->InfoPtrHi); writel(baddr & 0xffffffff, &regs->InfoPtrHi);
writel(baddr >> 32, &regs->InfoPtrLo); writel(baddr >> 32, &regs->InfoPtrLo);
...@@ -552,7 +552,7 @@ static inline void set_infoaddr(struct rr_regs *regs, volatile void *addr) ...@@ -552,7 +552,7 @@ static inline void set_infoaddr(struct rr_regs *regs, volatile void *addr)
#else #else
#define TX_RING_ENTRIES 16 #define TX_RING_ENTRIES 16
#endif #endif
#define TX_RING_SIZE (TX_RING_ENTRIES * sizeof(struct tx_desc)) #define TX_TOTAL_SIZE (TX_RING_ENTRIES * sizeof(struct tx_desc))
struct tx_desc{ struct tx_desc{
rraddr addr; rraddr addr;
...@@ -574,7 +574,7 @@ struct tx_desc{ ...@@ -574,7 +574,7 @@ struct tx_desc{
#else #else
#define RX_RING_ENTRIES 16 #define RX_RING_ENTRIES 16
#endif #endif
#define RX_RING_SIZE (RX_RING_ENTRIES * sizeof(struct rx_desc)) #define RX_TOTAL_SIZE (RX_RING_ENTRIES * sizeof(struct rx_desc))
struct rx_desc{ struct rx_desc{
rraddr addr; rraddr addr;
...@@ -798,24 +798,30 @@ struct rr_info { ...@@ -798,24 +798,30 @@ struct rr_info {
struct rr_private struct rr_private
{ {
struct rx_desc rx_ring[RX_RING_ENTRIES]; struct rx_desc *rx_ring;
struct tx_desc tx_ring[TX_RING_ENTRIES]; struct tx_desc *tx_ring;
struct event evt_ring[EVT_RING_ENTRIES]; struct event *evt_ring;
dma_addr_t tx_ring_dma;
dma_addr_t rx_ring_dma;
dma_addr_t evt_ring_dma;
/* Alignment ok ? */
struct sk_buff *rx_skbuff[RX_RING_ENTRIES]; struct sk_buff *rx_skbuff[RX_RING_ENTRIES];
struct sk_buff *tx_skbuff[TX_RING_ENTRIES]; struct sk_buff *tx_skbuff[TX_RING_ENTRIES];
struct rr_regs *regs; /* Register base */ struct rr_regs *regs; /* Register base */
struct ring_ctrl *rx_ctrl; /* Receive ring control */ struct ring_ctrl *rx_ctrl; /* Receive ring control */
struct rr_info *info; /* Shared info page */ struct rr_info *info; /* Shared info page */
struct net_device *next; dma_addr_t rx_ctrl_dma;
dma_addr_t info_dma;
spinlock_t lock; spinlock_t lock;
struct timer_list timer; struct timer_list timer;
u32 cur_rx, cur_cmd, cur_evt; u32 cur_rx, cur_cmd, cur_evt;
u32 dirty_rx, dirty_tx; u32 dirty_rx, dirty_tx;
u32 tx_full; u32 tx_full;
u32 fw_rev; u32 fw_rev;
short fw_running; volatile short fw_running;
char name[24]; /* The assigned name */ char name[24]; /* The assigned name */
struct net_device_stats stats; struct net_device_stats stats;
struct pci_dev *pci_dev;
}; };
...@@ -837,5 +843,6 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv, ...@@ -837,5 +843,6 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
unsigned long length); unsigned long length);
static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset); static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset);
static int rr_load_firmware(struct net_device *dev); static int rr_load_firmware(struct net_device *dev);
static inline void rr_raz_tx(struct rr_private *, struct net_device *);
static inline void rr_raz_rx(struct rr_private *, struct net_device *);
#endif /* _RRUNNER_H_ */ #endif /* _RRUNNER_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment