19 #define TG3_DEF_RX_MODE 0 20 #define TG3_DEF_TX_MODE 0 31 #define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \ 35 #define TG3_RX_RCB_RING_BYTES(tp) \ 36 (sizeof(struct tg3_rx_buffer_desc) * (TG3_RX_RET_MAX_SIZE_5705)) 38 #define TG3_RX_STD_RING_BYTES(tp) \ 39 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700) 42 {
DBGP(
"%s\n", __func__);
55 {
DBGP(
"%s\n", __func__);
67 tp->rx_rcb_mapping = 0;
75 tp->status_mapping = 0;
85 {
DBGP(
"%s\n", __func__);
92 DBGC(
tp->dev,
"hw_status alloc failed\n");
102 DBGC(
tp->dev,
"rx prodring alloc failed\n");
140 #define TG3_RX_STD_BUFF_RING_BYTES(tp) \ 141 (sizeof(struct ring_info) * TG3_RX_STD_MAX_SIZE_5700) 142 #define TG3_RX_STD_RING_BYTES(tp) \ 143 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700) 153 {
DBGP(
"%s\n", __func__);
179 {
DBGP(
"%s\n", __func__);
189 {
DBGP(
"%s\n", __func__);
204 {
DBGP(
"%s\n", __func__);
210 tp->last_irq_tag = 0;
211 tp->hw_status->status = 0;
212 tp->hw_status->status_tag = 0;
225 DBGC(
tp->dev,
"tg3_rx_prodring_alloc() failed\n");
234 {
DBGP(
"%s\n", __func__);
261 {
DBGP(
"%s\n", __func__);
274 static void tg3_dump_err_reg(
struct tg3 *
tp)
275 {
DBGP(
"%s\n", __func__);
287 {
DBGP(
"%s\n", __func__);
294 #define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) 300 {
DBGP(
"%s\n", __func__);
307 DBGC(
dev,
"Transmit ring full\n");
317 tp->tx_buffers[entry].iob = iob;
334 {
DBGP(
"%s\n", __func__);
337 u32 hw_idx =
tp->hw_status->idx[0].tx_consumer;
338 u32 sw_idx =
tp->tx_cons;
340 while (sw_idx != hw_idx) {
341 struct io_buffer *iob =
tp->tx_buffers[sw_idx].iob;
343 DBGC2(dev,
"Transmitted packet: %zd bytes\n",
iob_len(iob));
349 tp->tx_cons = sw_idx;
352 #define TG3_RX_STD_BUFF_RING_BYTES(tp) \ 353 (sizeof(struct ring_info) * TG3_RX_STD_MAX_SIZE_5700) 354 #define TG3_RX_STD_RING_BYTES(tp) \ 355 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700) 369 {
DBGP(
"%s\n", __func__);
374 int dest_idx, iob_idx;
394 desc->addr_hi = ((
u64)mapping >> 32);
395 desc->addr_lo = ((
u64)mapping & 0xffffffff);
401 {
DBGP(
"%s\n", __func__);
406 DBGCP(
tp->dev,
"%s\n", __func__);
411 DBGC(
tp->dev,
"alloc_iob() failed for descriptor %d\n", idx);
414 DBGC2(
tp->dev,
"allocated iob_buffer for descriptor %d\n", idx);
428 {
DBGP(
"%s\n", __func__);
432 u32 sw_idx =
tp->rx_rcb_ptr;
436 hw_idx = *(
tp->rx_rcb_prod_idx);
438 while (sw_idx != hw_idx) {
445 DBGC2(dev,
"RX - desc_idx: %d sw_idx: %d hw_idx: %d\n", desc_idx, sw_idx, hw_idx);
452 DBGC(dev,
"Corrupted packet received\n");
460 DBGC2(dev,
"Received packet: %d bytes %d %d\n",
len, sw_idx, hw_idx);
470 if (
tp->rx_rcb_ptr != sw_idx) {
472 tp->rx_rcb_ptr = sw_idx;
479 {
DBGP(
"%s\n", __func__);
497 {
DBGP(
"%s\n", __func__);
501 DBGP(
"%s\n", __func__);
512 {
DBGP(
"%s\n", __func__);
516 DBGP(
"%s: %d\n", __func__, enable);
532 #define TEST_BUFFER_SIZE 0x2000 538 {
DBGP(
"%s\n", __func__);
550 DBGC2(
tp->dev,
"dma test buffer, virt: %p phys: %#016lx\n", buf, buf_dma);
562 tp->dma_rwctrl |= 0x00180000;
566 tp->dma_rwctrl |= 0x003f0000;
568 tp->dma_rwctrl |= 0x003f000f;
573 u32 read_water = 0x7;
575 if (ccval == 0x6 || ccval == 0x7)
587 tp->dma_rwctrl |= 0x00144000;
590 tp->dma_rwctrl |= 0x00148000;
592 tp->dma_rwctrl |= 0x001b000f;
598 tp->dma_rwctrl &= 0xfffffff0;
645 "%s: Buffer write failed. err = %d\n",
656 "%s: Buffer corrupted on device! " 657 "(%d != %d)\n", __func__,
val, i);
666 DBGC(&
tp->pdev->dev,
"%s: Buffer read failed. " 667 "err = %d\n", __func__, ret);
684 "%s: Buffer corrupted on read back! " 685 "(%d != %d)\n", __func__, p[i], i);
717 {
DBGP(
"%s\n", __func__);
722 unsigned long reg_base, reg_size;
730 goto err_out_disable_pdev;
766 #if __BYTE_ORDER == __BIG_ENDIAN 776 DBGC(&
pdev->
dev,
"Failed to remap device registers\n");
778 goto err_out_disable_pdev;
783 DBGC(&
pdev->
dev,
"Problem fetching invariants of chip, aborting\n");
784 goto err_out_iounmap;
791 DBGC(&
pdev->
dev,
"Could not obtain valid ethernet address, aborting\n");
792 goto err_out_iounmap;
808 DBGC(&
pdev->
dev,
"DMA engine test failed, aborting\n");
809 goto err_out_iounmap;
820 DBGC(&
pdev->
dev,
"Cannot register net device, aborting\n");
821 goto err_out_iounmap;
829 DBGC(
tp->dev,
"tg3_setup_phy() call failed in %s\n", __func__);
830 goto err_out_iounmap;
843 err_out_disable_pdev:
849 {
DBGP(
"%s\n", __func__);
859 PCI_ROM(0x106b, 0x1645,
"106b-1645",
"106b-1645", 0),
860 PCI_ROM(0x1148, 0x4400,
"1148-4400",
"1148-4400", 0),
861 PCI_ROM(0x1148, 0x4500,
"1148-4500",
"1148-4500", 0),
862 PCI_ROM(0x14e4, 0x1600,
"14e4-1600",
"14e4-1600", 0),
863 PCI_ROM(0x14e4, 0x1601,
"14e4-1601",
"14e4-1601", 0),
864 PCI_ROM(0x14e4, 0x1644,
"14e4-1644",
"14e4-1644", 0),
865 PCI_ROM(0x14e4, 0x1645,
"14e4-1645",
"14e4-1645", 0),
866 PCI_ROM(0x14e4, 0x1646,
"14e4-1646",
"14e4-1646", 0),
867 PCI_ROM(0x14e4, 0x1647,
"14e4-1647",
"14e4-1647", 0),
868 PCI_ROM(0x14e4, 0x1648,
"14e4-1648",
"14e4-1648", 0),
869 PCI_ROM(0x14e4, 0x1649,
"14e4-1649",
"14e4-1649", 0),
870 PCI_ROM(0x14e4, 0x164d,
"14e4-164d",
"14e4-164d", 0),
871 PCI_ROM(0x14e4, 0x1653,
"14e4-1653",
"14e4-1653", 0),
872 PCI_ROM(0x14e4, 0x1654,
"14e4-1654",
"14e4-1654", 0),
873 PCI_ROM(0x14e4, 0x1655,
"14e4-1655",
"14e4-1655", 0),
874 PCI_ROM(0x14e4, 0x1656,
"14e4-1656",
"14e4-1656", 0),
875 PCI_ROM(0x14e4, 0x1657,
"14e4-1657",
"14e4-1657", 0),
876 PCI_ROM(0x14e4, 0x1659,
"14e4-1659",
"14e4-1659", 0),
877 PCI_ROM(0x14e4, 0x165a,
"14e4-165a",
"14e4-165a", 0),
878 PCI_ROM(0x14e4, 0x165b,
"14e4-165b",
"14e4-165b", 0),
879 PCI_ROM(0x14e4, 0x165d,
"14e4-165d",
"14e4-165d", 0),
880 PCI_ROM(0x14e4, 0x165e,
"14e4-165e",
"14e4-165e", 0),
881 PCI_ROM(0x14e4, 0x165f,
"14e4-165f",
"14e4-165f", 0),
882 PCI_ROM(0x14e4, 0x1668,
"14e4-1668",
"14e4-1668", 0),
883 PCI_ROM(0x14e4, 0x1669,
"14e4-1669",
"14e4-1669", 0),
884 PCI_ROM(0x14e4, 0x166a,
"14e4-166a",
"14e4-166a", 0),
885 PCI_ROM(0x14e4, 0x166b,
"14e4-166b",
"14e4-166b", 0),
886 PCI_ROM(0x14e4, 0x166e,
"14e4-166e",
"14e4-166e", 0),
887 PCI_ROM(0x14e4, 0x1672,
"14e4-1672",
"14e4-1672", 0),
888 PCI_ROM(0x14e4, 0x1673,
"14e4-1673",
"14e4-1673", 0),
889 PCI_ROM(0x14e4, 0x1674,
"14e4-1674",
"14e4-1674", 0),
890 PCI_ROM(0x14e4, 0x1677,
"14e4-1677",
"14e4-1677", 0),
891 PCI_ROM(0x14e4, 0x1678,
"14e4-1678",
"14e4-1678", 0),
892 PCI_ROM(0x14e4, 0x1679,
"14e4-1679",
"14e4-1679", 0),
893 PCI_ROM(0x14e4, 0x167a,
"14e4-167a",
"14e4-167a", 0),
894 PCI_ROM(0x14e4, 0x167b,
"14e4-167b",
"14e4-167b", 0),
895 PCI_ROM(0x14e4, 0x167d,
"14e4-167d",
"14e4-167d", 0),
896 PCI_ROM(0x14e4, 0x167e,
"14e4-167e",
"14e4-167e", 0),
897 PCI_ROM(0x14e4, 0x167f,
"14e4-167f",
"14e4-167f", 0),
898 PCI_ROM(0x14e4, 0x1680,
"14e4-1680",
"14e4-1680", 0),
899 PCI_ROM(0x14e4, 0x1681,
"14e4-1681",
"14e4-1681", 0),
900 PCI_ROM(0x14e4, 0x1682,
"14e4-1682",
"14e4-1682", 0),
901 PCI_ROM(0x14e4, 0x1684,
"14e4-1684",
"14e4-1684", 0),
902 PCI_ROM(0x14e4, 0x1686,
"14e4-1686",
"14e4-1686", 0),
903 PCI_ROM(0x14e4, 0x1688,
"14e4-1688",
"14e4-1688", 0),
904 PCI_ROM(0x14e4, 0x1689,
"14e4-1689",
"14e4-1689", 0),
905 PCI_ROM(0x14e4, 0x1690,
"14e4-1690",
"14e4-1690", 0),
906 PCI_ROM(0x14e4, 0x1691,
"14e4-1691",
"14e4-1691", 0),
907 PCI_ROM(0x14e4, 0x1692,
"14e4-1692",
"14e4-1692", 0),
908 PCI_ROM(0x14e4, 0x1693,
"14e4-1693",
"14e4-1693", 0),
909 PCI_ROM(0x14e4, 0x1694,
"14e4-1694",
"14e4-1694", 0),
910 PCI_ROM(0x14e4, 0x1696,
"14e4-1696",
"14e4-1696", 0),
911 PCI_ROM(0x14e4, 0x1698,
"14e4-1698",
"14e4-1698", 0),
912 PCI_ROM(0x14e4, 0x1699,
"14e4-1699",
"14e4-1699", 0),
913 PCI_ROM(0x14e4, 0x169a,
"14e4-169a",
"14e4-169a", 0),
914 PCI_ROM(0x14e4, 0x169b,
"14e4-169b",
"14e4-169b", 0),
915 PCI_ROM(0x14e4, 0x169c,
"14e4-169c",
"14e4-169c", 0),
916 PCI_ROM(0x14e4, 0x169d,
"14e4-169d",
"14e4-169d", 0),
917 PCI_ROM(0x14e4, 0x16a0,
"14e4-16a0",
"14e4-16a0", 0),
918 PCI_ROM(0x14e4, 0x16a6,
"14e4-16a6",
"14e4-16a6", 0),
919 PCI_ROM(0x14e4, 0x16a7,
"14e4-16a7",
"14e4-16a7", 0),
920 PCI_ROM(0x14e4, 0x16a8,
"14e4-16a8",
"14e4-16a8", 0),
921 PCI_ROM(0x14e4, 0x16b0,
"14e4-16b0",
"14e4-16b0", 0),
922 PCI_ROM(0x14e4, 0x16b1,
"14e4-16b1",
"14e4-16b1", 0),
923 PCI_ROM(0x14e4, 0x16b2,
"14e4-16b2",
"14e4-16b2", 0),
924 PCI_ROM(0x14e4, 0x16b4,
"14e4-16b4",
"14e4-16b4", 0),
925 PCI_ROM(0x14e4, 0x16b5,
"14e4-16b5",
"14e4-16b5", 0),
926 PCI_ROM(0x14e4, 0x16b6,
"14e4-16b6",
"14e4-16b6", 0),
927 PCI_ROM(0x14e4, 0x16c6,
"14e4-16c6",
"14e4-16c6", 0),
928 PCI_ROM(0x14e4, 0x16c7,
"14e4-16c7",
"14e4-16c7", 0),
929 PCI_ROM(0x14e4, 0x16dd,
"14e4-16dd",
"14e4-16dd", 0),
930 PCI_ROM(0x14e4, 0x16f7,
"14e4-16f7",
"14e4-16f7", 0),
931 PCI_ROM(0x14e4, 0x16fd,
"14e4-16fd",
"14e4-16fd", 0),
932 PCI_ROM(0x14e4, 0x16fe,
"14e4-16fe",
"14e4-16fe", 0),
933 PCI_ROM(0x14e4, 0x170d,
"14e4-170d",
"14e4-170d", 0),
934 PCI_ROM(0x14e4, 0x170e,
"14e4-170e",
"14e4-170e", 0),
935 PCI_ROM(0x14e4, 0x1712,
"14e4-1712",
"14e4-1712", 0),
936 PCI_ROM(0x14e4, 0x1713,
"14e4-1713",
"14e4-1713", 0),
937 PCI_ROM(0x173b, 0x03e8,
"173b-03e8",
"173b-03e8", 0),
938 PCI_ROM(0x173b, 0x03e9,
"173b-03e9",
"173b-03e9", 0),
939 PCI_ROM(0x173b, 0x03ea,
"173b-03ea",
"173b-03ea", 0),
940 PCI_ROM(0x173b, 0x03eb,
"173b-03eb",
"173b-03eb", 0),
#define EINVAL
Invalid argument.
#define MEMARB_MODE_ENABLE
void tg3_rx_prodring_fini(struct tg3_rx_prodring_set *tpr)
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
int printf(const char *fmt,...)
Write a formatted string to the console.
static unsigned int unsigned int reg
void tg3_init_bufmgr_config(struct tg3 *tp)
#define DMA_RWCTRL_WRITE_BNDRY_MASK
#define MISC_HOST_CTRL_PCISTATE_RW
#define TG3_DMA_ALIGNMENT
#define MAILBOX_INTERRUPT_0
static int tg3_open(struct net_device *dev)
static void tg3_tx_complete(struct net_device *dev)
#define le32_to_cpu(value)
int(* open)(struct net_device *netdev)
Open network device.
static u32 tg3_tx_avail(struct tg3 *tp)
static void tg3_poll(struct net_device *dev)
struct tg3_hw_status::@345 idx[16]
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
static void tg3_rx_prodring_free(struct tg3_rx_prodring_set *tpr)
#define MAILBOX_RCVRET_CON_IDX_0
#define DMA_RWCTRL_PCI_READ_CMD_SHIFT
uint8_t size
Entry size (in 32-bit words)
uint64_t desc
Microcode descriptor list physical address.
#define TG3_RX_RET_MAX_SIZE_5705
#define DMA_RWCTRL_DIS_CACHE_ALIGNMENT
#define GRC_MODE_BSWAP_DATA
#define ENOENT
No such file or directory.
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
static void tg3_free_consistent(struct tg3 *tp)
#define PCI_BASE_ADDRESS_0
int tg3_setup_phy(struct tg3 *tp, int force_reset)
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
#define TG3_RX_STD_MAX_SIZE_5700
#define TG3_RX_STD_DMA_SZ
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define tw32_rx_mbox(reg, val)
#define GET_ASIC_REV(CHIP_REV_ID)
#define PCI_SUBSYSTEM_ID
PCI subsystem ID.
#define GRC_MODE_WSWAP_DATA
struct device dev
Generic device.
void tg3_poll_link(struct tg3 *tp)
#define RXD_ERR_ODD_NIBBLE_RCVD_MII
Dynamic memory allocation.
static void tg3_rx_iob_free(struct io_buffer *iobs[], int i)
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
int tg3_halt(struct tg3 *tp)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define GRC_MODE_BSWAP_NONFRM_DATA
void tg3_set_power_state_0(struct tg3 *tp)
void * priv
Driver private data.
#define TG3_RX_STD_RING_BYTES(tp)
#define TG3_64BIT_REG_LOW
static void tg3_refill_prod_ring(struct tg3 *tp)
#define __unused
Declare a variable or data structure as unused.
#define TG3_DEF_TX_RING_PENDING
int errno
Global "last error" number.
struct pci_driver tg3_pci_driver __pci_driver
#define HOSTCC_MODE_ENABLE
static struct net_device * netdev
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
static struct tulip_private * tp
static void tg3_rx_complete(struct net_device *dev)
#define DMA_RWCTRL_USE_MEM_READ_MULT
void unregister_netdev(struct net_device *netdev)
Unregister network device.
#define GRC_MODE_WSWAP_NONFRM_DATA
#define DMA_RWCTRL_WRITE_WATER_SHIFT
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
#define tg3_flag(tp, flag)
void * zalloc(size_t size)
Allocate cleared memory.
#define DMA_RWCTRL_WRITE_BNDRY_16
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define TG3_DEF_RX_RING_PENDING
static int tg3_alloc_rx_iob(struct tg3_rx_prodring_set *tpr, u32 dest_idx_unmasked)
#define ENODEV
No such device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void tg3_irq(struct net_device *dev, int enable)
#define MISC_HOST_CTRL_INDIR_ACCESS
static void tg3_switch_clocks(struct tg3 *tp)
A PCI device ID list entry.
#define TG3PCI_DMA_RW_CTRL
static void tg3_close(struct net_device *dev)
#define tg3_flag_clear(tp, flag)
void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
void tg3_set_txd(struct tg3 *tp, int entry, dma_addr_t mapping, int len, u32 flags)
#define MISC_HOST_CTRL_MASK_PCI_INT
#define DMA_RWCTRL_ASSERT_ALL_BE
Network device operations.
#define TG3_RX_STD_PROD_IDX_REG
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
#define TG3_HW_STATUS_SIZE
#define TG3PCI_CLOCK_CTRL
#define TG3_TX_RING_BYTES
#define RXD_OPAQUE_RING_STD
Network device management.
static struct net_device_operations tg3_netdev_ops
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
#define RXD_OPAQUE_INDEX_SHIFT
static void tg3_remove_one(struct pci_device *pci)
#define TG3_RX_RCB_RING_BYTES(tp)
dma_addr_t rx_std_mapping
static int tg3_transmit(struct net_device *dev, struct io_buffer *iob)
static struct pci_device_id tg3_nics[]
#define SD_STATUS_UPDATED
int tg3_get_device_address(struct tg3 *tp)
#define ENOBUFS
No buffer space available.
#define DMA_RWCTRL_PCI_WRITE_CMD_SHIFT
Media Independent Interface constants.
#define MISC_HOST_CTRL_WORD_SWAP
void * data
Start of data.
#define WDMAC_MODE_ENABLE
#define barrier()
Optimisation barrier.
int tg3_init_rings(struct tg3 *tp)
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
#define DMA_RWCTRL_ONE_DMA
#define MAILBOX_SNDHOST_PROD_IDX_0
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
struct io_buffer * rx_iobufs[TG3_DEF_RX_RING_PENDING]
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
struct tg3_rx_buffer_desc * rx_std
void mb(void)
Memory barrier.
#define PCI_SUBSYSTEM_VENDOR_ID
PCI subsystem vendor ID.
static int tg3_test_dma(struct tg3 *tp)
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define DMA_RWCTRL_READ_WATER_SHIFT
#define RXD_OPAQUE_INDEX_MASK
void tg3_enable_ints(struct tg3 *tp)
#define NULL
NULL pointer (VOID *)
#define tw32_mailbox(reg, val)
#define tw32_mailbox(reg, val) tg3_write_indirect_mbox(((val) & 0xffffffff), tp->regs + (reg))
#define PCI_ROM(_vendor, _device, _name, _description, _data)
void tg3_disable_ints(struct tg3 *tp)
int tg3_init_hw(struct tg3 *tp, int reset_phy)
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.
static int tg3_rx_prodring_alloc(struct tg3 __unused *tp, struct tg3_rx_prodring_set *tpr)
int tg3_alloc_consistent(struct tg3 *tp)
if(natsemi->flags &NATSEMI_64BIT) return 1
#define tw32_tx_mbox(reg, val)
int tg3_get_invariants(struct tg3 *tp)
static int tg3_init_one(struct pci_device *pdev)
void * memset(void *dest, int character, size_t len) __nonnull
int tg3_do_test_dma(struct tg3 *tp, u32 __unused *buf, dma_addr_t buf_dma, int size, int to_device)