Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
02d748a
Documentation
arch
alpha
arm
avr32
blackfin
cris
frv
h8300
ia64
m32r
m68k
m68knommu
microblaze
mips
mn10300
parisc
powerpc
boot
dtc-src
dts
.gitignore
44x.h
4xx.c
4xx.h
Makefile
README
addRamDisk.c
addnote.c
bamboo.c
cpm-serial.c
crt0.S
crtsavres.S
cuboot-52xx.c
cuboot-824x.c
cuboot-83xx.c
cuboot-85xx-cpm2.c
cuboot-85xx.c
cuboot-8xx.c
cuboot-acadia.c
cuboot-amigaone.c
cuboot-bamboo.c
cuboot-c2k.c
cuboot-ebony.c
cuboot-hotfoot.c
cuboot-katmai.c
cuboot-kilauea.c
cuboot-mpc7448hpc2.c
cuboot-pq2.c
cuboot-rainier.c
cuboot-sam440ep.c
cuboot-sequoia.c
cuboot-taishan.c
cuboot-warp.c
cuboot-yosemite.c
cuboot.c
cuboot.h
dcr.h
devtree.c
div64.S
dummy.c
ebony.c
elf.h
elf_util.c
ep405.c
ep8248e.c
ep88xc.c
fixed-head.S
flatdevtree_env.h
fsl-soc.c
fsl-soc.h
gamecube-head.S
gamecube.c
gunzip_util.c
gunzip_util.h
hack-coff.c
holly.c
install.sh
io.h
libfdt-wrapper.c
libfdt_env.h
main.c
mktree.c
mpc52xx-psc.c
mpc8xx.c
mpc8xx.h
mpsc.c
mv64x60.c
mv64x60.h
mv64x60_i2c.c
ns16550.c
of.c
of.h
ofconsole.c
oflib.c
ops.h
page.h
planetcore.c
planetcore.h
ppc_asm.h
ppcboot-hotfoot.h
ppcboot.h
pq2.c
pq2.h
prpmc2800.c
ps3-head.S
ps3-hvcall.S
ps3.c
redboot-83xx.c
redboot-8xx.c
redboot.h
reg.h
rs6000.h
serial.c
simple_alloc.c
simpleboot.c
stdio.c
stdio.h
stdlib.c
stdlib.h
string.S
string.h
treeboot-bamboo.c
treeboot-ebony.c
treeboot-walnut.c
types.h
uartlite.c
ugecon.c
ugecon.h
util.S
virtex.c
virtex405-head.S
wii-head.S
wii.c
wrapper
zImage.coff.lds.S
zImage.lds.S
zImage.ps3.lds.S
configs
include
kernel
kvm
lib
math-emu
mm
oprofile
platforms
sysdev
xmon
Kconfig
Kconfig.debug
Makefile
relocs_check.pl
s390
score
sh
sparc
um
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
powerpc
/
boot
/
wii.c
Blame
Blame
Latest commit
History
History
158 lines (129 loc) · 3.15 KB
Breadcrumbs
linux
/
arch
/
powerpc
/
boot
/
wii.c
Top
File metadata and controls
Code
Blame
158 lines (129 loc) · 3.15 KB
Raw
/* * arch/powerpc/boot/wii.c * * Nintendo Wii bootwrapper support * Copyright (C) 2008-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); #define HW_REG(x) ((void *)(x)) #define EXI_CTRL HW_REG(0x0d800070) #define EXI_CTRL_ENABLE (1<<0) #define MEM2_TOP (0x10000000 + 64*1024*1024) #define FIRMWARE_DEFAULT_SIZE (12*1024*1024) struct mipc_infohdr { char magic[3]; u8 version; u32 mem2_boundary; u32 ipc_in; size_t ipc_in_size; u32 ipc_out; size_t ipc_out_size; }; static int mipc_check_address(u32 pa) { /* only MEM2 addresses */ if (pa < 0x10000000 || pa > 0x14000000) return -EINVAL; return 0; } static struct mipc_infohdr *mipc_get_infohdr(void) { struct mipc_infohdr **hdrp, *hdr; /* 'mini' header pointer is the last word of MEM2 memory */ hdrp = (struct mipc_infohdr **)0x13fffffc; if (mipc_check_address((u32)hdrp)) { printf("mini: invalid hdrp %08X\n", (u32)hdrp); hdr = NULL; goto out; } hdr = *hdrp; if (mipc_check_address((u32)hdr)) { printf("mini: invalid hdr %08X\n", (u32)hdr); hdr = NULL; goto out; } if (memcmp(hdr->magic, "IPC", 3)) { printf("mini: invalid magic\n"); hdr = NULL; goto out; } out: return hdr; } static int mipc_get_mem2_boundary(u32 *mem2_boundary) { struct mipc_infohdr *hdr; int error; hdr = mipc_get_infohdr(); if (!hdr) { error = -1; goto out; } if (mipc_check_address(hdr->mem2_boundary)) { printf("mini: invalid mem2_boundary %08X\n", hdr->mem2_boundary); error = -EINVAL; goto out; } *mem2_boundary = hdr->mem2_boundary; error = 0; out: return error; } static void platform_fixups(void) { void *mem; u32 reg[4]; u32 mem2_boundary; int len; int error; mem = finddevice("/memory"); if (!mem) fatal("Can't find memory node\n"); /* two ranges of (address, size) words */ len = getprop(mem, "reg", reg, sizeof(reg)); if (len != sizeof(reg)) { /* nothing to do */ goto out; } /* retrieve MEM2 boundary from 'mini' */ error = mipc_get_mem2_boundary(&mem2_boundary); if (error) { /* if that fails use a sane value */ mem2_boundary = MEM2_TOP - FIRMWARE_DEFAULT_SIZE; } if (mem2_boundary > reg[2] && mem2_boundary < reg[2] + reg[3]) { reg[3] = mem2_boundary - reg[2]; printf("top of MEM2 @ %08X\n", reg[2] + reg[3]); setprop(mem, "reg", reg, sizeof(reg)); } out: return; } void platform_init(unsigned long r3, unsigned long r4, unsigned long r5) { u32 heapsize = 24*1024*1024 - (u32)_end; simple_alloc_init(_end, heapsize, 32, 64); fdt_init(_dtb_start); /* * 'mini' boots the Broadway processor with EXI disabled. * We need it enabled before probing for the USB Gecko. */ out_be32(EXI_CTRL, in_be32(EXI_CTRL) | EXI_CTRL_ENABLE); if (ug_probe()) console_ops.write = ug_console_write; platform_ops.fixups = platform_fixups; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
You can’t perform that action at this time.