via.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. /*
  2. * 6522 Versatile Interface Adapter (VIA)
  3. *
  4. * There are two of these on the Mac II. Some IRQs are vectored
  5. * via them as are assorted bits and bobs - eg RTC, ADB.
  6. *
  7. * CSA: Motorola seems to have removed documentation on the 6522 from
  8. * their web site; try
  9. * http://nerini.drf.com/vectrex/other/text/chips/6522/
  10. * http://www.zymurgy.net/classic/vic20/vicdet1.htm
  11. * and
  12. * http://193.23.168.87/mikro_laborversuche/via_iobaustein/via6522_1.html
  13. * for info. A full-text web search on 6522 AND VIA will probably also
  14. * net some usefulness. <cananian@alumni.princeton.edu> 20apr1999
  15. *
  16. * Additional data is here (the SY6522 was used in the Mac II etc):
  17. * http://www.6502.org/documents/datasheets/synertek/synertek_sy6522.pdf
  18. * http://www.6502.org/documents/datasheets/synertek/synertek_sy6522_programming_reference.pdf
  19. *
  20. * PRAM/RTC access algorithms are from the NetBSD RTC toolkit version 1.08b
  21. * by Erik Vogan and adapted to Linux by Joshua M. Thompson (funaho@jurai.org)
  22. *
  23. */
  24. #include <linux/types.h>
  25. #include <linux/kernel.h>
  26. #include <linux/mm.h>
  27. #include <linux/delay.h>
  28. #include <linux/init.h>
  29. #include <linux/module.h>
  30. #include <linux/irq.h>
  31. #include <asm/macintosh.h>
  32. #include <asm/macints.h>
  33. #include <asm/mac_via.h>
  34. #include <asm/mac_psc.h>
  35. #include <asm/mac_oss.h>
  36. volatile __u8 *via1, *via2;
  37. int rbv_present;
  38. int via_alt_mapping;
  39. EXPORT_SYMBOL(via_alt_mapping);
  40. static __u8 rbv_clear;
  41. /*
  42. * Globals for accessing the VIA chip registers without having to
  43. * check if we're hitting a real VIA or an RBV. Normally you could
  44. * just hit the combined register (ie, vIER|rIER) but that seems to
  45. * break on AV Macs...probably because they actually decode more than
  46. * eight address bits. Why can't Apple engineers at least be
  47. * _consistently_ lazy? - 1999-05-21 (jmt)
  48. */
  49. static int gIER,gIFR,gBufA,gBufB;
  50. /*
  51. * Timer defs.
  52. */
  53. #define TICK_SIZE 10000
  54. #define MAC_CLOCK_TICK (783300/HZ) /* ticks per HZ */
  55. #define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF)
  56. #define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8)
  57. /*
  58. * On Macs with a genuine VIA chip there is no way to mask an individual slot
  59. * interrupt. This limitation also seems to apply to VIA clone logic cores in
  60. * Quadra-like ASICs. (RBV and OSS machines don't have this limitation.)
  61. *
  62. * We used to fake it by configuring the relevant VIA pin as an output
  63. * (to mask the interrupt) or input (to unmask). That scheme did not work on
  64. * (at least) the Quadra 700. A NuBus card's /NMRQ signal is an open-collector
  65. * circuit (see Designing Cards and Drivers for Macintosh II and Macintosh SE,
  66. * p. 10-11 etc) but VIA outputs are not (see datasheet).
  67. *
  68. * Driving these outputs high must cause the VIA to source current and the
  69. * card to sink current when it asserts /NMRQ. Current will flow but the pin
  70. * voltage is uncertain and so the /NMRQ condition may still cause a transition
  71. * at the VIA2 CA1 input (which explains the lost interrupts). A side effect
  72. * is that a disabled slot IRQ can never be tested as pending or not.
  73. *
  74. * Driving these outputs low doesn't work either. All the slot /NMRQ lines are
  75. * (active low) OR'd together to generate the CA1 (aka "SLOTS") interrupt (see
  76. * The Guide To Macintosh Family Hardware, 2nd edition p. 167). If we drive a
  77. * disabled /NMRQ line low, the falling edge immediately triggers a CA1
  78. * interrupt and all slot interrupts after that will generate no transition
  79. * and therefore no interrupt, even after being re-enabled.
  80. *
  81. * So we make the VIA port A I/O lines inputs and use nubus_disabled to keep
  82. * track of their states. When any slot IRQ becomes disabled we mask the CA1
  83. * umbrella interrupt. Only when all slot IRQs become enabled do we unmask
  84. * the CA1 interrupt. It must remain enabled even when cards have no interrupt
  85. * handler registered. Drivers must therefore disable a slot interrupt at the
  86. * device before they call free_irq (like shared and autovector interrupts).
  87. *
  88. * There is also a related problem when MacOS is used to boot Linux. A network
  89. * card brought up by a MacOS driver may raise an interrupt while Linux boots.
  90. * This can be fatal since it can't be handled until the right driver loads
  91. * (if such a driver exists at all). Apparently related to this hardware
  92. * limitation, "Designing Cards and Drivers", p. 9-8, says that a slot
  93. * interrupt with no driver would crash MacOS (the book was written before
  94. * the appearance of Macs with RBV or OSS).
  95. */
  96. static u8 nubus_disabled;
  97. void via_debug_dump(void);
  98. /*
  99. * Initialize the VIAs
  100. *
  101. * First we figure out where they actually _are_ as well as what type of
  102. * VIA we have for VIA2 (it could be a real VIA or an RBV or even an OSS.)
  103. * Then we pretty much clear them out and disable all IRQ sources.
  104. *
  105. * Note: the OSS is actually "detected" here and not in oss_init(). It just
  106. * seems more logical to do it here since via_init() needs to know
  107. * these things anyways.
  108. */
  109. void __init via_init(void)
  110. {
  111. switch(macintosh_config->via_type) {
  112. /* IIci, IIsi, IIvx, IIvi (P6xx), LC series */
  113. case MAC_VIA_IICI:
  114. via1 = (void *) VIA1_BASE;
  115. if (macintosh_config->ident == MAC_MODEL_IIFX) {
  116. via2 = NULL;
  117. rbv_present = 0;
  118. oss_present = 1;
  119. } else {
  120. via2 = (void *) RBV_BASE;
  121. rbv_present = 1;
  122. oss_present = 0;
  123. }
  124. if (macintosh_config->ident == MAC_MODEL_LCIII) {
  125. rbv_clear = 0x00;
  126. } else {
  127. /* on most RBVs (& unlike the VIAs), you */
  128. /* need to set bit 7 when you write to IFR */
  129. /* in order for your clear to occur. */
  130. rbv_clear = 0x80;
  131. }
  132. gIER = rIER;
  133. gIFR = rIFR;
  134. gBufA = rSIFR;
  135. gBufB = rBufB;
  136. break;
  137. /* Quadra and early MacIIs agree on the VIA locations */
  138. case MAC_VIA_QUADRA:
  139. case MAC_VIA_II:
  140. via1 = (void *) VIA1_BASE;
  141. via2 = (void *) VIA2_BASE;
  142. rbv_present = 0;
  143. oss_present = 0;
  144. rbv_clear = 0x00;
  145. gIER = vIER;
  146. gIFR = vIFR;
  147. gBufA = vBufA;
  148. gBufB = vBufB;
  149. break;
  150. default:
  151. panic("UNKNOWN VIA TYPE");
  152. }
  153. printk(KERN_INFO "VIA1 at %p is a 6522 or clone\n", via1);
  154. printk(KERN_INFO "VIA2 at %p is ", via2);
  155. if (rbv_present) {
  156. printk("an RBV\n");
  157. } else if (oss_present) {
  158. printk("an OSS\n");
  159. } else {
  160. printk("a 6522 or clone\n");
  161. }
  162. #ifdef DEBUG_VIA
  163. via_debug_dump();
  164. #endif
  165. /*
  166. * Shut down all IRQ sources, reset the timers, and
  167. * kill the timer latch on VIA1.
  168. */
  169. via1[vIER] = 0x7F;
  170. via1[vIFR] = 0x7F;
  171. via1[vT1LL] = 0;
  172. via1[vT1LH] = 0;
  173. via1[vT1CL] = 0;
  174. via1[vT1CH] = 0;
  175. via1[vT2CL] = 0;
  176. via1[vT2CH] = 0;
  177. via1[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
  178. via1[vACR] &= ~0x03; /* disable port A & B latches */
  179. /*
  180. * SE/30: disable video IRQ
  181. * XXX: testing for SE/30 VBL
  182. */
  183. if (macintosh_config->ident == MAC_MODEL_SE30) {
  184. via1[vDirB] |= 0x40;
  185. via1[vBufB] |= 0x40;
  186. }
  187. /*
  188. * Set the RTC bits to a known state: all lines to outputs and
  189. * RTC disabled (yes that's 0 to enable and 1 to disable).
  190. */
  191. via1[vDirB] |= (VIA1B_vRTCEnb | VIA1B_vRTCClk | VIA1B_vRTCData);
  192. via1[vBufB] |= (VIA1B_vRTCEnb | VIA1B_vRTCClk);
  193. /* Everything below this point is VIA2/RBV only... */
  194. if (oss_present)
  195. return;
  196. if ((macintosh_config->via_type == MAC_VIA_QUADRA) &&
  197. (macintosh_config->adb_type != MAC_ADB_PB1) &&
  198. (macintosh_config->adb_type != MAC_ADB_PB2) &&
  199. (macintosh_config->ident != MAC_MODEL_C660) &&
  200. (macintosh_config->ident != MAC_MODEL_Q840)) {
  201. via_alt_mapping = 1;
  202. via1[vDirB] |= 0x40;
  203. via1[vBufB] &= ~0x40;
  204. } else {
  205. via_alt_mapping = 0;
  206. }
  207. /*
  208. * Now initialize VIA2. For RBV we just kill all interrupts;
  209. * for a regular VIA we also reset the timers and stuff.
  210. */
  211. via2[gIER] = 0x7F;
  212. via2[gIFR] = 0x7F | rbv_clear;
  213. if (!rbv_present) {
  214. via2[vT1LL] = 0;
  215. via2[vT1LH] = 0;
  216. via2[vT1CL] = 0;
  217. via2[vT1CH] = 0;
  218. via2[vT2CL] = 0;
  219. via2[vT2CH] = 0;
  220. via2[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
  221. via2[vACR] &= ~0x03; /* disable port A & B latches */
  222. }
  223. /* Everything below this point is VIA2 only... */
  224. if (rbv_present)
  225. return;
  226. /*
  227. * Set vPCR for control line interrupts.
  228. *
  229. * CA1 (SLOTS IRQ), CB1 (ASC IRQ): negative edge trigger.
  230. *
  231. * Macs with ESP SCSI have a negative edge triggered SCSI interrupt.
  232. * Testing reveals that PowerBooks do too. However, the SE/30
  233. * schematic diagram shows an active high NCR5380 IRQ line.
  234. */
  235. pr_debug("VIA2 vPCR is 0x%02X\n", via2[vPCR]);
  236. if (macintosh_config->via_type == MAC_VIA_II) {
  237. /* CA2 (SCSI DRQ), CB2 (SCSI IRQ): indep. input, pos. edge */
  238. via2[vPCR] = 0x66;
  239. } else {
  240. /* CA2 (SCSI DRQ), CB2 (SCSI IRQ): indep. input, neg. edge */
  241. via2[vPCR] = 0x22;
  242. }
  243. }
  244. /*
  245. * Start the 100 Hz clock
  246. */
  247. void __init via_init_clock(irq_handler_t func)
  248. {
  249. via1[vACR] |= 0x40;
  250. via1[vT1LL] = MAC_CLOCK_LOW;
  251. via1[vT1LH] = MAC_CLOCK_HIGH;
  252. via1[vT1CL] = MAC_CLOCK_LOW;
  253. via1[vT1CH] = MAC_CLOCK_HIGH;
  254. if (request_irq(IRQ_MAC_TIMER_1, func, 0, "timer", func))
  255. pr_err("Couldn't register %s interrupt\n", "timer");
  256. }
  257. /*
  258. * Debugging dump, used in various places to see what's going on.
  259. */
  260. void via_debug_dump(void)
  261. {
  262. printk(KERN_DEBUG "VIA1: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
  263. (uint) via1[vDirA], (uint) via1[vDirB], (uint) via1[vACR]);
  264. printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
  265. (uint) via1[vPCR], (uint) via1[vIFR], (uint) via1[vIER]);
  266. if (oss_present) {
  267. printk(KERN_DEBUG "VIA2: <OSS>\n");
  268. } else if (rbv_present) {
  269. printk(KERN_DEBUG "VIA2: IFR = 0x%02X IER = 0x%02X\n",
  270. (uint) via2[rIFR], (uint) via2[rIER]);
  271. printk(KERN_DEBUG " SIFR = 0x%02X SIER = 0x%02X\n",
  272. (uint) via2[rSIFR], (uint) via2[rSIER]);
  273. } else {
  274. printk(KERN_DEBUG "VIA2: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
  275. (uint) via2[vDirA], (uint) via2[vDirB],
  276. (uint) via2[vACR]);
  277. printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
  278. (uint) via2[vPCR],
  279. (uint) via2[vIFR], (uint) via2[vIER]);
  280. }
  281. }
  282. /*
  283. * This is always executed with interrupts disabled.
  284. *
  285. * TBI: get time offset between scheduling timer ticks
  286. */
  287. u32 mac_gettimeoffset(void)
  288. {
  289. unsigned long ticks, offset = 0;
  290. /* read VIA1 timer 2 current value */
  291. ticks = via1[vT1CL] | (via1[vT1CH] << 8);
  292. /* The probability of underflow is less than 2% */
  293. if (ticks > MAC_CLOCK_TICK - MAC_CLOCK_TICK / 50)
  294. /* Check for pending timer interrupt in VIA1 IFR */
  295. if (via1[vIFR] & 0x40) offset = TICK_SIZE;
  296. ticks = MAC_CLOCK_TICK - ticks;
  297. ticks = ticks * 10000L / MAC_CLOCK_TICK;
  298. return (ticks + offset) * 1000;
  299. }
  300. /*
  301. * Flush the L2 cache on Macs that have it by flipping
  302. * the system into 24-bit mode for an instant.
  303. */
  304. void via_flush_cache(void)
  305. {
  306. via2[gBufB] &= ~VIA2B_vMode32;
  307. via2[gBufB] |= VIA2B_vMode32;
  308. }
  309. /*
  310. * Return the status of the L2 cache on a IIci
  311. */
  312. int via_get_cache_disable(void)
  313. {
  314. /* Safeguard against being called accidentally */
  315. if (!via2) {
  316. printk(KERN_ERR "via_get_cache_disable called on a non-VIA machine!\n");
  317. return 1;
  318. }
  319. return (int) via2[gBufB] & VIA2B_vCDis;
  320. }
  321. /*
  322. * Initialize VIA2 for Nubus access
  323. */
  324. void __init via_nubus_init(void)
  325. {
  326. /* unlock nubus transactions */
  327. if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
  328. (macintosh_config->adb_type != MAC_ADB_PB2)) {
  329. /* set the line to be an output on non-RBV machines */
  330. if (!rbv_present)
  331. via2[vDirB] |= 0x02;
  332. /* this seems to be an ADB bit on PMU machines */
  333. /* according to MkLinux. -- jmt */
  334. via2[gBufB] |= 0x02;
  335. }
  336. /*
  337. * Disable the slot interrupts. On some hardware that's not possible.
  338. * On some hardware it's unclear what all of these I/O lines do.
  339. */
  340. switch (macintosh_config->via_type) {
  341. case MAC_VIA_II:
  342. case MAC_VIA_QUADRA:
  343. pr_debug("VIA2 vDirA is 0x%02X\n", via2[vDirA]);
  344. break;
  345. case MAC_VIA_IICI:
  346. /* RBV. Disable all the slot interrupts. SIER works like IER. */
  347. via2[rSIER] = 0x7F;
  348. break;
  349. }
  350. }
  351. void via_nubus_irq_startup(int irq)
  352. {
  353. int irq_idx = IRQ_IDX(irq);
  354. switch (macintosh_config->via_type) {
  355. case MAC_VIA_II:
  356. case MAC_VIA_QUADRA:
  357. /* Make the port A line an input. Probably redundant. */
  358. if (macintosh_config->via_type == MAC_VIA_II) {
  359. /* The top two bits are RAM size outputs. */
  360. via2[vDirA] &= 0xC0 | ~(1 << irq_idx);
  361. } else {
  362. /* Allow NuBus slots 9 through F. */
  363. via2[vDirA] &= 0x80 | ~(1 << irq_idx);
  364. }
  365. /* fall through */
  366. case MAC_VIA_IICI:
  367. via_irq_enable(irq);
  368. break;
  369. }
  370. }
  371. void via_nubus_irq_shutdown(int irq)
  372. {
  373. switch (macintosh_config->via_type) {
  374. case MAC_VIA_II:
  375. case MAC_VIA_QUADRA:
  376. /* Ensure that the umbrella CA1 interrupt remains enabled. */
  377. via_irq_enable(irq);
  378. break;
  379. case MAC_VIA_IICI:
  380. via_irq_disable(irq);
  381. break;
  382. }
  383. }
  384. /*
  385. * The generic VIA interrupt routines (shamelessly stolen from Alan Cox's
  386. * via6522.c :-), disable/pending masks added.
  387. */
  388. void via1_irq(struct irq_desc *desc)
  389. {
  390. int irq_num;
  391. unsigned char irq_bit, events;
  392. events = via1[vIFR] & via1[vIER] & 0x7F;
  393. if (!events)
  394. return;
  395. irq_num = VIA1_SOURCE_BASE;
  396. irq_bit = 1;
  397. do {
  398. if (events & irq_bit) {
  399. via1[vIFR] = irq_bit;
  400. generic_handle_irq(irq_num);
  401. }
  402. ++irq_num;
  403. irq_bit <<= 1;
  404. } while (events >= irq_bit);
  405. }
  406. static void via2_irq(struct irq_desc *desc)
  407. {
  408. int irq_num;
  409. unsigned char irq_bit, events;
  410. events = via2[gIFR] & via2[gIER] & 0x7F;
  411. if (!events)
  412. return;
  413. irq_num = VIA2_SOURCE_BASE;
  414. irq_bit = 1;
  415. do {
  416. if (events & irq_bit) {
  417. via2[gIFR] = irq_bit | rbv_clear;
  418. generic_handle_irq(irq_num);
  419. }
  420. ++irq_num;
  421. irq_bit <<= 1;
  422. } while (events >= irq_bit);
  423. }
  424. /*
  425. * Dispatch Nubus interrupts. We are called as a secondary dispatch by the
  426. * VIA2 dispatcher as a fast interrupt handler.
  427. */
  428. static void via_nubus_irq(struct irq_desc *desc)
  429. {
  430. int slot_irq;
  431. unsigned char slot_bit, events;
  432. events = ~via2[gBufA] & 0x7F;
  433. if (rbv_present)
  434. events &= via2[rSIER];
  435. else
  436. events &= ~via2[vDirA];
  437. if (!events)
  438. return;
  439. do {
  440. slot_irq = IRQ_NUBUS_F;
  441. slot_bit = 0x40;
  442. do {
  443. if (events & slot_bit) {
  444. events &= ~slot_bit;
  445. generic_handle_irq(slot_irq);
  446. }
  447. --slot_irq;
  448. slot_bit >>= 1;
  449. } while (events);
  450. /* clear the CA1 interrupt and make certain there's no more. */
  451. via2[gIFR] = 0x02 | rbv_clear;
  452. events = ~via2[gBufA] & 0x7F;
  453. if (rbv_present)
  454. events &= via2[rSIER];
  455. else
  456. events &= ~via2[vDirA];
  457. } while (events);
  458. }
  459. /*
  460. * Register the interrupt dispatchers for VIA or RBV machines only.
  461. */
  462. void __init via_register_interrupts(void)
  463. {
  464. if (via_alt_mapping) {
  465. /* software interrupt */
  466. irq_set_chained_handler(IRQ_AUTO_1, via1_irq);
  467. /* via1 interrupt */
  468. irq_set_chained_handler(IRQ_AUTO_6, via1_irq);
  469. } else {
  470. irq_set_chained_handler(IRQ_AUTO_1, via1_irq);
  471. }
  472. irq_set_chained_handler(IRQ_AUTO_2, via2_irq);
  473. irq_set_chained_handler(IRQ_MAC_NUBUS, via_nubus_irq);
  474. }
  475. void via_irq_enable(int irq) {
  476. int irq_src = IRQ_SRC(irq);
  477. int irq_idx = IRQ_IDX(irq);
  478. #ifdef DEBUG_IRQUSE
  479. printk(KERN_DEBUG "via_irq_enable(%d)\n", irq);
  480. #endif
  481. if (irq_src == 1) {
  482. via1[vIER] = IER_SET_BIT(irq_idx);
  483. } else if (irq_src == 2) {
  484. if (irq != IRQ_MAC_NUBUS || nubus_disabled == 0)
  485. via2[gIER] = IER_SET_BIT(irq_idx);
  486. } else if (irq_src == 7) {
  487. switch (macintosh_config->via_type) {
  488. case MAC_VIA_II:
  489. case MAC_VIA_QUADRA:
  490. nubus_disabled &= ~(1 << irq_idx);
  491. /* Enable the CA1 interrupt when no slot is disabled. */
  492. if (!nubus_disabled)
  493. via2[gIER] = IER_SET_BIT(1);
  494. break;
  495. case MAC_VIA_IICI:
  496. /* On RBV, enable the slot interrupt.
  497. * SIER works like IER.
  498. */
  499. via2[rSIER] = IER_SET_BIT(irq_idx);
  500. break;
  501. }
  502. }
  503. }
  504. void via_irq_disable(int irq) {
  505. int irq_src = IRQ_SRC(irq);
  506. int irq_idx = IRQ_IDX(irq);
  507. #ifdef DEBUG_IRQUSE
  508. printk(KERN_DEBUG "via_irq_disable(%d)\n", irq);
  509. #endif
  510. if (irq_src == 1) {
  511. via1[vIER] = IER_CLR_BIT(irq_idx);
  512. } else if (irq_src == 2) {
  513. via2[gIER] = IER_CLR_BIT(irq_idx);
  514. } else if (irq_src == 7) {
  515. switch (macintosh_config->via_type) {
  516. case MAC_VIA_II:
  517. case MAC_VIA_QUADRA:
  518. nubus_disabled |= 1 << irq_idx;
  519. if (nubus_disabled)
  520. via2[gIER] = IER_CLR_BIT(1);
  521. break;
  522. case MAC_VIA_IICI:
  523. via2[rSIER] = IER_CLR_BIT(irq_idx);
  524. break;
  525. }
  526. }
  527. }
  528. void via1_set_head(int head)
  529. {
  530. if (head == 0)
  531. via1[vBufA] &= ~VIA1A_vHeadSel;
  532. else
  533. via1[vBufA] |= VIA1A_vHeadSel;
  534. }
  535. EXPORT_SYMBOL(via1_set_head);
  536. int via2_scsi_drq_pending(void)
  537. {
  538. return via2[gIFR] & (1 << IRQ_IDX(IRQ_MAC_SCSIDRQ));
  539. }
  540. EXPORT_SYMBOL(via2_scsi_drq_pending);