Skip to contentSkip to conversation

: Fix several warnings on sparc64.

PATCH In review David Miller 2 participants 3 messages Mar 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Fix several warnings on sparc64.

Many of these warnings are for two reasons:

1) grub_ssize_t is != 'int' on sparc64, and many pieces of code try to pass an int pointer in for the final arg of several ieee1275 "get property" functions which take a grub_ssize_t pointer.

2) The third arg to grub_ieee1275_get_integer_property is "uint32_t *" but we try passing pointers to grub_ieee1275_ihandle_t objects there, but those are of grub_ieee1275_cell_t type, which is uint64_t on sparc64.

2009-03-04 David S. Miller <[email protected]>

* kern/ieee1275/cmain.c (grub_ieee1275_init): Third arg to grub_ieee1275_get_integer_property is a uint32_t pointer.
* kern/ieee1275/init.c (grub_machine_init): Fix type of 'actual'.
* kern/ieee1275/openfw.c (grub_children_iterate): Likewise. (grub_devalias_iterate): Likewise.
* term/ieee1275/ofconsole.c (grub_ofconsole_init_input):
Fix third arg to grub_ieee1275_get_integer_property. (grub_ofconsole_init_output): Likewise.

---
 kern/ieee1275/cmain.c     |    6 +++++-
 kern/ieee1275/init.c      |    2 +-
 kern/ieee1275/openfw.c    |    4 ++--
 term/ieee1275/ofconsole.c |   10 ++++++++--
 4 files changed, 16 insertions(+), 6 deletions(-)
kern/ieee1275/cmain.c +5 -1
index b5e2ba6..847d9fd 100644
@@ -157,11 +157,15 @@ grub_ieee1275_find_options (void)
 void
 grub_ieee1275_init (void)
 {
+  uint32_t val;
+
   grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &grub_ieee1275_mmu,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &val,
 					  sizeof grub_ieee1275_mmu, 0) < 0)
     grub_ieee1275_mmu = 0;
+  else
+    grub_ieee1275_mmu = val;
 
   grub_ieee1275_find_options ();
 }
