82 DBGC ( myson,
"MYSON %p using configuration %08x\n",
88 DBGC ( myson,
"MYSON %p timed out waiting for reset\n", myson );
116 DBGC ( myson,
"MYSON %p timed out waiting for configuration " 160 size_t len = ( ring->
count *
sizeof ( ring->
desc[0] ) );
169 if ( ! ring->
desc ) {
177 DBGC ( myson,
"MYSON %p cannot support 64-bit ring address\n",
185 for ( i = 0 ; i < ring->
count ; i++ ) {
193 DBGC ( myson,
"MYSON %p ring %02x is at [%08llx,%08llx)\n",
194 myson, ring->
reg, ( (
unsigned long long )
address ),
214 size_t len = ( ring->
count *
sizeof ( ring->
desc[0] ) );
249 if ( ! myson_address_ok (
address ) ) {
250 DBGC ( myson,
"MYSON %p cannot support 64-bit RX " 251 "buffer address\n", myson );
275 DBGC2 ( myson,
"MYSON %p RX %d is [%llx,%llx)\n", myson,
276 rx_idx, ( (
unsigned long long )
address ),
346 DBGC ( myson,
"MYSON %p timed out waiting for idle state (status " 347 "%08x)\n", myson, tcr_rcr );
396 if ( ! myson_address_ok (
address ) ) {
397 DBGC ( myson,
"MYSON %p cannot support 64-bit TX buffer " 398 "address\n", myson );
404 DBGC ( myson,
"MYSON %p out of transmit descriptors\n",
425 DBGC2 ( myson,
"MYSON %p TX %d is [%llx,%llx)\n", myson, tx_idx,
426 ( (
unsigned long long )
address ),
456 DBGC ( myson,
"MYSON %p TX %d completion error " 457 "(%08x)\n", myson, tx_idx,
461 DBGC2 ( myson,
"MYSON %p TX %d complete\n",
500 DBGC ( myson,
"MYSON %p RX %d error (length %zd, " 501 "status %08x)\n", myson, rx_idx,
len,
505 DBGC2 ( myson,
"MYSON %p RX %d complete (length " 506 "%zd)\n", myson, rx_idx,
len );
601 memset ( myson, 0,
sizeof ( *myson ) );
610 if ( ! myson->
regs ) {
626 goto err_register_netdev;
668 PCI_ROM ( 0x1516, 0x0800,
"mtd800",
"MTD-8xx", 0 ),
669 PCI_ROM ( 0x1516, 0x0803,
"mtd803",
"Surecom EP-320X-S", 0 ),
670 PCI_ROM ( 0x1516, 0x0891,
"mtd891",
"MTD-8xx", 0 ),
#define MYSON_RX_STAT_OWN
Owner.
unsigned long membase
Memory base.
struct arbelprm_rc_send_wqe rc
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
static void myson_poll(struct net_device *netdev)
Poll for completed and received packets.
#define MYSON_RCR_RE
Receive enable.
#define MYSON_BCR_PBL_MASK
#define le32_to_cpu(value)
int(* open)(struct net_device *netdev)
Open network device.
static void myson_remove(struct pci_device *pci)
Remove PCI device.
uint32_t next
Next descriptor address.
static void myson_poll_tx(struct net_device *netdev)
Poll for completed packets.
#define MYSON_AUTOLD_MAX_WAIT_MS
Maximum time to wait for a configuration reload, in milliseconds.
#define MYSON_TCR_RCR
Transmit and Receive Configuration Register.
#define MYSON_TX_STAT_ABORT
Abort.
static void netdev_tx_complete_next(struct net_device *netdev)
Complete network transmission.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
uint64_t address
Base address.
struct pci_driver myson_driver __pci_driver
Myson PCI driver.
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
uint64_t desc
Microcode descriptor list physical address.
struct myson_descriptor * desc
Descriptors.
struct io_buffer * rx_iobuf[MYSON_NUM_RX_DESC]
Receive I/O buffers.
#define MYSON_RCR_ALP
Accept long packet.
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
#define MYSON_ISR_IODELAY_COUNT
Number of I/O delays between ISR reads.
void netdev_tx_complete_next_err(struct net_device *netdev, int rc)
Complete network transmission.
static void myson_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
#define MYSON_RCR_AB
Accept broadcast.
#define MYSON_RING_ALIGN
Descriptor ring alignment.
static int myson_open(struct net_device *netdev)
Open network device.
#define MYSON_ROM_MII
Boot ROM / EEPROM / MII Management Register.
uint8_t mac[ETH_ALEN]
MAC address.
static int myson_reload_config(struct myson_nic *myson)
Reload configuration from EEPROM.
#define MYSON_RX_CTRL_RBS(x)
Receive buffer size.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define MYSON_RCR_RXS
Receive status.
struct device dev
Generic device.
#define MYSON_RCR_ARP
Accept runt packet.
#define ENOTSUP
Operation not supported.
Dynamic memory allocation.
static int myson_reset(struct myson_nic *myson)
Reset hardware.
Myson Technology network card driver.
#define MYSON_ISR
Interrupt Status Register.
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.
#define MYSON_TX_CTRL_TBS(x)
Transmit buffer size.
static struct net_device_operations myson_operations
Myson network device operations.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int myson_soft_reset(struct myson_nic *myson)
Reset controller chip.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define MYSON_BCR_WIE
Write and invalidate.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
unsigned int reg
Descriptor start address register.
void * priv
Driver private data.
#define MYSON_TCR_TE
Transmit enable.
#define MYSON_RXLBA
Receive List Base Address.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
#define MYSON_BCR_RLE
Read line enable.
static struct net_device * netdev
static struct pci_device_id myson_nics[]
Myson PCI device IDs.
static void myson_destroy_ring(struct myson_nic *myson, struct myson_ring *ring)
Destroy descriptor ring.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
struct myson_ring rx
Receive descriptor ring.
#define MYSON_TX_STAT_CSL
Carrier sense lost.
#define cpu_to_le32(value)
static void myson_poll_rx(struct net_device *netdev)
Poll for received packets.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define MYSON_PAR4
Physical Address Register 4.
unsigned int prod
Producer index.
#define MYSON_IDLE_MAX_WAIT_MS
Maximum time to wait for transmit and receive to be idle, in milliseconds.
struct myson_ring tx
Transmit descriptor ring.
#define MYSON_TXLBA
Transmit List Base Address.
#define MYSON_TX_CTRL_PAD
Pad control.
static int myson_probe(struct pci_device *pci)
Probe PCI device.
static int myson_wait_idle(struct myson_nic *myson)
Wait for transmit and receive to become idle.
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 MYSON_RCR_PROM
Promiscuous mode.
Media Independent Interface.
#define ENODEV
No such device.
#define MYSON_NUM_TX_DESC
Number of transmit descriptors.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
unsigned int cons
Consumer index.
static void myson_refill_rx(struct net_device *netdev)
Refill receive descriptor ring.
#define MYSON_PAR0
Physical Address Register 0.
#define MYSON_RCR_AM
Accept multicast.
#define MYSON_BCR_PBL_DEFAULT
A PCI device ID list entry.
#define MYSON_BCR
Bus Command Register.
#define MYSON_BCR_SWR
Software reset.
#define MYSON_BAR_SIZE
BAR size.
#define MYSON_IRQ_TI
Transmit interrupt.
static struct xen_remove_from_physmap * remove
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
#define MYSON_NUM_RX_DESC
Number of receive descriptors.
struct device * dev
Underlying hardware device.
static void myson_close(struct net_device *netdev)
Close network device.
#define MYSON_TXPDR
Transmit Poll Demand Register.
Network device management.
#define MYSON_TX_CTRL_FD
First descriptor.
#define MYSON_IRQ_RI
Receive interrupt.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define ENOBUFS
No buffer space available.
int(* probe)(struct pci_device *pci)
Probe device.
#define MYSON_RX_MAX_LEN
Receive buffer length.
static int myson_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
#define MYSON_BCR_RME
Read multiple enable.
void * data
Start of data.
#define EIO
Input/output error.
#define MYSON_TX_CTRL_RTLC
Retry late collision.
unsigned int count
Number of descriptors.
#define MYSON_TX_CTRL_PKTS(x)
Packet size.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
#define MYSON_TX_CTRL_LD
Last descriptor.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
#define MYSON_TCR_TXS
Transmit status.
#define MYSON_TX_STAT_OWN
Owner.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
#define MYSON_TX_CTRL_IC
Interrupt control.
#define MYSON_RX_STAT_ES
Error summary.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define MYSON_RX_STAT_FLNG(status)
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define MYSON_TX_CTRL_CRC
CRC append.
#define MYSON_ROM_AUTOLD
Auto load.
void iodelay(void)
Slow down I/O.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
#define ETIMEDOUT
Connection timed out.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
#define MYSON_IMR
Interrupt Mask Register.
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
#define MYSON_RXPDR
Receive Poll Demand Register.
static int myson_create_ring(struct myson_nic *myson, struct myson_ring *ring)
Create descriptor ring.
void * memset(void *dest, int character, size_t len) __nonnull
#define MYSON_RESET_MAX_WAIT_MS
Maximum time to wait for a reset, in milliseconds.