Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

  typedef unsigned int         u32;
  typedef unsigned long        uintptr_t;
  typedef unsigned long long   u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly.  You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2018-08-06 20:47:40 +09:00 committed by Tom Rini
parent 3747bdbb2b
commit dee37fc99d
22 changed files with 43 additions and 351 deletions

View File

@ -15,7 +15,6 @@
*/ */
#include <common.h> #include <common.h>
#include <inttypes.h>
#include <relocate.h> #include <relocate.h>
#include <asm/u-boot-x86.h> #include <asm/u-boot-x86.h>
#include <asm/sections.h> #include <asm/sections.h>
@ -70,8 +69,7 @@ static void do_elf_reloc_fixups64(unsigned int text_base, uintptr_t size,
*offset_ptr_ram = gd->reloc_off + *offset_ptr_ram = gd->reloc_off +
re_src->r_addend; re_src->r_addend;
} else { } else {
debug(" %p: %lx: rom reloc %lx, ram %p, value %lx, limit %" debug(" %p: %lx: rom reloc %lx, ram %p, value %lx, limit %lX\n",
PRIXPTR "\n",
re_src, (ulong)re_src->r_info, re_src, (ulong)re_src->r_info,
(ulong)re_src->r_offset, offset_ptr_ram, (ulong)re_src->r_offset, offset_ptr_ram,
(ulong)*offset_ptr_ram, text_base + size); (ulong)*offset_ptr_ram, text_base + size);
@ -109,11 +107,9 @@ static void do_elf_reloc_fixups32(unsigned int text_base, uintptr_t size,
*offset_ptr_ram <= text_base + size) { *offset_ptr_ram <= text_base + size) {
*offset_ptr_ram += gd->reloc_off; *offset_ptr_ram += gd->reloc_off;
} else { } else {
debug(" %p: rom reloc %x, ram %p, value %x," debug(" %p: rom reloc %x, ram %p, value %x, limit %lX\n",
" limit %" PRIXPTR "\n", re_src, re_src, re_src->r_offset, offset_ptr_ram,
re_src->r_offset, offset_ptr_ram, *offset_ptr_ram, text_base + size);
*offset_ptr_ram,
text_base + size);
} }
} else { } else {
debug(" %p: rom reloc %x, last %p\n", re_src, debug(" %p: rom reloc %x, last %p\n", re_src,

View File

@ -4,7 +4,6 @@
*/ */
#include <common.h> #include <common.h>
#include <inttypes.h>
#include <config.h> #include <config.h>
#include <dm.h> #include <dm.h>
#include <environment.h> #include <environment.h>
@ -384,7 +383,7 @@ static void set_serial_number(void)
return; return;
} }
snprintf(serial_string, sizeof(serial_string), "%016" PRIx64, snprintf(serial_string, sizeof(serial_string), "%016llx",
msg->get_board_serial.body.resp.serial); msg->get_board_serial.body.resp.serial);
env_set("serial#", serial_string); env_set("serial#", serial_string);
} }

View File