kern/ieee1275/init.c +1 -1
index d345ba2..27783cc 100644
@@ -213,7 +213,7 @@ void
 grub_machine_init (void)
 {
   char args[256];
-  int actual;
+  grub_ssize_t actual;
 
   grub_ieee1275_init ();
 
kern/ieee1275/openfw.c +2 -2
index e88f3b3..4229c6e 100644
@@ -53,7 +53,7 @@ grub_children_iterate (char *devpath,
       char childname[64];
       char fullname[64];
       struct grub_ieee1275_devalias alias;
-      int actual;
+      grub_ssize_t actual;
 
       if (grub_ieee1275_get_property (child, "device_type", &childtype,
 				      sizeof childtype, &actual))
@@ -86,7 +86,7 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
 {
   grub_ieee1275_phandle_t aliases;
   char aliasname[32];
-  int actual;
+  grub_ssize_t actual;
   struct grub_ieee1275_devalias alias;
 
   if (grub_ieee1275_finddevice ("/aliases", &aliases))
term/ieee1275/ofconsole.c +8 -2
index 70fda9a..c24a4c2 100644
@@ -341,12 +341,15 @@ static grub_err_t
 grub_ofconsole_init_input (void)
 {
   grub_ssize_t actual;
+  uint32_t val;
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &stdin_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &val,
 					  sizeof stdin_ihandle, &actual)
       || actual != sizeof stdin_ihandle)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
 
+  stdin_ihandle = val;
+
   return 0;
 }
 
@@ -354,6 +357,7 @@ static grub_err_t
 grub_ofconsole_init_output (void)
 {
   grub_ssize_t actual;
+  uint32_t val;
   int col;
 
   /* The latest PowerMacs don't actually initialize the screen for us, so we
@@ -362,11 +366,13 @@ grub_ofconsole_init_output (void)
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT))
     grub_ieee1275_interpret ("output-device output", 0);
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", &stdout_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", &val,
 					  sizeof stdout_ihandle, &actual)
       || actual != sizeof stdout_ihandle)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
 
+  stdout_ihandle = val;
+
   /* Initialize colors.  */
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
     {
Signature · 1 line
1.6.1.2.253.ga34a
#1 lore raw
Quoted 17 lines · David Miller

Many of these warnings are for two reasons:

1) grub_ssize_t is != 'int' on sparc64, and many pieces of code try to pass an int pointer in for the final arg of several ieee1275 "get property" functions which take a grub_ssize_t pointer.

2) The third arg to grub_ieee1275_get_integer_property is "uint32_t *" but we try passing pointers to grub_ieee1275_ihandle_t objects there, but those are of grub_ieee1275_cell_t type, which is uint64_t on sparc64.

kern/ieee1275/cmain.c +0 -0
index b5e2ba6..847d9fd 100644

kern/ieee1275/cmain.c grub_ieee1275_find_options (void) · line 160

Quoted 4 lines
kern/ieee1275/cmain.c +1 -0
@@ -157,11 +157,15 @@ grub_ieee1275_find_options (void)
 void
 grub_ieee1275_init (void)
 {
+  uint32_t val;

Please use grub_uint32_t instead... (I know..)

This same applies to other instances of that same type too...

Quoted 7 lines
term/ieee1275/ofconsole.c +0 -0
index 70fda9a..c24a4c2 100644
@@ -341,12 +341,15 @@ static grub_err_t
 grub_ofconsole_init_input (void)
 {

term/ieee1275/ofconsole.c static grub_err_t · line 351

Quoted 10 lines
term/ieee1275/ofconsole.c +3 -1
   grub_ssize_t actual;
+  uint32_t val;
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &stdin_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &val,
 					  sizeof stdin_ihandle, &actual)
       || actual != sizeof stdin_ihandle)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
 
+  stdin_ihandle = val;

Why stdin_ihandle is not in proper type ? Or was there some other reason for this change?

#2 lore raw

From: Vesa Jääskeläinen <[email protected]>
Date: Wed, 04 Mar 2009 13:56:08 +0200

Quoted 43 lines
Quoted 17 lines · David Miller

Many of these warnings are for two reasons:

1) grub_ssize_t is != 'int' on sparc64, and many pieces of code try to pass an int pointer in for the final arg of several ieee1275 "get property" functions which take a grub_ssize_t pointer.

2) The third arg to grub_ieee1275_get_integer_property is "uint32_t *" but we try passing pointers to grub_ieee1275_ihandle_t objects there, but those are of grub_ieee1275_cell_t type, which is uint64_t on sparc64.

kern/ieee1275/cmain.c +0 -0
index b5e2ba6..847d9fd 100644

kern/ieee1275/cmain.c grub_ieee1275_find_options (void) · line 160

Quoted 4 lines
kern/ieee1275/cmain.c +1 -0
@@ -157,11 +157,15 @@ grub_ieee1275_find_options (void)
 void
 grub_ieee1275_init (void)
 {
+  uint32_t val;

Please use grub_uint32_t instead... (I know..)

This same applies to other instances of that same type too...

Quoted 16 lines
term/ieee1275/ofconsole.c +2 -1
index 70fda9a..c24a4c2 100644
@@ -341,12 +341,15 @@ static grub_err_t
 grub_ofconsole_init_input (void)
 {
   grub_ssize_t actual;
+  uint32_t val;
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &stdin_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &val,
 					  sizeof stdin_ihandle, &actual)
       || actual != sizeof stdin_ihandle)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
 
Quoted 4 lines

term/ieee1275/ofconsole.c static grub_err_t · line 351

Quoted 1 line
term/ieee1275/ofconsole.c +1 -0
+  stdin_ihandle = val;

Why stdin_ihandle is not in proper type ? Or was there some other reason for this change?

A cell is the proper type, but that's 64-bit on sparc.

It's actually really a 32-bit integer property, but when it's passed into the firmware via the ieee1275 interfaces it gets pass in 64-bit extended as a cell, so the type is correct.