forked from pool/grub2
237 lines
9.0 KiB
Diff
237 lines
9.0 KiB
Diff
|
From c3718600e10e985fe770d13e0110f086256b984f Mon Sep 17 00:00:00 2001
|
||
|
From: Anton Blanchard <anton@samba.org>
|
||
|
Date: Wed, 29 Jan 2014 10:29:32 +1100
|
||
|
Subject: [PATCH 07/23] Add IEEE1275_ADDR helper
|
||
|
|
||
|
If the target pointer size doesn't match the IEEE1275 cell size, we
|
||
|
need to cast twice to avoid a warning.
|
||
|
|
||
|
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
|
||
|
From: Anton Blanchard <anton@samba.org>
|
||
|
---
|
||
|
grub-core/disk/ieee1275/ofdisk.c | 4 ++--
|
||
|
grub-core/kern/ieee1275/ieee1275.c | 30 +++++++++++++++---------------
|
||
|
grub-core/kern/ieee1275/openfw.c | 6 +++---
|
||
|
grub-core/lib/ieee1275/datetime.c | 4 ++--
|
||
|
grub-core/net/drivers/ieee1275/ofnet.c | 2 +-
|
||
|
include/grub/ieee1275/ieee1275.h | 4 +++-
|
||
|
6 files changed, 26 insertions(+), 24 deletions(-)
|
||
|
|
||
|
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
|
||
|
index 6870b39..1b72f06 100644
|
||
|
--- a/grub-core/disk/ieee1275/ofdisk.c
|
||
|
+++ b/grub-core/disk/ieee1275/ofdisk.c
|
||
|
@@ -224,7 +224,7 @@ dev_iterate (const struct grub_ieee1275_devalias *alias)
|
||
|
return;
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3);
|
||
|
- args.method = (grub_ieee1275_cell_t) "vscsi-report-luns";
|
||
|
+ args.method = IEEE1275_ADDR("vscsi-report-luns");
|
||
|
args.ihandle = ihandle;
|
||
|
args.table = 0;
|
||
|
args.nentries = 0;
|
||
|
@@ -613,7 +613,7 @@ grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size)
|
||
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args_ieee1275.common, "call-method", 2, 2);
|
||
|
- args_ieee1275.method = (grub_ieee1275_cell_t) "block-size";
|
||
|
+ args_ieee1275.method = IEEE1275_ADDR("block-size");
|
||
|
args_ieee1275.ihandle = last_ihandle;
|
||
|
args_ieee1275.result = 1;
|
||
|
|
||
|
diff --git a/grub-core/kern/ieee1275/ieee1275.c b/grub-core/kern/ieee1275/ieee1275.c
|
||
|
index 9821702..f933c89 100644
|
||
|
--- a/grub-core/kern/ieee1275/ieee1275.c
|
||
|
+++ b/grub-core/kern/ieee1275/ieee1275.c
|
||
|
@@ -38,7 +38,7 @@ grub_ieee1275_finddevice (const char *name, grub_ieee1275_phandle_t *phandlep)
|
||
|
args;
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "finddevice", 1, 1);
|
||
|
- args.device = (grub_ieee1275_cell_t) name;
|
||
|
+ args.device = IEEE1275_ADDR(name);
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
return -1;
|
||
|
@@ -66,8 +66,8 @@ grub_ieee1275_get_property (grub_ieee1275_phandle_t phandle,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "getprop", 4, 1);
|
||
|
args.phandle = phandle;
|
||
|
- args.prop = (grub_ieee1275_cell_t) property;
|
||
|
- args.buf = (grub_ieee1275_cell_t) buf;
|
||
|
+ args.prop = IEEE1275_ADDR(property);
|
||
|
+ args.buf = IEEE1275_ADDR(buf);
|
||
|
args.buflen = (grub_ieee1275_cell_t) size;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -115,8 +115,8 @@ grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "nextprop", 3, 1);
|
||
|
args.phandle = phandle;
|
||
|
- args.prev_prop = (grub_ieee1275_cell_t) prev_prop;
|
||
|
- args.next_prop = (grub_ieee1275_cell_t) prop;
|
||
|
+ args.prev_prop = IEEE1275_ADDR(prev_prop);
|
||
|
+ args.next_prop = IEEE1275_ADDR(prop);
|
||
|
args.flags = (grub_ieee1275_cell_t) -1;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -139,7 +139,7 @@ grub_ieee1275_get_property_length (grub_ieee1275_phandle_t phandle,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "getproplen", 2, 1);
|
||
|
args.phandle = phandle;
|
||
|
- args.prop = (grub_ieee1275_cell_t) prop;
|
||
|
+ args.prop = IEEE1275_ADDR(prop);
|
||
|
args.length = (grub_ieee1275_cell_t) -1;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -190,7 +190,7 @@ grub_ieee1275_package_to_path (grub_ieee1275_phandle_t phandle,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "package-to-path", 3, 1);
|
||
|
args.phandle = phandle;
|
||
|
- args.buf = (grub_ieee1275_cell_t) path;
|
||
|
+ args.buf = IEEE1275_ADDR(path);
|
||
|
args.buflen = (grub_ieee1275_cell_t) len;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -219,7 +219,7 @@ grub_ieee1275_instance_to_path (grub_ieee1275_ihandle_t ihandle,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "instance-to-path", 3, 1);
|
||
|
args.ihandle = ihandle;
|
||
|
- args.buf = (grub_ieee1275_cell_t) path;
|
||
|
+ args.buf = IEEE1275_ADDR(path);
|
||
|
args.buflen = (grub_ieee1275_cell_t) len;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -247,7 +247,7 @@ grub_ieee1275_write (grub_ieee1275_ihandle_t ihandle, const void *buffer,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "write", 3, 1);
|
||
|
args.ihandle = ihandle;
|
||
|
- args.buf = (grub_ieee1275_cell_t) buffer;
|
||
|
+ args.buf = IEEE1275_ADDR(buffer);
|
||
|
args.len = (grub_ieee1275_cell_t) len;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -273,7 +273,7 @@ grub_ieee1275_read (grub_ieee1275_ihandle_t ihandle, void *buffer,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "read", 3, 1);
|
||
|
args.ihandle = ihandle;
|
||
|
- args.buf = (grub_ieee1275_cell_t) buffer;
|
||
|
+ args.buf = IEEE1275_ADDR(buffer);
|
||
|
args.len = (grub_ieee1275_cell_t) len;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -401,7 +401,7 @@ grub_ieee1275_interpret (const char *command, grub_ieee1275_cell_t *catch)
|
||
|
return -1;
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "interpret", 1, 1);
|
||
|
- args.command = (grub_ieee1275_cell_t) command;
|
||
|
+ args.command = IEEE1275_ADDR(command);
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
return -1;
|
||
|
@@ -453,7 +453,7 @@ grub_ieee1275_open (const char *path, grub_ieee1275_ihandle_t *result)
|
||
|
args;
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "open", 1, 1);
|
||
|
- args.path = (grub_ieee1275_cell_t) path;
|
||
|
+ args.path = IEEE1275_ADDR(path);
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
return -1;
|
||
|
@@ -548,8 +548,8 @@ grub_ieee1275_set_property (grub_ieee1275_phandle_t phandle,
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "setprop", 4, 1);
|
||
|
args.size = (grub_ieee1275_cell_t) size;
|
||
|
- args.buf = (grub_ieee1275_cell_t) buf;
|
||
|
- args.propname = (grub_ieee1275_cell_t) propname;
|
||
|
+ args.buf = IEEE1275_ADDR(buf);
|
||
|
+ args.propname = IEEE1275_ADDR(propname);
|
||
|
args.phandle = (grub_ieee1275_cell_t) phandle;
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
@@ -578,7 +578,7 @@ grub_ieee1275_set_color (grub_ieee1275_ihandle_t ihandle,
|
||
|
args;
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 1);
|
||
|
- args.method = (grub_ieee1275_cell_t) "color!";
|
||
|
+ args.method = IEEE1275_ADDR("color!");
|
||
|
args.ihandle = ihandle;
|
||
|
args.index = index;
|
||
|
args.r = r;
|
||
|
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
|
||
|
index ddb7783..a8bbc71 100644
|
||
|
--- a/grub-core/kern/ieee1275/openfw.c
|
||
|
+++ b/grub-core/kern/ieee1275/openfw.c
|
||
|
@@ -285,7 +285,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
|
||
|
6,
|
||
|
#endif
|
||
|
1);
|
||
|
- args.method = (grub_ieee1275_cell_t) "map";
|
||
|
+ args.method = IEEE1275_ADDR("map");
|
||
|
args.ihandle = grub_ieee1275_mmu;
|
||
|
#ifdef __sparc__
|
||
|
args.phys_high = 0;
|
||
|
@@ -543,8 +543,8 @@ grub_ieee1275_canonicalise_devname (const char *path)
|
||
|
return NULL;
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "canon", 3, 1);
|
||
|
- args.path = (grub_ieee1275_cell_t) path;
|
||
|
- args.buf = (grub_ieee1275_cell_t) buf;
|
||
|
+ args.path = IEEE1275_ADDR(path);
|
||
|
+ args.buf = IEEE1275_ADDR(buf);
|
||
|
args.inlen = (grub_ieee1275_cell_t) (bufsize - 1);
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||
|
diff --git a/grub-core/lib/ieee1275/datetime.c b/grub-core/lib/ieee1275/datetime.c
|
||
|
index 74578f1..fa0d3b6 100644
|
||
|
--- a/grub-core/lib/ieee1275/datetime.c
|
||
|
+++ b/grub-core/lib/ieee1275/datetime.c
|
||
|
@@ -84,7 +84,7 @@ grub_get_datetime (struct grub_datetime *datetime)
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 7);
|
||
|
args.device = (grub_ieee1275_cell_t) ihandle;
|
||
|
- args.method = (grub_ieee1275_cell_t) "get-time";
|
||
|
+ args.method = IEEE1275_ADDR("get-time");
|
||
|
|
||
|
status = IEEE1275_CALL_ENTRY_FN (&args);
|
||
|
|
||
|
@@ -136,7 +136,7 @@ grub_set_datetime (struct grub_datetime *datetime)
|
||
|
|
||
|
INIT_IEEE1275_COMMON (&args.common, "call-method", 8, 1);
|
||
|
args.device = (grub_ieee1275_cell_t) ihandle;
|
||
|
- args.method = (grub_ieee1275_cell_t) "set-time";
|
||
|
+ args.method = IEEE1275_ADDR("set-time");
|
||
|
|
||
|
args.year = datetime->year;
|
||
|
args.month = datetime->month;
|
||
|
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
|
||
|
index eea8e71..ea6456f 100644
|
||
|
--- a/grub-core/net/drivers/ieee1275/ofnet.c
|
||
|
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
|
||
|
@@ -386,7 +386,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
|
||
|
args;
|
||
|
INIT_IEEE1275_COMMON (&args.common, "interpret", 2, 2);
|
||
|
args.len = card->txbufsize;
|
||
|
- args.method = (grub_ieee1275_cell_t) "alloc-mem";
|
||
|
+ args.method = IEEE1275_ADDR("alloc-mem");
|
||
|
|
||
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1
|
||
|
|| args.catch)
|
||
|
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
|
||
|
index 8e42513..2e5270c 100644
|
||
|
--- a/include/grub/ieee1275/ieee1275.h
|
||
|
+++ b/include/grub/ieee1275/ieee1275.h
|
||
|
@@ -49,8 +49,10 @@ struct grub_ieee1275_common_hdr
|
||
|
grub_ieee1275_cell_t nr_outs;
|
||
|
};
|
||
|
|
||
|
+#define IEEE1275_ADDR(x) (grub_uint32_t)(grub_addr_t)(x)
|
||
|
+
|
||
|
#define INIT_IEEE1275_COMMON(p, xname, xins, xouts) \
|
||
|
- (p)->name = (grub_ieee1275_cell_t) xname; \
|
||
|
+ (p)->name = (grub_ieee1275_cell_t) IEEE1275_ADDR(xname); \
|
||
|
(p)->nr_ins = (grub_ieee1275_cell_t) xins; \
|
||
|
(p)->nr_outs = (grub_ieee1275_cell_t) xouts
|
||
|
|
||
|
--
|
||
|
1.8.3.1
|