+/** @file\r
+ This library will parse the coreboot table in memory and extract those required\r
+ information.\r
+\r
+ Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Uefi/UefiBaseType.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/CbParseLib.h>\r
+\r
+#include <IndustryStandard/Acpi.h>\r
+\r
+#include "Coreboot.h"\r
+\r
+/* Helpful inlines */\r
+\r
+static UINT64 cb_unpack64(struct cbuint64 val)\r
+{\r
+ return (((UINT64) val.hi) << 32) | val.lo;\r
+}\r
+\r
+static const char *cb_mb_vendor_string(const struct cb_mainboard *cbm)\r
+{\r
+ return (char *)(cbm->strings + cbm->vendor_idx);\r
+}\r
+\r
+static const char *cb_mb_part_string(const struct cb_mainboard *cbm)\r
+{\r
+ return (char *)(cbm->strings + cbm->part_number_idx);\r
+}\r
+\r
+UINT16\r
+CbCheckSum16 (\r
+ IN UINT16 *Buffer,\r
+ IN UINTN Length\r
+ )\r
+{\r
+ UINT32 Sum, TmpValue;\r
+ UINTN Idx;\r
+ UINT8 *TmpPtr;\r
+ \r
+ Sum = 0;\r
+ TmpPtr = (UINT8 *)Buffer;\r
+ for(Idx = 0; Idx < Length; Idx++) {\r
+ TmpValue = TmpPtr[Idx];\r
+ if (Idx % 2 == 1) {\r
+ TmpValue <<= 8;\r
+ }\r
+ \r
+ Sum += TmpValue;\r
+ \r
+ // Wrap\r
+ if (Sum >= 0x10000) {\r
+ Sum = (Sum + (Sum >> 16)) & 0xFFFF;\r
+ }\r
+ }\r
+ \r
+ return (UINT16)((~Sum) & 0xFFFF); \r
+}\r
+\r
+VOID *\r
+FindCbTag (\r
+ IN VOID *Start,\r
+ IN UINT32 Tag\r
+ )\r
+{\r
+ struct cb_header *Header;\r
+ struct cb_record *Record;\r
+ UINT8 *TmpPtr; \r
+ UINT8 *TagPtr; \r
+ UINTN Idx; \r
+ UINT16 CheckSum;\r
+ \r
+ Header = NULL;\r
+ TmpPtr = (UINT8 *)Start;\r
+ for (Idx = 0; Idx < 4096; Idx += 16, TmpPtr += 16) {\r
+ Header = (struct cb_header *)TmpPtr;\r
+ if (Header->signature == CB_HEADER_SIGNATURE) {\r
+ break;\r
+ }\r
+ }\r
+ \r
+ if (Idx >= 4096)\r
+ return NULL;\r
+ \r
+ if (Header == NULL || !Header->table_bytes)\r
+ return NULL;\r
+ \r
+ //\r
+ // Check the checksum of the coreboot table header\r
+ //\r
+ CheckSum = CbCheckSum16 ((UINT16 *)Header, sizeof (*Header));\r
+ if (CheckSum != 0) {\r
+ DEBUG ((EFI_D_ERROR, "Invalid coreboot table header checksum\n"));\r
+ return NULL;\r
+ } \r
+ \r
+ CheckSum = CbCheckSum16 ((UINT16 *)(TmpPtr + sizeof (*Header)), Header->table_bytes);\r
+ if (CheckSum != Header->table_checksum) {\r
+ DEBUG ((EFI_D_ERROR, "Incorrect checksum of all the coreboot table entries\n"));\r
+ return NULL;\r
+ }\r
+ \r
+ TagPtr = NULL;\r
+ TmpPtr += Header->header_bytes;\r
+ for (Idx = 0; Idx < Header->table_entries; Idx++) {\r
+ Record = (struct cb_record *)TmpPtr; \r
+ if (Record->tag == CB_TAG_FORWARD) {\r
+ TmpPtr = (VOID *)(UINTN)((struct cb_forward *)(UINTN)Record)->forward;\r
+ if (Tag == CB_TAG_FORWARD)\r
+ return TmpPtr;\r
+ else \r
+ return FindCbTag (TmpPtr, Tag);\r
+ } \r
+ if (Record->tag == Tag) {\r
+ TagPtr = TmpPtr;\r
+ break;\r
+ }\r
+ TmpPtr += Record->size; \r
+ }\r
+ \r
+ return TagPtr;\r
+}\r
+\r
+RETURN_STATUS\r
+FindCbMemTable ( \r
+ struct cbmem_root *root,\r
+ IN UINT32 TableId, \r
+ IN VOID** pMemTable,\r
+ IN UINT32* pMemTableSize\r
+)\r
+{ \r
+ UINTN Idx;\r
+ \r
+ if ((!root) || (!pMemTable))\r
+ return RETURN_INVALID_PARAMETER;\r
+ \r
+ for (Idx = 0; Idx < root->num_entries; Idx++) {\r
+ if (root->entries[Idx].id == TableId) {\r
+ *pMemTable = (VOID *) (UINTN)root->entries[Idx].start;\r
+ if (pMemTableSize)\r
+ *pMemTableSize = root->entries[Idx].size;\r
+ \r
+ DEBUG ((EFI_D_ERROR, "Find CbMemTable Id 0x%x, base 0x%x, size 0x%x\n", TableId, *pMemTable, *pMemTableSize));\r
+ return RETURN_SUCCESS;\r
+ }\r
+ }\r
+ \r
+ return RETURN_NOT_FOUND; \r
+}\r
+\r
+\r
+/**\r
+ Acquire the memory information from the coreboot table in memory.\r
+\r
+ @param pLowMemorySize Pointer to the variable of low memory size\r
+ @param pHighMemorySize Pointer to the variable of high memory size\r
+\r
+ @retval RETURN_SUCCESS Successfully find out the memory information.\r
+ @retval RETURN_INVALID_PARAMETER Invalid input parameters.\r
+ @retval RETURN_NOT_FOUND Failed to find the memory information.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseMemoryInfo (\r
+ IN UINT64* pLowMemorySize,\r
+ IN UINT64* pHighMemorySize\r
+ )\r
+{\r
+ struct cb_memory* rec;\r
+ struct cb_memory_range* Range;\r
+ UINT64 Start;\r
+ UINT64 Size;\r
+ UINTN Index;\r
+ \r
+ if ((!pLowMemorySize) || (!pHighMemorySize))\r
+ return RETURN_INVALID_PARAMETER;\r
+ \r
+ //\r
+ // Get the coreboot memory table\r
+ //\r
+ rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY);\r
+ if (!rec) \r
+ rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_MEMORY);\r
+ \r
+ if (!rec) \r
+ return RETURN_NOT_FOUND;\r
+ \r
+ *pLowMemorySize = 0;\r
+ *pHighMemorySize = 0;\r
+ \r
+ for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {\r
+ Range = MEM_RANGE_PTR(rec, Index); \r
+ Start = cb_unpack64(Range->start);\r
+ Size = cb_unpack64(Range->size);\r
+ DEBUG ((EFI_D_ERROR, "%d. %016lx - %016lx [%02x]\n",\r
+ Index, Start, Start + Size - 1, Range->type));\r
+ \r
+ if (Range->type != CB_MEM_RAM) {\r
+ continue;\r
+ }\r
+ \r
+ if (Start + Size < 0x100000000ULL) {\r
+ *pLowMemorySize = Start + Size;\r
+ } else { \r
+ *pHighMemorySize = Start + Size - 0x100000000ULL;\r
+ }\r
+ }\r
+ \r
+ DEBUG ((EFI_D_ERROR, "Low memory 0x%x, High Memory 0x%x\n", *pLowMemorySize, *pHighMemorySize));\r
+ \r
+ return RETURN_SUCCESS; \r
+}\r
+\r
+\r
+/**\r
+ Acquire the coreboot memory table with the given table id\r
+\r
+ @param TableId Table id to be searched\r
+ @param pMemTable Pointer to the base address of the memory table\r
+ @param pMemTableSize Pointer to the size of the memory table\r
+\r
+ @retval RETURN_SUCCESS Successfully find out the memory table.\r
+ @retval RETURN_INVALID_PARAMETER Invalid input parameters.\r
+ @retval RETURN_NOT_FOUND Failed to find the memory table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseCbMemTable (\r
+ IN UINT32 TableId, \r
+ IN VOID** pMemTable,\r
+ IN UINT32* pMemTableSize\r
+ )\r
+{\r
+ struct cb_memory* rec;\r
+ struct cb_memory_range* Range;\r
+ UINT64 Start;\r
+ UINT64 Size;\r
+ UINTN Index;\r
+ \r
+ if (!pMemTable)\r
+ return RETURN_INVALID_PARAMETER;\r
+ \r
+ *pMemTable = NULL;\r
+ \r
+ //\r
+ // Get the coreboot memory table\r
+ //\r
+ rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY);\r
+ if (!rec)\r
+ rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_MEMORY);\r
+ \r
+ if (!rec)\r
+ return RETURN_NOT_FOUND;\r
+ \r
+ for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {\r
+ Range = MEM_RANGE_PTR(rec, Index); \r
+ Start = cb_unpack64(Range->start);\r
+ Size = cb_unpack64(Range->size);\r
+ \r
+ if ((Range->type == CB_MEM_TABLE) && (Start > 0x1000)) {\r
+ if (FindCbMemTable ((struct cbmem_root *)(UINTN)(Start + Size - DYN_CBMEM_ALIGN_SIZE), TableId, pMemTable, pMemTableSize) == RETURN_SUCCESS)\r
+ return RETURN_SUCCESS;\r
+ }\r
+ }\r
+ \r
+ return RETURN_NOT_FOUND;\r
+}\r
+\r
+\r
+/**\r
+ Acquire the acpi table from coreboot\r
+\r
+ @param pMemTable Pointer to the base address of the memory table\r
+ @param pMemTableSize Pointer to the size of the memory table\r
+\r
+ @retval RETURN_SUCCESS Successfully find out the memory table.\r
+ @retval RETURN_INVALID_PARAMETER Invalid input parameters.\r
+ @retval RETURN_NOT_FOUND Failed to find the memory table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseAcpiTable (\r
+ IN VOID** pMemTable,\r
+ IN UINT32* pMemTableSize\r
+ )\r
+{\r
+ return CbParseCbMemTable (SIGNATURE_32 ('I', 'P', 'C', 'A'), pMemTable, pMemTableSize); \r
+}\r
+\r
+/**\r
+ Acquire the smbios table from coreboot\r
+\r
+ @param pMemTable Pointer to the base address of the memory table\r
+ @param pMemTableSize Pointer to the size of the memory table\r
+\r
+ @retval RETURN_SUCCESS Successfully find out the memory table.\r
+ @retval RETURN_INVALID_PARAMETER Invalid input parameters.\r
+ @retval RETURN_NOT_FOUND Failed to find the memory table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseSmbiosTable (\r
+ IN VOID** pMemTable,\r
+ IN UINT32* pMemTableSize\r
+ )\r
+{\r
+ return CbParseCbMemTable (SIGNATURE_32 ('T', 'B', 'M', 'S'), pMemTable, pMemTableSize); \r
+}\r
+\r
+/**\r
+ Find the required fadt information\r
+\r
+ @param pPmCtrlReg Pointer to the address of power management control register\r
+ @param pPmTimerReg Pointer to the address of power management timer register\r
+ @param pResetReg Pointer to the address of system reset register\r
+ @param pResetValue Pointer to the value to be writen to the system reset register\r
+\r
+ @retval RETURN_SUCCESS Successfully find out all the required fadt information.\r
+ @retval RETURN_NOT_FOUND Failed to find the fadt table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseFadtInfo (\r
+ IN UINTN* pPmCtrlReg,\r
+ IN UINTN* pPmTimerReg,\r
+ IN UINTN* pResetReg,\r
+ IN UINTN* pResetValue\r
+ )\r
+{\r
+ EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER* Rsdp;\r
+ EFI_ACPI_DESCRIPTION_HEADER* Rsdt;\r
+ UINT32* Entry32;\r
+ UINTN Entry32Num;\r
+ EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE* Fadt;\r
+ EFI_ACPI_DESCRIPTION_HEADER* Xsdt; \r
+ UINT64* Entry64;\r
+ UINTN Entry64Num;\r
+ UINTN Idx;\r
+ RETURN_STATUS Status;\r
+ \r
+ Rsdp = NULL;\r
+ Status = RETURN_SUCCESS;\r
+ \r
+ Status = CbParseAcpiTable (&Rsdp, NULL);\r
+ if (RETURN_ERROR(Status))\r
+ return Status;\r
+ \r
+ if (!Rsdp)\r
+ return RETURN_NOT_FOUND;\r
+ \r
+ DEBUG ((EFI_D_ERROR, "Find Rsdp at 0x%x\n", Rsdp));\r
+ DEBUG ((EFI_D_ERROR, "Find Rsdt 0x%x, Xsdt 0x%x\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress));\r
+ \r
+ //\r
+ // Search Rsdt First\r
+ //\r
+ Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress); \r
+ if (Rsdt != NULL) {\r
+ Entry32 = (UINT32 *)(Rsdt + 1);\r
+ Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;\r
+ for (Idx = 0; Idx < Entry32Num; Idx++) {\r
+ if (*(UINT32 *)(UINTN)(Entry32[Idx]) == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {\r
+ Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entry32[Idx]); \r
+ if (pPmCtrlReg)\r
+ *pPmCtrlReg = Fadt->Pm1aCntBlk; \r
+ DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk));\r
+ \r
+ if (pPmTimerReg) \r
+ *pPmTimerReg = Fadt->PmTmrBlk; \r
+ DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk));\r
+ \r
+ if (pResetReg) \r
+ *pResetReg = (UINTN)Fadt->ResetReg.Address; \r
+ DEBUG ((EFI_D_ERROR, "Reset Reg 0x%x\n", Fadt->ResetReg.Address));\r
+ \r
+ if (pResetValue) \r
+ *pResetValue = Fadt->ResetValue;\r
+ DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue));\r
+ \r
+ return RETURN_SUCCESS; \r
+ }\r
+ }\r
+ }\r
+ \r
+ //\r
+ // Search Xsdt Second\r
+ //\r
+ Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress); \r
+ if (Xsdt != NULL) {\r
+ Entry64 = (UINT64 *)(Xsdt + 1);\r
+ Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;\r
+ for (Idx = 0; Idx < Entry64Num; Idx++) {\r
+ if (*(UINT32 *)(UINTN)(Entry64[Idx]) == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {\r
+ Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entry64[Idx]); \r
+ if (pPmCtrlReg)\r
+ *pPmCtrlReg = Fadt->Pm1aCntBlk; \r
+ DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk));\r
+ \r
+ if (pPmTimerReg) \r
+ *pPmTimerReg = Fadt->PmTmrBlk; \r
+ DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk));\r
+ \r
+ if (pResetReg) \r
+ *pResetReg = (UINTN)Fadt->ResetReg.Address; \r
+ DEBUG ((EFI_D_ERROR, "Reset Reg 0x%x\n", Fadt->ResetReg.Address));\r
+ \r
+ if (pResetValue) \r
+ *pResetValue = Fadt->ResetValue;\r
+ DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue));\r
+ \r
+ return RETURN_SUCCESS; \r
+ }\r
+ }\r
+ } \r
+ \r
+ return RETURN_NOT_FOUND;\r
+}\r
+\r
+/**\r
+ Find the serial port information\r
+\r
+ @param pRegBase Pointer to the base address of serial port registers\r
+ @param pRegAccessType Pointer to the access type of serial port registers\r
+ @param pBaudrate Pointer to the serial port baudrate\r
+\r
+ @retval RETURN_SUCCESS Successfully find the serial port information.\r
+ @retval RETURN_NOT_FOUND Failed to find the serial port information .\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseSerialInfo (\r
+ IN UINT32* pRegBase,\r
+ IN UINT32* pRegAccessType,\r
+ IN UINT32* pBaudrate\r
+ )\r
+{\r
+ struct cb_serial* CbSerial;\r
+ \r
+ CbSerial = FindCbTag (0, CB_TAG_SERIAL);\r
+ if (!CbSerial)\r
+ CbSerial = FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_SERIAL);\r
+ \r
+ if (!CbSerial)\r
+ return RETURN_NOT_FOUND;\r
+ \r
+ if (pRegBase)\r
+ *pRegBase = CbSerial->baseaddr;\r
+ \r
+ if (pRegAccessType)\r
+ *pRegAccessType = CbSerial->type;\r
+ \r
+ if (pBaudrate)\r
+ *pBaudrate = CbSerial->baud;\r
+ \r
+ return RETURN_SUCCESS;\r
+}\r
+\r
+/**\r
+ Search for the coreboot table header\r
+\r
+ @param Level Level of the search depth\r
+ @param HeaderPtr Pointer to the pointer of coreboot table header\r
+\r
+ @retval RETURN_SUCCESS Successfully find the coreboot table header .\r
+ @retval RETURN_NOT_FOUND Failed to find the coreboot table header .\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseGetCbHeader (\r
+ IN UINTN Level,\r
+ IN VOID** HeaderPtr\r
+ )\r
+{\r
+ UINTN Index;\r
+ VOID* TempPtr;\r
+ \r
+ if (!HeaderPtr)\r
+ return RETURN_NOT_FOUND;\r
+ \r
+ TempPtr = NULL; \r
+ for (Index = 0; Index < Level; Index++) {\r
+ TempPtr = FindCbTag (TempPtr, CB_TAG_FORWARD);\r
+ if (!TempPtr)\r
+ break; \r
+ }\r
+ \r
+ if ((Index >= Level) && (TempPtr != NULL)) {\r
+ *HeaderPtr = TempPtr;\r
+ return RETURN_SUCCESS;\r
+ }\r
+ \r
+ return RETURN_NOT_FOUND;\r
+}\r
+\r
+/**\r
+ Find the video frame buffer information\r
+\r
+ @param pFbInfo Pointer to the FRAME_BUFFER_INFO structure\r
+\r
+ @retval RETURN_SUCCESS Successfully find the video frame buffer information.\r
+ @retval RETURN_NOT_FOUND Failed to find the video frame buffer information .\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseFbInfo (\r
+ IN FRAME_BUFFER_INFO* pFbInfo\r
+ )\r
+{\r
+ struct cb_framebuffer* CbFbRec;\r
+ \r
+ if (!pFbInfo)\r
+ return RETURN_INVALID_PARAMETER;\r
+ \r
+ CbFbRec = FindCbTag (0, CB_TAG_FRAMEBUFFER);\r
+ if (!CbFbRec)\r
+ CbFbRec = FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_FRAMEBUFFER);\r
+ \r
+ if (!CbFbRec)\r
+ return RETURN_NOT_FOUND;\r
+ \r
+ DEBUG ((EFI_D_ERROR, "Found coreboot video frame buffer information\n"));\r
+ DEBUG ((EFI_D_ERROR, "physical_address: 0x%x\n", CbFbRec->physical_address));\r
+ DEBUG ((EFI_D_ERROR, "x_resolution: 0x%x\n", CbFbRec->x_resolution));\r
+ DEBUG ((EFI_D_ERROR, "y_resolution: 0x%x\n", CbFbRec->y_resolution));\r
+ DEBUG ((EFI_D_ERROR, "bits_per_pixel: 0x%x\n", CbFbRec->bits_per_pixel));\r
+ DEBUG ((EFI_D_ERROR, "bytes_per_line: 0x%x\n", CbFbRec->bytes_per_line));\r
+ \r
+ DEBUG ((EFI_D_ERROR, "red_mask_size: 0x%x\n", CbFbRec->red_mask_size));\r
+ DEBUG ((EFI_D_ERROR, "red_mask_pos: 0x%x\n", CbFbRec->red_mask_pos));\r
+ DEBUG ((EFI_D_ERROR, "green_mask_size: 0x%x\n", CbFbRec->green_mask_size));\r
+ DEBUG ((EFI_D_ERROR, "green_mask_pos: 0x%x\n", CbFbRec->green_mask_pos));\r
+ DEBUG ((EFI_D_ERROR, "blue_mask_size: 0x%x\n", CbFbRec->blue_mask_size));\r
+ DEBUG ((EFI_D_ERROR, "blue_mask_pos: 0x%x\n", CbFbRec->blue_mask_pos));\r
+ DEBUG ((EFI_D_ERROR, "reserved_mask_size: 0x%x\n", CbFbRec->reserved_mask_size));\r
+ DEBUG ((EFI_D_ERROR, "reserved_mask_pos: 0x%x\n", CbFbRec->reserved_mask_pos));\r
+ \r
+ pFbInfo->LinearFrameBuffer = CbFbRec->physical_address; \r
+ pFbInfo->HorizontalResolution = CbFbRec->x_resolution;\r
+ pFbInfo->VerticalResolution = CbFbRec->y_resolution;\r
+ pFbInfo->BitsPerPixel = CbFbRec->bits_per_pixel;\r
+ pFbInfo->BytesPerScanLine = (UINT16)CbFbRec->bytes_per_line;\r
+ pFbInfo->Red.Mask = (1 << CbFbRec->red_mask_size) - 1;\r
+ pFbInfo->Red.Position = CbFbRec->red_mask_pos;\r
+ pFbInfo->Green.Mask = (1 << CbFbRec->green_mask_size) - 1;\r
+ pFbInfo->Green.Position = CbFbRec->green_mask_pos;\r
+ pFbInfo->Blue.Mask = (1 << CbFbRec->blue_mask_size) - 1;\r
+ pFbInfo->Blue.Position = CbFbRec->blue_mask_pos;\r
+ pFbInfo->Reserved.Mask = (1 << CbFbRec->reserved_mask_size) - 1;\r
+ pFbInfo->Reserved.Position = CbFbRec->reserved_mask_pos; \r
+ \r
+ return RETURN_SUCCESS;\r
+}\r
+\r
+\r