[OpenBIOS] [PATCH 1/2] Delegate construction of memory "available" property to each architecture.
Blue Swirl
blauwirbel at gmail.com
Sat Jan 8 16:52:23 CET 2011
On Sat, Jan 8, 2011 at 12:27 PM, Mark Cave-Ayland
<mark.cave-ayland at siriusit.co.uk> wrote:
> This is required because some architectures do not strictly follow the convention
> of using physical addresses sizes in the /memory node and virtual addresses in
> the /virtual-memory node.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
> ---
> openbios-devel/arch/ppc/qemu/ofmem.c | 24 ++++++++++++++++++++++++
> openbios-devel/arch/sparc32/lib.c | 2 --
> openbios-devel/arch/sparc32/ofmem_sparc32.c | 24 ++++++++++++++++++++++++
> openbios-devel/arch/sparc64/ofmem_sparc64.c | 24 ++++++++++++++++++++++++
> openbios-devel/include/libopenbios/ofmem.h | 6 ++++++
> openbios-devel/libopenbios/ofmem_common.c | 27 +++++++--------------------
> 6 files changed, 85 insertions(+), 22 deletions(-)
>
> diff --git a/openbios-devel/arch/ppc/qemu/ofmem.c b/openbios-devel/arch/ppc/qemu/ofmem.c
> index 4c6825e..25bbc39 100644
> --- a/openbios-devel/arch/ppc/qemu/ofmem.c
> +++ b/openbios-devel/arch/ppc/qemu/ofmem.c
> @@ -195,6 +195,30 @@ void ofmem_arch_create_translation_entry(ucell *transentry, translation_t *t)
> transentry[i++] = t->mode;
> }
>
> +/* Return the size of a memory available node given the phandle in cells */
> +int ofmem_arch_get_available_entry_size(phandle_t ph)
> +{
> + if (ph == s_phandle_memory) {
> + return 1 + ofmem_arch_get_physaddr_cellsize();
> + } else {
> + return 1 + 1;
> + }
> +}
> +
> +/* Generate memory available property entry for PPC */
> +void ofmem_arch_create_available_entry(phandle_t ph, ucell *availentry, phys_addr_t start, ucell size)
> +{
> + int i = 0;
> +
> + if (ph == s_phandle_memory) {
> + i += ofmem_arch_encode_physaddr(availentry, start);
> + } else {
> + availentry[i++] = start;
> + }
> +
> + availentry[i++] = size;
Postincrement is useless since the incremented value will not be used.
> +}
> +
> /************************************************************************/
> /* OF private allocations */
> /************************************************************************/
> diff --git a/openbios-devel/arch/sparc32/lib.c b/openbios-devel/arch/sparc32/lib.c
> index 72d3a87..90a070b 100644
> --- a/openbios-devel/arch/sparc32/lib.c
> +++ b/openbios-devel/arch/sparc32/lib.c
> @@ -59,8 +59,6 @@ unsigned int va_shift;
> static unsigned long *context_table;
> static unsigned long *l1;
>
> -static phandle_t s_phandle_memory = 0;
> -static phandle_t s_phandle_mmu = 0;
> static ucell *mem_reg = 0;
> static ucell *mem_avail = 0;
> static ucell *virt_avail = 0;
> diff --git a/openbios-devel/arch/sparc32/ofmem_sparc32.c b/openbios-devel/arch/sparc32/ofmem_sparc32.c
> index 6815349..aee736a 100644
> --- a/openbios-devel/arch/sparc32/ofmem_sparc32.c
> +++ b/openbios-devel/arch/sparc32/ofmem_sparc32.c
> @@ -124,6 +124,30 @@ void ofmem_arch_create_translation_entry(ucell *transentry, translation_t *t)
> transentry[2] = t->mode;
> }
>
> +/* Return the size of a memory available node given the phandle in cells */
> +int ofmem_arch_get_available_entry_size(phandle_t ph)
> +{
> + if (ph == s_phandle_memory) {
> + return 1 + ofmem_arch_get_physaddr_cellsize();
> + } else {
> + return 1 + 1;
> + }
> +}
> +
> +/* Generate memory available property entry for Sparc32 */
> +void ofmem_arch_create_available_entry(phandle_t ph, ucell *availentry, phys_addr_t start, ucell size)
> +{
> + int i = 0;
> +
> + if (ph == s_phandle_memory) {
> + i += ofmem_arch_encode_physaddr(availentry, start);
> + } else {
> + availentry[i++] = start;
> + }
> +
> + availentry[i++] = size;
Also here.
More information about the OpenBIOS
mailing list