Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/uboot/common/main.c
Show All 24 Lines | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <inttypes.h> | |||||
#include <stand.h> | #include <stand.h> | ||||
#include "api_public.h" | #include "api_public.h" | ||||
#include "bootstrap.h" | #include "bootstrap.h" | ||||
#include "glue.h" | #include "glue.h" | ||||
#include "libuboot.h" | #include "libuboot.h" | ||||
#ifndef nitems | #ifndef nitems | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | meminfo(void) | ||||
int i; | int i; | ||||
if ((si = ub_get_sys_info()) == NULL) | if ((si = ub_get_sys_info()) == NULL) | ||||
panic("could not retrieve system info"); | panic("could not retrieve system info"); | ||||
for (i = 0; i < 3; i++) { | for (i = 0; i < 3; i++) { | ||||
size = memsize(si, t[i]); | size = memsize(si, t[i]); | ||||
if (size > 0) | if (size > 0) | ||||
printf("%s: %lldMB\n", ub_mem_type(t[i]), | printf("%s: %" PRIu64 "MB\n", ub_mem_type(t[i]), | ||||
size / 1024 / 1024); | size / 1024 / 1024); | ||||
andrew: Cast to a `uintmax_t` and use `%ju` | |||||
} | } | ||||
} | } | ||||
static const char * | static const char * | ||||
get_device_type(const char *devstr, int *devtype) | get_device_type(const char *devstr, int *devtype) | ||||
{ | { | ||||
int i; | int i; | ||||
int namelen; | int namelen; | ||||
▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | main(void) | ||||
uboot_heap_start = round_page((uintptr_t)end); | uboot_heap_start = round_page((uintptr_t)end); | ||||
uboot_heap_end = uboot_heap_start + 512 * 1024; | uboot_heap_end = uboot_heap_start + 512 * 1024; | ||||
setheap((void *)uboot_heap_start, (void *)uboot_heap_end); | setheap((void *)uboot_heap_start, (void *)uboot_heap_end); | ||||
/* | /* | ||||
* Set up console. | * Set up console. | ||||
*/ | */ | ||||
cons_probe(); | cons_probe(); | ||||
printf("Compatible U-Boot API signature found @%x\n", (uint32_t)sig); | printf("Compatible U-Boot API signature found @%" PRIxPTR "\n", sig); | ||||
andrewUnsubmitted Done Inline Actions%p andrew: `%p` | |||||
printf("\n"); | printf("\n"); | ||||
printf("%s, Revision %s\n", bootprog_name, bootprog_rev); | printf("%s, Revision %s\n", bootprog_name, bootprog_rev); | ||||
printf("(%s, %s)\n", bootprog_maker, bootprog_date); | printf("(%s, %s)\n", bootprog_maker, bootprog_date); | ||||
printf("\n"); | printf("\n"); | ||||
dump_sig(sig); | dump_sig(sig); | ||||
dump_addr_info(); | dump_addr_info(); | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
COMMAND_SET(heap, "heap", "show heap usage", command_heap); | COMMAND_SET(heap, "heap", "show heap usage", command_heap); | ||||
static int | static int | ||||
command_heap(int argc, char *argv[]) | command_heap(int argc, char *argv[]) | ||||
{ | { | ||||
printf("heap base at %p, top at %p, used %d\n", end, sbrk(0), | printf("heap base at %p, top at %p, used %" PRIuPTR "\n", end, sbrk(0), | ||||
sbrk(0) - end); | sbrk(0) - end); | ||||
andrewUnsubmitted Done Inline ActionsI think a ptrdiff_t is %td andrew: I think a `ptrdiff_t` is `%td` | |||||
return (CMD_OK); | return (CMD_OK); | ||||
} | } | ||||
COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); | COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); | ||||
static int | static int | ||||
command_reboot(int argc, char *argv[]) | command_reboot(int argc, char *argv[]) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |
Cast to a uintmax_t and use %ju