Refactor ALL the things + enable LTO

This commit is contained in:
Kostas Missos 2018-08-13 11:58:24 +03:00
parent 2666b440ef
commit e5abdd938e
110 changed files with 275 additions and 1961 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
.vs
.vscode
build_ipl/*
build/*
output/*

View file

@ -4,17 +4,17 @@ endif
include $(DEVKITARM)/base_rules
TARGET := ipl
BUILD := build_ipl
TARGET := hekate
BUILD := build
OUTPUT := output
SOURCEDIR := ipl
SOURCEDIR = bootloader
VPATH = $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
OBJS = $(addprefix $(BUILD)/, \
OBJS = $(addprefix $(BUILD)/$(TARGET)/, \
start.o \
main.o \
config.o \
btn.o \
blz.o \
clock.o \
cluster.o \
fuse.o \
@ -23,7 +23,6 @@ OBJS = $(addprefix $(BUILD)/, \
hos.o \
i2c.o \
kfuse.o \
lz.o \
bq24193.o \
max7762x.o \
max17050.o \
@ -46,12 +45,15 @@ OBJS = $(addprefix $(BUILD)/, \
ini.o \
)
OBJS += $(addprefix $(BUILD)/, diskio.o ff.o ffunicode.o ffsystem.o)
OBJS += $(addprefix $(BUILD)/elfloader/, elfload.o elfreloc_arm.o)
OBJS += $(addprefix $(BUILD)/$(TARGET)/, \
lz.o blz.o \
diskio.o ff.o ffunicode.o ffsystem.o \
elfload.o elfreloc_arm.o \
)
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
CUSTOMDEFINES := -DMENU_LOGO_ENABLE #-DDEBUG
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
CFLAGS = $(ARCH) -O2 -nostdlib -flto -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections
MODULEDIRS := $(wildcard modules/*)
@ -71,17 +73,17 @@ clean:
$(MODULEDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
$(TARGET).bin: $(BUILD)/$(TARGET).elf $(MODULEDIRS)
$(TARGET).bin: $(BUILD)/$(TARGET)/$(TARGET).elf $(MODULEDIRS)
$(OBJCOPY) -S -O binary $< $(OUTPUT)/$@
$(BUILD)/$(TARGET).elf: $(OBJS)
$(CC) $(LDFLAGS) -T ipl/link.ld $^ -o $@
$(BUILD)/$(TARGET)/$(TARGET).elf: $(OBJS)
$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@
$(BUILD)/%.o: $(SOURCEDIR)/%.c
$(BUILD)/$(TARGET)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD)/%.o: $(SOURCEDIR)/%.S
$(BUILD)/$(TARGET)/%.o: %.S
@mkdir -p "$(BUILD)"
@mkdir -p "$(BUILD)/elfloader"
@mkdir -p "$(BUILD)/$(TARGET)"
@mkdir -p "$(OUTPUT)"
$(CC) $(CFLAGS) -c $< -o $@

View file

@ -17,14 +17,14 @@
#include <string.h>
#include <stdlib.h>
#include "btn.h"
#include "../utils/btn.h"
#include "config.h"
#include "ff.h"
#include "../libs/fatfs/ff.h"
#include "ini.h"
#include "list.h"
#include "tui.h"
#include "util.h"
#include "gfx.h"
#include "../utils/list.h"
#include "../gfx/tui.h"
#include "../utils/util.h"
#include "../gfx/gfx.h"
extern gfx_ctxt_t gfx_ctxt;
extern gfx_con_t gfx_con;

View file

@ -17,7 +17,7 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
#include "types.h"
#include "../utils/types.h"
typedef struct _hekate_config
{

4
ipl/ini.c → bootloader/config/ini.c Executable file → Normal file
View file

@ -18,8 +18,8 @@
#include <string.h>
#include "ini.h"
#include "ff.h"
#include "heap.h"
#include "../libs/fatfs/ff.h"
#include "../mem/heap.h"
static char *_strdup(char *str)
{

4
ipl/ini.h → bootloader/config/ini.h Executable file → Normal file
View file

@ -18,8 +18,8 @@
#ifndef _INI_H_
#define _INI_H_
#include "types.h"
#include "list.h"
#include "../utils/types.h"
#include "../utils/list.h"
#define INI_CHOICE 3
#define INI_CAPTION 5

16
ipl/di.c → bootloader/gfx/di.c Executable file → Normal file
View file

@ -18,14 +18,14 @@
#include <string.h>
#include "di.h"
#include "t210.h"
#include "util.h"
#include "i2c.h"
#include "pmc.h"
#include "max77620.h"
#include "gpio.h"
#include "pinmux.h"
#include "clock.h"
#include "../soc/t210.h"
#include "../utils/util.h"
#include "../soc/i2c.h"
#include "../soc/pmc.h"
#include "../power/max77620.h"
#include "../soc/gpio.h"
#include "../soc/pinmux.h"
#include "../soc/clock.h"
#include "di.inl"

2
ipl/di.h → bootloader/gfx/di.h Executable file → Normal file
View file

@ -18,7 +18,7 @@
#ifndef _DI_H_
#define _DI_H_
#include "types.h"
#include "../utils/types.h"
/*! Display registers. */
#define _DIREG(reg) ((reg) * 4)