@ -17,7 +17,6 @@
#include <command.h> #include <command.h>
#include <console.h> #include <console.h>
#include <hash.h> #include <hash.h>
#include <inttypes.h>
#include <mapmem.h> #include <mapmem.h>
#include <watchdog.h> #include <watchdog.h>
#include <asm/io.h> #include <asm/io.h>
@ -275,8 +274,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (word1 != word2) { if (word1 != word2) {
ulong offset = buf1 - base; ulong offset = buf1 - base;
#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
printf("%s at 0x%p (%#0*"PRIx64") != %s at 0x%p (%#0*" printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
PRIx64 ")\n",
type, (void *)(addr1 + offset), size, word1, type, (void *)(addr1 + offset), size, word1,
type, (void *)(addr2 + offset), size, word2); type, (void *)(addr2 + offset), size, word2);
#else #else
@ -1000,7 +998,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
printf(" %08x", *((u32 *)ptr)); printf(" %08x", *((u32 *)ptr));
#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
else if (size == 8) else if (size == 8)
printf(" %016" PRIx64, *((u64 *)ptr)); printf(" %016llx", *((u64 *)ptr));
#endif #endif
else if (size == 2) else if (size == 2)
printf(" %04x", *((u16 *)ptr)); printf(" %04x", *((u16 *)ptr));

View File

@ -7,7 +7,6 @@
*/ */
#include <common.h> #include <common.h>
#include <inttypes.h>
#include <stdio_dev.h> #include <stdio_dev.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/types.h> #include <linux/types.h>
@ -1025,8 +1024,7 @@ static u64 of_bus_default_map(fdt32_t *addr, const fdt32_t *range,
s = fdt_read_number(range + na + pna, ns); s = fdt_read_number(range + na + pna, ns);
da = fdt_read_number(addr, na); da = fdt_read_number(addr, na);
debug("OF: default map, cp=%" PRIu64 ", s=%" PRIu64 debug("OF: default map, cp=%llu, s=%llu, da=%llu\n", cp, s, da);
", da=%" PRIu64 "\n", cp, s, da);
if (da < cp || da >= (cp + s)) if (da < cp || da >= (cp + s))
return OF_BAD_ADDR; return OF_BAD_ADDR;
@ -1081,8 +1079,7 @@ static u64 of_bus_isa_map(fdt32_t *addr, const fdt32_t *range,
s = fdt_read_number(range + na + pna, ns); s = fdt_read_number(range + na + pna, ns);
da = fdt_read_number(addr + 1, na - 1); da = fdt_read_number(addr + 1, na - 1);
debug("OF: ISA map, cp=%" PRIu64 ", s=%" PRIu64 debug("OF: ISA map, cp=%llu, s=%llu, da=%llu\n", cp, s, da);
", da=%" PRIu64 "\n", cp, s, da);
if (da < cp || da >= (cp + s)) if (da < cp || da >= (cp + s))
return OF_BAD_ADDR; return OF_BAD_ADDR;
@ -1188,7 +1185,7 @@ static int of_translate_one(const void *blob, int parent, struct of_bus *bus,
finish: finish:
of_dump_addr("OF: parent translation for:", addr, pna); of_dump_addr("OF: parent translation for:", addr, pna);
debug("OF: with offset: %" PRIu64 "\n", offset); debug("OF: with offset: %llu\n", offset);
/* Translate it into parent bus space */ /* Translate it into parent bus space */
return pbus->translate(addr, offset, pna); return pbus->translate(addr, offset, pna);
@ -1518,9 +1515,9 @@ int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr)
dt_addr = fdt_translate_address(fdt, node, reg); dt_addr = fdt_translate_address(fdt, node, reg);
if (addr != dt_addr) { if (addr != dt_addr) {
printf("Warning: U-Boot configured device %s at address %" printf("Warning: U-Boot configured device %s at address %llu,\n"
PRIx64 ",\n but the device tree has it address %" "but the device tree has it address %llx.\n",
PRIx64 ".\n", alias, addr, dt_addr); alias, addr, dt_addr);
return 0; return 0;
} }
@ -1668,7 +1665,7 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
if (ret < 0) if (ret < 0)
return ret; return ret;
snprintf(name, sizeof(name), "framebuffer@%" PRIx64, base_address); snprintf(name, sizeof(name), "framebuffer@%llx", base_address);
ret = fdt_set_name(fdt, node, name); ret = fdt_set_name(fdt, node, name);
if (ret < 0) if (ret < 0)
return ret; return ret;

View File

@ -36,7 +36,6 @@
#include <command.h> #include <command.h>
#include <dm.h> #include <dm.h>
#include <errno.h> #include <errno.h>
#include <inttypes.h>
#include <mapmem.h> #include <mapmem.h>
#include <memalign.h> #include <memalign.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
@ -1164,8 +1163,8 @@ static unsigned long usb_stor_read(struct blk_desc *block_dev, lbaint_t blknr,
start = blknr; start = blknr;
blks = blkcnt; blks = blkcnt;
debug("\nusb_read: dev %d startblk " LBAF ", blccnt " LBAF " buffer %" debug("\nusb_read: dev %d startblk " LBAF ", blccnt " LBAF " buffer %lx\n",
PRIxPTR "\n", block_dev->devnum, start, blks, buf_addr); block_dev->devnum, start, blks, buf_addr);
do { do {
/* XXX need some comment here */ /* XXX need some comment here */
@ -1194,8 +1193,7 @@ retry_it:
} while (blks != 0); } while (blks != 0);
ss->flags &= ~USB_READY; ss->flags &= ~USB_READY;
debug("usb_read: end startblk " LBAF debug("usb_read: end startblk " LBAF ", blccnt %x buffer %lx\n",
", blccnt %x buffer %" PRIxPTR "\n",
start, smallblks, buf_addr); start, smallblks, buf_addr);
usb_disable_asynch(0); /* asynch transfer allowed */ usb_disable_asynch(0); /* asynch transfer allowed */
@ -1248,8 +1246,8 @@ static unsigned long usb_stor_write(struct blk_desc *block_dev, lbaint_t blknr,
start = blknr; start = blknr;
blks = blkcnt; blks = blkcnt;
debug("\nusb_write: dev %d startblk " LBAF ", blccnt " LBAF " buffer %" debug("\nusb_write: dev %d startblk " LBAF ", blccnt " LBAF " buffer %lx\n",
PRIxPTR "\n", block_dev->devnum, start, blks, buf_addr); block_dev->devnum, start, blks, buf_addr);
do { do {
/* If write fails retry for max retry count else /* If write fails retry for max retry count else
@ -1280,8 +1278,8 @@ retry_it:
} while (blks != 0); } while (blks != 0);
ss->flags &= ~USB_READY; ss->flags &= ~USB_READY;
debug("usb_write: end startblk " LBAF ", blccnt %x buffer %" debug("usb_write: end startblk " LBAF ", blccnt %x buffer %lx\n",
PRIxPTR "\n", start, smallblks, buf_addr); start, smallblks, buf_addr);
usb_disable_asynch(0); /* asynch transfer allowed */ usb_disable_asynch(0); /* asynch transfer allowed */
if (blkcnt >= ss->max_xfer_blk) if (blkcnt >= ss->max_xfer_blk)

View File

@ -14,7 +14,6 @@
#include <command.h> #include <command.h>
#include <fdtdec.h> #include <fdtdec.h>
#include <ide.h> #include <ide.h>
#include <inttypes.h>
#include <malloc.h> #include <malloc.h>
#include <memalign.h> #include <memalign.h>
#include <part_efi.h> #include <part_efi.h>

View File

@ -7,7 +7,6 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <errno.h> #include <errno.h>
#include <inttypes.h>
#include <pci.h> #include <pci.h>
#include <asm/io.h> #include <asm/io.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>
@ -854,9 +853,8 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
prop += addr_cells; prop += addr_cells;
size = fdtdec_get_number(prop, size_cells); size = fdtdec_get_number(prop, size_cells);
prop += size_cells; prop += size_cells;
debug("%s: region %d, pci_addr=%" PRIx64 ", addr=%" PRIx64 debug("%s: region %d, pci_addr=%llx, addr=%llx, size=%llx, space_code=%d\n",
", size=%" PRIx64 ", space_code=%d\n", __func__, __func__, hose->region_count, pci_addr, addr, size, space_code);
hose->region_count, pci_addr, addr, size, space_code);
if (space_code & 2) { if (space_code & 2) {
type = flags & (1U << 30) ? PCI_REGION_PREFETCH : type = flags & (1U << 30) ? PCI_REGION_PREFETCH :
PCI_REGION_MEM; PCI_REGION_MEM;

View File

@ -7,7 +7,6 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <fdtdec.h> #include <fdtdec.h>
#include <inttypes.h>
#include <pci.h> #include <pci.h>
#define FDT_DEV_INFO_CELLS 4 #define FDT_DEV_INFO_CELLS 4

View File

@ -6,7 +6,6 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <inttypes.h>
#include <pci.h> #include <pci.h>
#include <scsi.h> #include <scsi.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>
@ -196,7 +195,7 @@ static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr,
blks = 0; blks = 0;
} }
debug("scsi_read_ext: startblk " LBAF debug("scsi_read_ext: startblk " LBAF
", blccnt %x buffer %" PRIXPTR "\n", ", blccnt %x buffer %lX\n",
start, smallblks, buf_addr); start, smallblks, buf_addr);
if (scsi_exec(bdev, pccb)) { if (scsi_exec(bdev, pccb)) {
scsi_print_error(pccb); scsi_print_error(pccb);
@ -206,7 +205,7 @@ static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr,
buf_addr += pccb->datalen; buf_addr += pccb->datalen;
} while (blks != 0); } while (blks != 0);
debug("scsi_read_ext: end startblk " LBAF debug("scsi_read_ext: end startblk " LBAF
", blccnt %x buffer %" PRIXPTR "\n", start, smallblks, buf_addr); ", blccnt %x buffer %lX\n", start, smallblks, buf_addr);
return blkcnt; return blkcnt;
} }
@ -260,7 +259,7 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr,
start += blks; start += blks;
blks = 0; blks = 0;
} }
debug("%s: startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n", debug("%s: startblk " LBAF ", blccnt %x buffer %lx\n",
__func__, start, smallblks, buf_addr); __func__, start, smallblks, buf_addr);
if (scsi_exec(bdev, pccb)) { if (scsi_exec(bdev, pccb)) {
scsi_print_error(pccb); scsi_print_error(pccb);
@ -269,7 +268,7 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr,
} }
buf_addr += pccb->datalen; buf_addr += pccb->datalen;
} while (blks != 0); } while (blks != 0);
debug("%s: end startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n", debug("%s: end startblk " LBAF ", blccnt %x buffer %lX\n",
__func__, start, smallblks, buf_addr); __func__, start, smallblks, buf_addr);
return blkcnt; return blkcnt;
} }

