iPXE
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  sis900_bss
struct  mii_chip_info
struct  mii_phy

Macros

#define sis900_bufs   NIC_FAKE_BSS ( struct sis900_bss )
#define txd   sis900_bufs.txd
#define rxd   sis900_bufs.rxd
#define txb   sis900_bufs.txb
#define rxb   sis900_bufs.rxb
#define eeprom_delay()
#define sis900_mdio_delay()

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, void *hwdev)
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
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
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
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
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
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
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
static void sis900_disable (struct nic *nic, void *hwdev __unused)
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, sis900_bufs)

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
static struct mii_chip_info mii_chip_table []
static struct mii_phy mii
static struct pci_device_id sis900_nics []

Macro Definition Documentation

◆ sis900_bufs

#define sis900_bufs   NIC_FAKE_BSS ( struct sis900_bss )

Definition at line 74 of file sis900.c.

Referenced by DRIVER().

◆ txd

#define txd   sis900_bufs.txd

Definition at line 75 of file sis900.c.

◆ rxd

#define rxd   sis900_bufs.rxd

Definition at line 76 of file sis900.c.

◆ txb

#define txb   sis900_bufs.txb

Definition at line 77 of file sis900.c.

◆ rxb

#define rxb   sis900_bufs.rxb

Definition at line 78 of file sis900.c.

◆ eeprom_delay

#define eeprom_delay ( )
Value:
inl(ee_addr)
#define inl(io_addr)
Definition io.h:301

Definition at line 449 of file sis900.c.

Referenced by sis900_read_eeprom().

◆ sis900_mdio_delay

#define sis900_mdio_delay ( )
Value:
inl(mdio_addr)

Definition at line 505 of file sis900.c.

Referenced by sis900_mdio_idle(), sis900_mdio_read(), and sis900_mdio_reset().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL_ANY )

◆ sis900_read_mode() [1/2]

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

◆ amd79c901_read_mode() [1/2]

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

◆ ics1893_read_mode() [1/2]

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

◆ rtl8201_read_mode() [1/2]

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

◆ vt6103_read_mode() [1/2]

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

References name.

◆ sis900_probe()

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

Definition at line 336 of file sis900.c.

