iPXE
Data Structures | Macros | Functions | Variables
sis900.c File Reference
#include "etherboot.h"
#include <ipxe/pci.h>
#include "nic.h"
#include "sis900.h"

Go to the source code of this file.

Data Structures

struct  mii_chip_info
 
struct  mii_phy
 

Macros

#define txd   sis900_bufs.txd
 
#define rxd   sis900_bufs.rxd
 
#define txb   sis900_bufs.txb
 
#define rxb   sis900_bufs.rxb
 
#define eeprom_delay()   inl(ee_addr)
 
#define sis900_mdio_delay()   inl(mdio_addr)
 

Functions

 FILE_LICENCE (GPL_ANY)
 
static void sis900_read_mode (struct nic *nic, int phy_addr, int *speed, int *duplex)
 
static void amd79c901_read_mode (struct nic *nic, int phy_addr, int *speed, int *duplex)
 
static void ics1893_read_mode (struct nic *nic, int phy_addr, int *speed, int *duplex)
 
static void rtl8201_read_mode (struct nic *nic, int phy_addr, int *speed, int *duplex)
 
static void vt6103_read_mode (struct nic *nic, int phy_addr, int *speed, int *duplex)
 
static int sis900_probe (struct nic *nic, struct pci_device *pci)
 
static u16 sis900_read_eeprom (int location)
 
static void sis900_mdio_reset (long mdio_addr)
 
static void sis900_mdio_idle (long mdio_addr)
 
static u16 sis900_mdio_read (int phy_id, int location)
 
static void sis900_init (struct nic *nic)
 
static void sis900_reset (struct nic *nic)
 
static void sis900_init_rxfilter (struct nic *nic)
 
static void sis900_init_txd (struct nic *nic)
 
static void sis900_init_rxd (struct nic *nic)
 
static void sis900_set_rx_mode (struct nic *nic)
 
static void sis900_check_mode (struct nic *nic)
 
