Author: hbelusca
Date: Mon Oct 14 21:29:17 2013
New Revision: 60675
URL:
http://svn.reactos.org/svn/reactos?rev=60675&view=rev
Log:
[NTOS:HEADLESS]
- Fix the name of a function.
- Fix HdlspSendStringAtBaud (we started displaying string at its second character) and fix
HdlspPutData (data was sent erroneous, shifted by 1).
Fix SAC display.
Modified:
trunk/reactos/ntoskrnl/ex/hdlsterm.c
Modified: trunk/reactos/ntoskrnl/ex/hdlsterm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/hdlsterm.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/hdlsterm.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/hdlsterm.c [iso-8859-1] Mon Oct 14 21:29:17 2013
@@ -38,7 +38,7 @@
FORCEINLINE
VOID
-HdlspReleaselobalLock(IN KIRQL OldIrql)
+HdlspReleaseGlobalLock(IN KIRQL OldIrql)
{
/* Only release the lock if we aren't bugchecking */
if (OldIrql != 0xFF)
@@ -56,117 +56,10 @@
HdlspSendStringAtBaud(IN PUCHAR String)
{
/* Send every byte */
- while (*String++ != ANSI_NULL)
- {
- InbvPortPutByte(HeadlessGlobals->TerminalPort, *String);
- }
-}
-
-NTSTATUS
-NTAPI
-HdlspEnableTerminal(IN BOOLEAN Enable)
-{
- /* Enable if requested, as long as this isn't a PCI serial port crashing */
- if ((Enable) &&
- !(HeadlessGlobals->TerminalEnabled) &&
- !((HeadlessGlobals->IsMMIODevice) &&
(HeadlessGlobals->InBugCheck)))
- {
- /* Initialize the COM port with cportlib */
- HeadlessGlobals->TerminalEnabled = InbvPortInitialize(HeadlessGlobals->
- TerminalBaudRate,
- HeadlessGlobals->
- TerminalPortNumber,
- HeadlessGlobals->
- TerminalPortAddress,
- &HeadlessGlobals->
- TerminalPort,
- HeadlessGlobals->
- IsMMIODevice);
- if (!HeadlessGlobals->TerminalEnabled)
- {
- DPRINT1("Failed to initialize port through cportlib\n");
- return STATUS_UNSUCCESSFUL;
- }
-
- /* Cleanup the screen and reset the cursor */
- HdlspSendStringAtBaud((PUCHAR)"\x1B[2J");
- HdlspSendStringAtBaud((PUCHAR)"\x1B[H");
-
- /* Enable FIFO */
- InbvPortEnableFifo(HeadlessGlobals->TerminalPort, TRUE);
- }
- else if (!Enable)
- {
- /* Specific case when headless is being disabled */
- InbvPortTerminate(HeadlessGlobals->TerminalPort);
- HeadlessGlobals->TerminalPort = 0;
- HeadlessGlobals->TerminalEnabled = FALSE;
- }
-
- /* All done */
- return STATUS_SUCCESS;
-}
-
-VOID
-NTAPI
-INIT_FUNCTION
-HeadlessInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
-{
- PHEADLESS_LOADER_BLOCK HeadlessBlock;
-
- /* Only initialize further if the loader found EMS enabled */
- HeadlessBlock = LoaderBlock->Extension->HeadlessLoaderBlock;
- if (!HeadlessBlock) return;
-
- /* Ignore invalid EMS settings */
- if ((HeadlessBlock->PortNumber > 4) &&
(HeadlessBlock->UsedBiosSettings)) return;
-
- /* Allocate the global headless data */
- HeadlessGlobals = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(*HeadlessGlobals),
- 'sldH');
- if (!HeadlessGlobals) return;
-
- /* Zero and copy loader data */
- RtlZeroMemory(HeadlessGlobals, sizeof(*HeadlessGlobals));
- HeadlessGlobals->TerminalPortNumber = HeadlessBlock->PortNumber;
- HeadlessGlobals->TerminalPortAddress = HeadlessBlock->PortAddress;
- HeadlessGlobals->TerminalBaudRate = HeadlessBlock->BaudRate;
- HeadlessGlobals->TerminalParity = HeadlessBlock->Parity;
- HeadlessGlobals->TerminalStopBits = HeadlessBlock->StopBits;
- HeadlessGlobals->UsedBiosSettings = HeadlessBlock->UsedBiosSettings;
- HeadlessGlobals->IsMMIODevice = HeadlessBlock->IsMMIODevice;
- HeadlessGlobals->TerminalType = HeadlessBlock->TerminalType;
- HeadlessGlobals->SystemGUID = HeadlessBlock->SystemGUID;
- DPRINT1("EMS on Port %lu (0x%p) at %lu bps\n",
- HeadlessGlobals->TerminalPortNumber,
- HeadlessGlobals->TerminalPortAddress,
- HeadlessGlobals->TerminalBaudRate);
-
- /* These two are opposites of each other */
- if (HeadlessGlobals->IsMMIODevice) HeadlessGlobals->IsNonLegacyDevice = TRUE;
-
- /* Check for a PCI device, warn that this isn't supported */
- if (HeadlessBlock->PciDeviceId != PCI_INVALID_VENDORID)
- {
- DPRINT1("PCI Serial Ports not supported\n");
- }
-
- /* Log entries are not yet supported */
- DPRINT1("FIXME: No Headless logging support\n");
-
- /* Allocate temporary buffer */
- HeadlessGlobals->TmpBuffer = ExAllocatePoolWithTag(NonPagedPool, 80,
'sldH');
- if (!HeadlessGlobals->TmpBuffer) return;
-
- /* Windows seems to apply some special hacks for 9600 bps */
- if (HeadlessGlobals->TerminalBaudRate == 9600)
- {
- DPRINT1("Please use other baud rate than 9600bps for now\n");
- }
-
- /* Enable the terminal */
- HdlspEnableTerminal(TRUE);
+ while (*String != ANSI_NULL)
+ {
+ InbvPortPutByte(HeadlessGlobals->TerminalPort, *String++);
+ }
}
VOID
@@ -177,7 +70,7 @@
ULONG i;
for (i = 0; i < DataSize; i++)
{
- InbvPortPutByte(HeadlessGlobals->TerminalPort, Data[i]++);
+ InbvPortPutByte(HeadlessGlobals->TerminalPort, Data[i]);
}
}
@@ -252,6 +145,113 @@
NTSTATUS
NTAPI
+HdlspEnableTerminal(IN BOOLEAN Enable)
+{
+ /* Enable if requested, as long as this isn't a PCI serial port crashing */
+ if ((Enable) &&
+ !(HeadlessGlobals->TerminalEnabled) &&
+ !((HeadlessGlobals->IsMMIODevice) &&
(HeadlessGlobals->InBugCheck)))
+ {
+ /* Initialize the COM port with cportlib */
+ HeadlessGlobals->TerminalEnabled = InbvPortInitialize(HeadlessGlobals->
+ TerminalBaudRate,
+ HeadlessGlobals->
+ TerminalPortNumber,
+ HeadlessGlobals->
+ TerminalPortAddress,
+ &HeadlessGlobals->
+ TerminalPort,
+ HeadlessGlobals->
+ IsMMIODevice);
+ if (!HeadlessGlobals->TerminalEnabled)
+ {
+ DPRINT1("Failed to initialize port through cportlib\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* Cleanup the screen and reset the cursor */
+ HdlspSendStringAtBaud((PUCHAR)"\x1B[2J");
+ HdlspSendStringAtBaud((PUCHAR)"\x1B[H");
+
+ /* Enable FIFO */
+ InbvPortEnableFifo(HeadlessGlobals->TerminalPort, TRUE);
+ }
+ else if (!Enable)
+ {
+ /* Specific case when headless is being disabled */
+ InbvPortTerminate(HeadlessGlobals->TerminalPort);
+ HeadlessGlobals->TerminalPort = 0;
+ HeadlessGlobals->TerminalEnabled = FALSE;
+ }
+
+ /* All done */
+ return STATUS_SUCCESS;
+}
+
+VOID
+NTAPI
+INIT_FUNCTION
+HeadlessInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
+{
+ PHEADLESS_LOADER_BLOCK HeadlessBlock;
+
+ /* Only initialize further if the loader found EMS enabled */
+ HeadlessBlock = LoaderBlock->Extension->HeadlessLoaderBlock;
+ if (!HeadlessBlock) return;
+
+ /* Ignore invalid EMS settings */
+ if ((HeadlessBlock->PortNumber > 4) &&
(HeadlessBlock->UsedBiosSettings)) return;
+
+ /* Allocate the global headless data */
+ HeadlessGlobals = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(*HeadlessGlobals),
+ 'sldH');
+ if (!HeadlessGlobals) return;
+
+ /* Zero and copy loader data */
+ RtlZeroMemory(HeadlessGlobals, sizeof(*HeadlessGlobals));
+ HeadlessGlobals->TerminalPortNumber = HeadlessBlock->PortNumber;
+ HeadlessGlobals->TerminalPortAddress = HeadlessBlock->PortAddress;
+ HeadlessGlobals->TerminalBaudRate = HeadlessBlock->BaudRate;
+ HeadlessGlobals->TerminalParity = HeadlessBlock->Parity;
+ HeadlessGlobals->TerminalStopBits = HeadlessBlock->StopBits;
+ HeadlessGlobals->UsedBiosSettings = HeadlessBlock->UsedBiosSettings;
+ HeadlessGlobals->IsMMIODevice = HeadlessBlock->IsMMIODevice;
+ HeadlessGlobals->TerminalType = HeadlessBlock->TerminalType;
+ HeadlessGlobals->SystemGUID = HeadlessBlock->SystemGUID;
+ DPRINT1("EMS on Port %lu (0x%p) at %lu bps\n",
+ HeadlessGlobals->TerminalPortNumber,
+ HeadlessGlobals->TerminalPortAddress,
+ HeadlessGlobals->TerminalBaudRate);
+
+ /* These two are opposites of each other */
+ if (HeadlessGlobals->IsMMIODevice) HeadlessGlobals->IsNonLegacyDevice = TRUE;
+
+ /* Check for a PCI device, warn that this isn't supported */
+ if (HeadlessBlock->PciDeviceId != PCI_INVALID_VENDORID)
+ {
+ DPRINT1("PCI Serial Ports not supported\n");
+ }
+
+ /* Log entries are not yet supported */
+ DPRINT1("FIXME: No Headless logging support\n");
+
+ /* Allocate temporary buffer */
+ HeadlessGlobals->TmpBuffer = ExAllocatePoolWithTag(NonPagedPool, 80,
'sldH');
+ if (!HeadlessGlobals->TmpBuffer) return;
+
+ /* Windows seems to apply some special hacks for 9600 bps */
+ if (HeadlessGlobals->TerminalBaudRate == 9600)
+ {
+ DPRINT1("Please use other baud rate than 9600bps for now\n");
+ }
+
+ /* Enable the terminal */
+ HdlspEnableTerminal(TRUE);
+}
+
+NTSTATUS
+NTAPI
HdlspDispatch(IN HEADLESS_CMD Command,
IN PVOID InputBuffer,
IN SIZE_T InputBufferSize,
@@ -277,13 +277,13 @@
if (HeadlessGlobals->ProcessingCmd)
{
- HdlspReleaselobalLock(OldIrql);
+ HdlspReleaseGlobalLock(OldIrql);
return STATUS_UNSUCCESSFUL;
}
/* Don't allow these commands next time */
HeadlessGlobals->ProcessingCmd = TRUE;
- HdlspReleaselobalLock(OldIrql);
+ HdlspReleaseGlobalLock(OldIrql);
}
/* Handle each command */