42 OUT UINT64 *BaseAddress
45 CONST CHAR8 *NodeStatus;
49 NodeStatus = fdt_getprop (DeviceTree, Node,
"status",
NULL);
54 RegProp = fdt_getprop (DeviceTree, Node,
"reg", &PropSize);
55 if (RegProp ==
NULL) {
102 if (fdt_check_header (DeviceTree) != 0) {
106 Ports->NumberOfPorts = 0;
107 Node = fdt_next_node (DeviceTree, 0,
NULL);
109 (Ports->NumberOfPorts <
ARRAY_SIZE (Ports->BaseAddress)))
111 CONST CHAR8 *CompatProp;
114 CompatProp = fdt_getprop (DeviceTree, Node,
"compatible", &PropSize);
115 if (CompatProp !=
NULL) {
116 CONST CHAR8 *CompatItem;
118 CompatItem = CompatProp;
119 while ((CompatItem < CompatProp + PropSize) &&
125 if (CompatItem < CompatProp + PropSize) {
126 RETURN_STATUS Status;
131 Ports->BaseAddress[Ports->NumberOfPorts++] = BaseAddress;
136 Node = fdt_next_node (DeviceTree, Node,
NULL);
170 OUT UINT64 *BaseAddress
174 CONST CHAR8 *StdoutPathProp;
176 CONST CHAR8 *StdoutPathEnd;
177 UINTN StdoutPathLength;
179 RETURN_STATUS Status;
181 if (fdt_check_header (DeviceTree) != 0) {
185 ChosenNode = fdt_path_offset (DeviceTree,
"/chosen");
186 if (ChosenNode < 0) {
190 StdoutPathProp = fdt_getprop (
196 if (StdoutPathProp ==
NULL) {
205 if (StdoutPathEnd ==
NULL) {
206 StdoutPathLength = PropSize - 1;
208 StdoutPathLength = StdoutPathEnd - StdoutPathProp;
211 if (StdoutPathLength == 0) {
215 if (StdoutPathProp[0] ==
'/') {
219 ConsoleNode = fdt_path_offset_namelen (
222 (INT32)StdoutPathLength
228 CONST CHAR8 *ResolvedStdoutPath;
230 ResolvedStdoutPath = fdt_get_alias_namelen (
233 (INT32)StdoutPathLength
235 if (ResolvedStdoutPath ==
NULL) {
239 ConsoleNode = fdt_path_offset (DeviceTree, ResolvedStdoutPath);
242 if (ConsoleNode < 0) {
UINT64 EFIAPI ReadUnaligned64(IN CONST UINT64 *Buffer)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
CHAR8 *EFIAPI AsciiStrStr(IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString)
RETURN_STATUS EFIAPI FdtSerialGetConsolePort(IN CONST VOID *DeviceTree, OUT UINT64 *BaseAddress)
STATIC RETURN_STATUS GetBaseAddress(IN CONST VOID *DeviceTree, IN INT32 Node, OUT UINT64 *BaseAddress)
RETURN_STATUS EFIAPI FdtSerialGetPorts(IN CONST VOID *DeviceTree, IN CONST CHAR8 *Compatible, OUT FDT_SERIAL_PORTS *Ports)
#define RETURN_PROTOCOL_ERROR
#define RETURN_ERROR(StatusCode)
#define RETURN_DEVICE_ERROR
#define ARRAY_SIZE(Array)
#define RETURN_INVALID_PARAMETER
#define RETURN_BAD_BUFFER_SIZE