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>
This commit is contained in:
Julius Werner 2019-11-13 19:50:33 -08:00 committed by Patrick Georgi
parent 85b41445b5
commit a2148377b5
15 changed files with 32 additions and 26 deletions

View File

@ -14,8 +14,7 @@
#ifndef ARCH_CPU_H #ifndef ARCH_CPU_H
#define ARCH_CPU_H #define ARCH_CPU_H
#include <stdint.h> #include <types.h>
#include <stddef.h>
/* /*
* EFLAGS bits * EFLAGS bits

View File

@ -7,7 +7,7 @@
#ifndef __VPD_H__ #ifndef __VPD_H__
#define __VPD_H__ #define __VPD_H__
#include <stdint.h> #include <types.h>
#define GOOGLE_VPD_2_0_OFFSET 0x600 #define GOOGLE_VPD_2_0_OFFSET 0x600

View File

@ -17,8 +17,7 @@
#ifndef _EC_GOOGLE_CHROMEEC_EC_H #ifndef _EC_GOOGLE_CHROMEEC_EC_H
#define _EC_GOOGLE_CHROMEEC_EC_H #define _EC_GOOGLE_CHROMEEC_EC_H
#include <stddef.h> #include <types.h>
#include <stdint.h>
#include "ec_commands.h" #include "ec_commands.h"
/* Fill in base and size of the IO port resources used. */ /* Fill in base and size of the IO port resources used. */

View File

@ -16,9 +16,9 @@
#ifndef BOOTMEM_H #ifndef BOOTMEM_H
#define BOOTMEM_H #define BOOTMEM_H
#include <memrange.h>
#include <stdint.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#include <memrange.h>
#include <types.h>
/** /**
* Bootmem types match to LB_MEM tags, except for the following: * Bootmem types match to LB_MEM tags, except for the following:

View File

@ -17,7 +17,7 @@
#ifndef _CONSOLE_USB_H_ #ifndef _CONSOLE_USB_H_
#define _CONSOLE_USB_H_ #define _CONSOLE_USB_H_
#include <stdint.h> #include <types.h>
void usbdebug_init(void); void usbdebug_init(void);
int usbdebug_hw_init(bool force); int usbdebug_hw_init(bool force);

View File

@ -9,11 +9,10 @@
*/ */
#if !defined(__ROMCC__) #if !defined(__ROMCC__)
#include <stdint.h>
#include <stddef.h>
#include <device/resource.h> #include <device/resource.h>
#include <device/path.h> #include <device/path.h>
#include <device/pci_type.h> #include <device/pci_type.h>
#include <types.h>
struct device; struct device;
struct pci_operations; struct pci_operations;

16
src/include/stdbool.h Normal file
View File

@ -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__ */

View File

@ -101,13 +101,4 @@ typedef uint64_t u64;
#define UINTMAX_MAX UINT64_MAX #define UINTMAX_MAX UINT64_MAX
#endif #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 */ #endif /* STDINT_H */

View File

@ -16,7 +16,8 @@
#ifndef __TYPES_H #ifndef __TYPES_H
#define __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 <stdint.h>
#include <stddef.h> #include <stddef.h>

View File

@ -19,6 +19,7 @@
#include <imd.h> #include <imd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <types.h>
/* For more details on implementation and usage please see the imd.h header. */ /* For more details on implementation and usage please see the imd.h header. */

View File

@ -14,7 +14,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <stdint.h> #include <types.h>
#include "memory.h" #include "memory.h"
/** /**

View File

@ -17,8 +17,7 @@
#ifndef SOC_INTEL_COMMON_BLOCK_CPULIB_H #ifndef SOC_INTEL_COMMON_BLOCK_CPULIB_H
#define SOC_INTEL_COMMON_BLOCK_CPULIB_H #define SOC_INTEL_COMMON_BLOCK_CPULIB_H
#include <stdint.h> #include <types.h>
#include <stddef.h>
/* /*
* Set PERF_CTL MSR (0x199) P_Req with * Set PERF_CTL MSR (0x199) P_Req with

View File

@ -16,8 +16,7 @@
#ifndef SOC_INTEL_COMMON_BLOCK_FAST_SPI_H #ifndef SOC_INTEL_COMMON_BLOCK_FAST_SPI_H
#define SOC_INTEL_COMMON_BLOCK_FAST_SPI_H #define SOC_INTEL_COMMON_BLOCK_FAST_SPI_H
#include <stdint.h> #include <types.h>
#include <stddef.h>
/* /*
* Disable the BIOS write protect and Enable Prefetching and Caching. * Disable the BIOS write protect and Enable Prefetching and Caching.

View File

@ -20,7 +20,7 @@
#define PCR_PORTID_SHIFT 16 #define PCR_PORTID_SHIFT 16
#if !defined(__ACPI__) #if !defined(__ACPI__)
#include <stdint.h> #include <types.h>
uint32_t pcr_read32(uint8_t pid, uint16_t offset); uint32_t pcr_read32(uint8_t pid, uint16_t offset);
uint16_t pcr_read16(uint8_t pid, uint16_t offset); uint16_t pcr_read16(uint8_t pid, uint16_t offset);

View File

@ -16,6 +16,8 @@
#ifndef __SOC_MEDIATEK_MT6358_H__ #ifndef __SOC_MEDIATEK_MT6358_H__
#define __SOC_MEDIATEK_MT6358_H__ #define __SOC_MEDIATEK_MT6358_H__
#include <types.h>
enum { enum {
PMIC_SWCID = 0x000a, PMIC_SWCID = 0x000a,
PMIC_VM_MODE = 0x004e, PMIC_VM_MODE = 0x004e,