336 {
337
338 int i;
339 int found=0;
340 int phy_addr;
341 u8 revision;
342 int ret;
343
344 if (pci->ioaddr == 0)
345 return 0;
346
347 nic->irqno = 0;
348 nic->ioaddr = pci->ioaddr;
349
350 ioaddr = pci->ioaddr;
351 vendor = pci->vendor;
352 dev_id = pci->device;
353
354 /* wakeup chip */
355 pci_write_config_dword(pci, 0x40, 0x00000000);
356
358
359 /* get MAC address */
360 ret = 0;
362
363 /* save for use later in sis900_reset() */
365
367 ret = sis630e_get_mac_addr(pci, nic);
368 else if ((revision > 0x81) && (revision <= 0x90))
369 ret = sis635_get_mac_addr(pci, nic);
370 else if (revision == SIS96x_900_REV)
371 ret = sis96x_get_mac_addr(pci, nic);
372 else
373 ret = sis900_get_mac_addr(pci, nic);
374
375 if (ret == 0)
376 {
377 printf ("sis900_probe: Error MAC address not found\n");
378 return 0;
379 }
380
381 /* 630ET : set the mii access mode as software-mode */
384
385 DBG( "sis900_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id );
386
387 /* probe for mii transceiver */
388 /* search for total of 32 possible mii phy addresses */
389
390 found = 0;
391 for (phy_addr = 0; phy_addr < 32; phy_addr++) {
392 u16 mii_status;
393 u16 phy_id0, phy_id1;
394
395 mii_status = sis900_mdio_read(phy_addr, MII_STATUS);
396 if (mii_status == 0xffff || mii_status == 0x0000)
397 /* the mii is not accessible, try next one */
398 continue;
399
400 phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
401 phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
402
403 /* search our mii table for the current mii */
404 for (i = 0; mii_chip_table[i].phy_id1; i++) {
405
406 if ((phy_id0 == mii_chip_table[i].phy_id0) &&
407 ((phy_id1 & 0xFFF0) == mii_chip_table[i].phy_id1)){
408
409 printf("sis900_probe: %s transceiver found at address %d.\n",
410 mii_chip_table[i].name, phy_addr);
411
412 mii.chip_info = &mii_chip_table[i];
413 mii.phy_addr = phy_addr;
414 mii.status = sis900_mdio_read(phy_addr, MII_STATUS);
415 mii.next = NULL;
416
417 found=1;
418 break;
419 }
420 }
421 }
422
423 if (found == 0) {
424 printf("sis900_probe: No MII transceivers found!\n");
425 return 0;
426 }
427
428 /* Arbitrarily select the last PHY found as current PHY */
429 cur_phy = mii.phy_addr;
430 printf("sis900_probe: Using %s as default\n", mii.chip_info->name);
431
432 /* initialize device */
435
436 return 1;
437}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
const char * name
Definition ath9k_hw.c:1986
static unsigned long ioaddr
Definition davicom.c:129
static unsigned short vendor
Definition davicom.c:128
static unsigned short dev_id
Definition davicom.c:128
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
uint32_t revision
Entry point revision.
Definition ib_mad.h:9
#define u8
Definition igbvf_osdep.h:40
#define outl(data, io_addr)
Definition io.h:330
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
#define PCI_REVISION
PCI revision.
Definition pci.h:45
static struct mii_chip_info mii_chip_table[]
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:181
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:253
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:296
static struct mii_phy mii
static u16 sis900_mdio_read(int phy_id, int location)
Definition sis900.c:535
static struct nic_operations sis900_operations
Definition sis900.c:56
static u8 pci_revision
Definition sis900.c:62
static void sis900_init(struct nic *nic)
Definition sis900.c:619
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:215
static unsigned int cur_phy
Definition sis900.c:64
@ MII_PHY_ID0
Definition sis900.h:243
@ MII_PHY_ID1
Definition sis900.h:244
@ MII_STATUS
Definition sis900.h:242
@ cr
Definition sis900.h:22
@ SIS630ET_900_REV
Definition sis900.h:341
@ SIS630E_900_REV
Definition sis900.h:339
@ SIS96x_900_REV
Definition sis900.h:342
@ ACCESSMODE
Definition sis900.h:45
Definition nic.h:49
unsigned char irqno
Definition nic.h:56
unsigned int ioaddr
Definition nic.h:55
struct nic_operations * nic_op
Definition nic.h:50
unsigned long ioaddr
I/O address.
Definition pci.h:226
uint16_t vendor
Vendor ID.
Definition pci.h:228
uint16_t device
Device ID.
Definition pci.h:230
#define u16
Definition vga.h:20
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465

References ACCESSMODE, adjust_pci_device(), cr, cur_phy, DBG, dev_id, pci_device::device, inl, ioaddr, nic::ioaddr, pci_device::ioaddr, nic::irqno, mii, mii_chip_table, MII_PHY_ID0, MII_PHY_ID1, MII_STATUS, name, nic::nic_op, NULL, outl, pci_read_config_byte(), PCI_REVISION, pci_revision, pci_write_config_dword(), 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(), u16, u8, pci_device::vendor, and vendor.

Referenced by DRIVER().

◆ sis900_read_eeprom()

u16 sis900_read_eeprom ( int location)
static

Definition at line 464 of file sis900.c.

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

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

Referenced by sis900_get_mac_addr(), and sis96x_get_mac_addr().

◆ sis900_mdio_reset()

void sis900_mdio_reset ( long mdio_addr)
static

Definition at line 522 of file sis900.c.

523{
524 int i;
525
526 for (i = 31; i >= 0; i--) {
527 outl(MDDIR | MDIO, mdio_addr);
529 outl(MDDIR | MDIO | MDC, mdio_addr);
531 }
532 return;
533}
#define sis900_mdio_delay()
Definition sis900.c:505
@ MDDIR
Definition sis900.h:72
@ MDIO
Definition sis900.h:73
@ MDC
Definition sis900.h:71

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

Referenced by sis900_mdio_read().

◆ sis900_mdio_idle()

void sis900_mdio_idle ( long mdio_addr)
static

Definition at line 514 of file sis900.c.

515{
516 outl(MDIO | MDDIR, mdio_addr);
518 outl(MDIO | MDDIR | MDC, mdio_addr);
519}

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

Referenced by sis900_mdio_read().

◆ sis900_mdio_read()

u16 sis900_mdio_read ( int phy_id,
int location )
static

Definition at line 535 of file sis900.c.

536{
537 long mdio_addr = ioaddr + mear;
538 int mii_cmd = MIIread|(phy_id<<MIIpmdShift)|(location<<MIIregShift);
539 u16 retval = 0;
540 int i;
541
542 sis900_mdio_reset(mdio_addr);
543 sis900_mdio_idle(mdio_addr);
544
545 for (i = 15; i >= 0; i--) {
546 int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR;
547 outl(dataval, mdio_addr);
549 outl(dataval | MDC, mdio_addr);
551 }
552
553 /* Read the 16 data bits. */
554 for (i = 16; i > 0; i--) {
555 outl(0, mdio_addr);
557 retval = (retval << 1) | ((inl(mdio_addr) & MDIO) ? 1 : 0);
558 outl(MDC, mdio_addr);
560 }
561 outl(0x00, mdio_addr);
562 return retval;
563}
static void sis900_mdio_idle(long mdio_addr)
Definition sis900.c:514
static void sis900_mdio_reset(long mdio_addr)
Definition sis900.c:522
#define MIIpmdShift
Definition sis900.h:196
#define MIIregShift
Definition sis900.h:197
#define MIIread
Definition sis900.h:194

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

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

◆ sis900_init()

void sis900_init ( struct nic * nic)
static

Definition at line 619 of file sis900.c.

620{
621 /* Soft reset the chip. */
623
625
628
630
632
633 outl(RxENA| inl(ioaddr + cr), ioaddr + cr);
634}
static void sis900_init_txd(struct nic *nic)
static void sis900_check_mode(struct nic *nic)
Definition sis900.c:824
static void sis900_set_rx_mode(struct nic *nic)
static void sis900_init_rxfilter(struct nic *nic)
Definition sis900.c:681
static void sis900_reset(struct nic *nic)
static void sis900_init_rxd(struct nic *nic)
@ RxENA
Definition sis900.h:51

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]

