blob: 683c97dd512f35818b00f2c5e4b1420fbfe12f1c [file] [log] [blame]
Bo Lv72d0e902023-01-02 14:27:34 +00001/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2/*
3 * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
4 */
5
6#ifndef _PARTITION_TABLE_H
7#define _PARTITION_TABLE_H
8// #ifdef CONFIG_STORE_COMPATIBLE
9#include <amlogic/emmc_storage.h>
10#include <amlogic/storage.h>
11// #endif
12//#include <asm/arch/nand.h>
13//#include <asm/arch/poc.h>
14
15
16#define STORE_DBG
17#ifdef STORE_DBG
18#define store_dbg(fmt, ...) printk( "%s: line:%d " fmt "\n", \
19 __func__, __LINE__, ##__VA_ARGS__)
20
21#define store_msg(fmt, ...) printk( "%s: line:%d " fmt "\n", \
22 __func__, __LINE__, ##__VA_ARGS__)
23#else
24#define store_dbg(fmt, ...)
25#define store_msg(fmt, ...) printk( fmt "\n", ##__VA_ARGS__)
26#endif
27
28//boot_flag
29//#define R_BOOT_DEVICE_FLAG READ_CBUS_REG(ASSIST_POR_CONFIG)
30
31//#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8
32//#define POR_BOOT_VALUE ((((R_BOOT_DEVICE_FLAG>>9)&1)<<2)|((R_BOOT_DEVICE_FLAG>>6)&3))
33//#else
34//#define POR_BOOT_VALUE (R_BOOT_DEVICE_FLAG & 7)
35//#endif
36
37//#if 1 /*defined in poc.h*/
38//#define POR_NAND_BOOT() ((POR_BOOT_VALUE == 7) || (POR_BOOT_VALUE == 6))
39//#define POR_SPI_BOOT() ((POR_BOOT_VALUE == 5) || (POR_BOOT_VALUE == 4))
40//#define POR_EMMC_BOOT() ((IS_MESON_M8M2_CPU | IS_MESON_M8BABY_CPU)?((POR_BOOT_VALUE == 3) || ((POR_BOOT_VALUE == 1))):(POR_BOOT_VALUE == 3))
41//#define POR_CARD_BOOT() (POR_BOOT_VALUE == 0)
42//#endif
43
44#define SPI_BOOT_FLAG 0
45#define NAND_BOOT_FLAG 1
46#define EMMC_BOOT_FLAG 2
47#define CARD_BOOT_FLAG 3
48#define SPI_NAND_FLAG 4
49#define SPI_EMMC_FLAG 5
50
51#define _AML_DEVICE_BOOT_FLAG_DEFAULT (0XFFFFFFFF)
52
53#define START_ADDR 0xd9000200
54#define TABLE_MAGIC_NAME "part"
55#define STORE_MAGIC_NAME "stor"
56#define ACS_SET_LEN 128
57
58extern int info_disprotect;
59
60extern int has_boot_slot;
61extern int has_system_slot;
62extern bool dynamic_partition;
63extern bool vendor_boot_partition;
64extern bool gpt_partition;
65
66extern int get_partition_from_dts(unsigned char * buffer);
67
68extern int get_partitions_table(struct partitions **table);
69
70#define AML_DTB_IMG_MAX_SZ ((256<<10) - 512)
71extern struct partitions *get_partitions(void);
72
73extern int get_partition_count(void);
74extern void free_partitions(void);
75/* only nand&emmc for gxb and later soc */
76
77#endif// #ifndef _PARTITION_TABLE_H
78