0
ipl/di.inl → bootloader/gfx/di.inl Executable file → Normal file
View file

0
ipl/gfx.c → bootloader/gfx/gfx.c Executable file → Normal file
View file

2
ipl/gfx.h → bootloader/gfx/gfx.h Executable file → Normal file
View file

@ -19,7 +19,7 @@
#ifndef _GFX_H_
#define _GFX_H_
#include "../common/common_gfx.h"
#include "../../common/common_gfx.h"
void gfx_init_ctxt(gfx_ctxt_t *ctxt, u32 *fb, u32 width, u32 height, u32 stride);
void gfx_clear_grey(gfx_ctxt_t *ctxt, u8 color);

8
ipl/tui.c → bootloader/gfx/tui.c Executable file → Normal file
View file

@ -16,10 +16,10 @@
*/
#include "tui.h"
#include "btn.h"
#include "config.h"
#include "max17050.h"
#include "util.h"
#include "../utils/btn.h"
#include "../config/config.h"
#include "../power/max17050.h"
#include "../utils/util.h"
#ifdef MENU_LOGO_ENABLE
extern u8 *Kc_MENU_LOGO;

2
ipl/tui.h → bootloader/gfx/tui.h Executable file → Normal file
View file

@ -18,7 +18,7 @@
#ifndef _TUI_H_
#define _TUI_H_
#include "types.h"
#include "../utils/types.h"
#include "gfx.h"
#define MENT_END 0

32
ipl/hos.c → bootloader/hos/hos.c Executable file → Normal file
View file

@ -20,26 +20,24 @@
#include <string.h>
#include "hos.h"
#include "sdmmc.h"
#include "nx_emmc.h"
#include "t210.h"
#include "se.h"
#include "se_t210.h"
#include "pmc.h"
#include "cluster.h"
#include "heap.h"
#include "tsec.h"
#include "pkg2.h"
#include "nx_emmc.h"
#include "util.h"
#include "../storage/sdmmc.h"
#include "../storage/nx_emmc.h"
#include "../soc/t210.h"
#include "../sec/se.h"
#include "../sec/se_t210.h"
#include "../soc/pmc.h"
#include "../soc/cluster.h"
#include "../mem/heap.h"
#include "../sec/tsec.h"
#include "../utils/util.h"
#include "pkg1.h"
#include "pkg2.h"
#include "ff.h"
#include "di.h"
#include "config.h"
#include "mc.h"
#include "../libs/fatfs/ff.h"
#include "../gfx/di.h"
#include "../config/config.h"
#include "../mem/mc.h"
#include "gfx.h"
#include "../gfx/gfx.h"
extern gfx_ctxt_t gfx_ctxt;
extern gfx_con_t gfx_con;
extern void sd_unmount();

4
ipl/hos.h → bootloader/hos/hos.h Executable file → Normal file
View file

@ -17,8 +17,8 @@
#ifndef _HOS_H_
#define _HOS_H_
#include "types.h"
#include "ini.h"
#include "../utils/types.h"
#include "../config/ini.h"
int hos_launch(ini_sec_t *cfg);
int keygen(u8 *keyblob, u32 kb, void *tsec_fw);

4
ipl/pkg1.c → bootloader/hos/pkg1.c Executable file → Normal file
View file

