7 #define LINUX_OUT_MACROS 16 #define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) 17 #define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) 19 #define TX_RING_SIZE 2 20 #define RX_RING_SIZE 2 22 #define PKT_BUF_SZ 1536 40 #define TD_STDFLAGS TD_LASTDESC 49 #define delay(nanosec) do { int _i = 3; while (--_i > 0) \ 50 { __SLOW_DOWN_IO; }} while (0) 57 unsigned int type,
unsigned int len,
const char *
data);
61 static int mii_read(
int phy_id,
int location);
86 static unsigned short eeprom[64];
88 static signed char phys[4];
97 #define epic100_bufs NIC_FAKE_BSS ( struct epic100_bss ) 98 #define rx_ring epic100_bufs.rx_ring 99 #define tx_ring epic100_bufs.tx_ring 100 #define rx_packet epic100_bufs.rx_packet 101 #define tx_packet epic100_bufs.tx_packet 113 unsigned int phy, phy_idx;
164 for (i = 0; i < 16; i++) {
170 unsigned short sum = 0;
171 unsigned short value;
172 for (i = 0; i < 64; i++) {
180 printf(
"EEPROM contents\n");
181 for (i = 0; i < 64; i++) {
189 for (i = 0; i < 3; i++)
195 for (phy = 0, phy_idx = 0; phy < 32 && phy_idx <
sizeof(
phys); phy++) {
198 if (mii_status != 0xffff && mii_status != 0x0000) {
199 phys[phy_idx++] = phy;
201 printf(
"MII transceiver found at address %d.\n", phy);
207 printf(
"***WARNING***: No MII transceiver found!\n");
221 unsigned char mc_filter[8];
223 memset(mc_filter, 0xff,
sizeof(mc_filter));
225 for(i = 0; i < 4; i++)
226 outw(((
unsigned short *)mc_filter)[i],
mc0 + i*4);
246 if (mii_reg5 != 0xffff && (mii_reg5 & 0x0100)) {
247 printf(
" full-duplex mode");
307 unsigned int len,
const char *
data)
309 unsigned short nstype;
318 printf(
"eth_transmit: Unable to transmit. status=%4.4lx. Resetting...\n",
330 memcpy(txp + 12, (
char*)&nstype, 2);
359 printf(
"Oops, transmitter timeout, status=%4.4lX\n",
386 if ( ! retrieve )
return 1;
392 printf(
"epic_poll: entry %d status %hX\n", entry,
status);
397 printf(
"epic_poll: Giant packet\n");
399 }
else if (
status & 0x0006) {
401 printf(
"epic_poll: Frame received with errors\n");
444 #define EE_SHIFT_CLK 0x04 446 #define EE_DATA_WRITE 0x08 447 #define EE_WRITE_0 0x01 448 #define EE_WRITE_1 0x09 449 #define EE_DATA_READ 0x10 450 #define EE_ENB (0x0001 | EE_CS) 453 #define EE_WRITE_CMD (5 << 6) 454 #define EE_READ_CMD (6 << 6) 455 #define EE_ERASE_CMD (7 << 6) 457 #define eeprom_delay(n) delay(n) 470 for (i = 10; i >= 0; i--) {
481 for (i = 16; i > 0; i--) {
497 #define MII_WRITEOP 2 507 for (i = 4000; i > 0; i--)
522 PCI_ROM(0x10b8, 0x0005,
"epic100",
"SMC EtherPowerII", 0),
523 PCI_ROM(0x10b8, 0x0006,
"smc-83c175",
"SMC EPIC/C 83c175", 0),
static int read_eeprom(unsigned long ioaddr, int location, int addr_len)
int printf(const char *fmt,...)
Write a formatted string to the console.
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
#define le32_to_cpu(value)
#define outw(data, io_addr)
unsigned char tx_packet[PKT_BUF_SZ *TX_RING_SIZE]
unsigned long ioaddr
I/O address.
#define GC_RX_FIFO_THR_64
uint32_t type
Operating system type.
static int epic100_poll(struct nic *nic, int retrieve)
static unsigned int cur_tx
unsigned char rx_packet[PKT_BUF_SZ *RX_RING_SIZE]
static int epic100_probe(struct nic *nic, struct pci_device *pci)
int dummy_connect(struct nic *nic __unused)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static signed char phys[4]
static void epic100_disable(struct nic *nic, void *hwdev)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
static void epic100_init_ring(void)
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
A 16-bit general register.
#define COMMAND(name, exec)
#define cpu_to_le32(value)
#define outl(data, io_addr)
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
A PCI device ID list entry.
static void set_rx_mode(void)
static struct nic_operations epic100_operations
#define TC_EARLY_TX_ENABLE
unsigned char * node_addr
static struct pci_device_id epic100_nics[]
struct epic_rx_desc rx_ring[RX_RING_SIZE]
static unsigned int cur_rx
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
static void epic100_irq(struct nic *nic, irq_action_t action)
#define virt_to_le32desc(addr)
struct epic_tx_desc tx_ring[TX_RING_SIZE]
uint8_t data[48]
Additional event data.
static int mii_read(int phy_id, int location)
unsigned long currticks(void)
Get current system time in ticks.
#define DBG(...)
Print a debugging message.
struct nic_operations * nic_op
static struct command_descriptor read_cmd
"read" command descriptor
int(* connect)(struct nic *)
int putchar(int character)
Write a single character to each console device.
static void epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type, unsigned int len, const char *data)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
FILE_LICENCE(GPL2_OR_LATER)
DRIVER("EPIC100", nic_driver, pci_driver, epic100_driver, epic100_probe, epic100_disable, epic100_bufs)
void * memset(void *dest, int character, size_t len) __nonnull
static void epic100_open(void)
PCI_DRIVER(epic100_driver, epic100_nics, PCI_NO_CLASS)