include/bcd: move bcd code to commonlib/bsd/include

Move bcd2bin() / bin2bcd() functions to commonlib/bsd/include/

Also, the license is changed from GPL to BSD.
This is because it is needed from "utils" (see CL in the chain).

For reference bin2bcd() & bcd2bin() are very simple functions.
There are already BSD implementations, like these ones (just to
name a few):
https://chromium.googlesource.com/chromiumos/platform/mosys/+/refs/heads/main/include/lib/math.h#67
http://web.mit.edu/freebsd/head/sys/contrib/octeon-sdk/cvmx-cn3010-evb-hs5.c

BUG=b:172210863
TEST=make (everything compiled Ok).

Change-Id: If2eba82da35838799bcbcf38303de6bd53f7eb72
Signed-off-by: Ricardo Quesada <ricardoq@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56904
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Ricardo Quesada 2021-08-10 17:10:14 -07:00 committed by Felix Held
parent c8f926adda
commit 954df3d6bf
10 changed files with 16 additions and 16 deletions

View file

@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef _BCD_H_
#define _BCD_H_

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <bcd.h>
#include <commonlib/bsd/bcd.h>
#include <device/i2c_simple.h>
#include <rtc.h>
#include <stdint.h>

View file

@ -1,10 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <bcd.h>
#include <boot_device.h>
#include <bootstate.h>
#include <cbmem.h>
#include <commonlib/bsd/bcd.h>
#include <commonlib/bsd/elog.h>
#include <commonlib/region.h>
#include <console/console.h>

View file

@ -1,9 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <device/smbus.h>
#include <version.h>
#include <console/console.h>
#include <bcd.h>
#include "chip.h"
/* Set RTC date from coreboot build date. */

View file

@ -2,13 +2,13 @@
#include <acpi/acpi_device.h>
#include <acpi/acpigen.h>
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <device/device.h>
#include <device/i2c.h>
#include <device/i2c_bus.h>
#include <version.h>
#include <console/console.h>
#include <bcd.h>
#include <timer.h>
#include <version.h>
#include "chip.h"
#include "rx6110sa.h"

View file

@ -2,15 +2,15 @@
#include <acpi/acpi.h>
#include <arch/io.h>
#include <bcd.h>
#include <fallback.h>
#include <version.h>
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <fallback.h>
#include <pc80/mc146818rtc.h>
#include <rtc.h>
#include <security/vboot/vbnv.h>
#include <security/vboot/vbnv_layout.h>
#include <types.h>
#include <version.h>
static void cmos_reset_date(void)
{

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <bcd.h>
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <device/i2c_simple.h>
#include <rtc.h>

View file

@ -3,10 +3,10 @@
#ifndef _CPER_H_
#define _CPER_H_
#include <commonlib/bsd/bcd.h>
#include <rtc.h>
#include <types.h>
#include <uuid.h>
#include <bcd.h>
#include <rtc.h>
/* This file contains some definitions and helpers for implementing structures
* in the UEFI specification, Appendix "Common Platform Error Record". This

View file

@ -3,7 +3,7 @@
#ifndef SOC_MEDIATEK_RTC_COMMON_H
#define SOC_MEDIATEK_RTC_COMMON_H
#include <bcd.h>
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <rtc.h>
#include <stdbool.h>

View file

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <assert.h>
#include <bcd.h>
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <delay.h>
#include <device/i2c_simple.h>