trivial whitespace fixes

This commit is contained in:
bushing 2009-05-10 23:36:36 -07:00
parent 49c33236df
commit 8e1f68f0cb
14 changed files with 123 additions and 141 deletions

12
boot2.c
View File

@ -142,7 +142,8 @@ static inline u32 boot2_page_translate(u32 page)
static int read_to(u32 bytes) static int read_to(u32 bytes)
{ {
if(bytes > (valid_blocks * BLOCK_SIZE * PAGE_SIZE)) { if(bytes > (valid_blocks * BLOCK_SIZE * PAGE_SIZE)) {
gecko_printf("tried to read %d boot2 bytes (%d pages), but only %d blocks (%d pages) are valid!\n", bytes, (bytes+(PAGE_SIZE-1)) / PAGE_SIZE, valid_blocks, valid_blocks * BLOCK_SIZE); gecko_printf("tried to read %d boot2 bytes (%d pages), but only %d blocks (%d pages) are valid!\n",
bytes, (bytes+(PAGE_SIZE-1)) / PAGE_SIZE, valid_blocks, valid_blocks * BLOCK_SIZE);
return -1; return -1;
} }
while(bytes > ((u32)pages_read * PAGE_SIZE)) { while(bytes > ((u32)pages_read * PAGE_SIZE)) {
@ -186,7 +187,8 @@ int boot2_load(int copy)
} }
mapno = find_valid_map(maps); mapno = find_valid_map(maps);
if(mapno >= 0) { if(mapno >= 0) {
gecko_printf("found valid boot2 blockmap at page 0x%x, submap %d, generation %d\n", page, mapno, maps[mapno].generation); gecko_printf("found valid boot2 blockmap at page 0x%x, submap %d, generation %d\n",
page, mapno, maps[mapno].generation);
if(maps[mapno].generation >= good_blockmap.generation) { if(maps[mapno].generation >= good_blockmap.generation) {
memcpy(&good_blockmap, &maps[mapno], sizeof(boot2blockmap)); memcpy(&good_blockmap, &maps[mapno], sizeof(boot2blockmap));
found = 1; found = 1;
@ -270,7 +272,8 @@ int boot2_load(int copy)
gecko_printf("boot2 title key: %08x%08x%08x%08x\n", kp[0], kp[1], kp[2], kp[3]); gecko_printf("boot2 title key: %08x%08x%08x%08x\n", kp[0], kp[1], kp[2], kp[3]);
boot2_content_size = (boot2_tmd.boot_content.size + 15) & ~15; boot2_content_size = (boot2_tmd.boot_content.size + 15) & ~15;
gecko_printf("boot2 content size: 0x%x (padded: 0x%x)\n", (u32)boot2_tmd.boot_content.size, boot2_content_size); gecko_printf("boot2 content size: 0x%x (padded: 0x%x)\n",
(u32)boot2_tmd.boot_content.size, boot2_content_size);
// read content // read content
if(read_to(hdr->data_offset + boot2_content_size) < 0) { if(read_to(hdr->data_offset + boot2_content_size) < 0) {
@ -285,7 +288,7 @@ int boot2_load(int copy)
return 0; return 0;
} }
void boot2_init() { void boot2_init(void) {
boot2_copy = -1; boot2_copy = -1;
boot2_initialized = 0; boot2_initialized = 0;
if(boot2_load(0) < 0) { if(boot2_load(0) < 0) {
@ -359,7 +362,6 @@ u32 boot2_ipc(volatile ipc_request *req)
} else { } else {
ipc_post(req->code, req->tag, 1, -1); ipc_post(req->code, req->tag, 1, -1);
} }
break; break;
case IPC_BOOT2_TMD: case IPC_BOOT2_TMD:

View File

@ -7,6 +7,7 @@ Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
# This code is licensed to you under the terms of the GNU GPL, version 2; # This code is licensed to you under the terms of the GNU GPL, version 2;
# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/ */
#ifndef __BSDTYPES_H__ #ifndef __BSDTYPES_H__
#define __BSDTYPES_H__ #define __BSDTYPES_H__

View File

@ -40,7 +40,7 @@ void crypto_read_seeprom(void)
seeprom_read(&seeprom, 0, sizeof(seeprom) / 2); seeprom_read(&seeprom, 0, sizeof(seeprom) / 2);
} }
void crypto_initialize() void crypto_initialize(void)
{ {
crypto_read_otp(); crypto_read_otp();
crypto_read_seeprom(); crypto_read_seeprom();
@ -70,7 +70,7 @@ void crypto_ipc(volatile ipc_request *req)
static int _aes_irq = 0; static int _aes_irq = 0;
void aes_irq() void aes_irq(void)
{ {
_aes_irq = 1; _aes_irq = 1;
} }
@ -99,7 +99,7 @@ void aes_set_iv(u8 *iv)
} }
} }
void aes_empty_iv() void aes_empty_iv(void)
{ {
int i; int i;
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)

View File

@ -20,7 +20,6 @@ Copyright (C) 2008, 2009 Haxx Enterprises <bushing@gmail.com>
static u8 buffer[512] MEM2_BSS ALIGNED(32); static u8 buffer[512] MEM2_BSS ALIGNED(32);
// Initialize a Drive // Initialize a Drive
DSTATUS disk_initialize (BYTE drv) { DSTATUS disk_initialize (BYTE drv) {
if (sdmmc_check_card(SDMMC_DEFAULT_DEVICE) == SDMMC_NO_CARD) if (sdmmc_check_card(SDMMC_DEFAULT_DEVICE) == SDMMC_NO_CARD)
return STA_NOINIT; return STA_NOINIT;
@ -29,10 +28,7 @@ DSTATUS disk_initialize (BYTE drv) {
return disk_status(drv); return disk_status(drv);
} }
// Return Disk Status // Return Disk Status
DSTATUS disk_status (BYTE drv) { DSTATUS disk_status (BYTE drv) {
(void)drv; (void)drv;
if (sdmmc_check_card(SDMMC_DEFAULT_DEVICE) == SDMMC_INSERTED) if (sdmmc_check_card(SDMMC_DEFAULT_DEVICE) == SDMMC_INSERTED)
@ -41,10 +37,7 @@ DSTATUS disk_status (BYTE drv) {
return STA_NODISK; return STA_NODISK;
} }
// Read Sector(s) // Read Sector(s)
DRESULT disk_read (BYTE drv, BYTE *buff, DWORD sector, BYTE count) { DRESULT disk_read (BYTE drv, BYTE *buff, DWORD sector, BYTE count) {
int i; int i;
(void)drv; (void)drv;
@ -57,10 +50,7 @@ DRESULT disk_read (BYTE drv, BYTE *buff, DWORD sector, BYTE count) {
return RES_OK; return RES_OK;
} }
// Write Sector(s) // Write Sector(s)
#if _READONLY == 0 #if _READONLY == 0
DRESULT disk_write (BYTE drv, const BYTE *buff, DWORD sector, BYTE count) { DRESULT disk_write (BYTE drv, const BYTE *buff, DWORD sector, BYTE count) {
int i; int i;
@ -84,4 +74,3 @@ DRESULT disk_ioctl (BYTE drv, BYTE ctrl, void *buff) {
return RES_PARERR; return RES_PARERR;
} }
#endif /* _USE_IOCTL */ #endif /* _USE_IOCTL */

View File

@ -18,7 +18,8 @@ Copyright (C) 2008, 2009 Haxx Enterprises <bushing@gmail.com>
#include "panic.h" #include "panic.h"
const char *exceptions[] = { const char *exceptions[] = {
"RESET", "UNDEFINED INSTR", "SWI", "INSTR ABORT", "DATA ABORT", "RESERVED", "IRQ", "FIQ", "(unknown exception type)" "RESET", "UNDEFINED INSTR", "SWI", "INSTR ABORT", "DATA ABORT",
"RESERVED", "IRQ", "FIQ", "(unknown exception type)"
}; };
const char *aborts[] = { const char *aborts[] = {

View File

@ -99,7 +99,6 @@ Copyright (C) 2008, 2009 John Kelley <wiidev@kelley.ca>
#define HW_OTPDATA (HW_REG_BASE + 0x1f0) #define HW_OTPDATA (HW_REG_BASE + 0x1f0)
#define HW_VERSION (HW_REG_BASE + 0x214) #define HW_VERSION (HW_REG_BASE + 0x214)
/* NAND Registers */ /* NAND Registers */
#define NAND_REG_BASE 0xd010000 #define NAND_REG_BASE 0xd010000
@ -114,8 +113,6 @@ Copyright (C) 2008, 2009 John Kelley <wiidev@kelley.ca>
#define NAND_UNK1 (NAND_REG_BASE + 0x018) #define NAND_UNK1 (NAND_REG_BASE + 0x018)
#define NAND_UNK2 (NAND_REG_BASE + 0x01c) #define NAND_UNK2 (NAND_REG_BASE + 0x01c)
/* AES Registers */ /* AES Registers */
#define AES_REG_BASE 0xd020000 #define AES_REG_BASE 0xd020000
@ -126,8 +123,6 @@ Copyright (C) 2008, 2009 John Kelley <wiidev@kelley.ca>
#define AES_KEY (AES_REG_BASE + 0x00c) #define AES_KEY (AES_REG_BASE + 0x00c)
#define AES_IV (AES_REG_BASE + 0x010) #define AES_IV (AES_REG_BASE + 0x010)
/* SHA-1 Registers */ /* SHA-1 Registers */
#define SHA_REG_BASE 0xd030000 #define SHA_REG_BASE 0xd030000
@ -140,8 +135,6 @@ Copyright (C) 2008, 2009 John Kelley <wiidev@kelley.ca>
#define SHA_H3 (SHA_REG_BASE + 0x014) #define SHA_H3 (SHA_REG_BASE + 0x014)
#define SHA_H4 (SHA_REG_BASE + 0x018) #define SHA_H4 (SHA_REG_BASE + 0x018)
/* SD Host Controller Registers */ /* SD Host Controller Registers */
#define SDHC_REG_BASE 0xd070000 #define SDHC_REG_BASE 0xd070000
@ -173,8 +166,6 @@ Copyright (C) 2008, 2009 John Kelley <wiidev@kelley.ca>
#define EXI_BOOT_BASE (EXI_REG_BASE+0x040) #define EXI_BOOT_BASE (EXI_REG_BASE+0x040)
/* MEMORY CONTROLLER Registers */ /* MEMORY CONTROLLER Registers */
#define MEM_REG_BASE 0xd8b4000 #define MEM_REG_BASE 0xd8b4000
@ -185,4 +176,3 @@ Copyright (C) 2008, 2009 John Kelley <wiidev@kelley.ca>
#define MEM_FLUSHACK (MEM_REG_BASE+0x22a) #define MEM_FLUSHACK (MEM_REG_BASE+0x22a)
#endif #endif

View File

@ -4,10 +4,6 @@
#ifndef _INTEGER #ifndef _INTEGER
#if 0
#include <windows.h>
#else
/* These types must be 16-bit, 32-bit or larger integer */ /* These types must be 16-bit, 32-bit or larger integer */
typedef int INT; typedef int INT;
typedef unsigned int UINT; typedef unsigned int UINT;
@ -31,7 +27,5 @@ typedef unsigned long DWORD;
/* Boolean type */ /* Boolean type */
typedef enum { FALSE = 0, TRUE } BOOL; typedef enum { FALSE = 0, TRUE } BOOL;
#endif
#define _INTEGER #define _INTEGER
#endif #endif

View File

@ -48,26 +48,31 @@ static inline u32 get_cr(void)
__asm__ volatile ( "mrc\tp15, 0, %0, c1, c0, 0" : "=r" (data) ); __asm__ volatile ( "mrc\tp15, 0, %0, c1, c0, 0" : "=r" (data) );
return data; return data;
} }
static inline u32 get_ttbr(void) static inline u32 get_ttbr(void)
{ {
u32 data; u32 data;
__asm__ volatile ( "mrc\tp15, 0, %0, c2, c0, 0" : "=r" (data) ); __asm__ volatile ( "mrc\tp15, 0, %0, c2, c0, 0" : "=r" (data) );
return data; return data;
} }
static inline u32 get_dacr(void) static inline u32 get_dacr(void)
{ {
u32 data; u32 data;
__asm__ volatile ( "mrc\tp15, 0, %0, c3, c0, 0" : "=r" (data) ); __asm__ volatile ( "mrc\tp15, 0, %0, c3, c0, 0" : "=r" (data) );
return data; return data;
} }
static inline void set_cr(u32 data) static inline void set_cr(u32 data)
{ {
__asm__ volatile ( "mcr\tp15, 0, %0, c1, c0, 0" :: "r" (data) ); __asm__ volatile ( "mcr\tp15, 0, %0, c1, c0, 0" :: "r" (data) );
} }
static inline void set_ttbr(u32 data) static inline void set_ttbr(u32 data)
{ {
__asm__ volatile ( "mcr\tp15, 0, %0, c2, c0, 0" :: "r" (data) ); __asm__ volatile ( "mcr\tp15, 0, %0, c2, c0, 0" :: "r" (data) );
} }
static inline void set_dacr(u32 data) static inline void set_dacr(u32 data)
{ {
__asm__ volatile ( "mcr\tp15, 0, %0, c3, c0, 0" :: "r" (data) ); __asm__ volatile ( "mcr\tp15, 0, %0, c3, c0, 0" :: "r" (data) );
@ -79,12 +84,14 @@ static inline u32 get_dfsr(void)
__asm__ volatile ( "mrc\tp15, 0, %0, c5, c0, 0" : "=r" (data) ); __asm__ volatile ( "mrc\tp15, 0, %0, c5, c0, 0" : "=r" (data) );
return data; return data;
} }
static inline u32 get_ifsr(void) static inline u32 get_ifsr(void)
{ {
u32 data; u32 data;
__asm__ volatile ( "mrc\tp15, 0, %0, c5, c0, 1" : "=r" (data) ); __asm__ volatile ( "mrc\tp15, 0, %0, c5, c0, 1" : "=r" (data) );
return data; return data;
} }
static inline u32 get_far(void) static inline u32 get_far(void)
{ {
u32 data; u32 data;

4
nand.h
View File

@ -40,9 +40,7 @@ void nand_read_cluster(u32 clusterno, void *data);
#define NAND_ECC_UNCORRECTABLE -1 #define NAND_ECC_UNCORRECTABLE -1
int nand_correct(u32 pageno, void *data, void *ecc); int nand_correct(u32 pageno, void *data, void *ecc);
void nand_initialize(void);
void nand_initialize();
void nand_ipc(volatile ipc_request *req); void nand_ipc(volatile ipc_request *req);
#endif #endif

View File

@ -46,7 +46,7 @@ void powerpc_upload_stub(u32 entry)
clear32(HW_EXICTRL, EXICTRL_ENABLE_EXI); clear32(HW_EXICTRL, EXICTRL_ENABLE_EXI);
} }
void powerpc_hang() void powerpc_hang(void)
{ {
clear32(HW_RESETS, 0x30); clear32(HW_RESETS, 0x30);
udelay(100); udelay(100);
@ -54,7 +54,7 @@ void powerpc_hang()
udelay(100); udelay(100);
} }
void powerpc_reset() void powerpc_reset(void)
{ {
// enable the broadway IPC interrupt // enable the broadway IPC interrupt
write32(HW_PPCIRQMASK, (1<<30)); write32(HW_PPCIRQMASK, (1<<30));

View File

@ -15,8 +15,8 @@ Copyright (C) 2009 Andre Heider "dhewg" <dhewg@wiibrew.org>
#include "ipc.h" #include "ipc.h"
void powerpc_upload_stub(u32 entry); void powerpc_upload_stub(u32 entry);
void powerpc_hang(); void powerpc_hang(void);
void powerpc_reset(); void powerpc_reset(void);
void powerpc_ipc(volatile ipc_request *req); void powerpc_ipc(volatile ipc_request *req);
#endif #endif