iPXE
Data Structures | Defines | Functions | Variables
myson.h File Reference

Myson Technology network card driver. More...

#include <stdint.h>
#include <ipxe/if_ether.h>

Go to the source code of this file.

Data Structures

struct  myson_descriptor
 A packet descriptor. More...
union  myson_physical_address
 Physical address. More...
struct  myson_ring
 A Myson descriptor ring. More...

Defines

#define MYSON_BAR_SIZE   256
 BAR size.
#define MYSON_TX_STAT_OWN   0x80000000UL
 Owner.
#define MYSON_TX_STAT_ABORT   0x00002000UL
 Abort.
#define MYSON_TX_STAT_CSL   0x00001000UL
 Carrier sense lost.
#define MYSON_TX_CTRL_IC   0x80000000UL
 Interrupt control.
#define MYSON_TX_CTRL_LD   0x20000000UL
 Last descriptor.
#define MYSON_TX_CTRL_FD   0x10000000UL
 First descriptor.
#define MYSON_TX_CTRL_CRC   0x08000000UL
 CRC append.
#define MYSON_TX_CTRL_PAD   0x04000000UL
 Pad control.
#define MYSON_TX_CTRL_RTLC   0x02000000UL
 Retry late collision.
#define MYSON_TX_CTRL_PKTS(x)   ( (x) << 11 )
 Packet size.
#define MYSON_TX_CTRL_TBS(x)   ( (x) << 0 )
 Transmit buffer size.
#define MYSON_RX_STAT_OWN   0x80000000UL
 Owner.
#define MYSON_RX_STAT_FLNG(status)   ( ( (status) >> 16 ) & 0xfff )
#define MYSON_RX_STAT_ES   0x00000080UL
 Error summary.
#define MYSON_RX_CTRL_RBS(x)   ( (x) << 0 )
 Receive buffer size.
#define MYSON_RING_ALIGN   4
 Descriptor ring alignment.
#define MYSON_PAR0   0x00
 Physical Address Register 0.
#define MYSON_PAR4   0x04
 Physical Address Register 4.
#define MYSON_TCR_RCR   0x18
 Transmit and Receive Configuration Register.
#define MYSON_TCR_TXS   0x80000000UL
 Transmit status.
#define MYSON_TCR_TE   0x00040000UL
 Transmit enable.
#define MYSON_RCR_RXS   0x00008000UL
 Receive status.
#define MYSON_RCR_PROM   0x00000080UL
 Promiscuous mode.
#define MYSON_RCR_AB   0x00000040UL
 Accept broadcast.
#define MYSON_RCR_AM   0x00000020UL
 Accept multicast.
#define MYSON_RCR_ARP   0x00000008UL
 Accept runt packet.
#define MYSON_RCR_ALP   0x00000004UL
 Accept long packet.
#define MYSON_RCR_RE   0x00000001UL
 Receive enable.
#define MYSON_IDLE_MAX_WAIT_MS   100
 Maximum time to wait for transmit and receive to be idle, in milliseconds.
#define MYSON_BCR   0x1c
 Bus Command Register.
#define MYSON_BCR_RLE   0x00000100UL
 Read line enable.
#define MYSON_BCR_RME   0x00000080UL
 Read multiple enable.
#define MYSON_BCR_WIE   0x00000040UL
 Write and invalidate.
#define MYSON_BCR_PBL(x)   ( (x) << 3 )
 Burst length.
#define MYSON_BCR_PBL_MASK   MYSON_BCR_PBL ( 0x7 )
#define MYSON_BCR_PBL_DEFAULT   MYSON_BCR_PBL ( 0x6 )
#define MYSON_BCR_SWR   0x00000001UL
 Software reset.
#define MYSON_RESET_MAX_WAIT_MS   100
 Maximum time to wait for a reset, in milliseconds.
#define MYSON_TXPDR   0x20
 Transmit Poll Demand Register.
#define MYSON_RXPDR   0x24
 Receive Poll Demand Register.
#define MYSON_TXLBA   0x2c
 Transmit List Base Address.
#define MYSON_NUM_TX_DESC   4
 Number of transmit descriptors.
#define MYSON_RXLBA   0x30
 Receive List Base Address.
#define MYSON_NUM_RX_DESC   4
 Number of receive descriptors.
#define MYSON_RX_MAX_LEN   ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )
 Receive buffer length.
#define MYSON_ISR   0x34
 Interrupt Status Register.
#define MYSON_IRQ_TI   0x00000008UL
 Transmit interrupt.
#define MYSON_IRQ_RI   0x00000004UL
 Receive interrupt.
#define MYSON_ISR_IODELAY_COUNT   4
 Number of I/O delays between ISR reads.
#define MYSON_IMR   0x38
 Interrupt Mask Register.
#define MYSON_ROM_MII   0x40
 Boot ROM / EEPROM / MII Management Register.