@ -19,8 +19,8 @@
#include <string.h>
#include "pkg1.h"
#include "arm64.h"
#include "se.h"
#include "../utils/aarch64_util.h"
#include "../sec/se.h"
#define SM_100_ADR 0x4002B020
PATCHSET_DEF(_secmon_1_patchset,

2
ipl/pkg1.h → bootloader/hos/pkg1.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _PKG1_H_
#define _PKG1_H_
#include "types.h"
#include "../utils/types.h"
typedef struct _patch_t
{

10
ipl/pkg2.c → bootloader/hos/pkg2.c Executable file → Normal file
View file

@ -19,12 +19,12 @@
#include <string.h>
#include "pkg2.h"
#include "arm64.h"
#include "heap.h"
#include "se.h"
#include "blz.h"
#include "../utils/aarch64_util.h"
#include "../mem/heap.h"
#include "../sec/se.h"
#include "../libs/compr/blz.h"
#include "gfx.h"
#include "../gfx/gfx.h"
extern gfx_con_t gfx_con;

4
ipl/pkg2.h → bootloader/hos/pkg2.h Executable file → Normal file
View file

@ -18,8 +18,8 @@
#ifndef _PKG2_H_
#define _PKG2_H_
#include "types.h"
#include "list.h"
#include "../utils/types.h"
#include "../utils/list.h"
#define PKG2_MAGIC 0x31324B50
#define PKG2_SEC_BASE 0x80000000

View file

@ -17,7 +17,7 @@
#ifndef _BLZ_H_
#define _BLZ_H_
#include "types.h"
#include "../../utils/types.h"
typedef struct _blz_footer
{

0
ipl/lz.c → bootloader/libs/compr/lz.c Executable file → Normal file
View file

0
ipl/lz.h → bootloader/libs/compr/lz.h Executable file → Normal file
View file

View file

@ -1,4 +1,5 @@
/* Copyright © 2014, Owen Shepherd
/*
* Copyright © 2014, Owen Shepherd
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -12,6 +13,7 @@
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef ELFARCH_H
#define ELFARCH_H

View file

@ -1,4 +1,5 @@
/* Copyright © 2018, M4xw
/*
* Copyright © 2018, M4xw
* Copyright © 2014, Owen Shepherd
*
* Permission to use, copy, modify, and/or distribute this software for any
@ -13,9 +14,11 @@
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "elfload.h"
#include <string.h>
#include "elfload.h"
el_status el_pread(el_ctx *ctx, void *def, size_t nb, size_t offset)
{
return ctx->pread(ctx, def, nb, offset) ? EL_OK : EL_EIO;
@ -141,7 +144,6 @@ el_status el_init(el_ctx *ctx)
// Section String Table
if (ctx->ehdr.e_type == ET_DYN)
{
i = ctx->ehdr.e_shstrndx - 1;
if ((rv = el_findshdr(ctx, &ctx->shstr, SHT_STRTAB, &i)))

View file

@ -1,4 +1,5 @@
/* Copyright © 2018, M4xw
/*
* Copyright © 2018, M4xw
* Copyright © 2014, Owen Shepherd
*
* Permission to use, copy, modify, and/or distribute this software for any
@ -16,13 +17,15 @@
#ifndef ELFLOAD_H
#define ELFLOAD_H
#include <stdbool.h>
#include <stddef.h>
#include "elfarch.h"
#include "elf.h"
#include "../../utils/types.h"
#ifdef DEBUG
#include "../gfx.h"
#include "../../gfx/gfx.h"
extern gfx_con_t gfx_con;
#define EL_DEBUG(format, ...) \
gfx_printf(&gfx_con, format __VA_OPT__(, ) __VA_ARGS__)

View file

@ -1,4 +1,5 @@
/* Copyright © 2014, Owen Shepherd
/*
* Copyright © 2014, Owen Shepherd
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,9 +1,9 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <m4x@m4xw.net> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. M4xw
* <m4x@m4xw.net> wrote this file. As long as you retain this notice you can do
* whatever you want with this stuff. If we meet some day, and you think this
* stuff is worth it, you can buy me a beer in return. M4xw
* ----------------------------------------------------------------------------
*/

2
ipl/diskio.c → bootloader/libs/fatfs/diskio.c Executable file → Normal file
View file

@ -9,7 +9,7 @@
#include <string.h>
#include "diskio.h" /* FatFs lower layer API */
#include "sdmmc.h"
#include "../../storage/sdmmc.h"
extern sdmmc_storage_t sd_storage;

2
ipl/diskio.h → bootloader/libs/fatfs/diskio.h Executable file → Normal file
View file

@ -9,7 +9,7 @@
extern "C" {
#endif
#include "integer.h"
#include "../../utils/types.h"
/* Status of Disk Functions */

2
ipl/ff.c → bootloader/libs/fatfs/ff.c Executable file → Normal file
View file

@ -24,7 +24,7 @@
#include "ff.h" /* Declarations of FatFs API */
#include "diskio.h" /* Declarations of device I/O functions */
#include "gfx.h"
#include "../../gfx/gfx.h"
extern gfx_ctxt_t gfx_ctxt;
extern gfx_con_t gfx_con;
#define EFSPRINTF(text, ...) print_error(); gfx_printf(&gfx_con, "%k"text"%k\n", 0xFFFFFF00, 0xFFFFFFFF);

2
ipl/ff.h → bootloader/libs/fatfs/ff.h Executable file → Normal file
View file

@ -26,7 +26,7 @@
extern "C" {
#endif
#include "integer.h" /* Basic integer types */
#include "../../utils/types.h" /* Basic integer types */
#include "ffconf.h" /* FatFs configuration options */
#if FF_DEFINED != FFCONF_DEF

0
ipl/ffconf.h → bootloader/libs/fatfs/ffconf.h Executable file → Normal file
View file

View file

@ -6,7 +6,7 @@
#include "ff.h"
#include "heap.h"
#include "../../mem/heap.h"

0
ipl/ffunicode.c → bootloader/libs/fatfs/ffunicode.c Executable file → Normal file
View file

0
ipl/link.ld → bootloader/link.ld Executable file → Normal file
View file

72
ipl/main.c → bootloader/main.c Executable file → Normal file
View file

@ -22,43 +22,43 @@
#include <string.h>
#include <stdlib.h>
#include "clock.h"
#include "uart.h"
#include "i2c.h"
#include "sdram.h"
#include "di.h"
#include "mc.h"
#include "t210.h"
#include "pmc.h"
#include "pinmux.h"
#include "fuse.h"
#include "util.h"
#include "gfx.h"
#include "btn.h"
#include "tsec.h"
#include "kfuse.h"
#include "max77620.h"
#include "max7762x.h"
#include "gpio.h"
#include "sdmmc.h"
#include "ff.h"
#include "hekate_logos.h"
#include "tui.h"
#include "heap.h"
#include "list.h"
#include "nx_emmc.h"
#include "se.h"
#include "se_t210.h"
#include "hos.h"
#include "pkg1.h"
#include "pkg2.h"
#include "mmc.h"
#include "blz.h"
#include "max17050.h"
#include "bq24193.h"
#include "config.h"
#include "soc/clock.h"
#include "soc/uart.h"
#include "soc/i2c.h"
#include "mem/sdram.h"
#include "gfx/di.h"
#include "mem/mc.h"
#include "soc/t210.h"
#include "soc/pmc.h"
#include "soc/pinmux.h"
#include "soc/fuse.h"
#include "utils/util.h"
#include "gfx/gfx.h"
#include "utils/btn.h"
#include "sec/tsec.h"
#include "soc/kfuse.h"
#include "power/max77620.h"
#include "power/max7762x.h"
#include "soc/gpio.h"
#include "storage/sdmmc.h"
#include "libs/fatfs/ff.h"
#include "gfx/logos.h"
#include "gfx/tui.h"
#include "mem/heap.h"
#include "utils/list.h"
#include "storage/nx_emmc.h"
#include "sec/se.h"
#include "sec/se_t210.h"
#include "hos/hos.h"
#include "hos/pkg1.h"
#include "hos/pkg2.h"
#include "storage/mmc.h"
#include "libs/compr/blz.h"
#include "power/max17050.h"
#include "power/bq24193.h"
#include "config/config.h"
#include "elfloader/elfload.h"
#include "libs/elfload/elfload.h"
#include "../common/common_module.h"
// TODO: Make it not suck

0
ipl/emc.h → bootloader/mem/emc.h Executable file → Normal file
View file

2
ipl/heap.c → bootloader/mem/heap.c Executable file → Normal file
View file

@ -17,7 +17,7 @@
#include <string.h>
#include "heap.h"
#include "../common/common_heap.h"
#include "../../common/common_heap.h"
static void _heap_create(heap_t *heap, u32 start)
{

2
ipl/heap.h → bootloader/mem/heap.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _HEAP_H_
#define _HEAP_H_
#include "types.h"
#include "../utils/types.h"
void heap_init(u32 base);
void *malloc(u32 size);

8
ipl/mc.c → bootloader/mem/mc.c Executable file → Normal file
View file

@ -1,7 +1,7 @@
#include "mc.h"
#include "t210.h"
#include "clock.h"
#include "util.h"
#include "../mem/mc.h"
#include "../soc/t210.h"
#include "../soc/clock.h"
#include "../utils/util.h"
void mc_config_tsec_carveout(u32 bom, u32 size1mb, int lock)
{

4
ipl/mc.h → bootloader/mem/mc.h Executable file → Normal file
View file

@ -1,8 +1,8 @@
#ifndef _MC_H_
#define _MC_H_
#include "types.h"
#include "mc_t210.h"
#include "../utils/types.h"
#include "../mem/mc_t210.h"
void mc_config_tsec_carveout(u32 bom, u32 size1mb, int lock);
void mc_config_carveout();

0
ipl/mc_t210.h → bootloader/mem/mc_t210.h Executable file → Normal file
View file

22
ipl/sdram.c → bootloader/mem/sdram.c Executable file → Normal file
View file

@ -14,24 +14,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "i2c.h"
#include "t210.h"
#include "../soc/i2c.h"
#include "../soc/t210.h"
#include "mc.h"
#include "emc.h"
#include "pmc.h"
#include "util.h"
#include "fuse.h"
#include "max77620.h"
#include "sdram_param_t210.h"
#include "clock.h"
#include "../soc/pmc.h"
#include "../utils/util.h"
#include "../soc/fuse.h"
#include "../power/max77620.h"
#include "../mem/sdram_param_t210.h"
#include "../soc/clock.h"
#define CONFIG_SDRAM_COMPRESS_CFG
#ifdef CONFIG_SDRAM_COMPRESS_CFG
#include "lz.h"
#include "sdram_lz.inl"
#include "../libs/compr/lz.h"
#include "sdram_config_lz.inl"
#else
#include "sdram.inl"
#include "sdram_config.inl"
#endif
static u32 _get_sdram_id()

0
ipl/sdram.h → bootloader/mem/sdram.h Executable file → Normal file
View file

0
ipl/sdram.inl → bootloader/mem/sdram_config.inl Executable file → Normal file
View file

View file

6
ipl/sdram_lp0.c → bootloader/mem/sdram_lp0.c Executable file → Normal file
View file

@ -14,9 +14,9 @@
* more details.
*/
#include "t210.h"
#include "pmc_t210_lp0.h"
#include "sdram_param_t210_lp0.h"
#include "../soc/t210.h"
#include "../soc/pmc_lp0_t210.h"
#include "sdram_lp0_param_t210.h"
/*
* This function reads SDRAM parameters from the common BCT format and

View file

@ -23,7 +23,7 @@
#ifndef __SOC_NVIDIA_TEGRA210_SDRAM_PARAM_H__
#define __SOC_NVIDIA_TEGRA210_SDRAM_PARAM_H__
#include "types.h"
#include "../utils/types.h"
enum
{

View file

View file

@ -17,8 +17,8 @@
*/
#include "bq24193.h"
#include "i2c.h"
#include "util.h"
#include "../soc/i2c.h"
#include "../utils/util.h"
int bq24193_get_property(enum BQ24193_reg_prop prop, int *value)
{

View file

@ -23,8 +23,8 @@
*/
#include "max17050.h"
#include "i2c.h"
#include "util.h"
#include "../soc/i2c.h"
#include "../utils/util.h"
/* Status register bits */
#define STATUS_POR_BIT (1 << 1)

0
ipl/max77620.h → bootloader/power/max77620.h Executable file → Normal file
View file

4
ipl/max7762x.c → bootloader/power/max7762x.c Executable file → Normal file
View file

@ -16,8 +16,8 @@
#include "max7762x.h"
#include "max77620.h"
#include "i2c.h"
#include "util.h"
#include "../soc/i2c.h"
#include "../utils/util.h"
#define REGULATOR_SD 0
#define REGULATOR_LDO 1

2
ipl/max7762x.h → bootloader/power/max7762x.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _MAX7762X_H_
#define _MAX7762X_H_
#include "types.h"
#include "../utils/types.h"
/*
* Switch Power domains (max77620):

0
ipl/reloc.S → bootloader/reloc.S Executable file → Normal file
View file

10
ipl/se.c → bootloader/sec/se.c Executable file → Normal file
View file

@ -18,11 +18,11 @@
#include <string.h>
#include "se.h"
#include "heap.h"
#include "t210.h"
#include "se_t210.h"
#include "util.h"
#include "../sec/se.h"
#include "../mem/heap.h"
#include "../soc/t210.h"
#include "../sec/se_t210.h"
#include "../utils/util.h"
typedef struct _se_ll_t
{

2
ipl/se.h → bootloader/sec/se.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _SE_H_
#define _SE_H_
#include "types.h"
#include "../utils/types.h"
void se_rsa_acc_ctrl(u32 rs, u32 flags);
void se_key_acc_ctrl(u32 ks, u32 flags);

2
ipl/se_t210.h → bootloader/sec/se_t210.h Executable file → Normal file
View file

@ -21,7 +21,7 @@
#ifndef _CRYPTO_TEGRA_SE_H
#define _CRYPTO_TEGRA_SE_H
#include "types.h"
#include "../utils/types.h"
#define TEGRA_SE_CRA_PRIORITY 300
#define TEGRA_SE_COMPOSITE_PRIORITY 400

10
ipl/tsec.c → bootloader/sec/tsec.c Executable file → Normal file
View file

@ -16,11 +16,11 @@
#include <string.h>
#include "tsec.h"
#include "clock.h"
#include "t210.h"
#include "heap.h"
#include "util.h"
#include "../sec/tsec.h"
#include "../soc/clock.h"
#include "../soc/t210.h"
#include "../mem/heap.h"
#include "../utils/util.h"
static int _tsec_dma_wait_idle()
{

2
ipl/tsec.h → bootloader/sec/tsec.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _TSEC_H_
#define _TSEC_H_
#include "types.h"
#include "../utils/types.h"
int tsec_query(u8 *dst, u32 rev, void *fw);

8
ipl/clock.c → bootloader/soc/clock.c Executable file → Normal file
View file

@ -14,10 +14,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clock.h"
#include "t210.h"
#include "util.h"
#include "sdmmc.h"
#include "../soc/clock.h"
#include "../soc/t210.h"
#include "../utils/util.h"
#include "../storage/sdmmc.h"
static const clock_t _clock_uart[] = {
/* UART A */ { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_UARTA, 6, 0, 0 },

2
ipl/clock.h → bootloader/soc/clock.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _CLOCK_H_
#define _CLOCK_H_
#include "types.h"
#include "../utils/types.h"
/*! Clock registers. */
#define CLK_RST_CONTROLLER_RST_SOURCE 0x0

14
ipl/cluster.c → bootloader/soc/cluster.c Executable file → Normal file
View file

@ -14,13 +14,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cluster.h"
#include "i2c.h"
#include "clock.h"
#include "util.h"
#include "pmc.h"
#include "t210.h"
#include "max77620.h"
#include "../soc/cluster.h"
#include "../soc/i2c.h"
#include "../soc/clock.h"
#include "../utils/util.h"
#include "../soc/pmc.h"
#include "../soc/t210.h"
#include "../power/max77620.h"
void _cluster_enable_power()
{

2
ipl/cluster.h → bootloader/soc/cluster.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _CLUSTER_H_
#define _CLUSTER_H_
#include "types.h"
#include "../utils/types.h"
/*! Flow controller registers. */
#define FLOW_CTLR_HALT_COP_EVENTS 0x4

4
ipl/fuse.c → bootloader/soc/fuse.c Executable file → Normal file
View file

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "fuse.h"
#include "t210.h"
#include "../soc/fuse.h"
#include "../soc/t210.h"
void fuse_disable_program()
{

2
ipl/fuse.h → bootloader/soc/fuse.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _FUSE_H_
#define _FUSE_H_
#include "types.h"
#include "../utils/types.h"
/*! Fuse registers. */
#define FUSE_CTRL 0x0

4
ipl/gpio.c → bootloader/soc/gpio.c Executable file → Normal file
View file

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gpio.h"
#include "t210.h"
#include "../soc/gpio.h"
#include "../soc/t210.h"
static const u16 _gpio_cnf[31] = {
0x000, 0x004, 0x008, 0x00C,

2
ipl/gpio.h → bootloader/soc/gpio.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _GPIO_H_
#define _GPIO_H_
#include "types.h"
#include "../utils/types.h"
#define GPIO_MODE_SPIO 0
#define GPIO_MODE_GPIO 1

2
ipl/i2c.c → bootloader/soc/i2c.c Executable file → Normal file
View file

@ -17,7 +17,7 @@
#include <string.h>
#include "i2c.h"
#include "util.h"
#include "../utils/util.h"
static u32 i2c_addrs[] = {
0x7000C000, 0x7000C400, 0x7000C500,

2
ipl/i2c.h → bootloader/soc/i2c.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _I2C_H_
#define _I2C_H_
#include "types.h"
#include "../utils/types.h"
#define I2C_1 0
#define I2C_2 1

6
ipl/kfuse.c → bootloader/soc/kfuse.c Executable file → Normal file
View file

@ -14,9 +14,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kfuse.h"
#include "clock.h"
#include "t210.h"
#include "../soc/kfuse.h"
#include "../soc/clock.h"
#include "../soc/t210.h"
int kfuse_read(u32 *buf)
{

2
ipl/kfuse.h → bootloader/soc/kfuse.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _KFUSE_H_
#define _KFUSE_H_
#include "types.h"
#include "../utils/types.h"
#define KFUSE_STATE_SOFTRESET (1 << 31)
#define KFUSE_STATE_STOP (1 << 25)

4
ipl/pinmux.c → bootloader/soc/pinmux.c Executable file → Normal file
View file

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pinmux.h"
#include "t210.h"
#include "../soc/pinmux.h"
#include "../soc/t210.h"
void pinmux_config_uart(u32 idx)
{

2
ipl/pinmux.h → bootloader/soc/pinmux.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _PINMUX_H_
#define _PINMUX_H_
#include "types.h"
#include "../utils/types.h"
/*! APB MISC registers. */
#define APB_MISC_GP_SDMMC1_CLK_LPBK_CONTROL 0x8D4

0
ipl/pmc.h → bootloader/soc/pmc.h Executable file → Normal file
View file

2
ipl/pmc_t210_lp0.h → bootloader/soc/pmc_lp0_t210.h Executable file → Normal file
View file

@ -14,7 +14,7 @@
#ifndef _TEGRA210_PMC_H_
#define _TEGRA210_PMC_H_
#include "types.h"
#include "../utils/types.h"
struct tegra_pmc_regs {
u32 cntrl;

2
ipl/t210.h → bootloader/soc/t210.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _T210_H_
#define _T210_H_
#include "types.h"
#include "../utils/types.h"
#define HOST1X_BASE 0x50000000
#define DISPLAY_A_BASE 0x54200000

6
ipl/uart.c → bootloader/soc/uart.c Executable file → Normal file
View file

@ -14,9 +14,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "uart.h"
#include "t210.h"
#include "util.h"
#include "../soc/uart.h"
#include "../soc/t210.h"
#include "../utils/util.h"
/* UART A, B, C, D and E. */
static const u32 uart_baseoff[5] = { 0, 0x40, 0x200, 0x300, 0x400 };

2
ipl/uart.h → bootloader/soc/uart.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _UART_H_
#define _UART_H_
#include "types.h"
#include "../utils/types.h"
#define UART_A 0
#define UART_B 1

0
ipl/start.S → bootloader/start.S Executable file → Normal file
View file

0
ipl/mmc.h → bootloader/storage/mmc.h Executable file → Normal file
View file

4
ipl/nx_emmc.c → bootloader/storage/nx_emmc.c Executable file → Normal file
View file

@ -17,8 +17,8 @@
#include <string.h>
#include "nx_emmc.h"
#include "heap.h"
#include "list.h"
#include "../mem/heap.h"
#include "../utils/list.h"
void nx_emmc_gpt_parse(link_t *gpt, sdmmc_storage_t *storage)
{

4
ipl/nx_emmc.h → bootloader/storage/nx_emmc.h Executable file → Normal file
View file

@ -17,8 +17,8 @@
#ifndef _NX_EMMC_H_
#define _NX_EMMC_H_
#include "types.h"
#include "list.h"
#include "../utils/types.h"
#include "../utils/list.h"
#include "sdmmc.h"
typedef struct _gpt_entry_t

0
ipl/sd.h → bootloader/storage/sd.h Executable file → Normal file
View file

4
ipl/sdmmc.c → bootloader/storage/sdmmc.c Executable file → Normal file
View file

@ -19,8 +19,8 @@
#include "sdmmc.h"
#include "mmc.h"
#include "sd.h"
#include "util.h"
#include "heap.h"
#include "../utils/util.h"
#include "../mem/heap.h"
/*#include "gfx.h"
extern gfx_ctxt_t gfx_ctxt;

2
ipl/sdmmc.h → bootloader/storage/sdmmc.h Executable file → Normal file
View file

@ -18,7 +18,7 @@
#ifndef _SDMMC_H_
#define _SDMMC_H_
#include "types.h"
#include "../utils/types.h"
#include "sdmmc_driver.h"
typedef struct _mmc_cid

View file

@ -18,14 +18,14 @@
#include <string.h>
#include "sdmmc.h"
#include "util.h"
#include "clock.h"
#include "../utils/util.h"
#include "../soc/clock.h"
#include "mmc.h"
#include "max7762x.h"
#include "t210.h"
#include "pmc.h"
#include "pinmux.h"
#include "gpio.h"
#include "../power/max7762x.h"
#include "../soc/t210.h"
#include "../soc/pmc.h"
#include "../soc/pinmux.h"
#include "../soc/gpio.h"
/*#include "gfx.h"
extern gfx_ctxt_t gfx_ctxt;

View file

@ -17,7 +17,7 @@
#ifndef _SDMMC_DRIVER_H_
#define _SDMMC_DRIVER_H_
#include "types.h"
#include "../utils/types.h"
#include "sdmmc_t210.h"
/*! SDMMC controller IDs. */

2
ipl/sdmmc_t210.h → bootloader/storage/sdmmc_t210.h Executable file → Normal file
View file

@ -17,7 +17,7 @@
#ifndef _SDMMC_T210_H_
#define _SDMMC_T210_H_
#include "types.h"
#include "../utils/types.h"
#define TEGRA_MMC_PWRCTL_SD_BUS_POWER 0x1
#define TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V1_8 0xA

0
ipl/arm64.h → bootloader/utils/aarch64_util.h Executable file → Normal file
View file

6
ipl/btn.c → bootloader/utils/btn.c Executable file → Normal file
View file

@ -16,9 +16,9 @@
*/
#include "btn.h"
#include "i2c.h"
#include "gpio.h"
#include "t210.h"
#include "../soc/i2c.h"
#include "../soc/gpio.h"
#include "../soc/t210.h"
#include "util.h"
u32 btn_read()

0
ipl/btn.h → bootloader/utils/btn.h Executable file → Normal file
View file

0
ipl/list.h → bootloader/utils/list.h Executable file → Normal file
View file

9
ipl/types.h → bootloader/utils/types.h Executable file → Normal file
View file

@ -28,11 +28,20 @@
typedef char s8;
typedef short s16;
typedef short SHORT;
typedef int s32;
typedef int INT;
typedef long LONG;
typedef long long int s64;
typedef unsigned char u8;
typedef unsigned char BYTE;
typedef unsigned short u16;
typedef unsigned short WORD;
typedef unsigned short WCHAR;
typedef unsigned int u32;
typedef unsigned int UINT;
typedef unsigned long DWORD;
typedef unsigned long long QWORD;
typedef unsigned long long int u64;
typedef volatile unsigned char vu8;
typedef volatile unsigned short vu16;

2
ipl/util.c → bootloader/utils/util.c Executable file → Normal file
View file

@ -16,7 +16,7 @@
*/
#include "util.h"
#include "t210.h"
#include "../soc/t210.h"
u32 get_tmr_s()
{

Some files were not shown because too many files have changed in this diff Show more