[realtek] Update driver to use DMA API

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2020-11-04 15:25:30 +00:00
parent 38a54bd3b1
commit 580d9b00da
2 changed files with 127 additions and 95 deletions

View File

@@ -247,6 +247,8 @@ enum realtek_legacy_status {
struct realtek_ring {
/** Descriptors */
struct realtek_descriptor *desc;
/** Descriptor ring DMA mapping */
struct dma_mapping map;
/** Producer index */
unsigned int prod;
/** Consumer index */
@@ -272,10 +274,40 @@ realtek_init_ring ( struct realtek_ring *ring, unsigned int count,
ring->reg = reg;
}
/** Transmit ring */
struct realtek_tx_ring {
/** Descriptor ring */
struct realtek_ring ring;
/** DMA mappings */
struct dma_mapping map[RTL_NUM_TX_DESC];
};
/** Receive ring */
struct realtek_rx_ring {
/** Descriptor ring */
struct realtek_ring ring;
/** I/O buffers */
struct io_buffer *iobuf[RTL_NUM_RX_DESC];
/** DMA mappings */
struct dma_mapping map[RTL_NUM_RX_DESC];
};
/** Receive buffer (legacy mode *) */
struct realtek_rx_buffer {
/** Buffer */
void *data;
/** Buffer DMA mapping */
struct dma_mapping map;
/** Offset within buffer */
unsigned int offset;
};
/** A Realtek network card */
struct realtek_nic {
/** Registers */
void *regs;
/** DMA device */
struct dma_device *dma;
/** SPI bit-bashing interface */
struct spi_bit_basher spibit;
/** EEPROM */
@@ -295,15 +327,11 @@ struct realtek_nic {
unsigned int tppoll;
/** Transmit descriptor ring */
struct realtek_ring tx;
struct realtek_tx_ring tx;
/** Receive descriptor ring */
struct realtek_ring rx;
/** Receive I/O buffers */
struct io_buffer *rx_iobuf[RTL_NUM_RX_DESC];
struct realtek_rx_ring rx;
/** Receive buffer (legacy mode) */
void *rx_buffer;
/** Offset within receive buffer (legacy mode) */
unsigned int rx_offset;
struct realtek_rx_buffer rxbuf;
};
#endif /* _REALTEK_H */