2 mini_ipc.h -- public PowerPC-side interface to mini. Part of the
5 Copyright (C) 2009 Andre Heider "dhewg" <dhewg@wiibrew.org>
6 Copyright (C) 2009 Haxx Enterprises <bushing@gmail.com>
7 Copyright (C) 2009 John Kelley <wiidev@kelley.ca>
8 Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
10 # This code is licensed to you under the terms of the GNU GPL, version 2;
11 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
14 #ifndef __MINI_IPC_H__
15 #define __MINI_IPC_H__
17 #define SDHC_ENOCARD -0x1001
18 #define SDHC_ESTRANGE -0x1002
19 #define SDHC_EOVERFLOW -0x1003
20 #define SDHC_ETIMEDOUT -0x1004
21 #define SDHC_EINVAL -0x1005
22 #define SDHC_EIO -0x1006
24 #define SDMMC_NO_CARD 1
25 #define SDMMC_NEW_CARD 2
26 #define SDMMC_INSERTED 3
29 #define NAND_ECC_CORRECTED 1
30 #define NAND_ECC_UNCORRECTABLE -1
32 int sd_get_state(void);
33 int sd_protected(void);
36 int sd_read(u32 start_block, u32 blk_cnt, void *buffer);
37 int sd_write(u32 start_block, u32 blk_cnt, const void *buffer);
40 int ipc_powerpc_boot(const void *addr, u32 len);
42 #define TMD_BM_MARK(x) ((u16*)&(x->reserved[4]))
44 #define TMD_BM_MAGIC 0x424d
50 } __attribute__((packed)) sig_rsa2048;
58 } __attribute__((packed)) tmd_content;
61 sig_rsa2048 signature;
65 u8 signer_crl_version;
80 tmd_content boot_content;
81 } __attribute__((packed)) tmd;
83 u32 boot2_run(u32 hi, u32 lo);
91 union { // first two bytes of nand_hmac overlap last two bytes of ng_priv. no clue why
104 u32 unk2; // 0x00000007
105 } __attribute__((packed)) otp_t;
115 } __attribute__((packed)) eep_ctr_t;
125 eep_ctr_t counters[2];
131 } __attribute__((packed)) seeprom_t;
133 void getotp(otp_t *otp);
134 void getseeprom(seeprom_t *seeprom);
135 void getMiniGitVer(char *buf, u16 len);
137 void aes_reset(void);
138 void aes_set_key(u8 *key);
139 void aes_set_iv(u8 *iv);
140 void aes_decrypt(u8 *src, u8 *dst, u32 blocks, u8 keep_iv);
142 void nand_reset(void);
143 u32 nand_getid(void);
144 u8 nand_status(void);
145 int nand_read(u32 pageno, void *data, void *ecc);
146 void nand_write(u32 pageno, void *data, void *ecc);
147 void nand_erase(u32 pageno);