View File

@ -21,7 +21,6 @@
#include <common.h> #include <common.h>
#include <ext_common.h> #include <ext_common.h>
#include <ext4fs.h> #include <ext4fs.h>
#include <inttypes.h>
#include <malloc.h> #include <malloc.h>
#include <memalign.h> #include <memalign.h>
#include <stddef.h> #include <stddef.h>
@ -210,7 +209,7 @@ void put_ext4(uint64_t off, void *buf, uint32_t size)
if ((startblock + (size >> log2blksz)) > if ((startblock + (size >> log2blksz)) >
(part_offset + fs->total_sect)) { (part_offset + fs->total_sect)) {
printf("part_offset is " LBAFU "\n", part_offset); printf("part_offset is " LBAFU "\n", part_offset);
printf("total_sector is %" PRIu64 "\n", fs->total_sect); printf("total_sector is %llu\n", fs->total_sect);
printf("error: overflow occurs\n"); printf("error: overflow occurs\n");
return; return;
} }

View File

@ -37,9 +37,6 @@ typedef volatile unsigned char vu_char;
#include <flash.h> #include <flash.h>
#include <image.h> #include <image.h>
/* Bring in printf format macros if inttypes.h is included */
#define __STDC_FORMAT_MACROS
#ifdef __LP64__ #ifdef __LP64__
#define CONFIG_SYS_SUPPORT_64BIT_DATA #define CONFIG_SYS_SUPPORT_64BIT_DATA
#endif #endif

