iPXE
Data Structures | Macros | 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...
 
struct  myson_nic
 A myson network card. More...
 

Macros

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

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. More...
 

Variables

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

Detailed Description

Myson Technology network card driver.

Definition in file myson.h.

Macro Definition Documentation

◆ MYSON_BAR_SIZE

#define MYSON_BAR_SIZE   256

BAR size.

Definition at line 16 of file myson.h.

◆ MYSON_TX_STAT_OWN

#define MYSON_TX_STAT_OWN   0x80000000UL

Owner.

Definition at line 31 of file myson.h.

◆ MYSON_TX_STAT_ABORT

#define MYSON_TX_STAT_ABORT   0x00002000UL

Abort.

Definition at line 32 of file myson.h.

◆ MYSON_TX_STAT_CSL

#define MYSON_TX_STAT_CSL   0x00001000UL

Carrier sense lost.

Definition at line 33 of file myson.h.

◆ MYSON_TX_CTRL_IC

#define MYSON_TX_CTRL_IC   0x80000000UL

Interrupt control.

Definition at line 36 of file myson.h.

◆ MYSON_TX_CTRL_LD

#define MYSON_TX_CTRL_LD   0x20000000UL

Last descriptor.

Definition at line 37 of file myson.h.

◆ MYSON_TX_CTRL_FD

#define MYSON_TX_CTRL_FD   0x10000000UL

First descriptor.

Definition at line 38 of file myson.h.

◆ MYSON_TX_CTRL_CRC

#define MYSON_TX_CTRL_CRC   0x08000000UL

CRC append.

Definition at line 39 of file myson.h.

◆ MYSON_TX_CTRL_PAD

#define MYSON_TX_CTRL_PAD   0x04000000UL

Pad control.

Definition at line 40 of file myson.h.

◆ MYSON_TX_CTRL_RTLC

#define MYSON_TX_CTRL_RTLC   0x02000000UL

Retry late collision.

Definition at line 41 of file myson.h.

◆ MYSON_TX_CTRL_PKTS

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

Packet size.

Definition at line 42 of file myson.h.

◆ MYSON_TX_CTRL_TBS

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

Transmit buffer size.

Definition at line 43 of file myson.h.

◆ MYSON_RX_STAT_OWN

#define MYSON_RX_STAT_OWN   0x80000000UL

Owner.

Definition at line 46 of file myson.h.

◆ MYSON_RX_STAT_FLNG

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

Definition at line 47 of file myson.h.

◆ MYSON_RX_STAT_ES

#define MYSON_RX_STAT_ES   0x00000080UL

Error summary.

Definition at line 48 of file myson.h.

◆ MYSON_RX_CTRL_RBS

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

Receive buffer size.

Definition at line 51 of file myson.h.

◆ MYSON_RING_ALIGN

#define MYSON_RING_ALIGN   4

Descriptor ring alignment.

Definition at line 54 of file myson.h.

◆ MYSON_PAR0

#define MYSON_PAR0   0x00

Physical Address Register 0.

Definition at line 57 of file myson.h.

◆ MYSON_PAR4

#define MYSON_PAR4   0x04

Physical Address Register 4.

Definition at line 60 of file myson.h.

◆ MYSON_TCR_RCR

#define MYSON_TCR_RCR   0x18

Transmit and Receive Configuration Register.

Definition at line 72 of file myson.h.

◆ MYSON_TCR_TXS

#define MYSON_TCR_TXS   0x80000000UL

Transmit status.

Definition at line 73 of file myson.h.

◆ MYSON_TCR_TE

#define MYSON_TCR_TE   0x00040000UL

Transmit enable.

Definition at line 74 of file myson.h.

◆ MYSON_RCR_RXS

#define MYSON_RCR_RXS   0x00008000UL

Receive status.

Definition at line 75 of file myson.h.

◆ MYSON_RCR_PROM

#define MYSON_RCR_PROM   0x00000080UL

Promiscuous mode.

Definition at line 76 of file myson.h.

◆ MYSON_RCR_AB

#define MYSON_RCR_AB   0x00000040UL

Accept broadcast.

Definition at line 77 of file myson.h.

◆ MYSON_RCR_AM

#define MYSON_RCR_AM   0x00000020UL

Accept multicast.

Definition at line 78 of file myson.h.

◆ MYSON_RCR_ARP

#define MYSON_RCR_ARP   0x00000008UL

Accept runt packet.

Definition at line 79 of file myson.h.

◆ MYSON_RCR_ALP

#define MYSON_RCR_ALP   0x00000004UL

Accept long packet.

Definition at line 80 of file myson.h.

◆ MYSON_RCR_RE

#define MYSON_RCR_RE   0x00000001UL

Receive enable.

Definition at line 81 of file myson.h.

◆ MYSON_IDLE_MAX_WAIT_MS

#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.

◆ MYSON_BCR

#define MYSON_BCR   0x1c

Bus Command Register.

Definition at line 87 of file myson.h.

◆ MYSON_BCR_RLE

