[ros-diffs] [tkreuzer] 43173: Merge HAL changes 34743, 34812, 34839, 34917, 35515, 35771, 35902, 35904, 35905, 35906, 35942, 35947, 35948, 35949, 35953, 36013, 36388, 36389, 36570, 37873, 37991, 39151 from amd64 branch

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Sep 26 23:32:54 CEST 2009


Author: tkreuzer
Date: Sat Sep 26 23:32:53 2009
New Revision: 43173

URL: http://svn.reactos.org/svn/reactos?rev=43173&view=rev
Log:
Merge HAL changes 34743, 34812, 34839, 34917, 35515, 35771, 35902, 35904, 
35905, 35906, 35942, 35947, 35948, 35949, 35953, 36013, 36388, 36389, 36570, 37873, 37991, 39151 from amd64 branch

Added:
    trunk/reactos/hal/hal/hal_amd64.def   (with props)
    trunk/reactos/hal/halamd64/
      - copied from r34743, branches/ros-amd64-bringup/reactos/hal/halamd64/
    trunk/reactos/hal/halamd64/directory.rbuild
      - copied unchanged from r34812, branches/ros-amd64-bringup/reactos/hal/halamd64/directory.rbuild
    trunk/reactos/hal/halamd64/generic/
      - copied from r34812, branches/ros-amd64-bringup/reactos/hal/halamd64/generic/
    trunk/reactos/hal/halamd64/generic/halinit.c
      - copied unchanged from r35905, branches/ros-amd64-bringup/reactos/hal/halamd64/generic/halinit.c
    trunk/reactos/hal/halamd64/generic/irq.S
      - copied, changed from r35905, branches/ros-amd64-bringup/reactos/hal/halamd64/generic/irq.S
    trunk/reactos/hal/halamd64/generic/misc.c
      - copied unchanged from r35905, branches/ros-amd64-bringup/reactos/hal/halamd64/generic/misc.c
    trunk/reactos/hal/halamd64/generic/mps.S
      - copied unchanged from r35947, branches/ros-amd64-bringup/reactos/hal/halamd64/generic/mps.S
    trunk/reactos/hal/halamd64/generic/systimer.S
      - copied unchanged from r35905, branches/ros-amd64-bringup/reactos/hal/halamd64/generic/systimer.S
    trunk/reactos/hal/halamd64/include/
      - copied from r34812, branches/ros-amd64-bringup/reactos/hal/halamd64/include/
    trunk/reactos/hal/halamd64/include/bus.h
      - copied unchanged from r35905, branches/ros-amd64-bringup/reactos/hal/halamd64/include/bus.h
    trunk/reactos/hal/halamd64/up/
      - copied from r34812, branches/ros-amd64-bringup/reactos/hal/halamd64/up/
    trunk/reactos/hal/halamd64/up/processor.c
      - copied unchanged from r35905, branches/ros-amd64-bringup/reactos/hal/halamd64/up/processor.c
    trunk/reactos/hal/halx86/hal_generic_amd64.rbuild
      - copied, changed from r35905, branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_amd64.rbuild
Modified:
    trunk/reactos/   (props changed)
    trunk/reactos/hal/hal.rbuild
    trunk/reactos/hal/hal/hal.c
    trunk/reactos/hal/hal/hal.rbuild
    trunk/reactos/hal/halamd64/generic/generic.rbuild
    trunk/reactos/hal/halamd64/include/hal.h
    trunk/reactos/hal/halamd64/include/halp.h
    trunk/reactos/hal/halamd64/up/halup.rbuild
    trunk/reactos/hal/halx86/generic/timer.c
    trunk/reactos/hal/halx86/include/apic.h
    trunk/reactos/hal/halx86/include/bus.h
    trunk/reactos/hal/halx86/include/hal.h
    trunk/reactos/hal/halx86/include/halp.h
    trunk/reactos/hal/halx86/mp/apic.c

Propchange: trunk/reactos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 26 23:32:53 2009
@@ -1,1 +1,1 @@
-/branches/ros-amd64-bringup/reactos:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
+/branches/ros-amd64-bringup/reactos:34743,34812,34839,34917,35515,35746,35771,35789,35902,35904-35906,35942,35947-35949,35953,36013,36388-36389,36570,36614,36930,37873,37991,38148,38151,38265,38268,39151,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080

Modified: trunk/reactos/hal/hal.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal.rbuild?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/hal.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/hal.rbuild [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -26,4 +26,12 @@
 			<xi:include href="halarm/directory.rbuild" />
 		</directory>
 	</if>
+	<if property="ARCH" value="amd64">
+		<directory name="halx86">
+			<xi:include href="halx86/hal_generic_amd64.rbuild" />
+		</directory>
+		<directory name="halamd64">
+			<xi:include href="halamd64/directory.rbuild" />
+		</directory>
+	</if>
 </group>

Modified: trunk/reactos/hal/hal/hal.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal/hal.c?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/hal/hal.c [iso-8859-1] (original)
+++ trunk/reactos/hal/hal/hal.c [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -75,6 +75,7 @@
     return Interval;
 }
 
+#ifndef _M_AMD64
 VOID
 FASTCALL
 ExAcquireFastMutex(
@@ -101,7 +102,7 @@
 
   return TRUE;
 }
-
+#endif
 
 VOID
 NTAPI
@@ -466,7 +467,7 @@
 VOID
 NTAPI
 HalRequestIpi(
-  ULONG Unknown)
+    KAFFINITY TargetSet)
 {
   UNIMPLEMENTED;
 }
