CorebootModulePkg/CbParseLib: Remove tab and spaces
Replace tab with space. Remove the sapce at the end of lines. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Dong <guo.dong@intel.com> Reviewed-by: Maurice Ma <maurice.ma@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17485 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		| @@ -37,27 +37,27 @@ CbCheckSum16 ( | |||||||
|   IN UINTN    Length |   IN UINTN    Length | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	UINT32 Sum, TmpValue; |   UINT32 Sum, TmpValue; | ||||||
| 	UINTN  Idx; |   UINTN  Idx; | ||||||
| 	UINT8  *TmpPtr; |   UINT8  *TmpPtr; | ||||||
| 	 |  | ||||||
| 	Sum = 0; |   Sum = 0; | ||||||
| 	TmpPtr = (UINT8 *)Buffer; |   TmpPtr = (UINT8 *)Buffer; | ||||||
| 	for(Idx = 0; Idx < Length; Idx++) { |   for(Idx = 0; Idx < Length; Idx++) { | ||||||
| 		TmpValue  = TmpPtr[Idx]; |     TmpValue  = TmpPtr[Idx]; | ||||||
| 		if (Idx % 2 == 1) { |     if (Idx % 2 == 1) { | ||||||
| 			TmpValue <<= 8; |       TmpValue <<= 8; | ||||||
| 		} |     } | ||||||
| 		 |  | ||||||
| 		Sum += TmpValue; |     Sum += TmpValue; | ||||||
| 		 |  | ||||||
| 		// Wrap |     // Wrap | ||||||
| 		if (Sum >= 0x10000) { |     if (Sum >= 0x10000) { | ||||||
| 			Sum = (Sum + (Sum >> 16)) & 0xFFFF; |       Sum = (Sum + (Sum >> 16)) & 0xFFFF; | ||||||
| 		} |     } | ||||||
| 	} |   } | ||||||
| 	 |  | ||||||
| 	return (UINT16)((~Sum) & 0xFFFF);		 |   return (UINT16)((~Sum) & 0xFFFF); | ||||||
| } | } | ||||||
|  |  | ||||||
| VOID * | VOID * | ||||||
| @@ -68,11 +68,11 @@ FindCbTag ( | |||||||
| { | { | ||||||
|   struct cb_header   *Header; |   struct cb_header   *Header; | ||||||
|   struct cb_record   *Record; |   struct cb_record   *Record; | ||||||
|   UINT8              *TmpPtr;   |   UINT8              *TmpPtr; | ||||||
|   UINT8              *TagPtr;   |   UINT8              *TagPtr; | ||||||
|   UINTN              Idx;   |   UINTN              Idx; | ||||||
|   UINT16             CheckSum; |   UINT16             CheckSum; | ||||||
|        |  | ||||||
|   Header = NULL; |   Header = NULL; | ||||||
|   TmpPtr = (UINT8 *)Start; |   TmpPtr = (UINT8 *)Start; | ||||||
|   for (Idx = 0; Idx < 4096; Idx += 16, TmpPtr += 16) { |   for (Idx = 0; Idx < 4096; Idx += 16, TmpPtr += 16) { | ||||||
| @@ -81,65 +81,64 @@ FindCbTag ( | |||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|    |  | ||||||
|   if (Idx >= 4096) |   if (Idx >= 4096) | ||||||
|   	return NULL; |     return NULL; | ||||||
|    |  | ||||||
|   if (Header == NULL || !Header->table_bytes) |   if (Header == NULL || !Header->table_bytes) | ||||||
|     return NULL; |     return NULL; | ||||||
|      |  | ||||||
|   // |   // | ||||||
|   // Check the checksum of the coreboot table header |   // Check the checksum of the coreboot table header | ||||||
|   // |   // | ||||||
|   CheckSum = CbCheckSum16 ((UINT16 *)Header, sizeof (*Header)); |   CheckSum = CbCheckSum16 ((UINT16 *)Header, sizeof (*Header)); | ||||||
|   if (CheckSum != 0) { |   if (CheckSum != 0) { | ||||||
|   	DEBUG ((EFI_D_ERROR, "Invalid coreboot table header checksum\n")); |     DEBUG ((EFI_D_ERROR, "Invalid coreboot table header checksum\n")); | ||||||
|   	return NULL; |     return NULL; | ||||||
|   }   |   } | ||||||
|    |  | ||||||
|   CheckSum = CbCheckSum16 ((UINT16 *)(TmpPtr + sizeof (*Header)), Header->table_bytes); |   CheckSum = CbCheckSum16 ((UINT16 *)(TmpPtr + sizeof (*Header)), Header->table_bytes); | ||||||
|   if (CheckSum != Header->table_checksum) { |   if (CheckSum != Header->table_checksum) { | ||||||
|   	DEBUG ((EFI_D_ERROR, "Incorrect checksum of all the coreboot table entries\n")); |     DEBUG ((EFI_D_ERROR, "Incorrect checksum of all the coreboot table entries\n")); | ||||||
|   	return NULL; |     return NULL; | ||||||
|   } |   } | ||||||
|       |  | ||||||
|   TagPtr = NULL; |   TagPtr = NULL; | ||||||
|   TmpPtr += Header->header_bytes; |   TmpPtr += Header->header_bytes; | ||||||
|   for (Idx = 0; Idx < Header->table_entries; Idx++) { |   for (Idx = 0; Idx < Header->table_entries; Idx++) { | ||||||
|     Record = (struct cb_record *)TmpPtr;         |     Record = (struct cb_record *)TmpPtr; | ||||||
|     if (Record->tag == CB_TAG_FORWARD) { |     if (Record->tag == CB_TAG_FORWARD) { | ||||||
|       TmpPtr = (VOID *)(UINTN)((struct cb_forward *)(UINTN)Record)->forward; |       TmpPtr = (VOID *)(UINTN)((struct cb_forward *)(UINTN)Record)->forward; | ||||||
|       if (Tag == CB_TAG_FORWARD) |       if (Tag == CB_TAG_FORWARD) | ||||||
|         return TmpPtr; |         return TmpPtr; | ||||||
|       else  |       else | ||||||
|         return FindCbTag (TmpPtr, Tag); |         return FindCbTag (TmpPtr, Tag); | ||||||
|     }        |     } | ||||||
|     if (Record->tag == Tag) { |     if (Record->tag == Tag) { | ||||||
|       TagPtr = TmpPtr; |       TagPtr = TmpPtr; | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|     TmpPtr += Record->size;     |     TmpPtr += Record->size; | ||||||
|   } |   } | ||||||
|      |  | ||||||
|   return TagPtr; |   return TagPtr; | ||||||
| } | } | ||||||
|  |  | ||||||
| RETURN_STATUS | RETURN_STATUS | ||||||
| FindCbMemTable (   | FindCbMemTable ( | ||||||
|   IN  struct cbmem_root  *Root, |   IN  struct cbmem_root  *Root, | ||||||
|   IN  UINT32             TableId, |   IN  UINT32             TableId, | ||||||
|   OUT VOID               **pMemTable, |   OUT VOID               **pMemTable, | ||||||
|   OUT UINT32             *pMemTableSize |   OUT UINT32             *pMemTableSize | ||||||
| ) |   ) | ||||||
| {	 | { | ||||||
|   UINTN                Idx; |   UINTN                Idx; | ||||||
|   BOOLEAN              IsImdEntry; |   BOOLEAN              IsImdEntry; | ||||||
|   struct cbmem_entry  *Entries; |   struct cbmem_entry  *Entries; | ||||||
| 	 |  | ||||||
|   if ((Root == NULL) || (pMemTable == NULL)) { |   if ((Root == NULL) || (pMemTable == NULL)) { | ||||||
|     return RETURN_INVALID_PARAMETER; |     return RETURN_INVALID_PARAMETER; | ||||||
|   } |   } | ||||||
| 		 |  | ||||||
|   // |   // | ||||||
|   // Check if the entry is CBMEM or IMD |   // Check if the entry is CBMEM or IMD | ||||||
|   // and handle them separately |   // and handle them separately | ||||||
| @@ -166,13 +165,13 @@ FindCbMemTable ( | |||||||
|       if (pMemTableSize != NULL) { |       if (pMemTableSize != NULL) { | ||||||
|         *pMemTableSize = Entries[Idx].size; |         *pMemTableSize = Entries[Idx].size; | ||||||
|       } |       } | ||||||
|     	 |  | ||||||
|       DEBUG ((EFI_D_INFO, "Find CbMemTable Id 0x%x, base %p, size 0x%x\n", TableId, *pMemTable, *pMemTableSize)); |       DEBUG ((EFI_D_INFO, "Find CbMemTable Id 0x%x, base %p, size 0x%x\n", TableId, *pMemTable, *pMemTableSize)); | ||||||
|     	return RETURN_SUCCESS; |       return RETURN_SUCCESS; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|    |  | ||||||
|   return RETURN_NOT_FOUND;	 |   return RETURN_NOT_FOUND; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -193,49 +192,49 @@ CbParseMemoryInfo ( | |||||||
|   IN UINT64*    pHighMemorySize |   IN UINT64*    pHighMemorySize | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	struct cb_memory*        rec; |   struct cb_memory*        rec; | ||||||
| 	struct cb_memory_range*  Range; |   struct cb_memory_range*  Range; | ||||||
|   UINT64                   Start; |   UINT64                   Start; | ||||||
|   UINT64                   Size; |   UINT64                   Size; | ||||||
| 	UINTN                    Index; |   UINTN                    Index; | ||||||
| 	 |  | ||||||
| 	if ((!pLowMemorySize) || (!pHighMemorySize)) |   if ((!pLowMemorySize) || (!pHighMemorySize)) | ||||||
| 		return RETURN_INVALID_PARAMETER; |     return RETURN_INVALID_PARAMETER; | ||||||
| 	 |  | ||||||
| 	// |   // | ||||||
| 	// Get the coreboot memory table |   // Get the coreboot memory table | ||||||
| 	// |   // | ||||||
| 	rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY); |   rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY); | ||||||
| 	if (!rec)  |   if (!rec) | ||||||
| 	  rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_MEMORY); |     rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_MEMORY); | ||||||
| 		 |  | ||||||
| 	if (!rec)  |   if (!rec) | ||||||
| 		return RETURN_NOT_FOUND; |     return RETURN_NOT_FOUND; | ||||||
| 		 |  | ||||||
| 	*pLowMemorySize = 0; |   *pLowMemorySize = 0; | ||||||
| 	*pHighMemorySize = 0; |   *pHighMemorySize = 0; | ||||||
| 		 |  | ||||||
| 	for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) { |   for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) { | ||||||
|     Range = MEM_RANGE_PTR(rec, Index);     |     Range = MEM_RANGE_PTR(rec, Index); | ||||||
|     Start = cb_unpack64(Range->start); |     Start = cb_unpack64(Range->start); | ||||||
|     Size = cb_unpack64(Range->size); |     Size = cb_unpack64(Range->size); | ||||||
|     DEBUG ((EFI_D_ERROR, "%d. %016lx - %016lx [%02x]\n", |     DEBUG ((EFI_D_ERROR, "%d. %016lx - %016lx [%02x]\n", | ||||||
|       Index, Start, Start + Size - 1, Range->type)); |             Index, Start, Start + Size - 1, Range->type)); | ||||||
|      |  | ||||||
|     if (Range->type != CB_MEM_RAM) { |     if (Range->type != CB_MEM_RAM) { | ||||||
|       continue; |       continue; | ||||||
|     } |     } | ||||||
|        |  | ||||||
|     if (Start + Size < 0x100000000ULL) { |     if (Start + Size < 0x100000000ULL) { | ||||||
|       *pLowMemorySize = Start + Size; |       *pLowMemorySize = Start + Size; | ||||||
|     } else {       |     } else { | ||||||
|       *pHighMemorySize = Start + Size - 0x100000000ULL; |       *pHighMemorySize = Start + Size - 0x100000000ULL; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|    |  | ||||||
|   DEBUG ((EFI_D_ERROR, "Low memory 0x%lx, High Memory 0x%lx\n", *pLowMemorySize, *pHighMemorySize)); |   DEBUG ((EFI_D_ERROR, "Low memory 0x%lx, High Memory 0x%lx\n", *pLowMemorySize, *pHighMemorySize)); | ||||||
|    |  | ||||||
|   return RETURN_SUCCESS;	 |   return RETURN_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -253,44 +252,44 @@ CbParseMemoryInfo ( | |||||||
| **/ | **/ | ||||||
| RETURN_STATUS | RETURN_STATUS | ||||||
| CbParseCbMemTable ( | CbParseCbMemTable ( | ||||||
|   IN UINT32     TableId,  |   IN UINT32     TableId, | ||||||
|   IN VOID**     pMemTable, |   IN VOID**     pMemTable, | ||||||
|   IN UINT32*    pMemTableSize |   IN UINT32*    pMemTableSize | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	struct cb_memory*        rec; |   struct cb_memory*        rec; | ||||||
| 	struct cb_memory_range*  Range; |   struct cb_memory_range*  Range; | ||||||
|   UINT64                   Start; |   UINT64                   Start; | ||||||
|   UINT64                   Size; |   UINT64                   Size; | ||||||
| 	UINTN                    Index; |   UINTN                    Index; | ||||||
| 	 |  | ||||||
| 	if (!pMemTable) |   if (!pMemTable) | ||||||
| 		return RETURN_INVALID_PARAMETER; |     return RETURN_INVALID_PARAMETER; | ||||||
| 		 |  | ||||||
| 	*pMemTable = NULL; |   *pMemTable = NULL; | ||||||
| 	 |  | ||||||
| 	// |   // | ||||||
| 	// Get the coreboot memory table |   // Get the coreboot memory table | ||||||
| 	// |   // | ||||||
| 	rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY); |   rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY); | ||||||
| 	if (!rec) |   if (!rec) | ||||||
| 		rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_MEMORY); |     rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_MEMORY); | ||||||
| 		 |  | ||||||
| 	if (!rec) |   if (!rec) | ||||||
| 		return RETURN_NOT_FOUND; |     return RETURN_NOT_FOUND; | ||||||
| 		 |  | ||||||
| 	for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) { |   for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) { | ||||||
|     Range = MEM_RANGE_PTR(rec, Index);     |     Range = MEM_RANGE_PTR(rec, Index); | ||||||
|     Start = cb_unpack64(Range->start); |     Start = cb_unpack64(Range->start); | ||||||
|     Size = cb_unpack64(Range->size); |     Size = cb_unpack64(Range->size); | ||||||
|      |  | ||||||
|     if ((Range->type == CB_MEM_TABLE) && (Start > 0x1000)) { |     if ((Range->type == CB_MEM_TABLE) && (Start > 0x1000)) { | ||||||
|         if (FindCbMemTable ((struct  cbmem_root *)(UINTN)(Start + Size - DYN_CBMEM_ALIGN_SIZE), TableId, pMemTable, pMemTableSize) == RETURN_SUCCESS) |       if (FindCbMemTable ((struct  cbmem_root *)(UINTN)(Start + Size - DYN_CBMEM_ALIGN_SIZE), TableId, pMemTable, pMemTableSize) == RETURN_SUCCESS) | ||||||
|         	return RETURN_SUCCESS; |         return RETURN_SUCCESS; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 	 |  | ||||||
| 	return RETURN_NOT_FOUND; |   return RETURN_NOT_FOUND; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -311,7 +310,7 @@ CbParseAcpiTable ( | |||||||
|   IN UINT32*    pMemTableSize |   IN UINT32*    pMemTableSize | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	return CbParseCbMemTable (SIGNATURE_32 ('I', 'P', 'C', 'A'), (VOID **)pMemTable, pMemTableSize);	 |   return CbParseCbMemTable (SIGNATURE_32 ('I', 'P', 'C', 'A'), (VOID **)pMemTable, pMemTableSize); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -331,7 +330,7 @@ CbParseSmbiosTable ( | |||||||
|   IN UINT32*    pMemTableSize |   IN UINT32*    pMemTableSize | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	return CbParseCbMemTable (SIGNATURE_32 ('T', 'B', 'M', 'S'), pMemTable, pMemTableSize);	 |   return CbParseCbMemTable (SIGNATURE_32 ('T', 'B', 'M', 'S'), pMemTable, pMemTableSize); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -354,93 +353,93 @@ CbParseFadtInfo ( | |||||||
|   IN UINTN*     pResetValue |   IN UINTN*     pResetValue | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER* Rsdp; |   EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER* Rsdp; | ||||||
| 	EFI_ACPI_DESCRIPTION_HEADER*                  Rsdt; |   EFI_ACPI_DESCRIPTION_HEADER*                  Rsdt; | ||||||
|   UINT32*                                       Entry32; |   UINT32*                                       Entry32; | ||||||
|   UINTN                                         Entry32Num; |   UINTN                                         Entry32Num; | ||||||
|   EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE*    Fadt; |   EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE*    Fadt; | ||||||
|   EFI_ACPI_DESCRIPTION_HEADER*                  Xsdt;  |   EFI_ACPI_DESCRIPTION_HEADER*                  Xsdt; | ||||||
|   UINT64*                                       Entry64; |   UINT64*                                       Entry64; | ||||||
|   UINTN                                         Entry64Num; |   UINTN                                         Entry64Num; | ||||||
| 	UINTN                                         Idx; |   UINTN                                         Idx; | ||||||
| 	RETURN_STATUS                                 Status; |   RETURN_STATUS                                 Status; | ||||||
| 	 |  | ||||||
| 	Rsdp = NULL; |   Rsdp = NULL; | ||||||
| 	Status = RETURN_SUCCESS; |   Status = RETURN_SUCCESS; | ||||||
| 	 |  | ||||||
| 	Status = CbParseAcpiTable (&Rsdp, NULL); |   Status = CbParseAcpiTable (&Rsdp, NULL); | ||||||
| 	if (RETURN_ERROR(Status)) |   if (RETURN_ERROR(Status)) | ||||||
| 		return Status; |     return Status; | ||||||
| 		 |  | ||||||
| 	if (!Rsdp) |   if (!Rsdp) | ||||||
| 		return RETURN_NOT_FOUND; |     return RETURN_NOT_FOUND; | ||||||
| 		 |  | ||||||
| 	DEBUG ((EFI_D_ERROR, "Find Rsdp at %p\n", Rsdp)); |   DEBUG ((EFI_D_ERROR, "Find Rsdp at %p\n", Rsdp)); | ||||||
| 	DEBUG ((EFI_D_ERROR, "Find Rsdt 0x%x, Xsdt 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress)); |   DEBUG ((EFI_D_ERROR, "Find Rsdt 0x%x, Xsdt 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress)); | ||||||
| 	 |  | ||||||
| 	// |   // | ||||||
| 	// Search Rsdt First |   // Search Rsdt First | ||||||
| 	// |   // | ||||||
| 	Rsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);   |   Rsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress); | ||||||
| 	if (Rsdt != NULL) { |   if (Rsdt != NULL) { | ||||||
| 	  Entry32  = (UINT32 *)(Rsdt + 1); |     Entry32  = (UINT32 *)(Rsdt + 1); | ||||||
| 	  Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2; |     Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2; | ||||||
| 	  for (Idx = 0; Idx < Entry32Num; Idx++) { |     for (Idx = 0; Idx < Entry32Num; Idx++) { | ||||||
| 	    if (*(UINT32 *)(UINTN)(Entry32[Idx]) == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { |       if (*(UINT32 *)(UINTN)(Entry32[Idx]) == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { | ||||||
| 	      Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entry32[Idx]);   |         Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entry32[Idx]); | ||||||
| 	      if (pPmCtrlReg) |         if (pPmCtrlReg) | ||||||
| 	      	*pPmCtrlReg = Fadt->Pm1aCntBlk;	      	 |           *pPmCtrlReg = Fadt->Pm1aCntBlk; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk)); |         DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk)); | ||||||
| 	      	 |  | ||||||
| 	      if (pPmTimerReg)    |         if (pPmTimerReg) | ||||||
| 	      	*pPmTimerReg = Fadt->PmTmrBlk;  |           *pPmTimerReg = Fadt->PmTmrBlk; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk)); |         DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk)); | ||||||
| 	      	 |  | ||||||
| 	      if (pResetReg)    |         if (pResetReg) | ||||||
| 	      	*pResetReg = (UINTN)Fadt->ResetReg.Address;  |           *pResetReg = (UINTN)Fadt->ResetReg.Address; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n", Fadt->ResetReg.Address)); |         DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n", Fadt->ResetReg.Address)); | ||||||
| 	      	 |  | ||||||
| 	      if (pResetValue)    |         if (pResetValue) | ||||||
| 	      	*pResetValue = Fadt->ResetValue; |           *pResetValue = Fadt->ResetValue; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue)); |         DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue)); | ||||||
| 	      	      	          |  | ||||||
| 	      return RETURN_SUCCESS;         |         return RETURN_SUCCESS; | ||||||
| 	    } |       } | ||||||
| 	  } |     } | ||||||
| 	} |   } | ||||||
| 	 |  | ||||||
| 	// |   // | ||||||
| 	// Search Xsdt Second |   // Search Xsdt Second | ||||||
| 	// |   // | ||||||
| 	Xsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);   |   Xsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress); | ||||||
| 	if (Xsdt != NULL) { |   if (Xsdt != NULL) { | ||||||
| 	  Entry64  = (UINT64 *)(Xsdt + 1); |     Entry64  = (UINT64 *)(Xsdt + 1); | ||||||
| 	  Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3; |     Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3; | ||||||
| 	  for (Idx = 0; Idx < Entry64Num; Idx++) { |     for (Idx = 0; Idx < Entry64Num; Idx++) { | ||||||
| 	    if (*(UINT32 *)(UINTN)(Entry64[Idx]) == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { |       if (*(UINT32 *)(UINTN)(Entry64[Idx]) == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { | ||||||
| 	      Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entry64[Idx]);   |         Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)(UINTN)(Entry64[Idx]); | ||||||
| 	      if (pPmCtrlReg) |         if (pPmCtrlReg) | ||||||
| 	      	*pPmCtrlReg = Fadt->Pm1aCntBlk;	      	 |           *pPmCtrlReg = Fadt->Pm1aCntBlk; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk)); |         DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk)); | ||||||
| 	      	 |  | ||||||
| 	      if (pPmTimerReg)    |         if (pPmTimerReg) | ||||||
| 	      	*pPmTimerReg = Fadt->PmTmrBlk;  |           *pPmTimerReg = Fadt->PmTmrBlk; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk)); |         DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk)); | ||||||
| 	      	 |  | ||||||
| 	      if (pResetReg)    |         if (pResetReg) | ||||||
| 	      	*pResetReg = (UINTN)Fadt->ResetReg.Address;  |           *pResetReg = (UINTN)Fadt->ResetReg.Address; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n", Fadt->ResetReg.Address)); |         DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n", Fadt->ResetReg.Address)); | ||||||
| 	      	 |  | ||||||
| 	      if (pResetValue)    |         if (pResetValue) | ||||||
| 	      	*pResetValue = Fadt->ResetValue; |           *pResetValue = Fadt->ResetValue; | ||||||
| 	      DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue)); |         DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue)); | ||||||
| 	      	      	          |  | ||||||
| 	      return RETURN_SUCCESS;         |         return RETURN_SUCCESS; | ||||||
| 	    } |       } | ||||||
| 	  } |     } | ||||||
| 	}	 |   } | ||||||
| 	 |  | ||||||
| 	return RETURN_NOT_FOUND; |   return RETURN_NOT_FOUND; | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -461,25 +460,25 @@ CbParseSerialInfo ( | |||||||
|   IN UINT32*     pBaudrate |   IN UINT32*     pBaudrate | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	struct cb_serial*   CbSerial; |   struct cb_serial*   CbSerial; | ||||||
| 	 |  | ||||||
| 	CbSerial = FindCbTag (0, CB_TAG_SERIAL); |   CbSerial = FindCbTag (0, CB_TAG_SERIAL); | ||||||
| 	if (!CbSerial) |   if (!CbSerial) | ||||||
| 		CbSerial = FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_SERIAL); |     CbSerial = FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_SERIAL); | ||||||
| 	 |  | ||||||
| 	if (!CbSerial) |   if (!CbSerial) | ||||||
| 		return RETURN_NOT_FOUND; |     return RETURN_NOT_FOUND; | ||||||
| 		 |  | ||||||
| 	if (pRegBase) |   if (pRegBase) | ||||||
| 		*pRegBase = CbSerial->baseaddr; |     *pRegBase = CbSerial->baseaddr; | ||||||
| 		 |  | ||||||
| 	if (pRegAccessType) |   if (pRegAccessType) | ||||||
| 		*pRegAccessType = CbSerial->type; |     *pRegAccessType = CbSerial->type; | ||||||
| 		 |  | ||||||
| 	if (pBaudrate) |   if (pBaudrate) | ||||||
| 		*pBaudrate = CbSerial->baud; |     *pBaudrate = CbSerial->baud; | ||||||
| 			 |  | ||||||
| 	return RETURN_SUCCESS; |   return RETURN_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -498,25 +497,25 @@ CbParseGetCbHeader ( | |||||||
|   IN VOID** HeaderPtr |   IN VOID** HeaderPtr | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	UINTN Index; |   UINTN Index; | ||||||
| 	VOID* TempPtr; |   VOID* TempPtr; | ||||||
| 	 |  | ||||||
| 	if (!HeaderPtr) |   if (!HeaderPtr) | ||||||
| 		return RETURN_NOT_FOUND; |     return RETURN_NOT_FOUND; | ||||||
| 	 |  | ||||||
| 	TempPtr = NULL;	 |   TempPtr = NULL; | ||||||
| 	for (Index = 0; Index < Level; Index++) { |   for (Index = 0; Index < Level; Index++) { | ||||||
| 		TempPtr = FindCbTag (TempPtr, CB_TAG_FORWARD); |     TempPtr = FindCbTag (TempPtr, CB_TAG_FORWARD); | ||||||
| 		if (!TempPtr) |     if (!TempPtr) | ||||||
| 			break;		 |       break; | ||||||
| 	} |   } | ||||||
| 	 |  | ||||||
| 	if ((Index >= Level) && (TempPtr != NULL)) { |   if ((Index >= Level) && (TempPtr != NULL)) { | ||||||
| 		*HeaderPtr = TempPtr; |     *HeaderPtr = TempPtr; | ||||||
| 		return RETURN_SUCCESS; |     return RETURN_SUCCESS; | ||||||
| 	} |   } | ||||||
| 	 |  | ||||||
| 	return RETURN_NOT_FOUND; |   return RETURN_NOT_FOUND; | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -533,25 +532,25 @@ CbParseFbInfo ( | |||||||
|   IN FRAME_BUFFER_INFO*     pFbInfo |   IN FRAME_BUFFER_INFO*     pFbInfo | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| 	struct cb_framebuffer*   CbFbRec; |   struct cb_framebuffer*   CbFbRec; | ||||||
| 	 |  | ||||||
| 	if (!pFbInfo) |   if (!pFbInfo) | ||||||
| 		return RETURN_INVALID_PARAMETER; |     return RETURN_INVALID_PARAMETER; | ||||||
| 	 |  | ||||||
| 	CbFbRec = FindCbTag (0, CB_TAG_FRAMEBUFFER); |   CbFbRec = FindCbTag (0, CB_TAG_FRAMEBUFFER); | ||||||
| 	if (!CbFbRec) |   if (!CbFbRec) | ||||||
| 		CbFbRec = FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_FRAMEBUFFER); |     CbFbRec = FindCbTag ((VOID *)(UINTN)PcdGet32 (PcdCbHeaderPointer), CB_TAG_FRAMEBUFFER); | ||||||
| 	 |  | ||||||
| 	if (!CbFbRec) |   if (!CbFbRec) | ||||||
| 		return RETURN_NOT_FOUND; |     return RETURN_NOT_FOUND; | ||||||
| 		 |  | ||||||
|   DEBUG ((EFI_D_ERROR, "Found coreboot video frame buffer information\n")); |   DEBUG ((EFI_D_ERROR, "Found coreboot video frame buffer information\n")); | ||||||
|   DEBUG ((EFI_D_ERROR, "physical_address: 0x%lx\n", CbFbRec->physical_address)); |   DEBUG ((EFI_D_ERROR, "physical_address: 0x%lx\n", CbFbRec->physical_address)); | ||||||
|   DEBUG ((EFI_D_ERROR, "x_resolution: 0x%x\n", CbFbRec->x_resolution)); |   DEBUG ((EFI_D_ERROR, "x_resolution: 0x%x\n", CbFbRec->x_resolution)); | ||||||
|   DEBUG ((EFI_D_ERROR, "y_resolution: 0x%x\n", CbFbRec->y_resolution)); |   DEBUG ((EFI_D_ERROR, "y_resolution: 0x%x\n", CbFbRec->y_resolution)); | ||||||
|   DEBUG ((EFI_D_ERROR, "bits_per_pixel: 0x%x\n", CbFbRec->bits_per_pixel)); |   DEBUG ((EFI_D_ERROR, "bits_per_pixel: 0x%x\n", CbFbRec->bits_per_pixel)); | ||||||
|   DEBUG ((EFI_D_ERROR, "bytes_per_line: 0x%x\n", CbFbRec->bytes_per_line)); |   DEBUG ((EFI_D_ERROR, "bytes_per_line: 0x%x\n", CbFbRec->bytes_per_line)); | ||||||
|    |  | ||||||
|   DEBUG ((EFI_D_ERROR, "red_mask_size: 0x%x\n", CbFbRec->red_mask_size)); |   DEBUG ((EFI_D_ERROR, "red_mask_size: 0x%x\n", CbFbRec->red_mask_size)); | ||||||
|   DEBUG ((EFI_D_ERROR, "red_mask_pos: 0x%x\n", CbFbRec->red_mask_pos)); |   DEBUG ((EFI_D_ERROR, "red_mask_pos: 0x%x\n", CbFbRec->red_mask_pos)); | ||||||
|   DEBUG ((EFI_D_ERROR, "green_mask_size: 0x%x\n", CbFbRec->green_mask_size)); |   DEBUG ((EFI_D_ERROR, "green_mask_size: 0x%x\n", CbFbRec->green_mask_size)); | ||||||
| @@ -560,8 +559,8 @@ CbParseFbInfo ( | |||||||
|   DEBUG ((EFI_D_ERROR, "blue_mask_pos: 0x%x\n", CbFbRec->blue_mask_pos)); |   DEBUG ((EFI_D_ERROR, "blue_mask_pos: 0x%x\n", CbFbRec->blue_mask_pos)); | ||||||
|   DEBUG ((EFI_D_ERROR, "reserved_mask_size: 0x%x\n", CbFbRec->reserved_mask_size)); |   DEBUG ((EFI_D_ERROR, "reserved_mask_size: 0x%x\n", CbFbRec->reserved_mask_size)); | ||||||
|   DEBUG ((EFI_D_ERROR, "reserved_mask_pos: 0x%x\n", CbFbRec->reserved_mask_pos)); |   DEBUG ((EFI_D_ERROR, "reserved_mask_pos: 0x%x\n", CbFbRec->reserved_mask_pos)); | ||||||
| 	 |  | ||||||
|   pFbInfo->LinearFrameBuffer    = CbFbRec->physical_address;   |   pFbInfo->LinearFrameBuffer    = CbFbRec->physical_address; | ||||||
|   pFbInfo->HorizontalResolution = CbFbRec->x_resolution; |   pFbInfo->HorizontalResolution = CbFbRec->x_resolution; | ||||||
|   pFbInfo->VerticalResolution   = CbFbRec->y_resolution; |   pFbInfo->VerticalResolution   = CbFbRec->y_resolution; | ||||||
|   pFbInfo->BitsPerPixel         = CbFbRec->bits_per_pixel; |   pFbInfo->BitsPerPixel         = CbFbRec->bits_per_pixel; | ||||||
| @@ -573,9 +572,8 @@ CbParseFbInfo ( | |||||||
|   pFbInfo->Blue.Mask            = (1 << CbFbRec->blue_mask_size) - 1; |   pFbInfo->Blue.Mask            = (1 << CbFbRec->blue_mask_size) - 1; | ||||||
|   pFbInfo->Blue.Position        = CbFbRec->blue_mask_pos; |   pFbInfo->Blue.Position        = CbFbRec->blue_mask_pos; | ||||||
|   pFbInfo->Reserved.Mask        = (1 << CbFbRec->reserved_mask_size) - 1; |   pFbInfo->Reserved.Mask        = (1 << CbFbRec->reserved_mask_size) - 1; | ||||||
|   pFbInfo->Reserved.Position    = CbFbRec->reserved_mask_pos;   |   pFbInfo->Reserved.Position    = CbFbRec->reserved_mask_pos; | ||||||
|   			 |  | ||||||
| 	return RETURN_SUCCESS; |   return RETURN_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user