ReactOS 0.4.15-dev-8116-gf69e256
envir.c File Reference
#include "precomp.h"
Include dependency graph for envir.c:

Go to the source code of this file.

Functions

VOID NTAPI LlbEnvParseArguments (IN PATAG Arguments)
 
VOID NTAPI LlbEnvGetMemoryInformation (IN PULONG Base, IN PULONG Size)
 
BOOLEAN NTAPI LlbEnvGetRamDiskInformation (IN PULONG Base, IN PULONG Size)
 
PCHAR NTAPI LlbEnvRead (IN PCHAR ValueName)
 

Variables

ULONG LlbEnvHwPageSize
 
ULONG LlbEnvHwMemStart = 0
 
ULONG LlbEnvHwMemSize = 0
 
ULONG LlbEnvRamDiskStart = 0
 
ULONG LlbEnvRamDiskSize = 0
 
ULONG LlbEnvHwRevision
 
CHAR LlbEnvCmdLine [256]
 
CHAR LlbValueData [32]
 

Function Documentation

◆ LlbEnvGetMemoryInformation()

VOID NTAPI LlbEnvGetMemoryInformation ( IN PULONG  Base,
IN PULONG  Size 
)

Definition at line 97 of file envir.c.

99{
100 /* Return RAM information */
103}
ULONG LlbEnvHwMemSize
Definition: envir.c:13
ULONG LlbEnvHwMemStart
Definition: envir.c:12
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by LlbHwBuildMemoryMap().

◆ LlbEnvGetRamDiskInformation()

BOOLEAN NTAPI LlbEnvGetRamDiskInformation ( IN PULONG  Base,
IN PULONG  Size 
)

Definition at line 107 of file envir.c.

109{
110 /* Do we have a ramdisk? */
111 if (LlbEnvRamDiskSize == 0)
112 {
113 /* No */
114 *Base = 0;
115 *Size = 0;
116 return FALSE;
117 }
118
119 /* Return ramdisk information */
122 return TRUE;
123}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG LlbEnvRamDiskSize
Definition: envir.c:15
ULONG LlbEnvRamDiskStart
Definition: envir.c:14

Referenced by LlbHwBuildMemoryMap(), and LlbHwLoadOsLoaderFromRam().

◆ LlbEnvParseArguments()

VOID NTAPI LlbEnvParseArguments ( IN PATAG  Arguments)

Definition at line 22 of file envir.c.

23{
24 PATAG Atag;
25
26 /* Parse the ATAGs */
27 Atag = Arguments;
28 while (Atag->Hdr.Size)
29 {
30 /* Check tag type */
31 switch (Atag->Hdr.Tag)
32 {
33 case ATAG_CORE:
34
35 /* Save page size */
37 break;
38
39 case ATAG_REVISION:
40
41 /* Save page size */
43 break;
44
45 case ATAG_MEM:
46
47 /* Save RAM start and size */
49 LlbEnvHwMemSize += Atag->u.Mem.Size;
50 break;
51
52 case ATAG_INITRD2:
53
54 /* Save RAMDISK start and size */
57
58#ifdef _BEAGLE_
59 /* Make sure it's 16MB-aligned */
60 LlbEnvRamDiskSize = (LlbEnvRamDiskSize + (16 * 1024 * 1024) - 1)
61 &~ ((16 * 1024 * 1024) - 1);
62
63 /* The RAMDISK actually starts 16MB later */
64 LlbEnvRamDiskStart += 16 * 1024 * 1024;
65 LlbEnvRamDiskSize -= 16 * 1024 * 1024;
66#endif
67 break;
68
69 case ATAG_CMDLINE:
70
71 /* Save command line */
73 Atag->u.CmdLine.CmdLine,
74 Atag->Hdr.Size * sizeof(ULONG));
75 break;
76
77 /* Nothing left to handle */
78 case ATAG_NONE:
79 default:
80 break;
81 }
82
83 /* Next tag */
84 Atag = (PATAG)((PULONG)Atag + Atag->Hdr.Size);
85 }
86
87 /* For debugging */
88 DbgPrint("[BOOTROM] Board Revision: %lx PageSize: %dKB RAM: %dMB CMDLINE: %s\n"
89 "[RAMDISK] Base: %lx Size: %dMB\n",
91 LlbEnvHwPageSize / 1024, LlbEnvHwMemSize / 1024 / 1024, LlbEnvCmdLine,
93}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
CHAR LlbEnvCmdLine[256]
Definition: envir.c:17
ULONG LlbEnvHwRevision
Definition: envir.c:16
ULONG LlbEnvHwPageSize
Definition: envir.c:11
#define ATAG_REVISION
Definition: envir.h:64
struct _ATAG * PATAG
#define ATAG_NONE
Definition: envir.h:57
#define ATAG_MEM
Definition: envir.h:59
#define ATAG_CMDLINE
Definition: envir.h:66
#define ATAG_CORE
Definition: envir.h:58
#define ATAG_INITRD2
Definition: envir.h:62
#define DbgPrint
Definition: hal.h:12
CHAR CmdLine[ANYSIZE_ARRAY]
Definition: envir.h:41
ULONG PageSize
Definition: envir.h:18
ULONG Tag
Definition: envir.h:12
ULONG Size
Definition: envir.h:11
ULONG Start
Definition: envir.h:35
ULONG Size
Definition: envir.h:36
ULONG Start
Definition: envir.h:25
ULONG Size
Definition: envir.h:24
ULONG Rev
Definition: envir.h:30
Definition: envir.h:45
ATAG_REVISION Revision
Definition: envir.h:51
union _ATAG::@110 u
ATAG_CORE Core
Definition: envir.h:49
ATAG_MEM Mem
Definition: envir.h:50
ATAG_HEADER Hdr
Definition: envir.h:46
ATAG_CMDLINE CmdLine
Definition: envir.h:53
ATAG_INITRD2 InitRd2
Definition: envir.h:52
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59