View File

@ -1,276 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 1997-2001, 2004, 2007 Free Software Foundation, Inc.
*
* This file is taken from the GNU C Library v2.15, with the unimplemented
* functions removed and a few style fixes.
*/
/*
* ISO C99: 7.8 Format conversion of integer types <inttypes.h>
*/
#ifndef _INTTYPES_H
#define _INTTYPES_H 1
#include <linux/compiler.h>
/* Get a definition for wchar_t. But we must not define wchar_t itself. */
#ifndef ____gwchar_t_defined
# ifdef __cplusplus
# define __gwchar_t wchar_t
# elif defined __WCHAR_TYPE__
typedef __WCHAR_TYPE__ __gwchar_t;
# else
# define __need_wchar_t
# include <stddef.h>
typedef wchar_t __gwchar_t;
# endif
# define ____gwchar_t_defined 1
#endif
/* The ISO C99 standard specifies that these macros must only be
defined if explicitly requested. */
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
/* linux/types.h always uses long long for 64-bit and long for uintptr_t */
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX "l"
/* Macros for printing format specifiers. */
/* Decimal notation. */
# define PRId8 "d"
# define PRId16 "d"
# define PRId32 "d"
# define PRId64 __PRI64_PREFIX "d"
# define PRIdLEAST8 "d"
# define PRIdLEAST16 "d"
# define PRIdLEAST32 "d"
# define PRIdLEAST64 __PRI64_PREFIX "d"
# define PRIdFAST8 "d"
# define PRIdFAST16 __PRIPTR_PREFIX "d"
# define PRIdFAST32 __PRIPTR_PREFIX "d"
# define PRIdFAST64 __PRI64_PREFIX "d"
# define PRIi8 "i"
# define PRIi16 "i"
# define PRIi32 "i"
# define PRIi64 __PRI64_PREFIX "i"
# define PRIiLEAST8 "i"
# define PRIiLEAST16 "i"
# define PRIiLEAST32 "i"
# define PRIiLEAST64 __PRI64_PREFIX "i"
# define PRIiFAST8 "i"
# define PRIiFAST16 __PRIPTR_PREFIX "i"
# define PRIiFAST32 __PRIPTR_PREFIX "i"
# define PRIiFAST64 __PRI64_PREFIX "i"
/* Octal notation. */
# define PRIo8 "o"
# define PRIo16 "o"
# define PRIo32 "o"
# define PRIo64 __PRI64_PREFIX "o"
# define PRIoLEAST8 "o"
# define PRIoLEAST16 "o"
# define PRIoLEAST32 "o"
# define PRIoLEAST64 __PRI64_PREFIX "o"
# define PRIoFAST8 "o"
# define PRIoFAST16 __PRIPTR_PREFIX "o"
# define PRIoFAST32 __PRIPTR_PREFIX "o"
# define PRIoFAST64 __PRI64_PREFIX "o"
/* Unsigned integers. */
# define PRIu8 "u"
# define PRIu16 "u"
# define PRIu32 "u"
# define PRIu64 __PRI64_PREFIX "u"
# define PRIuLEAST8 "u"
# define PRIuLEAST16 "u"
# define PRIuLEAST32 "u"
# define PRIuLEAST64 __PRI64_PREFIX "u"
# define PRIuFAST8 "u"
# define PRIuFAST16 __PRIPTR_PREFIX "u"
# define PRIuFAST32 __PRIPTR_PREFIX "u"
# define PRIuFAST64 __PRI64_PREFIX "u"
/* lowercase hexadecimal notation. */
# define PRIx8 "x"
# define PRIx16 "x"
# define PRIx32 "x"
# define PRIx64 __PRI64_PREFIX "x"
# define PRIxLEAST8 "x"
# define PRIxLEAST16 "x"
# define PRIxLEAST32 "x"
# define PRIxLEAST64 __PRI64_PREFIX "x"
# define PRIxFAST8 "x"
# define PRIxFAST16 __PRIPTR_PREFIX "x"
# define PRIxFAST32 __PRIPTR_PREFIX "x"
# define PRIxFAST64 __PRI64_PREFIX "x"
/* UPPERCASE hexadecimal notation. */
# define PRIX8 "X"
# define PRIX16 "X"
# define PRIX32 "X"
# define PRIX64 __PRI64_PREFIX "X"
# define PRIXLEAST8 "X"
# define PRIXLEAST16 "X"
# define PRIXLEAST32 "X"
# define PRIXLEAST64 __PRI64_PREFIX "X"
# define PRIXFAST8 "X"
# define PRIXFAST16 __PRIPTR_PREFIX "X"
# define PRIXFAST32 __PRIPTR_PREFIX "X"
# define PRIXFAST64 __PRI64_PREFIX "X"
/* Macros for printing `intmax_t' and `uintmax_t'. */
# define PRIdMAX __PRI64_PREFIX "d"
# define PRIiMAX __PRI64_PREFIX "i"
# define PRIoMAX __PRI64_PREFIX "o"
# define PRIuMAX __PRI64_PREFIX "u"
# define PRIxMAX __PRI64_PREFIX "x"
# define PRIXMAX __PRI64_PREFIX "X"
/* Macros for printing `intptr_t' and `uintptr_t'. */
# define PRIdPTR __PRIPTR_PREFIX "d"
# define PRIiPTR __PRIPTR_PREFIX "i"
# define PRIoPTR __PRIPTR_PREFIX "o"
# define PRIuPTR __PRIPTR_PREFIX "u"
# define PRIxPTR __PRIPTR_PREFIX "x"
# define PRIXPTR __PRIPTR_PREFIX "X"
/* Macros for scanning format specifiers. */
/* Signed decimal notation. */
# define SCNd8 "hhd"
# define SCNd16 "hd"
# define SCNd32 "d"
# define SCNd64 __PRI64_PREFIX "d"
# define SCNdLEAST8 "hhd"
# define SCNdLEAST16 "hd"
# define SCNdLEAST32 "d"
# define SCNdLEAST64 __PRI64_PREFIX "d"
# define SCNdFAST8 "hhd"
# define SCNdFAST16 __PRIPTR_PREFIX "d"
# define SCNdFAST32 __PRIPTR_PREFIX "d"
# define SCNdFAST64 __PRI64_PREFIX "d"
/* Signed decimal notation. */
# define SCNi8 "hhi"
# define SCNi16 "hi"
# define SCNi32 "i"
# define SCNi64 __PRI64_PREFIX "i"
# define SCNiLEAST8 "hhi"
# define SCNiLEAST16 "hi"
# define SCNiLEAST32 "i"
# define SCNiLEAST64 __PRI64_PREFIX "i"
# define SCNiFAST8 "hhi"
# define SCNiFAST16 __PRIPTR_PREFIX "i"
# define SCNiFAST32 __PRIPTR_PREFIX "i"
# define SCNiFAST64 __PRI64_PREFIX "i"
/* Unsigned decimal notation. */
# define SCNu8 "hhu"
# define SCNu16 "hu"
# define SCNu32 "u"
# define SCNu64 __PRI64_PREFIX "u"
# define SCNuLEAST8 "hhu"
# define SCNuLEAST16 "hu"
# define SCNuLEAST32 "u"
# define SCNuLEAST64 __PRI64_PREFIX "u"
# define SCNuFAST8 "hhu"
# define SCNuFAST16 __PRIPTR_PREFIX "u"
# define SCNuFAST32 __PRIPTR_PREFIX "u"
# define SCNuFAST64 __PRI64_PREFIX "u"
/* Octal notation. */
# define SCNo8 "hho"
# define SCNo16 "ho"
# define SCNo32 "o"
# define SCNo64 __PRI64_PREFIX "o"
# define SCNoLEAST8 "hho"
# define SCNoLEAST16 "ho"
# define SCNoLEAST32 "o"
# define SCNoLEAST64 __PRI64_PREFIX "o"
# define SCNoFAST8 "hho"
# define SCNoFAST16 __PRIPTR_PREFIX "o"
# define SCNoFAST32 __PRIPTR_PREFIX "o"
# define SCNoFAST64 __PRI64_PREFIX "o"
/* Hexadecimal notation. */
# define SCNx8 "hhx"
# define SCNx16 "hx"
# define SCNx32 "x"
# define SCNx64 __PRI64_PREFIX "x"
# define SCNxLEAST8 "hhx"
# define SCNxLEAST16 "hx"
# define SCNxLEAST32 "x"
# define SCNxLEAST64 __PRI64_PREFIX "x"
# define SCNxFAST8 "hhx"
# define SCNxFAST16 __PRIPTR_PREFIX "x"
# define SCNxFAST32 __PRIPTR_PREFIX "x"
# define SCNxFAST64 __PRI64_PREFIX "x"
/* Macros for scanning `intmax_t' and `uintmax_t'. */
# define SCNdMAX __PRI64_PREFIX "d"
# define SCNiMAX __PRI64_PREFIX "i"
# define SCNoMAX __PRI64_PREFIX "o"
# define SCNuMAX __PRI64_PREFIX "u"
# define SCNxMAX __PRI64_PREFIX "x"
/* Macros for scaning `intptr_t' and `uintptr_t'. */
# define SCNdPTR __PRIPTR_PREFIX "d"
# define SCNiPTR __PRIPTR_PREFIX "i"
# define SCNoPTR __PRIPTR_PREFIX "o"
# define SCNuPTR __PRIPTR_PREFIX "u"
# define SCNxPTR __PRIPTR_PREFIX "x"
#endif /* C++ && format macros */
#if __WORDSIZE == 64
/* We have to define the `uintmax_t' type using `ldiv_t'. */
typedef struct {
long int quot; /* Quotient. */
long int rem; /* Remainder. */
} imaxdiv_t;
#else
/* We have to define the `uintmax_t' type using `lldiv_t'. */
typedef struct {
long long int quot; /* Quotient. */
long long int rem; /* Remainder. */
} imaxdiv_t;
#endif
#endif /* inttypes.h */

