Patchwork fix SB800 CIMX "multi-character constant warning"

login
register
about
Submitter She, Kerry
Date 2011-01-10 10:04:08
Message ID <F53A09371FB723428826B442A4B20A41049B7FDC@sbjgexmb1.amd.com>
Download mbox | patch
Permalink /patch/2502/
State Accepted
Commit r6248
Headers show

Comments

She, Kerry - 2011-01-10 10:04:08
Hello,

 

compile the original AMD SB800 CIMX code, GCC would complain “multi-character constant warning”.

This patch using 'Int32FromChar' macro replace the multi-character constant to fix it.

 

Signed-off-by Kerry She <kerry.she@amd.com>
change to a readable way to fix SB800 CIMX "multi-character constant warning".
by using 'Int32FromChar' macro, instead of the ASCII code.

Signed-off-by Kerry She <kerry.she@amd.com>
Marc Jones - 2011-01-10 19:27:56
On Mon, Jan 10, 2011 at 3:04 AM, She, Kerry <Kerry.She@amd.com> wrote:
> Hello,
>
>
>
> compile the original AMD SB800 CIMX code, GCC would complain
> “multi-character constant warning”.
>
> This patch using 'Int32FromChar' macro replace the multi-character constant
> to fix it.
>
>
>
> Signed-off-by Kerry She <kerry.she@amd.com>

Acked-by: Marc Jones <marcj303@gmail.com>

Patch

Index: src/southbridge/amd/cimx_wrapper/sb800/Amd.h
===================================================================
--- src/southbridge/amd/cimx_wrapper/sb800/Amd.h	(revision 6247)
+++ src/southbridge/amd/cimx_wrapper/sb800/Amd.h	(working copy)
@@ -49,8 +49,16 @@ 
 #define IOCFC 0xCFC
 #define IN
 #define OUT
-#define IMAGE_SIGNATURE 'DMA$'
 
+#ifndef Int16FromChar
+#define Int16FromChar(a,b) ((a) << 0 | (b) << 8)
+#endif
+#ifndef Int32FromChar
+#define Int32FromChar(a,b,c,d) ((a) << 0 | (b) << 8 | (c) << 16 | (d) << 24)
+#endif
+
+#define IMAGE_SIGNATURE     Int32FromChar ('$', 'A', 'M', 'D')
+
 typedef UINTN AGESA_STATUS;
 
 #define AGESA_SUCCESS       ((AGESA_STATUS) 0x0)
Index: src/vendorcode/amd/cimx/sb800/SBCMN.c
===================================================================
--- src/vendorcode/amd/cimx/sb800/SBCMN.c	(revision 6247)
+++ src/vendorcode/amd/cimx/sb800/SBCMN.c	(working copy)
@@ -769,12 +769,10 @@ 
 
   } else {
     if ( ! (pConfig->S3Resume) ) {
-      //pHpetTable = (DESCRIPTION_HEADER*) ACPI_LocateTable ('TEPH'); //gcc multi-character character constant warning

-      pHpetTable = (DESCRIPTION_HEADER*) ACPI_LocateTable (0x54455048);//'TEPH'

+      pHpetTable = (DESCRIPTION_HEADER*) ACPI_LocateTable (Int32FromChar('H', 'P', 'E', 'T'));

     }
     if ( pHpetTable != NULL ) {
-      //pHpetTable->Signature = 'HPET';

-      pHpetTable->Signature = 0x48504554; //'HPET'

+      pHpetTable->Signature = Int32FromChar('T', 'E', 'P', 'H');

     }
   }
 }
Index: src/vendorcode/amd/cimx/sb800/ACPILIB.c
===================================================================
--- src/vendorcode/amd/cimx/sb800/ACPILIB.c	(revision 6247)
+++ src/vendorcode/amd/cimx/sb800/ACPILIB.c	(working copy)
@@ -52,9 +52,7 @@ 
   RsdPtr = (UINT32*) (UINTN)0xe0000;
   Rsdt = NULL;
   do {
-    //if ( *RsdPtr == ' DSR' && *(RsdPtr + 1) == ' RTP' ) { //gcc multi-character character constant warning

-    if ( *RsdPtr == 0x20445352 && *(RsdPtr + 1) == 0x20525450) {

-

+    if ( *RsdPtr == Int32FromChar('R', 'S', 'D', ' ') && *(RsdPtr + 1) == Int32FromChar('P', 'T', 'R', ' ')) {

       Rsdt = (UINT32*) (UINTN) ((RSDP*)RsdPtr)->RsdtAddress;
       break;
     }
Index: src/vendorcode/amd/cimx/sb800/DISPATCHER.c
===================================================================
--- src/vendorcode/amd/cimx/sb800/DISPATCHER.c	(revision 6247)
+++ src/vendorcode/amd/cimx/sb800/DISPATCHER.c	(working copy)
@@ -204,8 +204,7 @@ 
   UINT16 Sum;
   UINT32  i;
   Sum = 0;
-  //if ( (*((UINT32*)ImagePtr) == 'DMA$' && ((CIMFILEHEADER*)ImagePtr)->CreatorID == Signature) ) { //gcc multi-character character constant warning

-  if ( (*((UINT32*)ImagePtr) == 0x444d4124 && ((CIMFILEHEADER*)ImagePtr)->CreatorID == Signature) ) {//'DMA$'

+  if ( (*((UINT32*)ImagePtr) == Int32FromChar('$', 'A', 'M', 'D') && ((CIMFILEHEADER*)ImagePtr)->CreatorID == Signature) ) {

     //GetImage Image size
     TempImagePtr = (UINT16*)ImagePtr;
     for ( i = 0; i < (((CIMFILEHEADER*)ImagePtr)->ImageSize); i += 2 ) {