#define MYSON_ROM_AUTOLD   0x00100000UL
 Auto load.
#define MYSON_AUTOLD_MAX_WAIT_MS   100
 Maximum time to wait for a configuration reload, in milliseconds.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
struct myson_descriptor __attribute__ ((packed))
static __attribute__ ((always_inline)) void myson_init_ring(struct myson_ring *ring
 Initialise descriptor ring.

Variables

uint32_t status
 Status.
uint32_t control
 Control.
uint32_t address
 Buffer start address.
uint32_t next
 Next descriptor address.
uint32_t low
uint32_t high
union myson_physical_address __attribute__
static unsigned int count

Detailed Description

Myson Technology network card driver.

Definition in file myson.h.


Define Documentation

#define MYSON_BAR_SIZE   256

BAR size.

Definition at line 16 of file myson.h.

Referenced by myson_probe().

#define MYSON_TX_STAT_OWN   0x80000000UL

Owner.

Definition at line 31 of file myson.h.

Referenced by myson_poll_tx(), and myson_transmit().

#define MYSON_TX_STAT_ABORT   0x00002000UL

Abort.

Definition at line 32 of file myson.h.

Referenced by myson_poll_tx().

#define MYSON_TX_STAT_CSL   0x00001000UL

Carrier sense lost.

Definition at line 33 of file myson.h.

Referenced by myson_poll_tx().

#define MYSON_TX_CTRL_IC   0x80000000UL

Interrupt control.

Definition at line 36 of file myson.h.

Referenced by myson_transmit().

#define MYSON_TX_CTRL_LD   0x20000000UL

Last descriptor.

Definition at line 37 of file myson.h.

Referenced by myson_transmit().

#define MYSON_TX_CTRL_FD   0x10000000UL

First descriptor.

Definition at line 38 of file myson.h.

Referenced by myson_transmit().

#define MYSON_TX_CTRL_CRC   0x08000000UL

CRC append.

Definition at line 39 of file myson.h.

Referenced by myson_transmit().

#define MYSON_TX_CTRL_PAD   0x04000000UL

Pad control.

Definition at line 40 of file myson.h.

Referenced by myson_transmit().

#define MYSON_TX_CTRL_RTLC   0x02000000UL

Retry late collision.

Definition at line 41 of file myson.h.

Referenced by myson_transmit().

#define MYSON_TX_CTRL_PKTS (   x)    ( (x) << 11 )

Packet size.

Definition at line 42 of file myson.h.

Referenced by myson_transmit().

#define MYSON_TX_CTRL_TBS (   x)    ( (x) << 0 )

Transmit buffer size.

Definition at line 43 of file myson.h.

Referenced by myson_transmit().

#define MYSON_RX_STAT_OWN   0x80000000UL

Owner.

Definition at line 46 of file myson.h.

Referenced by myson_poll_rx(), and myson_refill_rx().

#define MYSON_RX_STAT_FLNG (   status)    ( ( (status) >> 16 ) & 0xfff )

Definition at line 47 of file myson.h.

Referenced by myson_poll_rx().

#define MYSON_RX_STAT_ES   0x00000080UL

Error summary.

Definition at line 48 of file myson.h.

Referenced by myson_poll_rx().

#define MYSON_RX_CTRL_RBS (   x)    ( (x) << 0 )

Receive buffer size.

Definition at line 51 of file myson.h.

Referenced by myson_refill_rx().

#define MYSON_RING_ALIGN   4

Descriptor ring alignment.

Definition at line 54 of file myson.h.

Referenced by myson_create_ring().

#define MYSON_PAR0   0x00

Physical Address Register 0.

Definition at line 57 of file myson.h.

Referenced by myson_open(), and myson_probe().

#define MYSON_PAR4   0x04

Physical Address Register 4.

Definition at line 60 of file myson.h.

Referenced by myson_open(), and myson_probe().

#define MYSON_TCR_RCR   0x18

Transmit and Receive Configuration Register.

Definition at line 72 of file myson.h.

Referenced by myson_close(), myson_open(), and myson_wait_idle().

#define MYSON_TCR_TXS   0x80000000UL

Transmit status.

Definition at line 73 of file myson.h.

Referenced by myson_wait_idle().

#define MYSON_TCR_TE   0x00040000UL

Transmit enable.

Definition at line 74 of file myson.h.

Referenced by myson_open().

#define MYSON_RCR_RXS   0x00008000UL

Receive status.

Definition at line 75 of file myson.h.

Referenced by myson_wait_idle().

#define MYSON_RCR_PROM   0x00000080UL

Promiscuous mode.

Definition at line 76 of file myson.h.

Referenced by myson_open().

#define MYSON_RCR_AB   0x00000040UL

Accept broadcast.

Definition at line 77 of file myson.h.

Referenced by myson_open().

#define MYSON_RCR_AM   0x00000020UL

Accept multicast.

Definition at line 78 of file myson.h.

Referenced by myson_open().

#define MYSON_RCR_ARP   0x00000008UL

Accept runt packet.

Definition at line 79 of file myson.h.

Referenced by myson_open().

#define MYSON_RCR_ALP   0x00000004UL

Accept long packet.

Definition at line 80 of file myson.h.

Referenced by myson_open().

#define MYSON_RCR_RE   0x00000001UL

Receive enable.

Definition at line 81 of file myson.h.

Referenced by myson_open().

#define MYSON_IDLE_MAX_WAIT_MS   100

Maximum time to wait for transmit and receive to be idle, in milliseconds.

Definition at line 84 of file myson.h.

Referenced by myson_wait_idle().

#define MYSON_BCR   0x1c

Bus Command Register.

Definition at line 87 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_BCR_RLE   0x00000100UL

Read line enable.

Definition at line 88 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_BCR_RME   0x00000080UL

Read multiple enable.

Definition at line 89 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_BCR_WIE   0x00000040UL

Write and invalidate.

Definition at line 90 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_BCR_PBL (   x)    ( (x) << 3 )

Burst length.

Definition at line 91 of file myson.h.

#define MYSON_BCR_PBL_MASK   MYSON_BCR_PBL ( 0x7 )

Definition at line 92 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_BCR_PBL_DEFAULT   MYSON_BCR_PBL ( 0x6 )

Definition at line 93 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_BCR_SWR   0x00000001UL

Software reset.

Definition at line 94 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_RESET_MAX_WAIT_MS   100

Maximum time to wait for a reset, in milliseconds.

Definition at line 97 of file myson.h.

Referenced by myson_soft_reset().

#define MYSON_TXPDR   0x20

Transmit Poll Demand Register.

Definition at line 100 of file myson.h.

Referenced by myson_transmit().

#define MYSON_RXPDR   0x24

Receive Poll Demand Register.

Definition at line 103 of file myson.h.

Referenced by myson_refill_rx().

#define MYSON_TXLBA   0x2c

Transmit List Base Address.

Definition at line 106 of file myson.h.

Referenced by myson_probe().

#define MYSON_NUM_TX_DESC   4

Number of transmit descriptors.

Definition at line 109 of file myson.h.

Referenced by myson_poll_tx(), myson_probe(), and myson_transmit().

#define MYSON_RXLBA   0x30

Receive List Base Address.

Definition at line 112 of file myson.h.

Referenced by myson_probe().

#define MYSON_NUM_RX_DESC   4

Number of receive descriptors.

Definition at line 115 of file myson.h.

Referenced by myson_close(), myson_poll_rx(), myson_probe(), and myson_refill_rx().

#define MYSON_RX_MAX_LEN   ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )

Receive buffer length.

Definition at line 118 of file myson.h.

Referenced by myson_refill_rx().

#define MYSON_ISR   0x34

Interrupt Status Register.

Definition at line 121 of file myson.h.

Referenced by myson_poll().

#define MYSON_IRQ_TI   0x00000008UL

Transmit interrupt.

Definition at line 122 of file myson.h.

Referenced by myson_irq(), and myson_poll().

#define MYSON_IRQ_RI   0x00000004UL

Receive interrupt.

Definition at line 123 of file myson.h.

Referenced by myson_irq(), and myson_poll().

#define MYSON_ISR_IODELAY_COUNT   4

Number of I/O delays between ISR reads.

Definition at line 126 of file myson.h.

Referenced by myson_poll().

#define MYSON_IMR   0x38

Interrupt Mask Register.

Definition at line 129 of file myson.h.

Referenced by myson_irq(), and myson_reset().

#define MYSON_ROM_MII   0x40

Boot ROM / EEPROM / MII Management Register.

Definition at line 132 of file myson.h.

Referenced by myson_reload_config().

#define MYSON_ROM_AUTOLD   0x00100000UL

Auto load.

Definition at line 133 of file myson.h.

Referenced by myson_reload_config().

#define MYSON_AUTOLD_MAX_WAIT_MS   100

Maximum time to wait for a configuration reload, in milliseconds.

Definition at line 136 of file myson.h.

Referenced by myson_reload_config().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
struct myson_descriptor __attribute__ ( (packed)  )
static __attribute__ ( (always_inline)  ) [inline, static]

Initialise descriptor ring.

Check if card can access physical address.

Parameters:
ringDescriptor ring
countNumber of descriptors
regDescriptor base address register
addressPhysical address
address_okCard can access physical address

Variable Documentation

Status.

Definition at line 30 of file myson.h.

Buffer start address.

Definition at line 34 of file myson.h.

Next descriptor address.

Definition at line 36 of file myson.h.

Definition at line 68 of file myson.h.

Definition at line 69 of file myson.h.

unsigned int count

Definition at line 161 of file myson.h.