View File

@ -7,7 +7,6 @@
#include <common.h> #include <common.h>
#include <console.h> #include <console.h>
#include <div64.h> #include <div64.h>
#include <inttypes.h>
#include <version.h> #include <version.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <asm/io.h> #include <asm/io.h>
@ -65,7 +64,7 @@ void print_freq(uint64_t freq, const char *s)
} }
if (!c) { if (!c) {
printf("%" PRIu64 " Hz%s", freq, s); printf("%llu Hz%s", freq, s);
return; return;
} }
@ -105,7 +104,7 @@ void print_size(uint64_t size, const char *s)
} }
if (!c) { if (!c) {
printf("%" PRIu64 " Bytes%s", size, s); printf("%llu Bytes%s", size, s);
return; return;
} }

View File

@ -13,7 +13,6 @@
#include <linux/libfdt_env.h> #include <linux/libfdt_env.h>
#include <u-boot/crc.h> #include <u-boot/crc.h>
#include <bootm.h> #include <bootm.h>
#include <inttypes.h>
#include <watchdog.h> #include <watchdog.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
@ -338,7 +337,7 @@ static efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory,
{ {
efi_status_t r; efi_status_t r;
EFI_ENTRY("%" PRIx64 ", 0x%zx", memory, pages); EFI_ENTRY("%llx, 0x%zx", memory, pages);
r = efi_free_pages(memory, pages); r = efi_free_pages(memory, pages);
return EFI_EXIT(r); return EFI_EXIT(r);
} }
@ -789,7 +788,7 @@ static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event,
enum efi_timer_delay type, enum efi_timer_delay type,
uint64_t trigger_time) uint64_t trigger_time)
{ {
EFI_ENTRY("%p, %d, %" PRIx64, event, type, trigger_time); EFI_ENTRY("%p, %d, %llx", event, type, trigger_time);
return EFI_EXIT(efi_set_timer(event, type, trigger_time)); return EFI_EXIT(efi_set_timer(event, type, trigger_time));
} }
@ -1961,7 +1960,7 @@ static efi_status_t EFIAPI efi_set_watchdog_timer(unsigned long timeout,
unsigned long data_size, unsigned long data_size,
uint16_t *watchdog_data) uint16_t *watchdog_data)
{ {
EFI_ENTRY("%ld, 0x%" PRIx64 ", %ld, %p", timeout, watchdog_code, EFI_ENTRY("%ld, 0x%llx, %ld, %p", timeout, watchdog_code,
data_size, watchdog_data); data_size, watchdog_data);
return EFI_EXIT(efi_set_watchdog(timeout)); return EFI_EXIT(efi_set_watchdog(timeout));
} }

