[intel] Update driver to use DMA API
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
+11
-11
@@ -32,7 +32,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <ipxe/ethernet.h>
|
||||
#include <ipxe/if_ether.h>
|
||||
#include <ipxe/iobuf.h>
|
||||
#include <ipxe/malloc.h>
|
||||
#include <ipxe/pci.h>
|
||||
#include "intelx.h"
|
||||
|
||||
@@ -186,11 +185,11 @@ static int intelx_open ( struct net_device *netdev ) {
|
||||
int rc;
|
||||
|
||||
/* Create transmit descriptor ring */
|
||||
if ( ( rc = intel_create_ring ( intel, &intel->tx ) ) != 0 )
|
||||
if ( ( rc = intel_create_ring ( intel, &intel->tx.ring ) ) != 0 )
|
||||
goto err_create_tx;
|
||||
|
||||
/* Create receive descriptor ring */
|
||||
if ( ( rc = intel_create_ring ( intel, &intel->rx ) ) != 0 )
|
||||
if ( ( rc = intel_create_ring ( intel, &intel->rx.ring ) ) != 0 )
|
||||
goto err_create_rx;
|
||||
|
||||
/* Program MAC address */
|
||||
@@ -264,9 +263,9 @@ static int intelx_open ( struct net_device *netdev ) {
|
||||
|
||||
return 0;
|
||||
|
||||
intel_destroy_ring ( intel, &intel->rx );
|
||||
intel_destroy_ring ( intel, &intel->rx.ring );
|
||||
err_create_rx:
|
||||
intel_destroy_ring ( intel, &intel->tx );
|
||||
intel_destroy_ring ( intel, &intel->tx.ring );
|
||||
err_create_tx:
|
||||
return rc;
|
||||
}
|
||||
@@ -292,13 +291,13 @@ static void intelx_close ( struct net_device *netdev ) {
|
||||
writel ( dmatxctl, intel->regs + INTELX_DMATXCTL );
|
||||
|
||||
/* Destroy receive descriptor ring */
|
||||
intel_destroy_ring ( intel, &intel->rx );
|
||||
intel_destroy_ring ( intel, &intel->rx.ring );
|
||||
|
||||
/* Discard any unused receive buffers */
|
||||
intel_empty_rx ( intel );
|
||||
/* Flush unused buffers */
|
||||
intel_flush ( intel );
|
||||
|
||||
/* Destroy transmit descriptor ring */
|
||||
intel_destroy_ring ( intel, &intel->tx );
|
||||
intel_destroy_ring ( intel, &intel->tx.ring );
|
||||
|
||||
/* Reset the NIC, to flush the transmit and receive FIFOs */
|
||||
intelx_reset ( intel );
|
||||
@@ -395,10 +394,11 @@ static int intelx_probe ( struct pci_device *pci ) {
|
||||
pci_set_drvdata ( pci, netdev );
|
||||
netdev->dev = &pci->dev;
|
||||
memset ( intel, 0, sizeof ( *intel ) );
|
||||
intel->dma = &pci->dma;
|
||||
intel->port = PCI_FUNC ( pci->busdevfn );
|
||||
intel_init_ring ( &intel->tx, INTEL_NUM_TX_DESC, INTELX_TD,
|
||||
intel_init_ring ( &intel->tx.ring, INTEL_NUM_TX_DESC, INTELX_TD,
|
||||
intel_describe_tx );
|
||||
intel_init_ring ( &intel->rx, INTEL_NUM_RX_DESC, INTELX_RD,
|
||||
intel_init_ring ( &intel->rx.ring, INTEL_NUM_RX_DESC, INTELX_RD,
|
||||
intel_describe_rx );
|
||||
|
||||
/* Fix up PCI device */
|
||||
|
||||
Reference in New Issue
Block a user