58 TmpPtr = (UINT8 *)Buffer;
59 for (Idx = 0; Idx < Length; Idx++) {
60 TmpValue = TmpPtr[Idx];
69 Sum = (Sum + (Sum >> 16)) & 0xFFFF;
73 return (UINT16)((~Sum) & 0xFFFF);
92 if ((Header ==
NULL) || (Header->table_bytes == 0)) {
96 if (Header->signature != CB_HEADER_SIGNATURE) {
103 CheckSum =
CbCheckSum16 ((UINT16 *)Header,
sizeof (*Header));
105 DEBUG ((DEBUG_ERROR,
"Invalid coreboot table header checksum\n"));
109 CheckSum =
CbCheckSum16 ((UINT16 *)((UINT8 *)Header +
sizeof (*Header)), Header->table_bytes);
110 if (CheckSum != Header->table_checksum) {
111 DEBUG ((DEBUG_ERROR,
"Incorrect checksum of all the coreboot table entries\n"));
154 for (Idx = 16; Idx < 4096; Idx += 16) {
156 if (Header->signature == CB_HEADER_SIGNATURE) {
176 TmpPtr = (UINT8 *)Header + Header->header_bytes;
177 for (Idx = 0; Idx < Header->table_entries; Idx++) {
179 if (Record->tag == CB_TAG_FORWARD) {
184 TmpPtr += Record->size;
223 TmpPtr = (UINT8 *)Header + Header->header_bytes;
224 for (Idx = 0; Idx < Header->table_entries; Idx++) {
226 if (Record->tag == Tag) {
231 TmpPtr += Record->size;
255 OUT UINT32 *MemTableSize
262 if ((Root ==
NULL) || (MemTable ==
NULL)) {
270 Entries = Root->entries;
271 if (Entries[0].magic == CBMEM_ENTRY_MAGIC) {
275 if (Entries[0].magic == IMD_ENTRY_MAGIC) {
282 for (Idx = 0; Idx < Root->num_entries; Idx++) {
283 if (Entries[Idx].
id == TableId) {
285 *MemTable = (VOID *)((
INTN)(INT32)Entries[Idx].start + (
UINTN)Root);
287 *MemTable = (VOID *)(
UINTN)Entries[Idx].start;
290 if (MemTableSize !=
NULL) {
291 *MemTableSize = Entries[Idx].size;
296 "Find CbMemTable Id 0x%x, base %p, size 0x%x\n",
324 OUT UINT32 *MemTableSize
335 if (MemTable ==
NULL) {
350 for (Index = 0; Index < MEM_RANGE_COUNT (Rec); Index++) {
351 Range = MEM_RANGE_PTR (Rec, Index);
355 if ((Range->type == CB_MEM_TABLE) && (Start > 0x1000)) {
356 CbMemRoot = (
struct cbmem_root *)(
UINTN)(Start + Size - DYN_CBMEM_ALIGN_SIZE);
357 Status =
FindCbMemTable (CbMemRoot, TableId, MemTable, MemTableSize);
358 if (!EFI_ERROR (Status)) {
397 for (Index = 0; Index < MEM_RANGE_COUNT (Rec); Index++) {
398 Range = MEM_RANGE_PTR (Rec, Index);
401 MemoryMap.Type = (UINT8)Range->type;
405 "%d. %016lx - %016lx [%02x]\n",
408 MemoryMap.Base + MemoryMap.Size - 1,
438 if (EFI_ERROR (Status)) {
439 return EFI_NOT_FOUND;
442 SmbiosTable->SmBiosEntryPoint = (UINT64)(
UINTN)MemTable;
467 if (EFI_ERROR (Status)) {
468 return EFI_NOT_FOUND;
471 AcpiTableHob->Rsdp = (UINT64)(
UINTN)MemTable;
494 if (CbSerial ==
NULL) {
498 SerialPortInfo->BaseAddr = CbSerial->baseaddr;
499 SerialPortInfo->RegWidth = CbSerial->regwidth;
500 SerialPortInfo->Type = CbSerial->type;
501 SerialPortInfo->Baud = CbSerial->baud;
502 SerialPortInfo->InputHertz = CbSerial->input_hertz;
503 SerialPortInfo->UartPciAddr = CbSerial->uart_pci_addr;
526 if (GfxInfo ==
NULL) {
530 CbFbRec =
FindCbTag (CB_TAG_FRAMEBUFFER);
531 if (CbFbRec ==
NULL) {
535 DEBUG ((DEBUG_INFO,
"Found coreboot video frame buffer information\n"));
536 DEBUG ((DEBUG_INFO,
"physical_address: 0x%lx\n", CbFbRec->physical_address));
537 DEBUG ((DEBUG_INFO,
"x_resolution: 0x%x\n", CbFbRec->x_resolution));
538 DEBUG ((DEBUG_INFO,
"y_resolution: 0x%x\n", CbFbRec->y_resolution));
539 DEBUG ((DEBUG_INFO,
"bits_per_pixel: 0x%x\n", CbFbRec->bits_per_pixel));
540 DEBUG ((DEBUG_INFO,
"bytes_per_line: 0x%x\n", CbFbRec->bytes_per_line));
542 DEBUG ((DEBUG_INFO,
"red_mask_size: 0x%x\n", CbFbRec->red_mask_size));
543 DEBUG ((DEBUG_INFO,
"red_mask_pos: 0x%x\n", CbFbRec->red_mask_pos));
544 DEBUG ((DEBUG_INFO,
"green_mask_size: 0x%x\n", CbFbRec->green_mask_size));
545 DEBUG ((DEBUG_INFO,
"green_mask_pos: 0x%x\n", CbFbRec->green_mask_pos));
546 DEBUG ((DEBUG_INFO,
"blue_mask_size: 0x%x\n", CbFbRec->blue_mask_size));
547 DEBUG ((DEBUG_INFO,
"blue_mask_pos: 0x%x\n", CbFbRec->blue_mask_pos));
548 DEBUG ((DEBUG_INFO,
"reserved_mask_size: 0x%x\n", CbFbRec->reserved_mask_size));
549 DEBUG ((DEBUG_INFO,
"reserved_mask_pos: 0x%x\n", CbFbRec->reserved_mask_pos));
551 GfxMode = &GfxInfo->GraphicsMode;
555 GfxMode->
PixelsPerScanLine = (CbFbRec->bytes_per_line << 3) / CbFbRec->bits_per_pixel;
556 if ((CbFbRec->red_mask_pos == 0) && (CbFbRec->green_mask_pos == 8) && (CbFbRec->blue_mask_pos == 16)) {
558 }
else if ((CbFbRec->blue_mask_pos == 0) && (CbFbRec->green_mask_pos == 8) && (CbFbRec->red_mask_pos == 16)) {
562 GfxMode->
PixelInformation.RedMask = ((1 << CbFbRec->red_mask_size) - 1) << CbFbRec->red_mask_pos;
563 GfxMode->
PixelInformation.GreenMask = ((1 << CbFbRec->green_mask_size) - 1) << CbFbRec->green_mask_pos;
564 GfxMode->
PixelInformation.BlueMask = ((1 << CbFbRec->blue_mask_size) - 1) << CbFbRec->blue_mask_pos;
565 GfxMode->
PixelInformation.ReservedMask = ((1 << CbFbRec->reserved_mask_size) - 1) << CbFbRec->reserved_mask_pos;
567 GfxInfo->FrameBufferBase = CbFbRec->physical_address;
568 GfxInfo->FrameBufferSize = CbFbRec->bytes_per_line * CbFbRec->y_resolution;
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
UINT64 cb_unpack64(IN struct cbuint64 val)
RETURN_STATUS EFIAPI ParseSmbiosTable(OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmbiosTable)
UINT16 CbCheckSum16(IN UINT16 *Buffer, IN UINTN Length)
BOOLEAN IsValidCbTable(IN struct cb_header *Header)
VOID * FindCbTag(IN UINT32 Tag)
RETURN_STATUS EFIAPI ParseMemoryInfo(IN BL_MEM_INFO_CALLBACK MemInfoCallback, IN VOID *Params)
RETURN_STATUS ParseCbMemTable(IN UINT32 TableId, OUT VOID **MemTable, OUT UINT32 *MemTableSize)
RETURN_STATUS EFIAPI ParseGfxDeviceInfo(OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *GfxDeviceInfo)
RETURN_STATUS EFIAPI ParseGfxInfo(OUT EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo)
RETURN_STATUS EFIAPI ParseAcpiTableInfo(OUT UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTableHob)
RETURN_STATUS EFIAPI ParseSerialInfo(OUT SERIAL_PORT_INFO *SerialPortInfo)
VOID *EFIAPI GetParameterBase(VOID)
RETURN_STATUS EFIAPI ParseMiscInfo(VOID)
RETURN_STATUS FindCbMemTable(IN struct cbmem_root *Root, IN UINT32 TableId, OUT VOID **MemTable, OUT UINT32 *MemTableSize)
#define SIGNATURE_32(A, B, C, D)
#define RETURN_INVALID_PARAMETER
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
@ PixelRedGreenBlueReserved8BitPerColor
@ PixelBlueGreenRedReserved8BitPerColor
#define PcdSet64S(TokenName, Value)
EFI_STATUS MemInfoCallback(IN MEMORY_MAP_ENTRY *MemoryMapEntry, IN VOID *Params)
UINT32 VerticalResolution
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat
UINT32 HorizontalResolution
EFI_PIXEL_BITMASK PixelInformation