void sis900_reset ( struct nic * nic)
static

Referenced by sis900_init().

◆ sis900_init_rxfilter()

void sis900_init_rxfilter ( struct nic * nic)
static

Definition at line 681 of file sis900.c.

682{
683 u32 rfcrSave;
684 int i;
685
686 rfcrSave = inl(rfcr + ioaddr);
687
688 /* disable packet filtering before setting filter */
689 outl(rfcrSave & ~RFEN, rfcr + ioaddr);
690
691 /* load MAC addr to filter data register */
692 for (i = 0 ; i < 3 ; i++) {
693 u32 w;
694
695 w = (u32) *((u16 *)(nic->node_addr)+i);
696 outl((i << RFADDR_shift), ioaddr + rfcr);
697 outl(w, ioaddr + rfdr);
698
699 if (sis900_debug > 0)
700 printf("sis900_init_rxfilter: Receive Filter Addrss[%d]=%X\n",
701 i, inl(ioaddr + rfdr));
702 }
703
704 /* enable packet filitering */
705 outl(rfcrSave | RFEN, rfcr + ioaddr);
706}
static int sis900_debug
Definition sis900.c:58
#define RFADDR_shift
Definition sis900.h:153
@ rfdr
Definition sis900.h:37
@ rfcr
Definition sis900.h:36
@ RFEN
Definition sis900.h:156
unsigned char * node_addr
Definition nic.h:52

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

Referenced by sis900_init().

◆ sis900_init_txd() [1/2]

void sis900_init_txd ( struct nic * nic)
static

Referenced by sis900_init().

◆ sis900_init_rxd() [1/2]

void sis900_init_rxd ( struct nic * nic)
static

Referenced by sis900_init().

◆ sis900_set_rx_mode() [1/2]

void sis900_set_rx_mode ( struct nic * nic)
static

Referenced by sis900_init().

◆ sis900_check_mode()

void sis900_check_mode ( struct nic * nic)
static

Definition at line 824 of file sis900.c.

