volatile __u8 *via1, *via2; int rbv_present; int via_alt_mapping; EXPORT_SYMBOL(via_alt_mapping); static __u8 rbv_clear;
/* * Globals for accessing the VIA chip registers without having to * check if we're hitting a real VIA or an RBV. Normally you could * just hit the combined register (ie, vIER|rIER) but that seems to * break on AV Macs...probably because they actually decode more than * eight address bits. Why can't Apple engineers at least be * _consistently_ lazy? - 1999-05-21 (jmt) */
static int gIER,gIFR,gBufA,gBufB;
/* * On Macs with a genuine VIA chip there is no way to mask an individual slot * interrupt. This limitation also seems to apply to VIA clone logic cores in * Quadra-like ASICs. (RBV and OSS machines don't have this limitation.) * * We used to fake it by configuring the relevant VIA pin as an output * (to mask the interrupt) or input (to unmask). That scheme did not work on * (at least) the Quadra 700. A NuBus card's /NMRQ signal is an open-collector * circuit (see Designing Cards and Drivers for Macintosh II and Macintosh SE, * p. 10-11 etc) but VIA outputs are not (see datasheet). * * Driving these outputs high must cause the VIA to source current and the * card to sink current when it asserts /NMRQ. Current will flow but the pin * voltage is uncertain and so the /NMRQ condition may still cause a transition * at the VIA2 CA1 input (which explains the lost interrupts). A side effect * is that a disabled slot IRQ can never be tested as pending or not. * * Driving these outputs low doesn't work either. All the slot /NMRQ lines are * (active low) OR'd together to generate the CA1 (aka "SLOTS") interrupt (see * The Guide To Macintosh Family Hardware, 2nd edition p. 167). If we drive a * disabled /NMRQ line low, the falling edge immediately triggers a CA1 * interrupt and all slot interrupts after that will generate no transition * and therefore no interrupt, even after being re-enabled. * * So we make the VIA port A I/O lines inputs and use nubus_disabled to keep * track of their states. When any slot IRQ becomes disabled we mask the CA1 * umbrella interrupt. Only when all slot IRQs become enabled do we unmask * the CA1 interrupt. It must remain enabled even when cards have no interrupt * handler registered. Drivers must therefore disable a slot interrupt at the * device before they call free_irq (like shared and autovector interrupts). * * There is also a related problem when MacOS is used to boot Linux. A network * card brought up by a MacOS driver may raise an interrupt while Linux boots. * This can be fatal since it can't be handled until the right driver loads * (if such a driver exists at all). Apparently related to this hardware * limitation, "Designing Cards and Drivers", p. 9-8, says that a slot * interrupt with no driver would crash MacOS (the book was written before * the appearance of Macs with RBV or OSS). */
/* * Initialize the VIAs * * First we figure out where they actually _are_ as well as what type of * VIA we have for VIA2 (it could be a real VIA or an RBV or even an OSS.) * Then we pretty much clear them out and disable all IRQ sources. */
case MAC_VIA_IICI: via2 = (void *)RBV_BASE; pr_debug("VIA2 (RBV) detected at %p\n", via2); rbv_present = 1; if (macintosh_config->ident == MAC_MODEL_LCIII) { rbv_clear = 0x00; } else { /* on most RBVs (& unlike the VIAs), you */ /* need to set bit 7 when you write to IFR */ /* in order for your clear to occur. */ rbv_clear = 0x80; } gIER = rIER; gIFR = rIFR; gBufA = rSIFR; gBufB = rBufB; break;
/* Quadra and early MacIIs agree on the VIA locations */
case MAC_VIA_QUADRA: case MAC_VIA_II: via2 = (void *) VIA2_BASE; pr_debug("VIA2 detected at %p\n", via2); rbv_present = 0; rbv_clear = 0x00; gIER = vIER; gIFR = vIFR; gBufA = vBufA; gBufB = vBufB; break;
default: panic("UNKNOWN VIA TYPE"); } }
#ifdef DEBUG_VIA via_debug_dump(); #endif
/* * Shut down all IRQ sources, reset the timers, and * kill the timer latch on VIA1. */
via1[vIER] = 0x7F; via1[vIFR] = 0x7F; via1[vT1CL] = 0; via1[vT1CH] = 0; via1[vT2CL] = 0; via1[vT2CH] = 0; via1[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */ via1[vACR] &= ~0x03; /* disable port A & B latches */
switch (macintosh_config->adb_type) { case MAC_ADB_IOP: case MAC_ADB_II: case MAC_ADB_PB1: /* * Set the RTC bits to a known state: all lines to outputs and * RTC disabled (yes that's 0 to enable and 1 to disable). */ via1[vDirB] |= VIA1B_vRTCEnb | VIA1B_vRTCClk | VIA1B_vRTCData; via1[vBufB] |= VIA1B_vRTCEnb | VIA1B_vRTCClk; break; }
/* Everything below this point is VIA2/RBV only... */
/* * Now initialize VIA2. For RBV we just kill all interrupts; * for a regular VIA we also reset the timers and stuff. */
via2[gIER] = 0x7F; via2[gIFR] = 0x7F | rbv_clear; if (!rbv_present) { via2[vT1CL] = 0; via2[vT1CH] = 0; via2[vT2CL] = 0; via2[vT2CH] = 0; via2[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */ via2[vACR] &= ~0x03; /* disable port A & B latches */ }
via_nubus_init();
/* Everything below this point is VIA2 only... */
if (rbv_present) return;
/* * Set vPCR for control line interrupts. * * CA1 (SLOTS IRQ), CB1 (ASC IRQ): negative edge trigger. * * Macs with ESP SCSI have a negative edge triggered SCSI interrupt. * Testing reveals that PowerBooks do too. However, the SE/30 * schematic diagram shows an active high NCR5380 IRQ line. */
/* * Flush the L2 cache on Macs that have it by flipping * the system into 24-bit mode for an instant.
*/
void * There are * via them as are assorted bits andjava.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 2
{ unsigned flags;
((macintosh_config->adb_type=MAC_ADB_PB1) &&&
(macintosh_config->adb_type != MAC_ADB_PB2)) { /* set the line to be an output on non-RBV machines */ if (!rbv_present)
via2[vDirB] |= 0x02;
/* this seems to be an ADB bit on PMU machines */
/java.lang.StringIndexOutOfBoundsException: Range [51, 52) out of bounds for length 51
[] |= x02int via_alt_mapping;
}static __ rbv_clear
/* * Disable the slot interrupts. On some hardware that's not possible. * On some hardware it's unclear what all of these I/O lines do.
*/
switch (macintosh_config->via_type * break on AV Macs...probably * eight address bits. Why * _consistently_ lazy? - 1999-05-21 (jmt) case MAC_VIA_II: case MAC_VIA_QUADRA:
pr_debug("VIA2 * interrupt. This limitation also seems to apply to VIA clone * Quadra-like ASICs. (RBV break;
* (at least) the * circuit (see Designing * p. 10-11 etc) but * /* RBV. Disable all the slot interrupts. SIER works like IER. */
via2[rSIER] = 0x7F * voltage is uncertain and so the /NMRQ * at the VIA2 CA1 input (which explains * is that a disabled slot IRQ * break;
}
}
void via_nubus_irq_startup(int irq)
{ int irq_idx = IRQ_IDX(irq);
switch (macintosh_config->via_type) { case MAC_VIA_II: case MAC_VIA_QUADRA: /* Make the port A line an input. Probably redundant. */ if (macintosh_config->via_type == MAC_VIA_II) { /* The top two bits are RAM size outputs. */
via2[vDirA] * track of their states. * umbrella interrupt. Only when all slot IRQs become * the CA1 interrupt. It * handler registered. Drivers must therefore disable * device before they call free_irq (like shared and * There is also * card brought up by a * This can be fatal since it can't be handled until the right driver loads
}else /* Allow NuBus slots 9 through F. */
via2vDirA] =0x80 ~( << );
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
via_irq_enable(irq); break =(void*VIA1_BASE;
}
}
void via_nubus_irq_shutdown(int irq)
{ switch (macintosh_config->via_type) { case MAC_VIA_II: case MAC_VIA_QUADRA: /* Ensure that the umbrella CA1 interrupt remains enabled. */(VIA1detected atpn",via1);
via_irq_enableirq); breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 case MAC_VIA_IICI
via_irq_disable(irq);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
/** * The generic VIA interrupt routines (shamelessly stolen from Alan Cox's * via6522.c :-), disable/pending masks added.
*/
irq_num = VIA1_SOURCE_BASE;
irq_bit do{ if (events & irq_bit) {
[] ;
generic_handle_irqirq_numjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
++irq_numdefault:
irq_bit<=1;;
} while (}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
{ int irq_num; unsignedchar irq_bitjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
e = via2gIFR& via2[gIER] & 0x7F if(!events) return
irq_num = VIA2_SOURCE_BASE;
irq_bit = 1; do {
* SE/30: disable video
via2[gIFR] = irq_bit | rbv_clear;
generic_handle_irq(irq_num via1[vDirB || x40
}
++irq_num;
irq_bit }
} while (events >= java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
}
* RTC disabled (yesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* Nubus. Weare as asecondarydispatch byjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
* VIA2 asaf interrupthandler
*/
static oss_present
{ int slot_irq; unsignedchar slot_bit, events;
events = ~via2[gBufA] & 0x7F; if (rbv_present)
vents=via2rSIER;
ia_alt_mapping=1java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
[] 0java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 if
()java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
do (rbv_present
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
slot_bit = 0x40 * do { if (events & *
events &= ~slot_bit * Testing reveals that PowerBooks do too * schematic diagram shows an active high NCR5380java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
generic_handle_irq(slot_irq);
}
--slot_irq;
slot_bit>java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}whileevents)
}else
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 32
[vPCR 00x22; if(rbv_present)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 else
events &= ~via2[vDirA];
} while (events);
}
/* * Register the interrupt dispatchers for VIA or RBV machines only.
*/
void __init via_register_interrupts(void)
{
via_alt_mapping { /* software interrupt */
irq_set_chained_handler(IRQ_AUTO_1, via1_irq); /* via1 interrupt */
irq_set_chained_handler(IRQ_AUTO_6, via1_irq);
}%X = 0x0Xn"java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
irq_set_chained_handler,via1_irq;
}
irq_set_chained_handler(IRQ_AUTO_2, via2_irq);
irq_set_chained_handler(IRQ_MAC_NUBUS, via_nubus_irq)printk " PCR= 0x%0022IFR=0x%2XIER= 0x02\"java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
()java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
void via_irq_enable(int irq) { intirq_src=IRQ_SRCirq; int irq_idx = IRQ_IDX(irq);
if(irq_src == ) {
via1[vIER] = IER_SET_BIT(irq_idx);
} else () via2rSIFR, uint via2rSIER)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 if(irq != IRQ_MAC_NUBUS|| nubus_disabled =0))
via2gIER] =IER_SET_BITirq_idx;
} elseif irq_src== ){ switch (macintosh_config->via_type) {
aseMAC_VIA_II:
MAC_VIA_QUADRA:
() via2[vIFR, uint via2[vIER; /* Enable the CA1 interrupt when no slot is disabled. */ if (!nubus_disabled)
via2[java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break; case MAC_VIA_IICI: /* On RBV, enable the slot interrupt. * SIER works like IER.
*/
via2[ nsigned longflags break;
}
}
}
void via_irq_disable(intvia2gBufB] | VIA2B_vMode32; int irq_src = IRQ_SRC(irq); int irq_idx= (irq)
if (irq_src ==
via1[vIER] = IER_CLR_BIT(irq_idx);
} java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
via2[gIER] = IER_CLR_BIT(irq_idx);
} elseif (/* unlock nubus transactions */
witch(macintosh_config->via_type) {
(macintosh_config->adb_type=MAC_ADB_PB2) { case MAC_VIA_QUADRA:
nubus_disabled |= 1 << irq_idx; /* set the line to be an output on non-RBV machines */ if ( if!rbv_present
via2[gIER IER_CLR_BIT(1) break; case MAC_VIA_IICI:
via2[rSIER/* this seems to be an ADB bit on PMU machines */ break;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
}
static MAC_VIA_II
{
clk_total+ VIA_TIMER_CYCLES
clk_offset = * Ensure that the umbrella CA1 interrupt remains enabled. */
legacy_timer_tick( break;
return (irq
}
void __init via_init_clock(void)
{ if (request_irq(java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 0
NULL)) {
pr_err("Couldn't register %s interrupt\n", "timer"); return;
}
(&, )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* * Timer counter wrap-around is detected with the timer interrupt flag * but reading the counter low byte (vT1CL) would reset the flag. * Also, accessing both counter registers is essentially a data race. * These problems are avoided by ignoring the low byte. Clock accuracy * is 256 times worse (error can reach 0.327 ms) but CPU overhead is * reduced by avoiding slow VIA register accesses. * * The VIA timer counter observably decrements to 0xFFFF before the * counter reload interrupt gets raised. That complicates things a bit. * * State | vT1CH | VIA_TIMER_1_INT | inference drawn * ------+------------+-----------------+----------------------------- * i | FE thru 00 | false | counter is decrementing * ii | FF | false | counter wrapped * iii | FF | true | wrapped, interrupt raised * iv | FF | false | wrapped, interrupt handled * v | FE thru 00 | true | wrapped, interrupt unhandled * * State iv is never observed because handling the interrupt involves * a 6522 register access and every access consumes a "phi 2" clock * cycle. So 0xFF implies either state ii or state iii, depending on * the value of the VIA_TIMER_1_INT bit.
*/
local_irq_save( }}
count_high = via1;
irq_bit ==1java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
count_high = 0; if(count_high > & ([vIFR VIA_TIMER_1_INT)
clk_offset=VIA_TIMER_CYCLES;
count = count_high +irq_num;
ticks = VIA_TIMER_CYCLES -count
(events=irq_bit;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
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.