// SPDX-License-Identifier: GPL-2.0 /* * linux/arch/alpha/kernel/core_t2.c * * Written by Jay A Estabrook (jestabro@amt.tay1.dec.com). * December 1996. * * based on CIA code by David A Rusling (david.rusling@reo.mts.dec.com) * * Code common to all T2 core logic chips.
*/
/* For dumping final DMA window settings. */ #define DEBUG_PRINT_FINAL_SETTINGS 0
/* * By default, we direct-map starting at 2GB, in order to allow the * maximum size direct-map window (2GB) to match the maximum amount of * memory (2GB) that can be present on SABLEs. But that limits the * floppy to DMA only via the scatter/gather window set up for 8MB * ISA DMA, since the maximum ISA DMA address is 2GB-1. * * For now, this seems a reasonable trade-off: even though most SABLEs * have less than 1GB of memory, floppy usage/performance will not * really be affected by forcing it to go via scatter/gather...
*/ #define T2_DIRECTMAP_2G 1
/* The ISA scatter/gather window settings. */ #define T2_ISA_SG_START 0x00800000UL #define T2_ISA_SG_LENGTH 0x00800000UL
/* * NOTE: Herein lie back-to-back mb instructions. They are magic. * One plausible explanation is that the i/o controller does not properly * handle the system transaction. Another involves timing. Ho hum.
*/
/* Place to save the DMA Window registers as set up by SRM
for restoration during shutdown. */ staticstruct
{ struct { unsignedlong wbase; unsignedlong wmask; unsignedlong tbase;
} window[2]; unsignedlong hae_1; unsignedlong hae_2; unsignedlong hae_3; unsignedlong hae_4; unsignedlong hbase;
} t2_saved_config __attribute((common));
/* * Given a bus, device, and function number, compute resulting * configuration space address and setup the T2_HAXR2 register * accordingly. It is therefore not safe to have concurrent * invocations to configuration space access routines, but there * really shouldn't be any need for this. * * Type 0: * * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | |D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|0| * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * 31:11 Device select bit. * 10:8 Function number * 7:2 Register number * * Type 1: * * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | | | | | | | | | | |B|B|B|B|B|B|B|B|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|1| * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * 31:24 reserved * 23:16 bus number (8 bits = 128 possible buses) * 15:11 Device number (5 bits) * 10:8 function number * 7:2 register number * * Notes: * The function number selects which function of a multi-function device * (e.g., SCSI and Ethernet). * * The register selects a DWORD (32 bit) register offset. Hence it * doesn't get shifted by 2 bits as we want to "drop" the bottom two * bits.
*/
staticint
mk_conf_addr(struct pci_bus *pbus, unsignedint device_fn, int where, unsignedlong *pci_addr, unsignedchar *type1)
{ unsignedlong addr;
u8 bus = pbus->number;
/* * NOTE: both conf_read() and conf_write() may set HAE_3 when needing * to do type1 access. This is protected by the use of spinlock IRQ * primitives in the wrapper functions pci_{read,write}_config_*() * defined in drivers/pci/pci.c.
*/ staticunsignedint
conf_read(unsignedlong addr, unsignedchar type1)
{ unsignedint value, cpu, taken; unsignedlong t2_cfg = 0;
/* Wait for possible mcheck. Also, this lets other CPUs clear their mchecks as well, as they can reliably tell when another CPU is in the midst of handling a real mcheck via
the "taken" function. */
udelay(100);
/* Wait for possible mcheck. Also, this lets other CPUs clear their mchecks as well, as they can reliably tell when this CPU is in the midst of handling a real mcheck via
the "taken" function. */
udelay(100);
/* Note we can only do 1 SG window, as the other is for direct, so
do an ISA SG area, especially for the floppy. */
hose->sg_isa = iommu_arena_new(hose, base, length, SMP_CACHE_BYTES);
hose->sg_pci = NULL;
/* Always make an ISA DMA window. */
t2_sg_map_window2(hose, T2_ISA_SG_START, T2_ISA_SG_LENGTH);
*(vulp)T2_HBASE = 0x0; /* Disable HOLES. */
/* Zero HAE. */
*(vulp)T2_HAE_1 = 0; mb(); /* Sparse MEM HAE */
*(vulp)T2_HAE_2 = 0; mb(); /* Sparse I/O HAE */
*(vulp)T2_HAE_3 = 0; mb(); /* Config Space HAE */
/* * We also now zero out HAE_4, the dense memory HAE, so that * we need not account for its "offset" when accessing dense * memory resources which we allocated in our normal way. This * HAE would need to stay untouched were we to keep the SRM * resource settings. * * Thus we can now run standard X servers on SABLE/LYNX. :-)
*/
*(vulp)T2_HAE_4 = 0; mb();
}
/* * SABLE seems to have a "broadcast" style machine check, in that all * CPUs receive it. And, the issuing CPU, in the case of PCI Config * space read/write faults, will also receive a second mcheck, upon * lowering IPL during completion processing in pci_read_config_byte() * et al. * * Hence all the taken/expected/any_expected/last_taken stuff...
*/ void
t2_machine_check(unsignedlong vector, unsignedlong la_ptr)
{ int cpu = smp_processor_id(); #ifdef CONFIG_VERBOSE_MCHECK struct el_common *mchk_header = (struct el_common *)la_ptr; #endif
/* Clear the error before any reporting. */
mb();
mb(); /* magic */
draina();
t2_clear_errors(cpu);
/* This should not actually be done until the logout frame is
examined, but, since we don't do that, go on and do this... */
wrmces(0x7);
mb();
/* Now, do testing for the anomalous conditions. */ if (!mcheck_expected(cpu) && t2_mcheck_any_expected) { /* * FUNKY: Received mcheck on a CPU and not * expecting it, but another CPU is expecting one. * * Just dismiss it for now on this CPU...
*/ #ifdef CONFIG_VERBOSE_MCHECK if (alpha_verbose_mcheck > 1) {
printk("t2_machine_check(cpu%d): any_expected 0x%x -" " (assumed) spurious -" " code 0x%x\n", cpu, t2_mcheck_any_expected,
(unsignedint)mchk_header->code);
} #endif return;
}
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.