825{
826 int speed, duplex;
827 u32 tx_flags = 0, rx_flags = 0;
828
829 mii.chip_info->read_mode(nic, cur_phy, &speed, &duplex);
830
831 if( inl(ioaddr + cfg) & EDB_MASTER_EN ) {
833 rx_flags = DMA_BURST_64 << RxMXDMA_shift;
834 }
835 else {
837 rx_flags = DMA_BURST_512 << RxMXDMA_shift;
838 }
839
840 if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS) {
841 rx_flags |= (RxDRNT_10 << RxDRNT_shift);
842 tx_flags |= (TxDRNT_10 << TxDRNT_shift);
843 }
844 else {
845 rx_flags |= (RxDRNT_100 << RxDRNT_shift);
846 tx_flags |= (TxDRNT_100 << TxDRNT_shift);
847 }
848
850 tx_flags |= (TxCSI | TxHBI);
851 rx_flags |= RxATX;
852 }
853
854 outl (tx_flags, ioaddr + txcfg);
855 outl (rx_flags, ioaddr + rxcfg);
856}
duplex
Definition nic.h:40
@ TxATP
Definition sis900.h:133
@ TxHBI
Definition sis900.h:131
@ TxCSI
Definition sis900.h:130
#define TxDRNT_10
Definition sis900.h:127
#define HW_SPEED_10_MBPS
Definition sis900.h:356
#define RxDRNT_shift
Definition sis900.h:140
@ EDB_MASTER_EN
Definition sis900.h:67
#define FDX_CAPABLE_FULL_SELECTED
Definition sis900.h:352
#define RxDRNT_100
Definition sis900.h:141
#define TxMXDMA_shift
Definition sis900.h:113
@ rxcfg
Definition sis900.h:33
@ cfg
Definition sis900.h:23
@ txcfg
Definition sis900.h:31
#define TxFILLT_shift
Definition sis900.h:124
@ RxATX
Definition sis900.h:147
#define HW_SPEED_HOME
Definition sis900.h:355
#define TX_FILL_THRESH
Definition sis900.h:123
@ DMA_BURST_512
Definition sis900.h:119
@ DMA_BURST_64
Definition sis900.h:119
#define RxMXDMA_shift
Definition sis900.h:114
#define RxDRNT_10
Definition sis900.h:142
#define TxDRNT_shift
Definition sis900.h:125
#define TxDRNT_100
Definition sis900.h:126

References cfg, 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, 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, TxMXDMA_shift, and u32.

Referenced by sis900_init().

◆ sis900_transmit()

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

Definition at line 1104 of file sis900.c.

1109{
1110 u32 to, nstype;
1111 volatile u32 tx_status;
1112
1113 /* Stop the transmitter */
1114 outl(TxDIS | inl(ioaddr + cr), ioaddr + cr);
1115
1116 /* load Transmit Descriptor Register */
1118 if (sis900_debug > 1)
1119 printf("sis900_transmit: TX descriptor register loaded with: %X\n",
1120 inl(ioaddr + txdp));
1121
1122 memcpy(txb, d, ETH_ALEN);
1124 nstype = htons(t);
1125 memcpy(txb + 2 * ETH_ALEN, (char*)&nstype, 2);
1126 memcpy(txb + ETH_HLEN, p, s);
1127
1128 s += ETH_HLEN;
1129 s &= DSIZE;
1130
1131 if (sis900_debug > 1)
1132 printf("sis900_transmit: sending %d bytes ethtype %hX\n", (int) s, t);
1133
1134 /* pad to minimum packet size */
1135 while (s < ETH_ZLEN)
1136 txb[s++] = '\0';
1137
1138 /* set the transmit buffer descriptor and enable Transmit State Machine */
1139 txd.bufptr = virt_to_bus(&txb[0]);
1140 txd.cmdsts = (u32) OWN | s;
1141
1142 /* restart the transmitter */
1143 outl(TxENA | inl(ioaddr + cr), ioaddr + cr);
1144
1145 if (sis900_debug > 1)
1146 printf("sis900_transmit: Queued Tx packet size %d.\n", (int) s);
1147
1148 to = currticks() + TX_TIMEOUT;
1149
1150 while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
1151 /* wait */ ;
1152
1153 if (currticks() >= to) {
1154 printf("sis900_transmit: TX Timeout! Tx status %X.\n",
1155 (unsigned int) tx_status);
1156 }
1157
1158 if (tx_status & (ABORT | UNDERRUN | OWCOLL)) {
1159 /* packet unsuccessfully transmited */
1160 printf("sis900_transmit: Transmit error, Tx status %X.\n",
1161 (unsigned int) tx_status);
1162 }
1163 /* Disable interrupts by clearing the interrupt mask. */
1164 outl(0, ioaddr + imr);
1165}
#define TX_TIMEOUT
Definition amd8111e.c:57
#define txb
Definition davicom.c:145
#define txd
Definition davicom.c:144
#define ETH_ZLEN
Definition if_ether.h:11
#define ETH_ALEN
Definition if_ether.h:9
#define ETH_HLEN
Definition if_ether.h:10
#define htons(value)
Definition byteswap.h:136
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
void * memcpy(void *dest, const void *src, size_t len) __nonnull
@ ABORT
Definition sis190.h:210
@ imr
Definition sis900.h:27
@ txdp
Definition sis900.h:30
@ DSIZE
Definition sis900.h:209
@ OWN
Definition sis900.h:203
@ TxDIS
Definition sis900.h:52
@ TxENA
Definition sis900.h:53
@ UNDERRUN
Definition sis900.h:215
@ OWCOLL
Definition sis900.h:219
unsigned long currticks(void)
Get current system time in ticks.
Definition timer.c:43

References ABORT, cr, currticks(), 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()

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

