162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _PPC_BOOT_PLANETCORE_H_
362306a36Sopenharmony_ci#define _PPC_BOOT_PLANETCORE_H_
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include "types.h"
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#define PLANETCORE_KEY_BOARD_TYPE   "BO"
862306a36Sopenharmony_ci#define PLANETCORE_KEY_BOARD_REV    "BR"
962306a36Sopenharmony_ci#define PLANETCORE_KEY_MB_RAM       "D1"
1062306a36Sopenharmony_ci#define PLANETCORE_KEY_MAC_ADDR     "EA"
1162306a36Sopenharmony_ci#define PLANETCORE_KEY_FLASH_SPEED  "FS"
1262306a36Sopenharmony_ci#define PLANETCORE_KEY_IP_ADDR      "IP"
1362306a36Sopenharmony_ci#define PLANETCORE_KEY_KB_NVRAM     "NV"
1462306a36Sopenharmony_ci#define PLANETCORE_KEY_PROCESSOR    "PR"
1562306a36Sopenharmony_ci#define PLANETCORE_KEY_PROC_VARIANT "PV"
1662306a36Sopenharmony_ci#define PLANETCORE_KEY_SERIAL_BAUD  "SB"
1762306a36Sopenharmony_ci#define PLANETCORE_KEY_SERIAL_PORT  "SP"
1862306a36Sopenharmony_ci#define PLANETCORE_KEY_SWITCH       "SW"
1962306a36Sopenharmony_ci#define PLANETCORE_KEY_TEMP_OFFSET  "TC"
2062306a36Sopenharmony_ci#define PLANETCORE_KEY_TARGET_IP    "TIP"
2162306a36Sopenharmony_ci#define PLANETCORE_KEY_CRYSTAL_HZ   "XT"
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/* Prepare the table for processing, by turning all newlines
2462306a36Sopenharmony_ci * into NULL bytes.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_civoid planetcore_prepare_table(char *table);
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/* Return the value associated with a given key in text,
2962306a36Sopenharmony_ci * decimal, or hex format.
3062306a36Sopenharmony_ci *
3162306a36Sopenharmony_ci * Returns zero/NULL on failure, non-zero on success.
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ciconst char *planetcore_get_key(const char *table, const char *key);
3462306a36Sopenharmony_ciint planetcore_get_decimal(const char *table, const char *key, u64 *val);
3562306a36Sopenharmony_ciint planetcore_get_hex(const char *table, const char *key, u64 *val);
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* Updates the device tree local-mac-address properties based
3862306a36Sopenharmony_ci * on the EA tag.
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_civoid planetcore_set_mac_addrs(const char *table);
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/* Sets the linux,stdout-path in the /chosen node.  This requires the
4362306a36Sopenharmony_ci * linux,planetcore-label property in each serial node.
4462306a36Sopenharmony_ci */
4562306a36Sopenharmony_civoid planetcore_set_stdout_path(const char *table);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#endif
48