#define MYSON_BCR_RLE   0x00000100UL

Read line enable.

Definition at line 88 of file myson.h.

◆ MYSON_BCR_RME

#define MYSON_BCR_RME   0x00000080UL

Read multiple enable.

Definition at line 89 of file myson.h.

◆ MYSON_BCR_WIE

#define MYSON_BCR_WIE   0x00000040UL

Write and invalidate.

Definition at line 90 of file myson.h.

◆ MYSON_BCR_PBL

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

Burst length.

Definition at line 91 of file myson.h.

◆ MYSON_BCR_PBL_MASK

#define MYSON_BCR_PBL_MASK   MYSON_BCR_PBL ( 0x7 )

Definition at line 92 of file myson.h.

◆ MYSON_BCR_PBL_DEFAULT

#define MYSON_BCR_PBL_DEFAULT   MYSON_BCR_PBL ( 0x6 )

Definition at line 93 of file myson.h.

◆ MYSON_BCR_SWR

#define MYSON_BCR_SWR   0x00000001UL

Software reset.

Definition at line 94 of file myson.h.

◆ MYSON_RESET_MAX_WAIT_MS

#define MYSON_RESET_MAX_WAIT_MS   100

Maximum time to wait for a reset, in milliseconds.

Definition at line 97 of file myson.h.

◆ MYSON_TXPDR

#define MYSON_TXPDR   0x20

Transmit Poll Demand Register.

Definition at line 100 of file myson.h.

◆ MYSON_RXPDR

#define MYSON_RXPDR   0x24

Receive Poll Demand Register.

Definition at line 103 of file myson.h.

◆ MYSON_TXLBA

#define MYSON_TXLBA   0x2c

Transmit List Base Address.

Definition at line 106 of file myson.h.

◆ MYSON_NUM_TX_DESC

#define MYSON_NUM_TX_DESC   4

Number of transmit descriptors.

Definition at line 109 of file myson.h.

◆ MYSON_RXLBA

#define MYSON_RXLBA   0x30

Receive List Base Address.

Definition at line 112 of file myson.h.

◆ MYSON_NUM_RX_DESC

#define MYSON_NUM_RX_DESC   4

Number of receive descriptors.

Definition at line 115 of file myson.h.

◆ MYSON_RX_MAX_LEN

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

Receive buffer length.

Definition at line 118 of file myson.h.

◆ MYSON_ISR

#define MYSON_ISR   0x34

Interrupt Status Register.

Definition at line 121 of file myson.h.

◆ MYSON_IRQ_TI

#define MYSON_IRQ_TI   0x00000008UL

Transmit interrupt.

Definition at line 122 of file myson.h.

◆ MYSON_IRQ_RI

#define MYSON_IRQ_RI   0x00000004UL

Receive interrupt.

Definition at line 123 of file myson.h.

◆ MYSON_ISR_IODELAY_COUNT

#define MYSON_ISR_IODELAY_COUNT   4

Number of I/O delays between ISR reads.

Definition at line 126 of file myson.h.

◆ MYSON_IMR

#define MYSON_IMR   0x38

Interrupt Mask Register.

Definition at line 129 of file myson.h.

◆ MYSON_ROM_MII

#define MYSON_ROM_MII   0x40

Boot ROM / EEPROM / MII Management Register.

Definition at line 132 of file myson.h.

◆ MYSON_ROM_AUTOLD

#define MYSON_ROM_AUTOLD   0x00100000UL

Auto load.

Definition at line 133 of file myson.h.

◆ MYSON_AUTOLD_MAX_WAIT_MS

#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.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__() [1/2]

struct myson_descriptor __attribute__ ( (packed)  )

◆ __attribute__() [2/2]

static __attribute__ ( (always_inline)  )
inlinestatic

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

Definition at line 186 of file myson.h.

187  {
188 
189  /* In a 32-bit build, all addresses can be accessed */
190  if ( sizeof ( physaddr_t ) <= sizeof ( uint32_t ) )
191  return 1;
192 
193  /* Card can access all addresses below 4GB */
194  if ( ( address & ~0xffffffffULL ) == 0 )
195  return 1;
196 
197  return 0;
198 }
unsigned int uint32_t
Definition: stdint.h:12
unsigned long physaddr_t
Definition: stdint.h:20
uint32_t address
Buffer start address.
Definition: myson.h:16

References address.

Variable Documentation

◆ status

uint32_t status

Status.

Definition at line 12 of file myson.h.

◆ control

uint8_t control

◆ address

uint32_t address

Buffer start address.

Definition at line 16 of file myson.h.

Referenced by __attribute__().

◆ next

struct arbelprm_wqe_segment_next next

◆ low

uint32_t low

Definition at line 19 of file myson.h.

◆ high

uint32_t high

Definition at line 20 of file myson.h.

◆ __attribute__

◆ count

unsigned int count

Definition at line 161 of file myson.h.

◆ reg

ring reg
Initial value:
{
ring->count = count
static unsigned int count
Definition: myson.h:161

Definition at line 162 of file myson.h.