]>
Commit | Line | Data |
---|---|---|
bae5ddc0 SZ |
1 | /** @file\r |
2 | Platform Hook Library instance for UART device upon coreboot.\r | |
3 | \r | |
4 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include <Base.h>\r | |
16 | #include <Uefi/UefiBaseType.h>\r | |
17 | #include <Library/PlatformHookLib.h>\r | |
18 | #include <Library/CbParseLib.h>\r | |
19 | #include <Library/PcdLib.h>\r | |
20 | \r | |
21 | /**\r | |
22 | Performs platform specific initialization required for the CPU to access\r | |
23 | the hardware associated with a SerialPortLib instance. This function does\r | |
24 | not intiailzie the serial port hardware itself. Instead, it initializes\r | |
25 | hardware devices that are required for the CPU to access the serial port\r | |
26 | hardware. This function may be called more than once.\r | |
27 | \r | |
28 | @retval RETURN_SUCCESS The platform specific initialization succeeded.\r | |
29 | @retval RETURN_DEVICE_ERROR The platform specific initialization could not be completed.\r | |
30 | \r | |
31 | **/\r | |
32 | RETURN_STATUS\r | |
33 | EFIAPI\r | |
34 | PlatformHookSerialPortInitialize (\r | |
35 | VOID\r | |
36 | )\r | |
37 | {\r | |
38 | RETURN_STATUS Status;\r | |
39 | UINT32 SerialRegBase;\r | |
40 | UINT32 SerialRegAccessType;\r | |
41 | \r | |
42 | Status = CbParseSerialInfo (&SerialRegBase, &SerialRegAccessType, NULL);\r | |
43 | if (RETURN_ERROR (Status)) {\r | |
44 | return Status;\r | |
45 | }\r | |
46 | \r | |
47 | if (SerialRegAccessType == 2) { //MMIO\r | |
53f97bdc | 48 | Status = PcdSetBoolS (PcdSerialUseMmio, TRUE);\r |
bae5ddc0 | 49 | } else { //IO\r |
53f97bdc SZ |
50 | Status = PcdSetBoolS (PcdSerialUseMmio, FALSE);\r |
51 | }\r | |
52 | if (RETURN_ERROR (Status)) {\r | |
53 | return Status;\r | |
54 | }\r | |
55 | Status = PcdSet64S (PcdSerialRegisterBase, (UINT64) SerialRegBase);\r | |
56 | if (RETURN_ERROR (Status)) {\r | |
57 | return Status;\r | |
bae5ddc0 | 58 | }\r |
bae5ddc0 SZ |
59 | \r |
60 | return RETURN_SUCCESS;\r | |
61 | }\r | |
62 | \r |