wiiu.h revision 1.2
11.2Sjmcneill/* $NetBSD: wiiu.h,v 1.2 2026/01/10 22:45:57 jmcneill Exp $ */
21.1Sjmcneill
31.1Sjmcneill/*-
41.1Sjmcneill * Copyright (c) 2025 Jared McNeill <jmcneill@invisible.ca>
51.1Sjmcneill * All rights reserved.
61.1Sjmcneill *
71.1Sjmcneill * Redistribution and use in source and binary forms, with or without
81.1Sjmcneill * modification, are permitted provided that the following conditions
91.1Sjmcneill * are met:
101.1Sjmcneill * 1. Redistributions of source code must retain the above copyright
111.1Sjmcneill *    notice, this list of conditions and the following disclaimer.
121.1Sjmcneill * 2. Redistributions in binary form must reproduce the above copyright
131.1Sjmcneill *    notice, this list of conditions and the following disclaimer in the
141.1Sjmcneill *    documentation and/or other materials provided with the distribution.
151.1Sjmcneill *
161.1Sjmcneill * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
171.1Sjmcneill * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
181.1Sjmcneill * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
191.1Sjmcneill * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
201.1Sjmcneill * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
211.1Sjmcneill * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
221.1Sjmcneill * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
231.1Sjmcneill * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
241.1Sjmcneill * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
251.1Sjmcneill * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261.1Sjmcneill * SUCH DAMAGE.
271.1Sjmcneill */
281.1Sjmcneill
291.1Sjmcneill/*
301.1Sjmcneill * Nintendo Wii U platform definitions.
311.1Sjmcneill */
321.1Sjmcneill
331.1Sjmcneill#ifndef _WIIU_H
341.1Sjmcneill#define _WIIU_H
351.1Sjmcneill
361.1Sjmcneill#include <machine/wii.h>
371.1Sjmcneill
381.1Sjmcneill#define WIIU_MEM1_BASE			0x00000000
391.1Sjmcneill#define WIIU_MEM1_SIZE			0x02000000	/* 32 MB */
401.1Sjmcneill#define WIIU_MEM0_BASE			0x08000000
411.1Sjmcneill#define WIIU_MEM0_SIZE			0x00300000	/* 3 MB */
421.1Sjmcneill#define WIIU_MEM2_BASE			0x10000000
431.1Sjmcneill#define WIIU_MEM2_SIZE			0x80000000	/* 2 GB */
441.1Sjmcneill
451.1Sjmcneill#define WIIU_GFX_TV_BASE		0x17500000
461.1Sjmcneill#define WIIU_GFX_DRC_BASE		0x178c0000
471.1Sjmcneill
481.1Sjmcneill#define WIIU_BUS_FREQ_HZ		248625000
491.1Sjmcneill#define WIIU_CPU_FREQ_HZ		(WIIU_BUS_FREQ_HZ * 5)
501.1Sjmcneill#define WIIU_TIMEBASE_FREQ_HZ		(WIIU_BUS_FREQ_HZ / 4)
511.1Sjmcneill
521.1Sjmcneill#define WIIU_PI_BASE			0x0c000000
531.1Sjmcneill
541.1Sjmcneill#define WIIU_DSP_BASE			0x0c280000
551.1Sjmcneill
561.1Sjmcneill/* Processor interface registers */
571.1Sjmcneill#define WIIU_PI_INTSR(n)		(WIIU_PI_BASE + 0x78 + (n) * 8)
581.1Sjmcneill#define WIIU_PI_INTMSK(n)		(WIIU_PI_BASE + 0x7c + (n) * 8)
591.1Sjmcneill
601.1Sjmcneill/* Latte IRQs */
611.1Sjmcneill#define WIIU_PI_IRQ_MB_CPU(n)		(20 + (n))
621.1Sjmcneill
631.1Sjmcneill/* Latte registers */
641.1Sjmcneill#define LT_PPCnINT1STS(n)		(HOLLYWOOD_PRIV_BASE + 0x440 + (n) * 0x10)
651.1Sjmcneill#define LT_PPCnINT2STS(n)		(HOLLYWOOD_PRIV_BASE + 0x444 + (n) * 0x10)
661.1Sjmcneill#define LT_PPCnINT1EN(n)		(HOLLYWOOD_PRIV_BASE + 0x448 + (n) * 0x10)
671.1Sjmcneill#define LT_PPCnINT2EN(n)		(HOLLYWOOD_PRIV_BASE + 0x44c + (n) * 0x10)
681.1Sjmcneill#define LT_IOPINT1STS			LT_PPCnINT1STS(3)
691.1Sjmcneill#define LT_IOPINT2STS			LT_PPCnINT2STS(3)
701.1Sjmcneill#define LT_IOPIRQINT1EN			LT_PPCnINT1EN(3)
711.1Sjmcneill#define LT_IOPIRQINT2EN			LT_PPCnINT2EN(3)
721.1Sjmcneill#define LT_CHIPREVID			(HOLLYWOOD_PRIV_BASE + 0x5a0)
731.1Sjmcneill#define  LT_CHIPREVID_MAGIC		__BITS(31, 16)
741.1Sjmcneill#define  LT_CHIPREVID_MAGIC_CAFE	0xCAFE
751.1Sjmcneill#define  LT_CHIPREVID_VERHI		__BITS(7, 4)
761.1Sjmcneill#define  LT_CHIPREVID_VERLO		__BITS(3, 0)
771.1Sjmcneill#define LT_PIMCOMPAT			(HOLLYWOOD_PRIV_BASE + 0x5b0)
781.1Sjmcneill#define  PPC_COMPAT			__BIT(5)
791.1Sjmcneill#define LT_GPUINDADDR			(HOLLYWOOD_PRIV_BASE + 0x620)
801.1Sjmcneill#define  LT_GPUINDADDR_REGSPACE_GPU	(0x3U << 30)
811.1Sjmcneill#define LT_GPUINDDATA			(HOLLYWOOD_PRIV_BASE + 0x624)
821.1Sjmcneill
831.1Sjmcneill/* GPIOs */
841.1Sjmcneill#define WIIU_GPIO_POWER			0
851.1Sjmcneill
861.1Sjmcneill/* Boot vector */
871.1Sjmcneill#define WIIU_BOOT_VECTOR		0x08100100
881.1Sjmcneill
891.2Sjmcneill/* linux-loader command line protocol */
901.2Sjmcneill#define WIIU_LOADER_DATA_ADDR		0x89200000
911.2Sjmcneill#define WIIU_LOADER_MAGIC		0xcafefeca
921.2Sjmcneillstruct wiiu_argv {
931.2Sjmcneill	uint32_t	magic;
941.2Sjmcneill	char		cmdline[256];
951.2Sjmcneill	uint32_t	initrd;
961.2Sjmcneill	uint32_t	initrd_len;
971.2Sjmcneill};
981.2Sjmcneill
991.1Sjmcneill/* Declared in sys/arch/evbppc/nintendo/machdep.c */
1001.1Sjmcneillextern bool wiiu_plat;
1011.1Sjmcneillextern bool wiiu_native;
1021.1Sjmcneill
1031.1Sjmcneill#endif /* !_WIIU_H */
104