2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
Merge grub_ieee1275_map_physical into grub_map and rename to grub_ieee1275_map * include/grub/ieee1275/ieee1275.h (grub_ieee1275_map): New proto. * include/grub/sparc64/ieee1275/ieee1275.h (grub_ieee1275_map_physical): Remove. * kern/ieee1275/openfw.c (grub_map): Rename to ... (grub_ieee1275_map): ... this. All users updated. Add phys_lo when necessary. * kern/sparc64/ieee1275/ieee1275.c (grub_ieee1275_map_physical): Remove.
This commit is contained in:
parent
5b59a4e367
commit
904935c3ef
6 changed files with 40 additions and 47 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Merge grub_ieee1275_map_physical into grub_map and rename to
|
||||||
|
grub_ieee1275_map
|
||||||
|
|
||||||
|
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_map): New proto.
|
||||||
|
* include/grub/sparc64/ieee1275/ieee1275.h (grub_ieee1275_map_physical):
|
||||||
|
Remove.
|
||||||
|
* kern/ieee1275/openfw.c (grub_map): Rename to ...
|
||||||
|
(grub_ieee1275_map): ... this. All users updated. Add phys_lo when
|
||||||
|
necessary.
|
||||||
|
* kern/sparc64/ieee1275/ieee1275.c (grub_ieee1275_map_physical): Remove.
|
||||||
|
|
||||||
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Check device type before
|
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Check device type before
|
||||||
|
|
|
@ -173,6 +173,10 @@ grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||||
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
|
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
|
||||||
|
|
||||||
|
int
|
||||||
|
EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
|
||||||
|
grub_size_t size, grub_uint32_t mode);
|
||||||
|
|
||||||
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
|
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
|
||||||
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
|
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,6 @@ typedef grub_uint64_t grub_ieee1275_cell_t;
|
||||||
#define IEEE1275_MAP_DEFAULT (IEEE1275_MAP_WRITE | IEEE1275_MAP_READ | \
|
#define IEEE1275_MAP_DEFAULT (IEEE1275_MAP_WRITE | IEEE1275_MAP_READ | \
|
||||||
IEEE1275_MAP_EXEC | IEEE1275_MAP_CACHED)
|
IEEE1275_MAP_EXEC | IEEE1275_MAP_CACHED)
|
||||||
|
|
||||||
extern int EXPORT_FUNC(grub_ieee1275_map_physical) (grub_addr_t paddr,
|
|
||||||
grub_addr_t vaddr,
|
|
||||||
grub_size_t size,
|
|
||||||
grub_uint32_t mode);
|
|
||||||
extern int EXPORT_FUNC(grub_ieee1275_claim_vaddr) (grub_addr_t vaddr,
|
extern int EXPORT_FUNC(grub_ieee1275_claim_vaddr) (grub_addr_t vaddr,
|
||||||
grub_size_t size);
|
grub_size_t size);
|
||||||
extern int EXPORT_FUNC(grub_ieee1275_alloc_physmem) (grub_addr_t *paddr,
|
extern int EXPORT_FUNC(grub_ieee1275_alloc_physmem) (grub_addr_t *paddr,
|
||||||
|
|
|
@ -199,9 +199,9 @@ nextprop:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the "map" method of /chosen/mmu. */
|
/* Call the "map" method of /chosen/mmu. */
|
||||||
static int
|
int
|
||||||
grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
|
grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
|
||||||
grub_uint8_t mode)
|
grub_uint32_t mode)
|
||||||
{
|
{
|
||||||
struct map_args {
|
struct map_args {
|
||||||
struct grub_ieee1275_common_hdr common;
|
struct grub_ieee1275_common_hdr common;
|
||||||
|
@ -210,17 +210,30 @@ grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
|
||||||
grub_ieee1275_cell_t mode;
|
grub_ieee1275_cell_t mode;
|
||||||
grub_ieee1275_cell_t size;
|
grub_ieee1275_cell_t size;
|
||||||
grub_ieee1275_cell_t virt;
|
grub_ieee1275_cell_t virt;
|
||||||
grub_ieee1275_cell_t phys;
|
#ifdef GRUB_MACHINE_SPARC64
|
||||||
|
grub_ieee1275_cell_t phys_high;
|
||||||
|
#endif
|
||||||
|
grub_ieee1275_cell_t phys_low;
|
||||||
grub_ieee1275_cell_t catch_result;
|
grub_ieee1275_cell_t catch_result;
|
||||||
} args;
|
} args;
|
||||||
|
|
||||||
INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 1);
|
INIT_IEEE1275_COMMON (&args.common, "call-method",
|
||||||
|
#ifdef GRUB_MACHINE_SPARC64
|
||||||
|
7,
|
||||||
|
#else
|
||||||
|
6,
|
||||||
|
#endif
|
||||||
|
1);
|
||||||
args.method = (grub_ieee1275_cell_t) "map";
|
args.method = (grub_ieee1275_cell_t) "map";
|
||||||
args.ihandle = grub_ieee1275_mmu;
|
args.ihandle = grub_ieee1275_mmu;
|
||||||
args.phys = phys;
|
#ifdef GRUB_MACHINE_SPARC64
|
||||||
|
args.phys_high = 0;
|
||||||
|
#endif
|
||||||
|
args.phys_low = phys;
|
||||||
args.virt = virt;
|
args.virt = virt;
|
||||||
args.size = size;
|
args.size = size;
|
||||||
args.mode = mode; /* Format is WIMG0PP. */
|
args.mode = mode; /* Format is WIMG0PP. */
|
||||||
|
args.catch_result = (grub_ieee1275_cell_t) -1;
|
||||||
|
|
||||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -235,7 +248,7 @@ grub_claimmap (grub_addr_t addr, grub_size_t size)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE)
|
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE)
|
||||||
&& grub_map (addr, addr, size, 0x00))
|
&& grub_ieee1275_map (addr, addr, size, 0x00))
|
||||||
{
|
{
|
||||||
grub_printf ("map failed: address 0x%llx, size 0x%llx\n",
|
grub_printf ("map failed: address 0x%llx, size 0x%llx\n",
|
||||||
(long long) addr, (long long) size);
|
(long long) addr, (long long) size);
|
||||||
|
|
|
@ -21,39 +21,6 @@
|
||||||
|
|
||||||
/* Sun specific ieee1275 interfaces used by GRUB. */
|
/* Sun specific ieee1275 interfaces used by GRUB. */
|
||||||
|
|
||||||
int
|
|
||||||
grub_ieee1275_map_physical (grub_addr_t paddr, grub_addr_t vaddr,
|
|
||||||
grub_size_t size, grub_uint32_t mode)
|
|
||||||
{
|
|
||||||
struct map_physical_args
|
|
||||||
{
|
|
||||||
struct grub_ieee1275_common_hdr common;
|
|
||||||
grub_ieee1275_cell_t method;
|
|
||||||
grub_ieee1275_cell_t ihandle;
|
|
||||||
grub_ieee1275_cell_t mode;
|
|
||||||
grub_ieee1275_cell_t size;
|
|
||||||
grub_ieee1275_cell_t virt;
|
|
||||||
grub_ieee1275_cell_t phys_high;
|
|
||||||
grub_ieee1275_cell_t phys_low;
|
|
||||||
grub_ieee1275_cell_t catch_result;
|
|
||||||
}
|
|
||||||
args;
|
|
||||||
|
|
||||||
INIT_IEEE1275_COMMON (&args.common, "call-method", 7, 1);
|
|
||||||
args.method = (grub_ieee1275_cell_t) "map";
|
|
||||||
args.ihandle = grub_ieee1275_mmu;
|
|
||||||
args.mode = mode;
|
|
||||||
args.size = size;
|
|
||||||
args.virt = vaddr;
|
|
||||||
args.phys_high = 0;
|
|
||||||
args.phys_low = paddr;
|
|
||||||
args.catch_result = (grub_ieee1275_cell_t) -1;
|
|
||||||
|
|
||||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
|
||||||
return -1;
|
|
||||||
return args.catch_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_ieee1275_claim_vaddr (grub_addr_t vaddr, grub_size_t size)
|
grub_ieee1275_claim_vaddr (grub_addr_t vaddr, grub_size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,7 +252,7 @@ grub_linux_load64 (grub_elf_t elf)
|
||||||
if (paddr == (grub_addr_t) -1)
|
if (paddr == (grub_addr_t) -1)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"couldn't allocate physical memory");
|
"couldn't allocate physical memory");
|
||||||
ret = grub_ieee1275_map_physical (paddr, linux_addr - off,
|
ret = grub_ieee1275_map (paddr, linux_addr - off,
|
||||||
linux_size + off, IEEE1275_MAP_DEFAULT);
|
linux_size + off, IEEE1275_MAP_DEFAULT);
|
||||||
if (ret)
|
if (ret)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
|
@ -403,7 +403,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||||
"couldn't allocate physical memory");
|
"couldn't allocate physical memory");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ret = grub_ieee1275_map_physical (paddr, addr, size, IEEE1275_MAP_DEFAULT);
|
ret = grub_ieee1275_map (paddr, addr, size, IEEE1275_MAP_DEFAULT);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
|
|
Loading…
Reference in a new issue