drvfbi.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311
  1. /******************************************************************************
  2. *
  3. * (C)Copyright 1998,1999 SysKonnect,
  4. * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
  5. *
  6. * See the file "skfddi.c" for further information.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * The information in this file is provided "AS IS" without warranty.
  14. *
  15. ******************************************************************************/
  16. /*
  17. * FBI board dependent Driver for SMT and LLC
  18. */
  19. #include "h/types.h"
  20. #include "h/fddi.h"
  21. #include "h/smc.h"
  22. #include "h/supern_2.h"
  23. #include "h/skfbiinc.h"
  24. #include <linux/bitrev.h>
  25. #ifndef lint
  26. static const char ID_sccs[] = "@(#)drvfbi.c 1.63 99/02/11 (C) SK " ;
  27. #endif
  28. /*
  29. * PCM active state
  30. */
  31. #define PC8_ACTIVE 8
  32. #define LED_Y_ON 0x11 /* Used for ring up/down indication */
  33. #define LED_Y_OFF 0x10
  34. #define MS2BCLK(x) ((x)*12500L)
  35. /*
  36. * valid configuration values are:
  37. */
  38. #ifdef ISA
  39. const int opt_ints[] = {8, 3, 4, 5, 9, 10, 11, 12, 15} ;
  40. const int opt_iops[] = {8,
  41. 0x100, 0x120, 0x180, 0x1a0, 0x220, 0x240, 0x320, 0x340};
  42. const int opt_dmas[] = {4, 3, 5, 6, 7} ;
  43. const int opt_eproms[] = {15, 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce,
  44. 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc} ;
  45. #endif
  46. #ifdef EISA
  47. const int opt_ints[] = {5, 9, 10, 11} ;
  48. const int opt_dmas[] = {0, 5, 6, 7} ;
  49. const int opt_eproms[] = {0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce,
  50. 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc} ;
  51. #endif
  52. #ifdef MCA
  53. int opt_ints[] = {3, 11, 10, 9} ; /* FM1 */
  54. int opt_eproms[] = {0, 0xc4, 0xc8, 0xcc, 0xd0, 0xd4, 0xd8, 0xdc} ;
  55. #endif /* MCA */
  56. /*
  57. * xPOS_ID:xxxx
  58. * | \ /
  59. * | \/
  60. * | --------------------- the patched POS_ID of the Adapter
  61. * | xxxx = (Vendor ID low byte,
  62. * | Vendor ID high byte,
  63. * | Device ID low byte,
  64. * | Device ID high byte)
  65. * +------------------------------ the patched oem_id must be
  66. * 'S' for SK or 'I' for IBM
  67. * this is a short id for the driver.
  68. */
  69. #ifndef MULT_OEM
  70. #ifndef OEM_CONCEPT
  71. #ifndef MCA
  72. const u_char oem_id[] = "xPOS_ID:xxxx" ;
  73. #else
  74. const u_char oem_id[] = "xPOSID1:xxxx" ; /* FM1 card id. */
  75. #endif
  76. #else /* OEM_CONCEPT */
  77. #ifndef MCA
  78. const u_char oem_id[] = OEM_ID ;
  79. #else
  80. const u_char oem_id[] = OEM_ID1 ; /* FM1 card id. */
  81. #endif /* MCA */
  82. #endif /* OEM_CONCEPT */
  83. #define ID_BYTE0 8
  84. #define OEMID(smc,i) oem_id[ID_BYTE0 + i]
  85. #else /* MULT_OEM */
  86. const struct s_oem_ids oem_ids[] = {
  87. #include "oemids.h"
  88. {0}
  89. };
  90. #define OEMID(smc,i) smc->hw.oem_id->oi_id[i]
  91. #endif /* MULT_OEM */
  92. /* Prototypes of external functions */
  93. #ifdef AIX
  94. extern int AIX_vpdReadByte() ;
  95. #endif
  96. /* Prototype of a local function. */
  97. static void smt_stop_watchdog(struct s_smc *smc);
  98. #ifdef MCA
  99. static int read_card_id() ;
  100. static void DisableSlotAccess() ;
  101. static void EnableSlotAccess() ;
  102. #ifdef AIX
  103. extern int attach_POS_addr() ;
  104. extern int detach_POS_addr() ;
  105. extern u_char read_POS() ;
  106. extern void write_POS() ;
  107. extern int AIX_vpdReadByte() ;
  108. #else
  109. #define read_POS(smc,a1,a2) ((u_char) inp(a1))
  110. #define write_POS(smc,a1,a2,a3) outp((a1),(a3))
  111. #endif
  112. #endif /* MCA */
  113. /*
  114. * FDDI card reset
  115. */
  116. static void card_start(struct s_smc *smc)
  117. {
  118. int i ;
  119. #ifdef PCI
  120. u_char rev_id ;
  121. u_short word;
  122. #endif
  123. smt_stop_watchdog(smc) ;
  124. #ifdef ISA
  125. outpw(CSR_A,0) ; /* reset for all chips */
  126. for (i = 10 ; i ; i--) /* delay for PLC's */
  127. (void)inpw(ISR_A) ;
  128. OUT_82c54_TIMER(3,COUNT(2) | RW_OP(3) | TMODE(2)) ;
  129. /* counter 2, mode 2 */
  130. OUT_82c54_TIMER(2,97) ; /* LSB */
  131. OUT_82c54_TIMER(2,0) ; /* MSB ( 15.6 us ) */
  132. outpw(CSR_A,CS_CRESET) ;
  133. #endif
  134. #ifdef EISA
  135. outpw(CSR_A,0) ; /* reset for all chips */
  136. for (i = 10 ; i ; i--) /* delay for PLC's */
  137. (void)inpw(ISR_A) ;
  138. outpw(CSR_A,CS_CRESET) ;
  139. smc->hw.led = (2<<6) ;
  140. outpw(CSR_A,CS_CRESET | smc->hw.led) ;
  141. #endif
  142. #ifdef MCA
  143. outp(ADDR(CARD_DIS),0) ; /* reset for all chips */
  144. for (i = 10 ; i ; i--) /* delay for PLC's */
  145. (void)inpw(ISR_A) ;
  146. outp(ADDR(CARD_EN),0) ;
  147. /* first I/O after reset must not be a access to FORMAC or PLC */
  148. /*
  149. * bus timeout (MCA)
  150. */
  151. OUT_82c54_TIMER(3,COUNT(2) | RW_OP(3) | TMODE(3)) ;
  152. /* counter 2, mode 3 */
  153. OUT_82c54_TIMER(2,(2*24)) ; /* 3.9 us * 2 square wave */
  154. OUT_82c54_TIMER(2,0) ; /* MSB */
  155. /* POS 102 indicated an activ Check Line or Buss Error monitoring */
  156. if (inpw(CSA_A) & (POS_EN_CHKINT | POS_EN_BUS_ERR)) {
  157. outp(ADDR(IRQ_CHCK_EN),0) ;
  158. }
  159. if (!((i = inpw(CSR_A)) & CS_SAS)) {
  160. if (!(i & CS_BYSTAT)) {
  161. outp(ADDR(BYPASS(STAT_INS)),0) ;/* insert station */
  162. }
  163. }
  164. outpw(LEDR_A,LED_1) ; /* yellow */
  165. #endif /* MCA */
  166. #ifdef PCI
  167. /*
  168. * make sure no transfer activity is pending
  169. */
  170. outpw(FM_A(FM_MDREG1),FM_MINIT) ;
  171. outp(ADDR(B0_CTRL), CTRL_HPI_SET) ;
  172. hwt_wait_time(smc,hwt_quick_read(smc),MS2BCLK(10)) ;
  173. /*
  174. * now reset everything
  175. */
  176. outp(ADDR(B0_CTRL),CTRL_RST_SET) ; /* reset for all chips */
  177. i = (int) inp(ADDR(B0_CTRL)) ; /* do dummy read */
  178. SK_UNUSED(i) ; /* Make LINT happy. */
  179. outp(ADDR(B0_CTRL), CTRL_RST_CLR) ;
  180. /*
  181. * Reset all bits in the PCI STATUS register
  182. */
  183. outp(ADDR(B0_TST_CTRL), TST_CFG_WRITE_ON) ; /* enable for writes */
  184. word = inpw(PCI_C(PCI_STATUS)) ;
  185. outpw(PCI_C(PCI_STATUS), word | PCI_ERRBITS) ;
  186. outp(ADDR(B0_TST_CTRL), TST_CFG_WRITE_OFF) ; /* disable writes */
  187. /*
  188. * Release the reset of all the State machines
  189. * Release Master_Reset
  190. * Release HPI_SM_Reset
  191. */
  192. outp(ADDR(B0_CTRL), CTRL_MRST_CLR|CTRL_HPI_CLR) ;
  193. /*
  194. * determine the adapter type
  195. * Note: Do it here, because some drivers may call card_start() once
  196. * at very first before any other initialization functions is
  197. * executed.
  198. */
  199. rev_id = inp(PCI_C(PCI_REV_ID)) ;
  200. if ((rev_id & 0xf0) == SK_ML_ID_1 || (rev_id & 0xf0) == SK_ML_ID_2) {
  201. smc->hw.hw_is_64bit = TRUE ;
  202. } else {
  203. smc->hw.hw_is_64bit = FALSE ;
  204. }
  205. /*
  206. * Watermark initialization
  207. */
  208. if (!smc->hw.hw_is_64bit) {
  209. outpd(ADDR(B4_R1_F), RX_WATERMARK) ;
  210. outpd(ADDR(B5_XA_F), TX_WATERMARK) ;
  211. outpd(ADDR(B5_XS_F), TX_WATERMARK) ;
  212. }
  213. outp(ADDR(B0_CTRL),CTRL_RST_CLR) ; /* clear the reset chips */
  214. outp(ADDR(B0_LED),LED_GA_OFF|LED_MY_ON|LED_GB_OFF) ; /* ye LED on */
  215. /* init the timer value for the watch dog 2,5 minutes */
  216. outpd(ADDR(B2_WDOG_INI),0x6FC23AC0) ;
  217. /* initialize the ISR mask */
  218. smc->hw.is_imask = ISR_MASK ;
  219. smc->hw.hw_state = STOPPED ;
  220. #endif
  221. GET_PAGE(0) ; /* necessary for BOOT */
  222. }
  223. void card_stop(struct s_smc *smc)
  224. {
  225. smt_stop_watchdog(smc) ;
  226. smc->hw.mac_ring_is_up = 0 ; /* ring down */
  227. #ifdef ISA
  228. outpw(CSR_A,0) ; /* reset for all chips */
  229. #endif
  230. #ifdef EISA
  231. outpw(CSR_A,0) ; /* reset for all chips */
  232. #endif
  233. #ifdef MCA
  234. outp(ADDR(CARD_DIS),0) ; /* reset for all chips */
  235. #endif
  236. #ifdef PCI
  237. /*
  238. * make sure no transfer activity is pending
  239. */
  240. outpw(FM_A(FM_MDREG1),FM_MINIT) ;
  241. outp(ADDR(B0_CTRL), CTRL_HPI_SET) ;
  242. hwt_wait_time(smc,hwt_quick_read(smc),MS2BCLK(10)) ;
  243. /*
  244. * now reset everything
  245. */
  246. outp(ADDR(B0_CTRL),CTRL_RST_SET) ; /* reset for all chips */
  247. outp(ADDR(B0_CTRL),CTRL_RST_CLR) ; /* reset for all chips */
  248. outp(ADDR(B0_LED),LED_GA_OFF|LED_MY_OFF|LED_GB_OFF) ; /* all LEDs off */
  249. smc->hw.hw_state = STOPPED ;
  250. #endif
  251. }
  252. /*--------------------------- ISR handling ----------------------------------*/
  253. void mac1_irq(struct s_smc *smc, u_short stu, u_short stl)
  254. {
  255. int restart_tx = 0 ;
  256. again:
  257. #ifndef PCI
  258. #ifndef ISA
  259. /*
  260. * FORMAC+ bug modified the queue pointer if many read/write accesses happens!?
  261. */
  262. if (stl & (FM_SPCEPDS | /* parit/coding err. syn.q.*/
  263. FM_SPCEPDA0 | /* parit/coding err. a.q.0 */
  264. FM_SPCEPDA1 | /* parit/coding err. a.q.1 */
  265. FM_SPCEPDA2)) { /* parit/coding err. a.q.2 */
  266. SMT_PANIC(smc,SMT_E0132, SMT_E0132_MSG) ;
  267. }
  268. if (stl & (FM_STBURS | /* tx buffer underrun syn.q.*/
  269. FM_STBURA0 | /* tx buffer underrun a.q.0 */
  270. FM_STBURA1 | /* tx buffer underrun a.q.1 */
  271. FM_STBURA2)) { /* tx buffer underrun a.q.2 */
  272. SMT_PANIC(smc,SMT_E0133, SMT_E0133_MSG) ;
  273. }
  274. #endif
  275. if ( (stu & (FM_SXMTABT | /* transmit abort */
  276. #ifdef SYNC
  277. FM_STXABRS | /* syn. tx abort */
  278. #endif /* SYNC */
  279. FM_STXABRA0)) || /* asyn. tx abort */
  280. (stl & (FM_SQLCKS | /* lock for syn. q. */
  281. FM_SQLCKA0)) ) { /* lock for asyn. q. */
  282. formac_tx_restart(smc) ; /* init tx */
  283. restart_tx = 1 ;
  284. stu = inpw(FM_A(FM_ST1U)) ;
  285. stl = inpw(FM_A(FM_ST1L)) ;
  286. stu &= ~ (FM_STECFRMA0 | FM_STEFRMA0 | FM_STEFRMS) ;
  287. if (stu || stl)
  288. goto again ;
  289. }
  290. #ifndef SYNC
  291. if (stu & (FM_STECFRMA0 | /* end of chain asyn tx */
  292. FM_STEFRMA0)) { /* end of frame asyn tx */
  293. /* free tx_queue */
  294. smc->hw.n_a_send = 0 ;
  295. if (++smc->hw.fp.tx_free < smc->hw.fp.tx_max) {
  296. start_next_send(smc);
  297. }
  298. restart_tx = 1 ;
  299. }
  300. #else /* SYNC */
  301. if (stu & (FM_STEFRMA0 | /* end of asyn tx */
  302. FM_STEFRMS)) { /* end of sync tx */
  303. restart_tx = 1 ;
  304. }
  305. #endif /* SYNC */
  306. if (restart_tx)
  307. llc_restart_tx(smc) ;
  308. }
  309. #else /* PCI */
  310. /*
  311. * parity error: note encoding error is not possible in tag mode
  312. */
  313. if (stl & (FM_SPCEPDS | /* parity err. syn.q.*/
  314. FM_SPCEPDA0 | /* parity err. a.q.0 */
  315. FM_SPCEPDA1)) { /* parity err. a.q.1 */
  316. SMT_PANIC(smc,SMT_E0134, SMT_E0134_MSG) ;
  317. }
  318. /*
  319. * buffer underrun: can only occur if a tx threshold is specified
  320. */
  321. if (stl & (FM_STBURS | /* tx buffer underrun syn.q.*/
  322. FM_STBURA0 | /* tx buffer underrun a.q.0 */
  323. FM_STBURA1)) { /* tx buffer underrun a.q.2 */
  324. SMT_PANIC(smc,SMT_E0133, SMT_E0133_MSG) ;
  325. }
  326. if ( (stu & (FM_SXMTABT | /* transmit abort */
  327. FM_STXABRS | /* syn. tx abort */
  328. FM_STXABRA0)) || /* asyn. tx abort */
  329. (stl & (FM_SQLCKS | /* lock for syn. q. */
  330. FM_SQLCKA0)) ) { /* lock for asyn. q. */
  331. formac_tx_restart(smc) ; /* init tx */
  332. restart_tx = 1 ;
  333. stu = inpw(FM_A(FM_ST1U)) ;
  334. stl = inpw(FM_A(FM_ST1L)) ;
  335. stu &= ~ (FM_STECFRMA0 | FM_STEFRMA0 | FM_STEFRMS) ;
  336. if (stu || stl)
  337. goto again ;
  338. }
  339. if (stu & (FM_STEFRMA0 | /* end of asyn tx */
  340. FM_STEFRMS)) { /* end of sync tx */
  341. restart_tx = 1 ;
  342. }
  343. if (restart_tx)
  344. llc_restart_tx(smc) ;
  345. }
  346. #endif /* PCI */
  347. /*
  348. * interrupt source= plc1
  349. * this function is called in nwfbisr.asm
  350. */
  351. void plc1_irq(struct s_smc *smc)
  352. {
  353. u_short st = inpw(PLC(PB,PL_INTR_EVENT)) ;
  354. #if (defined(ISA) || defined(EISA))
  355. /* reset PLC Int. bits */
  356. outpw(PLC1_I,inpw(PLC1_I)) ;
  357. #endif
  358. plc_irq(smc,PB,st) ;
  359. }
  360. /*
  361. * interrupt source= plc2
  362. * this function is called in nwfbisr.asm
  363. */
  364. void plc2_irq(struct s_smc *smc)
  365. {
  366. u_short st = inpw(PLC(PA,PL_INTR_EVENT)) ;
  367. #if (defined(ISA) || defined(EISA))
  368. /* reset PLC Int. bits */
  369. outpw(PLC2_I,inpw(PLC2_I)) ;
  370. #endif
  371. plc_irq(smc,PA,st) ;
  372. }
  373. /*
  374. * interrupt source= timer
  375. */
  376. void timer_irq(struct s_smc *smc)
  377. {
  378. hwt_restart(smc);
  379. smc->hw.t_stop = smc->hw.t_start;
  380. smt_timer_done(smc) ;
  381. }
  382. /*
  383. * return S-port (PA or PB)
  384. */
  385. int pcm_get_s_port(struct s_smc *smc)
  386. {
  387. SK_UNUSED(smc) ;
  388. return(PS) ;
  389. }
  390. /*
  391. * Station Label = "FDDI-XYZ" where
  392. *
  393. * X = connector type
  394. * Y = PMD type
  395. * Z = port type
  396. */
  397. #define STATION_LABEL_CONNECTOR_OFFSET 5
  398. #define STATION_LABEL_PMD_OFFSET 6
  399. #define STATION_LABEL_PORT_OFFSET 7
  400. void read_address(struct s_smc *smc, u_char *mac_addr)
  401. {
  402. char ConnectorType ;
  403. char PmdType ;
  404. int i ;
  405. #if (defined(ISA) || defined(MCA))
  406. for (i = 0; i < 4 ;i++) { /* read mac address from board */
  407. smc->hw.fddi_phys_addr.a[i] =
  408. bitrev8(inpw(PR_A(i+SA_MAC)));
  409. }
  410. for (i = 4; i < 6; i++) {
  411. smc->hw.fddi_phys_addr.a[i] =
  412. bitrev8(inpw(PR_A(i+SA_MAC+PRA_OFF)));
  413. }
  414. #endif
  415. #ifdef EISA
  416. /*
  417. * Note: We get trouble on an Alpha machine if we make a inpw()
  418. * instead of inp()
  419. */
  420. for (i = 0; i < 4 ;i++) { /* read mac address from board */
  421. smc->hw.fddi_phys_addr.a[i] =
  422. bitrev8(inp(PR_A(i+SA_MAC)));
  423. }
  424. for (i = 4; i < 6; i++) {
  425. smc->hw.fddi_phys_addr.a[i] =
  426. bitrev8(inp(PR_A(i+SA_MAC+PRA_OFF)));
  427. }
  428. #endif
  429. #ifdef PCI
  430. for (i = 0; i < 6; i++) { /* read mac address from board */
  431. smc->hw.fddi_phys_addr.a[i] =
  432. bitrev8(inp(ADDR(B2_MAC_0+i)));
  433. }
  434. #endif
  435. #ifndef PCI
  436. ConnectorType = inpw(PR_A(SA_PMD_TYPE)) & 0xff ;
  437. PmdType = inpw(PR_A(SA_PMD_TYPE+1)) & 0xff ;
  438. #else
  439. ConnectorType = inp(ADDR(B2_CONN_TYP)) ;
  440. PmdType = inp(ADDR(B2_PMD_TYP)) ;
  441. #endif
  442. smc->y[PA].pmd_type[PMD_SK_CONN] =
  443. smc->y[PB].pmd_type[PMD_SK_CONN] = ConnectorType ;
  444. smc->y[PA].pmd_type[PMD_SK_PMD ] =
  445. smc->y[PB].pmd_type[PMD_SK_PMD ] = PmdType ;
  446. if (mac_addr) {
  447. for (i = 0; i < 6 ;i++) {
  448. smc->hw.fddi_canon_addr.a[i] = mac_addr[i] ;
  449. smc->hw.fddi_home_addr.a[i] = bitrev8(mac_addr[i]);
  450. }
  451. return ;
  452. }
  453. smc->hw.fddi_home_addr = smc->hw.fddi_phys_addr ;
  454. for (i = 0; i < 6 ;i++) {
  455. smc->hw.fddi_canon_addr.a[i] =
  456. bitrev8(smc->hw.fddi_phys_addr.a[i]);
  457. }
  458. }
  459. /*
  460. * FDDI card soft reset
  461. */
  462. void init_board(struct s_smc *smc, u_char *mac_addr)
  463. {
  464. card_start(smc) ;
  465. read_address(smc,mac_addr) ;
  466. #ifndef PCI
  467. if (inpw(CSR_A) & CS_SAS)
  468. #else
  469. if (!(inp(ADDR(B0_DAS)) & DAS_AVAIL))
  470. #endif
  471. smc->s.sas = SMT_SAS ; /* Single att. station */
  472. else
  473. smc->s.sas = SMT_DAS ; /* Dual att. station */
  474. #ifndef PCI
  475. if (inpw(CSR_A) & CS_BYSTAT)
  476. #else
  477. if (!(inp(ADDR(B0_DAS)) & DAS_BYP_ST))
  478. #endif
  479. smc->mib.fddiSMTBypassPresent = 0 ;
  480. /* without opt. bypass */
  481. else
  482. smc->mib.fddiSMTBypassPresent = 1 ;
  483. /* with opt. bypass */
  484. }
  485. /*
  486. * insert or deinsert optical bypass (called by ECM)
  487. */
  488. void sm_pm_bypass_req(struct s_smc *smc, int mode)
  489. {
  490. #if (defined(ISA) || defined(EISA))
  491. int csra_v ;
  492. #endif
  493. DB_ECMN(1,"ECM : sm_pm_bypass_req(%s)\n",(mode == BP_INSERT) ?
  494. "BP_INSERT" : "BP_DEINSERT",0) ;
  495. if (smc->s.sas != SMT_DAS)
  496. return ;
  497. #if (defined(ISA) || defined(EISA))
  498. csra_v = inpw(CSR_A) & ~CS_BYPASS ;
  499. #ifdef EISA
  500. csra_v |= smc->hw.led ;
  501. #endif
  502. switch(mode) {
  503. case BP_INSERT :
  504. outpw(CSR_A,csra_v | CS_BYPASS) ;
  505. break ;
  506. case BP_DEINSERT :
  507. outpw(CSR_A,csra_v) ;
  508. break ;
  509. }
  510. #endif /* ISA / EISA */
  511. #ifdef MCA
  512. switch(mode) {
  513. case BP_INSERT :
  514. outp(ADDR(BYPASS(STAT_INS)),0) ;/* insert station */
  515. break ;
  516. case BP_DEINSERT :
  517. outp(ADDR(BYPASS(STAT_BYP)),0) ; /* bypass station */
  518. break ;
  519. }
  520. #endif
  521. #ifdef PCI
  522. switch(mode) {
  523. case BP_INSERT :
  524. outp(ADDR(B0_DAS),DAS_BYP_INS) ; /* insert station */
  525. break ;
  526. case BP_DEINSERT :
  527. outp(ADDR(B0_DAS),DAS_BYP_RMV) ; /* bypass station */
  528. break ;
  529. }
  530. #endif
  531. }
  532. /*
  533. * check if bypass connected
  534. */
  535. int sm_pm_bypass_present(struct s_smc *smc)
  536. {
  537. #ifndef PCI
  538. return( (inpw(CSR_A) & CS_BYSTAT) ? FALSE : TRUE ) ;
  539. #else
  540. return( (inp(ADDR(B0_DAS)) & DAS_BYP_ST) ? TRUE: FALSE) ;
  541. #endif
  542. }
  543. void plc_clear_irq(struct s_smc *smc, int p)
  544. {
  545. SK_UNUSED(p) ;
  546. #if (defined(ISA) || defined(EISA))
  547. switch (p) {
  548. case PA :
  549. /* reset PLC Int. bits */
  550. outpw(PLC2_I,inpw(PLC2_I)) ;
  551. break ;
  552. case PB :
  553. /* reset PLC Int. bits */
  554. outpw(PLC1_I,inpw(PLC1_I)) ;
  555. break ;
  556. }
  557. #else
  558. SK_UNUSED(smc) ;
  559. #endif
  560. }
  561. /*
  562. * led_indication called by rmt_indication() and
  563. * pcm_state_change()
  564. *
  565. * Input:
  566. * smc: SMT context
  567. * led_event:
  568. * 0 Only switch green LEDs according to their respective PCM state
  569. * LED_Y_OFF just switch yellow LED off
  570. * LED_Y_ON just switch yello LED on
  571. */
  572. static void led_indication(struct s_smc *smc, int led_event)
  573. {
  574. /* use smc->hw.mac_ring_is_up == TRUE
  575. * as indication for Ring Operational
  576. */
  577. u_short led_state ;
  578. struct s_phy *phy ;
  579. struct fddi_mib_p *mib_a ;
  580. struct fddi_mib_p *mib_b ;
  581. phy = &smc->y[PA] ;
  582. mib_a = phy->mib ;
  583. phy = &smc->y[PB] ;
  584. mib_b = phy->mib ;
  585. #ifdef EISA
  586. /* Ring up = yellow led OFF*/
  587. if (led_event == LED_Y_ON) {
  588. smc->hw.led |= CS_LED_1 ;
  589. }
  590. else if (led_event == LED_Y_OFF) {
  591. smc->hw.led &= ~CS_LED_1 ;
  592. }
  593. else {
  594. /* Link at Port A or B = green led ON */
  595. if (mib_a->fddiPORTPCMState == PC8_ACTIVE ||
  596. mib_b->fddiPORTPCMState == PC8_ACTIVE) {
  597. smc->hw.led |= CS_LED_0 ;
  598. }
  599. else {
  600. smc->hw.led &= ~CS_LED_0 ;
  601. }
  602. }
  603. #endif
  604. #ifdef MCA
  605. led_state = inpw(LEDR_A) ;
  606. /* Ring up = yellow led OFF*/
  607. if (led_event == LED_Y_ON) {
  608. led_state |= LED_1 ;
  609. }
  610. else if (led_event == LED_Y_OFF) {
  611. led_state &= ~LED_1 ;
  612. }
  613. else {
  614. led_state &= ~(LED_2|LED_0) ;
  615. /* Link at Port A = green led A ON */
  616. if (mib_a->fddiPORTPCMState == PC8_ACTIVE) {
  617. led_state |= LED_2 ;
  618. }
  619. /* Link at Port B/S = green led B ON */
  620. if (mib_b->fddiPORTPCMState == PC8_ACTIVE) {
  621. led_state |= LED_0 ;
  622. }
  623. }
  624. outpw(LEDR_A, led_state) ;
  625. #endif /* MCA */
  626. #ifdef PCI
  627. led_state = 0 ;
  628. /* Ring up = yellow led OFF*/
  629. if (led_event == LED_Y_ON) {
  630. led_state |= LED_MY_ON ;
  631. }
  632. else if (led_event == LED_Y_OFF) {
  633. led_state |= LED_MY_OFF ;
  634. }
  635. else { /* PCM state changed */
  636. /* Link at Port A/S = green led A ON */
  637. if (mib_a->fddiPORTPCMState == PC8_ACTIVE) {
  638. led_state |= LED_GA_ON ;
  639. }
  640. else {
  641. led_state |= LED_GA_OFF ;
  642. }
  643. /* Link at Port B = green led B ON */
  644. if (mib_b->fddiPORTPCMState == PC8_ACTIVE) {
  645. led_state |= LED_GB_ON ;
  646. }
  647. else {
  648. led_state |= LED_GB_OFF ;
  649. }
  650. }
  651. outp(ADDR(B0_LED), led_state) ;
  652. #endif /* PCI */
  653. }
  654. void pcm_state_change(struct s_smc *smc, int plc, int p_state)
  655. {
  656. /*
  657. * the current implementation of pcm_state_change() in the driver
  658. * parts must be renamed to drv_pcm_state_change() which will be called
  659. * now after led_indication.
  660. */
  661. DRV_PCM_STATE_CHANGE(smc,plc,p_state) ;
  662. led_indication(smc,0) ;
  663. }
  664. void rmt_indication(struct s_smc *smc, int i)
  665. {
  666. /* Call a driver special function if defined */
  667. DRV_RMT_INDICATION(smc,i) ;
  668. led_indication(smc, i ? LED_Y_OFF : LED_Y_ON) ;
  669. }
  670. /*
  671. * llc_recover_tx called by init_tx (fplus.c)
  672. */
  673. void llc_recover_tx(struct s_smc *smc)
  674. {
  675. #ifdef LOAD_GEN
  676. extern int load_gen_flag ;
  677. load_gen_flag = 0 ;
  678. #endif
  679. #ifndef SYNC
  680. smc->hw.n_a_send= 0 ;
  681. #else
  682. SK_UNUSED(smc) ;
  683. #endif
  684. }
  685. #ifdef MULT_OEM
  686. static int is_equal_num(char comp1[], char comp2[], int num)
  687. {
  688. int i ;
  689. for (i = 0 ; i < num ; i++) {
  690. if (comp1[i] != comp2[i])
  691. return (0) ;
  692. }
  693. return (1) ;
  694. } /* is_equal_num */
  695. /*
  696. * set the OEM ID defaults, and test the contents of the OEM data base
  697. * The default OEM is the first ACTIVE entry in the OEM data base
  698. *
  699. * returns: 0 success
  700. * 1 error in data base
  701. * 2 data base empty
  702. * 3 no active entry
  703. */
  704. int set_oi_id_def(struct s_smc *smc)
  705. {
  706. int sel_id ;
  707. int i ;
  708. int act_entries ;
  709. i = 0 ;
  710. sel_id = -1 ;
  711. act_entries = FALSE ;
  712. smc->hw.oem_id = 0 ;
  713. smc->hw.oem_min_status = OI_STAT_ACTIVE ;
  714. /* check OEM data base */
  715. while (oem_ids[i].oi_status) {
  716. switch (oem_ids[i].oi_status) {
  717. case OI_STAT_ACTIVE:
  718. act_entries = TRUE ; /* we have active IDs */
  719. if (sel_id == -1)
  720. sel_id = i ; /* save the first active ID */
  721. case OI_STAT_VALID:
  722. case OI_STAT_PRESENT:
  723. i++ ;
  724. break ; /* entry ok */
  725. default:
  726. return (1) ; /* invalid oi_status */
  727. }
  728. }
  729. if (i == 0)
  730. return (2) ;
  731. if (!act_entries)
  732. return (3) ;
  733. /* ok, we have a valid OEM data base with an active entry */
  734. smc->hw.oem_id = (struct s_oem_ids *) &oem_ids[sel_id] ;
  735. return (0) ;
  736. }
  737. #endif /* MULT_OEM */
  738. #ifdef MCA
  739. /************************
  740. *
  741. * BEGIN_MANUAL_ENTRY()
  742. *
  743. * exist_board
  744. *
  745. * Check if an MCA board is present in the specified slot.
  746. *
  747. * int exist_board(
  748. * struct s_smc *smc,
  749. * int slot) ;
  750. * In
  751. * smc - A pointer to the SMT Context struct.
  752. *
  753. * slot - The number of the slot to inspect.
  754. * Out
  755. * 0 = No adapter present.
  756. * 1 = Found FM1 adapter.
  757. *
  758. * Pseudo
  759. * Read MCA ID
  760. * for all valid OEM_IDs
  761. * compare with ID read
  762. * if equal, return 1
  763. * return(0
  764. *
  765. * Note
  766. * The smc pointer must be valid now.
  767. *
  768. * END_MANUAL_ENTRY()
  769. *
  770. ************************/
  771. #define LONG_CARD_ID(lo, hi) ((((hi) & 0xff) << 8) | ((lo) & 0xff))
  772. int exist_board(struct s_smc *smc, int slot)
  773. {
  774. #ifdef MULT_OEM
  775. SK_LOC_DECL(u_char,id[2]) ;
  776. int idi ;
  777. #endif /* MULT_OEM */
  778. /* No longer valid. */
  779. if (smc == NULL)
  780. return(0) ;
  781. #ifndef MULT_OEM
  782. if (read_card_id(smc, slot)
  783. == LONG_CARD_ID(OEMID(smc,0), OEMID(smc,1)))
  784. return (1) ; /* Found FM adapter. */
  785. #else /* MULT_OEM */
  786. idi = read_card_id(smc, slot) ;
  787. id[0] = idi & 0xff ;
  788. id[1] = idi >> 8 ;
  789. smc->hw.oem_id = (struct s_oem_ids *) &oem_ids[0] ;
  790. for (; smc->hw.oem_id->oi_status != OI_STAT_LAST; smc->hw.oem_id++) {
  791. if (smc->hw.oem_id->oi_status < smc->hw.oem_min_status)
  792. continue ;
  793. if (is_equal_num(&id[0],&OEMID(smc,0),2))
  794. return (1) ;
  795. }
  796. #endif /* MULT_OEM */
  797. return (0) ; /* No adapter found. */
  798. }
  799. /************************
  800. *
  801. * read_card_id
  802. *
  803. * Read the MCA card id from the specified slot.
  804. * In
  805. * smc - A pointer to the SMT Context struct.
  806. * CAVEAT: This pointer may be NULL and *must not* be used within this
  807. * function. It's only purpose is for drivers that need some information
  808. * for the inp() and outp() macros.
  809. *
  810. * slot - The number of the slot for which the card id is returned.
  811. * Out
  812. * Returns the card id read from the specified slot. If an illegal slot
  813. * number is specified, the function returns zero.
  814. *
  815. ************************/
  816. static int read_card_id(struct s_smc *smc, int slot)
  817. /* struct s_smc *smc ; Do not use. */
  818. {
  819. int card_id ;
  820. SK_UNUSED(smc) ; /* Make LINT happy. */
  821. if ((slot < 1) || (slot > 15)) /* max 16 slots, 0 = motherboard */
  822. return (0) ; /* Illegal slot number specified. */
  823. EnableSlotAccess(smc, slot) ;
  824. card_id = ((read_POS(smc,POS_ID_HIGH,slot - 1) & 0xff) << 8) |
  825. (read_POS(smc,POS_ID_LOW,slot - 1) & 0xff) ;
  826. DisableSlotAccess(smc) ;
  827. return (card_id) ;
  828. }
  829. /************************
  830. *
  831. * BEGIN_MANUAL_ENTRY()
  832. *
  833. * get_board_para
  834. *
  835. * Get adapter configuration information. Fill all board specific
  836. * parameters within the 'smc' structure.
  837. *
  838. * int get_board_para(
  839. * struct s_smc *smc,
  840. * int slot) ;
  841. * In
  842. * smc - A pointer to the SMT Context struct, to which this function will
  843. * write some adapter configuration data.
  844. *
  845. * slot - The number of the slot, in which the adapter is installed.
  846. * Out
  847. * 0 = No adapter present.
  848. * 1 = Ok.
  849. * 2 = Adapter present, but card enable bit not set.
  850. *
  851. * END_MANUAL_ENTRY()
  852. *
  853. ************************/
  854. int get_board_para(struct s_smc *smc, int slot)
  855. {
  856. int val ;
  857. int i ;
  858. /* Check if adapter present & get type of adapter. */
  859. switch (exist_board(smc, slot)) {
  860. case 0: /* Adapter not present. */
  861. return (0) ;
  862. case 1: /* FM Rev. 1 */
  863. smc->hw.rev = FM1_REV ;
  864. smc->hw.VFullRead = 0x0a ;
  865. smc->hw.VFullWrite = 0x05 ;
  866. smc->hw.DmaWriteExtraBytes = 8 ; /* 2 extra words. */
  867. break ;
  868. }
  869. smc->hw.slot = slot ;
  870. EnableSlotAccess(smc, slot) ;
  871. if (!(read_POS(smc,POS_102, slot - 1) & POS_CARD_EN)) {
  872. DisableSlotAccess(smc) ;
  873. return (2) ; /* Card enable bit not set. */
  874. }
  875. val = read_POS(smc,POS_104, slot - 1) ; /* I/O, IRQ */
  876. #ifndef MEM_MAPPED_IO /* is defined by the operating system */
  877. i = val & POS_IOSEL ; /* I/O base addr. (0x0200 .. 0xfe00) */
  878. smc->hw.iop = (i + 1) * 0x0400 - 0x200 ;
  879. #endif
  880. i = ((val & POS_IRQSEL) >> 6) & 0x03 ; /* IRQ <0, 1> */
  881. smc->hw.irq = opt_ints[i] ;
  882. /* FPROM base addr. */
  883. i = ((read_POS(smc,POS_103, slot - 1) & POS_MSEL) >> 4) & 0x07 ;
  884. smc->hw.eprom = opt_eproms[i] ;
  885. DisableSlotAccess(smc) ;
  886. /* before this, the smc->hw.iop must be set !!! */
  887. smc->hw.slot_32 = inpw(CSF_A) & SLOT_32 ;
  888. return (1) ;
  889. }
  890. /* Enable access to specified MCA slot. */
  891. static void EnableSlotAccess(struct s_smc *smc, int slot)
  892. {
  893. SK_UNUSED(slot) ;
  894. #ifndef AIX
  895. SK_UNUSED(smc) ;
  896. /* System mode. */
  897. outp(POS_SYS_SETUP, POS_SYSTEM) ;
  898. /* Select slot. */
  899. outp(POS_CHANNEL_POS, POS_CHANNEL_BIT | (slot-1)) ;
  900. #else
  901. attach_POS_addr (smc) ;
  902. #endif
  903. }
  904. /* Disable access to MCA slot formerly enabled via EnableSlotAccess(). */
  905. static void DisableSlotAccess(struct s_smc *smc)
  906. {
  907. #ifndef AIX
  908. SK_UNUSED(smc) ;
  909. outp(POS_CHANNEL_POS, 0) ;
  910. #else
  911. detach_POS_addr (smc) ;
  912. #endif
  913. }
  914. #endif /* MCA */
  915. #ifdef EISA
  916. #ifndef MEM_MAPPED_IO
  917. #define SADDR(slot) (((slot)<<12)&0xf000)
  918. #else /* MEM_MAPPED_IO */
  919. #define SADDR(slot) (smc->hw.iop)
  920. #endif /* MEM_MAPPED_IO */
  921. /************************
  922. *
  923. * BEGIN_MANUAL_ENTRY()
  924. *
  925. * exist_board
  926. *
  927. * Check if an EISA board is present in the specified slot.
  928. *
  929. * int exist_board(
  930. * struct s_smc *smc,
  931. * int slot) ;
  932. * In
  933. * smc - A pointer to the SMT Context struct.
  934. *
  935. * slot - The number of the slot to inspect.
  936. * Out
  937. * 0 = No adapter present.
  938. * 1 = Found adapter.
  939. *
  940. * Pseudo
  941. * Read EISA ID
  942. * for all valid OEM_IDs
  943. * compare with ID read
  944. * if equal, return 1
  945. * return(0
  946. *
  947. * Note
  948. * The smc pointer must be valid now.
  949. *
  950. ************************/
  951. int exist_board(struct s_smc *smc, int slot)
  952. {
  953. int i ;
  954. #ifdef MULT_OEM
  955. SK_LOC_DECL(u_char,id[4]) ;
  956. #endif /* MULT_OEM */
  957. /* No longer valid. */
  958. if (smc == NULL)
  959. return(0);
  960. SK_UNUSED(slot) ;
  961. #ifndef MULT_OEM
  962. for (i = 0 ; i < 4 ; i++) {
  963. if (inp(SADDR(slot)+PRA(i)) != OEMID(smc,i))
  964. return(0) ;
  965. }
  966. return(1) ;
  967. #else /* MULT_OEM */
  968. for (i = 0 ; i < 4 ; i++)
  969. id[i] = inp(SADDR(slot)+PRA(i)) ;
  970. smc->hw.oem_id = (struct s_oem_ids *) &oem_ids[0] ;
  971. for (; smc->hw.oem_id->oi_status != OI_STAT_LAST; smc->hw.oem_id++) {
  972. if (smc->hw.oem_id->oi_status < smc->hw.oem_min_status)
  973. continue ;
  974. if (is_equal_num(&id[0],&OEMID(smc,0),4))
  975. return (1) ;
  976. }
  977. return (0) ; /* No adapter found. */
  978. #endif /* MULT_OEM */
  979. }
  980. int get_board_para(struct s_smc *smc, int slot)
  981. {
  982. int i ;
  983. if (!exist_board(smc,slot))
  984. return(0) ;
  985. smc->hw.slot = slot ;
  986. #ifndef MEM_MAPPED_IO /* if defined by the operating system */
  987. smc->hw.iop = SADDR(slot) ;
  988. #endif
  989. if (!(inp(C0_A(0))&CFG_CARD_EN)) {
  990. return(2) ; /* CFG_CARD_EN bit not set! */
  991. }
  992. smc->hw.irq = opt_ints[(inp(C1_A(0)) & CFG_IRQ_SEL)] ;
  993. smc->hw.dma = opt_dmas[((inp(C1_A(0)) & CFG_DRQ_SEL)>>3)] ;
  994. if ((i = inp(C2_A(0)) & CFG_EPROM_SEL) != 0x0f)
  995. smc->hw.eprom = opt_eproms[i] ;
  996. else
  997. smc->hw.eprom = 0 ;
  998. smc->hw.DmaWriteExtraBytes = 8 ;
  999. return(1) ;
  1000. }
  1001. #endif /* EISA */
  1002. #ifdef ISA
  1003. #ifndef MULT_OEM
  1004. const u_char sklogo[6] = SKLOGO_STR ;
  1005. #define SIZE_SKLOGO(smc) sizeof(sklogo)
  1006. #define SKLOGO(smc,i) sklogo[i]
  1007. #else /* MULT_OEM */
  1008. #define SIZE_SKLOGO(smc) smc->hw.oem_id->oi_logo_len
  1009. #define SKLOGO(smc,i) smc->hw.oem_id->oi_logo[i]
  1010. #endif /* MULT_OEM */
  1011. int exist_board(struct s_smc *smc, HW_PTR port)
  1012. {
  1013. int i ;
  1014. #ifdef MULT_OEM
  1015. int bytes_read ;
  1016. u_char board_logo[15] ;
  1017. SK_LOC_DECL(u_char,id[4]) ;
  1018. #endif /* MULT_OEM */
  1019. /* No longer valid. */
  1020. if (smc == NULL)
  1021. return(0);
  1022. SK_UNUSED(smc) ;
  1023. #ifndef MULT_OEM
  1024. for (i = SADDRL ; i < (signed) (SADDRL+SIZE_SKLOGO(smc)) ; i++) {
  1025. if ((u_char)inpw((PRA(i)+port)) != SKLOGO(smc,i-SADDRL)) {
  1026. return(0) ;
  1027. }
  1028. }
  1029. /* check MAC address (S&K or other) */
  1030. for (i = 0 ; i < 3 ; i++) {
  1031. if ((u_char)inpw((PRA(i)+port)) != OEMID(smc,i))
  1032. return(0) ;
  1033. }
  1034. return(1) ;
  1035. #else /* MULT_OEM */
  1036. smc->hw.oem_id = (struct s_oem_ids *) &oem_ids[0] ;
  1037. board_logo[0] = (u_char)inpw((PRA(SADDRL)+port)) ;
  1038. bytes_read = 1 ;
  1039. for (; smc->hw.oem_id->oi_status != OI_STAT_LAST; smc->hw.oem_id++) {
  1040. if (smc->hw.oem_id->oi_status < smc->hw.oem_min_status)
  1041. continue ;
  1042. /* Test all read bytes with current OEM_entry */
  1043. /* for (i=0; (i<bytes_read) && (i < SIZE_SKLOGO(smc)); i++) { */
  1044. for (i = 0; i < bytes_read; i++) {
  1045. if (board_logo[i] != SKLOGO(smc,i))
  1046. break ;
  1047. }
  1048. /* If mismatch, switch to next OEM entry */
  1049. if ((board_logo[i] != SKLOGO(smc,i)) && (i < bytes_read))
  1050. continue ;
  1051. --i ;
  1052. while (bytes_read < SIZE_SKLOGO(smc)) {
  1053. // inpw next byte SK_Logo
  1054. i++ ;
  1055. board_logo[i] = (u_char)inpw((PRA(SADDRL+i)+port)) ;
  1056. bytes_read++ ;
  1057. if (board_logo[i] != SKLOGO(smc,i))
  1058. break ;
  1059. }
  1060. for (i = 0 ; i < 3 ; i++)
  1061. id[i] = (u_char)inpw((PRA(i)+port)) ;
  1062. if ((board_logo[i] == SKLOGO(smc,i))
  1063. && (bytes_read == SIZE_SKLOGO(smc))) {
  1064. if (is_equal_num(&id[0],&OEMID(smc,0),3))
  1065. return(1);
  1066. }
  1067. } /* for */
  1068. return(0) ;
  1069. #endif /* MULT_OEM */
  1070. }
  1071. int get_board_para(struct s_smc *smc, int slot)
  1072. {
  1073. SK_UNUSED(smc) ;
  1074. SK_UNUSED(slot) ;
  1075. return(0) ; /* for ISA not supported */
  1076. }
  1077. #endif /* ISA */
  1078. #ifdef PCI
  1079. #ifdef USE_BIOS_FUN
  1080. int exist_board(struct s_smc *smc, int slot)
  1081. {
  1082. u_short dev_id ;
  1083. u_short ven_id ;
  1084. int found ;
  1085. int i ;
  1086. found = FALSE ; /* make sure we returned with adatper not found*/
  1087. /* if an empty oemids.h was included */
  1088. #ifdef MULT_OEM
  1089. smc->hw.oem_id = (struct s_oem_ids *) &oem_ids[0] ;
  1090. for (; smc->hw.oem_id->oi_status != OI_STAT_LAST; smc->hw.oem_id++) {
  1091. if (smc->hw.oem_id->oi_status < smc->hw.oem_min_status)
  1092. continue ;
  1093. #endif
  1094. ven_id = OEMID(smc,0) + (OEMID(smc,1) << 8) ;
  1095. dev_id = OEMID(smc,2) + (OEMID(smc,3) << 8) ;
  1096. for (i = 0; i < slot; i++) {
  1097. if (pci_find_device(i,&smc->hw.pci_handle,
  1098. dev_id,ven_id) != 0) {
  1099. found = FALSE ;
  1100. } else {
  1101. found = TRUE ;
  1102. }
  1103. }
  1104. if (found) {
  1105. return(1) ; /* adapter was found */
  1106. }
  1107. #ifdef MULT_OEM
  1108. }
  1109. #endif
  1110. return(0) ; /* adapter was not found */
  1111. }
  1112. #endif /* PCI */
  1113. #endif /* USE_BIOS_FUNC */
  1114. void driver_get_bia(struct s_smc *smc, struct fddi_addr *bia_addr)
  1115. {
  1116. int i ;
  1117. for (i = 0 ; i < 6 ; i++)
  1118. bia_addr->a[i] = bitrev8(smc->hw.fddi_phys_addr.a[i]);
  1119. }
  1120. void smt_start_watchdog(struct s_smc *smc)
  1121. {
  1122. SK_UNUSED(smc) ; /* Make LINT happy. */
  1123. #ifndef DEBUG
  1124. #ifdef PCI
  1125. if (smc->hw.wdog_used) {
  1126. outpw(ADDR(B2_WDOG_CRTL),TIM_START) ; /* Start timer. */
  1127. }
  1128. #endif
  1129. #endif /* DEBUG */
  1130. }
  1131. static void smt_stop_watchdog(struct s_smc *smc)
  1132. {
  1133. SK_UNUSED(smc) ; /* Make LINT happy. */
  1134. #ifndef DEBUG
  1135. #ifdef PCI
  1136. if (smc->hw.wdog_used) {
  1137. outpw(ADDR(B2_WDOG_CRTL),TIM_STOP) ; /* Stop timer. */
  1138. }
  1139. #endif
  1140. #endif /* DEBUG */
  1141. }
  1142. #ifdef PCI
  1143. void mac_do_pci_fix(struct s_smc *smc)
  1144. {
  1145. SK_UNUSED(smc) ;
  1146. }
  1147. #endif /* PCI */