View File

@ -13,7 +13,6 @@
#include <usb.h> #include <usb.h>
#include <mmc.h> #include <mmc.h>
#include <efi_loader.h> #include <efi_loader.h>
#include <inttypes.h>
#include <part.h> #include <part.h>
/* template END node: */ /* template END node: */

View File

@ -9,7 +9,6 @@
#include <blk.h> #include <blk.h>
#include <dm.h> #include <dm.h>
#include <efi_loader.h> #include <efi_loader.h>
#include <inttypes.h>
#include <part.h> #include <part.h>
#include <malloc.h> #include <malloc.h>
@ -66,7 +65,7 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this,
blocks = buffer_size / blksz; blocks = buffer_size / blksz;
lba += diskobj->offset; lba += diskobj->offset;
debug("EFI: %s:%d blocks=%x lba=%"PRIx64" blksz=%x dir=%d\n", __func__, debug("EFI: %s:%d blocks=%x lba=%llx blksz=%x dir=%d\n", __func__,
__LINE__, blocks, lba, blksz, direction); __LINE__, blocks, lba, blksz, direction);
/* We only support full block access */ /* We only support full block access */
@ -111,7 +110,7 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this,
real_buffer = efi_bounce_buffer; real_buffer = efi_bounce_buffer;
#endif #endif
EFI_ENTRY("%p, %x, %" PRIx64 ", %zx, %p", this, media_id, lba, EFI_ENTRY("%p, %x, %llx, %zx, %p", this, media_id, lba,
buffer_size, buffer); buffer_size, buffer);
r = efi_disk_rw_blocks(this, media_id, lba, buffer_size, real_buffer, r = efi_disk_rw_blocks(this, media_id, lba, buffer_size, real_buffer,
@ -146,7 +145,7 @@ static efi_status_t EFIAPI efi_disk_write_blocks(struct efi_block_io *this,
real_buffer = efi_bounce_buffer; real_buffer = efi_bounce_buffer;
#endif #endif
EFI_ENTRY("%p, %x, %" PRIx64 ", %zx, %p", this, media_id, lba, EFI_ENTRY("%p, %x, %llx, %zx, %p", this, media_id, lba,
buffer_size, buffer); buffer_size, buffer);
/* Populate bounce buffer if necessary */ /* Populate bounce buffer if necessary */

View File

@ -8,7 +8,6 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <efi_loader.h> #include <efi_loader.h>
#include <inttypes.h>
#include <lcd.h> #include <lcd.h>
#include <malloc.h> #include <malloc.h>
#include <video.h> #include <video.h>

View File

@ -7,7 +7,6 @@
#include <common.h> #include <common.h>
#include <efi_loader.h> #include <efi_loader.h>
#include <inttypes.h>
#include <malloc.h> #include <malloc.h>
#include <mapmem.h> #include <mapmem.h>
#include <watchdog.h> #include <watchdog.h>
@ -159,7 +158,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
bool carve_again; bool carve_again;
uint64_t carved_pages = 0; uint64_t carved_pages = 0;
debug("%s: 0x%" PRIx64 " 0x%" PRIx64 " %d %s\n", __func__, debug("%s: 0x%llx 0x%llx %d %s\n", __func__,
start, pages, memory_type, overlap_only_ram ? "yes" : "no"); start, pages, memory_type, overlap_only_ram ? "yes" : "no");
if (memory_type >= EFI_MAX_MEMORY_TYPE) if (memory_type >= EFI_MAX_MEMORY_TYPE)

View File

@ -7,7 +7,6 @@
#include <common.h> #include <common.h>
#include <efi_loader.h> #include <efi_loader.h>
#include <inttypes.h>
#include <lcd.h> #include <lcd.h>
#include <malloc.h> #include <malloc.h>

View File

@ -7,7 +7,6 @@
#include <common.h> #include <common.h>
#include <efi_loader.h> #include <efi_loader.h>
#include <inttypes.h>
#include <smbios.h> #include <smbios.h>
static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID; static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;

View File

@ -11,7 +11,6 @@
#include <errno.h> #include <errno.h>
#include <fdtdec.h> #include <fdtdec.h>
#include <fdt_support.h> #include <fdt_support.h>
#include <inttypes.h>
#include <linux/libfdt.h> #include <linux/libfdt.h>
#include <serial.h> #include <serial.h>
#include <asm/sections.h> #include <asm/sections.h>
@ -1448,13 +1447,12 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
if (auto_size) { if (auto_size) {
u64 new_size; u64 new_size;
debug("Auto-sizing %" PRIx64 ", size %" PRIx64 ": ", debug("Auto-sizing %llx, size %llx: ", addr, size);
addr, size);
new_size = get_ram_size((long *)(uintptr_t)addr, size); new_size = get_ram_size((long *)(uintptr_t)addr, size);
if (new_size == size) { if (new_size == size) {
debug("OK\n"); debug("OK\n");
} else { } else {
debug("sized to %" PRIx64 "\n", new_size); debug("sized to %llx\n", new_size);
size = new_size; size = new_size;
} }
} }
@ -1464,7 +1462,7 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
total_size += size; total_size += size;
} }
debug("Memory size %" PRIu64 "\n", total_size); debug("Memory size %llu\n", total_size);
if (sizep) if (sizep)
*sizep = (phys_size_t)total_size; *sizep = (phys_size_t)total_size;

View File

@ -1,5 +1,4 @@
#include <common.h> #include <common.h>
#include <inttypes.h>
int test_types(void) int test_types(void)
{ {
@ -7,7 +6,7 @@ int test_types(void)
uint64_t uint64 = 0; uint64_t uint64 = 0;
u64 u64_val = 0; u64 u64_val = 0;
printf("uintptr = %" PRIuPTR "\n", uintptr); printf("uintptr = %lu\n", uintptr);
printf("uint64 = %" PRIu64 "\n", uint64); printf("uint64 = %llu\n", uint64);
printf("u64 = %" PRIu64 "\n", u64_val); printf("u64 = %llu\n", u64_val);
} }