Definition at line 1183 of file sis900.c.

1184{
1185 u32 rx_status = rxd[cur_rx].cmdsts;
1186 int retstat = 0;
1187
1188 /* acknowledge interrupts by reading interrupt status register */
1189 inl(ioaddr + isr);
1190
1191 if (sis900_debug > 2)
1192 printf("sis900_poll: cur_rx:%d, status:%X\n", cur_rx,
1193 (unsigned int) rx_status);
1194
1195 if (!(rx_status & OWN))
1196 return retstat;
1197
1198 if (sis900_debug > 1)
1199 printf("sis900_poll: got a packet: cur_rx:%d, status:%X\n",
1200 cur_rx, (unsigned int) rx_status);
1201
1202 if ( ! retrieve ) return 1;
1203
1204 nic->packetlen = (rx_status & DSIZE) - CRC_SIZE;
1205
1206 if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) {
1207 /* corrupted packet received */
1208 printf("sis900_poll: Corrupted packet received, buffer status = %X\n",
1209 (unsigned int) rx_status);
1210 retstat = 0;
1211 } else {
1212 /* give packet to higher level routine */
1214 retstat = 1;
1215 }
1216
1217 /* return the descriptor and buffer to receive ring */
1218 rxd[cur_rx].cmdsts = RX_BUF_SIZE;
1220
1221 if (++cur_rx == NUM_RX_DESC)
1222 cur_rx = 0;
1223
1224 /* re-enable the potentially idle receive state machine */
1225 outl(RxENA | inl(ioaddr + cr), ioaddr + cr);
1226
1227 return retstat;
1228
1229}
#define RX_BUF_SIZE
Definition 3c90x.h:269
#define rxb
Definition davicom.c:147
#define rxd
Definition davicom.c:146
static unsigned int cur_rx
Definition epic100.c:84
#define NUM_RX_DESC
Definition igbvf.h:281
@ TOOLONG
Definition sis900.h:230
@ OVERRUN
Definition sis900.h:225
@ RUNT
Definition sis900.h:231
@ CRCERR
Definition sis900.h:233
@ FAERR
Definition sis900.h:234
@ RXISERR
Definition sis900.h:232
@ isr
Definition sis900.h:26
#define CRC_SIZE
Definition sis900.h:360
unsigned char * packet
Definition nic.h:53
unsigned int packetlen
Definition nic.h:54

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, u32, and virt_to_bus().

◆ sis900_disable() [1/2]

void sis900_disable ( struct nic * nic,
void * hwdev )
static

Referenced by DRIVER().

◆ sis900_irq() [1/2]

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

◆ sis900_get_mac_addr()

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 181 of file sis900.c.

182{
184 int i;
185
186 /* check to see if we have sane EEPROM */
188 if (signature == 0xffff || signature == 0x0000) {
189 printf ("sis900_probe: Error EERPOM read %hX\n", signature);
190 return 0;
191 }
192
193 /* get MAC address from EEPROM */
194 for (i = 0; i < 3; i++)
196 return 1;
197}
u8 signature
CPU signature.
Definition CIB_PRM.h:7
@ EEPROMMACAddr
Definition sis190.h:241
@ EEPROMSignature
Definition sis190.h:238
static u16 sis900_read_eeprom(int location)
Definition sis900.c:464

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

Referenced by sis900_probe().

◆ sis96x_get_mac_addr()

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 215 of file sis900.c.

216{
217/* long ioaddr = net_dev->base_addr; */
218 long ee_addr = ioaddr + mear;
219 u32 waittime = 0;
220 int i;
221
222 printf("Alternate function\n");
223
224 outl(EEREQ, ee_addr);
225 while(waittime < 2000) {
226 if(inl(ee_addr) & EEGNT) {
227
228 /* get MAC address from EEPROM */
229 for (i = 0; i < 3; i++)
231
232 outl(EEDONE, ee_addr);
233 return 1;
234 } else {
235 udelay(1);
236 waittime ++;
237 }
238 }
239 outl(EEDONE, ee_addr);
240 return 0;
241}
@ EEREQ
Definition sis190.h:231
@ EEGNT
Definition sis900.h:190
@ EEDONE
Definition sis900.h:190
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61

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

Referenced by sis900_probe().

◆ sis630e_get_mac_addr()

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 253 of file sis900.c.

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

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

Referenced by sis900_probe().

◆ sis635_get_mac_addr()

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 296 of file sis900.c.