Referenced by LlbStartup().

◆ LlbEnvRead()

PCHAR NTAPI LlbEnvRead ( IN PCHAR  ValueName)

Definition at line 127 of file envir.c.

128{
129 PCHAR ValuePointer;
130 ULONG Length = 0;
131
132 /* Search for the value name */
133 ValuePointer = strstr(LlbEnvCmdLine, ValueName);
134 if (ValuePointer)
135 {
136 /* Get the value data and its length */
137 ValuePointer += strlen(ValueName) + 1;
138 if (strchr(ValuePointer, ','))
139 {
140 /* Stop before next parameter */
141 Length = strchr(ValuePointer, ',') - ValuePointer;
142 }
143 else
144 {
145 /* Stop before the string ends */
146 Length = strlen(ValuePointer);
147 }
148
149 /* Copy it */
150 strncpy(LlbValueData, ValuePointer, Length);
151 }
152
153 /* Terminate the data */
155
156 /* Return the data */
157 return LlbValueData;
158}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strchr(const char *String, int ch)
Definition: utclib.c:501
CHAR LlbValueData[32]
Definition: envir.c:18
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243

Referenced by LlbHwLoadOsLoaderFromRam(), and LlbLoadOsLoader().

Variable Documentation

◆ LlbEnvCmdLine

CHAR LlbEnvCmdLine[256]

Definition at line 17 of file envir.c.

Referenced by LlbEnvParseArguments(), and LlbEnvRead().

◆ LlbEnvHwMemSize

ULONG LlbEnvHwMemSize = 0

Definition at line 13 of file envir.c.

Referenced by LlbEnvGetMemoryInformation(), and LlbEnvParseArguments().

◆ LlbEnvHwMemStart

ULONG LlbEnvHwMemStart = 0

Definition at line 12 of file envir.c.

Referenced by LlbEnvGetMemoryInformation(), and LlbEnvParseArguments().

◆ LlbEnvHwPageSize

ULONG LlbEnvHwPageSize

Definition at line 11 of file envir.c.

Referenced by LlbEnvParseArguments().

◆ LlbEnvHwRevision

ULONG LlbEnvHwRevision

Definition at line 16 of file envir.c.

Referenced by LlbEnvParseArguments().

◆ LlbEnvRamDiskSize

ULONG LlbEnvRamDiskSize = 0

Definition at line 15 of file envir.c.

Referenced by LlbEnvGetRamDiskInformation(), and LlbEnvParseArguments().

◆ LlbEnvRamDiskStart

ULONG LlbEnvRamDiskStart = 0

Definition at line 14 of file envir.c.

Referenced by LlbEnvGetRamDiskInformation(), and LlbEnvParseArguments().

◆ LlbValueData

CHAR LlbValueData[32]

Definition at line 18 of file envir.c.

Referenced by LlbEnvRead().