summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halast/i386/astdetct.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ntos/nthals/halast/i386/astdetct.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/ntos/nthals/halast/i386/astdetct.c')
-rw-r--r--private/ntos/nthals/halast/i386/astdetct.c169
1 files changed, 169 insertions, 0 deletions
diff --git a/private/ntos/nthals/halast/i386/astdetct.c b/private/ntos/nthals/halast/i386/astdetct.c
new file mode 100644
index 000000000..cf2c00e90
--- /dev/null
+++ b/private/ntos/nthals/halast/i386/astdetct.c
@@ -0,0 +1,169 @@
+/*++
+
+Copyright (c) 1992 AST Research Inc.
+
+Module Name:
+
+ astdetct.c
+
+Abstract:
+
+
+Author:
+
+ Bob Beard (v-bobb) 24-Jul-1992
+
+Environment:
+
+ Kernel mode only.
+
+Revision History:
+
+ Bob Beard (v-bobb) 19-Aug-1992 detect if MP
+ Quang Phan (v-quangp) 27-Aug-1992 modified to work with the NT Setup
+ program.
+
+--*/
+
+#ifndef _NTOS_
+#include "nthal.h"
+#endif
+
+#include "halp.h"
+#include "astebiii.h"
+
+#define AST_MANUFACTURER_ID 0x0674
+#define AST_EBI2_STRING 0x32494245
+
+ULONG ProcCount;
+//#define MAX_EBI_SLOTS 32L
+//VOID* EBI2_MMIOTable[MAX_EBI_SLOTS];
+
+//
+// EBI_II function offset table
+//
+
+EBI_II EBI2_CallTab;
+
+//
+// Global pointer to BIOS
+//
+
+PVOID BiosPtr;
+
+BOOLEAN
+GetProcCount()
+/*++
+
+Routine Description:
+ Call EBI2 to get the number of processors in the system.
+ To make this call work with the NT current Setup environment,
+ (memory address limited to 16MB), a fake MMIOTable is passed to EBI.
+ ProcCount contains the number of processors in the system.
+
+Arguments:
+ none.
+
+Return Value:
+ True if successfully initialized. False otherwise.
+
+--*/
+{
+
+ULONG i;
+ULONG *Alias = (ULONG *)&EBI2_CallTab;
+ebi_iiSig *Sig = (ebi_iiSig*)((ULONG)BiosPtr + EBI_II_SIGNATURE);
+ULONG *OffTab;
+
+//
+// Build the EBI II offset table
+//
+
+ OffTab =(ULONG *) ((ULONG)BiosPtr + (REAL_TO_LIN(Sig->seg,Sig->off) -
+ REAL_TO_LIN(BIOS_SEG, 0)));
+ for( i = 0; i < ( sizeof( offsetTable ) / sizeof( ULONG )); i++ )
+ Alias[i] = OffTab[i] + (ULONG)BiosPtr;
+
+//
+// Find out the number of good processors
+//
+
+if ( (EBI2_CallTab.GetNumProcs)( (VOID *) 0, &ProcCount ) )
+ return(FALSE);
+
+ return(TRUE);
+}
+
+
+
+ULONG
+DetectAST(
+ OUT PBOOLEAN IsConfiguredMp
+)
+/*++
+
+Routine Description:
+ Determine on which AST platform we are running. Special HAL is needed
+ for EBI II based AST machines.
+
+Arguments:
+ PBOOLEAN IsConfiguredMp returns with value of TRUE if MP. FALSE if
+ UP.
+
+Return Value:
+ Boolean that indicates if AST EBI II platform is detected. TRUE means
+ an AST EBI II platform was detected. FALSE indicates it was not.
+
+
+--*/
+{
+
+USHORT ManufacturerId;
+PULONG EBI2StringPtr;
+ULONG ProcCount;
+UCHAR ProductId;
+
+//
+// Read the EISA ManufactuerID and check for AST
+//
+
+ManufacturerId = (((USHORT)(READ_PORT_UCHAR((PUCHAR)0xc80))) << 8)
+ | (READ_PORT_UCHAR((PUCHAR)0xc81));
+if (ManufacturerId != AST_MANUFACTURER_ID)
+ return(FALSE);
+
+//
+//This HAL works with Manhattans that have EISA's ProductId 0x40-0x4F.
+//
+
+ProductId = ((READ_PORT_UCHAR((PUCHAR)0xc82)));
+if ((ProductId & 0xF0) != 0x40)
+ return(FALSE);
+
+//
+// Map in all of AST BIOS for EBI II calls
+//
+
+BiosPtr = (PVOID)((ULONG)REAL_TO_LIN( BIOS_SEG, 0 ));
+BiosPtr = HalpMapPhysicalMemory(BiosPtr, 0x10000/PAGE_SIZE); // assumes PAGE_SIZE <= 64k
+if (BiosPtr == NULL)
+ return(FALSE);
+
+EBI2StringPtr = (PULONG)((ULONG)BiosPtr + EBI_II_SIGNATURE);
+if (*EBI2StringPtr != AST_EBI2_STRING)
+ return(FALSE);
+
+//
+// Call EBI II to get num. of processors
+//
+if (!GetProcCount())
+ return(FALSE);
+
+//
+// This is an MP hal
+//
+
+ *IsConfiguredMp = TRUE;
+
+return(TRUE);
+}