wiiu.h revision 1.2
1/* $NetBSD: wiiu.h,v 1.2 2026/01/10 22:45:57 jmcneill Exp $ */
2
3/*-
4 * Copyright (c) 2025 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29/*
30 * Nintendo Wii U platform definitions.
31 */
32
33#ifndef _WIIU_H
34#define _WIIU_H
35
36#include <machine/wii.h>
37
38#define WIIU_MEM1_BASE			0x00000000
39#define WIIU_MEM1_SIZE			0x02000000	/* 32 MB */
40#define WIIU_MEM0_BASE			0x08000000
41#define WIIU_MEM0_SIZE			0x00300000	/* 3 MB */
42#define WIIU_MEM2_BASE			0x10000000
43#define WIIU_MEM2_SIZE			0x80000000	/* 2 GB */
44
45#define WIIU_GFX_TV_BASE		0x17500000
46#define WIIU_GFX_DRC_BASE		0x178c0000
47
48#define WIIU_BUS_FREQ_HZ		248625000
49#define WIIU_CPU_FREQ_HZ		(WIIU_BUS_FREQ_HZ * 5)
50#define WIIU_TIMEBASE_FREQ_HZ		(WIIU_BUS_FREQ_HZ / 4)
51
52#define WIIU_PI_BASE			0x0c000000
53
54#define WIIU_DSP_BASE			0x0c280000
55
56/* Processor interface registers */
57#define WIIU_PI_INTSR(n)		(WIIU_PI_BASE + 0x78 + (n) * 8)
58#define WIIU_PI_INTMSK(n)		(WIIU_PI_BASE + 0x7c + (n) * 8)
59
60/* Latte IRQs */
61#define WIIU_PI_IRQ_MB_CPU(n)		(20 + (n))
62
63/* Latte registers */
64#define LT_PPCnINT1STS(n)		(HOLLYWOOD_PRIV_BASE + 0x440 + (n) * 0x10)
65#define LT_PPCnINT2STS(n)		(HOLLYWOOD_PRIV_BASE + 0x444 + (n) * 0x10)
66#define LT_PPCnINT1EN(n)		(HOLLYWOOD_PRIV_BASE + 0x448 + (n) * 0x10)
67#define LT_PPCnINT2EN(n)		(HOLLYWOOD_PRIV_BASE + 0x44c + (n) * 0x10)
68#define LT_IOPINT1STS			LT_PPCnINT1STS(3)
69#define LT_IOPINT2STS			LT_PPCnINT2STS(3)
70#define LT_IOPIRQINT1EN			LT_PPCnINT1EN(3)
71#define LT_IOPIRQINT2EN			LT_PPCnINT2EN(3)
72#define LT_CHIPREVID			(HOLLYWOOD_PRIV_BASE + 0x5a0)
73#define  LT_CHIPREVID_MAGIC		__BITS(31, 16)
74#define  LT_CHIPREVID_MAGIC_CAFE	0xCAFE
75#define  LT_CHIPREVID_VERHI		__BITS(7, 4)
76#define  LT_CHIPREVID_VERLO		__BITS(3, 0)
77#define LT_PIMCOMPAT			(HOLLYWOOD_PRIV_BASE + 0x5b0)
78#define  PPC_COMPAT			__BIT(5)
79#define LT_GPUINDADDR			(HOLLYWOOD_PRIV_BASE + 0x620)
80#define  LT_GPUINDADDR_REGSPACE_GPU	(0x3U << 30)
81#define LT_GPUINDDATA			(HOLLYWOOD_PRIV_BASE + 0x624)
82
83/* GPIOs */
84#define WIIU_GPIO_POWER			0
85
86/* Boot vector */
87#define WIIU_BOOT_VECTOR		0x08100100
88
89/* linux-loader command line protocol */
90#define WIIU_LOADER_DATA_ADDR		0x89200000
91#define WIIU_LOADER_MAGIC		0xcafefeca
92struct wiiu_argv {
93	uint32_t	magic;
94	char		cmdline[256];
95	uint32_t	initrd;
96	uint32_t	initrd_len;
97};
98
99/* Declared in sys/arch/evbppc/nintendo/machdep.c */
100extern bool wiiu_plat;
101extern bool wiiu_native;
102
103#endif /* !_WIIU_H */
104