Sure. Thanks for reminder. Will have a check whether it could be replaced when 
doing cleanup.

Thanks,
Guo
-----Original Message-----
From: Ma, Maurice 
Sent: Tuesday, May 19, 2015 1:16 PM
To: Dong, Guo; Justen, Jordan L
Cc: edk2-devel@lists.sourceforge.net
Subject: RE: [edk2] [Patch 2/2] Replace tab with space and remove the space at 
the end of lines.

Hi, Guo,

The CalculateSum16() function in BaseLib might not have the identical 
functionality as the CbCheckSum16().
Please check it.

Regards,
Maurice

-----Original Message-----
From: Dong, Guo 
Sent: Monday, May 18, 2015 10:07 PM
To: Justen, Jordan L; edk2-devel@lists.sourceforge.net; Ma, Maurice
Cc: edk2-devel@lists.sourceforge.net
Subject: RE: [edk2] [Patch 2/2] Replace tab with space and remove the space at 
the end of lines.


OK. I will create another patch to clean up the code for EDKII coding style 
after this fix check in.
And will replace CbCheckSum16() using the CalculateSum16() in BaseLib, etc.

Thanks,
Guo
-----Original Message-----
From: Justen, Jordan L
Sent: Tuesday, May 19, 2015 12:47 PM
To: edk2-devel@lists.sourceforge.net; Dong, Guo; Ma, Maurice
Cc: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] [Patch 2/2] Replace tab with space and remove the space at 
the end of lines.

By the way, thank you for fixing this! Parts of the code were difficult to read 
with tabs.

One more patch idea is below.

