diff --git a/Makefile b/Makefile index b10362ab1..b8ebeb7f1 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ OBJECTS := \ afk.o \ aic.o \ asc.o \ - bootlogo_128.o bootlogo_256.o \ + bootlogo_48.o bootlogo_128.o bootlogo_256.o \ chainload.o \ chainload_asm.o \ chickens.o \ diff --git a/data/bootlogo_48.bin b/data/bootlogo_48.bin new file mode 100644 index 000000000..76df9e8b2 Binary files /dev/null and b/data/bootlogo_48.bin differ diff --git a/data/bootlogo_48.png b/data/bootlogo_48.png new file mode 100644 index 000000000..0b2ec48e1 Binary files /dev/null and b/data/bootlogo_48.png differ diff --git a/data/makelogo.sh b/data/makelogo.sh index a86076969..20dcffbd5 100755 --- a/data/makelogo.sh +++ b/data/makelogo.sh @@ -1,3 +1,4 @@ #!/usr/bin/env sh +convert bootlogo_48.png -background black -flatten -depth 8 rgba:bootlogo_48.bin convert bootlogo_128.png -background black -flatten -depth 8 rgba:bootlogo_128.bin convert bootlogo_256.png -background black -flatten -depth 8 rgba:bootlogo_256.bin diff --git a/src/fb.c b/src/fb.c index 8a3c317be..32f7d6f0e 100644 --- a/src/fb.c +++ b/src/fb.c @@ -44,12 +44,19 @@ static struct { bool active; } console; +extern u8 _binary_build_bootlogo_48_bin_start[]; extern u8 _binary_build_bootlogo_128_bin_start[]; extern u8 _binary_build_bootlogo_256_bin_start[]; extern u8 _binary_build_font_bin_start[]; extern u8 _binary_build_font_retina_bin_start[]; +const struct image logo_48 = { + .ptr = (void *)_binary_build_bootlogo_48_bin_start, + .width = 48, + .height = 48, +}; + const struct image logo_128 = { .ptr = (void *)_binary_build_bootlogo_128_bin_start, .width = 128, @@ -409,7 +416,13 @@ void fb_init(bool clear) fb.ptr = malloc(fb.size); memcpy(fb.ptr, fb.hwptr, fb.size); - if (cur_boot_args.video.depth & FB_DEPTH_FLAG_RETINA) { + // This is the touchbar, make everything tiny + if (chip_id == T8012) { + logo = &logo_48; + console.font.ptr = _binary_build_font_bin_start; + console.font.width = 8; + console.font.height = 16; + } else if (cur_boot_args.video.depth & FB_DEPTH_FLAG_RETINA) { logo = &logo_256; console.font.ptr = _binary_build_font_retina_bin_start; console.font.width = 16; diff --git a/src/memory.c b/src/memory.c index c88086e70..9394bb67a 100644 --- a/src/memory.c +++ b/src/memory.c @@ -380,8 +380,11 @@ static void mmu_map_mmio(void) u64 bus = ranges[2] | ((u64)ranges[3] << 32); u64 size = ranges[4] | ((u64)ranges[5] << 32); - mmu_add_mapping(bus, bus, size, MAIR_IDX_DEVICE_nGnRnE, PERM_RW_EL0); + /* T2 is really stupid */ + if (chip_id == T8012) + size = ALIGN_UP(size, PAGE_SIZE); + mmu_add_mapping(bus, bus, size, MAIR_IDX_DEVICE_nGnRnE, PERM_RW_EL0); ranges += 6; } } diff --git a/src/startup.c b/src/startup.c index b0308c389..08476ff64 100644 --- a/src/startup.c +++ b/src/startup.c @@ -134,7 +134,23 @@ void dump_boot_args(struct boot_args *ba) break; } if (!mem_size_actual) { - mem_size_actual = ALIGN_UP(ba->phys_base + ba->mem_size - 0x800000000, BIT(30)); + if (chip_id == T8012) { + int anode = adt_path_offset(adt, "/arm-io/mcc"); + + /* + * Lower 512 MB intented for OS use, upper 512 or 1536 MB is some sort + * of SSD cache. Cannot use dram-size, it may not exist in older firmwares + * This property is changed from 4 to 2 by iBoot on 1 GB RAM models. + */ + + u32 dcs_num_channels = 0; + if (anode > 0 && ADT_GETPROP(adt, anode, "dcs_num_channels", &dcs_num_channels) > 0) + mem_size_actual = dcs_num_channels * 0x20000000; + else + mem_size_actual = 0x40000000; + } else { + mem_size_actual = ALIGN_UP(ba->phys_base + ba->mem_size - 0x800000000, BIT(30)); + } printf("Correcting mem_size_actual to 0x%lx\n", mem_size_actual); } }