Move the RTL8029 register definitions to <dev/ic/rtl80x9reg.h>, and add

the registers/bits present in the RTL8019 (ISA version).
This commit is contained in:
thorpej 1998-10-31 00:27:41 +00:00
parent de14bf4f80
commit 992f2906ba
2 changed files with 80 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ne_pcireg.h,v 1.1 1998/10/27 22:30:56 thorpej Exp $ */
/* $NetBSD: rtl80x9reg.h,v 1.1 1998/10/31 00:27:43 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -38,21 +38,26 @@
*/
/*
* Register description for NE2000-compatible PCI Ethernet interfaces.
*/
/*
* Registers on RealTek 8029 NE2000-compatible network interfaces.
* Registers on RealTek 8019 and 8029 NE2000-compatible network interfaces.
*
* Data sheets for this chip can be found at:
* Data sheets for these chips can be found at:
*
* http://www.realtek.com.tw
*/
/*
* Page 0 register offsets.
*/
#define NERTL_RTL0_8019ID0 0x0a /* 8019 ID Register 0 */
#define RTL0_8019ID0 'P'
#define NERTL_RTL0_8019ID1 0x0b /* 8019 ID Register 1 */
#define RTL0_8019ID1 'p'
/*
* Page 3 register offsets.
*/
#define NEPCI_RTL3_EECR 0x01 /* EEPROM Command Register */
#define NERTL_RTL3_EECR 0x01 /* EEPROM Command Register */
#define RTL3_EECR_EEM1 0x80 /* EEPROM Operating Mode */
#define RTL3_EECR_EEM0 0x40
/* 0 0 Normal operation */
@ -64,26 +69,70 @@
#define RTL3_EECR_EEDI 0x02 /* EEPROM Data In */
#define RTL3_EECR_EEDO 0x01 /* EEPROM Data Out */
#define NEPCI_RTL3_CONFIG0 0x03 /* Configuration 0 (ro) */
#define NERTL_RTL3_BPAGE 0x02 /* BROM Page Regiseter (8019) */
#define NERTL_RTL3_CONFIG0 0x03 /* Configuration 0 (ro) */
#define RTL3_CONFIG0_JP 0x08 /* jumper mode (8019) */
#define RTL3_CONFIG0_BNC 0x04 /* BNC is active */
#define NEPCI_RTL3_CONFIG2 0x05 /* Configuration 2 */
#define NERTL_RTL3_CONFIG1 0x04 /* Configuration 1 (8019) */
#define RTL3_CONFIG1_IRQEN 0x80 /* IRQ Enable */
#define RTL3_CONFIG1_IRQS2 0x40 /* IRQ Select */
#define RTL3_CONFIG1_IRQS1 0x20
#define RTL3_CONFIG1_IRQS0 0x10
/* 0 0 0 int 0 irq 2/9 */
/* 0 0 1 int 1 irq 3 */
/* 0 1 0 int 2 irq 4 */
/* 0 1 1 int 3 irq 5 */
/* 1 0 0 int 4 irq 10 */
/* 1 0 1 int 5 irq 11 */
/* 1 1 0 int 6 irq 12 */
/* 1 1 1 int 7 irq 15 */
#define RTL_CONFIG1_IOS3 0x08 /* I/O base Select */
#define RTL_CONFIG1_IOS2 0x04
#define RTL_CONFIG1_IOS1 0x02
#define RTL_CONFIG1_IOS0 0x01
/* 0 0 0 0 0x300 */
/* 0 0 0 1 0x320 */
/* 0 0 1 0 0x340 */
/* 0 0 1 1 0x360 */
/* 0 1 0 0 0x380 */
/* 0 1 0 1 0x3a0 */
/* 0 1 1 0 0x3c0 */
/* 0 1 1 1 0x3e0 */
/* 1 0 0 0 0x200 */
/* 1 0 0 1 0x220 */
/* 1 0 1 0 0x240 */
/* 1 0 1 1 0x260 */
/* 1 1 0 0 0x280 */
/* 1 1 0 1 0x2a0 */
/* 1 1 1 0 0x2c0 */
/* 1 1 1 1 0x2e0 */
#define NERTL_RTL3_CONFIG2 0x05 /* Configuration 2 */
#define RTL3_CONFIG2_PL1 0x80 /* Network media type */
#define RTL3_CONFIG2_PL0 0x40
/* 0 0 TP/CX auto-detect */
/* 0 1 10baseT */
/* 1 0 10base5 */
/* 1 1 10base2 */
#define RTL3_CONFIG2_FCE 0x20 /* Flow Control Enable */
#define RTL3_CONFIG2_PF 0x10 /* Pause Flag */
#define RTL3_CONFIG2_BS1 0x02 /* Boot Rom Size */
#define RTL3_CONFIG2_BS0 0x01
#define RTL3_CONFIG2_8029FCE 0x20 /* Flow Control Enable */
#define RTL3_CONFIG2_8029PF 0x10 /* Pause Flag */
#define RTL3_CONFIG2_8029BS1 0x02 /* Boot Rom Size */
#define RTL3_CONFIG2_8029BS0 0x01
/* 0 0 No Boot Rom */
/* 0 1 8k */
/* 1 0 16k */
/* 1 1 32k */
#define RTL3_CONFIG2_8019BSELB 0x20 /* BROM disable */
#define RTL3_CONFIG2_8019BS4 0x10 /* BROM size/base */
#define RTL3_CONFIG2_8019BS3 0x08
#define RTL3_CONFIG2_8019BS2 0x04
#define RTL3_CONFIG2_8019BS1 0x02
#define RTL3_CONFIG2_8019BS0 0x01
#define NEPCI_RTL3_CONFIG3 0x06 /* Configuration 3 */
#define NERTL_RTL3_CONFIG3 0x06 /* Configuration 3 */
#define RTL3_CONFIG3_8019PNP 0x80 /* PnP Mode */
#define RTL3_CONFIG3_FUDUP 0x40 /* Full Duplex */
#define RTL3_CONFIG3_LEDS1 0x20 /* LED1/2 pin configuration */
/* 0 LED1 == LED_RX, LED2 == LED_TX */
@ -93,11 +142,16 @@
/* 1 LED0 pin == LED_LINK */
#define RTL3_CONFIG3_SLEEP 0x04 /* Sleep mode */
#define RTL3_CONFIG3_PWRDN 0x02 /* Power Down */
#define RTL3_CONFIG3_8019ACTIVEB 0x01 /* inverse of bit 0 in PnP Act Reg */
#define NEPCI_RTL3_HLTCLK 0x09 /* Halt Clock */
#define NERTL_RTL3_CSNSAV 0x08 /* CSN Save Register (8019) */
#define NERTL_RTL3_HLTCLK 0x09 /* Halt Clock */
#define RTL3_HLTCLK_RUNNING 'R' /* clock runs in power down */
#define RTL3_HLTCLK_HALTED 'H' /* clock halted in power down */
#define NEPCI_RTL3_ID0 0x0e /* ID register 0 */
#define NERTL_RTL3_INTR 0x0b /* ISA bus states of INT7-0 (8019) */
#define NEPCI_RTL3_ID1 0x0f /* ID register 1 */
#define NERTL_RTL3_8029ID0 0x0e /* ID register 0 */
#define NERTL_RTL3_8029ID1 0x0f /* ID register 1 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ne_pci.c,v 1.11 1998/10/28 00:15:54 thorpej Exp $ */
/* $NetBSD: if_ne_pci.c,v 1.12 1998/10/31 00:27:41 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
#include <dev/ic/ne2000reg.h>
#include <dev/ic/ne2000var.h>
#include <dev/pci/if_ne_pcireg.h>
#include <dev/ic/rtl80x9reg.h>
struct ne_pci_softc {
struct ne2000_softc sc_ne2000; /* real "ne2000" softc */
@ -318,12 +318,12 @@ ne_pci_rtl8029_mediastatus(sc, ifmr)
/* Set NIC to page 3 registers. */
NIC_PUT(sc->sc_regt, sc->sc_regh, ED_P0_CR, cr_proto | ED_CR_PAGE_3);
if (NIC_GET(sc->sc_regt, sc->sc_regh, NEPCI_RTL3_CONFIG0) &
if (NIC_GET(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG0) &
RTL3_CONFIG0_BNC)
ifmr->ifm_active = IFM_ETHER|IFM_10_2;
else {
ifmr->ifm_active = IFM_ETHER|IFM_10_T;
if (NIC_GET(sc->sc_regt, sc->sc_regh, NEPCI_RTL3_CONFIG3) &
if (NIC_GET(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG3) &
RTL3_CONFIG3_FUDUP)
ifmr->ifm_active |= IFM_FDX;
}
@ -346,7 +346,7 @@ ne_pci_rtl8029_init_card(sc)
NIC_PUT(sc->sc_regt, sc->sc_regh, ED_P0_CR, cr_proto | ED_CR_PAGE_3);
/* First, set basic media type. */
reg = NIC_GET(sc->sc_regt, sc->sc_regh, NEPCI_RTL3_CONFIG2);
reg = NIC_GET(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG2);
reg &= ~(RTL3_CONFIG2_PL1|RTL3_CONFIG2_PL0);
switch (IFM_SUBTYPE(ifm->ifm_cur->ifm_media)) {
case IFM_AUTO:
@ -361,15 +361,15 @@ ne_pci_rtl8029_init_card(sc)
reg |= RTL3_CONFIG2_PL1|RTL3_CONFIG2_PL0;
break;
}
NIC_PUT(sc->sc_regt, sc->sc_regh, NEPCI_RTL3_CONFIG2, reg);
NIC_PUT(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG2, reg);
/* Now, set duplex mode. */
reg = NIC_GET(sc->sc_regt, sc->sc_regh, NEPCI_RTL3_CONFIG3);
reg = NIC_GET(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG3);
if (ifm->ifm_cur->ifm_media & IFM_FDX)
reg |= RTL3_CONFIG3_FUDUP;
else
reg &= ~RTL3_CONFIG3_FUDUP;
NIC_PUT(sc->sc_regt, sc->sc_regh, NEPCI_RTL3_CONFIG3, reg);
NIC_PUT(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG3, reg);
/* Set NIC to page 0 registers. */
NIC_PUT(sc->sc_regt, sc->sc_regh, ED_P0_CR, cr_proto | ED_CR_PAGE_0);