/*
* Copyright (c) 2001 Rafal K. Boni
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (isc.eisa_present)
printf(", EISA bus present");
printf("\n");
/* Clear CPU/GIO error status registers to clear any leftover bits. */
imc_bus_reset();
/* Hook the bus error handler into the ISR */
platform.intr4 = imc_bus_error;
/*
* Enable parity reporting on GIO/main memory transactions.
* Disable parity checking on CPU bus transactions (as turning
* it on seems to cause spurious bus errors), but enable parity
* checking on CPU reads from main memory (note that this bit
* has the opposite sense... Turning it on turns the checks off!).
* Finally, turn on interrupt writes to the CPU from the MC.
*/
reg = bus_space_read_4(isc.iot, isc.ioh, IMC_CPUCTRL0);
reg &= ~IMC_CPUCTRL0_NCHKMEMPAR;
reg |= (IMC_CPUCTRL0_GPR | IMC_CPUCTRL0_MPR | IMC_CPUCTRL0_INTENA);
bus_space_write_4(isc.iot, isc.ioh, IMC_CPUCTRL0, reg);
/* Setup the MC write buffer depth */
reg = bus_space_read_4(isc.iot, isc.ioh, IMC_CPUCTRL1);
reg = (reg & ~IMC_CPUCTRL1_MCHWMSK) | 13;
/*
* Force endianness on the onboard HPC and both slots.
* This should be safe for Fullhouse, but leave it conditional
* for now.
*/
if (mach_type == MACH_SGI_IP20 || (mach_type == MACH_SGI_IP22 &&
mach_subtype == MACH_SGI_IP22_GUINNESS)) {
reg |= IMC_CPUCTRL1_HPCFX;
reg |= IMC_CPUCTRL1_EXP0FX;
reg |= IMC_CPUCTRL1_EXP1FX;
reg &= ~IMC_CPUCTRL1_HPCLITTLE;
reg &= ~IMC_CPUCTRL1_EXP0LITTLE;
reg &= ~IMC_CPUCTRL1_EXP1LITTLE;
}
bus_space_write_4(isc.iot, isc.ioh, IMC_CPUCTRL1, reg);
/*
* Set GIO64 arbitrator configuration register:
*
* Preserve PROM-set graphics-related bits, as they seem to depend
* on the graphics variant present and I'm not sure how to figure
* that out or 100% sure what the correct settings are for each.
*/
reg = bus_space_read_4(isc.iot, isc.ioh, IMC_GIO64ARB);
reg &= (IMC_GIO64ARB_GRX64 | IMC_GIO64ARB_GRXRT | IMC_GIO64ARB_GRXMST);
/* EISA can bus-master, is 64-bit */
reg |= (IMC_GIO64ARB_EISAMST | IMC_GIO64ARB_EISA64);
break;
case MACH_SGI_IP22_FULLHOUSE:
/*
* All Fullhouse boards have a 64-bit HPC2 and pipelined
* EXP0 slot.
*/
reg |= (IMC_GIO64ARB_HPCEXP64 | IMC_GIO64ARB_EXP0PIPE);
/* intended to be called from gio/gio.c only */
int
imc_gio64_arb_config(int slot, uint32_t flags)
{
uint32_t reg;
/* GIO_SLOT_EXP1 is unusable on Fullhouse */
if (slot == GIO_SLOT_EXP1 && mach_subtype == MACH_SGI_IP22_FULLHOUSE)
return EINVAL;
/* GIO_SLOT_GFX is only usable on Fullhouse */
if (slot == GIO_SLOT_GFX && mach_subtype != MACH_SGI_IP22_FULLHOUSE)
return EINVAL;
/* GIO_SLOT_GFX is always pipelined */
if (slot == GIO_SLOT_GFX && (flags & GIO_ARB_NOPIPE))
return EINVAL;
/* IP20 does not support pipelining (XXX what about Indy?) */
if (((flags & GIO_ARB_PIPE) || (flags & GIO_ARB_NOPIPE)) &&
mach_type == MACH_SGI_IP20)
return EINVAL;
/*
* According to chapter 19 of the "IRIX Device Driver Programmer's Guide",
* some GIO devices, which do not drive all data lines, may cause false
* memory read parity errors on the SysAD bus. The workaround is to disable
* parity checking.
*/
void
imc_disable_sysad_parity(void)
{
uint32_t reg;
if (mach_type != MACH_SGI_IP20 && mach_type != MACH_SGI_IP22)
return;