[RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits

Grant Likely grant.likely at secretlab.ca
Mon Nov 23 10:11:43 EST 2009


On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz at yahoo.es> wrote:
> Add support for the Nintendo GameCube video game console to the powerpc
> bootwrapper.
>
> dtbImage.gamecube is a wrapped image that contains a flat device tree,
> an entry point compatible with SDload, and an optional initrd.
>
> Signed-off-by: Albert Herranz <albert_herranz at yahoo.es>

Acked-by: Grant Likely <grant.likely at secretlab.ca>

> ---
>  arch/powerpc/boot/Makefile   |    4 ++-
>  arch/powerpc/boot/gamecube.c |   78 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 81 insertions(+), 1 deletions(-)
>  create mode 100644 arch/powerpc/boot/gamecube.c
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 44bce21..b2f06b0 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -76,7 +76,8 @@ src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c
>                cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
>                cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
>                virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
> -               cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c
> +               cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \
> +               gamecube.c
>  src-boot := $(src-wlib) $(src-plat) empty.c
>
>  src-boot := $(addprefix $(obj)/, $(src-boot))
> @@ -254,6 +255,7 @@ image-$(CONFIG_KSI8560)                     += cuImage.ksi8560
>  image-$(CONFIG_STORCENTER)             += cuImage.storcenter
>  image-$(CONFIG_MPC7448HPC2)            += cuImage.mpc7448hpc2
>  image-$(CONFIG_PPC_C2K)                        += cuImage.c2k
> +image-$(CONFIG_GAMECUBE)               += dtbImage.gamecube
>
>  # Board port in arch/powerpc/platform/amigaone/Kconfig
>  image-$(CONFIG_AMIGAONE)               += cuImage.amigaone
> diff --git a/arch/powerpc/boot/gamecube.c b/arch/powerpc/boot/gamecube.c
> new file mode 100644
> index 0000000..0d6c517
> --- /dev/null
> +++ b/arch/powerpc/boot/gamecube.c
> @@ -0,0 +1,78 @@
> +/*
> + * arch/powerpc/boot/gamecube.c
> + *
> + * Nintendo GameCube bootwrapper support
> + * Copyright (C) 2004-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + */
> +
> +#include <stddef.h>
> +#include "stdio.h"
> +#include "types.h"
> +#include "io.h"
> +#include "ops.h"
> +
> +#include "ugecon.h"
> +
> +BSS_STACK(8192);
> +
> +/*
> + * We enter with the cache enabled, the MMU enabled and some known legacy
> + * memory mappings active. xBAT3 is unused.
> + *
> + * We leave the MMU enabled, but we switch to an identity mapped memory
> + * scheme as expected by the start code.
> + *
> + */
> +asm ("\n\
> +.text\n\
> +.globl _zimage_start\n\
> +_zimage_start:\n\
> +\n\
> +       isync\n\
> +       /* IBAT3,DBAT3 for first 16Mbytes */\n\
> +       li      8, 0x01ff       /* 16MB */\n\
> +       li      9, 0x0002       /* rw */\n\
> +       mtspr   0x216, 8        /* IBAT3U */\n\
> +       mtspr   0x217, 9        /* IBAT3L */\n\
> +       mtspr   0x21e, 8        /* DBAT3U */\n\
> +       mtspr   0x21f, 9        /* DBAT3L */\n\
> +\n\
> +       sync\n\
> +       isync\n\
> +\n\
> +       li      3, 0\n\
> +       li      4, 0\n\
> +       li      5, 0\n\
> +\n\
> +       bcl-    20,4*cr7+so,1f\n\
> +1:\n\
> +       mflr    8\n\
> +       clrlwi  8, 8, 3\n\
> +       addi    8, 8, 2f - 1b\n\
> +       mtlr    8\n\
> +       blr\n\
> +2:\n\
> +       b _zimage_start_lib\n\
> +");
> +
> +/*
> + *
> + */
> +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
> +{
> +       u32 heapsize = 16*1024*1024 - (u32)_end;
> +
> +       simple_alloc_init(_end, heapsize, 32, 64);
> +       fdt_init(_dtb_start);
> +
> +       if (!ug_grab_io_base() && ug_is_adapter_present())
> +               console_ops.write = ug_console_write;
> +}
> +
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.


More information about the Linuxppc-dev mailing list