Merge to 13895. Remove ACPI static compiler flag and used dynamic
variable with detection done through Freeloader (still some work left).
Add more profile code and begin tiny work on Io functions.
Modified:
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/arch/i386/hwacpi
.c
Modified:
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/include/multiboo
t.h
Modified:
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/reactos/reactos.
c
Modified: branches/alex_devel_branch/reactos/config
Added: branches/alex_devel_branch/reactos/doc/irp cancel boilerplate.c
Modified:
branches/alex_devel_branch/reactos/drivers/bus/acpi/tables/tbget.c
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/create.c
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/rw.c
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/volume.c
Modified:
branches/alex_devel_branch/reactos/drivers/video/displays/vga/main/enabl
e.c
Modified: branches/alex_devel_branch/reactos/hal/halx86/generic/timer.c
Modified: branches/alex_devel_branch/reactos/hal/halx86/include/apic.h
Modified: branches/alex_devel_branch/reactos/hal/halx86/include/hal.h
Added: branches/alex_devel_branch/reactos/hal/halx86/include/ioapic.h
Modified: branches/alex_devel_branch/reactos/hal/halx86/include/mps.h
Modified: branches/alex_devel_branch/reactos/hal/halx86/mp/Makefile
Modified: branches/alex_devel_branch/reactos/hal/halx86/mp/apic.c
Modified: branches/alex_devel_branch/reactos/hal/halx86/mp/halinit_mp.c
Added: branches/alex_devel_branch/reactos/hal/halx86/mp/ioapic.c
Added: branches/alex_devel_branch/reactos/hal/halx86/mp/mpconfig.c
Modified: branches/alex_devel_branch/reactos/hal/halx86/mp/mpsirql.c
Modified:
branches/alex_devel_branch/reactos/hal/halx86/mp/processor_mp.c
Modified: branches/alex_devel_branch/reactos/include/win32k/dc.h
Added: branches/alex_devel_branch/reactos/lib/cpl/appwiz/De.rc
Added: branches/alex_devel_branch/reactos/lib/cpl/appwiz/En.rc
Modified: branches/alex_devel_branch/reactos/lib/cpl/appwiz/appwiz.rc
Modified:
branches/alex_devel_branch/reactos/lib/cpl/appwiz/resources/applet.ico
Added: branches/alex_devel_branch/reactos/lib/cpl/control/De.rc
Added: branches/alex_devel_branch/reactos/lib/cpl/control/En.rc
Modified: branches/alex_devel_branch/reactos/lib/cpl/control/control.rc
Modified:
branches/alex_devel_branch/reactos/lib/kernel32/except/except.c
Modified: branches/alex_devel_branch/reactos/lib/rosrtl/misc/intrlck.c
Modified: branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c
Added: branches/alex_devel_branch/reactos/lib/shellext/slayer/De.rc
Modified:
branches/alex_devel_branch/reactos/lib/shellext/slayer/slayer.rc
Modified: branches/alex_devel_branch/reactos/lib/smdll/connect.c
Modified: branches/alex_devel_branch/reactos/lib/user32/windows/bitmap.c
Modified: branches/alex_devel_branch/reactos/lib/user32/windows/icon.c
Modified:
branches/alex_devel_branch/reactos/ntoskrnl/include/internal/i386/ke.h
Modified:
branches/alex_devel_branch/reactos/ntoskrnl/include/internal/kd.h
Modified:
branches/alex_devel_branch/reactos/ntoskrnl/include/internal/ke.h
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/cancel.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/device.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/driver.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/irp.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/irq.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/process.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/i386/kernel.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/profile.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/po/power.c
Modified: branches/alex_devel_branch/reactos/subsys/system/cmd/cmd.h
Modified: branches/alex_devel_branch/reactos/subsys/system/cmd/dir.c
Modified: branches/alex_devel_branch/reactos/subsys/system/cmd/error.c
Modified: branches/alex_devel_branch/reactos/subsys/system/cmd/precomp.h
Modified: branches/alex_devel_branch/reactos/subsys/system/cmd/todo.txt
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/include/intgdi.h
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/ntuser/message.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/ntuser/metric.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/ntuser/windc.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/ntuser/winsta.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/objects/bitmaps.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/objects/brush.c
Modified: branches/alex_devel_branch/reactos/subsys/win32k/objects/dc.c
Modified: branches/alex_devel_branch/reactos/subsys/win32k/objects/dib.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/objects/fillshap.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/objects/line.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/objects/print.c
Modified:
branches/alex_devel_branch/reactos/subsys/win32k/objects/text.c
Modified: branches/alex_devel_branch/reactos/tools/Makefile
Modified: branches/alex_devel_branch/reactos/tools/helper.mk
Modified: branches/alex_devel_branch/reactos/tools/widl/ChangeLog
Modified: branches/alex_devel_branch/reactos/tools/widl/client.c
Modified: branches/alex_devel_branch/reactos/tools/widl/header.c
Modified: branches/alex_devel_branch/reactos/tools/widl/header.h
Modified: branches/alex_devel_branch/reactos/tools/widl/server.c
_____
Modified:
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/arch/i386/hwacpi
.c
---
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/arch/i386/hwacpi
.c 2005-03-08 23:15:34 UTC (rev 13895)
+++
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/arch/i386/hwacpi
.c 2005-03-08 23:33:28 UTC (rev 13896)
@@ -28,6 +28,7 @@
#include "../../reactos/registry.h"
#include "hardware.h"
+BOOLEAN AcpiPresent = FALSE;
static BOOL
FindAcpiBios(VOID)
@@ -63,6 +64,7 @@
if (FindAcpiBios())
{
+ AcpiPresent = TRUE;
/* Create new bus key */
sprintf(Buffer,
"MultifunctionAdapter\\%u", *BusNumber);
_____
Modified:
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/include/multiboo
t.h
---
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/include/multiboo
t.h 2005-03-08 23:15:34 UTC (rev 13895)
+++
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/include/multiboo
t.h 2005-03-08 23:33:28 UTC (rev 13896)
@@ -52,6 +52,7 @@
#define MB_INFO_FLAG_BOOT_LOADER_NAME 0x00000200
#define MB_INFO_FLAG_APM_TABLE 0x00000400
#define MB_INFO_FLAG_GRAPHICS_TABLE 0x00000800
+#define MB_INFO_FLAG_ACPI_TABLE 0x00001000
#ifndef ASM
/* Do not include here in boot.S. */
_____
Modified:
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/reactos/reactos.
c
---
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/reactos/reactos.
c 2005-03-08 23:15:34 UTC (rev 13895)
+++
branches/alex_devel_branch/reactos/boot/freeldr/freeldr/reactos/reactos.
c 2005-03-08 23:33:28 UTC (rev 13896)
@@ -580,6 +580,7 @@
extern ULONG PageDirectoryStart;
extern ULONG PageDirectoryEnd;
+ extern BOOLEAN AcpiPresent;
//
// Open the operating system section
@@ -596,6 +597,7 @@
* Setup multiboot information structure
*/
LoaderBlock.Flags = MB_INFO_FLAG_MEM_SIZE |
MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE |
MB_INFO_FLAG_MODULES;
+ if (AcpiPresent) LoaderBlock.Flags |= MB_INFO_FLAG_ACPI_TABLE;
LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart;
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
LoaderBlock.BootDevice = 0xffffffff;
_____
Modified: branches/alex_devel_branch/reactos/config
--- branches/alex_devel_branch/reactos/config 2005-03-08 23:15:34 UTC
(rev 13895)
+++ branches/alex_devel_branch/reactos/config 2005-03-08 23:33:28 UTC
(rev 13896)
@@ -26,21 +26,11 @@
DBG := 1
#
-# Whether to compile with optimizations
-#
-OPTIMIZED := 1
-
-#
# Whether to compile a multiprocessor or single processor version
#
CONFIG_SMP := 0
#
-# Whether to compile for ACPI compliant systems
-#
-ACPI := 0
-
-#
# Which version of NDIS do we support up to?
#
#NDISVERSION=NDIS50
_____
Copied: branches/alex_devel_branch/reactos/doc/irp cancel boilerplate.c
(from rev 13856, trunk/reactos/doc/irp cancel boilerplate.c)
--- trunk/reactos/doc/irp cancel boilerplate.c 2005-03-06 16:42:36 UTC
(rev 13856)
+++ branches/alex_devel_branch/reactos/doc/irp cancel boilerplate.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -0,0 +1,103 @@
+
+
+/*
+Boiler plate for irp cancelation, for irp queues you manage yourself
+-Gunnar
+*/
+
+
+
+CancelRoutine(
+ DEV_OBJ Dev,
+ Irp
+ )
+{
+ //don't need this since we have our own sync. protecting irp
cancellation
+ IoReleaseCancelSpinLock(Irp->CancelIrql);
+
+ theLock = Irp->Tail.Overlay.DriverContext[3];
+
+ Lock(theLock);
+ RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
+ Unlock(theLock);
+
+ Irp->IoStatus.Status = STATUS_CANCELLED;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+}
+
+
+QUEUE_BOLIERPLATE
+{
+ Lock(theLock);
+
+ Irp->Tail.Overlay.DriverContext[3] = &theLock;
+
+ IoSetCancelRoutine(Irp, CancelRoutine);
+ if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
+ {
+ /*
+ Irp has already been cancelled (before we got to queue it),
+ and we got to remove the cancel routine before the canceler
could,
+ so we cancel/complete the irp ourself.
+ */
+
+ Unlock(theLock);
+
+ Irp->IoStatus.Status = STATUS_CANCELLED;
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return FALSE;
+ }
+
+ //else were ok
+
+
+ Irp->IoStatus.Status = STATUS_PENDING;
+ IoMarkIrpPending(Irp);
+
+ InsertTailList(Queue);
+
+ Unlock(theLock);
+
+}
+
+
+DEQUEUE_BOILERPLATE
+{
+ Lock(theLock);
+
+ Irp = RemoveHeadList(Queue);
+
+ if (!IoSetCancelRoutine(Irp, NULL))
+ {
+ /*
+ Cancel routine WILL be called after we release the spinlock. It
will try to remove
+ the irp from the list and cancel/complete this irp. Since we
allready removed it,
+ make its ListEntry point to itself.
+ */
+
+ InitializeListHead(&Irp->Tail.Overlay.ListEntry);
+
+ Unlock(theLock);
+
+ return;
+ }
+
+
+ /*
+ Cancel routine will NOT be called, canceled or not.
+ The Irp might have been canceled (Irp->Cancel flag set) but we don't
care,
+ since we are to complete this Irp now anyways.
+ */
+
+ Unlock(theLock);
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+}
_____
Modified:
branches/alex_devel_branch/reactos/drivers/bus/acpi/tables/tbget.c
--- branches/alex_devel_branch/reactos/drivers/bus/acpi/tables/tbget.c
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/drivers/bus/acpi/tables/tbget.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -503,7 +503,7 @@
REPORT_ERROR (("Invalid signature where RSDP indicates
%s should be located\n",
table_signature));
- return (status);
+ return (AE_NO_ACPI_TABLES);
}
_____
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/create.c
--- branches/alex_devel_branch/reactos/drivers/fs/np/create.c
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/create.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -54,10 +54,15 @@
while (CurrentEntry != &Pipe->WaiterListHead)
{
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY,
Entry);
- if (Waiter->Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ if (Waiter->Fcb->PipeState == FILE_PIPE_LISTENING_STATE &&
+ !Waiter->Irp->Cancel)
{
DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
- return Waiter->Fcb;
+
+ if (IoSetCancelRoutine(Waiter->Irp, NULL) != NULL)
+ {
+ return Waiter->Fcb;
+ }
}
CurrentEntry = CurrentEntry->Flink;
@@ -143,39 +148,13 @@
KeUnlockMutex(&DeviceExt->PipeListLock);
/*
- * Step 2. Search for listening server FCB.
- */
-
- /*
* Acquire the lock for FCB lists. From now on no modifications to
the
* FCB lists are allowed, because it can cause various
misconsistencies.
*/
KeLockMutex(&Pipe->FcbListLock);
- if (!SpecialAccess)
- {
- ServerFcb = NpfsFindListeningServerInstance(Pipe);
- if (ServerFcb == NULL)
- {
- /* Not found, bail out with error for FILE_OPEN requests. */
- DPRINT("No listening server fcb found!\n");
- KeUnlockMutex(&Pipe->FcbListLock);
- Irp->IoStatus.Status = STATUS_PIPE_BUSY;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_PIPE_BUSY;
- }
- }
- else if (IsListEmpty(&Pipe->ServerFcbListHead))
- {
- DPRINT("No server fcb found!\n");
- KeUnlockMutex(&Pipe->FcbListLock);
- Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_UNSUCCESSFUL;
- }
-
/*
- * Step 3. Create the client FCB.
+ * Step 2. Create the client FCB.
*/
ClientFcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB));
if (ClientFcb == NULL)
@@ -222,6 +201,73 @@
KeInitializeEvent(&ClientFcb->Event, SynchronizationEvent, FALSE);
/*
+ * Step 3. Search for listening server FCB.
+ */
+
+ if (!SpecialAccess)
+ {
+ /*
+ * WARNING: Point of no return! Once we get the server FCB it's
+ * possible that we completed a wait request and so we have to
+ * complete even this request.
+ */
+
+ ServerFcb = NpfsFindListeningServerInstance(Pipe);
+ if (ServerFcb == NULL)
+ {
+ PLIST_ENTRY CurrentEntry;
+ PNPFS_FCB Fcb;
+
+ /*
+ * If no waiting server FCB was found then try to pick
+ * one of the listing server FCB on the pipe.
+ */
+
+ CurrentEntry = Pipe->ServerFcbListHead.Flink;
+ while (CurrentEntry != &Pipe->ServerFcbListHead)
+ {
+ Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB,
FcbListEntry);
+ if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ {
+ ServerFcb = Fcb;
+ break;
+ }
+ CurrentEntry = CurrentEntry->Flink;
+ }
+
+ /*
+ * No one is listening to me?! I'm so lonely... :(
+ */
+
+ if (ServerFcb == NULL)
+ {
+ /* Not found, bail out with error for FILE_OPEN requests.
*/
+ DPRINT("No listening server fcb found!\n");
+ if (ClientFcb->Data)
+ ExFreePool(ClientFcb->Data);
+ KeUnlockMutex(&Pipe->FcbListLock);
+ Irp->IoStatus.Status = STATUS_PIPE_BUSY;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_PIPE_BUSY;
+ }
+ }
+ else
+ {
+ /* Signal the server thread and remove it from the waiter
list */
+ /* FIXME: Merge this with the NpfsFindListeningServerInstance
routine. */
+ NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb);
+ }
+ }
+ else if (IsListEmpty(&Pipe->ServerFcbListHead))
+ {
+ DPRINT("No server fcb found!\n");
+ KeUnlockMutex(&Pipe->FcbListLock);
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /*
* Step 4. Add the client FCB to a list and connect it if possible.
*/
@@ -235,9 +281,6 @@
ServerFcb->OtherSide = ClientFcb;
ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
ServerFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
-
- /* Signal the server thread and remove it from the waiter list */
- NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb);
}
KeUnlockMutex(&Pipe->FcbListLock);
_____
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c
--- branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -25,18 +25,19 @@
PNPFS_WAITER_ENTRY Waiter;
DPRINT1("NpfsListeningCancelRoutine() called\n");
- /* FIXME: Not tested. */
+ IoReleaseCancelSpinLock(Irp->CancelIrql);
+
Waiter = Irp->Tail.Overlay.DriverContext[0];
+ KeLockMutex(&Waiter->Pipe->FcbListLock);
RemoveEntryList(&Waiter->Entry);
- ExFreePool(Waiter);
+ KeUnlockMutex(&Waiter->Pipe->FcbListLock);
- IoReleaseCancelSpinLock(Irp->CancelIrql);
-
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ ExFreePool(Waiter);
}
@@ -45,7 +46,6 @@
PNPFS_FCB Fcb)
{
PNPFS_WAITER_ENTRY Entry;
- KIRQL OldIrql;
Entry = ExAllocatePool(NonPagedPool, sizeof(NPFS_WAITER_ENTRY));
if (Entry == NULL)
@@ -53,22 +53,28 @@
Entry->Irp = Irp;
Entry->Fcb = Fcb;
+ Entry->Pipe = Fcb->Pipe;
+
+ KeLockMutex(&Fcb->Pipe->FcbListLock);
+
+ IoMarkIrpPending(Irp);
+ Irp->Tail.Overlay.DriverContext[0] = Entry;
InsertTailList(&Fcb->Pipe->WaiterListHead, &Entry->Entry);
- IoAcquireCancelSpinLock(&OldIrql);
+ IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
+
if (!Irp->Cancel)
{
- Irp->Tail.Overlay.DriverContext[0] = Entry;
- IoMarkIrpPending(Irp);
- IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
- IoReleaseCancelSpinLock(OldIrql);
+ KeUnlockMutex(&Fcb->Pipe->FcbListLock);
return STATUS_PENDING;
}
- /* IRP has already been cancelled */
- IoReleaseCancelSpinLock(OldIrql);
-
- DPRINT1("FIXME: Remove waiter entry!\n");
+
RemoveEntryList(&Entry->Entry);
+
+ Irp->IoStatus.Status = STATUS_CANCELLED;
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ KeUnlockMutex(&Fcb->Pipe->FcbListLock);
ExFreePool(Entry);
return STATUS_CANCELLED;
_____
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/rw.c
--- branches/alex_devel_branch/reactos/drivers/fs/np/rw.c
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/rw.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -165,7 +165,10 @@
if (Length == 0)
{
- KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
+ if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ {
+ KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
+ }
KeResetEvent(&Fcb->Event);
break;
}
@@ -197,6 +200,11 @@
}
else
{
+ KeResetEvent(&Fcb->Event);
+ if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ {
+ KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT,
FALSE);
+ }
Fcb->ReadDataAvailable = 0;
Fcb->WriteQuotaAvailable = Fcb->MaxDataLength;
}
@@ -204,11 +212,6 @@
if (Information > 0)
{
- if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
- {
- KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
- }
- KeResetEvent(&Fcb->Event);
break;
}
}
@@ -383,12 +386,12 @@
ReaderFcb->WriteQuotaAvailable = 0;
}
- if (Information > 0)
- {
- KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
- KeResetEvent(&Fcb->Event);
- break;
- }
+ if (Information > 0)
+ {
+ KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
+ KeResetEvent(&Fcb->Event);
+ break;
+ }
}
}
_____
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/volume.c
--- branches/alex_devel_branch/reactos/drivers/fs/np/volume.c
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/volume.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -36,7 +36,7 @@
DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
- return STATUS_SUCCESS;
+ return STATUS_SUCCESS;
}
_____
Modified:
branches/alex_devel_branch/reactos/drivers/video/displays/vga/main/enabl
e.c
---
branches/alex_devel_branch/reactos/drivers/video/displays/vga/main/enabl
e.c 2005-03-08 23:15:34 UTC (rev 13895)
+++
branches/alex_devel_branch/reactos/drivers/video/displays/vga/main/enabl
e.c 2005-03-08 23:33:28 UTC (rev 13896)
@@ -266,6 +266,9 @@
GDIInfoSize = sizeof(GDIINFO);
}
memcpy(GDIInfo, &gaulCap, GDIInfoSize);
+ DM->dmBitsPerPel = gaulCap.cBitsPixel * gaulCap.cPlanes;
+ DM->dmPelsWidth = gaulCap.ulHorzRes;
+ DM->dmPelsHeight = gaulCap.ulVertRes;
devinfoVGA.hpalDefault = EngCreatePalette(PAL_INDEXED, 16, (ULONG *)
VGApalette.PaletteEntry, 0, 0, 0);
if (sizeof(DEVINFO) < DevInfoSize)
_____
Modified: branches/alex_devel_branch/reactos/hal/halx86/generic/timer.c
--- branches/alex_devel_branch/reactos/hal/halx86/generic/timer.c
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/hal/halx86/generic/timer.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -165,7 +165,7 @@
}
-static VOID WaitFor8254Wraparound(VOID)
+VOID WaitFor8254Wraparound(VOID)
{
ULONG CurCount, PrevCount = ~0;
LONG Delta;
_____
Modified: branches/alex_devel_branch/reactos/hal/halx86/include/apic.h
--- branches/alex_devel_branch/reactos/hal/halx86/include/apic.h
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/hal/halx86/include/apic.h
2005-03-08 23:33:28 UTC (rev 13896)
@@ -145,7 +145,16 @@
#define APIC_INTEGRATED(version) (version & 0xF0)
+typedef enum {
+ amPIC = 0, /* IMCR and PIC compatibility mode */
+ amVWIRE /* Virtual Wire compatibility mode */
+} APIC_MODE;
+
+#ifdef CONFIG_SMP
#define MAX_CPU 32
+#else
+#define MAX_CPU 1
+#endif
/*
* Local APIC timer IRQ vector is on a different priority level,
@@ -158,6 +167,11 @@
#define ERROR_VECTOR 0xFE
#define SPURIOUS_VECTOR 0xFF /* Must be 0xXF */
+/* CPU flags */
+#define CPU_USABLE 0x01 /* 1 if the CPU is usable (ie. can be used)
*/
+#define CPU_ENABLED 0x02 /* 1 if the CPU is enabled */
+#define CPU_BSP 0x04 /* 1 if the CPU is the bootstrap processor
*/
+#define CPU_TSC 0x08 /* 1 if the CPU has a time stamp counter */
typedef struct _CPU_INFO
{
@@ -170,23 +184,26 @@
UCHAR Padding[16-12]; /* Padding to 16-byte */
} CPU_INFO, *PCPU_INFO;
+extern ULONG CPUCount; /* Total number of CPUs */
+extern ULONG BootCPU; /* Bootstrap
processor */
+extern ULONG OnlineCPUs; /* Bitmask of online CPUs */
+extern CPU_INFO CPUMap[MAX_CPU]; /* Map of all CPUs in the system
*/
/* Prototypes */
-
+inline VOID APICWrite(ULONG Offset, ULONG Value);
inline ULONG APICRead(ULONG Offset);
-inline VOID APICWrite(ULONG Offset, ULONG Value);
VOID APICSendIPI(ULONG Target, ULONG Mode);
-
-ULONG APICGetMaxLVT(VOID);
VOID APICSetup(VOID);
VOID HaliInitBSP(VOID);
VOID APICSyncArbIDs(VOID);
inline VOID APICSendEOI(VOID);
+VOID APICCalibrateTimer(ULONG CPU);
+VOID HaliStartApplicationProcessor(ULONG Cpu, ULONG Stack);
static inline ULONG ThisCPU(VOID)
{
- return (APICRead(APIC_ID) & APIC_ID_MASK) >> 24;
+ return (APICRead(APIC_ID) & APIC_ID_MASK) >> 24;
}
_____
Modified: branches/alex_devel_branch/reactos/hal/halx86/include/hal.h
--- branches/alex_devel_branch/reactos/hal/halx86/include/hal.h
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/hal/halx86/include/hal.h
2005-03-08 23:33:28 UTC (rev 13896)
@@ -413,6 +413,8 @@
#define Ki386EnableInterrupts() __asm__
__volatile__("sti\n\t")
#define Ki386HaltProcessor() __asm__ __volatile__("hlt\n\t")
#define Ki386RdTSC(x) __asm__ __volatile__("rdtsc\n\t" :
"=A" (x.u.LowPart), "=d" (x.u.HighPart));
+#define Ki386Rdmsr(msr,val1,val2) __asm__ __volatile__("rdmsr" :
"=a"
(val1), "=d" (val2) : "c" (msr))
+#define Ki386Wrmsr(msr,val1,val2) __asm__ __volatile__("wrmsr" : /*
no outputs */ : "c" (msr), "a" (val1), "d" (val2))
static inline BYTE Ki386ReadFsByte(ULONG offset)
{
_____
Copied: branches/alex_devel_branch/reactos/hal/halx86/include/ioapic.h
(from rev 13894, trunk/reactos/hal/halx86/include/ioapic.h)
_____
Modified: branches/alex_devel_branch/reactos/hal/halx86/include/mps.h
--- branches/alex_devel_branch/reactos/hal/halx86/include/mps.h
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/hal/halx86/include/mps.h
2005-03-08 23:33:28 UTC (rev 13896)
@@ -9,77 +9,7 @@
#define IRQL2TPR(irql) ((irql) >= IPI_LEVEL ? IPI_VECTOR : ((irql)
= PROFILE_LEVEL ? LOCAL_TIMER_VECTOR : ((irql) >
DISPATCH_LEVEL ?
IRQL2VECTOR(irql) : 0)))
-#define IOAPIC_DEFAULT_BASE 0xFEC00000 /* Default I/O APIC Base
Register Address */
-/* I/O APIC Register Address Map */
-#define IOAPIC_IOREGSEL 0x0000 /* I/O Register Select (index) (R/W) */
-#define IOAPIC_IOWIN 0x0010 /* I/O window (data) (R/W) */
-
-#define IOAPIC_ID 0x0000 /* IO APIC ID (R/W) */
-#define IOAPIC_VER 0x0001 /* IO APIC Version (R) */
-#define IOAPIC_ARB 0x0002 /* IO APIC Arbitration ID (R) */
-#define IOAPIC_REDTBL 0x0010 /* Redirection Table (0-23 64-bit
registers) (R/W) */
-
-#define IOAPIC_ID_MASK (0xF << 24)
-#define GET_IOAPIC_ID(x) (((x) & IOAPIC_ID_MASK) >> 24)
-#define SET_IOAPIC_ID(x) ((x) << 24)
-
-#define IOAPIC_VER_MASK (0xFF)
-#define GET_IOAPIC_VERSION(x) (((x) & IOAPIC_VER_MASK))
-#define IOAPIC_MRE_MASK (0xFF << 16) /* Maximum Redirection
Entry */
-#define GET_IOAPIC_MRE(x) (((x) & IOAPIC_MRE_MASK) >> 16)
-
-#define IOAPIC_ARB_MASK (0xF << 24)
-#define GET_IOAPIC_ARB(x) (((x) & IOAPIC_ARB_MASK) >> 24)
-
-#define IOAPIC_TBL_DELMOD (0x7 << 10) /* Delivery Mode (see
APIC_DM_*) */
-#define IOAPIC_TBL_DM (0x1 << 11) /* Destination Mode */
-#define IOAPIC_TBL_DS (0x1 << 12) /* Delivery Status */
-#define IOAPIC_TBL_INTPOL (0x1 << 13) /* Interrupt Input Pin Polarity
*/
-#define IOAPIC_TBL_RIRR (0x1 << 14) /* Remote IRR */
-#define IOAPIC_TBL_TM (0x1 << 15) /* Trigger Mode */
-#define IOAPIC_TBL_IM (0x1 << 16) /* Interrupt Mask */
-#define IOAPIC_TBL_DF0 (0xF << 56) /* Destination Field (physical
mode) */
-#define IOAPIC_TBL_DF1 (0xFF<< 56) /* Destination Field (logical
mode) */
-#define IOAPIC_TBL_VECTOR (0xFF << 0) /* Vector (10h - FEh) */
-
-typedef struct _IOAPIC_ROUTE_ENTRY {
- ULONG vector : 8,
- delivery_mode : 3, /* 000: FIXED
- * 001: lowest
priority
- * 111: ExtINT
- */
- dest_mode : 1, /* 0: physical, 1: logical
*/
- delivery_status : 1,
- polarity : 1,
- irr : 1,
- trigger : 1, /* 0: edge, 1: level */
- mask : 1, /* 0: enabled, 1: disabled
*/
- __reserved_2 : 15;
-
- union { struct { ULONG
- __reserved_1 : 24,
- physical_dest : 4,
- __reserved_2 : 4;
- } physical;
-
- struct { ULONG
- __reserved_1 : 24,
- logical_dest : 8;
- } logical;
- } dest;
-} __attribute__ ((packed)) IOAPIC_ROUTE_ENTRY, *PIOAPIC_ROUTE_ENTRY;
-
-typedef struct _IOAPIC_INFO
-{
- ULONG ApicId; /* APIC ID */
- ULONG ApicVersion; /* APIC version */
- ULONG ApicAddress; /* APIC address */
- ULONG EntryCount; /* Number of redirection entries */
-} IOAPIC_INFO, *PIOAPIC_INFO;
-
-
-
#if 0
/* This values are defined in halirql.h */
#define FIRST_DEVICE_VECTOR 0x30
@@ -148,14 +78,8 @@
} __attribute__((packed)) MP_CONFIGURATION_PROCESSOR,
*PMP_CONFIGURATION_PROCESSOR;
-#define CPU_FLAG_ENABLED 1 /* Processor is available */
-#define CPU_FLAG_BSP 2 /* Processor is the bootstrap
processor */
-#define CPU_STEPPING_MASK 0x0F
-#define CPU_MODEL_MASK 0xF0
-#define CPU_FAMILY_MASK 0xF00
-
typedef struct __attribute__((packed)) _MP_CONFIGURATION_BUS
{
UCHAR Type; /* 1 */
@@ -239,54 +163,20 @@
} MP_CONFIGURATION_INTLOCAL, *PMP_CONFIGURATION_INTLOCAL;
#define MP_APIC_ALL 0xFF
-
-
-static inline VOID ReadPentiumClock(PULARGE_INTEGER Count)
-{
- register ULONG nLow;
- register ULONG nHigh;
-#if defined(__GNUC__)
- __asm__ __volatile__ ("rdtsc" : "=a" (nLow), "=d"
(nHigh));
-#elif defined(_MSC_VER)
- __asm rdtsc
- __asm mov nLow, eax
- __asm mov nHigh, edx
-#else
-#error Unknown compiler for inline assembler
-#endif
+#define CPU_FLAG_ENABLED 1 /* Processor is available */
+#define CPU_FLAG_BSP 2 /* Processor is the bootstrap
processor */
- Count->u.LowPart = nLow;
- Count->u.HighPart = nHigh;
-}
+#define CPU_STEPPING_MASK 0x0F
+#define CPU_MODEL_MASK 0xF0
+#define CPU_FAMILY_MASK 0xF00
-
-
-
-/* CPU flags */
-#define CPU_USABLE 0x01 /* 1 if the CPU is usable (ie. can be used)
*/
-#define CPU_ENABLED 0x02 /* 1 if the CPU is enabled */
-#define CPU_BSP 0x04 /* 1 if the CPU is the bootstrap processor
*/
-
-
-typedef enum {
- amPIC = 0, /* IMCR and PIC compatibility mode */
- amVWIRE /* Virtual Wire compatibility mode */
-} APIC_MODE;
-
-
#define PIC_IRQS 16
/* Prototypes */
VOID HalpInitMPS(VOID);
-ULONG IOAPICRead(ULONG Apic, ULONG Offset);
-VOID IOAPICWrite(ULONG Apic, ULONG Offset, ULONG Value);
-VOID IOAPICMaskIrq(ULONG Irq);
-VOID IOAPICUnmaskIrq(ULONG Irq);
-/* For debugging */
-VOID IOAPICDump(VOID);
#endif /* __INCLUDE_HAL_MPS */
_____
Modified: branches/alex_devel_branch/reactos/hal/halx86/mp/Makefile
--- branches/alex_devel_branch/reactos/hal/halx86/mp/Makefile
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/hal/halx86/mp/Makefile
2005-03-08 23:33:28 UTC (rev 13896)
@@ -61,7 +61,9 @@
MP_OBJECTS = \
apic.o \
halinit_mp.o \
+ ioapic.o \
ipi_mp.o \
+ mpconfig.o \
mpsirql.o \
mpsboot.o \
mps.o \
_____
Modified: branches/alex_devel_branch/reactos/hal/halx86/mp/apic.c
--- branches/alex_devel_branch/reactos/hal/halx86/mp/apic.c
2005-03-08 23:15:34 UTC (rev 13895)
+++ branches/alex_devel_branch/reactos/hal/halx86/mp/apic.c
2005-03-08 23:33:28 UTC (rev 13896)
@@ -1,6 +1,6 @@
/*
* ReactOS kernel
- * Copyright (C) 2004 ReactOS Team
+ * Copyright (C) 2004, 2005 ReactOS Team
*
* This program is free software; you can redistribute it and/or
modify
* it under the terms of the GNU General Public License as published
by
@@ -25,6 +25,8 @@
* PROGRAMMER:
*/
+/* INCLUDE
***********************************************************************/
+
#include <ddk/ntddk.h>
#include <internal/i386/ps.h>
@@ -36,23 +38,47 @@
#define NDEBUG
#include <internal/debug.h>
-BOOLEAN VerifyLocalAPIC(VOID);
-VOID APICCalibrateTimer(ULONG CPU);
+/* GLOBALS
***********************************************************************/
-extern VOID MpsTimerInterrupt(VOID);
-extern VOID MpsErrorInterrupt(VOID);
-extern VOID MpsSpuriousInterrupt(VOID);
-extern VOID MpsIpiInterrupt(VOID);
+ULONG CPUCount; /* Total number
of CPUs */
+ULONG BootCPU; /* Bootstrap processor
*/
+ULONG OnlineCPUs; /* Bitmask of online
CPUs */
+CPU_INFO CPUMap[MAX_CPU]; /* Map of all CPUs in
the system */
-extern ULONG APICMode; /* APIC mode at startup */
-extern PULONG BIOSBase; /* Virtual address of BIOS data segment
*/
-extern PULONG CommonBase; /* Virtual address of common area */
-extern ULONG BootCPU; /* Bootstrap processor */
-extern ULONG OnlineCPUs; /* Bitmask of online CPUs */
+#ifdef CONFIG_SMP
+PULONG BIOSBase; /* Virtual address of
BIOS data segment */
+PULONG CommonBase; /* Virtual address of
common area */
+#endif
-extern CHAR *APstart, *APend;
-extern VOID (*APflush)(VOID);
+PULONG APICBase = (PULONG)APIC_DEFAULT_BASE; /* Virtual address of
local APIC */
+ULONG APICMode; /* APIC mode at
startup */
+
+/* For debugging */
+ULONG lastregr[MAX_CPU];
+ULONG lastvalr[MAX_CPU];
+ULONG lastregw[MAX_CPU];
+ULONG lastvalw[MAX_CPU];
+
+#ifdef CONFIG_SMP
+typedef struct __attribute__((packed)) _COMMON_AREA_INFO
+{
+ ULONG Stack; /* Location of AP stack */
+ ULONG PageDirectory; /* Page directory for an AP */
+ ULONG NtProcessStartup; /* Kernel entry point for an AP */
+ ULONG PaeModeEnabled; /* PAE mode is enabled */
+ ULONG Debug[16]; /* For debugging */
+} COMMON_AREA_INFO, *PCOMMON_AREA_INFO;
+#endif
+
+CHAR *APstart, *APend;
+
+#define BIOS_AREA 0x0
+#define COMMON_AREA 0x2000
+
+#define HZ (100)
+#define APIC_DIVISOR (16)
+
#define CMOS_READ(address) ({ \
WRITE_PORT_UCHAR((PUCHAR)0x70, address)); \
READ_PORT_UCHAR((PUCHAR)0x71)); \
@@ -63,20 +89,17 @@
WRITE_PORT_UCHAR((PUCHAR)0x71, value); \
})
-#define BIOS_AREA 0x0
-#define COMMON_AREA 0x2000
+extern PVOID IMPORTED MmSystemRangeStart;
+/* FUNCTIONS
*********************************************************************/
-extern CPU_INFO CPUMap[MAX_CPU]; /* Map of all CPUs in
the system */
+extern ULONG Read8254Timer(VOID);
+extern VOID WaitFor8254Wraparound(VOID);
+extern VOID MpsTimerInterrupt(VOID);
+extern VOID MpsErrorInterrupt(VOID);
+extern VOID MpsSpuriousInterrupt(VOID);
+extern VOID MpsIpiInterrupt(VOID);
-PULONG APICBase = (PULONG)APIC_DEFAULT_BASE; /* Virtual address of
local APIC */
-
-/* For debugging */
-ULONG lastregr[MAX_CPU];
-ULONG lastvalr[MAX_CPU];
-ULONG lastregw[MAX_CPU];
-ULONG lastvalw[MAX_CPU];
-
ULONG APICGetMaxLVT(VOID)
{
ULONG tmp, ver, maxlvt;
@@ -152,7 +175,7 @@
}
/* Enable symetric I/O mode ie. connect the BSP's local APIC to INT and
NMI lines */
-VOID EnableSMPMode(VOID)
+VOID EnableApicMode(VOID)
{
/*
* Do not trust the local APIC being empty at bootup.
@@ -203,64 +226,7 @@
APICWrite(APIC_SIVR, tmp);
}
-VOID HaliInitBSP(VOID)
-{
- PUSHORT ps;
- static BOOLEAN BSPInitialized = FALSE;
- /* Only initialize the BSP once */
- if (BSPInitialized)
- {
- KEBUGCHECK(0);
- return;
- }
-
- BSPInitialized = TRUE;
-
- DPRINT("APIC is mapped at 0x%X\n", APICBase);
-
- if (VerifyLocalAPIC())
- {
- DPRINT("APIC found\n");
- }
- else
- {
- DPRINT("No APIC found\n");
- KEBUGCHECK(0);
- }
-
- if (APICMode == amPIC)
- {
- EnableSMPMode();
- }
-
- APICSetup();
-
- /* BIOS data segment */
- BIOSBase = (PULONG)BIOS_AREA;
-
- /* Area for communicating with the APs */
- CommonBase = (PULONG)COMMON_AREA;
-
- /* Copy bootstrap code to common area */
- memcpy((PVOID)((ULONG)CommonBase + PAGE_SIZE),
- &APstart,
- (ULONG)&APend - (ULONG)&APstart + 1);
-
- /* Set shutdown code */
- CMOS_WRITE(0xF, 0xA);
-
- /* Set warm reset vector */
- ps = (PUSHORT)((ULONG)BIOSBase + 0x467);
- *ps = (COMMON_AREA + PAGE_SIZE) & 0xF;
-
- ps = (PUSHORT)((ULONG)BIOSBase + 0x469);
- *ps = (COMMON_AREA + PAGE_SIZE) >> 4;
-
- /* Calibrate APIC timer */
- APICCalibrateTimer(BootCPU);
-}
-
inline ULONG _APICRead(ULONG Offset)
{
PULONG p;
@@ -455,7 +421,6 @@
BOOLEAN VerifyLocalAPIC(VOID)
{
UINT reg0, reg1;
- CHECKPOINT1;
/* The version register is read-only in a real APIC */
reg0 = APICRead(APIC_VER);
DPRINT1("Getting VERSION: %x\n", reg0);
@@ -502,9 +467,23 @@
return FALSE;
}
+ ULONG l, h;
+ Ki386Rdmsr(0x1b /*MSR_IA32_APICBASE*/, l, h);
+
+ if (!(l & /*MSR_IA32_APICBASE_ENABLE*/(1<<11)))
+ {
+ DPRINT1("Local APIC disabled by BIOS -- reenabling.\n");
+ l &= ~/*MSR_IA32_APICBASE_BASE*/(1<<11);
+ l |= /*MSR_IA32_APICBASE_ENABLE |
APIC_DEFAULT_PHYS_BASE*/(1<<11)|0xfee00000;
+ Ki386Wrmsr(0x1b/*MSR_IA32_APICBASE*/, l, h);
+ }
+
+
+
return TRUE;
}
+#ifdef CONFIG_SMP
VOID APICSendIPI(ULONG Target, ULONG Mode)
{
ULONG tmp, i, flags;
@@ -568,6 +547,7 @@
}
Ki386RestoreFlags(flags);
}
+#endif
VOID APICSetup(VOID)
{
@@ -651,7 +631,6 @@
}
APICWrite(APIC_LINT0, tmp);
-
/*
[truncated at 1000 lines; 7233 more skipped]