// SPDX-License-Identifier: GPL-2.0-or-later /****************************************************************************** * * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * * See the file "skfddi.c" for further information. * * The information in this file is provided "AS IS" without warranty. *
******************************************************************************/
/* * FBI board dependent Driver for SMT and LLC
*/
#define LED_Y_ON 0x11 /* Used for ring up/down indication */ #define LED_Y_OFF 0x10
#define MS2BCLK(x) ((x)*12500L)
/* * valid configuration values are:
*/
/* * xPOS_ID:xxxx * | \ / * | \/ * | --------------------- the patched POS_ID of the Adapter * | xxxx = (Vendor ID low byte, * | Vendor ID high byte, * | Device ID low byte, * | Device ID high byte) * +------------------------------ the patched oem_id must be * 'S' for SK or 'I' for IBM * this is a short id for the driver.
*/ #ifndef MULT_OEM #ifndef OEM_CONCEPT const u_char oem_id[] = "xPOS_ID:xxxx" ; #else/* OEM_CONCEPT */ const u_char oem_id[] = OEM_ID ; #endif/* OEM_CONCEPT */ #define ID_BYTE0 8 #define OEMID(smc,i) oem_id[ID_BYTE0 + i] #else/* MULT_OEM */ conststruct s_oem_ids oem_ids[] = { #include"oemids.h"
{0}
}; #define OEMID(smc,i) smc->hw.oem_id->oi_id[i] #endif/* MULT_OEM */
#ifdef PCI /* * make sure no transfer activity is pending
*/
outpw(FM_A(FM_MDREG1),FM_MINIT) ;
outp(ADDR(B0_CTRL), CTRL_HPI_SET) ;
hwt_wait_time(smc,hwt_quick_read(smc),MS2BCLK(10)) ; /* * now reset everything
*/
outp(ADDR(B0_CTRL),CTRL_RST_SET) ; /* reset for all chips */
i = (int) inp(ADDR(B0_CTRL)) ; /* do dummy read */
SK_UNUSED(i) ; /* Make LINT happy. */
outp(ADDR(B0_CTRL), CTRL_RST_CLR) ;
/* * Reset all bits in the PCI STATUS register
*/
outp(ADDR(B0_TST_CTRL), TST_CFG_WRITE_ON) ; /* enable for writes */
word = inpw(PCI_C(PCI_STATUS)) ;
outpw(PCI_C(PCI_STATUS), word | PCI_STATUS_ERROR_BITS);
outp(ADDR(B0_TST_CTRL), TST_CFG_WRITE_OFF) ; /* disable writes */
/* * Release the reset of all the State machines * Release Master_Reset * Release HPI_SM_Reset
*/
outp(ADDR(B0_CTRL), CTRL_MRST_CLR|CTRL_HPI_CLR) ;
/* * determine the adapter type * Note: Do it here, because some drivers may call card_start() once * at very first before any other initialization functions is * executed.
*/
rev_id = inp(PCI_C(PCI_REVISION_ID)) ; if ((rev_id & 0xf0) == SK_ML_ID_1 || (rev_id & 0xf0) == SK_ML_ID_2) {
smc->hw.hw_is_64bit = TRUE ;
} else {
smc->hw.hw_is_64bit = FALSE ;
}
/* * return S-port (PA or PB)
*/ int pcm_get_s_port(struct s_smc *smc)
{
SK_UNUSED(smc) ; return PS;
}
/* * Station Label = "FDDI-XYZ" where * * X = connector type * Y = PMD type * Z = port type
*/ #define STATION_LABEL_CONNECTOR_OFFSET 5 #define STATION_LABEL_PMD_OFFSET 6 #define STATION_LABEL_PORT_OFFSET 7
void read_address(struct s_smc *smc, u_char *mac_addr)
{ char ConnectorType ; char PmdType ; int i ;
#ifdef PCI for (i = 0; i < 6; i++) { /* read mac address from board */
smc->hw.fddi_phys_addr.a[i] =
bitrev8(inp(ADDR(B2_MAC_0+i)));
} #endif
void plc_clear_irq(struct s_smc *smc, int p)
{
SK_UNUSED(p) ;
SK_UNUSED(smc) ;
}
/* * led_indication called by rmt_indication() and * pcm_state_change() * * Input: * smc: SMT context * led_event: * 0 Only switch green LEDs according to their respective PCM state * LED_Y_OFF just switch yellow LED off * LED_Y_ON just switch yello LED on
*/ staticvoid led_indication(struct s_smc *smc, int led_event)
{ /* use smc->hw.mac_ring_is_up == TRUE * as indication for Ring Operational
*/
u_short led_state ; struct s_phy *phy ; struct fddi_mib_p *mib_a ; struct fddi_mib_p *mib_b ;
/* Ring up = yellow led OFF*/ if (led_event == LED_Y_ON) {
led_state |= LED_MY_ON ;
} elseif (led_event == LED_Y_OFF) {
led_state |= LED_MY_OFF ;
} else { /* PCM state changed */ /* Link at Port A/S = green led A ON */ if (mib_a->fddiPORTPCMState == PC8_ACTIVE) {
led_state |= LED_GA_ON ;
} else {
led_state |= LED_GA_OFF ;
}
/* Link at Port B = green led B ON */ if (mib_b->fddiPORTPCMState == PC8_ACTIVE) {
led_state |= LED_GB_ON ;
} else {
led_state |= LED_GB_OFF ;
}
}
outp(ADDR(B0_LED), led_state) ; #endif/* PCI */
}
void pcm_state_change(struct s_smc *smc, int plc, int p_state)
{ /* * the current implementation of pcm_state_change() in the driver * parts must be renamed to drv_pcm_state_change() which will be called * now after led_indication.
*/
DRV_PCM_STATE_CHANGE(smc,plc,p_state) ;
led_indication(smc,0) ;
}
void rmt_indication(struct s_smc *smc, int i)
{ /* Call a driver special function if defined */
DRV_RMT_INDICATION(smc,i) ;
led_indication(smc, i ? LED_Y_OFF : LED_Y_ON) ;
}
/* * llc_recover_tx called by init_tx (fplus.c)
*/ void llc_recover_tx(struct s_smc *smc)
{ #ifdef LOAD_GEN externint load_gen_flag ;
#ifdef MULT_OEM staticint is_equal_num(char comp1[], char comp2[], int num)
{ int i ;
for (i = 0 ; i < num ; i++) { if (comp1[i] != comp2[i]) return 0;
} return 1;
} /* is_equal_num */
/* * set the OEM ID defaults, and test the contents of the OEM data base * The default OEM is the first ACTIVE entry in the OEM data base * * returns: 0 success * 1 error in data base * 2 data base empty * 3 no active entry
*/ int set_oi_id_def(struct s_smc *smc)
{ int sel_id ; int i ; int act_entries ;
/* check OEM data base */ while (oem_ids[i].oi_status) { switch (oem_ids[i].oi_status) { case OI_STAT_ACTIVE:
act_entries = TRUE ; /* we have active IDs */ if (sel_id == -1)
sel_id = i ; /* save the first active ID */ case OI_STAT_VALID: case OI_STAT_PRESENT:
i++ ; break ; /* entry ok */ default: return 1; /* invalid oi_status */
}
}
if (i == 0) return 2; if (!act_entries) return 3;
/* ok, we have a valid OEM data base with an active entry */
smc->hw.oem_id = (struct s_oem_ids *) &oem_ids[sel_id] ; return 0;
} #endif/* MULT_OEM */
void driver_get_bia(struct s_smc *smc, struct fddi_addr *bia_addr)
{ int i ;
for (i = 0 ; i < 6 ; i++)
bia_addr->a[i] = bitrev8(smc->hw.fddi_phys_addr.a[i]);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.