On 2015-05-18 08:29:34, Guo Dong wrote:
> Signed-off-by: Guo Dong <guo.d...@intel.com>
> ---
>  CorebootModulePkg/Library/CbParseLib/CbParseLib.c | 498
> +++++++++++-----------
>  1 file changed, 249 insertions(+), 249 deletions(-)
> 
> diff --git a/CorebootModulePkg/Library/CbParseLib/CbParseLib.c
> b/CorebootModulePkg/Library/CbParseLib/CbParseLib.c
> index 0f82b01..bb182f7 100644
> --- a/CorebootModulePkg/Library/CbParseLib/CbParseLib.c
> +++ b/CorebootModulePkg/Library/CbParseLib/CbParseLib.c
> @@ -35,112 +35,112 @@ UINT16
>  CbCheckSum16 (
>    IN UINT16   *Buffer,
>    IN UINTN    Length
>    )
>  {
> -       UINT32 Sum, TmpValue;
> -       UINTN  Idx;
> -       UINT8  *TmpPtr;
> -       
> -       Sum = 0;
> -       TmpPtr = (UINT8 *)Buffer;
> -       for(Idx = 0; Idx < Length; Idx++) {
> -               TmpValue  = TmpPtr[Idx];
> -               if (Idx % 2 == 1) {
> -                       TmpValue <<= 8;
> -               }
> -               
> -               Sum += TmpValue;
> -               
> -               // Wrap
> -               if (Sum >= 0x10000) {
> -                       Sum = (Sum + (Sum >> 16)) & 0xFFFF;
> -               }
> -       }
> -       
> -       return (UINT16)((~Sum) & 0xFFFF);               
> +  UINT32 Sum, TmpValue;
> +  UINTN  Idx;
> +  UINT8  *TmpPtr;
> +
> +  Sum = 0;
> +  TmpPtr = (UINT8 *)Buffer;
> +  for(Idx = 0; Idx < Length; Idx++) {
> +    TmpValue  = TmpPtr[Idx];
> +    if (Idx % 2 == 1) {
> +      TmpValue <<= 8;
> +    }
> +
> +    Sum += TmpValue;
> +
> +    // Wrap
> +    if (Sum >= 0x10000) {
> +      Sum = (Sum + (Sum >> 16)) & 0xFFFF;
> +    }
> +  }
> +
> +  return (UINT16)((~Sum) & 0xFFFF);
>  }
>  
>  VOID *
>  FindCbTag (
>    IN  VOID    *Start,
>    IN  UINT32   Tag
>    )
>  {
>    struct cb_header   *Header;
>    struct cb_record   *Record;
> -  UINT8              *TmpPtr;  
> -  UINT8              *TagPtr;  
> -  UINTN              Idx;  
> +  UINT8              *TmpPtr;
> +  UINT8              *TagPtr;
> +  UINTN              Idx;
>    UINT16             CheckSum;
> -      
> +
>    Header = NULL;
>    TmpPtr = (UINT8 *)Start;
>    for (Idx = 0; Idx < 4096; Idx += 16, TmpPtr += 16) {
>      Header = (struct cb_header   *)TmpPtr;
>      if (Header->signature == CB_HEADER_SIGNATURE) {
>        break;
>      }
>    }
> -
> +
>    if (Idx >= 4096)
> -       return NULL;
> -
> +    return NULL;
> +

I think it is good to keep this patch just about whitespace.

Maybe another patch could fix the package this to follow the code style more? 
For example:

if (Idx >= 4096)
  return NULL;

=>

if (Idx >= 4096) {
  return NULL;
}

Thanks,

-Jordan

>    if (Header == NULL || !Header->table_bytes)
>      return NULL;
> -    
> +
>    //
>    // Check the checksum of the coreboot table header
>    //
>    CheckSum = CbCheckSum16 ((UINT16 *)Header, sizeof (*Header));
>    if (CheckSum != 0) {
> -       DEBUG ((EFI_D_ERROR, "Invalid coreboot table header checksum\n"));
> -       return NULL;
> -  }
> -
> +    DEBUG ((EFI_D_ERROR, "Invalid coreboot table header checksum\n"));
> +    return NULL;
> +  }
> +
>    CheckSum = CbCheckSum16 ((UINT16 *)(TmpPtr + sizeof (*Header)), 
> Header->table_bytes);
>    if (CheckSum != Header->table_checksum) {
> -       DEBUG ((EFI_D_ERROR, "Incorrect checksum of all the coreboot table 
> entries\n"));
> -       return NULL;
> +    DEBUG ((EFI_D_ERROR, "Incorrect checksum of all the coreboot table 
> entries\n"));
> +    return NULL;
>    }
> -     
> +
>    TagPtr = NULL;
>    TmpPtr += Header->header_bytes;
>    for (Idx = 0; Idx < Header->table_entries; Idx++) {
> -    Record = (struct cb_record *)TmpPtr;        
> +    Record = (struct cb_record *)TmpPtr;
>      if (Record->tag == CB_TAG_FORWARD) {
>        TmpPtr = (VOID *)(UINTN)((struct cb_forward *)(UINTN)Record)->forward;
>        if (Tag == CB_TAG_FORWARD)
>          return TmpPtr;
> -      else 
> +      else
>          return FindCbTag (TmpPtr, Tag);
> -    }       
> +    }
>      if (Record->tag == Tag) {
>        TagPtr = TmpPtr;
>        break;
>      }
> -    TmpPtr += Record->size;    
> +    TmpPtr += Record->size;
>    }
> -    
> +
>    return TagPtr;
>  }
>  
>  RETURN_STATUS
> -FindCbMemTable (
> +FindCbMemTable (
>    IN struct cbmem_root  *Root,
> -  IN UINT32     TableId, 
> +  IN UINT32     TableId,
>    IN VOID**     pMemTable,
>    IN UINT32*    pMemTableSize
> -)
> -{      
> +  )
> +{
>    UINTN                Idx;
>    BOOLEAN              IsImdEntry;
>    struct cbmem_entry  *Entries;
> -       
> +
>    if ((!Root) || (!pMemTable))
> -               return RETURN_INVALID_PARAMETER;
> -               
> +    return RETURN_INVALID_PARAMETER;
> +
>    //
>    // Check if the entry is CBMEM or IMD
>    // and handle them separately
>    //
>    Entries    = Root->entries;
> @@ -162,17 +162,17 @@ FindCbMemTable (
>        } else {
>          *pMemTable = (VOID *) (UINTN)Entries[Idx].start;
>        }
>        if (pMemTableSize)
>          *pMemTableSize = Entries[Idx].size;
> -       
> -       DEBUG ((EFI_D_ERROR, "Find CbMemTable Id 0x%x, base %p, size 0x%x\n", 
> TableId, *pMemTable, *pMemTableSize));
> -       return RETURN_SUCCESS;
> +
> +      DEBUG ((EFI_D_ERROR, "Find CbMemTable Id 0x%x, base %p, size 0x%x\n", 
> TableId, *pMemTable, *pMemTableSize));
> +      return RETURN_SUCCESS;
>      }
>    }
> -  
> -  return RETURN_NOT_FOUND;     
> +
> +  return RETURN_NOT_FOUND;
>  }
>  
>  
>  /**
>    Acquire the memory information from the coreboot table in memory.
> @@ -189,53 +189,53 @@ RETURN_STATUS
>  CbParseMemoryInfo (
>    IN UINT64*    pLowMemorySize,
>    IN UINT64*    pHighMemorySize
>    )
>  {
> -       struct cb_memory*        rec;
> -       struct cb_memory_range*  Range;
> +  struct cb_memory*        rec;
> +  struct cb_memory_range*  Range;
>    UINT64                   Start;
>    UINT64                   Size;
> -       UINTN                    Index;
> -       
> -       if ((!pLowMemorySize) || (!pHighMemorySize))
> -               return RETURN_INVALID_PARAMETER;
> -       
> -       //
> -       // Get the coreboot memory table
> -       //
> -       rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY);
> -       if (!rec) 
> -         rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 
> (PcdCbHeaderPointer), CB_TAG_MEMORY);
> -               
> -       if (!rec) 
> -               return RETURN_NOT_FOUND;
> -               
> -       *pLowMemorySize = 0;
> -       *pHighMemorySize = 0;
> -               
> -       for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {
> -    Range = MEM_RANGE_PTR(rec, Index);    
> +  UINTN                    Index;
> +
> +  if ((!pLowMemorySize) || (!pHighMemorySize))
> +    return RETURN_INVALID_PARAMETER;
> +
> +  //
> +  // Get the coreboot memory table
> +  //
> +  rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY);  if (!rec)
> +    rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 
> + (PcdCbHeaderPointer), CB_TAG_MEMORY);
> +
> +  if (!rec)
> +    return RETURN_NOT_FOUND;
> +
> +  *pLowMemorySize = 0;
> +  *pHighMemorySize = 0;
> +
> +  for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {
> +    Range = MEM_RANGE_PTR(rec, Index);
>      Start = cb_unpack64(Range->start);
>      Size = cb_unpack64(Range->size);
>      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) {
>        continue;
>      }
> -      
> +
>      if (Start + Size < 0x100000000ULL) {
>        *pLowMemorySize = Start + Size;
> -    } else {      
> +    } else {
>        *pHighMemorySize = Start + Size - 0x100000000ULL;
>      }
>    }
> -
> +
>    DEBUG ((EFI_D_ERROR, "Low memory 0x%lx, High Memory 0x%lx\n", 
> *pLowMemorySize, *pHighMemorySize));
> -  
> -  return RETURN_SUCCESS;       
> +
> +  return RETURN_SUCCESS;
>  }
>  
>  
>  /**
>    Acquire the coreboot memory table with the given table id @@
> -249,48 +249,48 @@ CbParseMemoryInfo (
>    @retval RETURN_NOT_FOUND   Failed to find the memory table.
>  
>  **/
>  RETURN_STATUS
>  CbParseCbMemTable (
> -  IN UINT32     TableId, 
> +  IN UINT32     TableId,
>    IN VOID**     pMemTable,
>    IN UINT32*    pMemTableSize
>    )
>  {
> -       struct cb_memory*        rec;
> -       struct cb_memory_range*  Range;
> +  struct cb_memory*        rec;
> +  struct cb_memory_range*  Range;
>    UINT64                   Start;
>    UINT64                   Size;
> -       UINTN                    Index;
> -       
> -       if (!pMemTable)
> -               return RETURN_INVALID_PARAMETER;
> -               
> -       *pMemTable = NULL;
> -       
> -       //
> -       // Get the coreboot memory table
> -       //
> -       rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY);
> -       if (!rec)
> -               rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 
> (PcdCbHeaderPointer), CB_TAG_MEMORY);
> -               
> -       if (!rec)
> -               return RETURN_NOT_FOUND;
> -               
> -       for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {
> -    Range = MEM_RANGE_PTR(rec, Index);    
> +  UINTN                    Index;
> +
> +  if (!pMemTable)
> +    return RETURN_INVALID_PARAMETER;
> +
> +  *pMemTable = NULL;
> +
> +  //
> +  // Get the coreboot memory table
> +  //
> +  rec = (struct cb_memory *)FindCbTag (0, CB_TAG_MEMORY);  if (!rec)
> +    rec = (struct cb_memory *)FindCbTag ((VOID *)(UINTN)PcdGet32 
> + (PcdCbHeaderPointer), CB_TAG_MEMORY);
> +
> +  if (!rec)
> +    return RETURN_NOT_FOUND;
> +
> +  for (Index = 0; Index < MEM_RANGE_COUNT(rec); Index++) {
> +    Range = MEM_RANGE_PTR(rec, Index);
>      Start = cb_unpack64(Range->start);
>      Size = cb_unpack64(Range->size);
> -    
> +
>      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)
> -               return RETURN_SUCCESS;
> +      if (FindCbMemTable ((struct  cbmem_root *)(UINTN)(Start + Size - 
> DYN_CBMEM_ALIGN_SIZE), TableId, pMemTable, pMemTableSize) == RETURN_SUCCESS)
> +        return RETURN_SUCCESS;
>      }
>    }
> -       
> -       return RETURN_NOT_FOUND;
> +
> +  return RETURN_NOT_FOUND;
>  }
>  
>  
>  /**
>    Acquire the acpi table from coreboot @@ -307,11 +307,11 @@ 
> RETURN_STATUS  CbParseAcpiTable (
>    IN VOID*      pMemTable,
>    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);
>  }
>  
>  /**
>    Acquire the smbios table from coreboot
>  
> @@ -327,11 +327,11 @@ RETURN_STATUS
>  CbParseSmbiosTable (
>    IN VOID**     pMemTable,
>    IN UINT32*    pMemTableSize
>    )
>  {
> -       return CbParseCbMemTable (SIGNATURE_32 ('T', 'B', 'M', 'S'), 
> pMemTable, pMemTableSize); 
> +  return CbParseCbMemTable (SIGNATURE_32 ('T', 'B', 'M', 'S'), 
> + pMemTable, pMemTableSize);
>  }
>  
>  /**
>    Find the required fadt information
>  
> @@ -350,97 +350,97 @@ CbParseFadtInfo (
>    IN UINTN*     pPmTimerReg,
>    IN UINTN*     pResetReg,
>    IN UINTN*     pResetValue
>    )
>  {
> -       EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER* Rsdp;
> -       EFI_ACPI_DESCRIPTION_HEADER*                  Rsdt;
> +  EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER* Rsdp;
> +  EFI_ACPI_DESCRIPTION_HEADER*                  Rsdt;
>    UINT32*                                       Entry32;
>    UINTN                                         Entry32Num;
>    EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE*    Fadt;
> -  EFI_ACPI_DESCRIPTION_HEADER*                  Xsdt; 
> +  EFI_ACPI_DESCRIPTION_HEADER*                  Xsdt;
>    UINT64*                                       Entry64;
>    UINTN                                         Entry64Num;
> -       UINTN                                         Idx;
> -       RETURN_STATUS                                 Status;
> -       
> -       Rsdp = NULL;
> -       Status = RETURN_SUCCESS;
> -       
> -       Status = CbParseAcpiTable (&Rsdp, NULL);
> -       if (RETURN_ERROR(Status))
> -               return Status;
> -               
> -       if (!Rsdp)
> -               return RETURN_NOT_FOUND;
> -               
> -       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));
> -       
> -       //
> -       // Search Rsdt First
> -       //
> -       Rsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress); 
>  
> -       if (Rsdt != NULL) {
> -         Entry32  = (UINT32 *)(Rsdt + 1);
> -         Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) 
> >> 2;
> -         for (Idx = 0; Idx < Entry32Num; Idx++) {
> -           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]);  
> -             if (pPmCtrlReg)
> -               *pPmCtrlReg = Fadt->Pm1aCntBlk;         
> -             DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk));
> -               
> -             if (pPmTimerReg)   
> -               *pPmTimerReg = Fadt->PmTmrBlk; 
> -             DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk));
> -               
> -             if (pResetReg)   
> -               *pResetReg = (UINTN)Fadt->ResetReg.Address; 
> -             DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n", 
> Fadt->ResetReg.Address));
> -               
> -             if (pResetValue)   
> -               *pResetValue = Fadt->ResetValue;
> -             DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue));
> -                                
> -             return RETURN_SUCCESS;        
> -           }
> -         }
> -       }
> -       
> -       //
> -       // Search Xsdt Second
> -       //
> -       Xsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress); 
>  
> -       if (Xsdt != NULL) {
> -         Entry64  = (UINT64 *)(Xsdt + 1);
> -         Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) 
> >> 3;
> -         for (Idx = 0; Idx < Entry64Num; Idx++) {
> -           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]);  
> -             if (pPmCtrlReg)
> -               *pPmCtrlReg = Fadt->Pm1aCntBlk;         
> -             DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk));
> -               
> -             if (pPmTimerReg)   
> -               *pPmTimerReg = Fadt->PmTmrBlk; 
> -             DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk));
> -               
> -             if (pResetReg)   
> -               *pResetReg = (UINTN)Fadt->ResetReg.Address; 
> -             DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n", 
> Fadt->ResetReg.Address));
> -               
> -             if (pResetValue)   
> -               *pResetValue = Fadt->ResetValue;
> -             DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n", Fadt->ResetValue));
> -                                
> -             return RETURN_SUCCESS;        
> -           }
> -         }
> -       }       
> -       
> -       return RETURN_NOT_FOUND;
> +  UINTN                                         Idx;
> +  RETURN_STATUS                                 Status;
> +
> +  Rsdp = NULL;
> +  Status = RETURN_SUCCESS;
> +
> +  Status = CbParseAcpiTable (&Rsdp, NULL);  if (RETURN_ERROR(Status))
> +    return Status;
> +
> +  if (!Rsdp)
> +    return RETURN_NOT_FOUND;
> +
> +  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));
> +
> +  //
> +  // Search Rsdt First
> +  //
> +  Rsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);
> +  if (Rsdt != NULL) {
> +    Entry32  = (UINT32 *)(Rsdt + 1);
> +    Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;
> +    for (Idx = 0; Idx < Entry32Num; Idx++) {
> +      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]);
> +        if (pPmCtrlReg)
> +          *pPmCtrlReg = Fadt->Pm1aCntBlk;
> +        DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk));
> +
> +        if (pPmTimerReg)
> +          *pPmTimerReg = Fadt->PmTmrBlk;
> +        DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk));
> +
> +        if (pResetReg)
> +          *pResetReg = (UINTN)Fadt->ResetReg.Address;
> +        DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n",
> + Fadt->ResetReg.Address));
> +
> +        if (pResetValue)
> +          *pResetValue = Fadt->ResetValue;
> +        DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n",
> + Fadt->ResetValue));
> +
> +        return RETURN_SUCCESS;
> +      }
> +    }
> +  }
> +
> +  //
> +  // Search Xsdt Second
> +  //
> +  Xsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);
> +  if (Xsdt != NULL) {
> +    Entry64  = (UINT64 *)(Xsdt + 1);
> +    Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;
> +    for (Idx = 0; Idx < Entry64Num; Idx++) {
> +      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]);
> +        if (pPmCtrlReg)
> +          *pPmCtrlReg = Fadt->Pm1aCntBlk;
> +        DEBUG ((EFI_D_ERROR, "PmCtrl Reg 0x%x\n", Fadt->Pm1aCntBlk));
> +
> +        if (pPmTimerReg)
> +          *pPmTimerReg = Fadt->PmTmrBlk;
> +        DEBUG ((EFI_D_ERROR, "PmTimer Reg 0x%x\n", Fadt->PmTmrBlk));
> +
> +        if (pResetReg)
> +          *pResetReg = (UINTN)Fadt->ResetReg.Address;
> +        DEBUG ((EFI_D_ERROR, "Reset Reg 0x%lx\n",
> + Fadt->ResetReg.Address));
> +
> +        if (pResetValue)
> +          *pResetValue = Fadt->ResetValue;
> +        DEBUG ((EFI_D_ERROR, "Reset Value 0x%x\n",
> + Fadt->ResetValue));
> +
> +        return RETURN_SUCCESS;
> +      }
> +    }
> +  }
> +
> +  return RETURN_NOT_FOUND;
>  }
>  
>  /**
>    Find the serial port information
>  
> @@ -457,29 +457,29 @@ CbParseSerialInfo (
>    IN UINT32*     pRegBase,
>    IN UINT32*     pRegAccessType,
>    IN UINT32*     pBaudrate
>    )
>  {
> -       struct cb_serial*   CbSerial;
> -       
> -       CbSerial = FindCbTag (0, CB_TAG_SERIAL);
> -       if (!CbSerial)
> -               CbSerial = FindCbTag ((VOID *)(UINTN)PcdGet32 
> (PcdCbHeaderPointer), CB_TAG_SERIAL);
> -       
> -       if (!CbSerial)
> -               return RETURN_NOT_FOUND;
> -               
> -       if (pRegBase)
> -               *pRegBase = CbSerial->baseaddr;
> -               
> -       if (pRegAccessType)
> -               *pRegAccessType = CbSerial->type;
> -               
> -       if (pBaudrate)
> -               *pBaudrate = CbSerial->baud;
> -                       
> -       return RETURN_SUCCESS;
> +  struct cb_serial*   CbSerial;
> +
> +  CbSerial = FindCbTag (0, CB_TAG_SERIAL);  if (!CbSerial)
> +    CbSerial = FindCbTag ((VOID *)(UINTN)PcdGet32 
> + (PcdCbHeaderPointer), CB_TAG_SERIAL);
> +
> +  if (!CbSerial)
> +    return RETURN_NOT_FOUND;
> +
> +  if (pRegBase)
> +    *pRegBase = CbSerial->baseaddr;
> +
> +  if (pRegAccessType)
> +    *pRegAccessType = CbSerial->type;
> +
> +  if (pBaudrate)
> +    *pBaudrate = CbSerial->baud;
> +
> +  return RETURN_SUCCESS;
>  }
>  
>  /**
>    Search for the coreboot table header
>  
> @@ -494,29 +494,29 @@ RETURN_STATUS
>  CbParseGetCbHeader (
>    IN UINTN  Level,
>    IN VOID** HeaderPtr
>    )
>  {
> -       UINTN Index;
> -       VOID* TempPtr;
> -       
> -       if (!HeaderPtr)
> -               return RETURN_NOT_FOUND;
> -       
> -       TempPtr = NULL; 
> -       for (Index = 0; Index < Level; Index++) {
> -               TempPtr = FindCbTag (TempPtr, CB_TAG_FORWARD);
> -               if (!TempPtr)
> -                       break;          
> -       }
> -       
> -       if ((Index >= Level) && (TempPtr != NULL)) {
> -               *HeaderPtr = TempPtr;
> -               return RETURN_SUCCESS;
> -       }
> -       
> -       return RETURN_NOT_FOUND;
> +  UINTN Index;
> +  VOID* TempPtr;
> +
> +  if (!HeaderPtr)
> +    return RETURN_NOT_FOUND;
> +
> +  TempPtr = NULL;
> +  for (Index = 0; Index < Level; Index++) {
> +    TempPtr = FindCbTag (TempPtr, CB_TAG_FORWARD);
> +    if (!TempPtr)
> +      break;
> +  }
> +
> +  if ((Index >= Level) && (TempPtr != NULL)) {
> +    *HeaderPtr = TempPtr;
> +    return RETURN_SUCCESS;
> +  }
> +
> +  return RETURN_NOT_FOUND;
>  }
>  
>  /**
>    Find the video frame buffer information
>  
> @@ -529,39 +529,39 @@ CbParseGetCbHeader (  RETURN_STATUS 
> CbParseFbInfo (
>    IN FRAME_BUFFER_INFO*     pFbInfo
>    )
>  {
> -       struct cb_framebuffer*   CbFbRec;
> -       
> -       if (!pFbInfo)
> -               return RETURN_INVALID_PARAMETER;
> -       
> -       CbFbRec = FindCbTag (0, CB_TAG_FRAMEBUFFER);
> -       if (!CbFbRec)
> -               CbFbRec = FindCbTag ((VOID *)(UINTN)PcdGet32 
> (PcdCbHeaderPointer), CB_TAG_FRAMEBUFFER);
> -       
> -       if (!CbFbRec)
> -               return RETURN_NOT_FOUND;
> -               
> +  struct cb_framebuffer*   CbFbRec;
> +
> +  if (!pFbInfo)
> +    return RETURN_INVALID_PARAMETER;
> +
> +  CbFbRec = FindCbTag (0, CB_TAG_FRAMEBUFFER);  if (!CbFbRec)
> +    CbFbRec = FindCbTag ((VOID *)(UINTN)PcdGet32 
> + (PcdCbHeaderPointer), CB_TAG_FRAMEBUFFER);
> +
> +  if (!CbFbRec)
> +    return RETURN_NOT_FOUND;
> +
>    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, "x_resolution: 0x%x\n", CbFbRec->x_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, "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_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_pos: 0x%x\n", CbFbRec->green_mask_pos));
>    DEBUG ((EFI_D_ERROR, "blue_mask_size: 0x%x\n", CbFbRec->blue_mask_size));
>    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_pos: 0x%x\n", 
> CbFbRec->reserved_mask_pos));
> -       
> -  pFbInfo->LinearFrameBuffer    = CbFbRec->physical_address;  
> +
> +  pFbInfo->LinearFrameBuffer    = CbFbRec->physical_address;
>    pFbInfo->HorizontalResolution = CbFbRec->x_resolution;
>    pFbInfo->VerticalResolution   = CbFbRec->y_resolution;
>    pFbInfo->BitsPerPixel         = CbFbRec->bits_per_pixel;
>    pFbInfo->BytesPerScanLine     = (UINT16)CbFbRec->bytes_per_line;
>    pFbInfo->Red.Mask             = (1 << CbFbRec->red_mask_size) - 1;
> @@ -569,11 +569,11 @@ CbParseFbInfo (
>    pFbInfo->Green.Mask           = (1 << CbFbRec->green_mask_size) - 1;
>    pFbInfo->Green.Position       = CbFbRec->green_mask_pos;
>    pFbInfo->Blue.Mask            = (1 << CbFbRec->blue_mask_size) - 1;
>    pFbInfo->Blue.Position        = CbFbRec->blue_mask_pos;
>    pFbInfo->Reserved.Mask        = (1 << CbFbRec->reserved_mask_size) - 1;
> -  pFbInfo->Reserved.Position    = CbFbRec->reserved_mask_pos;  
> -                       
> -       return RETURN_SUCCESS;
> +  pFbInfo->Reserved.Position    = CbFbRec->reserved_mask_pos;
> +
> +  return RETURN_SUCCESS;
>  }
>  
>  
> --
> 1.9.5.msysgit.0
> 
> 
> 
> ----------------------------------------------------------------------
> -------- One dashboard for servers and applications across 
> Physical-Virtual-Cloud Widest out-of-the-box monitoring support with
> 50+ applications Performance metrics, stats and reports that give you
> Actionable Insights Deep dive visibility with transaction tracing 
> using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to