Hello Patrick Georgi,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/36837
to review the following change.
Change subject: include: Make stdbool.h a separate file ......................................................................
include: Make stdbool.h a separate file
This patch moves the traditional POSIX stdbool.h definitions out from stdint.h into their own file. This helps for using these definitions in commonlib code which may be compiled in different environments. For coreboot everything should chain-include this stuff via types.h anyway so nothing should change.
Change-Id: Ic8d52be80b64d8e9564f3aee8975cb25e4c187f5 Signed-off-by: Julius Werner jwerner@chromium.org --- A src/include/stdbool.h M src/include/stdint.h M src/include/types.h 3 files changed, 16 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/36837/1
diff --git a/src/include/stdbool.h b/src/include/stdbool.h new file mode 100644 index 0000000..ce45686 --- /dev/null +++ b/src/include/stdbool.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __STDBOOL_H__ +#define __STDBOOL_H__ + +#ifdef __ROMCC__ +typedef uint8_t bool; +#else +typedef _Bool bool; +#endif +#define true 1 +#define false 0 + +#endif /* __STDBOOL_H__ */ diff --git a/src/include/stdint.h b/src/include/stdint.h index 0a8e153..67b0b0b 100644 --- a/src/include/stdint.h +++ b/src/include/stdint.h @@ -101,13 +101,4 @@ #define UINTMAX_MAX UINT64_MAX #endif
-/* TODO: move into stdbool.h */ -#ifdef __ROMCC__ -typedef uint8_t bool; -#else -typedef _Bool bool; -#endif -#define true 1 -#define false 0 - #endif /* STDINT_H */ diff --git a/src/include/types.h b/src/include/types.h index 5902bc2..30f243f 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -16,7 +16,8 @@ #ifndef __TYPES_H #define __TYPES_H
-/* types.h is supposed to provide stdint and stddef defined in here: */ +/* types.h is supposed to provide the standard headers defined in here: */ +#include <stdbool.h> #include <stdint.h> #include <stddef.h>
Hello build bot (Jenkins), Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36837
to look at the new patch set (#2).
Change subject: include: Make stdbool.h a separate file ......................................................................
include: Make stdbool.h a separate file
This patch moves the traditional POSIX stdbool.h definitions out from stdint.h into their own file. This helps for using these definitions in commonlib code which may be compiled in different environments. For coreboot everything should chain-include this stuff via types.h anyway so nothing should change.
Change-Id: Ic8d52be80b64d8e9564f3aee8975cb25e4c187f5 Signed-off-by: Julius Werner jwerner@chromium.org --- M src/arch/x86/include/arch/cpu.h M src/drivers/vpd/vpd.h M src/ec/google/chromeec/ec.h M src/include/bootmem.h M src/include/console/usb.h M src/include/device/device.h A src/include/stdbool.h M src/include/stdint.h M src/include/types.h M src/lib/imd.c M src/security/memory/memory.c M src/soc/intel/common/block/include/intelblocks/cpulib.h M src/soc/intel/common/block/include/intelblocks/fast_spi.h M src/soc/intel/common/block/include/intelblocks/pcr.h 14 files changed, 28 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/36837/2
Hello Patrick Rudolph, build bot (Jenkins), Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36837
to look at the new patch set (#3).
Change subject: include: Make stdbool.h a separate file ......................................................................
include: Make stdbool.h a separate file
This patch moves the traditional POSIX stdbool.h definitions out from stdint.h into their own file. This helps for using these definitions in commonlib code which may be compiled in different environments. For coreboot everything should chain-include this stuff via types.h anyway so nothing should change.
Change-Id: Ic8d52be80b64d8e9564f3aee8975cb25e4c187f5 Signed-off-by: Julius Werner jwerner@chromium.org --- M src/arch/x86/include/arch/cpu.h M src/drivers/vpd/vpd.h M src/ec/google/chromeec/ec.h M src/include/bootmem.h M src/include/console/usb.h M src/include/device/device.h A src/include/stdbool.h M src/include/stdint.h M src/include/types.h M src/lib/imd.c M src/security/memory/memory.c M src/soc/intel/common/block/include/intelblocks/cpulib.h M src/soc/intel/common/block/include/intelblocks/fast_spi.h M src/soc/intel/common/block/include/intelblocks/pcr.h M src/soc/mediatek/mt8183/include/soc/mt6358.h 15 files changed, 32 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/36837/3
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36837 )
Change subject: include: Make stdbool.h a separate file ......................................................................
Patch Set 3: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/36837 )
Change subject: include: Make stdbool.h a separate file ......................................................................
include: Make stdbool.h a separate file
This patch moves the traditional POSIX stdbool.h definitions out from stdint.h into their own file. This helps for using these definitions in commonlib code which may be compiled in different environments. For coreboot everything should chain-include this stuff via types.h anyway so nothing should change.
Change-Id: Ic8d52be80b64d8e9564f3aee8975cb25e4c187f5 Signed-off-by: Julius Werner jwerner@chromium.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/36837 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M src/arch/x86/include/arch/cpu.h M src/drivers/vpd/vpd.h M src/ec/google/chromeec/ec.h M src/include/bootmem.h M src/include/console/usb.h M src/include/device/device.h A src/include/stdbool.h M src/include/stdint.h M src/include/types.h M src/lib/imd.c M src/security/memory/memory.c M src/soc/intel/common/block/include/intelblocks/cpulib.h M src/soc/intel/common/block/include/intelblocks/fast_spi.h M src/soc/intel/common/block/include/intelblocks/pcr.h M src/soc/mediatek/mt8183/include/soc/mt6358.h 15 files changed, 32 insertions(+), 26 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 9133f53..d74d6de 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -14,8 +14,7 @@ #ifndef ARCH_CPU_H #define ARCH_CPU_H
-#include <stdint.h> -#include <stddef.h> +#include <types.h>
/* * EFLAGS bits diff --git a/src/drivers/vpd/vpd.h b/src/drivers/vpd/vpd.h index 244a7be..1bae513 100644 --- a/src/drivers/vpd/vpd.h +++ b/src/drivers/vpd/vpd.h @@ -7,7 +7,7 @@ #ifndef __VPD_H__ #define __VPD_H__
-#include <stdint.h> +#include <types.h>
#define GOOGLE_VPD_2_0_OFFSET 0x600
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 9fb9c39..5ef4366 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -17,8 +17,7 @@
#ifndef _EC_GOOGLE_CHROMEEC_EC_H #define _EC_GOOGLE_CHROMEEC_EC_H -#include <stddef.h> -#include <stdint.h> +#include <types.h> #include "ec_commands.h"
/* Fill in base and size of the IO port resources used. */ diff --git a/src/include/bootmem.h b/src/include/bootmem.h index 2e33fcd..53e2d0f 100644 --- a/src/include/bootmem.h +++ b/src/include/bootmem.h @@ -16,9 +16,9 @@ #ifndef BOOTMEM_H #define BOOTMEM_H
-#include <memrange.h> -#include <stdint.h> #include <boot/coreboot_tables.h> +#include <memrange.h> +#include <types.h>
/** * Bootmem types match to LB_MEM tags, except for the following: diff --git a/src/include/console/usb.h b/src/include/console/usb.h index 33edbf6..ad57d52 100644 --- a/src/include/console/usb.h +++ b/src/include/console/usb.h @@ -17,7 +17,7 @@ #ifndef _CONSOLE_USB_H_ #define _CONSOLE_USB_H_
-#include <stdint.h> +#include <types.h>
void usbdebug_init(void); int usbdebug_hw_init(bool force); diff --git a/src/include/device/device.h b/src/include/device/device.h index 405d816e..b1c1651 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -9,11 +9,10 @@ */ #if !defined(__ROMCC__)
-#include <stdint.h> -#include <stddef.h> #include <device/resource.h> #include <device/path.h> #include <device/pci_type.h> +#include <types.h>
struct device; struct pci_operations; diff --git a/src/include/stdbool.h b/src/include/stdbool.h new file mode 100644 index 0000000..2eeb70e --- /dev/null +++ b/src/include/stdbool.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __STDBOOL_H__ +#define __STDBOOL_H__ + +#include <stdint.h> + +#ifdef __ROMCC__ +typedef uint8_t bool; +#else +typedef _Bool bool; +#endif +#define true 1 +#define false 0 + +#endif /* __STDBOOL_H__ */ diff --git a/src/include/stdint.h b/src/include/stdint.h index 0a8e153..67b0b0b 100644 --- a/src/include/stdint.h +++ b/src/include/stdint.h @@ -101,13 +101,4 @@ #define UINTMAX_MAX UINT64_MAX #endif
-/* TODO: move into stdbool.h */ -#ifdef __ROMCC__ -typedef uint8_t bool; -#else -typedef _Bool bool; -#endif -#define true 1 -#define false 0 - #endif /* STDINT_H */ diff --git a/src/include/types.h b/src/include/types.h index 5902bc2..30f243f 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -16,7 +16,8 @@ #ifndef __TYPES_H #define __TYPES_H
-/* types.h is supposed to provide stdint and stddef defined in here: */ +/* types.h is supposed to provide the standard headers defined in here: */ +#include <stdbool.h> #include <stdint.h> #include <stddef.h>
diff --git a/src/lib/imd.c b/src/lib/imd.c index 17ec2d9..b5fc34a 100644 --- a/src/lib/imd.c +++ b/src/lib/imd.c @@ -19,6 +19,7 @@ #include <imd.h> #include <stdlib.h> #include <string.h> +#include <types.h>
/* For more details on implementation and usage please see the imd.h header. */
diff --git a/src/security/memory/memory.c b/src/security/memory/memory.c index 14f2857..c815236 100644 --- a/src/security/memory/memory.c +++ b/src/security/memory/memory.c @@ -14,7 +14,7 @@ * GNU General Public License for more details. */
-#include <stdint.h> +#include <types.h> #include "memory.h"
/** diff --git a/src/soc/intel/common/block/include/intelblocks/cpulib.h b/src/soc/intel/common/block/include/intelblocks/cpulib.h index a422094..84e750e 100644 --- a/src/soc/intel/common/block/include/intelblocks/cpulib.h +++ b/src/soc/intel/common/block/include/intelblocks/cpulib.h @@ -17,8 +17,7 @@ #ifndef SOC_INTEL_COMMON_BLOCK_CPULIB_H #define SOC_INTEL_COMMON_BLOCK_CPULIB_H
-#include <stdint.h> -#include <stddef.h> +#include <types.h>
/* * Set PERF_CTL MSR (0x199) P_Req with diff --git a/src/soc/intel/common/block/include/intelblocks/fast_spi.h b/src/soc/intel/common/block/include/intelblocks/fast_spi.h index 6499ca5..e0e6649 100644 --- a/src/soc/intel/common/block/include/intelblocks/fast_spi.h +++ b/src/soc/intel/common/block/include/intelblocks/fast_spi.h @@ -16,8 +16,7 @@ #ifndef SOC_INTEL_COMMON_BLOCK_FAST_SPI_H #define SOC_INTEL_COMMON_BLOCK_FAST_SPI_H
-#include <stdint.h> -#include <stddef.h> +#include <types.h>
/* * Disable the BIOS write protect and Enable Prefetching and Caching. diff --git a/src/soc/intel/common/block/include/intelblocks/pcr.h b/src/soc/intel/common/block/include/intelblocks/pcr.h index c3af2fd..c6554a3 100644 --- a/src/soc/intel/common/block/include/intelblocks/pcr.h +++ b/src/soc/intel/common/block/include/intelblocks/pcr.h @@ -20,7 +20,7 @@ #define PCR_PORTID_SHIFT 16
#if !defined(__ACPI__) -#include <stdint.h> +#include <types.h>
uint32_t pcr_read32(uint8_t pid, uint16_t offset); uint16_t pcr_read16(uint8_t pid, uint16_t offset); diff --git a/src/soc/mediatek/mt8183/include/soc/mt6358.h b/src/soc/mediatek/mt8183/include/soc/mt6358.h index 6b74695..1c3e563 100644 --- a/src/soc/mediatek/mt8183/include/soc/mt6358.h +++ b/src/soc/mediatek/mt8183/include/soc/mt6358.h @@ -16,6 +16,8 @@ #ifndef __SOC_MEDIATEK_MT6358_H__ #define __SOC_MEDIATEK_MT6358_H__
+#include <types.h> + enum { PMIC_SWCID = 0x000a, PMIC_VM_MODE = 0x004e,