297{
298 u32 rfcrSave;
299 u32 i;
300
301
302 rfcrSave = inl(rfcr + ioaddr);
303
304 outl(rfcrSave | RELOAD, ioaddr + cr);
305 outl(0, ioaddr + cr);
306
307 /* disable packet filtering before setting filter */
308 outl(rfcrSave & ~RFEN, rfcr + ioaddr);
309
310 /* load MAC addr to filter data register */
311 for (i = 0 ; i < 3 ; i++) {
312 outl((i << RFADDR_shift), ioaddr + rfcr);
313 *( ((u16 *)nic->node_addr) + i) = inw(ioaddr + rfdr);
314 }
315
316 /* enable packet filitering */
317 outl(rfcrSave | RFEN, rfcr + ioaddr);
318
319 return 1;
320}
#define inw(io_addr)
Definition io.h:292
@ RELOAD
Definition sis900.h:44

References __unused, cr, inl, inw, ioaddr, nic::node_addr, outl, RELOAD, RFADDR_shift, rfcr, rfdr, RFEN, u16, and u32.

Referenced by sis900_probe().

◆ sis900_reset() [2/2]

void sis900_reset ( struct nic *nic __unused)
static

Definition at line 648 of file sis900.c.

649{
650 int i = 0;
652
653 outl(0, ioaddr + ier);
654 outl(0, ioaddr + imr);
655 outl(0, ioaddr + rfcr);
656
658
659 /* Check that the chip has finished the reset. */
660 while (status && (i++ < 1000)) {
661 status ^= (inl(isr + ioaddr) & status);
662 }
663
666 else
667 outl(PESEL, ioaddr + cfg);
668}
uint8_t status
Status.
Definition ena.h:5
@ PESEL
Definition sis900.h:62
@ RND_CNT
Definition sis900.h:65
@ ier
Definition sis900.h:28
@ SIS900B_900_REV
Definition sis900.h:342
@ SIS635A_900_REV
Definition sis900.h:341
@ TxRCMP
Definition sis900.h:84
@ RxRCMP
Definition sis900.h:85
@ RESET
Definition sis900.h:46
@ TxRESET
Definition sis900.h:49
@ RxRESET
Definition sis900.h:48

References __unused, 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, TxRESET, and u32.

◆ sis900_init_txd() [2/2]

void sis900_init_txd ( struct nic *nic __unused)
static

Definition at line 720 of file sis900.c.

721{
722 txd.link = (u32) 0;
723 txd.cmdsts = (u32) 0;
724 txd.bufptr = virt_to_bus(&txb[0]);
725
726 /* load Transmit Descriptor Register */
728 if (sis900_debug > 0)
729 printf("sis900_init_txd: TX descriptor register loaded with: %X\n",
730 inl(ioaddr + txdp));
731}

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

◆ sis900_init_rxd() [2/2]

void sis900_init_rxd ( struct nic *nic __unused)
static

Definition at line 744 of file sis900.c.

745{
746 int i;
747
748 cur_rx = 0;
749
750 /* init RX descriptor */
751 for (i = 0; i < NUM_RX_DESC; i++) {
752 rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]);
753 rxd[i].cmdsts = (u32) RX_BUF_SIZE;
754 rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]);
755 if (sis900_debug > 0)
756 printf("sis900_init_rxd: rxd[%d]=%p link=%X cmdsts=%X bufptr=%X\n",
757 i, &rxd[i], (unsigned int) rxd[i].link, (unsigned int) rxd[i].cmdsts,
758 (unsigned int) rxd[i].bufptr);
759 }
760
761 /* load Receive Descriptor Register */
762 outl(virt_to_bus(&rxd[0]), ioaddr + rxdp);
763
764 if (sis900_debug > 0)
765 printf("sis900_init_rxd: RX descriptor register loaded with: %X\n",
766 inl(ioaddr + rxdp));
767
768}
u32 link
Link to next descriptor.
Definition ar9003_mac.h:1
uint32_t bufptr
Buffer pointer.
Definition natsemi.h:5
uint32_t cmdsts
Command / status.
Definition natsemi.h:3
@ rxdp
Definition sis900.h:32

References __unused, 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]

void sis900_set_rx_mode ( struct nic *nic __unused)
static

Definition at line 782 of file sis900.c.

