Home | History | Annotate | Line # | Download | only in include
      1 /* $NetBSD: wiiu.h,v 1.4 2026/02/07 13:06:19 jmcneill Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2025-2026 Jared McNeill <jmcneill (at) 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_GX2_BASE			0x0c200000
     55 #define WIIU_GX2_SIZE			0x80000
     56 
     57 #define WIIU_DSP_BASE			0x0c280000
     58 
     59 /* Processor interface registers */
     60 #define WIIU_PI_INTSR(n)		(WIIU_PI_BASE + 0x78 + (n) * 8)
     61 #define WIIU_PI_INTMSK(n)		(WIIU_PI_BASE + 0x7c + (n) * 8)
     62 
     63 /* Latte IRQs */
     64 #define WIIU_PI_IRQ_MB_CPU(n)		(20 + (n))
     65 #define WIIU_PI_IRQ_GPU7		23
     66 
     67 /* Latte registers */
     68 #define LT_PPCnINT1STS(n)		(HOLLYWOOD_PRIV_BASE + 0x440 + (n) * 0x10)
     69 #define LT_PPCnINT2STS(n)		(HOLLYWOOD_PRIV_BASE + 0x444 + (n) * 0x10)
     70 #define LT_PPCnINT1EN(n)		(HOLLYWOOD_PRIV_BASE + 0x448 + (n) * 0x10)
     71 #define LT_PPCnINT2EN(n)		(HOLLYWOOD_PRIV_BASE + 0x44c + (n) * 0x10)
     72 #define LT_IOPINT1STS			LT_PPCnINT1STS(3)
     73 #define LT_IOPINT2STS			LT_PPCnINT2STS(3)
     74 #define LT_IOPIRQINT1EN			LT_PPCnINT1EN(3)
     75 #define LT_IOPIRQINT2EN			LT_PPCnINT2EN(3)
     76 #define LT_CHIPREVID			(HOLLYWOOD_PRIV_BASE + 0x5a0)
     77 #define  LT_CHIPREVID_MAGIC		__BITS(31, 16)
     78 #define  LT_CHIPREVID_MAGIC_CAFE	0xCAFE
     79 #define  LT_CHIPREVID_VERHI		__BITS(7, 4)
     80 #define  LT_CHIPREVID_VERLO		__BITS(3, 0)
     81 #define LT_PIMCOMPAT			(HOLLYWOOD_PRIV_BASE + 0x5b0)
     82 #define  PPC_COMPAT			__BIT(5)
     83 #define LT_GPUINDADDR			(HOLLYWOOD_PRIV_BASE + 0x620)
     84 #define  LT_GPUINDADDR_REGSPACE_GPU	(0x3U << 30)
     85 #define LT_GPUINDDATA			(HOLLYWOOD_PRIV_BASE + 0x624)
     86 
     87 /* GPIOs */
     88 #define WIIU_GPIO_POWER			0
     89 
     90 /* Boot vector */
     91 #define WIIU_BOOT_VECTOR		0x08100100
     92 
     93 /* linux-loader command line protocol */
     94 #define WIIU_LOADER_DATA_ADDR		0x89200000
     95 #define WIIU_LOADER_MAGIC		0xcafefeca
     96 struct wiiu_argv {
     97 	uint32_t	magic;
     98 	char		cmdline[256];
     99 	uint32_t	initrd;
    100 	uint32_t	initrd_len;
    101 };
    102 
    103 /* linux-loader IPC protocol */
    104 #define CMD_POWEROFF			0xcafe0001
    105 #define CMD_REBOOT			0xcafe0002
    106 
    107 /* Declared in sys/arch/evbppc/nintendo/machdep.c */
    108 extern bool wiiu_plat;
    109 extern bool wiiu_native;
    110 
    111 #endif /* !_WIIU_H */
    112