From e611b132f9b8abe35b362e5870b74bce94a1e58e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 May 2020 20:51:50 -0700 Subject: initial commit --- private/ntos/nthals/haleb66/alpha/28f008sa.c | 1 + private/ntos/nthals/haleb66/alpha/29f040.c | 1 + private/ntos/nthals/haleb66/alpha/addrsup.c | 636 ++++++++++++++++++++++ private/ntos/nthals/haleb66/alpha/adjust.c | 7 + private/ntos/nthals/haleb66/alpha/allstart.c | 7 + private/ntos/nthals/haleb66/alpha/alphaio.s | 7 + private/ntos/nthals/haleb66/alpha/bios.c | 7 + private/ntos/nthals/haleb66/alpha/busdata.c | 127 +++++ private/ntos/nthals/haleb66/alpha/cache.c | 7 + private/ntos/nthals/haleb66/alpha/chipset.h | 1 + private/ntos/nthals/haleb66/alpha/cmos8k.c | 5 + private/ntos/nthals/haleb66/alpha/eb66def.h | 94 ++++ private/ntos/nthals/haleb66/alpha/ebenv.c | 61 +++ private/ntos/nthals/haleb66/alpha/ebinitnt.c | 784 +++++++++++++++++++++++++++ private/ntos/nthals/haleb66/alpha/ebintr.s | 123 +++++ private/ntos/nthals/haleb66/alpha/ebintsup.c | 612 +++++++++++++++++++++ private/ntos/nthals/haleb66/alpha/ebmapio.c | 158 ++++++ private/ntos/nthals/haleb66/alpha/ebsgdma.c | 7 + private/ntos/nthals/haleb66/alpha/ebsysint.c | 424 +++++++++++++++ private/ntos/nthals/haleb66/alpha/eisasup.c | 7 + private/ntos/nthals/haleb66/alpha/environ.c | 7 + private/ntos/nthals/haleb66/alpha/ev4cache.c | 7 + private/ntos/nthals/haleb66/alpha/ev4int.c | 7 + private/ntos/nthals/haleb66/alpha/ev4ints.s | 6 + private/ntos/nthals/haleb66/alpha/ev4mem.s | 7 + private/ntos/nthals/haleb66/alpha/ev4parit.c | 7 + private/ntos/nthals/haleb66/alpha/ev4prof.c | 7 + private/ntos/nthals/haleb66/alpha/flash8k.c | 5 + private/ntos/nthals/haleb66/alpha/flashdrv.c | 23 + private/ntos/nthals/haleb66/alpha/fwreturn.c | 7 + private/ntos/nthals/haleb66/alpha/haldebug.c | 7 + private/ntos/nthals/haleb66/alpha/halpal.s | 7 + private/ntos/nthals/haleb66/alpha/idle.s | 7 + private/ntos/nthals/haleb66/alpha/info.c | 7 + private/ntos/nthals/haleb66/alpha/inithal.c | 7 + private/ntos/nthals/haleb66/alpha/intsup.s | 7 + private/ntos/nthals/haleb66/alpha/ioproc.c | 7 + private/ntos/nthals/haleb66/alpha/iousage.c | 7 + private/ntos/nthals/haleb66/alpha/lca4.c | 7 + private/ntos/nthals/haleb66/alpha/lca4err.c | 7 + private/ntos/nthals/haleb66/alpha/lcaioacc.s | 7 + private/ntos/nthals/haleb66/alpha/machdep.h | 43 ++ private/ntos/nthals/haleb66/alpha/memory.c | 7 + private/ntos/nthals/haleb66/alpha/mustdef.h | 56 ++ private/ntos/nthals/haleb66/alpha/pcibus.c | 128 +++++ private/ntos/nthals/haleb66/alpha/pcisio.c | 7 + private/ntos/nthals/haleb66/alpha/pcisup.c | 7 + private/ntos/nthals/haleb66/alpha/pcrtc.c | 7 + private/ntos/nthals/haleb66/alpha/pcserial.c | 7 + private/ntos/nthals/haleb66/alpha/pcspeakr.c | 7 + private/ntos/nthals/haleb66/alpha/perfcntr.c | 7 + private/ntos/nthals/haleb66/alpha/pintolin.h | 192 +++++++ private/ntos/nthals/haleb66/alpha/vga.c | 7 + 53 files changed, 3711 insertions(+) create mode 100644 private/ntos/nthals/haleb66/alpha/28f008sa.c create mode 100644 private/ntos/nthals/haleb66/alpha/29f040.c create mode 100644 private/ntos/nthals/haleb66/alpha/addrsup.c create mode 100644 private/ntos/nthals/haleb66/alpha/adjust.c create mode 100644 private/ntos/nthals/haleb66/alpha/allstart.c create mode 100644 private/ntos/nthals/haleb66/alpha/alphaio.s create mode 100644 private/ntos/nthals/haleb66/alpha/bios.c create mode 100644 private/ntos/nthals/haleb66/alpha/busdata.c create mode 100644 private/ntos/nthals/haleb66/alpha/cache.c create mode 100644 private/ntos/nthals/haleb66/alpha/chipset.h create mode 100644 private/ntos/nthals/haleb66/alpha/cmos8k.c create mode 100644 private/ntos/nthals/haleb66/alpha/eb66def.h create mode 100644 private/ntos/nthals/haleb66/alpha/ebenv.c create mode 100644 private/ntos/nthals/haleb66/alpha/ebinitnt.c create mode 100644 private/ntos/nthals/haleb66/alpha/ebintr.s create mode 100644 private/ntos/nthals/haleb66/alpha/ebintsup.c create mode 100644 private/ntos/nthals/haleb66/alpha/ebmapio.c create mode 100644 private/ntos/nthals/haleb66/alpha/ebsgdma.c create mode 100644 private/ntos/nthals/haleb66/alpha/ebsysint.c create mode 100644 private/ntos/nthals/haleb66/alpha/eisasup.c create mode 100644 private/ntos/nthals/haleb66/alpha/environ.c create mode 100644 private/ntos/nthals/haleb66/alpha/ev4cache.c create mode 100644 private/ntos/nthals/haleb66/alpha/ev4int.c create mode 100644 private/ntos/nthals/haleb66/alpha/ev4ints.s create mode 100644 private/ntos/nthals/haleb66/alpha/ev4mem.s create mode 100644 private/ntos/nthals/haleb66/alpha/ev4parit.c create mode 100644 private/ntos/nthals/haleb66/alpha/ev4prof.c create mode 100644 private/ntos/nthals/haleb66/alpha/flash8k.c create mode 100644 private/ntos/nthals/haleb66/alpha/flashdrv.c create mode 100644 private/ntos/nthals/haleb66/alpha/fwreturn.c create mode 100644 private/ntos/nthals/haleb66/alpha/haldebug.c create mode 100644 private/ntos/nthals/haleb66/alpha/halpal.s create mode 100644 private/ntos/nthals/haleb66/alpha/idle.s create mode 100644 private/ntos/nthals/haleb66/alpha/info.c create mode 100644 private/ntos/nthals/haleb66/alpha/inithal.c create mode 100644 private/ntos/nthals/haleb66/alpha/intsup.s create mode 100644 private/ntos/nthals/haleb66/alpha/ioproc.c create mode 100644 private/ntos/nthals/haleb66/alpha/iousage.c create mode 100644 private/ntos/nthals/haleb66/alpha/lca4.c create mode 100644 private/ntos/nthals/haleb66/alpha/lca4err.c create mode 100644 private/ntos/nthals/haleb66/alpha/lcaioacc.s create mode 100644 private/ntos/nthals/haleb66/alpha/machdep.h create mode 100644 private/ntos/nthals/haleb66/alpha/memory.c create mode 100644 private/ntos/nthals/haleb66/alpha/mustdef.h create mode 100644 private/ntos/nthals/haleb66/alpha/pcibus.c create mode 100644 private/ntos/nthals/haleb66/alpha/pcisio.c create mode 100644 private/ntos/nthals/haleb66/alpha/pcisup.c create mode 100644 private/ntos/nthals/haleb66/alpha/pcrtc.c create mode 100644 private/ntos/nthals/haleb66/alpha/pcserial.c create mode 100644 private/ntos/nthals/haleb66/alpha/pcspeakr.c create mode 100644 private/ntos/nthals/haleb66/alpha/perfcntr.c create mode 100644 private/ntos/nthals/haleb66/alpha/pintolin.h create mode 100644 private/ntos/nthals/haleb66/alpha/vga.c (limited to 'private/ntos/nthals/haleb66/alpha') diff --git a/private/ntos/nthals/haleb66/alpha/28f008sa.c b/private/ntos/nthals/haleb66/alpha/28f008sa.c new file mode 100644 index 000000000..2865a2061 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/28f008sa.c @@ -0,0 +1 @@ +#include "../halalpha/28f008sa.c" diff --git a/private/ntos/nthals/haleb66/alpha/29f040.c b/private/ntos/nthals/haleb66/alpha/29f040.c new file mode 100644 index 000000000..2c2b423af --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/29f040.c @@ -0,0 +1 @@ +#include "../halalpha/29f040.c" diff --git a/private/ntos/nthals/haleb66/alpha/addrsup.c b/private/ntos/nthals/haleb66/alpha/addrsup.c new file mode 100644 index 000000000..a3db00941 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/addrsup.c @@ -0,0 +1,636 @@ +/*++ + +Copyright (c) 1993, 1994 Digital Equipment Corporation + +Module Name: + + addrsup.c + +Abstract: + + This module contains the platform dependent code to create bus addreses + and QVAs for the EB66 system. + +Author: + + Joe Notarangelo 22-Oct-1993 + +Environment: + + Kernel mode + +Revision History: + + Eric Rehm (Digital) 03-Jan-1994 + Added PCIBus(0) and dense space support to all routines. + +--*/ + +#include "halp.h" +#include "eisa.h" +#include "eb66def.h" + + +typedef PVOID QUASI_VIRTUAL_ADDRESS; + +#ifndef AXP_FIRMWARE +QUASI_VIRTUAL_ADDRESS +HalCreateQva( + IN PHYSICAL_ADDRESS PA, + IN PVOID VA + ); +#endif + +#ifdef AXP_FIRMWARE +// +// Place the appropriate functions in the discardable text section. +// + +// +// Local function prototypes +// + +PVOID +HalCreateQva( + IN PHYSICAL_ADDRESS PA, + IN PVOID VA + ); + +PVOID +HalDereferenceQva( + PVOID Qva, + INTERFACE_TYPE InterfaceType, + ULONG BusNumber + ); + +#pragma alloc_text(DISTEXT, HalpTranslateSystemBusAddress) +#pragma alloc_text(DISTEXT, HalCreateQva) +#pragma alloc_text(DISTEXT, HalDereferenceQva) + +#endif + + +BOOLEAN +HalpTranslateSystemBusAddress( + IN PBUS_HANDLER BusHandler, + IN PBUS_HANDLER RootHandler, + IN PHYSICAL_ADDRESS BusAddress, + IN OUT PULONG AddressSpace, + OUT PPHYSICAL_ADDRESS TranslatedAddress + ) + +/*++ + +Routine Description: + + This function returns the system physical address for a specified I/O bus + address. The return value is suitable for use in a subsequent call to + MmMapIoSpace. + +Arguments: + + BusHandler - Registered BUSHANDLER for the target configuration space + Supplies the bus handler (bus no, interface type). + + RootHandler - Registered BUSHANDLER for the orginating + HalTranslateBusAddress request. + + BusAddress - Supplies the bus relative address. + + AddressSpace - Supplies the address space number for the device: 0 for + memory and 1 for I/O space. If the desired access mode is user mode, + then bit 1 must be TRUE. + + TranslatedAddress - Supplies a pointer to return the translated address + + +Notes: + + This is a variation of what began in the MIPS code. The intel code often + assumes that if an address is in I/O space, the bottom 32 bits of the + physical address can be used "like" a virtual address, and are returned + to the user. This doesn't work on MIPs machines where physical + addresses can be larger than 32 bits. + + Since we are using superpage addresses for I/O on Alpha, we can do + almost what is done on intel. If AddressSpace is equal to 0 or 1, then + we assume the user is doing kernel I/O and we call + HalCreateQva to build a Quasi Virtual Address and return + that to the caller. We then set AddressSpace to a 1, so that the caller + will not call MmMapIoSpace. The Caller will use the low 32 bits of the + physical address we return as the VA. (Which we built a QVA in). + If the caller wants to access EISA I/O or Memory through user mode, then + the caller must set bit 1 in AddressSpace to a 1 (AddressSpace=2 or 3, + depending on whether EISA I/O or Memory), then the caller is returned the + 34 bit Physical address. The caller will then call MmMapIoSpace, or + ZwMapViewOfSection which in turn calls HalCreateQva to build a QVA out + of a VA mapped through the page tables. + + **** Note **** + + The QVA in user mode can only be used via the user-mode access macros. + + + +Return Value: + + A return value of TRUE indicates that a system physical address + corresponding to the supplied bus relative address and bus address + number has been returned in TranslatedAddress. + + A return value of FALSE occurs if the translation for the address was + not possible + +--*/ + +{ + INTERFACE_TYPE InterfaceType = BusHandler->InterfaceType; + ULONG BusNumber = BusHandler->BusNumber; + + PVOID va = 0; // note, this is used for a placeholder + + // + // The only buses available on EB66 are an ISA bus and a PCI bus. + // We support any translations for EISA devices as well, though + // if they are true EISA devices they won't even be able to plug into + // the connectors! + // + + if (InterfaceType != Isa && + InterfaceType != Eisa && + InterfaceType != PCIBus) { + + // + // Not on this system return nothing. + // + + *AddressSpace = 0; + TranslatedAddress->LowPart = 0; + return(FALSE); + } + + // + // Determine the address based on whether the bus address is in I/O space + // or bus memory space. + // + + switch ( (ADDRESS_SPACE_TYPE)(*AddressSpace) ) { + + case BusMemory: { + + // + // The address is in PCI memory space, kernel mode. + // + +//jnfix - HAE support here + switch( InterfaceType ) { + + case Isa: { + + // + // Can't go above 16MB (24 Bits) for Isa Buses + // + if( BusAddress.LowPart >= __16MB ){ + + *AddressSpace = 0; + TranslatedAddress->LowPart = 0; + return(FALSE); + + } + + break; + + } // case Isa + + case PCIBus: { + + // + // IMPORTANT: For now we have set HAE set to zero. + // + // MAX PCI sparse memory for us is PCI_MAX_SPARSE_MEMORY_ADDRESS=128MB-1 + // MAX PCI dense memory for us is PCI_MAX_DENSE_MEMORY_ADDRESS=2.5GB-1 + // + + if ( BusAddress.LowPart > PCI_MAX_DENSE_MEMORY_ADDRESS ) { + + // + // Unsupported dense PCI bus address. + // +#if HALDBG + DbgPrint ("Unsupported PCI address %x:%x\n", + BusAddress.HighPart, + BusAddress.LowPart); +#endif + *AddressSpace = 0; + TranslatedAddress->LowPart = 0; + return(FALSE); + } + else if( BusAddress.LowPart >= PCI_MIN_DENSE_MEMORY_ADDRESS && + BusAddress.LowPart <= PCI_MAX_DENSE_MEMORY_ADDRESS ) { + +#if HALDBG + DbgPrint ("Translating PCI kernel dense address %x:%x\n", + BusAddress.HighPart, + BusAddress.LowPart); +#endif + // + // Bus Address is in dense PCI memory space + // + + // + // QVA, as such, is simply the PCI bus address + // + + TranslatedAddress->LowPart = BusAddress.LowPart; + + // + // clear high longword for QVA + // + + TranslatedAddress->HighPart = 0; + + // + // dont let the user call MmMapIoSpace + // + + *AddressSpace = 1; + + return (TRUE); + + + } + + // + // Bus Address is in sparse PCI memory space + // + + +#if HALDBG + DbgPrint ("Translating PCI kernel sparse address %x:%x\n", + BusAddress.HighPart, + BusAddress.LowPart); +#endif + break; + } // case PCIBus + + case Eisa: { + break; + } // case Eisa + + } // switch( InterfaceType ) + // + // Start with the base physical address and add the + // bus address by converting it to the physical address. + // + + TranslatedAddress->QuadPart = LCA4_PCI_MEMORY_BASE_PHYSICAL; + TranslatedAddress->QuadPart += (BusAddress.LowPart << IO_BIT_SHIFT); + + // + // Now call HalCreateQva. This will create a QVA + // that we'll return to the caller. Then we will implicitly set + // AddressSpace to a 1. The caller then will not call MmMapIoSpace + // and will use the address we return as a VA. + // + + TranslatedAddress->LowPart = + (ULONG) HalCreateQva( *TranslatedAddress, va); + + // + // clear high longword for QVA + // + + TranslatedAddress->HighPart = 0; + + // + // don't let the user call MmMapIoSpace + // + + *AddressSpace = 1; + + return(TRUE); + + } // case BusMemory + + case BusIo: { + + // + // The address is in PCI I/O space, kernel mode. + // + switch( InterfaceType ) { + + case Isa: { + // + // Can't go above 64KB (16 Bits) for Isa Buses + // + if( BusAddress.LowPart >= __64K ){ + + *AddressSpace = 0; + TranslatedAddress->LowPart = 0; + return(FALSE); + + } + break; + } // case Isa + + case PCIBus: { + + // + // PCI IO space is always below 16MB (24 Bits) BusAddress + // If the address cannot be mapped, just return FALSE. + // + // IMPORTANT: For now we have set HAXR2 to 0(see ebinitnt.c) + // + if( BusAddress.LowPart >= __16MB ){ + + *AddressSpace = 0; + TranslatedAddress->LowPart = 0; + return(FALSE); + + } + // + // if the BusAddress.LowPart is > 64K then we use the HAER2 + // register. + // + break; + } // case PCIBus + + case Eisa: { + break; + } // case Eisa + + } // switch( InterfaceType ) + + // + // Start with the base physical address and add the + // bus address by converting it to the physical address. + // + + TranslatedAddress->QuadPart = HalpLca4PciIoPhysical(); + TranslatedAddress->QuadPart += (BusAddress.LowPart << IO_BIT_SHIFT); + + // + // Now call HalCreateQva. This will create a QVA + // that we'll return to the caller. Then we will implicitly set + // AddressSpace to a 1. The caller then will not call MmMapIoSpace + // and will use the address we return as a VA. + + TranslatedAddress->LowPart = (ULONG) HalCreateQva( *TranslatedAddress, + va); + + TranslatedAddress->HighPart = 0; // clear high longword for QVA + + *AddressSpace = 1; // Make sure user doesn't call + // MmMapIoSpace. + + return(TRUE); + + } + + case UserBusMemory: { + + // + // The address is in PCI sparse memory space, user mode. + // + + // + // Start with the base physical address and add the + // bus address by converting it to the physical address. + // + + TranslatedAddress->QuadPart = LCA4_PCI_MEMORY_BASE_PHYSICAL; + TranslatedAddress->QuadPart += (BusAddress.LowPart << IO_BIT_SHIFT); + + *AddressSpace = 0; // Let the user call MmMapIoSpace + + return(TRUE); + + } + + case UserBusIo: { + + // + // The address is in PCI I/O space, user mode. + // + + // + // Start with the base physical address and add the + // bus address by converting it to the physical address. + // + + TranslatedAddress->QuadPart = HalpLca4PciIoPhysical(); + TranslatedAddress->QuadPart += (BusAddress.LowPart << IO_BIT_SHIFT); + + *AddressSpace = 0; // Make sure user can call + // MmMapIoSpace. + + return(TRUE); + + } + + + case KernelPciDenseMemory: + case UserPciDenseMemory: + { + + // + // The address is in PCI memory space, user mode. + // + + // + // Dense space is not supported on Pass 1 LCA4s. + // + + if( HalpLca4Revision() == Lca4Pass1 ){ + + *AddressSpace = 0; + TranslatedAddress->LowPart = 0; + return FALSE; + + } + + // + // Start with the base physical address and add the + // bus address by converting it to the physical address. + // + + TranslatedAddress->QuadPart = HalpLca4PciDensePhysical(); + TranslatedAddress->QuadPart += BusAddress.LowPart; + + *AddressSpace = 0; // Let the user call MmMapIoSpace + + return(TRUE); + + } + + default: { + + // + // Unsupported address space. + + *AddressSpace = 0; + TranslatedAddress->LowPart = 0; + return(FALSE); + + } + + + } +} + +PVOID +HalCreateQva( + IN PHYSICAL_ADDRESS PA, + IN PVOID VA + ) + +/*++ + +Routine Description: + + This function is called two ways. First, from HalTranslateBusAddress, + if the caller is going to run in kernel mode and use superpages. + The second way is if the user is going to access in user mode. + MmMapIoSpace or ZwViewMapOfSection will call this. + + If the input parameter VA is zero, then we assume super page and build + a QUASI virtual address that is only usable by calling the hal I/O + access routines. + + if the input parameter VA is non-zero, we assume the user has either + called MmMapIoSpace or ZwMapViewOfSection and will use the user mode + access macros. + + If the PA is not a sparse I/O space address (PCI I/O, PCI Memory), + then return the VA as the QVA. + +Arguments: + + PA - the physical address generated by HalTranslateBusAddress + + VA - the virtual address returned by MmMapIoSpace + +Return Value: + + The returned value is a quasi virtual address in that it can be + added to and subtracted from, but it cannot be used to access the + bus directly. The top bits are set so that we can trap invalid + accesses in the memory management subsystem. All access should be + done through the Hal Access Routines in *ioacc.s if it was a superpage + kernel mode access. If it is usermode, then the user mode access + macros must be used. + +--*/ +{ + + PVOID qva; + + // + // If the physical address is not in dense space then perform the + // QVA shuffle. + // + // N.B. - Dense space is not supported for Lca4Pass1. + // + + if( (HalpLca4Revision() == Lca4Pass1) || + (PA.QuadPart < (LONGLONG)HalpLca4PciDensePhysical()) ){ + + // + // The physical address is within one of the sparse I/O spaces. + // + + if (VA == 0) { + + qva = (PVOID)(PA.QuadPart >> IO_BIT_SHIFT); + + } else { + + qva = (PVOID)((ULONG)VA >> IO_BIT_SHIFT); + } + + qva = (PVOID)((ULONG)qva | QVA_ENABLE); + + return(qva); + } + + // + // It is not a sparse I/O space address, return the VA as the QVA + // + + return(VA); + +} + +PVOID +HalDereferenceQva( + PVOID Qva, + INTERFACE_TYPE InterfaceType, + ULONG BusNumber + ) +/*++ + +Routine Description: + + This function performs the inverse of the HalCreateQva for I/O addresses + that are memory-mapped (i.e. the quasi-virtual address was created from + a virtual address rather than a physical address). + +Arguments: + + Qva - Supplies the quasi-virtual address to be converted back to a + virtual address. + + InterfaceType - Supplies the interface type of the bus to which the + Qva pertains. + + BusNumber - Supplies the bus number of the bus to which the Qva pertains. + +Return Value: + + The Virtual Address from which the quasi-address was originally created + is returned. + +--*/ +{ + + + // + // For EB66 we have only 2 bus types: + // + // Isa + // PCIBus + // + // We will allow Eisa as an alias for Isa. All other values not named + // above will be considered bogus. + // + + switch (InterfaceType ){ + + case Isa: + case Eisa: + case PCIBus: + + // + // Support dense space: check to see if it's really + // a sparse space QVA. + // + + if ( ((ULONG) Qva & QVA_SELECTORS) == QVA_ENABLE ) + { + return( (PVOID)( (ULONG)Qva << IO_BIT_SHIFT ) ); + } + else + { + return (Qva); + } + break; + + + default: + + return NULL; + + } + + +} diff --git a/private/ntos/nthals/haleb66/alpha/adjust.c b/private/ntos/nthals/haleb66/alpha/adjust.c new file mode 100644 index 000000000..47c267fb8 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/adjust.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\adjust.c" + diff --git a/private/ntos/nthals/haleb66/alpha/allstart.c b/private/ntos/nthals/haleb66/alpha/allstart.c new file mode 100644 index 000000000..42f70b7ca --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/allstart.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\allstart.c" + diff --git a/private/ntos/nthals/haleb66/alpha/alphaio.s b/private/ntos/nthals/haleb66/alpha/alphaio.s new file mode 100644 index 000000000..d2fe61a53 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/alphaio.s @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\alphaio.s" + diff --git a/private/ntos/nthals/haleb66/alpha/bios.c b/private/ntos/nthals/haleb66/alpha/bios.c new file mode 100644 index 000000000..3a9d3aa50 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/bios.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\bios.c" + diff --git a/private/ntos/nthals/haleb66/alpha/busdata.c b/private/ntos/nthals/haleb66/alpha/busdata.c new file mode 100644 index 000000000..020194bb6 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/busdata.c @@ -0,0 +1,127 @@ +/*++ + + +Copyright (c) 1989 Microsoft Corporation +Copyright (c) 1994 Digital Equipment Corporation + +Module Name: + + busdata.c + +Abstract: + + This module contains get/set bus data routines. + +Author: + + Darryl E. Havens (darrylh) 11-Apr-1990 + +Environment: + + Kernel mode + +Revision History: + + +--*/ + +#include "halp.h" +#include "eb66def.h" + +// +// External Function Prototypes +// + + +ULONG +HalpNoBusData ( + IN PVOID BusHandler, + IN PVOID RootHandler, + IN ULONG SlotNumber, + IN PVOID Buffer, + IN ULONG Offset, + IN ULONG Length + ); + +#ifdef ALLOC_PRAGMA +#pragma alloc_text(INIT,HalpRegisterInternalBusHandlers) +#endif + + +VOID +HalpRegisterInternalBusHandlers ( + VOID + ) +/*++ + +Routine Description: + + This function registers the bushandlers for buses on the system + that will always be present on the system. + +Arguments: + + None. + +Return Value: + + None. + +--*/ +{ + PBUS_HANDLER Bus; + + // + // Initalize BusHandler data before registering any handlers + // + + HalpInitBusHandler (); + + // + // Build the processor internal bus 0 + // + + HaliRegisterBusHandler (ProcessorInternal, // Bus Type + -1, // No config space + 0, // Bus Number + -1, // No parent bus type + 0, // No parent bus number + 0, // No extension data + NULL, // No install handler + &Bus); // Bushandler return + + Bus->GetInterruptVector = HalpGetSystemInterruptVector; + + // + // Build internal-bus 0, or system level bus + // + + HaliRegisterBusHandler (Internal, // Bus Type + -1, // No config space + 0, // Bus Number + -1, // No parent bus type + 0, // No parent bus number + 0, // No extension data + NULL, // No install handler + &Bus); // Bushandler return + + Bus->GetInterruptVector = HalpGetSystemInterruptVector; + Bus->TranslateBusAddress = HalpTranslateSystemBusAddress; + + // + // Build Isa bus #0 + // + + HaliRegisterBusHandler (Isa, // Bus Type + -1, // No config space + 0, // Internal bus #0 + Internal, // Parent bus type + 0, // Parent bus number + 0, // No extension data + NULL, // No install handler + &Bus); // Bushandler return + + Bus->GetBusData = HalpNoBusData; + Bus->AdjustResourceList = HalpAdjustIsaResourceList; + +} diff --git a/private/ntos/nthals/haleb66/alpha/cache.c b/private/ntos/nthals/haleb66/alpha/cache.c new file mode 100644 index 000000000..561528477 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/cache.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\cache.c" + diff --git a/private/ntos/nthals/haleb66/alpha/chipset.h b/private/ntos/nthals/haleb66/alpha/chipset.h new file mode 100644 index 000000000..b5d5b44c3 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/chipset.h @@ -0,0 +1 @@ +#include "lca4.h" diff --git a/private/ntos/nthals/haleb66/alpha/cmos8k.c b/private/ntos/nthals/haleb66/alpha/cmos8k.c new file mode 100644 index 000000000..6253ecab6 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/cmos8k.c @@ -0,0 +1,5 @@ +#define HalpWriteNVRamBuffer HalpCmos8kWriteNVRamBuffer +#define HalpReadNVRamBuffer HalpCmos8kReadNVRamBuffer +#define HalpCopyNVRamBuffer HalpCmos8kCopyNVRamBuffer +#include "..\..\halalpha\cmos8k.c" + diff --git a/private/ntos/nthals/haleb66/alpha/eb66def.h b/private/ntos/nthals/haleb66/alpha/eb66def.h new file mode 100644 index 000000000..58b623bb2 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/eb66def.h @@ -0,0 +1,94 @@ +/*++ + +Copyright (c) 1993 Digital Equipment Corporation + +Module Name: + + eb66def.h + +Abstract: + + This module specifies platform-specific definitions for the + EB66p modules. + +Author: + + Joe Notarangelo 25-Oct-1993 + +Revision History: + + Ken Curewitz [DEC] December 1994 + + Adapted for EB66p from eb66def.h + +--*/ + +#ifndef _EB66PDEF_ +#define _EB66PDEF_ + +#include "alpharef.h" +#include "lca4.h" +#include "isaaddr.h" + +#define NUMBER_ISA_SLOTS 4 +#define NUMBER_PCI_SLOTS 4 + +// +// QVA definitions for base addresses on the PCI +// +#define PCI_SPARSE_IO_BASE_QVA \ + ((ULONG)(HAL_MAKE_QVA(LCA4_PASS2_PCI_IO_BASE_PHYSICAL))) + +#define PCI_SPARSE_MEMORY_BASE_QVA \ + ((ULONG)(HAL_MAKE_QVA(LCA4_PCI_MEMORY_BASE_PHYSICAL))) + +// +// Highest Virtual local PCI Slot +// +// On the EB66 we can only probe for 13 devices +// +#define PCI_MAX_LOCAL_DEVICE 13 + +// +// Highest PCI interrupt vector is in PCI vector space +// +#define PCI_MAX_INTERRUPT_VECTOR (MAXIMUM_PCI_VECTOR - PCI_VECTORS) + +#define EB66P_INTERRUPT_MASK0_QVA \ + ((PUCHAR)HAL_MAKE_QVA(LCA4_PASS2_PCI_IO_BASE_PHYSICAL) + 0x804) +#define EB66P_INTERRUPT_MASK1_QVA \ + ((PUCHAR)HAL_MAKE_QVA(LCA4_PASS2_PCI_IO_BASE_PHYSICAL) + 0x805) +#define EB66P_INTERRUPT_MASK2_QVA \ + ((PUCHAR)HAL_MAKE_QVA(LCA4_PASS2_PCI_IO_BASE_PHYSICAL) + 0x806) +#define EB66P_SIO_INTERRUPT_MASK 0x10 + +#define EB66_INTERRUPT_MASK0_QVA \ + ((PUCHAR)HAL_MAKE_QVA(LCA4_PASS2_PCI_IO_BASE_PHYSICAL) + 0x26) +#define EB66_INTERRUPT_MASK1_QVA \ + ((PUCHAR)HAL_MAKE_QVA(LCA4_PASS2_PCI_IO_BASE_PHYSICAL) + 0x27) +#define EB66_INTERRUPT_MASK2_QVA NULL +#define EB66_SIO_INTERRUPT_MASK 0x20 + +extern PVOID INTERRUPT_MASK0_QVA; +extern PVOID INTERRUPT_MASK1_QVA; +extern PVOID INTERRUPT_MASK2_QVA; +extern ULONG SIO_INTERRUPT_MASK; + +// +// Define the default processor frequency to be used before the actual +// frequency can be determined. +// + +#define DEFAULT_PROCESSOR_FREQUENCY_MHZ (233) + +// +// Define the location of the flash environment block +// + +extern BOOLEAN SystemIsEB66P; + +#define EB66P_ENVIRONMENT_QVA \ + ((ULONG)HAL_MAKE_QVA(LCA4_PCI_MEMORY_BASE_PHYSICAL) + 0xf0000) + +#endif // _EB66PDEF_ + diff --git a/private/ntos/nthals/haleb66/alpha/ebenv.c b/private/ntos/nthals/haleb66/alpha/ebenv.c new file mode 100644 index 000000000..b28e0ade4 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ebenv.c @@ -0,0 +1,61 @@ +#include "halp.h" +#include "arccodes.h" + +extern BOOLEAN SystemIsEB66P; + +ARC_STATUS +HalpFlash8kReadNVRamBuffer ( + OUT PCHAR DataPtr, + IN PCHAR NvRamPtr, + IN ULONG Length + ); + +ARC_STATUS +HalpFlash8kWriteNVRamBuffer ( + IN PCHAR NvRamPtr, + IN PCHAR DataPtr, + IN ULONG Length + ); + +ARC_STATUS +HalpCmos8kReadNVRamBuffer ( + OUT PCHAR DataPtr, + IN PCHAR NvRamPtr, + IN ULONG Length + ); + +ARC_STATUS +HalpCmos8kWriteNVRamBuffer ( + IN PCHAR NvRamPtr, + IN PCHAR DataPtr, + IN ULONG Length + ); + +ARC_STATUS +HalpReadNVRamBuffer ( + OUT PCHAR DataPtr, + IN PCHAR NvRamPtr, + IN ULONG Length + ) +{ + if (SystemIsEB66P) + return HalpFlash8kReadNVRamBuffer(DataPtr, NvRamPtr, Length); + + return HalpCmos8kReadNVRamBuffer(DataPtr, NvRamPtr, Length); +} + +ARC_STATUS +HalpWriteNVRamBuffer ( + IN PCHAR NvRamPtr, + IN PCHAR DataPtr, + IN ULONG Length + ) +{ + if (SystemIsEB66P) + return HalpFlash8kWriteNVRamBuffer(NvRamPtr, DataPtr, Length); + + return HalpCmos8kWriteNVRamBuffer(NvRamPtr, DataPtr, Length); +} + + + diff --git a/private/ntos/nthals/haleb66/alpha/ebinitnt.c b/private/ntos/nthals/haleb66/alpha/ebinitnt.c new file mode 100644 index 000000000..8e58f6527 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ebinitnt.c @@ -0,0 +1,784 @@ +/*++ + +Copyright (c) 1993 Digital Equipment Corporation + +Module Name: + + ebinitnt.c + +Abstract: + + + This module implements the interrupt initialization for a Low Cost Alpha + (LCA) system. Contains the VLSI 82C106, the 82357 and an EISA bus. + + Orignally taken from the JENSEN hal code. + +Author: + + Wim Colgate (DEC) 26-Oct-1993 + +Environment: + + Kernel mode only. + +Revision History: + + Dick Bissen [DEC] 12-May-1994 + + Correct the IRQ assignments for the EB66 pass2 module. Daytona will not + be supported on EB66 pass1 modules. + + Eric Rehm (DEC) 7-Jan-1994 + Intialize PCI Bus information during Phase 1 init. + +--*/ + +#include "halp.h" +#include "pcrtc.h" +#include "eb66def.h" +#include "halpcsl.h" +#include "eisa.h" +#include "pci.h" +#include "pcip.h" +#include "iousage.h" +#include "flash8k.h" + +#include "fwcallbk.h" + +#include // to get the product build number. + +// +// Include the header containing Error Frame Definitions(in halalpha). +// +#include "errframe.h" + +// +// Define extern global buffer for the Uncorrectable Error Frame. +// declared in halalpha\inithal.c +// + +extern PERROR_FRAME PUncorrectableError; + + + +// +// Define global data for builtin device interrupt enables. +// + +USHORT HalpBuiltinInterruptEnable; + + +// +// +// +BOOLEAN SystemIsEB66P; +PVOID INTERRUPT_MASK0_QVA; +PVOID INTERRUPT_MASK1_QVA; +PVOID INTERRUPT_MASK2_QVA; +ULONG SIO_INTERRUPT_MASK; + +// irql mask and tables +// +// irql 0 - passive +// irql 1 - sfw apc level +// irql 2 - sfw dispatch level +// irql 3 - device low (All devices except) +// irql 4 - device high (the serial lines) +// irql 5 - clock +// irql 6 - real time +// irql 7 - error, mchk, nmi, halt +// +// +// IDT mappings: +// For the built-ins, GetInterruptVector will need more info, +// or it will have to be built-in to the routines, since +// these don't match IRQL levels in any meaningful way. +// +// 0 passive 8 +// 1 apc 9 +// 2 dispatch 10 PIC +// 3 11 keyboard/mouse +// 4 serial 12 errors +// 5 clock 13 parallel +// 6 14 halt +// 7 nmi 15 +// +// This is assuming the following prioritization: +// nmi +// halt +// errors +// clock +// serial +// parallel +// keyboard/mouse +// pic + +// +// This is the HalpIrqlMask for LCA based machines: +// The LCA interrupt pins: +// +// eirq 0 NMI +// eirq 1 PIC - 82357 interrupts +// eirq 2 Clock + +// +// For information purposes: here is what the IDT division looks like: +// +// 000-015 Built-ins (we only use 8 entries; NT wants 10) +// 016-031 ISA +// 048-063 EISA +// 080-095 PCI +// 112-127 Turbo Channel +// 128-255 unused, as are all other holes +// + +// +// Define the bus type, this value allows us to distinguish between +// EISA and ISA systems. +// + +ULONG HalpBusType = MACHINE_TYPE_ISA; + +// +// This is the PCI Memory space that cannot be used by anyone +// and therefore the HAL says it is reserved for itself +// + +ADDRESS_USAGE +EB66PCIMemorySpace = { + NULL, CmResourceTypeMemory, PCIUsage, + { + __8MB, __32MB - __8MB, // Start=8MB; Length=24Mb (8 through 32) + 0,0 + } +}; + +// +// Define global data used to communicate new clock rates to the clock +// interrupt service routine. +// + +ULONG HalpCurrentTimeIncrement; +ULONG HalpNextRateSelect; +ULONG HalpNextTimeIncrement; +ULONG HalpNewTimeIncrement; + +VOID +HalpClearInterrupts( + ); + + +BOOLEAN +HalpInitializeInterrupts ( + VOID + ) + +/*++ + +Routine Description: + + This function initializes interrupts for an Alpha system. + +Arguments: + + None. + +Return Value: + + A value of TRUE is returned if the initialization is successfully + completed. Otherwise a value of FALSE is returned. + +--*/ + +{ + + UCHAR DataByte; + ULONG DataLong; + ULONG Index; + ULONG Irq; + KIRQL Irql; + UCHAR Priority; + ULONG Vector; + + // + // Initialize HAL processor parameters based on estimated CPU speed. + // This must be done before HalpStallExecution is called. Compute integral + // megahertz first to avoid rounding errors due to imprecise cycle clock + // period values. + // + + HalpInitializeProcessorParameters(); + + // + // Connect the Stall interrupt vector to the clock. When the + // profile count is calculated, we then connect the normal + // clock. + + + PCR->InterruptRoutine[CLOCK2_LEVEL] = HalpStallInterrupt; + + // + // Clear all pending interrupts + // + + HalpClearInterrupts(); + + // + // Start the peridodic interrupt from the RTC + // + HalpProgramIntervalTimer(MAXIMUM_RATE_SELECT); + + // + // Initialize the EISA and PCI interrupt controllers. + // + + HalpInitializePCIInterrupts(); + + // + // Initialize the 21066 interrupts. + // + // N.B. - The 21066 uses the 21064 core and so the 21066 HAL + // uses 21064 interrupt enable/disable routines. + // + + HalpInitialize21064Interrupts(); + + HalpEnable21064SoftwareInterrupt( Irql = APC_LEVEL ); + HalpEnable21064SoftwareInterrupt( Irql = DISPATCH_LEVEL ); + + HalpEnable21064HardwareInterrupt( Irq = 0, + Irql = DEVICE_LEVEL, + Vector = PIC_VECTOR, + Priority = 0 ); + HalpEnable21064HardwareInterrupt( Irq = 1, + Irql = CLOCK_LEVEL, + Vector = CLOCK_VECTOR, + Priority = 0 ); + HalpEnable21064HardwareInterrupt( Irq = 2, + Irql = HIGH_LEVEL, + Vector = EISA_NMI_VECTOR, + Priority = 0 ); + + return TRUE; +} + + +VOID +HalpClearInterrupts( + ) +/*++ + +Routine Description: + + This function no longer does anything. + +Arguments: + + None. + +Return Value: + + None. + +--*/ + +{ + return; +} + + +VOID +HalpSetTimeIncrement( + VOID + ) +/*++ + +Routine Description: + + This routine is responsible for setting the time increment for an LCA + based machine via a call into the kernel. + +Arguments: + + None. + +Return Value: + + None. + +--*/ +{ + // + // Set the time increment value. + // + + HalpCurrentTimeIncrement = MAXIMUM_INCREMENT; + HalpNextTimeIncrement = MAXIMUM_INCREMENT; + HalpNextRateSelect = 0; + KeSetTimeIncrement( MAXIMUM_INCREMENT, MINIMUM_INCREMENT ); + +} + +// +// Define global data used to calibrate and stall processor execution. +// + +ULONG HalpProfileCountRate; + +VOID +HalpInitializeClockInterrupts( + VOID + ) + +/*++ + +Routine Description: + + This function is called during phase 1 initialization to complete + the initialization of clock interrupts. For LCA, this function + connects the true clock interrupt handler and initializes the values + required to handle profile interrupts. + +Arguments: + + None. + +Return Value: + + None. + +--*/ + +{ + + // + // Compute the profile interrupt rate. + // + + HalpProfileCountRate = ((1000 * 1000 * 10) / KeQueryTimeIncrement()); + + // + // Set the time increment value and connect the real clock interrupt + // routine. + // + + PCR->InterruptRoutine[CLOCK2_LEVEL] = HalpClockInterrupt; + + return; +} + +VOID +HalpEstablishErrorHandler( + VOID + ) +/*++ + +Routine Description: + + This routine performs the initialization necessary for the HAL to + begin servicing machine checks. + +Arguments: + + None. + +Return Value: + + None. + +--*/ +{ + BOOLEAN ReportCorrectables; + + // + // Connect the machine check handler via the PCR. The machine check + // handler for LCA is the default EV4 parity-mode handler. + // + + PCR->MachineCheckError = HalMachineCheck; + + // + // Clear any error conditions currently pending. + //jnfix - report correctables one day + + HalpClearAllErrors( ReportCorrectables = FALSE ); + + return; +} + +VOID +HalpInitializeMachineDependent( + IN ULONG Phase, + IN PLOADER_PARAMETER_BLOCK LoaderBlock + ) +/*++ + +Routine Description: + + This function performs any EV4-specific initialization based on + the current phase on initialization. + +Arguments: + + Phase - Supplies an indicator for phase of initialization, phase 0 or + phase 1. + + LoaderBlock - supplies a pointer to the loader block. + +Return Value: + + None. + +--*/ +{ + + if( Phase == 0 ){ + + // + // Phase 0 Initialization. + // + + HalpFlashDriver = HalpInitializeFlashDriver(EB66P_ENVIRONMENT_QVA); + if (HalpFlashDriver != NULL) { + // + // The flash device was found, so we must be running on an + // EB66P + // + SystemIsEB66P = TRUE; + HalpCMOSRamBase = EB66P_ENVIRONMENT_QVA; + INTERRUPT_MASK0_QVA = EB66P_INTERRUPT_MASK0_QVA; + INTERRUPT_MASK1_QVA = EB66P_INTERRUPT_MASK1_QVA; + INTERRUPT_MASK2_QVA = EB66P_INTERRUPT_MASK2_QVA; + SIO_INTERRUPT_MASK = EB66P_SIO_INTERRUPT_MASK; + } else { + SystemIsEB66P = FALSE; + INTERRUPT_MASK0_QVA = EB66_INTERRUPT_MASK0_QVA; + INTERRUPT_MASK1_QVA = EB66_INTERRUPT_MASK1_QVA; + INTERRUPT_MASK2_QVA = EB66_INTERRUPT_MASK2_QVA; + SIO_INTERRUPT_MASK = EB66_SIO_INTERRUPT_MASK; + } + + HalpRegisterAddressUsage (&EB66PCIMemorySpace); + + + } else { + + // + // Phase 1 Initialization. + // + + // + // Initialize the existing bus handlers. + // + + HalpRegisterInternalBusHandlers(); + + // + // Initialize the PCI Bus. + // + + HalpInitializePCIBus (LoaderBlock); + + // + // Initialize the profiler. + // + + HalpInitializeProfiler(); + + + } + + return; + +} + + +VOID +HalpStallInterrupt ( + VOID + ) + +/*++ + +Routine Description: + + This function serves as the stall calibration interrupt service + routine. It is executed in response to system clock interrupts + during the initialization of the HAL layer. + +Arguments: + + None. + +Return Value: + + None. + +--*/ + +{ + + HalpAcknowledgeClockInterrupt(); + + return; +} + +ULONG +HalSetTimeIncrement ( + IN ULONG DesiredIncrement + ) + +/*++ + +Routine Description: + + This function is called to set the clock interrupt rate to the frequency + required by the specified time increment value. + +Arguments: + + DesiredIncrement - Supplies desired number of 100ns units between clock + interrupts. + +Return Value: + + The actual time increment in 100ns units. + +--*/ + +{ + ULONG NewTimeIncrement; + ULONG NextRateSelect; + KIRQL OldIrql; + + // + // Raise IRQL to the highest level, set the new clock interrupt + // parameters, lower IRQl, and return the new time increment value. + // + KeRaiseIrql(HIGH_LEVEL, &OldIrql); + if (DesiredIncrement < MINIMUM_INCREMENT) { + DesiredIncrement = MINIMUM_INCREMENT; + } + if (DesiredIncrement > MAXIMUM_INCREMENT) { + DesiredIncrement = MAXIMUM_INCREMENT; + } + + // + // Find the allowed increment that is less than or equal to + // the desired increment. + // + if (DesiredIncrement >= RTC_PERIOD_IN_CLUNKS4) { + NewTimeIncrement = RTC_PERIOD_IN_CLUNKS4; + NextRateSelect = RTC_RATE_SELECT4; + } else if (DesiredIncrement >= RTC_PERIOD_IN_CLUNKS3) { + NewTimeIncrement = RTC_PERIOD_IN_CLUNKS3; + NextRateSelect = RTC_RATE_SELECT3; + } else if (DesiredIncrement >= RTC_PERIOD_IN_CLUNKS2) { + NewTimeIncrement = RTC_PERIOD_IN_CLUNKS2; + NextRateSelect = RTC_RATE_SELECT2; + } else { + NewTimeIncrement = RTC_PERIOD_IN_CLUNKS1; + NextRateSelect = RTC_RATE_SELECT1; + } + + HalpNextRateSelect = NextRateSelect; + HalpNewTimeIncrement = NewTimeIncrement; + + KeLowerIrql(OldIrql); + + return NewTimeIncrement; + +} + +VOID +HalpResetHAERegisters( + VOID + ) +/*++ + +Routine Description: + + This function resets the HAE registers in the chipset to 0. + This is routine called during a shutdown so that the prom + gets a predictable environment. + +Arguments: + + none + +Return Value: + + none + +--*/ +{ + // WRITE_REGISTER_ULONG( EPIC_HAXR1_QVA, 0 ); + // WRITE_REGISTER_ULONG( EPIC_HAXR2_QVA, 0); + return; +} + + +VOID +HalpGetMachineDependentErrorFrameSizes( + PULONG RawProcessorSize, + PULONG RawSystemInfoSize + ) +/*++ + +Routine Description: + + This function returns the size of the system specific structures. + + +Arguments: + + RawProcessorSize - Pointer to a buffer that will receive the + size of the processor specific error information buffer. + + RawSystemInfoSize - Pointer to a buffer that will receive the + size of the system specific error information buffer. + +Return Value: + + none + +--*/ +{ + *RawProcessorSize = sizeof(PROCESSOR_LCA_UNCORRECTABLE); + *RawSystemInfoSize = 0; + return; +} + + +VOID +HalpGetSystemInfo(SYSTEM_INFORMATION *SystemInfo) +/*++ + +Routine Description: + + This function fills in the System information. + + +Arguments: + + SystemInfo - Pointer to the SYSTEM_INFORMATION buffer that needs + to be filled in. + +Return Value: + + none + +--*/ +{ + char systemtype[] = "EB66"; + EXTENDED_SYSTEM_INFORMATION FwExtSysInfo; + + + VenReturnExtendedSystemInformation(&FwExtSysInfo); + + RtlCopyMemory(SystemInfo->FirmwareRevisionId, + FwExtSysInfo.FirmwareVersion, + 16); + + RtlCopyMemory(SystemInfo->SystemType,systemtype, 8); + + SystemInfo->ClockSpeed = + ((1000 * 1000) + (PCR->CycleClockPeriod >> 1)) / PCR->CycleClockPeriod; + + SystemInfo->SystemRevision = PCR->SystemRevision; + + RtlCopyMemory(SystemInfo->SystemSerialNumber, + PCR->SystemSerialNumber, + 16); + + SystemInfo->SystemVariant = PCR->SystemVariant; + + + SystemInfo->PalMajorVersion = PCR->PalMajorVersion; + SystemInfo->PalMinorVersion = PCR->PalMinorVersion; + + SystemInfo->OsRevisionId = VER_PRODUCTBUILD; + + // + // For now fill in dummy values. + // + SystemInfo->ModuleVariant = 1UL; + SystemInfo->ModuleRevision = 1UL; + SystemInfo->ModuleSerialNumber = 0; + + return; +} + +VOID +HalpInitializeUncorrectableErrorFrame ( + VOID + ) +/*++ + +Routine Description: + + This function Allocates an Uncorrectable Error frame for this + system and initializes the frame with certain constant/global + values. + + This is routine called during machine dependent system + Initialization. + +Arguments: + + none + +Return Value: + + none + +--*/ +{ + PROCESSOR_LCA_UNCORRECTABLE processorFrame; + + // + // If the Uncorrectable error buffer is not set then simply return + // + if(PUncorrectableError == NULL) + return; + + PUncorrectableError->Signature = ERROR_FRAME_SIGNATURE; + + PUncorrectableError->FrameType = UncorrectableFrame; + + // + // ERROR_FRAME_VERSION is define in errframe.h and will + // change as and when there is a change in the errframe.h. + // This Version number helps the service, that reads this + // information from the dumpfile, to check if it knows about + // this frmae version type to decode. If it doesn't know, it + // will dump the entire frame to the EventLog with a message + // "Error Frame Version Mismatch". + // + + PUncorrectableError->VersionNumber = ERROR_FRAME_VERSION; + + // + // The sequence number will always be 1 for Uncorrectable errors. + // + + PUncorrectableError->SequenceNumber = 1; + + // + // The PerformanceCounterValue field is not used for Uncorrectable + // errors. + // + + PUncorrectableError->PerformanceCounterValue = 0; + + // + // We will fill in the UncorrectableFrame.SystemInfo here. + // + + HalpGetSystemInfo(&PUncorrectableError->UncorrectableFrame.System); + + PUncorrectableError->UncorrectableFrame.Flags.SystemInformationValid = 1; + + return; +} diff --git a/private/ntos/nthals/haleb66/alpha/ebintr.s b/private/ntos/nthals/haleb66/alpha/ebintr.s new file mode 100644 index 000000000..7730a21ec --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ebintr.s @@ -0,0 +1,123 @@ +// TITLE("PCI/ISA Interrupt Handler") +//++ +// +// Copyright (c) 1994 Digital Equipment Corporation +// +// Module Name: +// +// ebintr.s +// +// Abstract: +// +// This module implements first level interrupt handlers for Mustang & EB66 +// +// During Phase 0 initialization, the appropriate platform-dependent handler +// is connected. +// +// Author: +// +// Joe Notarangelo 08-Jul-1993 +// +// Environment: +// +// Kernel mode only. +// +// Revision History: +// +// 07-Feb-1994 Eric Rehm +// Make this module platform-dependent. +//-- + +#include "halalpha.h" + + SBTTL("EB66 PCI Interrupt Handler") +//++ +// +// VOID +// HalpPCIInterruptHandlerEB66 +// IN PKINTERRUPT Interrupt, +// IN PVOID ServiceContext +// ) +// +// Routine Description: +// +// This function is executed as the result of an interrupt on a PCI +// bus. The function is responsible for calling HalpPCIDispatch to +// appropriately dispatch the interrupt. +// +// N.B. This function exists only to capture the trap frame and forward +// the interrupt to HalpPCIDispatch. +// +// Arguments: +// +// Interrupt (a0) - Supplies a pointer to the interrupt object. +// +// ServiceContext (a1) - Supplies a pointer to the service context for +// PCI interrupts. +// +// TrapFrame (fp/s6) - Supplies a pointer to the trap frame for +// the interrupt. +// +// Return Value: +// +// None. +// +//-- + + LEAF_ENTRY(HalpPCIInterruptHandlerEB66) + + bis fp, zero, a2 // capture trap frame as argument + br zero, HalpPCIDispatchEB66 // dispatch the interrupt + + ret zero, (ra) // will never get here + + .end HalpPCIInterruptHandlerEB66 + + + + SBTTL("Mustang PCI Interrupt Handler") +//++ +// +// VOID +// HalpPCIInterruptHandlerMustang +// IN PKINTERRUPT Interrupt, +// IN PVOID ServiceContext +// ) +// +// Routine Description: +// +// This function is executed as the result of an interrupt on a PCI +// bus. The function is responsible for calling HalpPCIDispatch to +// appropriately dispatch the interrupt. +// +// N.B. This function exists only to capture the trap frame and forward +// the interrupt to HalpPCIDispatch. +// +// Arguments: +// +// Interrupt (a0) - Supplies a pointer to the interrupt object. +// +// ServiceContext (a1) - Supplies a pointer to the service context for +// PCI interrupts. +// +// TrapFrame (fp/s6) - Supplies a pointer to the trap frame for +// the interrupt. +// +// Return Value: +// +// None. +// +//-- + + LEAF_ENTRY(HalpPCIInterruptHandlerMustang) + + bis fp, zero, a2 // capture trap frame as argument + br zero, HalpPCIDispatchMustang // dispatch the interrupt + + ret zero, (ra) // will never get here + + .end HalpPCIInterruptHandlerMustang + + + + diff --git a/private/ntos/nthals/haleb66/alpha/ebintsup.c b/private/ntos/nthals/haleb66/alpha/ebintsup.c new file mode 100644 index 000000000..ed4ddbeea --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ebintsup.c @@ -0,0 +1,612 @@ +/*++ + +Copyright (c) 1990 Microsoft Corporation +Copyright (c) 1992, 1993 Digital Equipment Corporation + +Module Name: + + ebintsup.c + +Abstract: + + The module provides the interrupt support for EB66/Mustang systems. + +Author: + + Eric Rehm (DEC) 29-December-1993 + +Revision History: + + Dick Bissen [DEC] 12-May-1994 + + Removed all support of the EB66 pass1 module from the code. + +--*/ + + +#include "halp.h" +#include "eisa.h" +#include "ebsgdma.h" +#include "eb66def.h" +#include "pcrtc.h" +#include "pintolin.h" + +// +// Global to control interrupt handling for EB64+ +// + +UCHAR IntMask0, IntMask1, IntMask2; + +VOID +HalpInitializePciInterrupts ( + VOID + ); + +BOOLEAN +HalpPCIDispatch( + IN PKINTERRUPT Interrupt, + IN PVOID ServiceContext, + IN PKTRAP_FRAME TrapFrame + ); + +// +// Define the context structure for use by interrupt service routines. +// + +typedef BOOLEAN (*PSECOND_LEVEL_DISPATCH)( + PKINTERRUPT InterruptObject + ); + +// +// The following is the interrupt object used for DMA controller interrupts. +// DMA controller interrupts occur when a memory parity error occurs or a +// programming error occurs to the DMA controller. +// + +KINTERRUPT HalpEisaNmiInterrupt; + +// +// The following function initializes NMI handling. +// + +VOID +HalpInitializeNMI( + VOID + ); + +// +// The following functions is called when an EISA NMI occurs. +// + +BOOLEAN +HalHandleNMI( + IN PKINTERRUPT Interrupt, + IN PVOID ServiceContext + ); + +VOID +HalpDisableSioInterrupt( + IN ULONG Vector + ); + +VOID +HalpEnableSioInterrupt( + IN ULONG Vector, + IN KINTERRUPT_MODE InterruptMode + ); + + +BOOLEAN +HalpInitializePCIInterrupts ( + VOID + ) + +/*++ + +Routine Description: + + This routine initializes the structures necessary for EISA & PCI operations + and connects the intermediate interrupt dispatcher. It also initializes the + EISA interrupt controller. + +Arguments: + + None. + +Return Value: + + If the second level interrupt dispatcher is connected, then a value of + TRUE is returned. Otherwise, a value of FALSE is returned. + +--*/ + +{ + + UCHAR DataByte; + KIRQL oldIrql; + UCHAR *SystemType; + + // + // Initialize the SIO NMI interrupt. + // + + HalpInitializeNMI(); + + // + // Directly connect the ISA interrupt dispatcher to the level for + // ISA bus interrupt. + // + // N.B. This vector is reserved for exclusive use by the HAL (see + // interrupt initialization. + // + + PCR->InterruptRoutine[PIC_VECTOR] = (PVOID)HalpPCIDispatch; + HalEnableSystemInterrupt(PIC_VECTOR, DEVICE_LEVEL, LevelSensitive); + + if (SystemIsEB66P) + (PVOID) HalpPCIPinToLineTable = (PVOID) EB66PPCIPinToLineTable; + else + (PVOID) HalpPCIPinToLineTable = (PVOID) EB66PCIPinToLineTable; + + // + // Raise the IRQL while the PCI interrupt controller is initalized. + // + + KeRaiseIrql(PCI_DEVICE_LEVEL, &oldIrql); + + // + // Initialize the PCI interrupts. + // + HalpInitializePciInterrupts(); + + // + // Initialize SIO Programmable Interrupt Contoller + // + + HalpInitializeSioInterrupts(); + + // + // Restore IRQL level. + // + + KeLowerIrql(oldIrql); + + // + // Initialize the DMA mode registers to a default value. + // Disable all of the DMA channels except channel 4 which is the + // cascade of channels 0-3. + // + + WRITE_PORT_UCHAR( + &((PEISA_CONTROL) HalpEisaControlBase)->Dma1BasePort.AllMask, + 0x0F + ); + + WRITE_PORT_UCHAR( + &((PEISA_CONTROL) HalpEisaControlBase)->Dma2BasePort.AllMask, + 0x0E + ); + + return(TRUE); +} + +BOOLEAN +HalpPCIDispatch( + IN PKINTERRUPT Interrupt, + IN PVOID ServiceContext, + IN PKTRAP_FRAME TrapFrame + ) + +/*++ + +Routine Description: + + This routine is entered as the result of an interrupt being generated + via the vector that is connected to an interrupt object that describes + the PCI and ISA device interrupts. Its function is to call the second + level interrupt dispatch routine and acknowledge the interrupt at the ISA + controller. + + This service routine should be connected as follows: + + KeInitializeInterrupt(&Interrupt, HalpPCIDispatch, + EISA_VIRTUAL_BASE, + (PKSPIN_LOCK)NULL, PCI_LEVEL, PCI_LEVEL, PCI_LEVEL, + LevelSensitive, TRUE, 0, FALSE); + KeConnectInterrupt(&Interrupt); + +Arguments: + + Interrupt - Supplies a pointer to the interrupt object. + + ServiceContext - Supplies a pointer to the ISA interrupt acknowledge + register. + + TrapFrame - Supplies a pointer to the trap frame for this interrupt. + +Return Value: + + Returns the value returned from the second level routine. + +--*/ + +{ + UCHAR PciVector, IntNumber; + ULONG PCRInOffset = 0xffff; + KPCR *pcr; + + // + // Read in the 1st interrupt register. + // + PciVector = READ_PORT_UCHAR(INTERRUPT_MASK0_QVA) & IntMask0; + + // + // Was it an ISA (SIO) interrupt? + // + if (PciVector & SIO_INTERRUPT_MASK) { + // + // ISA interrupt - call HalpSioDispatch(). + // + return HalpSioDispatch(); + } + + // + // Which PCI interrupt was it? + // + if (PciVector) { + for(IntNumber = 0; IntNumber < 8; IntNumber++) { + if (PciVector & 1) { + PCRInOffset = IntNumber; + break; + } + PciVector >>= 1; + } + } else { + PciVector = READ_PORT_UCHAR(INTERRUPT_MASK1_QVA) & IntMask1; + + if (PciVector) { + for(IntNumber = 0; IntNumber < 8; IntNumber++) { + if (PciVector & 1) { + PCRInOffset = IntNumber + 8; + break; + } + PciVector >>= 1; + } + } else if (INTERRUPT_MASK2_QVA != NULL) { + PciVector = READ_PORT_UCHAR(INTERRUPT_MASK2_QVA) & IntMask2; + + if (PciVector) + PCRInOffset = 0x10; + } + } + + if (PCRInOffset == 0xffff) { + return FALSE; + } + + PCRInOffset += PCI_VECTORS; + PCRInOffset++; + return ((PSECONDARY_DISPATCH)PCR->InterruptRoutine[PCRInOffset])( + PCR->InterruptRoutine[PCRInOffset], TrapFrame); +} + + +VOID +HalpDisablePCIInterrupt( + IN ULONG Vector + ) + +/*++ + +Routine Description: + + This function Disables the PCI bus specified PCI bus interrupt. + +Arguments: + + Vector - Supplies the vector of the PCI interrupt that is Disabled. + +Return Value: + + None. + +--*/ + +{ + // + // Calculate the PCI interrupt vector. + // + + Vector -= PCI_VECTORS; + Vector--; + + // + // Clear the corresponding bit in the appropriate interrupt mask + // shadow and write it out to the interrupt mask. + // + if (Vector >= 0 && Vector <= 7) { + IntMask0 &= (UCHAR) ~(1 << Vector); + WRITE_PORT_UCHAR(INTERRUPT_MASK0_QVA, ~IntMask0); + } else if (Vector >= 8 && Vector <= 0xf) { + IntMask1 &= (UCHAR) ~(1 << (Vector - 8)); + WRITE_PORT_UCHAR(INTERRUPT_MASK1_QVA, ~IntMask1); + } else if ((Vector == 0x10) && (INTERRUPT_MASK2_QVA != NULL)) { + IntMask2 = 0; + WRITE_PORT_UCHAR(INTERRUPT_MASK2_QVA, ~IntMask2); + } else { +#ifdef HALDBG + DbgPrint("HalpDisablePCIInterrupt: bad vector\n"); +#endif // HALDBG + } +} + + +VOID +HalpEnablePCIInterrupt( + IN ULONG Vector + ) + +/*++ + +Routine Description: + + This function enables the PCI bus specified PCI bus interrupt. + PCI interrupts must be LevelSensitve. (PCI Spec. 2.2.6) + +Arguments: + + Vector - Supplies the vector of the ESIA interrupt that is enabled. + + InterruptMode - Supplies the mode of the interrupt; LevelSensitive or + Latched. + +Return Value: + + None. + +--*/ + +{ + // + // Calculate the PCI interrupt vector. + // + + Vector -= PCI_VECTORS; + Vector--; + + // + // Set the corresponding bit in the appropriate interrupt mask + // shadow and write it out to the interrupt mask. + // + if (Vector >= 0 && Vector <= 7) { + IntMask0 |= (UCHAR) (1 << Vector); + WRITE_PORT_UCHAR(INTERRUPT_MASK0_QVA, ~IntMask0); + } else if (Vector >= 8 && Vector <= 0xf) { + IntMask1 |= (UCHAR) (1 << (Vector - 8)); + WRITE_PORT_UCHAR(INTERRUPT_MASK1_QVA, ~IntMask1); + } else if ((Vector == 0x10) && (INTERRUPT_MASK2_QVA != NULL)) { + IntMask2 = 1; + WRITE_PORT_UCHAR(INTERRUPT_MASK2_QVA, ~IntMask2); + } else { +#ifdef HALDBG + DbgPrint("HalpEnablePCIInterrupt: bad vector\n"); +#endif // HALDBG + } +} + + +VOID +HalpInitializeNMI( + VOID + ) +/*++ + +Routine Description: + + This function is called to intialize SIO NMI interrupts. + +Arguments: + + None. + +Return Value: + + None. +--*/ +{ + UCHAR DataByte; + + // + // Initialize the SIO NMI interrupt. + // + + KeInitializeInterrupt( &HalpEisaNmiInterrupt, + HalHandleNMI, + NULL, + NULL, + EISA_NMI_VECTOR, + EISA_NMI_LEVEL, + EISA_NMI_LEVEL, + LevelSensitive, + FALSE, + 0, + FALSE + ); + + // + // Don't fail if the interrupt cannot be connected. + // + + KeConnectInterrupt( &HalpEisaNmiInterrupt ); + + // + // Clear the Eisa NMI disable bit. This bit is the high order of the + // NMI enable register. + // + + DataByte = 0; + + WRITE_PORT_UCHAR( + &((PEISA_CONTROL) HalpEisaControlBase)->NmiEnable, + DataByte + ); + +} + +BOOLEAN +HalHandleNMI( + IN PKINTERRUPT Interrupt, + IN PVOID ServiceContext + ) +/*++ + +Routine Description: + + This function is called when an EISA NMI occurs. It print the appropriate + status information and bugchecks. + +Arguments: + + Interrupt - Supplies a pointer to the interrupt object + + ServiceContext - Bug number to call bugcheck with. + +Return Value: + + Returns TRUE. + +--*/ +{ + UCHAR StatusByte; + UCHAR EisaPort; + ULONG port; + ULONG AddressSpace = 1; // 1 = I/O address space + BOOLEAN Status; + PHYSICAL_ADDRESS BusAddress; + PHYSICAL_ADDRESS TranslatedAddress; + + StatusByte = + READ_PORT_UCHAR(&((PEISA_CONTROL) HalpEisaControlBase)->NmiStatus); + + if (StatusByte & 0x80) { + HalDisplayString ("NMI: Parity Check / Parity Error\n"); + } + + if (StatusByte & 0x40) { + HalDisplayString ("NMI: Channel Check / IOCHK\n"); + } + + // + // This is an Isa machine, no extnded nmi information, so just do it. + // + + + KeBugCheck(NMI_HARDWARE_FAILURE); + return(TRUE); +} + + +UCHAR +HalpAcknowledgeEisaInterrupt( + PVOID ServiceContext + ) +/*++ + +Routine Description: + + Acknowledge the EISA interrupt from the programmable interrupt controller. + Return the vector number of the highest priority pending interrupt. + +Arguments: + + ServiceContext - Service context of the interrupt service supplies + a pointer to the EISA interrupt acknowledge register. + +Return Value: + + Return the value of the highest priority pending interrupt. + +--*/ +{ + UCHAR InterruptVector; + + // + // Read the interrupt vector from the PIC. + // + + InterruptVector = READ_PORT_UCHAR(ServiceContext); + + return( InterruptVector ); + +} + +VOID +HalpAcknowledgeClockInterrupt( + VOID + ) +/*++ + +Routine Description: + + Acknowledge the clock interrupt from the interval timer. The interval + timer for EB66 comes from the Dallas real-time clock. + +Arguments: + + None. + +Return Value: + + None. + +--*/ +{ + + // + // Acknowledge the clock interrupt by reading the control register C of + // the Real Time Clock. + // + + HalpReadClockRegister( RTC_CONTROL_REGISTERC ); + + return; +} + +VOID +HalpInitializePciInterrupts ( + VOID + ) +/*++ + +Routine Description: + + This routine initializes the PCI device interrupt mask. + +Arguments: + + None. + +Return Value: + + None. + +--*/ +{ + // + // Initialize the shadow copies of the interrupt masks to enable only + // the SIO interrupt. + // + + IntMask0 = (UCHAR)SIO_INTERRUPT_MASK; + IntMask1 = 0; + IntMask2 = 0; + + // + // Write the masks. + // + WRITE_PORT_UCHAR(INTERRUPT_MASK0_QVA, ~IntMask0); + WRITE_PORT_UCHAR(INTERRUPT_MASK1_QVA, ~IntMask1); + if (INTERRUPT_MASK2_QVA != NULL) { + WRITE_PORT_UCHAR(INTERRUPT_MASK2_QVA, ~IntMask2); + } +} diff --git a/private/ntos/nthals/haleb66/alpha/ebmapio.c b/private/ntos/nthals/haleb66/alpha/ebmapio.c new file mode 100644 index 000000000..e779d23a6 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ebmapio.c @@ -0,0 +1,158 @@ +/*++ + +Copyright (c) 1992 Digital Equipment Corporation + +Module Name: + + ebmapio.c + +Abstract: + + This maps I/O addresses used by the HAL on Low Cost Alpha (LCA) machines. + +Author: + + Wim Colgate (DEC) 26-Oct-1993 + Originally taken from the Jensen hal code. + +Environment: + + Kernel mode + +Revision History: + +--*/ + +#include "halp.h" +#include "eb66def.h" + +// +// Define global data used to locate the EISA control space. +// + +PVOID HalpEisaControlBase; +PVOID HalpEisaIntAckBase; +PVOID HalpCMOSRamBase; + + +BOOLEAN +HalpMapIoSpace ( + VOID + ) + +/*++ + +Routine Description: + + This routine maps the HAL I/O space for a LCA based + system using the Quasi VA. + +Arguments: + + None. + +Return Value: + + If the initialization is successfully completed, than a value of TRUE + is returned. Otherwise, a value of FALSE is returned. + +--*/ + +{ + PVOID PciIoSpaceBase; + + // + // Map the address spaces on the LCA4. + // + + HalpLca4MapAddressSpaces(); + + // + // Map base addresses into QVA space. + // + + PciIoSpaceBase = HAL_MAKE_QVA( HalpLca4PciIoPhysical() ); + + HalpEisaControlBase = PciIoSpaceBase;; + HalpEisaIntAckBase = HAL_MAKE_QVA( HalpLca4PciIntAckPhysical() ); + HalpCMOSRamBase = (PVOID)((ULONG)PciIoSpaceBase + CMOS_ISA_PORT_ADDRESS); + + // + // Map the real-time clock registers. + // + + HalpRtcAddressPort = (PVOID)((ULONG)PciIoSpaceBase + RTC_ISA_ADDRESS_PORT); + HalpRtcDataPort = (PVOID)((ULONG)PciIoSpaceBase + RTC_ISA_DATA_PORT); + + return TRUE; + +} + +ULONG +HalpMapDebugPort( + IN ULONG ComPort, + OUT PULONG ReadQva, + OUT PULONG WriteQva + ) +/*++ + +Routine Description: + + This routine maps the debug com port so that the kernel debugger + may function - if called it is called very earlier in the boot sequence. + +Arguments: + + ComPort - Supplies the number of the com port to use as the debug port. + + ReadQva - Receives the QVA used to access the read registers of the debug + port. + + WriteQva - Receives the QVA used to access the write registers of the + debug port. + +Return Value: + + Returns the base bus address of the device used as the debug port. + +--*/ +{ + ULONG ComPortAddress; + ULONG PortQva; + + // + // Compute the port address, based on the desired com port. + // + + switch( ComPort ){ + + case 1: + + ComPortAddress = COM1_ISA_PORT_ADDRESS; + break; + + case 2: + default: + + ComPortAddress = COM2_ISA_PORT_ADDRESS; + + } + + // + // Map the address spaces on the LCA4. + // + + HalpLca4MapAddressSpaces(); + + // + // Return the QVAs for read and write access. + // + + PortQva = (ULONG)(HAL_MAKE_QVA(HalpLca4PciIoPhysical())) + ComPortAddress; + + *ReadQva = PortQva; + *WriteQva = PortQva; + + return ComPortAddress; + +} diff --git a/private/ntos/nthals/haleb66/alpha/ebsgdma.c b/private/ntos/nthals/haleb66/alpha/ebsgdma.c new file mode 100644 index 000000000..f2f033fad --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ebsgdma.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\ebsgdma.c" + diff --git a/private/ntos/nthals/haleb66/alpha/ebsysint.c b/private/ntos/nthals/haleb66/alpha/ebsysint.c new file mode 100644 index 000000000..4d9e69a36 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ebsysint.c @@ -0,0 +1,424 @@ +/*++ + +Copyright (c) 1993 Digital Equipment Corporation + +Module Name: + + ebsysint.c + +Abstract: + + This module implements the HAL enable/disable system interrupt, and + request interprocessor interrupt routines for a Low Cost Alpha (LCA) + based system. + + Originally taken from JENSEN hal code. + +Author: + + Wim Colgate 26-Oct-1993 + +Environment: + + Kernel mode + +Revision History: + + Dick Bissen [DEC] 12-May-1994 + + Removed all support of the EB66 pass1 module from the code. + +--*/ + +#include "halp.h" +#include "eb66def.h" +#include "axp21064.h" + + + +// +// Define reference to the builtin device interrupt enables. +// + +extern USHORT HalpBuiltinInterruptEnable; +extern BOOLEAN bMustang; + + +VOID +HalDisableSystemInterrupt ( + IN ULONG Vector, + IN KIRQL Irql + ) + +/*++ + +Routine Description: + + This routine disables the specified system interrupt. + +Arguments: + + Vector - Supplies the vector of the system interrupt that is disabled. + + Irql - Supplies the IRQL of the interrupting source. + +Return Value: + + None. + +--*/ + +{ + + ULONG Irq; + KIRQL OldIrql; + + // + // Raise IRQL to the highest level. + // + + KeRaiseIrql(HIGH_LEVEL, &OldIrql); + + // + // If the vector number is within the range of the ISA interrupts, then + // disable the ISA interrrupt. + // + + if (Vector >= ISA_VECTORS && + Vector < MAXIMUM_ISA_VECTOR && + Irql == ISA_DEVICE_LEVEL) { + HalpDisableSioInterrupt(Vector); + } + + // + // If the vector number is within the range of the PCI interrupts, then + // disable the PCI interrrupt. + + if (Vector >= PCI_VECTORS && + Vector < MAXIMUM_PCI_VECTOR && + Irql == PCI_DEVICE_LEVEL) { + HalpDisablePCIInterrupt(Vector); + } + + // + // If the vector is a performance counter vector or one of the internal + // device vectors (serial and keyboard/mouse for LCA) then disable the + // interrupt. + // + + switch (Vector) { + + // + // Performance counter 0 interrupt (internal to 21064) + // + + case PC0_VECTOR: + case PC0_SECONDARY_VECTOR: + + HalpDisable21064PerformanceInterrupt( Vector ); + break; + + // + // Performance counter 1 interrupt (internal to 21064) + // + + case PC1_VECTOR: + case PC1_SECONDARY_VECTOR: + + HalpDisable21064PerformanceInterrupt( Vector ); + break; + + } //end switch Vector + + // + // Lower IRQL to the previous level. + // + + KeLowerIrql(OldIrql); + return; +} + +BOOLEAN +HalEnableSystemInterrupt ( + IN ULONG Vector, + IN KIRQL Irql, + IN KINTERRUPT_MODE InterruptMode + ) + +/*++ + +Routine Description: + + This routine enables the specified system interrupt. + +Arguments: + + Vector - Supplies the vector of the system interrupt that is enabled. + + Irql - Supplies the IRQL of the interrupting source. + + InterruptMode - Supplies the mode of the interrupt; LevelSensitive or + Latched. + +Return Value: + + TRUE if the system interrupt was enabled + +--*/ + +{ + BOOLEAN Enabled = FALSE; + ULONG Irq; + KIRQL OldIrql; + + // + // Raise IRQL to the highest level. + // + + KeRaiseIrql(HIGH_LEVEL, &OldIrql); + + // + // If the vector number is within the range of the ISA interrupts, then + // enable the ISA interrrupt. It must be latched. + // + + if (Vector >= ISA_VECTORS && + Vector < MAXIMUM_ISA_VECTOR && + Irql == ISA_DEVICE_LEVEL) { + HalpEnableSioInterrupt( Vector, InterruptMode ); + Enabled = TRUE; + } + + // + // If the vector number is within the range of the PCI interrupts, then + // enable the PCI interrrupt. PCI interrupts must be LevelSensitve. + // (PCI Spec. 2.2.6) + // + + if (Vector >= PCI_VECTORS && + Vector < MAXIMUM_PCI_VECTOR && + Irql == PCI_DEVICE_LEVEL && + InterruptMode == LevelSensitive) { + HalpEnablePCIInterrupt( Vector ); + Enabled = TRUE; + } + + // + // If the vector is a performance counter vector or one of the + // internal device vectors (serial or keyboard/mouse) then perform + // 21064-specific enable. + // + + switch (Vector) { + + // + // Performance counter 0 (internal to 21064) + // + + case PC0_VECTOR: + case PC0_SECONDARY_VECTOR: + + HalpEnable21064PerformanceInterrupt( Vector, Irql ); + Enabled = TRUE; + break; + + // + // Performance counter 1 (internal to 21064) + // + + case PC1_VECTOR: + case PC1_SECONDARY_VECTOR: + + HalpEnable21064PerformanceInterrupt( Vector, Irql ); + Enabled = TRUE; + break; + + } //end switch Vector + + // + // Lower IRQL to the previous level. + // + + KeLowerIrql(OldIrql); + return Enabled; +} + +ULONG +HalpGetSystemInterruptVector( + IN PBUS_HANDLER BusHandler, + IN PBUS_HANDLER RootHandler, + IN ULONG BusInterruptLevel, + IN ULONG BusInterruptVector, + OUT PKIRQL Irql, + OUT PKAFFINITY Affinity + ) + +/*++ + +Routine Description: + + This function returns the system interrupt vector and IRQL level + corresponding to the specified bus interrupt level and/or vector. The + system interrupt vector and IRQL are suitable for use in a subsequent call + to KeInitializeInterrupt. + + We only use InterfaceType, and BusInterruptLevel. BusInterruptVector + for ISA and EISA are the same as the InterruptLevel, so ignore. + +Arguments: + + BusHandler - Registered BUSHANDLER for the target configuration space + + RootHandler - Registered BUSHANDLER for the orginating HalGetBusData + request. + + BusInterruptLevel - Supplies the bus specific interrupt level. + + BusInterruptVector - Supplies the bus specific interrupt vector. + + Irql - Returns the system request priority. + + Affinity - Returns the affinity for the requested vector + +Return Value: + + Returns the system interrupt vector corresponding to the specified device. + +--*/ + +{ + INTERFACE_TYPE InterfaceType = BusHandler->InterfaceType; + ULONG BusNumber = BusHandler->BusNumber; + + ULONG Vector; + + *Affinity = 1; + + switch (InterfaceType) { + + case ProcessorInternal: + + // + // Handle the internal defined for the processor itself + // and used to control the performance counters in the 21064. + // + + if( (Vector = HalpGet21064PerformanceVector( BusInterruptLevel, + Irql)) != 0 ){ + + // + // Performance counter was successfully recognized. + // + + return Vector; + + } else { + + // + // Unrecognized processor interrupt. + // + + *Irql = 0; + *Affinity = 0; + return 0; + + } //end if Vector + + break; + + case Isa: + + // + // Assumes all ISA devices coming in on same pin + // + + *Irql = ISA_DEVICE_LEVEL; + + // + // The vector is equal to the specified bus level plus the ISA_VECTOR. + // This is assuming that the ISA levels not assigned Interrupt Levels + // in the Beta programming guide are unused in the LCA system. + // Otherwise, need a different encoding scheme. + // + // Not all interrupt levels are actually supported on Beta; + // Should we make some of them illegal here? + + return(BusInterruptLevel + ISA_VECTORS); + break; + + + case Eisa: + + // + // Assumes all EISA devices coming in on same pin + // + + *Irql = EISA_DEVICE_LEVEL; + + // + // The vector is equal to the specified bus level plus the EISA_VECTOR. + // + + return(BusInterruptLevel + EISA_VECTORS); + break; + + case PCIBus: + + // + // Assumes all PCI devices coming in on same pin + // + + *Irql = PCI_DEVICE_LEVEL; + + // + // The vector is equal to the specified bus level plus the PCI_VECTOR. + // + + return((BusInterruptLevel) + PCI_VECTORS); + + break; + + default: + + // + // Not an interface supported on EB66/Mustang systems + // + + *Irql = 0; + *Affinity = 0; + return(0); + break; + + } //end switch(InterfaceType) + +} + +VOID +HalRequestIpi ( + IN ULONG Mask + ) + +/*++ + +Routine Description: + + This routine requests an interprocessor interrupt on a set of processors. + + This routine performs no function on an EB66/Mustang because it is a + uni-processor system. + +Arguments: + + Mask - Supplies the set of processors that are sent an interprocessor + interrupt. + +Return Value: + + None. + +--*/ + +{ + + return; +} diff --git a/private/ntos/nthals/haleb66/alpha/eisasup.c b/private/ntos/nthals/haleb66/alpha/eisasup.c new file mode 100644 index 000000000..0d46ef3e4 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/eisasup.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\eisasup.c" + diff --git a/private/ntos/nthals/haleb66/alpha/environ.c b/private/ntos/nthals/haleb66/alpha/environ.c new file mode 100644 index 000000000..75015a0a0 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/environ.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\environ.c" + diff --git a/private/ntos/nthals/haleb66/alpha/ev4cache.c b/private/ntos/nthals/haleb66/alpha/ev4cache.c new file mode 100644 index 000000000..b0cf9e3be --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ev4cache.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\ev4cache.c" + diff --git a/private/ntos/nthals/haleb66/alpha/ev4int.c b/private/ntos/nthals/haleb66/alpha/ev4int.c new file mode 100644 index 000000000..8a10705d7 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ev4int.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\ev4int.c" + diff --git a/private/ntos/nthals/haleb66/alpha/ev4ints.s b/private/ntos/nthals/haleb66/alpha/ev4ints.s new file mode 100644 index 000000000..6df823ab6 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ev4ints.s @@ -0,0 +1,6 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// +#include "..\halalpha\ev4ints.s" + diff --git a/private/ntos/nthals/haleb66/alpha/ev4mem.s b/private/ntos/nthals/haleb66/alpha/ev4mem.s new file mode 100644 index 000000000..f410d09a3 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ev4mem.s @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\ev4mem.s" + diff --git a/private/ntos/nthals/haleb66/alpha/ev4parit.c b/private/ntos/nthals/haleb66/alpha/ev4parit.c new file mode 100644 index 000000000..74c6d0d00 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ev4parit.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\ev4parit.c" + diff --git a/private/ntos/nthals/haleb66/alpha/ev4prof.c b/private/ntos/nthals/haleb66/alpha/ev4prof.c new file mode 100644 index 000000000..7ecdfa8b7 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ev4prof.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\ev4prof.c" + diff --git a/private/ntos/nthals/haleb66/alpha/flash8k.c b/private/ntos/nthals/haleb66/alpha/flash8k.c new file mode 100644 index 000000000..cfe6f38a2 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/flash8k.c @@ -0,0 +1,5 @@ +#define HalpWriteNVRamBuffer HalpFlash8kWriteNVRamBuffer +#define HalpReadNVRamBuffer HalpFlash8kReadNVRamBuffer +#define HalpCopyNVRamBuffer HalpFlash8kCopyNVRamBuffer +#include "..\..\halalpha\flash8k.c" + diff --git a/private/ntos/nthals/haleb66/alpha/flashdrv.c b/private/ntos/nthals/haleb66/alpha/flashdrv.c new file mode 100644 index 000000000..20b91fc59 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/flashdrv.c @@ -0,0 +1,23 @@ +#include "halp.h" +#include "flash8k.h" + +// +// Flash Drivers +// +// extern declarations of each known flash driver's Initialize() funcion +// are needed here for addition into the list of known drivers. +// +// FlashDriverList is an array of driver Initialize() functions used to +// identify the flash device present in the system. The last entry +// in FlashDriverList must be NULL. +// +extern PFLASH_DRIVER I28F008SA_Initialize(PUCHAR); +extern PFLASH_DRIVER Am29F080_Initialize(PUCHAR); +extern PFLASH_DRIVER Am29F040_Initialize(PUCHAR); + +PFLASH_DRIVER (*FlashDriverList[])(PUCHAR) = { + I28F008SA_Initialize, + Am29F080_Initialize, + Am29F040_Initialize, + NULL}; + diff --git a/private/ntos/nthals/haleb66/alpha/fwreturn.c b/private/ntos/nthals/haleb66/alpha/fwreturn.c new file mode 100644 index 000000000..65ae88cb8 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/fwreturn.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\fwreturn.c" + diff --git a/private/ntos/nthals/haleb66/alpha/haldebug.c b/private/ntos/nthals/haleb66/alpha/haldebug.c new file mode 100644 index 000000000..ce91863ec --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/haldebug.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\haldebug.c" + diff --git a/private/ntos/nthals/haleb66/alpha/halpal.s b/private/ntos/nthals/haleb66/alpha/halpal.s new file mode 100644 index 000000000..fc89f8370 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/halpal.s @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\halpal.s" + diff --git a/private/ntos/nthals/haleb66/alpha/idle.s b/private/ntos/nthals/haleb66/alpha/idle.s new file mode 100644 index 000000000..f517bab2f --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/idle.s @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\idle.s" + diff --git a/private/ntos/nthals/haleb66/alpha/info.c b/private/ntos/nthals/haleb66/alpha/info.c new file mode 100644 index 000000000..22aef63a3 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/info.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\info.c" + diff --git a/private/ntos/nthals/haleb66/alpha/inithal.c b/private/ntos/nthals/haleb66/alpha/inithal.c new file mode 100644 index 000000000..a99cb9a1a --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/inithal.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\inithal.c" + diff --git a/private/ntos/nthals/haleb66/alpha/intsup.s b/private/ntos/nthals/haleb66/alpha/intsup.s new file mode 100644 index 000000000..a7d9f8f4f --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/intsup.s @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// +#include "pcrtc.h" +#include "..\halalpha\intsup.s" + diff --git a/private/ntos/nthals/haleb66/alpha/ioproc.c b/private/ntos/nthals/haleb66/alpha/ioproc.c new file mode 100644 index 000000000..cc65eacde --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/ioproc.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\ioproc.c" + diff --git a/private/ntos/nthals/haleb66/alpha/iousage.c b/private/ntos/nthals/haleb66/alpha/iousage.c new file mode 100644 index 000000000..83cbfb656 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/iousage.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\iousage.c" + diff --git a/private/ntos/nthals/haleb66/alpha/lca4.c b/private/ntos/nthals/haleb66/alpha/lca4.c new file mode 100644 index 000000000..6c2a74470 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/lca4.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\lca4.c" + diff --git a/private/ntos/nthals/haleb66/alpha/lca4err.c b/private/ntos/nthals/haleb66/alpha/lca4err.c new file mode 100644 index 000000000..29b38623e --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/lca4err.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\lca4err.c" + diff --git a/private/ntos/nthals/haleb66/alpha/lcaioacc.s b/private/ntos/nthals/haleb66/alpha/lcaioacc.s new file mode 100644 index 000000000..02bcd070c --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/lcaioacc.s @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\lcaioacc.s" + diff --git a/private/ntos/nthals/haleb66/alpha/machdep.h b/private/ntos/nthals/haleb66/alpha/machdep.h new file mode 100644 index 000000000..364425c7f --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/machdep.h @@ -0,0 +1,43 @@ +/*++ + +Copyright (c) 1993 Digital Equipment Corporation + +Module Name: + + machdep.h + +Abstract: + + This file includes the platform-dependent include files used to + build the HAL. + +Author: + + Joe Notarangelo 01-Dec-1993 + +Environment: + + Kernel mode + +Revision History: + + +--*/ + +#ifndef _MACHDEP_ +#define _MACHDEP_ + +// +// Include EB66 platform-specific definitions. +// + +#include "lca4.h" +#include "eb66def.h" + +// +// Include scatter/gather definitions. +// + +#include "ebsgdma.h" + +#endif //_MACHDEP_ diff --git a/private/ntos/nthals/haleb66/alpha/memory.c b/private/ntos/nthals/haleb66/alpha/memory.c new file mode 100644 index 000000000..76b1eb7df --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/memory.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\memory.c" + diff --git a/private/ntos/nthals/haleb66/alpha/mustdef.h b/private/ntos/nthals/haleb66/alpha/mustdef.h new file mode 100644 index 000000000..7269aeb05 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/mustdef.h @@ -0,0 +1,56 @@ +/*++ + +Copyright (c) 1993 Digital Equipment Corporation + +Module Name: + + mustdef.h + +Abstract: + + This module specifies platform-specific definitions for the + Mustang/EB66 modules. + +Author: + + Joe Notarangelo 22-Oct-1993 + +Revision History: + + +--*/ + +#ifndef _MUSTDEF_ +#define _MUSTDEF_ + +#include "alpharef.h" +#include "lca4.h" +#include "isaaddr.h" + +#define NUMBER_ISA_SLOTS 3 +#define NUMBER_PCI_SLOTS 2 + +// Highest Virtual local PCI Slot - Max of EB66 (9) and Mustang (7) + +#define PCI_MAX_LOCAL_DEVICE 9 + +// Highest PCI interrupt vector is in PCI vector space + +#define PCI_MAX_INTERRUPT_VECTOR (MAXIMUM_PCI_VECTOR - PCI_VECTORS) + +#if !defined(_LANGUAGE_ASSEMBLY) + +// +#define PCI_INTERRUPT_READ_QVA ((PUCHAR)HAL_MAKE_QVA(HalpLca4PciIoPhysical()) + 0x26) +#define PCI_INTERRUPT_MASK_QVA ((PUCHAR)HAL_MAKE_QVA(HalpLca4PciIoPhysical()) + 0x26) + +#endif //!_LANGUAGE_ASSEMBLY + +// +// Define the default processor frequency to be used before the actual +// frequency can be determined. +// + +#define DEFAULT_PROCESSOR_FREQUENCY_MHZ (166) + +#endif // _MUSTDEF_ diff --git a/private/ntos/nthals/haleb66/alpha/pcibus.c b/private/ntos/nthals/haleb66/alpha/pcibus.c new file mode 100644 index 000000000..ea5a1717d --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/pcibus.c @@ -0,0 +1,128 @@ +/*++ + + +Copyright (c) 1993 Microsoft Corporationn, Digital Equipment Corporation + +Module Name: + + pcibus.c + +Abstract: + + Platform-specific PCI bus routines + +Author: + +Environment: + + Kernel mode + +Revision History: + + +--*/ + +#include "halp.h" +#include "pci.h" +#include "pcip.h" +#include "machdep.h" + +extern ULONG PCIMaxBus; + +// +// Local function prototypes +// + +PCI_CONFIGURATION_TYPES +HalpPCIConfigCycleType ( + IN ULONG BusNumber + ); + +VOID +HalpPCIConfigAddr ( + IN ULONG BusNumber, + IN PCI_SLOT_NUMBER Slot, + PPCI_CFG_CYCLE_BITS pPciAddr + ); + +#ifdef AXP_FIRMWARE + +// +// Put these functions in the discardable text section. +// + +#pragma alloc_text(DISTEXT, HalpPCIConfigCycleType ) +#pragma alloc_text(DISTEXT, HalpPCIConfigAddr ) + +#endif //AXP_FIRMWARE + + +PCI_CONFIGURATION_TYPES +HalpPCIConfigCycleType ( + IN PBUS_HANDLER BusHandler + ) +{ + if (BusHandler->BusNumber == 0) { + return PciConfigType0; + } else { + return PciConfigType1; + } +} + + +VOID +HalpPCIConfigAddr ( + IN PBUS_HANDLER BusHandler, + IN PCI_SLOT_NUMBER Slot, + PPCI_CFG_CYCLE_BITS pPciAddr + ) +{ + PCI_CONFIGURATION_TYPES ConfigType; + + ConfigType = HalpPCIConfigCycleType(BusHandler); + + if (ConfigType == PciConfigType0) + { + // + // Initialize PciAddr for a type 0 configuration cycle + // + // Device number is mapped to address bits 11:24, which are wired to IDSEL pins. + // Note that HalpValidPCISlot has already done bounds checking on DeviceNumber. + // + // PciAddr can be intialized for different bus numbers + // with distinct configuration spaces here. + // + + pPciAddr->u.AsULONG = (ULONG) LCA4_PCI_CONFIG_BASE_QVA; + pPciAddr->u.AsULONG += ( 1 << (Slot.u.bits.DeviceNumber + 11) ); + pPciAddr->u.bits0.FunctionNumber = Slot.u.bits.FunctionNumber; + pPciAddr->u.bits0.Reserved1 = PciConfigType0; + +#if DBG + DbgPrint("Type 0 PCI Config Access @ %x\n", pPciAddr->u.AsULONG); +#endif // DBG + + } + else + { + // + // Initialize PciAddr for a type 1 configuration cycle + // + // + + pPciAddr->u.AsULONG = (ULONG) LCA4_PCI_CONFIG_BASE_QVA; + pPciAddr->u.bits1.BusNumber = BusHandler->BusNumber; + pPciAddr->u.bits1.FunctionNumber = Slot.u.bits.FunctionNumber; + pPciAddr->u.bits1.DeviceNumber = Slot.u.bits.DeviceNumber; + pPciAddr->u.bits1.Reserved1 = PciConfigType1; + +#if DBG + DbgPrint("Type 1 PCI Config Access @ %x\n", pPciAddr->u.AsULONG); +#endif // DBG + + } + + return; +} + + diff --git a/private/ntos/nthals/haleb66/alpha/pcisio.c b/private/ntos/nthals/haleb66/alpha/pcisio.c new file mode 100644 index 000000000..cf5f0f462 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/pcisio.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\pcisio.c" + diff --git a/private/ntos/nthals/haleb66/alpha/pcisup.c b/private/ntos/nthals/haleb66/alpha/pcisup.c new file mode 100644 index 000000000..360919f42 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/pcisup.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\pcisup.c" + diff --git a/private/ntos/nthals/haleb66/alpha/pcrtc.c b/private/ntos/nthals/haleb66/alpha/pcrtc.c new file mode 100644 index 000000000..2e57b87d6 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/pcrtc.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\pcrtc.c" + diff --git a/private/ntos/nthals/haleb66/alpha/pcserial.c b/private/ntos/nthals/haleb66/alpha/pcserial.c new file mode 100644 index 000000000..a2f159c48 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/pcserial.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\pcserial.c" + diff --git a/private/ntos/nthals/haleb66/alpha/pcspeakr.c b/private/ntos/nthals/haleb66/alpha/pcspeakr.c new file mode 100644 index 000000000..807b6f324 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/pcspeakr.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\pcspeakr.c" + diff --git a/private/ntos/nthals/haleb66/alpha/perfcntr.c b/private/ntos/nthals/haleb66/alpha/perfcntr.c new file mode 100644 index 000000000..6c0a8f892 --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/perfcntr.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\perfcntr.c" + diff --git a/private/ntos/nthals/haleb66/alpha/pintolin.h b/private/ntos/nthals/haleb66/alpha/pintolin.h new file mode 100644 index 000000000..e6af4110c --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/pintolin.h @@ -0,0 +1,192 @@ +/*++ + +Copyright (c) 1993 Microsoft Corporation +Copyright (c) 1994 Digital Equipment Corporation + +Module Name: + + pintolin.h + +Abstract: + + This file includes the platform-dependent Pin To Line Table + for EB66 and Mustang. + +Author: + +Environment: + + Kernel mode + +Revision History: + + James Livingston (Digital) 23-June-1994 + Extracted these tables from ebintsup.c for EB66. + + Anonymous (Digital) date uncertain + Combined tables for EB66 and Mustang to go with combined + ebintsup.c + + Dick Bissen [DEC] 12-May-1994 + + Removed all support of the EB66 pass1 module from the code. + +--*/ +// +// These tables represent the mapping from slot number and interrupt pin +// into a PCI Interrupt Vector. +// On Mustang and EB66, the interrupt vector is Interrupt Request Register bit +// representing that interrupt + 1. +// On EB66, the value also represents the Interrupt Mask Register Bit, +// since it is identical to the Interrupt Read Register. On Mustang, +// the Interrupt Mask Register only allows masking of all interrupts +// from the two plug-in slots. +// +// Formally, these mappings can be expressed as: +// +// PCIPinToLine: +// SlotNumber.DeviceNumber x InterruptPin -> InterruptLine +// +// LineToVector: +// InterruptLine -> InterruptVector +// +// VectorToIRRBit: +// InterruptVector -> InterruptRequestRegisterBit +// +// VectorToIMRBit: +// InterruptVector -> InterruptMaskRegisterBit +// +// SlotNumberToIDSEL: +// SlotNumber.DeviceNumber -> IDSEL +// +// subject to following invariants (predicates must always be true): +// +// Slot.DeviceNumber in {0,...,15} +// +// InterruptPin in {1, 2, 3, 4} +// +// InterruptRequestRegisterBit in {0,...,15} +// +// InterruptMaskRegisterBit in {0,...,15} +// +// PCIPinToLine(SlotNumber.DeviceNumber, InterruptPin) = +// PCIPinToLineTable[SlotNumber.DeviceNumber, InterruptPin] +// (Table-lookup function initialized below) +// +// LineToVector(InterruptLine) = PCI_VECTORS + InterruptLine +// +// VectorToIRRBit(InterruptVector) = InterruptVector - 1 +// +// VectorToIMRBit(InterruptVector) [see below] +// +// SlotNumberToIDSEL(SlotNumber.DeviceNumber) = (1 << (Slot.DeviceNumber + 11)) +// +// where: +// +// SlotNumber.DeviceNumber: +// Alpha AXP Platforms receive interrupts on local PCI buses only, which +// are limited to 16 devices (PCI AD[11]-AD[26]). (We loose AD[17]-AD[31] +// since PCI Config space is a sparse space, requiring a five-bit shift.) +// +// InterruptPin: +// Each virtual slot has up to four interrupt pins INTA#, INTB#, INTC#, INTD#, +// as per the PCI Spec. V2.0, Section 2.2.6. (FYI, only multifunction devices +// use INTB#, INTC#, INTD#.) +// +// PCI configuration space indicates which interrupt pin a device will use +// in the InterruptPin register, which has the values: +// +// INTA# = 1, INTB#=2, INTC#=3, INTD# = 4 +// +// Note that there may be up to 8 functions/device on a PCI multifunction +// device plugged into the option slots, e.g., Slot #0. +// Each function has its own PCI configuration space, addressed +// by the SlotNumber.FunctionNumber field, and will identify which +// interrput pin of the four it will use in its own InterruptPin register. +// +// If the option is a PCI-PCI bridge, interrupts across the bridge will +// somehow be combined to appear on some combination of the four +// interrupt pins that the bridge plugs into. +// +// InterruptLine: +// This PCI Configuration register, unlike x86 PC's, is maintained by +// software and represents offset into PCI interrupt vectors. +// Whenever HalGetBusData or HalGetBusDataByOffset is called, +// HalpPCIPinToLine() computes the correct InterruptLine register value +// by using the HalpPCIPinToLineTable mapping. +// +// InterruptRequestRegisterBit: +// 0xff is used to mark an invalid IRR bit, hence an invalid request +// for a vector. Also, note that the 16 bits of the EB66 IRR must +// be access as two 8-bit reads. +// +// InterruptMaskRegisterBit: +// On EB66, the PinToLine table may also be find the to write the +// InterruptMaskRegister. Formally, we can express this invariant as +// +// VectorToIMRBit(InterrruptVector) = InterruptVector - 1 +// +// On Mustang, the table is useless. The InterruptMaskRegister has +// only two bits the completely mask all interrupts from either +// Slot #0 or Slot#1 (PCI AD[17] and AD[18]): +// +// InterruptVector in {3,4,5,6} then VectorToIMRBit(InterruptVector) = 0 +// InterruptVector in {7,8,9,10} then VectorToIMRBit(InterruptVector) = 1 +// +// IDSEL: +// For accessing PCI configuration space on a local PCI bus (as opposed +// to over a PCI-PCI bridge), type 0 configuration cycles must be generated. +// In this case, the IDSEL pin of the device to be accessed is tied to one +// of the PCI Address lines AD[11] - AD[26]. (The function field in the +// PCI address is used should we be accessing a multifunction device.) +// Anyway, virtual slot 0 represents the device with IDSEL = AD[11], and +// so on. +// + +// +// Interrupt Vector Table Mapping for EB66 +// +// You can limit init table to MAX_PCI_LOCAL_DEVICES entries. +// The highest virtual slot between EB66 and Mustang is 9, so +// MAX_PCI_LOCAL_DEVICE is defined as 9 in the platform dependent +// header file (MUSTDEF.H). HalpValidPCISlot assures us that +// we won't ever try to set an InterruptLine register of a slot +// greater than Virtual slot 9 = PCI_AD[20]. +// + +ULONG *HalpPCIPinToLineTable; + +ULONG EB66PCIPinToLineTable[][4]= +{ + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 0 = PCI_AD[11] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 1 = PCI_AD[12] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 2 = PCI_AD[13] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 3 = PCI_AD[14] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 4 = PCI_AD[15] + { 0x8, 0xff, 0xff, 0xff }, // Virtual Slot 5 = PCI_AD[16] SCSI + { 0x1, 0x3, 0x5, 0xa }, // Virtual Slot 6 = PCI_AD[17] Slot #0 + { 0x2, 0x4, 0x9, 0xb }, // Virtual Slot 7 = PCI_AD[18] Slot #1 + { 0x6, 0xff, 0xff, 0xff }, // Virtual Slot 8 = PCI_AD[19] SIO + { 0x7, 0xff, 0xff, 0xff } // Virtual Slot 9 = PCI_AD[20] Tulip +}; + +// +// Interrupt Vector Table Mapping for EB66p +// + +ULONG EB66PPCIPinToLineTable[][4]= +{ +// Pin 1 Pin 2 Pin 3 Pin 4 +// ----- ----- ----- ----- + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 0 = PCI_AD[11] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 1 = PCI_AD[12] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 2 = PCI_AD[13] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 3 = PCI_AD[14] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 4 = PCI_AD[15] + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 5 = PCI_AD[16] + { 0x1, 0x6, 0xa, 0xe }, // Virtual Slot 6 = PCI_AD[17] Slot #0 + { 0x2, 0x7, 0xb, 0xf }, // Virtual Slot 7 = PCI_AD[18] Slot #1 + { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 8 = PCI_AD[19] SIO + { 0x3, 0x8, 0xc, 0x10 }, // Virtual Slot 9 = PCI_AD[20] Slot #2 + { 0x4, 0x9, 0xd, 0x11 } // Virtual Slot 10 = PCI_AD[21] Slot #3 +}; diff --git a/private/ntos/nthals/haleb66/alpha/vga.c b/private/ntos/nthals/haleb66/alpha/vga.c new file mode 100644 index 000000000..764c585af --- /dev/null +++ b/private/ntos/nthals/haleb66/alpha/vga.c @@ -0,0 +1,7 @@ +// +// This file simply includes the source file from the common Alpha +// HAL directory. +// + +#include "..\halalpha\vga.c" + -- cgit v1.2.3