783{
784 int i, table_entries;
785 u32 rx_mode;
786 u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */
787
789 table_entries = 16;
790 else
791 table_entries = 8;
792
793 /* accept all multicast packet */
794 rx_mode = RFAAB | RFAAM;
795 for (i = 0; i < table_entries; i++)
796 mc_filter[i] = 0xffff;
797
798 /* update Multicast Hash Table in Receive Filter */
799 for (i = 0; i < table_entries; i++) {
800 /* why plus 0x04? That makes the correct value for hash table. */
801 outl((u32)(0x00000004+i) << RFADDR_shift, ioaddr + rfcr);
802 outl(mc_filter[i], ioaddr + rfdr);
803 }
804
805 /* Accept Broadcast and multicast packets, destination addresses that match
806 our MAC address */
807 outl(RFEN | rx_mode, ioaddr + rfcr);
808
809 return;
810}
@ RFAAB
Definition sis900.h:157
@ RFAAM
Definition sis900.h:158

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

◆ sis900_read_mode() [2/2]

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

Definition at line 870 of file sis900.c.

871{
872 int i = 0;
873 u32 status;
874 u16 phy_id0, phy_id1;
875
876 /* STSOUT register is Latched on Transition, read operation updates it */
877 do {
879 } while (i++ < 2);
880
881 *speed = HW_SPEED_10_MBPS;
883
885 *speed = HW_SPEED_100_MBPS;
888
889 /* Workaround for Realtek RTL8201 PHY issue */
890 phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
891 phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
892 if((phy_id0 == 0x0000) && ((phy_id1 & 0xFFF0) == 0x8200)){
895 if(sis900_mdio_read(phy_addr, 0x0019) & 0x01)
896 *speed = HW_SPEED_100_MBPS;
897 }
898
900 printf("sis900_read_mode: Media Link Off\n");
901 else
902 printf("sis900_read_mode: Media Link On %s %s-duplex \n",
903 *speed == HW_SPEED_100_MBPS ?
904 "100mbps" : "10mbps",
906 "full" : "half");
907}
@ MII_CONTROL
Definition sis900.h:241
@ MII_NWAY_TX_FDX
Definition sis900.h:312
@ MII_NWAY_TX
Definition sis900.h:311
@ MII_NWAY_T_FDX
Definition sis900.h:310
#define HW_SPEED_100_MBPS
Definition sis900.h:357
@ MII_STSOUT
Definition sis900.h:254
@ MII_STSOUT_LINK_FAIL
Definition sis900.h:321
@ MII_CNTL_FDX
Definition sis900.h:274
#define FDX_CAPABLE_HALF_SELECTED
Definition sis900.h:351

References __unused, 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(), status, u16, and u32.

◆ amd79c901_read_mode() [2/2]

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

Definition at line 921 of file sis900.c.

922{
923 int i;
924 u16 status;
925
926 for (i = 0; i < 2; i++)
928
930 /* 10BASE-T PHY */
931 for (i = 0; i < 2; i++)
934 *speed = HW_SPEED_100_MBPS;
935 else
936 *speed = HW_SPEED_10_MBPS;
939 else
941
943 printf("amd79c901_read_mode: Media Link On %s %s-duplex \n",
944 *speed == HW_SPEED_100_MBPS ?
945 "100mbps" : "10mbps",
947 "full" : "half");
948 else
949 printf("amd79c901_read_mode: Media Link Off\n");
950 }
951 else {
952 /* HomePNA */
953 *speed = HW_SPEED_HOME;
955 if (status & MII_STAT_LINK)
956 printf("amd79c901_read_mode:Media Link On 1mbps half-duplex \n");
957 else
958 printf("amd79c901_read_mode: Media Link Off\n");
959 }
960}
@ MII_STSSUM_SPD
Definition sis900.h:335
@ MII_STSSUM_LINK
Definition sis900.h:332
@ MII_STSSUM_DPLX
Definition sis900.h:333
@ MII_STAT_CAN_AUTO
Definition sis900.h:289
@ MII_STAT_LINK
Definition sis900.h:288
@ MII_STATUS_SUMMARY
Definition sis900.h:261

References __unused, 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(), status, and u16.

◆ ics1893_read_mode() [2/2]

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 974 of file sis900.c.

975{
976 int i = 0;
977 u32 status;
978
979 /* MII_QPDSTS is Latched, read twice in succession will reflect the current state */
980 for (i = 0; i < 2; i++)
982
984 *speed = HW_SPEED_100_MBPS;
985 else
986 *speed = HW_SPEED_10_MBPS;
987
990 else
992
994 printf("ics1893_read_mode: Media Link On %s %s-duplex \n",
995 *speed == HW_SPEED_100_MBPS ?
996 "100mbps" : "10mbps",
998 "full" : "half");
999 else
1000 printf("ics1893_read_mode: Media Link Off\n");
1001}
@ MII_STSICS_DPLX
Definition sis900.h:327
@ MII_STSICS_SPD
Definition sis900.h:327
@ MII_STSICS_LINKSTS
Definition sis900.h:328
@ MII_QPDSTS
Definition sis900.h:266