static void sis900_transmit (struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
 
static int sis900_poll (struct nic *nic, int retrieve)
 
static void sis900_disable (struct nic *nic)
 
static void sis900_irq (struct nic *nic, irq_action_t action)
 
static int sis900_get_mac_addr (struct pci_device *pci_dev __unused, struct nic *nic)
 sis900_get_mac_addr: - Get MAC address for stand alone SiS900 model @pci_dev: the sis900 pci device @net_dev: the net device to get address for More...
 
static int sis96x_get_mac_addr (struct pci_device *pci_dev __unused, struct nic *nic)
 sis96x_get_mac_addr: - Get MAC address for SiS962 or SiS963 model @pci_dev: the sis900 pci device @net_dev: the net device to get address for More...
 
static int sis630e_get_mac_addr (struct pci_device *pci_dev __unused, struct nic *nic __unused)
 sis630e_get_mac_addr: - Get MAC address for SiS630E model @pci_dev: the sis900 pci device @net_dev: the net device to get address for More...
 
static int sis635_get_mac_addr (struct pci_device *pci_dev __unused, struct nic *nic)
 sis630e_get_mac_addr: - Get MAC address for SiS630E model @pci_dev: the sis900 pci device @net_dev: the net device to get address for More...
 
static void sis900_reset (struct nic *nic __unused)
 
static void sis900_init_txd (struct nic *nic __unused)
 
static void sis900_init_rxd (struct nic *nic __unused)
 
static void sis900_set_rx_mode (struct nic *nic __unused)
 
static void sis900_read_mode (struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
 
static void amd79c901_read_mode (struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
 
static void ics1893_read_mode (struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
 ics1893_read_mode: - read media mode for ICS1893 PHY @net_dev: the net device to read mode for @phy_addr: mii phy address @speed: the transmit speed to be determined @duplex: the duplex mode to be determined More...
 
static void rtl8201_read_mode (struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
 rtl8201_read_mode: - read media mode for rtl8201 phy @nic: the net device to read mode for @phy_addr: mii phy address @speed: the transmit speed to be determined @duplex: the duplex mode to be determined More...
 
static void vt6103_read_mode (struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
 vt6103_read_mode: - read media mode for vt6103 phy @nic: the net device to read mode for @phy_addr: mii phy address @speed: the transmit speed to be determined @duplex: the duplex mode to be determined More...
 
static void sis900_irq (struct nic *nic __unused, irq_action_t action __unused)
 
 PCI_DRIVER (sis900_driver, sis900_nics, PCI_NO_CLASS)
 
 DRIVER ("SIS900", nic_driver, pci_driver, sis900_driver, sis900_probe, sis900_disable)
 

Variables

static struct nic_operations sis900_operations
 
static int sis900_debug = 0
 
static unsigned short vendor
 
static unsigned short dev_id
 
static unsigned long ioaddr
 
static u8 pci_revision
 
static unsigned int cur_phy
 
static unsigned int cur_rx
 
struct {
   BufferDesc   txd
 
   BufferDesc   rxd [NUM_RX_DESC]
 
   unsigned char   txb [TX_BUF_SIZE]
 
   unsigned char   rxb [NUM_RX_DESC *RX_BUF_SIZE]
 
__shared
 
static struct mii_chip_info mii_chip_table []
 
static struct mii_phy mii
 
static struct pci_device_id sis900_nics []
 

Macro Definition Documentation

◆ txd

#define txd   sis900_bufs.txd

Definition at line 74 of file sis900.c.

◆ rxd

#define rxd   sis900_bufs.rxd

Definition at line 75 of file sis900.c.

◆ txb

#define txb   sis900_bufs.txb

Definition at line 76 of file sis900.c.

◆ rxb

#define rxb   sis900_bufs.rxb

Definition at line 77 of file sis900.c.

◆ eeprom_delay

#define eeprom_delay ( )    inl(ee_addr)

Definition at line 448 of file sis900.c.

◆ sis900_mdio_delay

#define sis900_mdio_delay ( )    inl(mdio_addr)

Definition at line 504 of file sis900.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL_ANY  )

◆ sis900_read_mode() [1/2]

static void sis900_read_mode ( struct nic nic,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

◆ amd79c901_read_mode() [1/2]

static void amd79c901_read_mode ( struct nic nic,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

◆ ics1893_read_mode() [1/2]

static void ics1893_read_mode ( struct nic nic,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

◆ rtl8201_read_mode() [1/2]

static void rtl8201_read_mode ( struct nic nic,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

◆ vt6103_read_mode() [1/2]

static void vt6103_read_mode ( struct nic nic,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

◆ sis900_probe()

static int sis900_probe ( struct nic nic,
struct pci_device pci 
)
static

Definition at line 335 of file sis900.c.

335  {
336 
337  int i;
338  int found=0;
339  int phy_addr;
340  u8 revision;
341  int ret;
342 
343  if (pci->ioaddr == 0)
344  return 0;
345 
346  nic->irqno = 0;
347  nic->ioaddr = pci->ioaddr;
348 
349  ioaddr = pci->ioaddr;
350  vendor = pci->vendor;
351  dev_id = pci->device;
352 
353  /* wakeup chip */
354  pci_write_config_dword(pci, 0x40, 0x00000000);
355 
356  adjust_pci_device(pci);
357 
358  /* get MAC address */
359  ret = 0;
361 
362  /* save for use later in sis900_reset() */
364 
365  if (revision == SIS630E_900_REV)
366  ret = sis630e_get_mac_addr(pci, nic);
367  else if ((revision > 0x81) && (revision <= 0x90))
368  ret = sis635_get_mac_addr(pci, nic);
369  else if (revision == SIS96x_900_REV)
370  ret = sis96x_get_mac_addr(pci, nic);
371  else
372  ret = sis900_get_mac_addr(pci, nic);
373 
374  if (ret == 0)
375  {
376  printf ("sis900_probe: Error MAC address not found\n");
377  return 0;
378  }
379 
380  /* 630ET : set the mii access mode as software-mode */
381  if (revision == SIS630ET_900_REV)
382  outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
383 
384  DBG( "sis900_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id );
385 
386  /* probe for mii transceiver */
387  /* search for total of 32 possible mii phy addresses */
388 
389  found = 0;
390  for (phy_addr = 0; phy_addr < 32; phy_addr++) {
391  u16 mii_status;
392  u16 phy_id0, phy_id1;
393 
394  mii_status = sis900_mdio_read(phy_addr, MII_STATUS);
395  if (mii_status == 0xffff || mii_status == 0x0000)
396  /* the mii is not accessible, try next one */
397  continue;
398 
399  phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
400  phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
401 
402  /* search our mii table for the current mii */
403  for (i = 0; mii_chip_table[i].phy_id1; i++) {
404 
405  if ((phy_id0 == mii_chip_table[i].phy_id0) &&
406  ((phy_id1 & 0xFFF0) == mii_chip_table[i].phy_id1)){
407 
408  printf("sis900_probe: %s transceiver found at address %d.\n",
409  mii_chip_table[i].name, phy_addr);
410 
412  mii.phy_addr = phy_addr;
413  mii.status = sis900_mdio_read(phy_addr, MII_STATUS);
414  mii.next = NULL;
415 
416  found=1;
417  break;
418  }
419  }
420  }
421 
422  if (found == 0) {
423  printf("sis900_probe: No MII transceivers found!\n");
424  return 0;
425  }
426 
427  /* Arbitrarily select the last PHY found as current PHY */
428  cur_phy = mii.phy_addr;
429  printf("sis900_probe: Using %s as default\n", mii.chip_info->name);
430 
431  /* initialize device */
432  sis900_init(nic);
434 
435  return 1;
436 }
unsigned char irqno
Definition: nic.h:56
uint16_t u16
Definition: stdint.h:21
static u16 sis900_mdio_read(int phy_id, int location)
Definition: sis900.c:534
const char * name
Definition: ath9k_hw.c:1984
static struct mii_phy mii
static u8 pci_revision
Definition: sis900.c:62
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
unsigned long ioaddr
I/O address.
Definition: pci.h:221
static int sis635_get_mac_addr(struct pci_device *pci_dev __unused, struct nic *nic)
sis630e_get_mac_addr: - Get MAC address for SiS630E model @pci_dev: the sis900 pci device @net_dev: t...
Definition: sis900.c:295
static int sis630e_get_mac_addr(struct pci_device *pci_dev __unused, struct nic *nic __unused)
sis630e_get_mac_addr: - Get MAC address for SiS630E model @pci_dev: the sis900 pci device @net_dev: t...
Definition: sis900.c:252
u16 phy_id1
Definition: sis900.c:102
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition: pci.c:154
unsigned int ioaddr
Definition: nic.h:55
static void sis900_init(struct nic *nic)
Definition: sis900.c:618
uint16_t device
Device ID.
Definition: pci.h:225
u16 status
Definition: sis900.c:121
struct mii_chip_info * chip_info
Definition: sis900.c:119
static int sis900_get_mac_addr(struct pci_device *pci_dev __unused, struct nic *nic)
sis900_get_mac_addr: - Get MAC address for stand alone SiS900 model @pci_dev: the sis900 pci device @...
Definition: sis900.c:180
uint32_t revision
Entry point revision.
Definition: ib_mad.h:20
int phy_addr
Definition: sis900.c:120
#define outl(data, io_addr)
Definition: io.h:329
static int sis96x_get_mac_addr(struct pci_device *pci_dev __unused, struct nic *nic)
sis96x_get_mac_addr: - Get MAC address for SiS962 or SiS963 model @pci_dev: the sis900 pci device @ne...
Definition: sis900.c:214
static struct nic_operations sis900_operations
Definition: sis900.c:56
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
uint16_t vendor
Vendor ID.
Definition: pci.h:223
static struct mii_chip_info mii_chip_table[]
Definition: sis900.h:22
static unsigned int cur_phy
Definition: sis900.c:64
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
#define PCI_REVISION
PCI revision.
Definition: pci.h:44
static unsigned short vendor
Definition: sis900.c:60
const char * name
Definition: sis190.h:285
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static unsigned short dev_id
Definition: sis900.c:60
struct nic_operations * nic_op
Definition: nic.h:50
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
uint8_t u8
Definition: stdint.h:19
struct mii_phy * next
Definition: sis900.c:118
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.

References ACCESSMODE, adjust_pci_device(), mii_phy::chip_info, cr, cur_phy, DBG, dev_id, pci_device::device, inl(), nic::ioaddr, ioaddr, pci_device::ioaddr, nic::irqno, mii, mii_chip_table, MII_PHY_ID0, MII_PHY_ID1, MII_STATUS, mii_chip_info::name, name, mii_phy::next, nic::nic_op, NULL, outl, pci_read_config_byte(), PCI_REVISION, pci_revision, pci_write_config_dword(), mii_phy::phy_addr, mii_chip_info::phy_id1, printf(), revision, SIS630E_900_REV, sis630e_get_mac_addr(), SIS630ET_900_REV, sis635_get_mac_addr(), sis900_get_mac_addr(), sis900_init(), sis900_mdio_read(), sis900_operations, SIS96x_900_REV, sis96x_get_mac_addr(), mii_phy::status, vendor, and pci_device::vendor.

◆ sis900_read_eeprom()

static u16 sis900_read_eeprom ( int  location)
static

Definition at line 463 of file sis900.c.

464 {
465  int i;
466  u16 retval = 0;
467  long ee_addr = ioaddr + mear;
468  u32 read_cmd = location | EEread;
469 
470  outl(0, ee_addr);
471  eeprom_delay();
472  outl(EECS, ee_addr);
473  eeprom_delay();
474 
475  /* Shift the read command (9) bits out. */
476  for (i = 8; i >= 0; i--) {
477  u32 dataval = (read_cmd & (1 << i)) ? EEDI | EECS : EECS;
478  outl(dataval, ee_addr);
479  eeprom_delay();
480  outl(dataval | EECLK, ee_addr);
481  eeprom_delay();
482  }
483  outl(EECS, ee_addr);
484  eeprom_delay();
485 
486  /* read the 16-bits data in */
487  for (i = 16; i > 0; i--) {
488  outl(EECS, ee_addr);
489  eeprom_delay();
490  outl(EECS | EECLK, ee_addr);
491  eeprom_delay();
492  retval = (retval << 1) | ((inl(ee_addr) & EEDO) ? 1 : 0);
493  eeprom_delay();
494  }
495 
496  /* Terminate the EEPROM access. */
497  outl(0, ee_addr);
498  eeprom_delay();
499 // outl(EECLK, ee_addr);
500 
501  return (retval);
502 }
uint16_t u16
Definition: stdint.h:21
#define EEDO
Definition: eepro.c:267
#define EEDI
Definition: eepro.c:266
#define EECS
Definition: eepro.c:265
#define outl(data, io_addr)
Definition: io.h:329
static unsigned long ioaddr
Definition: sis900.c:61
unsigned long retval
Definition: xen.h:45
#define eeprom_delay()
Definition: sis900.c:448
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:24
Definition: sis900.h:178
Definition: sis190.h:228
static struct command_descriptor read_cmd
"read" command descriptor
Definition: nvo_cmd.c:134
uint32_t u32
Definition: stdint.h:23

References EECLK, EECS, EEDI, EEDO, eeprom_delay, EEread, inl(), ioaddr, mear, outl, read_cmd, and retval.

Referenced by sis900_get_mac_addr(), and sis96x_get_mac_addr().

◆ sis900_mdio_reset()

static void sis900_mdio_reset ( long  mdio_addr)
static

Definition at line 521 of file sis900.c.

522 {
523  int i;
524 
525  for (i = 31; i >= 0; i--) {
526  outl(MDDIR | MDIO, mdio_addr);
528  outl(MDDIR | MDIO | MDC, mdio_addr);
530  }
531  return;
532 }
#define sis900_mdio_delay()
Definition: sis900.c:504
Definition: sis900.h:73
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:71
Definition: sis900.h:72

References MDC, MDDIR, MDIO, outl, and sis900_mdio_delay.

Referenced by sis900_mdio_read().

◆ sis900_mdio_idle()

static void sis900_mdio_idle ( long  mdio_addr)
static

Definition at line 513 of file sis900.c.

514 {
515  outl(MDIO | MDDIR, mdio_addr);
517  outl(MDIO | MDDIR | MDC, mdio_addr);
518 }
#define sis900_mdio_delay()
Definition: sis900.c:504
Definition: sis900.h:73
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:71
Definition: sis900.h:72

References MDC, MDDIR, MDIO, outl, and sis900_mdio_delay.

Referenced by sis900_mdio_read().

◆ sis900_mdio_read()

static u16 sis900_mdio_read ( int  phy_id,
int  location 
)
static

Definition at line 534 of file sis900.c.

535 {
536  long mdio_addr = ioaddr + mear;
537  int mii_cmd = MIIread|(phy_id<<MIIpmdShift)|(location<<MIIregShift);
538  u16 retval = 0;
539  int i;
540 
541  sis900_mdio_reset(mdio_addr);
542  sis900_mdio_idle(mdio_addr);
543 
544  for (i = 15; i >= 0; i--) {
545  int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR;
546  outl(dataval, mdio_addr);
548  outl(dataval | MDC, mdio_addr);
550  }
551 
552  /* Read the 16 data bits. */
553  for (i = 16; i > 0; i--) {
554  outl(0, mdio_addr);
556  retval = (retval << 1) | ((inl(mdio_addr) & MDIO) ? 1 : 0);
557  outl(MDC, mdio_addr);
559  }
560  outl(0x00, mdio_addr);
561  return retval;
562 }
uint16_t u16
Definition: stdint.h:21
#define sis900_mdio_delay()
Definition: sis900.c:504
Definition: sis900.h:73
#define MIIregShift
Definition: sis900.h:197
#define outl(data, io_addr)
Definition: io.h:329
static unsigned long ioaddr
Definition: sis900.c:61
#define MIIread
Definition: sis900.h:194
unsigned long retval
Definition: xen.h:45
static void sis900_mdio_idle(long mdio_addr)
Definition: sis900.c:513
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:24
Definition: sis900.h:71
static void sis900_mdio_reset(long mdio_addr)
Definition: sis900.c:521
#define MIIpmdShift
Definition: sis900.h:196
Definition: sis900.h:72

References inl(), ioaddr, MDC, MDDIR, MDIO, mear, MIIpmdShift, MIIread, MIIregShift, outl, retval, sis900_mdio_delay, sis900_mdio_idle(), and sis900_mdio_reset().

Referenced by amd79c901_read_mode(), ics1893_read_mode(), rtl8201_read_mode(), sis900_probe(), sis900_read_mode(), and vt6103_read_mode().

◆ sis900_init()

static void sis900_init ( struct nic nic)
static

Definition at line 618 of file sis900.c.

619 {
620  /* Soft reset the chip. */
621  sis900_reset(nic);
622 
624 
627 
629 
631 
632  outl(RxENA| inl(ioaddr + cr), ioaddr + cr);
633 }
static void sis900_reset(struct nic *nic)
Definition: sis900.h:51
static void sis900_init_rxfilter(struct nic *nic)
Definition: sis900.c:680
#define outl(data, io_addr)
Definition: io.h:329
static void sis900_init_txd(struct nic *nic)
Definition: nic.h:49
static void sis900_set_rx_mode(struct nic *nic)
static unsigned long ioaddr
Definition: sis900.c:61
static void sis900_init_rxd(struct nic *nic)
Definition: sis900.h:22
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
static void sis900_check_mode(struct nic *nic)
Definition: sis900.c:823

References cr, inl(), ioaddr, outl, RxENA, sis900_check_mode(), sis900_init_rxd(), sis900_init_rxfilter(), sis900_init_txd(), sis900_reset(), and sis900_set_rx_mode().

Referenced by sis900_disable(), and sis900_probe().

◆ sis900_reset() [1/2]

static void sis900_reset ( struct nic nic)
static

Referenced by sis900_init().

◆ sis900_init_rxfilter()

static void sis900_init_rxfilter ( struct nic nic)
static

Definition at line 680 of file sis900.c.

681 {
682  u32 rfcrSave;
683  int i;
684 
685  rfcrSave = inl(rfcr + ioaddr);
686 
687  /* disable packet filtering before setting filter */
688  outl(rfcrSave & ~RFEN, rfcr + ioaddr);
689 
690  /* load MAC addr to filter data register */
691  for (i = 0 ; i < 3 ; i++) {
692  u32 w;
693 
694  w = (u32) *((u16 *)(nic->node_addr)+i);
695  outl((i << RFADDR_shift), ioaddr + rfcr);
696  outl(w, ioaddr + rfdr);
697 
698  if (sis900_debug > 0)
699  printf("sis900_init_rxfilter: Receive Filter Addrss[%d]=%X\n",
700  i, inl(ioaddr + rfdr));
701  }
702 
703  /* enable packet filitering */
704  outl(rfcrSave | RFEN, rfcr + ioaddr);
705 }
uint16_t u16
Definition: stdint.h:21
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define RFADDR_shift
Definition: sis900.h:153
Definition: sis900.h:36
#define u32
Definition: vga.h:21
static int sis900_debug
Definition: sis900.c:58
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:156
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
uint32_t w[16]
Definition: md4.c:32
unsigned char * node_addr
Definition: nic.h:52
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:37
uint32_t u32
Definition: stdint.h:23

References inl(), ioaddr, nic::node_addr, outl, printf(), RFADDR_shift, rfcr, rfdr, RFEN, sis900_debug, u32, and w.

Referenced by sis900_init().

◆ sis900_init_txd() [1/2]

static void sis900_init_txd ( struct nic nic)
static

Referenced by sis900_init().

◆ sis900_init_rxd() [1/2]

static void sis900_init_rxd ( struct nic nic)
static

Referenced by sis900_init().

◆ sis900_set_rx_mode() [1/2]

static void sis900_set_rx_mode ( struct nic nic)
static

Referenced by sis900_init().

◆ sis900_check_mode()

static void sis900_check_mode ( struct nic nic)
static

Definition at line 823 of file sis900.c.

824 {
825  int speed, duplex;
826  u32 tx_flags = 0, rx_flags = 0;
827 
828  mii.chip_info->read_mode(nic, cur_phy, &speed, &duplex);
829 
830  if( inl(ioaddr + cfg) & EDB_MASTER_EN ) {
832  rx_flags = DMA_BURST_64 << RxMXDMA_shift;
833  }
834  else {
836  rx_flags = DMA_BURST_512 << RxMXDMA_shift;
837  }
838 
839  if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS) {
840  rx_flags |= (RxDRNT_10 << RxDRNT_shift);
841  tx_flags |= (TxDRNT_10 << TxDRNT_shift);
842  }
843  else {
844  rx_flags |= (RxDRNT_100 << RxDRNT_shift);
845  tx_flags |= (TxDRNT_100 << TxDRNT_shift);
846  }
847 
849  tx_flags |= (TxCSI | TxHBI);
850  rx_flags |= RxATX;
851  }
852 
853  outl (tx_flags, ioaddr + txcfg);
854  outl (rx_flags, ioaddr + rxcfg);
855 }
static struct mii_phy mii
#define TxDRNT_10
Definition: sis900.h:127
#define TX_FILL_THRESH
Definition: sis900.h:123
Definition: sis900.h:130
#define RxDRNT_shift
Definition: sis900.h:140
Definition: sis900.h:33
#define RxDRNT_10
Definition: sis900.h:142
#define FDX_CAPABLE_FULL_SELECTED
Definition: sis900.h:352
#define TxFILLT_shift
Definition: sis900.h:124
struct mii_chip_info * chip_info
Definition: sis900.c:119
#define TxMXDMA_shift
Definition: sis900.h:113
#define RxMXDMA_shift
Definition: sis900.h:114
#define TxDRNT_shift
Definition: sis900.h:125
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:133
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
#define HW_SPEED_HOME
Definition: sis900.h:355
duplex
Definition: nic.h:40
Definition: sis900.h:23
static unsigned int cur_phy
Definition: sis900.c:64
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
#define RxDRNT_100
Definition: sis900.h:141
#define HW_SPEED_10_MBPS
Definition: sis900.h:356
Definition: sis900.h:131
Definition: sis900.h:31
void(* read_mode)(struct nic *nic, int phy_addr, int *speed, int *duplex)
Definition: sis900.c:103
#define TxDRNT_100
Definition: sis900.h:126
uint32_t u32
Definition: stdint.h:23
Definition: sis900.h:147

References cfg, mii_phy::chip_info, cur_phy, DMA_BURST_512, DMA_BURST_64, EDB_MASTER_EN, FDX_CAPABLE_FULL_SELECTED, HW_SPEED_10_MBPS, HW_SPEED_HOME, inl(), ioaddr, mii, outl, mii_chip_info::read_mode, RxATX, rxcfg, RxDRNT_10, RxDRNT_100, RxDRNT_shift, RxMXDMA_shift, TX_FILL_THRESH, TxATP, txcfg, TxCSI, TxDRNT_10, TxDRNT_100, TxDRNT_shift, TxFILLT_shift, TxHBI, and TxMXDMA_shift.

Referenced by sis900_init().

◆ sis900_transmit()

static void sis900_transmit ( struct nic nic,
const char *  d,
unsigned int  t,
unsigned int  s,
const char *  p 
)
static

Definition at line 1103 of file sis900.c.

1108 {
1109  u32 to, nstype;
1110  volatile u32 tx_status;
1111 
1112  /* Stop the transmitter */
1113  outl(TxDIS | inl(ioaddr + cr), ioaddr + cr);
1114 
1115  /* load Transmit Descriptor Register */
1116  outl(virt_to_bus(&txd), ioaddr + txdp);
1117  if (sis900_debug > 1)
1118  printf("sis900_transmit: TX descriptor register loaded with: %X\n",
1119  inl(ioaddr + txdp));
1120 
1121  memcpy(txb, d, ETH_ALEN);
1123  nstype = htons(t);
1124  memcpy(txb + 2 * ETH_ALEN, (char*)&nstype, 2);
1125  memcpy(txb + ETH_HLEN, p, s);
1126 
1127  s += ETH_HLEN;
1128  s &= DSIZE;
1129 
1130  if (sis900_debug > 1)
1131  printf("sis900_transmit: sending %d bytes ethtype %hX\n", (int) s, t);
1132 
1133  /* pad to minimum packet size */
1134  while (s < ETH_ZLEN)
1135  txb[s++] = '\0';
1136 
1137  /* set the transmit buffer descriptor and enable Transmit State Machine */
1138  txd.bufptr = virt_to_bus(&txb[0]);
1139  txd.cmdsts = (u32) OWN | s;
1140 
1141  /* restart the transmitter */
1142  outl(TxENA | inl(ioaddr + cr), ioaddr + cr);
1143 
1144  if (sis900_debug > 1)
1145  printf("sis900_transmit: Queued Tx packet size %d.\n", (int) s);
1146 
1147  to = currticks() + TX_TIMEOUT;
1148 
1149  while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
1150  /* wait */ ;
1151 
1152  if (currticks() >= to) {
1153  printf("sis900_transmit: TX Timeout! Tx status %X.\n",
1154  (unsigned int) tx_status);
1155  }
1156 
1157  if (tx_status & (ABORT | UNDERRUN | OWCOLL)) {
1158  /* packet unsuccessfully transmited */
1159  printf("sis900_transmit: Transmit error, Tx status %X.\n",
1160  (unsigned int) tx_status);
1161  }
1162  /* Disable interrupts by clearing the interrupt mask. */
1163  outl(0, ioaddr + imr);
1164 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
Definition: sis190.h:210
#define TX_TIMEOUT
Definition: amd8111e.c:57
Definition: sis900.h:27
Definition: sis900.h:53
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
#define ETH_HLEN
Definition: if_ether.h:9
#define u32
Definition: vga.h:21
Definition: sis900.h:209
Definition: sis900.h:203
static int sis900_debug
Definition: sis900.c:58
#define outl(data, io_addr)
Definition: io.h:329
#define ETH_ALEN
Definition: if_ether.h:8
Definition: sis900.h:30
#define ETH_ZLEN
Definition: if_ether.h:10
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
Definition: sis900.h:22
unsigned char * node_addr
Definition: nic.h:52
#define txd
Definition: sis900.c:74
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
uint32_t d
Definition: md4.c:31
Definition: sis900.h:219
Definition: sis900.h:52
unsigned long currticks(void)
Get current system time in ticks.
Definition: timer.c:42
#define htons(value)
Definition: byteswap.h:135
#define txb
Definition: sis900.c:76
uint32_t u32
Definition: stdint.h:23

References ABORT, cr, currticks(), d, DSIZE, ETH_ALEN, ETH_HLEN, ETH_ZLEN, htons, imr, inl(), ioaddr, memcpy(), nic::node_addr, outl, OWCOLL, OWN, printf(), sis900_debug, TX_TIMEOUT, txb, txd, TxDIS, txdp, TxENA, u32, UNDERRUN, and virt_to_bus().

◆ sis900_poll()

static int sis900_poll ( struct nic nic,
int  retrieve 
)
static

Definition at line 1182 of file sis900.c.

1183 {
1184  u32 rx_status = rxd[cur_rx].cmdsts;
1185  int retstat = 0;
1186 
1187  /* acknowledge interrupts by reading interrupt status register */
1188  inl(ioaddr + isr);
1189 
1190  if (sis900_debug > 2)
1191  printf("sis900_poll: cur_rx:%d, status:%X\n", cur_rx,
1192  (unsigned int) rx_status);
1193 
1194  if (!(rx_status & OWN))
1195  return retstat;
1196 
1197  if (sis900_debug > 1)
1198  printf("sis900_poll: got a packet: cur_rx:%d, status:%X\n",
1199  cur_rx, (unsigned int) rx_status);
1200 
1201  if ( ! retrieve ) return 1;
1202 
1203  nic->packetlen = (rx_status & DSIZE) - CRC_SIZE;
1204 
1205  if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) {
1206  /* corrupted packet received */
1207  printf("sis900_poll: Corrupted packet received, buffer status = %X\n",
1208  (unsigned int) rx_status);
1209  retstat = 0;
1210  } else {
1211  /* give packet to higher level routine */
1213  retstat = 1;
1214  }
1215 
1216  /* return the descriptor and buffer to receive ring */
1217  rxd[cur_rx].cmdsts = RX_BUF_SIZE;
1218  rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]);
1219 
1220  if (++cur_rx == NUM_RX_DESC)
1221  cur_rx = 0;
1222 
1223  /* re-enable the potentially idle receive state machine */
1224  outl(RxENA | inl(ioaddr + cr), ioaddr + cr);
1225 
1226  return retstat;
1227 
1228 }
static unsigned int cur_rx
Definition: sis900.c:66
Definition: sis900.h:233
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
Definition: sis190.h:210
#define rxb
Definition: sis900.c:77
#define RX_BUF_SIZE
Definition: 3c90x.h:269
Definition: sis900.h:51
#define rxd
Definition: sis900.c:75
#define NUM_RX_DESC
Definition: igbvf.h:281
#define CRC_SIZE
Definition: sis900.h:360
Definition: sis900.h:231
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
Definition: sis900.h:26
Definition: sis900.h:209
Definition: sis900.h:203
unsigned int packetlen
Definition: nic.h:54
static int sis900_debug
Definition: sis900.c:58
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:234
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
unsigned char * packet
Definition: nic.h:53
Definition: sis900.h:22
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
uint32_t u32
Definition: stdint.h:23

References ABORT, cr, CRC_SIZE, CRCERR, cur_rx, DSIZE, FAERR, inl(), ioaddr, isr, memcpy(), NUM_RX_DESC, outl, OVERRUN, OWN, nic::packet, nic::packetlen, printf(), RUNT, RX_BUF_SIZE, rxb, rxd, RxENA, RXISERR, sis900_debug, TOOLONG, and virt_to_bus().

◆ sis900_disable()

static void sis900_disable ( struct nic nic)
static

Definition at line 1241 of file sis900.c.

1241  {
1242 
1243  sis900_init(nic);
1244 
1245  /* Disable interrupts by clearing the interrupt mask. */
1246  outl(0, ioaddr + imr);
1247  outl(0, ioaddr + ier);
1248 
1249  /* Stop the chip's Tx and Rx Status Machine */
1250  outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr);
1251 }
Definition: sis900.h:27
Definition: sis900.h:28
static void sis900_init(struct nic *nic)
Definition: sis900.c:618
Definition: sis900.h:50
#define outl(data, io_addr)
Definition: io.h:329
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
Definition: sis900.h:22
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:52

References cr, ier, imr, inl(), ioaddr, outl, RxDIS, sis900_init(), and TxDIS.

◆ sis900_irq() [1/2]

static void sis900_irq ( struct nic nic,
irq_action_t  action 
)
static

◆ sis900_get_mac_addr()

static int sis900_get_mac_addr ( struct pci_device *pci_dev  __unused,
struct nic nic 
)
static

sis900_get_mac_addr: - Get MAC address for stand alone SiS900 model @pci_dev: the sis900 pci device @net_dev: the net device to get address for

Older SiS900 and friends, use EEPROM to store MAC address. MAC address is read from read_eeprom() into @net_dev->dev_addr.

Definition at line 180 of file sis900.c.

181 {
182  u16 signature;
183  int i;
184 
185  /* check to see if we have sane EEPROM */
187  if (signature == 0xffff || signature == 0x0000) {
188  printf ("sis900_probe: Error EERPOM read %hX\n", signature);
189  return 0;
190  }
191 
192  /* get MAC address from EEPROM */
193  for (i = 0; i < 3; i++)
195  return 1;
196 }
#define u16
Definition: vga.h:20
uint16_t u16
Definition: stdint.h:21
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
Definition: nic.h:49
unsigned char * node_addr
Definition: nic.h:52
static u16 sis900_read_eeprom(int location)
Definition: sis900.c:463
u8 signature
Signature.
Definition: CIB_PRM.h:35

References EEPROMMACAddr, EEPROMSignature, nic::node_addr, printf(), signature, sis900_read_eeprom(), and u16.

Referenced by sis900_probe().

◆ sis96x_get_mac_addr()

static int sis96x_get_mac_addr ( struct pci_device *pci_dev  __unused,
struct nic nic 
)
static

sis96x_get_mac_addr: - Get MAC address for SiS962 or SiS963 model @pci_dev: the sis900 pci device @net_dev: the net device to get address for

SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM is shared by LAN and 1394. When access EEPROM, send EEREQ signal to hardware first and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access by LAN, otherwise is not. After MAC address is read from EEPROM, send EEDONE signal to refuse EEPROM access by LAN. The EEPROM map of SiS962 or SiS963 is different to SiS900. The signature field in SiS962 or SiS963 spec is meaningless. MAC address is read into @net_dev->dev_addr.

Definition at line 214 of file sis900.c.

215 {
216 /* long ioaddr = net_dev->base_addr; */
217  long ee_addr = ioaddr + mear;
218  u32 waittime = 0;
219  int i;
220 
221  printf("Alternate function\n");
222 
223  outl(EEREQ, ee_addr);
224  while(waittime < 2000) {
225  if(inl(ee_addr) & EEGNT) {
226 
227  /* get MAC address from EEPROM */
228  for (i = 0; i < 3; i++)
230 
231  outl(EEDONE, ee_addr);
232  return 1;
233  } else {
234  udelay(1);
235  waittime ++;
236  }
237  }
238  outl(EEDONE, ee_addr);
239  return 0;
240 }
uint16_t u16
Definition: stdint.h:21
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
Definition: sis900.h:190
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
Definition: sis900.h:190
#define outl(data, io_addr)
Definition: io.h:329
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
Definition: sis190.h:231
unsigned char * node_addr
Definition: nic.h:52
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:24
static u16 sis900_read_eeprom(int location)
Definition: sis900.c:463
uint32_t u32
Definition: stdint.h:23

References EEDONE, EEGNT, EEPROMMACAddr, EEREQ, inl(), ioaddr, mear, nic::node_addr, outl, printf(), sis900_read_eeprom(), and udelay().

Referenced by sis900_probe().

◆ sis630e_get_mac_addr()

static int sis630e_get_mac_addr ( struct pci_device *pci_dev  __unused,
struct nic *nic  __unused 
)
static

sis630e_get_mac_addr: - Get MAC address for SiS630E model @pci_dev: the sis900 pci device @net_dev: the net device to get address for

SiS630E model, use APC CMOS RAM to store MAC address. APC CMOS RAM is accessed through ISA bridge. MAC address is read into @net_dev->dev_addr.

Definition at line 252 of file sis900.c.

253 {
254 #if 0
255  u8 reg;
256  int i;
257  struct bus_loc bus_loc;
258  union {
259  struct bus_dev bus_dev;
260  struct pci_device isa_bridge;
261  } u;
262 
263  /* find PCI to ISA bridge */
264  memset(&bus_loc, 0, sizeof(bus_loc));
265  if ( ! find_by_driver ( &bus_loc, &u.bus_dev, &sis_bridge_driver, 0 ) )
266  return 0;
267 
268  pci_read_config_byte(&u.isa_bridge, 0x48, &reg);
269  pci_write_config_byte(&u.isa_bridge, 0x48, reg | 0x40);
270 
271  for (i = 0; i < ETH_ALEN; i++)
272  {
273  outb(0x09 + i, 0x70);
274  ((u8 *)(nic->node_addr))[i] = inb(0x71);
275  }
276  pci_write_config_byte(&u.isa_bridge, 0x48, reg & ~0x40);
277 
278  return 1;
279 #endif
280 
281  /* Does not work with current bus/device model */
282  return 0;
283 }
static unsigned int unsigned int reg
Definition: myson.h:162
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
A PCI device.
Definition: pci.h:206
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define ETH_ALEN
Definition: if_ether.h:8
Definition: nic.h:49
unsigned char * node_addr
Definition: nic.h:52
#define outb(data, io_addr)
Definition: io.h:309
union @17 u
uint8_t u8
Definition: stdint.h:19
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.

References ETH_ALEN, inb(), memset(), nic::node_addr, outb, pci_read_config_byte(), pci_write_config_byte(), reg, and u.

Referenced by sis900_probe().

◆ sis635_get_mac_addr()

static int sis635_get_mac_addr ( struct pci_device *pci_dev  __unused,
struct nic nic 
)
static

sis630e_get_mac_addr: - Get MAC address for SiS630E model @pci_dev: the sis900 pci device @net_dev: the net device to get address for

SiS630E model, use APC CMOS RAM to store MAC address. APC CMOS RAM is accessed through ISA bridge. MAC address is read into @net_dev->dev_addr.

Definition at line 295 of file sis900.c.

296 {
297  u32 rfcrSave;
298  u32 i;
299 
300 
301  rfcrSave = inl(rfcr + ioaddr);
302 
303  outl(rfcrSave | RELOAD, ioaddr + cr);
304  outl(0, ioaddr + cr);
305 
306  /* disable packet filtering before setting filter */
307  outl(rfcrSave & ~RFEN, rfcr + ioaddr);
308 
309  /* load MAC addr to filter data register */
310  for (i = 0 ; i < 3 ; i++) {
311  outl((i << RFADDR_shift), ioaddr + rfcr);
312  *( ((u16 *)nic->node_addr) + i) = inw(ioaddr + rfdr);
313  }
314 
315  /* enable packet filitering */
316  outl(rfcrSave | RFEN, rfcr + ioaddr);
317 
318  return 1;
319 }
uint16_t u16
Definition: stdint.h:21
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
Definition: sis900.h:44
#define RFADDR_shift
Definition: sis900.h:153
Definition: sis900.h:36
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:156
Definition: nic.h:49
static unsigned long ioaddr
Definition: sis900.c:61
Definition: sis900.h:22
unsigned char * node_addr
Definition: nic.h:52
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:37
uint32_t u32
Definition: stdint.h:23

References cr, inl(), inw(), ioaddr, nic::node_addr, outl, RELOAD, RFADDR_shift, rfcr, rfdr, and RFEN.

Referenced by sis900_probe().

◆ sis900_reset() [2/2]

static void sis900_reset ( struct nic *nic  __unused)
static

Definition at line 647 of file sis900.c.

648 {
649  int i = 0;
650  u32 status = TxRCMP | RxRCMP;
651 
652  outl(0, ioaddr + ier);
653  outl(0, ioaddr + imr);
654  outl(0, ioaddr + rfcr);
655 
656  outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr);
657 
658  /* Check that the chip has finished the reset. */
659  while (status && (i++ < 1000)) {
660  status ^= (inl(isr + ioaddr) & status);
661  }
662 
664  outl(PESEL | RND_CNT, ioaddr + cfg);
665  else
666  outl(PESEL, ioaddr + cfg);
667 }
static u8 pci_revision
Definition: sis900.c:62
Definition: sis900.h:65
Definition: sis900.h:27
Definition: sis900.h:46
uint8_t status
Status.
Definition: ena.h:16
Definition: sis900.h:28
Definition: sis900.h:49
Definition: sis900.h:85
Definition: sis900.h:36
Definition: sis900.h:84
Definition: sis900.h:26
#define outl(data, io_addr)
Definition: io.h:329
static unsigned long ioaddr
Definition: sis900.c:61
Definition: sis900.h:22
Definition: sis900.h:23
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:48
Definition: sis900.h:62
uint32_t u32
Definition: stdint.h:23

References cfg, cr, ier, imr, inl(), ioaddr, isr, outl, pci_revision, PESEL, RESET, rfcr, RND_CNT, RxRCMP, RxRESET, SIS635A_900_REV, SIS900B_900_REV, status, TxRCMP, and TxRESET.

◆ sis900_init_txd() [2/2]

static void sis900_init_txd ( struct nic *nic  __unused)
static

Definition at line 719 of file sis900.c.

720 {
721  txd.link = (u32) 0;
722  txd.cmdsts = (u32) 0;
723  txd.bufptr = virt_to_bus(&txb[0]);
724 
725  /* load Transmit Descriptor Register */
726  outl(virt_to_bus(&txd), ioaddr + txdp);
727  if (sis900_debug > 0)
728  printf("sis900_init_txd: TX descriptor register loaded with: %X\n",
729  inl(ioaddr + txdp));
730 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
#define u32
Definition: vga.h:21
static int sis900_debug
Definition: sis900.c:58
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:30
static unsigned long ioaddr
Definition: sis900.c:61
#define txd
Definition: sis900.c:74
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
#define txb
Definition: sis900.c:76

References inl(), ioaddr, outl, printf(), sis900_debug, txb, txd, txdp, u32, and virt_to_bus().

◆ sis900_init_rxd() [2/2]

static void sis900_init_rxd ( struct nic *nic  __unused)
static

Definition at line 743 of file sis900.c.

744 {
745  int i;
746 
747  cur_rx = 0;
748 
749  /* init RX descriptor */
750  for (i = 0; i < NUM_RX_DESC; i++) {
751  rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]);
752  rxd[i].cmdsts = (u32) RX_BUF_SIZE;
753  rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]);
754  if (sis900_debug > 0)
755  printf("sis900_init_rxd: rxd[%d]=%p link=%X cmdsts=%X bufptr=%X\n",
756  i, &rxd[i], (unsigned int) rxd[i].link, (unsigned int) rxd[i].cmdsts,
757  (unsigned int) rxd[i].bufptr);
758  }
759 
760  /* load Receive Descriptor Register */
761  outl(virt_to_bus(&rxd[0]), ioaddr + rxdp);
762 
763  if (sis900_debug > 0)
764  printf("sis900_init_rxd: RX descriptor register loaded with: %X\n",
765  inl(ioaddr + rxdp));
766 
767 }
static unsigned int cur_rx
Definition: sis900.c:66
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define rxb
Definition: sis900.c:77
#define RX_BUF_SIZE
Definition: 3c90x.h:269
#define rxd
Definition: sis900.c:75
#define NUM_RX_DESC
Definition: igbvf.h:281
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
#define u32
Definition: vga.h:21
u32 link
Link to next descriptor.
Definition: ar9003_mac.h:68
static int sis900_debug
Definition: sis900.c:58
#define outl(data, io_addr)
Definition: io.h:329
static unsigned long ioaddr
Definition: sis900.c:61
uint32_t bufptr
Buffer pointer.
Definition: natsemi.h:16
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
Definition: sis900.h:32
uint32_t cmdsts
Command / status.
Definition: natsemi.h:14

References bufptr, cmdsts, cur_rx, inl(), ioaddr, link, NUM_RX_DESC, outl, printf(), RX_BUF_SIZE, rxb, rxd, rxdp, sis900_debug, u32, and virt_to_bus().

◆ sis900_set_rx_mode() [2/2]

static void sis900_set_rx_mode ( struct nic *nic  __unused)
static

Definition at line 781 of file sis900.c.

782 {
783  int i, table_entries;
784  u32 rx_mode;
785  u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */
786 
788  table_entries = 16;
789  else
790  table_entries = 8;
791 
792  /* accept all multicast packet */
793  rx_mode = RFAAB | RFAAM;
794  for (i = 0; i < table_entries; i++)
795  mc_filter[i] = 0xffff;
796 
797  /* update Multicast Hash Table in Receive Filter */
798  for (i = 0; i < table_entries; i++) {
799  /* why plus 0x04? That makes the correct value for hash table. */
800  outl((u32)(0x00000004+i) << RFADDR_shift, ioaddr + rfcr);
801  outl(mc_filter[i], ioaddr + rfdr);
802  }
803 
804  /* Accept Broadcast and multicast packets, destination addresses that match
805  our MAC address */
806  outl(RFEN | rx_mode, ioaddr + rfcr);
807 
808  return;
809 }
uint16_t u16
Definition: stdint.h:21
static u8 pci_revision
Definition: sis900.c:62
#define RFADDR_shift
Definition: sis900.h:153
Definition: sis900.h:36
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:158
Definition: sis900.h:156
static unsigned long ioaddr
Definition: sis900.c:61
Definition: sis900.h:37
uint32_t u32
Definition: stdint.h:23
Definition: sis900.h:157

References ioaddr, outl, pci_revision, RFAAB, RFAAM, RFADDR_shift, rfcr, rfdr, RFEN, SIS635A_900_REV, and SIS900B_900_REV.

◆ sis900_read_mode() [2/2]

static void sis900_read_mode ( struct nic *nic  __unused,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

Definition at line 869 of file sis900.c.

870 {
871  int i = 0;
872  u32 status;
873  u16 phy_id0, phy_id1;
874 
875  /* STSOUT register is Latched on Transition, read operation updates it */
876  do {
877  status = sis900_mdio_read(phy_addr, MII_STSOUT);
878  } while (i++ < 2);
879 
880  *speed = HW_SPEED_10_MBPS;
882 
884  *speed = HW_SPEED_100_MBPS;
887 
888  /* Workaround for Realtek RTL8201 PHY issue */
889  phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
890  phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
891  if((phy_id0 == 0x0000) && ((phy_id1 & 0xFFF0) == 0x8200)){
892  if(sis900_mdio_read(phy_addr, MII_CONTROL) & MII_CNTL_FDX)
894  if(sis900_mdio_read(phy_addr, 0x0019) & 0x01)
895  *speed = HW_SPEED_100_MBPS;
896  }
897 
899  printf("sis900_read_mode: Media Link Off\n");
900  else
901  printf("sis900_read_mode: Media Link On %s %s-duplex \n",
902  *speed == HW_SPEED_100_MBPS ?
903  "100mbps" : "10mbps",
905  "full" : "half");
906 }
uint16_t u16
Definition: stdint.h:21
static u16 sis900_mdio_read(int phy_id, int location)
Definition: sis900.c:534
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
uint8_t status
Status.
Definition: ena.h:16
#define FDX_CAPABLE_FULL_SELECTED
Definition: sis900.h:352
#define HW_SPEED_100_MBPS
Definition: sis900.h:357
duplex
Definition: nic.h:40
#define FDX_CAPABLE_HALF_SELECTED
Definition: sis900.h:351
#define HW_SPEED_10_MBPS
Definition: sis900.h:356
uint32_t u32
Definition: stdint.h:23

References FDX_CAPABLE_FULL_SELECTED, FDX_CAPABLE_HALF_SELECTED, HW_SPEED_100_MBPS, HW_SPEED_10_MBPS, MII_CNTL_FDX, MII_CONTROL, MII_NWAY_T_FDX, MII_NWAY_TX, MII_NWAY_TX_FDX, MII_PHY_ID0, MII_PHY_ID1, MII_STSOUT, MII_STSOUT_LINK_FAIL, printf(), sis900_mdio_read(), and status.

◆ amd79c901_read_mode() [2/2]

static void amd79c901_read_mode ( struct nic *nic  __unused,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

Definition at line 920 of file sis900.c.

921 {
922  int i;
923  u16 status;
924 
925  for (i = 0; i < 2; i++)
926  status = sis900_mdio_read(phy_addr, MII_STATUS);
927 
928  if (status & MII_STAT_CAN_AUTO) {
929  /* 10BASE-T PHY */
930  for (i = 0; i < 2; i++)
932  if (status & MII_STSSUM_SPD)
933  *speed = HW_SPEED_100_MBPS;
934  else
935  *speed = HW_SPEED_10_MBPS;
936  if (status & MII_STSSUM_DPLX)
938  else
940 
941  if (status & MII_STSSUM_LINK)
942  printf("amd79c901_read_mode: Media Link On %s %s-duplex \n",
943  *speed == HW_SPEED_100_MBPS ?
944  "100mbps" : "10mbps",
946  "full" : "half");
947  else
948  printf("amd79c901_read_mode: Media Link Off\n");
949  }
950  else {
951  /* HomePNA */
952  *speed = HW_SPEED_HOME;
954  if (status & MII_STAT_LINK)
955  printf("amd79c901_read_mode:Media Link On 1mbps half-duplex \n");
956  else
957  printf("amd79c901_read_mode: Media Link Off\n");
958  }
959 }
uint16_t u16
Definition: stdint.h:21
static u16 sis900_mdio_read(int phy_id, int location)
Definition: sis900.c:534
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
uint8_t status
Status.
Definition: ena.h:16
#define FDX_CAPABLE_FULL_SELECTED
Definition: sis900.h:352
#define HW_SPEED_100_MBPS
Definition: sis900.h:357
#define HW_SPEED_HOME
Definition: sis900.h:355
duplex
Definition: nic.h:40
#define FDX_CAPABLE_HALF_SELECTED
Definition: sis900.h:351
#define HW_SPEED_10_MBPS
Definition: sis900.h:356

References FDX_CAPABLE_FULL_SELECTED, FDX_CAPABLE_HALF_SELECTED, HW_SPEED_100_MBPS, HW_SPEED_10_MBPS, HW_SPEED_HOME, MII_STAT_CAN_AUTO, MII_STAT_LINK, MII_STATUS, MII_STATUS_SUMMARY, MII_STSSUM_DPLX, MII_STSSUM_LINK, MII_STSSUM_SPD, printf(), sis900_mdio_read(), and status.

◆ ics1893_read_mode() [2/2]

static void ics1893_read_mode ( struct nic *nic  __unused,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

ics1893_read_mode: - read media mode for ICS1893 PHY @net_dev: the net device to read mode for @phy_addr: mii phy address @speed: the transmit speed to be determined @duplex: the duplex mode to be determined

ICS1893 PHY use Quick Poll Detailed Status register to determine the speed and duplex mode for sis900

Definition at line 973 of file sis900.c.

974 {
975  int i = 0;
976  u32 status;
977 
978  /* MII_QPDSTS is Latched, read twice in succession will reflect the current state */
979  for (i = 0; i < 2; i++)
980  status = sis900_mdio_read(phy_addr, MII_QPDSTS);
981 
982  if (status & MII_STSICS_SPD)
983  *speed = HW_SPEED_100_MBPS;
984  else
985  *speed = HW_SPEED_10_MBPS;
986 
987  if (status & MII_STSICS_DPLX)
989  else
991 
993  printf("ics1893_read_mode: Media Link On %s %s-duplex \n",
994  *speed == HW_SPEED_100_MBPS ?
995  "100mbps" : "10mbps",
997  "full" : "half");
998  else
999  printf("ics1893_read_mode: Media Link Off\n");
1000 }
static u16 sis900_mdio_read(int phy_id, int location)
Definition: sis900.c:534
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
uint8_t status
Status.
Definition: ena.h:16
#define FDX_CAPABLE_FULL_SELECTED
Definition: sis900.h:352
#define HW_SPEED_100_MBPS
Definition: sis900.h:357
duplex
Definition: nic.h:40
#define FDX_CAPABLE_HALF_SELECTED
Definition: sis900.h:351
#define HW_SPEED_10_MBPS
Definition: sis900.h:356
uint32_t u32
Definition: stdint.h:23

References FDX_CAPABLE_FULL_SELECTED, FDX_CAPABLE_HALF_SELECTED, HW_SPEED_100_MBPS, HW_SPEED_10_MBPS, MII_QPDSTS, MII_STSICS_DPLX, MII_STSICS_LINKSTS, MII_STSICS_SPD, printf(), sis900_mdio_read(), and status.

◆ rtl8201_read_mode() [2/2]

static void rtl8201_read_mode ( struct nic *nic  __unused,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

rtl8201_read_mode: - read media mode for rtl8201 phy @nic: the net device to read mode for @phy_addr: mii phy address @speed: the transmit speed to be determined @duplex: the duplex mode to be determined

read MII_STATUS register from rtl8201 phy to determine the speed and duplex mode for sis900

Definition at line 1013 of file sis900.c.

1014 {
1015  u32 status;
1016 
1017  status = sis900_mdio_read(phy_addr, MII_STATUS);
1018 
1019  if (status & MII_STAT_CAN_TX_FDX) {
1020  *speed = HW_SPEED_100_MBPS;
1022  }
1023  else if (status & MII_STAT_CAN_TX) {
1024  *speed = HW_SPEED_100_MBPS;
1026  }
1027  else if (status & MII_STAT_CAN_T_FDX) {
1028  *speed = HW_SPEED_10_MBPS;
1030  }
1031  else if (status & MII_STAT_CAN_T) {
1032  *speed = HW_SPEED_10_MBPS;
1034  }
1035 
1036  if (status & MII_STAT_LINK)
1037  printf("rtl8201_read_mode: Media Link On %s %s-duplex \n",
1038  *speed == HW_SPEED_100_MBPS ?
1039  "100mbps" : "10mbps",
1041  "full" : "half");
1042  else
1043  printf("rtl8201_read_config_mode: Media Link Off\n");
1044 }
static u16 sis900_mdio_read(int phy_id, int location)
Definition: sis900.c:534
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
uint8_t status
Status.
Definition: ena.h:16
#define FDX_CAPABLE_FULL_SELECTED
Definition: sis900.h:352
#define HW_SPEED_100_MBPS
Definition: sis900.h:357
duplex
Definition: nic.h:40
#define FDX_CAPABLE_HALF_SELECTED
Definition: sis900.h:351
#define HW_SPEED_10_MBPS
Definition: sis900.h:356
uint32_t u32
Definition: stdint.h:23

References FDX_CAPABLE_FULL_SELECTED, FDX_CAPABLE_HALF_SELECTED, HW_SPEED_100_MBPS, HW_SPEED_10_MBPS, MII_STAT_CAN_T, MII_STAT_CAN_T_FDX, MII_STAT_CAN_TX, MII_STAT_CAN_TX_FDX, MII_STAT_LINK, MII_STATUS, printf(), sis900_mdio_read(), and status.

◆ vt6103_read_mode() [2/2]

static void vt6103_read_mode ( struct nic *nic  __unused,
int  phy_addr,
int *  speed,
int *  duplex 
)
static

vt6103_read_mode: - read media mode for vt6103 phy @nic: the net device to read mode for @phy_addr: mii phy address @speed: the transmit speed to be determined @duplex: the duplex mode to be determined

read MII_STATUS register from rtl8201 phy to determine the speed and duplex mode for sis900

Definition at line 1057 of file sis900.c.

1058 {
1059  u32 status;
1060 
1061  status = sis900_mdio_read(phy_addr, MII_STATUS);
1062 
1063  if (status & MII_STAT_CAN_TX_FDX) {
1064  *speed = HW_SPEED_100_MBPS;
1066  }
1067  else if (status & MII_STAT_CAN_TX) {
1068  *speed = HW_SPEED_100_MBPS;
1070  }
1071  else if (status & MII_STAT_CAN_T_FDX) {
1072  *speed = HW_SPEED_10_MBPS;
1074  }
1075  else if (status & MII_STAT_CAN_T) {
1076  *speed = HW_SPEED_10_MBPS;
1078  }
1079 
1080  if (status & MII_STAT_LINK)
1081  printf("vt6103_read_mode: Media Link On %s %s-duplex \n",
1082  *speed == HW_SPEED_100_MBPS ?
1083  "100mbps" : "10mbps",
1085  "full" : "half");
1086  else
1087  printf("vt6103_read_config_mode: Media Link Off\n");
1088 }
static u16 sis900_mdio_read(int phy_id, int location)
Definition: sis900.c:534
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
uint8_t status
Status.
Definition: ena.h:16
#define FDX_CAPABLE_FULL_SELECTED
Definition: sis900.h:352
#define HW_SPEED_100_MBPS
Definition: sis900.h:357
duplex
Definition: nic.h:40
#define FDX_CAPABLE_HALF_SELECTED
Definition: sis900.h:351
#define HW_SPEED_10_MBPS
Definition: sis900.h:356
uint32_t u32
Definition: stdint.h:23

References FDX_CAPABLE_FULL_SELECTED, FDX_CAPABLE_HALF_SELECTED, HW_SPEED_100_MBPS, HW_SPEED_10_MBPS, MII_STAT_CAN_T, MII_STAT_CAN_T_FDX, MII_STAT_CAN_TX, MII_STAT_CAN_TX_FDX, MII_STAT_LINK, MII_STATUS, printf(), sis900_mdio_read(), and status.

◆ sis900_irq() [2/2]

static void sis900_irq ( struct nic *nic  __unused,
irq_action_t action  __unused 
)
static

Definition at line 1265 of file sis900.c.

1266 {
1267  switch ( action ) {
1268  case DISABLE :
1269  outl(0, ioaddr + imr);
1270  break;
1271  case ENABLE :
1273  break;
1274  case FORCE :
1275  break;
1276  }
1277 }
Definition: nic.h:35
Definition: sis900.h:27
Definition: sis900.h:96
#define outl(data, io_addr)
Definition: io.h:329
Definition: sis900.h:90
Definition: nic.h:37
static unsigned long ioaddr
Definition: sis900.c:61
Definition: nic.h:36
Definition: sis900.h:99
Definition: sis900.h:102
Definition: sis900.h:104
Definition: sis900.h:95
Definition: sis900.h:94

References DISABLE, ENABLE, FORCE, imr, ioaddr, outl, RxERR, RxOK, RxORN, RxSOVR, TxERR, TxIDLE, and TxURN.

◆ PCI_DRIVER()

PCI_DRIVER ( sis900_driver  ,
sis900_nics  ,
PCI_NO_CLASS   
)

◆ DRIVER()

DRIVER ( "SIS900"  ,
nic_driver  ,
pci_driver  ,
sis900_driver  ,
sis900_probe  ,
sis900_disable   
)

Variable Documentation

◆ sis900_operations

static struct nic_operations sis900_operations
static
Initial value:
= {
.connect = dummy_connect,
.poll = sis900_poll,
.transmit = sis900_transmit,
.irq = sis900_irq,
}
int dummy_connect(struct nic *nic __unused)
Definition: legacy.c:151
static int sis900_poll(struct nic *nic, int retrieve)
Definition: sis900.c:1182
static void sis900_irq(struct nic *nic, irq_action_t action)
static void sis900_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
Definition: sis900.c:1103

Definition at line 56 of file sis900.c.

Referenced by sis900_probe().

◆ sis900_debug

int sis900_debug = 0
static

◆ vendor

unsigned short vendor
static

Definition at line 60 of file sis900.c.

Referenced by sis900_probe().

◆ dev_id

unsigned short dev_id
static

Definition at line 60 of file sis900.c.

Referenced by sis900_probe().

◆ ioaddr

unsigned long ioaddr
static

◆ pci_revision

u8 pci_revision
static

Definition at line 62 of file sis900.c.

Referenced by sis900_probe(), sis900_reset(), and sis900_set_rx_mode().

◆ cur_phy

unsigned int cur_phy
static

Definition at line 64 of file sis900.c.

Referenced by sis900_check_mode(), and sis900_probe().

◆ cur_rx

unsigned int cur_rx
static

Definition at line 66 of file sis900.c.

Referenced by sis900_init_rxd(), and sis900_poll().

◆ txd

Definition at line 69 of file sis900.c.

◆ rxd

Definition at line 70 of file sis900.c.

◆ txb

unsigned char txb[TX_BUF_SIZE]

Definition at line 71 of file sis900.c.

◆ rxb

unsigned char rxb[NUM_RX_DESC *RX_BUF_SIZE]

Definition at line 72 of file sis900.c.

◆ __shared

struct { ... } __shared

◆ mii_chip_table

struct mii_chip_info mii_chip_table[]
static
Initial value:
= {
{"SiS 900 Internal MII PHY", 0x001d, 0x8000, sis900_read_mode},
{"SiS 7014 Physical Layer Solution", 0x0016, 0xf830,sis900_read_mode},
{"SiS 900 on Foxconn 661 7MI", 0x0143, 0xBC70, sis900_read_mode},
{"AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, amd79c901_read_mode},
{"AMD 79C901 HomePNA PHY", 0x0000, 0x6B90, amd79c901_read_mode},
{"ICS 1893 Integrated PHYceiver" , 0x0015, 0xf440,ics1893_read_mode},
{"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8200,rtl8201_read_mode},
{"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
{NULL,0,0,NULL}
}
static void amd79c901_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
static void ics1893_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
static void sis900_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
static void rtl8201_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
static void vt6103_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

Referenced by sis900_probe().

◆ mii

struct mii_phy mii
static

◆ sis900_nics

struct pci_device_id sis900_nics[]
static
Initial value:
= {
PCI_ROM(0x1039, 0x0900, "sis900", "SIS900", 0),
PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016", 0),
}
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition: pci.h:303

Definition at line 1286 of file sis900.c.