@@ -747,7 +748,7 @@
   return 0;
 }
 
-
+#ifndef _M_AMD64
 VOID
 FASTCALL
 KeAcquireInStackQueuedSpinLock(
@@ -776,6 +777,7 @@
 {
   UNIMPLEMENTED;
 }
+#endif
 
 VOID
 NTAPI
@@ -784,6 +786,7 @@
   UNIMPLEMENTED;
 }
 
+#ifndef _M_AMD64
 #undef KeGetCurrentIrql
 KIRQL
 NTAPI
@@ -802,6 +805,7 @@
 {
   UNIMPLEMENTED;
 }
+#endif
 
 
 LARGE_INTEGER
@@ -818,6 +822,7 @@
   return Value;
 }
 
+#ifndef _M_AMD64
 #undef KeRaiseIrql
 VOID
 NTAPI
@@ -847,7 +852,9 @@
 
   return (KIRQL)0;
 }
-
+#endif
+
+#ifndef _M_AMD64
 #undef KeReleaseSpinLock
 VOID
 NTAPI
@@ -857,7 +864,7 @@
 {
   UNIMPLEMENTED;
 }
-
+#endif
 
 VOID
 NTAPI
@@ -891,7 +898,7 @@
   return FALSE;
 }
 
-
+#if !defined(_M_AMD64)
 KIRQL
 FASTCALL
 KfAcquireSpinLock(
@@ -931,8 +938,9 @@
 {
   UNIMPLEMENTED;
 }
-
-
+#endif
+
+#if !defined(_M_AMD64)
 VOID
 NTAPI
 READ_PORT_BUFFER_UCHAR(
@@ -1058,6 +1066,7 @@
 {
   UNIMPLEMENTED;
 }
+#endif
 
 KIRQL
 FASTCALL

Modified: trunk/reactos/hal/hal/hal.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal/hal.rbuild?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/hal/hal.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/hal/hal.rbuild [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -10,8 +10,8 @@
 		<file>hal.c</file>
 		<file>hal.rc</file>
 	</module>
-    </if>
-    <if property="ARCH" value="i386">
+	</if>
+	<if property="ARCH" value="i386">
 	<module name="hal" type="kernelmodedll">
 		<importlibrary definition="hal.pspec" />
 		<include base="ntoskrnl">include</include>
@@ -20,7 +20,7 @@
 		<file>hal.c</file>
 		<file>hal.rc</file>
 	</module>
-    </if>
+	</if>
 	<if property="ARCH" value="i386">
 		<module ifnot="false" name="halupalias" type="alias" installbase="system32" installname="hal.dll" aliasof="halup">
 		</module>
@@ -30,4 +30,14 @@
 	<if property="ARCH" value="powerpc">
 		<module name="halupalias" type="alias" installbase="system32" installname="hal.dll" aliasof="halppc_up"/>
 	</if>
+	<if property="ARCH" value="amd64">
+	<module name="hal" type="kernelmodedll">
+		<importlibrary definition="hal_amd64.def" />
+		<include base="ntoskrnl">include</include>
+		<library>ntoskrnl</library>
+		<define name="_NTHAL_" />
+		<file>hal.c</file>
+		<file>hal.rc</file>
+	</module>
+	</if>
 </group>

Added: trunk/reactos/hal/hal/hal_amd64.def
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal/hal_amd64.def?rev=43173&view=auto
==============================================================================
--- trunk/reactos/hal/hal/hal_amd64.def (added)
+++ trunk/reactos/hal/hal/hal_amd64.def [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -1,0 +1,86 @@
+; Hardware Abstraction Layer - ReactOS Operating System
+
+LIBRARY hal.dll
+
+EXPORTS
+HalAcquireDisplayOwnership
+HalAdjustResourceList
+HalAllProcessorsStarted
+HalAllocateAdapterChannel
+HalAllocateCommonBuffer
+HalAllocateCrashDumpRegisters
+HalAssignSlotResources
+;HalBugCheckSystem
+HalCalibratePerformanceCounter
+HalClearSoftwareInterrupt
+;HalConvertDeviceIdtToIrql
+;HalDisableInterrupt
+HalDisplayString
+;HalEnableInterrupt
+;HalEnumerateEnvironmentVariablesEx
+;HalEnumerateProcessors
+HalFlushCommonBuffer
+HalFreeCommonBuffer
+HalGetAdapter
+HalGetBusData
+HalGetBusDataByOffset
+HalGetEnvironmentVariable
+;HalGetEnvironmentVariableEx
+;HalGetInterruptTargetInformation
+HalGetInterruptVector
+;HalGetMessageRoutingInfo
+;HalGetProcessorIdByNtNumber
+;HalGetVectorInput
+;HalHandleMcheck
+HalHandleNMI
+HalInitSystem
+;HalInitializeBios
+;HalInitializeOnResume
+HalInitializeProcessor
+;HalIsHyperThreadingEnabled
+HalMakeBeep
+HalProcessorIdle
+HalQueryDisplayParameters
+;HalQueryEnvironmentVariableInfoEx
+;HalQueryMaximumProcessorCount
+HalQueryRealTimeClock
+HalReadDmaCounter
+;HalRegisterDynamicProcessor
+;HalRegisterErrataCallbacks
+HalReportResourceUsage
+HalRequestIpi
+HalRequestSoftwareInterrupt
+HalReturnToFirmware
+;HalSendNMI
+;HalSendSoftwareInterrupt
+HalSetBusData
+HalSetBusDataByOffset
+HalSetDisplayParameters
+HalSetEnvironmentVariable
+;HalSetEnvironmentVariableEx
+HalSetProfileInterval
+HalSetRealTimeClock
+HalSetTimeIncrement
+;HalStartDynamicProcessor
+HalStartNextProcessor
+HalStartProfileInterrupt
+HalStopProfileInterrupt
+HalSystemVectorDispatchEntry
+HalTranslateBusAddress
+IoAssignDriveLetters
+IoFlushAdapterBuffers
+IoFreeAdapterChannel
+IoFreeMapRegisters
+IoMapTransfer
+IoReadPartitionTable
+IoSetPartitionInformation
+IoWritePartitionTable
+KdComPortInUse=_KdComPortInUse DATA
+KeFlushWriteBuffer
+KeQueryPerformanceCounter
+KeStallExecutionProcessor
+;x86BiosAllocateBuffer
+;x86BiosCall
+;x86BiosFreeBuffer
+;x86BiosReadMemory
+;x86BiosWriteMemory

Propchange: trunk/reactos/hal/hal/hal_amd64.def
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/hal/halamd64/generic/generic.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halamd64/generic/generic.rbuild?rev=43173&r1=34812&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halamd64/generic/generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/halamd64/generic/generic.rbuild [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -1,10 +1,16 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="halamd64_generic" type="objectlibrary">
-	<include base="halamd64_generic">../include</include>
-	<include base="ntoskrnl">include</include>
-	<define name="_DISABLE_TIDENTS" />
-	<define name="_NTHAL_" />
-	<file>hal.c</file>
-	<pch>../include/hal.h</pch>
-</module>
+<group>
+	<module name="hal_generic" type="objectlibrary">
+		<include base="hal_generic">../include</include>
+		<include base="ntoskrnl">include</include>
+		<define name="_DISABLE_TIDENTS" />
+		<define name="_NTHAL_" />
+		<file>halinit.c</file>
+		<file>irq.S</file>
+		<file>misc.c</file>
+		<file>mps.S</file>
+		<file>systimer.S</file>
+		<pch>../include/hal.h</pch>
+	</module>
+</group>

Copied: trunk/reactos/hal/halamd64/generic/irq.S (from r35905, branches/ros-amd64-bringup/reactos/hal/halamd64/generic/irq.S)
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halamd64/generic/irq.S?p2=trunk/reactos/hal/halamd64/generic/irq.S&p1=branches/ros-amd64-bringup/reactos/hal/halamd64/generic/irq.S&r1=35905&r2=43173&rev=43173&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halamd64/generic/irq.S [iso-8859-1] (original)
+++ trunk/reactos/hal/halamd64/generic/irq.S [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -14,7 +14,7 @@
 .macro UNIMPLEMENTED func
     jmp 2f
 1:
-    .ascii "Sory, asm function "
+    .ascii "Sorry, asm function "
     .ascii func
     .ascii " is unimplemented!\n\0"
 2:
@@ -34,13 +34,44 @@
 .globl _HalpInitPICs
 .func _HalpInitPICs
 _HalpInitPICs:
-UNIMPLEMENTED "HalpInitPICs"
+    UNIMPLEMENTED "HalpInitPICs"
+.endfunc
 
+.global _HalEnableInterrupt
+.func _HalEnableInterrupt
+_HalEnableInterrupt:
+    UNIMPLEMENTED "HalEnableInterrupt"
 .endfunc
+
+.global _HalDisableInterrupt
+.func _HalDisableInterrupt
+_HalDisableInterrupt:
+    UNIMPLEMENTED "HalDisableInterrupt"
+.endfunc
+
+.global _HalRequestSoftwareInterrupt
+.func _HalRequestSoftwareInterrupt
+_HalRequestSoftwareInterrupt:
+    UNIMPLEMENTED "HalRequestSoftwareInterrupt"
+.endfunc
+
+.global _HalSendSoftwareInterrupt
+.func _HalSendSoftwareInterrupt
+_HalSendSoftwareInterrupt:
+    UNIMPLEMENTED "HalSendSoftwareInterrupt"
+.endfunc
+
+.global _HalEndSystemInterrupt
+.func _HalEndSystemInterrupt
+_HalEndSystemInterrupt:
+    UNIMPLEMENTED "HalEndSystemInterrupt"
+.endfunc
+
 
 .globl _HalClearSoftwareInterrupt
 .func _HalClearSoftwareInterrupt
 _HalClearSoftwareInterrupt:
+    UNIMPLEMENTED "HalClearSoftwareInterrupt"
 
     /* Get IRR mask */
     mov eax, 1
@@ -52,42 +83,9 @@
     ret
 .endfunc
 
-.globl _HalRequestSoftwareInterrupt
-.func _HalRequestSoftwareInterrupt
-_HalRequestSoftwareInterrupt:
-UNIMPLEMENTED "HalRequestSoftwareInterrupt"
-.endfunc
-
 .globl _HalBeginSystemInterrupt
 .func _HalBeginSystemInterrupt
 _HalBeginSystemInterrupt:
-UNIMPLEMENTED "HalBeginSystemInterrupt"
+    UNIMPLEMENTED "HalBeginSystemInterrupt"
 .endfunc
 
-.globl _HalpApcInterrupt
-.func _HalpApcInterrupt
-//TRAP_FIXUPS hapc_a, hapc_t, DoFixupV86, DoFixupAbios
-_HalpApcInterrupt:
-UNIMPLEMENTED "HalpApcInterrupt"
-.endfunc
-
-.globl _HalpApcInterrupt2ndEntry
-.func _HalpApcInterrupt2ndEntry
-_HalpApcInterrupt2ndEntry:
-UNIMPLEMENTED "HalpApcInterrupt2ndEntry"
-.endfunc
-
-.globl _HalpDispatchInterrupt
-.func _HalpDispatchInterrupt
-//TRAP_FIXUPS hdpc_a, hdpc_t, DoFixupV86, DoFixupAbios
-_HalpDispatchInterrupt:
-UNIMPLEMENTED "HalpDispatchInterrupt"
-.endfunc
-
-
-.globl _HalpDispatchInterrupt2ndEntry
-.func _HalpDispatchInterrupt2ndEntry
-_HalpDispatchInterrupt2ndEntry:
-UNIMPLEMENTED "HalpDispatchInterrupt2ndEntry"
-.endfunc
-

Modified: trunk/reactos/hal/halamd64/include/hal.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halamd64/include/hal.h?rev=43173&r1=34812&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halamd64/include/hal.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halamd64/include/hal.h [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -1,9 +1,9 @@
 /*
- * PROJECT:         ReactOS HAL
- * LICENSE:         BSD - See COPYING.ARM in the top level directory
- * FILE:            hal/halarm/include/hal.h
- * PURPOSE:         Hardware Abstraction Layer Header
- * PROGRAMMERS:     ReactOS Portable Systems Group
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Hardware Abstraction Layer
+ * FILE:            hal/halx86/include/hal.h
+ * PURPOSE:         HAL Header
+ * PROGRAMMER:      Alex Ionescu (alex at relsoft.net)
  */
 
 /* INCLUDES ******************************************************************/
@@ -28,14 +28,23 @@
 #include <arc/arc.h>
 #include <iotypes.h>
 #include <kefuncs.h>
-#include <intrin.h>
 #include <halfuncs.h>
 #include <iofuncs.h>
 #include <ldrtypes.h>
 #include <obfuncs.h>
 
+/* Internal kernel headers */
+#include "internal/pci.h"
+#include "internal/i386/intrin_i.h"
+
 /* Internal HAL Headers */
+//#include "apic.h"
+#include "bus.h"
+//#include "halirq.h"
+//#include "haldma.h"
 #include "halp.h"
+//#include "mps.h"
+//#include "ioapic.h"
 
 /* Helper Header */
 #include <reactos/helper.h>

Modified: trunk/reactos/hal/halamd64/include/halp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halamd64/include/halp.h?rev=43173&r1=34812&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halamd64/include/halp.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halamd64/include/halp.h [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -1,22 +1,172 @@
+/*
+ *
+ */
+
 #ifndef __INTERNAL_HAL_HAL_H
 #define __INTERNAL_HAL_HAL_H
 
-//
-// ARM Headers
-//
-#include <internal/arm/ke.h>
-#include <internal/arm/intrin_i.h>
+#define HAL_APC_REQUEST         0
+#define HAL_DPC_REQUEST         1
+
+/* CMOS Registers and Ports */
+#define CMOS_CONTROL_PORT       (PUCHAR)0x70
+#define CMOS_DATA_PORT          (PUCHAR)0x71
+#define RTC_REGISTER_A          0x0A
+#define RTC_REGISTER_B          0x0B
+#define RTC_REG_A_UIP           0x80
+#define RTC_REGISTER_CENTURY    0x32
+
+/* Timer Registers and Ports */
+#define TIMER_CONTROL_PORT      0x43
+#define TIMER_DATA_PORT0        0x40
+#define TIMER_SC0               0
+#define TIMER_BOTH              0x30
+#define TIMER_MD2               0x4
+
+/* Conversion functions */
+#define BCD_INT(bcd)            \
+    (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))
+#define INT_BCD(int)            \
+    (UCHAR)(((int / 10) << 4) + (int % 10))
+
+/* adapter.c */
+PADAPTER_OBJECT NTAPI HalpAllocateAdapterEx(ULONG NumberOfMapRegisters,BOOLEAN IsMaster, BOOLEAN Dma32BitAddresses);
+
+/* bus.c */
+VOID NTAPI HalpInitNonBusHandler (VOID);
+
+/* irql.c */
+VOID NTAPI HalpInitPICs(VOID);
+
+/* udelay.c */
+VOID NTAPI HalpInitializeClock(VOID);
+
+/* pci.c */
+VOID HalpInitPciBus (VOID);
+
+/* dma.c */
+VOID HalpInitDma (VOID);
+
+/* Non-generic initialization */
+VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
+VOID HalpInitPhase1(VOID);
+VOID NTAPI HalpClockInterrupt(VOID);
 
 //
-// Versatile Peripherals
+// KD Support
 //
-#include <peripherals/pl011.h>
-#include <peripherals/pl190.h>
-#include <peripherals/sp804.h>
+VOID
+NTAPI
+HalpCheckPowerButton(
+    VOID
+);
+
+VOID
+NTAPI
+HalpRegisterKdSupportFunctions(
+    VOID
+);
+
+NTSTATUS
+NTAPI
+HalpSetupPciDeviceForDebugging(
+    IN PVOID LoaderBlock,
+    IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
+);
+
+NTSTATUS
+NTAPI
+HalpReleasePciDeviceForDebugging(
+    IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
+);
 
 //
-// WDK Hack
+// Memory routines
 //
-#define KdComPortInUse          _KdComPortInUse
+PVOID
+NTAPI
+HalpMapPhysicalMemory64(
+    IN PHYSICAL_ADDRESS PhysicalAddress,
+    IN ULONG NumberPage
+);
+
+VOID
+NTAPI
+HalpUnmapVirtualAddress(
+    IN PVOID VirtualAddress,
+    IN ULONG NumberPages
+);
+
+/* sysinfo.c */
+NTSTATUS
+NTAPI
+HaliQuerySystemInformation(
+    IN HAL_QUERY_INFORMATION_CLASS InformationClass,
+    IN ULONG BufferSize,
+    IN OUT PVOID Buffer,
+    OUT PULONG ReturnedLength
+);
+
+NTSTATUS
+NTAPI
+HaliSetSystemInformation(
+    IN HAL_SET_INFORMATION_CLASS InformationClass,
+    IN ULONG BufferSize,
+    IN OUT PVOID Buffer
+);
+
+//
+// BIOS Routines
+//
+BOOLEAN
+NTAPI
+HalpBiosDisplayReset(
+    VOID
+);
+
+ULONG
+NTAPI
+HalpBorrowTss(
+    VOID
+);
+
+ULONG
+NTAPI
+HalpReturnTss(
+    ULONG SavedTss
+);
+
+VOID
+NTAPI
+HalpBiosCall(
+    VOID
+);
+
+VOID
+NTAPI
+HalpTrap0D(
+    VOID
+);
+
+VOID
+NTAPI
+HalpTrap06(
+    VOID
+);
+
+PDMA_ADAPTER
+NTAPI
+HalpGetDmaAdapter(
+   IN PVOID Context,
+   IN PDEVICE_DESCRIPTION DeviceDescription,
+   OUT PULONG NumberOfMapRegisters);
+
+VOID HaliInitBSP(VOID);
+VOID HaliStartApplicationProcessor(ULONG Cpu, ULONG Stack);
+
+extern PVOID HalpRealModeStart;
+extern PVOID HalpRealModeEnd;
+
+extern KSPIN_LOCK HalpSystemHardwareLock;
 
 #endif /* __INTERNAL_HAL_HAL_H */

Modified: trunk/reactos/hal/halamd64/up/halup.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halamd64/up/halup.rbuild?rev=43173&r1=34812&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halamd64/up/halup.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/halamd64/up/halup.rbuild [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -1,14 +1,16 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="halarm_up" type="kernelmodedll" installbase="system32" installname="hal.dll">
-	<importlibrary definition="../../hal/hal_amd64.def" />
+<module name="halup" type="kernelmodedll" installbase="system32" installname="hal.dll">
+	<importlibrary base="hal" definition="hal_amd64.def" />
 	<bootstrap installbase="$(CDOUTPUT)" nameoncd="hal.dll" />
-	<include base="halamd64_generic">../include</include>
+	<include base="halup">../include</include>
 	<include base="ntoskrnl">include</include>
 	<define name="_DISABLE_TIDENTS" />
 	<define name="_NTHAL_" />
-	<library>halamd64_generic</library>
+	<library>hal_generic_amd64</library>
+	<library>hal_generic</library>
 	<library>ntoskrnl</library>
 	<file>halinit_up.c</file>
 	<file>halup.rc</file>
+	<file>processor.c</file>
 </module>

Modified: trunk/reactos/hal/halx86/generic/timer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/timer.c?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -48,7 +48,7 @@
     PKPRCB Prcb = KeGetCurrentPrcb();
     ULONG Increment;
     USHORT RollOver;
-    ULONG Flags;
+    ULONG_PTR Flags;
 
     /* Check the CPU Type */
     if (Prcb->CpuType <= 4)
@@ -92,7 +92,7 @@
 HalCalibratePerformanceCounter(IN volatile PLONG Count,
                                IN ULONGLONG NewCount)
 {
-    ULONG Flags;
+    ULONG_PTR Flags;
 
     /* Disable interrupts */
     Flags = __readeflags();

Copied: trunk/reactos/hal/halx86/hal_generic_amd64.rbuild (from r35905, branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_amd64.rbuild)
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/hal_generic_amd64.rbuild?p2=trunk/reactos/hal/halx86/hal_generic_amd64.rbuild&p1=branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_amd64.rbuild&r1=35905&r2=43173&rev=43173&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_amd64.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/hal_generic_amd64.rbuild [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -13,13 +13,14 @@
 			<file>dma.c</file>
 			<file>drive.c</file>
 			<file>display.c</file>
+			<file>pci.c</file>
 			<file>profil.c</file>
 			<file>reboot.c</file>
 			<file>sysinfo.c</file>
 			<file>timer.c</file>
 		</directory>
 		<directory name="mp">
-			<!-- file>apic.c</file -->
+			<file>apic.c</file>
 		</directory>
 		<directory name="include">
 			<pch>hal.h</pch>

Modified: trunk/reactos/hal/halx86/include/apic.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/apic.h?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/include/apic.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/apic.h [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -5,7 +5,11 @@
 #ifndef __INTERNAL_HAL_APIC_H
 #define __INTERNAL_HAL_APIC_H
 
+#ifdef _M_AMD64
+#define APIC_DEFAULT_BASE     0xfffffffffee00000ULL;
+#else
 #define APIC_DEFAULT_BASE     0xFEE00000    /* Default Local APIC Base Register Address */
+#endif
 
 /* APIC Register Address Map */
 #define APIC_ID      0x0020 /* Local APIC ID Register (R/W) */
@@ -115,30 +119,6 @@
 #define APIC_TDCR_128      0x0A
 #define APIC_TDCR_1        0x0B
 
-#define APIC_LVT_VECTOR   		  (0xFF << 0)   /* Vector */
-#define APIC_LVT_DS       		  (0x1 << 12)   /* Delivery Status */
-#define APIC_LVT_REMOTE_IRR		  (0x1 << 14)	/* Remote IRR */
-#define APIC_LVT_LEVEL_TRIGGER		  (0x1 << 15)	/* Lvel Triggered */
-#define APIC_LVT_MASKED			  (0x1 << 16)   /* Mask */
-#define APIC_LVT_PERIODIC	 	  (0x1 << 17)   /* Timer Mode */
-
-#define APIC_LVT3_DM        (0x7 << 8)
-#define APIC_LVT3_IIPP      (0x1 << 13)
-#define APIC_LVT3_TM        (0x1 << 15)
-#define APIC_LVT3_MASKED    (0x1 << 16)
-#define APIC_LVT3_OS        (0x1 << 17)
-
-#define APIC_TDCR_TMBASE   (0x1 << 2)
-#define APIC_TDCR_MASK     0x0F
-#define APIC_TDCR_2        0x00
-#define APIC_TDCR_4        0x01
-#define APIC_TDCR_8        0x02
-#define APIC_TDCR_16       0x03
-#define APIC_TDCR_32       0x08
-#define APIC_TDCR_64       0x09
-#define APIC_TDCR_128      0x0A
-#define APIC_TDCR_1        0x0B
-
 #define APIC_TARGET_SELF         0x100
 #define APIC_TARGET_ALL          0x200
 #define APIC_TARGET_ALL_BUT_SELF 0x300
@@ -206,7 +186,7 @@
 {
     PULONG p;
 
-    p = (PULONG)((ULONG)APICBase + Offset);
+    p = (PULONG)((ULONG_PTR)APICBase + Offset);
     return *p;
 }
 
@@ -216,7 +196,7 @@
 {
     PULONG p;
 
-    p = (PULONG)((ULONG)APICBase + Offset);
+    p = (PULONG)((ULONG_PTR)APICBase + Offset);
 
     *p = Value;
 }
@@ -230,7 +210,7 @@
     lastregw[CPU] = Offset;
     lastvalw[CPU] = Value;
 
-    p = (PULONG)((ULONG)APICBase + Offset);
+    p = (PULONG)((ULONG_PTR)APICBase + Offset);
 
     *p = Value;
 }
@@ -241,7 +221,7 @@
 {
     PULONG p;
 
-    p = (PULONG)((ULONG)APICBase + Offset);
+    p = (PULONG)((ULONG_PTR)APICBase + Offset);
     return *p;
 }
 #else
@@ -253,7 +233,7 @@
     lastregr[CPU] = Offset;
     lastvalr[CPU] = 0;
 
-    p = (PULONG)((ULONG)APICBase + Offset);
+    p = (PULONG)((ULONG_PTR)APICBase + Offset);
 
     lastvalr[CPU] = *p;
     return lastvalr[CPU];

Modified: trunk/reactos/hal/halx86/include/bus.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/bus.h?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/include/bus.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/bus.h [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -43,7 +43,7 @@
 #define TYPE1_READ(x, y)                                                \
     TYPE1_START(x, y)                                                   \
     *((POINTER_TO_(y))Buffer) =                                         \
-    READ_FROM(y)((POINTER_TO_(y))(BusData->Config.Type1.Data + i));     \
+    READ_FROM(y)((POINTER_TO_(y))(ULONG_PTR)(BusData->Config.Type1.Data + i));     \
     TYPE1_END(y)
 
 //
@@ -51,7 +51,7 @@
 //
 #define TYPE1_WRITE(x, y)                                               \
     TYPE1_START(x, y)                                                   \
-    WRITE_TO(y)((POINTER_TO_(y))(BusData->Config.Type1.Data + i),       \
+    WRITE_TO(y)((POINTER_TO_(y))(ULONG_PTR)(BusData->Config.Type1.Data + i),       \
                 *((POINTER_TO_(y))Buffer));                             \
     TYPE1_END(y)
 
@@ -69,7 +69,7 @@
 #define TYPE2_READ(x, y)                                                \
     TYPE2_START(x, y)                                                   \
     *((POINTER_TO_(y))Buffer) =                                         \
-        READ_FROM(y)((POINTER_TO_(y))(ULONG)PciCfg->u.AsUSHORT);        \
+        READ_FROM(y)((POINTER_TO_(y))(ULONG_PTR)PciCfg->u.AsUSHORT);        \
     TYPE2_END(y)
 
 //
@@ -77,7 +77,7 @@
 //
 #define TYPE2_WRITE(x, y)                                               \
     TYPE2_START(x, y)                                                   \
-    WRITE_TO(y)((POINTER_TO_(y))(ULONG)PciCfg->u.AsUSHORT,              \
+    WRITE_TO(y)((POINTER_TO_(y))(ULONG_PTR)PciCfg->u.AsUSHORT,              \
                 *((POINTER_TO_(y))Buffer));                             \
     TYPE2_END(y)
 

Modified: trunk/reactos/hal/halx86/include/hal.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/hal.h?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/include/hal.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/hal.h [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -34,7 +34,11 @@
 
 /* Internal kernel headers */
 #include "internal/pci.h"
+#ifdef _M_AMD64
+#include "internal/amd64/intrin_i.h"
+#else
 #include "internal/i386/intrin_i.h"
+#endif
 
 /* Internal HAL Headers */
 #include "apic.h"

Modified: trunk/reactos/hal/halx86/include/halp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -154,6 +154,17 @@
     VOID
 );
 
+#ifdef _M_AMD64
+#define KfLowerIrql KeLowerIrql
+#ifndef CONFIG_SMP
+/* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
+#define KiAcquireSpinLock(SpinLock)
+#define KiReleaseSpinLock(SpinLock)
+#define KfAcquireSpinLock(SpinLock) KfRaiseIrql(DISPATCH_LEVEL);
+#define KfReleaseSpinLock(SpinLock, OldIrql) KeLowerIrql(OldIrql);
+#endif // !CONFIG_SMP
+#endif // _M_AMD64
+
 extern PVOID HalpRealModeStart;
 extern PVOID HalpRealModeEnd;
 

Modified: trunk/reactos/hal/halx86/mp/apic.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/apic.c?rev=43173&r1=43172&r2=43173&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/mp/apic.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/mp/apic.c [iso-8859-1] Sat Sep 26 23:32:53 2009
@@ -709,6 +709,9 @@
 MpsIRQTrapFrameToTrapFrame(PKIRQ_TRAPFRAME IrqTrapFrame,
 			   PKTRAP_FRAME TrapFrame)
 {
+#ifdef _M_AMD64
+    UNIMPLEMENTED;
+#else
    TrapFrame->SegGs     = (USHORT)IrqTrapFrame->Gs;
    TrapFrame->SegFs     = (USHORT)IrqTrapFrame->Fs;
    TrapFrame->SegEs     = (USHORT)IrqTrapFrame->Es;
@@ -724,6 +727,7 @@
    TrapFrame->Eip    = IrqTrapFrame->Eip;
    TrapFrame->SegCs     = IrqTrapFrame->Cs;
    TrapFrame->EFlags = IrqTrapFrame->Eflags;
+#endif
 }
 
 VOID
@@ -798,7 +802,7 @@
 
    APICSetupLVTT(1000000000);
 
-   TSCPresent = ((PKIPCR)KeGetPcr())->PrcbData.FeatureBits & KF_RDTSC ? TRUE : FALSE;
+   TSCPresent = KeGetCurrentPrcb()->FeatureBits & KF_RDTSC ? TRUE : FALSE;
 
    /*
     * The timer chip counts down to zero. Let's wait
@@ -827,7 +831,7 @@
       DPRINT("CPU clock speed is %ld.%04ld MHz.\n",
 	     CPUMap[CPU].CoreSpeed/1000000,
 	     CPUMap[CPU].CoreSpeed%1000000);
-      ((PKIPCR)KeGetPcr())->PrcbData.MHz = CPUMap[CPU].CoreSpeed/1000000;
+      KeGetCurrentPrcb()->MHz = CPUMap[CPU].CoreSpeed/1000000;
    }
 
    CPUMap[CPU].BusSpeed = (HZ * (long)(tt1 - tt2) * APIC_DIVISOR);
@@ -843,8 +847,25 @@
 }
 
 VOID 
-SetInterruptGate(ULONG index, ULONG address)
-{
+SetInterruptGate(ULONG index, ULONG_PTR address)
+{
+#ifdef _M_AMD64
+  KIDTENTRY64 *idt;
+
+  idt = &KeGetPcr()->IdtBase[index];
+
+  idt->OffsetLow = address & 0xffff;
+  idt->Selector = KGDT_64_R0_CODE;
+  idt->IstIndex = 0;
+  idt->Reserved0 = 0;
+  idt->Type = 0x0e;
+  idt->Dpl = 0;
+  idt->Present = 1;
+  idt->OffsetMiddle = (address >> 16) & 0xffff;
+  idt->OffsetHigh = address >> 32;
+  idt->Reserved1 = 0;
+  idt->Alignment = 0;
+#else
   KIDTENTRY *idt;
   KIDT_ACCESS Access;
 
@@ -860,6 +881,7 @@
   idt->Selector = KGDT_R0_CODE;
   idt->Access = Access.Value;
   idt->ExtendedOffset = (USHORT)(address >> 16);
+#endif
 }
 
 VOID HaliInitBSP(VOID)
@@ -880,11 +902,11 @@
    BSPInitialized = TRUE;
 
    /* Setup interrupt handlers */
-   SetInterruptGate(LOCAL_TIMER_VECTOR, (ULONG)MpsTimerInterrupt);
-   SetInterruptGate(ERROR_VECTOR, (ULONG)MpsErrorInterrupt);
-   SetInterruptGate(SPURIOUS_VECTOR, (ULONG)MpsSpuriousInterrupt);
+   SetInterruptGate(LOCAL_TIMER_VECTOR, (ULONG_PTR)MpsTimerInterrupt);
+   SetInterruptGate(ERROR_VECTOR, (ULONG_PTR)MpsErrorInterrupt);
+   SetInterruptGate(SPURIOUS_VECTOR, (ULONG_PTR)MpsSpuriousInterrupt);
 #ifdef CONFIG_SMP
-   SetInterruptGate(IPI_VECTOR, (ULONG)MpsIpiInterrupt);
+   SetInterruptGate(IPI_VECTOR, (ULONG_PTR)MpsIpiInterrupt);
 #endif
    DPRINT("APIC is mapped at 0x%X\n", APICBase);
 
@@ -913,18 +935,18 @@
    CommonBase = (PULONG)COMMON_AREA;
  
    /* Copy bootstrap code to common area */
-   memcpy((PVOID)((ULONG)CommonBase + PAGE_SIZE),
+   memcpy((PVOID)((ULONG_PTR)CommonBase + PAGE_SIZE),
 	  &APstart,
-	  (ULONG)&APend - (ULONG)&APstart + 1);
+	  (ULONG_PTR)&APend - (ULONG_PTR)&APstart + 1);
 
    /* Set shutdown code */
    CMOS_WRITE(0xF, 0xA);
 
    /* Set warm reset vector */
-   ps = (PUSHORT)((ULONG)BIOSBase + 0x467);
+   ps = (PUSHORT)((ULONG_PTR)BIOSBase + 0x467);
    *ps = (COMMON_AREA + PAGE_SIZE) & 0xF;
  
-   ps = (PUSHORT)((ULONG)BIOSBase + 0x469);
+   ps = (PUSHORT)((ULONG_PTR)BIOSBase + 0x469);
    *ps = (COMMON_AREA + PAGE_SIZE) >> 4;
 #endif
 




More information about the Ros-diffs mailing list