References __unused, 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(), status, and u32.

◆ rtl8201_read_mode() [2/2]

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 1014 of file sis900.c.

1015{
1016 u32 status;
1017
1018 status = sis900_mdio_read(phy_addr, MII_STATUS);
1019
1021 *speed = HW_SPEED_100_MBPS;
1023 }
1024 else if (status & MII_STAT_CAN_TX) {
1025 *speed = HW_SPEED_100_MBPS;
1027 }
1028 else if (status & MII_STAT_CAN_T_FDX) {
1029 *speed = HW_SPEED_10_MBPS;
1031 }
1032 else if (status & MII_STAT_CAN_T) {
1033 *speed = HW_SPEED_10_MBPS;
1035 }
1036
1037 if (status & MII_STAT_LINK)
1038 printf("rtl8201_read_mode: Media Link On %s %s-duplex \n",
1039 *speed == HW_SPEED_100_MBPS ?
1040 "100mbps" : "10mbps",
1042 "full" : "half");
1043 else
1044 printf("rtl8201_read_config_mode: Media Link Off\n");
1045}
@ MII_STAT_CAN_T
Definition sis900.h:292
@ MII_STAT_CAN_TX
Definition sis900.h:294
@ MII_STAT_CAN_TX_FDX
Definition sis900.h:295
@ MII_STAT_CAN_T_FDX
Definition sis900.h:293

References __unused, 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(), status, and u32.

◆ vt6103_read_mode() [2/2]

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 1058 of file sis900.c.

1059{
1060 u32 status;
1061
1062 status = sis900_mdio_read(phy_addr, MII_STATUS);
1063
1065 *speed = HW_SPEED_100_MBPS;
1067 }
1068 else if (status & MII_STAT_CAN_TX) {
1069 *speed = HW_SPEED_100_MBPS;
1071 }
1072 else if (status & MII_STAT_CAN_T_FDX) {
1073 *speed = HW_SPEED_10_MBPS;
1075 }
1076 else if (status & MII_STAT_CAN_T) {
1077 *speed = HW_SPEED_10_MBPS;
1079 }
1080
1081 if (status & MII_STAT_LINK)
1082 printf("vt6103_read_mode: Media Link On %s %s-duplex \n",
1083 *speed == HW_SPEED_100_MBPS ?
1084 "100mbps" : "10mbps",
1086 "full" : "half");
1087 else
1088 printf("vt6103_read_config_mode: Media Link Off\n");
1089}

References __unused, 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(), status, and u32.

◆ sis900_disable() [2/2]

void sis900_disable ( struct nic * nic,
void *hwdev __unused )
static

Definition at line 1242 of file sis900.c.

1242 {
1243
1245
1246 /* Disable interrupts by clearing the interrupt mask. */
1247 outl(0, ioaddr + imr);
1248 outl(0, ioaddr + ier);
1249
1250 /* Stop the chip's Tx and Rx Status Machine */
1251 outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr);
1252}
@ RxDIS
Definition sis900.h:50

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

◆ sis900_irq() [2/2]

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

Definition at line 1266 of file sis900.c.

1267{
1268 switch ( action ) {
1269 case DISABLE :
1270 outl(0, ioaddr + imr);
1271 break;
1272 case ENABLE :
1274 break;
1275 case FORCE :
1276 break;
1277 }
1278}
@ FORCE
Definition nic.h:37
@ ENABLE
Definition nic.h:36
@ DISABLE
Definition nic.h:35
@ RxORN
Definition sis900.h:99
@ RxOK
Definition sis900.h:104
@ RxERR
Definition sis900.h:102
@ TxURN
Definition sis900.h:94
@ TxIDLE
Definition sis900.h:95
@ RxSOVR
Definition sis900.h:90
@ TxERR
Definition sis900.h:96

References __unused, 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  )

References sis900_nics.

◆ DRIVER()

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

Variable Documentation

◆ sis900_operations

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:175
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:1104
static int sis900_poll(struct nic *nic, int retrieve)
Definition sis900.c:1183

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.

◆ dev_id

unsigned short dev_id
static

Definition at line 60 of file sis900.c.

◆ ioaddr

unsigned long ioaddr
static

Definition at line 61 of file sis900.c.

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

◆ 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)

◆ mii

◆ 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:308

Definition at line 1287 of file sis900.c.

1287 {
1288PCI_ROM(0x1039, 0x0900, "sis900", "SIS900", 0),
1289PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016", 0),
1290};

Referenced by PCI_DRIVER().