/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* arch/powerpc/boot/gamecube-head.S3*4* Nintendo GameCube bootwrapper entry.5* Copyright (C) 2004-2009 The GameCube Linux Team6* Copyright (C) 2008,2009 Albert Herranz7*/89#include "ppc_asm.h"1011/*12* The entry code does no assumptions regarding:13* - if the data and instruction caches are enabled or not14* - if the MMU is enabled or not15*16* We enable the caches if not already enabled, enable the MMU with an17* identity mapping scheme and jump to the start code.18*/1920.text2122.globl _zimage_start23_zimage_start:2425/* turn the MMU off */26mfmsr 927rlwinm 9, 9, 0, ~((1<<4)|(1<<5)) /* MSR_DR|MSR_IR */28bcl 20, 31, 1f291:30mflr 831clrlwi 8, 8, 3 /* convert to a real address */32addi 8, 8, _mmu_off - 1b33mtsrr0 834mtsrr1 935rfi36_mmu_off:37/* MMU disabled */3839/* setup BATs */40isync41li 8, 042mtspr 0x210, 8 /* IBAT0U */43mtspr 0x212, 8 /* IBAT1U */44mtspr 0x214, 8 /* IBAT2U */45mtspr 0x216, 8 /* IBAT3U */46mtspr 0x218, 8 /* DBAT0U */47mtspr 0x21a, 8 /* DBAT1U */48mtspr 0x21c, 8 /* DBAT2U */49mtspr 0x21e, 8 /* DBAT3U */5051li 8, 0x01ff /* first 16MiB */52li 9, 0x0002 /* rw */53mtspr 0x211, 9 /* IBAT0L */54mtspr 0x210, 8 /* IBAT0U */55mtspr 0x219, 9 /* DBAT0L */56mtspr 0x218, 8 /* DBAT0U */5758lis 8, 0x0c00 /* I/O mem */59ori 8, 8, 0x3ff /* 32MiB */60lis 9, 0x0c0061ori 9, 9, 0x002a /* uncached, guarded, rw */62mtspr 0x21b, 9 /* DBAT1L */63mtspr 0x21a, 8 /* DBAT1U */6465lis 8, 0x0100 /* next 8MiB */66ori 8, 8, 0x00ff /* 8MiB */67lis 9, 0x010068ori 9, 9, 0x0002 /* rw */69mtspr 0x215, 9 /* IBAT2L */70mtspr 0x214, 8 /* IBAT2U */71mtspr 0x21d, 9 /* DBAT2L */72mtspr 0x21c, 8 /* DBAT2U */7374/* enable and invalidate the caches if not already enabled */75mfspr 8, 0x3f0 /* HID0 */76andi. 0, 8, (1<<15) /* HID0_ICE */77bne 1f78ori 8, 8, (1<<15)|(1<<11) /* HID0_ICE|HID0_ICFI*/791:80andi. 0, 8, (1<<14) /* HID0_DCE */81bne 1f82ori 8, 8, (1<<14)|(1<<10) /* HID0_DCE|HID0_DCFI*/831:84mtspr 0x3f0, 8 /* HID0 */85isync8687/* initialize arguments */88li 3, 089li 4, 090li 5, 09192/* turn the MMU on */93bcl 20, 31, 1f941:95mflr 896addi 8, 8, _mmu_on - 1b97mfmsr 998ori 9, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */99mtsrr0 8100mtsrr1 9101sync102rfi103_mmu_on:104b _zimage_start_lib105106107108