Drivers: Support Open Firmware API and model of PIC

We support OFW API to replace fdt old API, and add
IRQ, IO, Platform-Bus, CPUs ... OFW node contorl.
To support work with Device Tree or ACPI in drivers
that use IRQ, we make a programmable interrupt
controller driver's model.

Signed-off-by: GuEe-GUI <GuEe-GUI@github.com>
This commit is contained in:
wusongjie
2023-07-05 13:50:18 +08:00
parent 950d71e1ac
commit 8aa4366cb2
76 changed files with 12204 additions and 5 deletions

View File

@@ -347,6 +347,7 @@ CONFIG_RT_LWIP_USING_PING=y
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -219,6 +219,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -275,6 +275,7 @@ CONFIG_RT_USING_POSIX_PIPE_SIZE=512
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -162,6 +162,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -266,6 +266,7 @@ CONFIG_RT_USING_POSIX_PIPE_SIZE=512
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
CONFIG_RT_USING_RESOURCE_ID=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -149,6 +149,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
#define RT_USING_RESOURCE_ID
/* RT-Thread Utestcases */

View File

@@ -256,6 +256,7 @@ CONFIG_RT_USING_POSIX_TIMER=y
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
CONFIG_RT_USING_RESOURCE_ID=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -140,6 +140,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
#define RT_USING_RESOURCE_ID
/* RT-Thread Utestcases */

View File

@@ -364,6 +364,7 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -209,6 +209,7 @@
#define ULOG_OUTPUT_TAG
#define ULOG_BACKEND_USING_CONSOLE
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -414,6 +414,7 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -267,6 +267,7 @@
#define ULOG_OUTPUT_TAG
#define ULOG_BACKEND_USING_CONSOLE
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -228,6 +228,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -113,6 +113,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -398,6 +398,7 @@ CONFIG_UTEST_THR_STACK_SIZE=4096
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -386,6 +386,7 @@ CONFIG_UTEST_THR_STACK_SIZE=4096
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -404,6 +404,7 @@ CONFIG_UTEST_THR_STACK_SIZE=4096
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -398,6 +398,7 @@ CONFIG_UTEST_THR_STACK_SIZE=4096
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -399,6 +399,7 @@ CONFIG_UTEST_THR_STACK_SIZE=4096
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -272,6 +272,7 @@ CONFIG_UTEST_THR_STACK_SIZE=4096
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -164,6 +164,7 @@
#define UTEST_THR_STACK_SIZE 4096
#define UTEST_THR_PRIORITY 20
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -252,6 +252,7 @@ CONFIG_YMODEM_USING_FILE_TRANSFER=y
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -143,6 +143,7 @@
#define RT_USING_RYM
#define YMODEM_USING_FILE_TRANSFER
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -289,6 +289,7 @@ CONFIG_RT_USING_POSIX_MESSAGE_SEMAPHORE=y
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -181,6 +181,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -277,6 +277,7 @@ CONFIG_RT_USING_POSIX_PIPE_SIZE=512
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -171,6 +171,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -349,6 +349,7 @@ CONFIG_UTEST_THR_STACK_SIZE=4096
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -223,6 +223,7 @@
#define UTEST_THR_STACK_SIZE 4096
#define UTEST_THR_PRIORITY 20
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -218,6 +218,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -107,6 +107,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -260,6 +260,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -138,6 +138,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -265,6 +265,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -148,6 +148,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -350,6 +350,7 @@ CONFIG_RT_LWIP_USING_PING=y
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -204,6 +204,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -357,6 +357,7 @@ CONFIG_UTEST_THR_STACK_SIZE=8192
CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -227,6 +227,7 @@
#define UTEST_THR_STACK_SIZE 8192
#define UTEST_THR_PRIORITY 20
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -216,6 +216,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
CONFIG_RT_USING_ADT=y
CONFIG_RT_USING_ADT_AVL=y
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set

View File

@@ -113,6 +113,7 @@
/* Utilities */
#define RT_USING_ADT
#define RT_USING_ADT_AVL
/* RT-Thread Utestcases */

View File

@@ -773,6 +773,9 @@ menuconfig RT_USING_VIRTIO
default y
endif
source "$RTT_DIR/components/drivers/ofw/Kconfig"
source "$RTT_DIR/components/drivers/pic/Kconfig"
menu "Using USB"
config RT_USING_USB
bool

View File

@@ -0,0 +1,433 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-08-25 GuEe-GUI first version
*/
#ifndef __OFW_H__
#define __OFW_H__
#include <rtthread.h>
#include <ref.h>
#include <bitmap.h>
#include <libfdt/libfdt.h>
typedef rt_uint32_t rt_phandle;
struct rt_ofw_prop
{
const char *name;
int length;
void *value;
struct rt_ofw_prop *next;
};
struct rt_ofw_node
{
const char *name;
/* full_name is 'path/tag' or 'path/tag@reg' */
const char *full_name;
/* phandles range from 1 to 2^32-2 (0xfffffffe) */
rt_phandle phandle;
struct rt_ofw_prop *props;
struct rt_ofw_node *parent;
struct rt_ofw_node *child;
struct rt_ofw_node *sibling;
struct rt_ref ref;
#define RT_OFW_F_SYSTEM 0 /* node is system node */
#define RT_OFW_F_READLY 1 /* node has driver */
#define RT_OFW_F_PLATFORM 2 /* node is platform device */
#define RT_OFW_F_OVERLAY 3 /* node is from overlay */
rt_bitmap_t flags;
/* RT-Thread object prototype */
void *rt_data;
};
#define RT_OFW_MAX_CELL_ARGS 16
struct rt_ofw_cell_args
{
void *data;
int args_count;
rt_uint32_t args[RT_OFW_MAX_CELL_ARGS];
};
struct rt_ofw_node_id
{
/* The name string should consist name property (deprecated) */
char name[32];
/*
* The type string should consist device_type property, such as pci, memory
* serial. Because it's deprecated in <devicetree-basics>, we can use other
* name (like "ttyS" or "ttyAMA" ...) to config with /chosen.
*/
char type[32];
/*
* The compatible string should consist only of lowercase letters, digits
* and dashes, and should start with a letter. A single comma is typically
* only used following a vendor prefix. Underscores should not be used.
*/
char compatible[128];
const void *data;
};
struct rt_ofw_stub
{
const struct rt_ofw_node_id *ids;
rt_err_t (*handler)(struct rt_ofw_node *np, const struct rt_ofw_node_id *id);
};
#define RT_OFW_SYMBOL(_class, _level) \
rt_section(".rt_ofw_data." #_class "." #_level)
#define RT_OFW_SYMBOL_TYPE_RANGE(_class, _type, _start, _end) \
static const rt_used RT_OFW_SYMBOL(_class, 0) _type _start; \
static const rt_used RT_OFW_SYMBOL(_class, end) _type _end; \
#define RT_OFW_STUB_EXPORT(_name, _ids, _class, _handler, ...) \
static const struct rt_ofw_stub __rt_ofw_##_name \
rt_used RT_OFW_SYMBOL(_class, __VA_ARGS__ _) = \
{ \
.ids = _ids, \
.handler = _handler, \
}
#define RT_OFW_STUB_RANGE_EXPORT(_class, _start, _end) \
RT_OFW_SYMBOL_TYPE_RANGE(_class, struct rt_ofw_stub, _start = {}, _end = {})
#define rt_ofw_data(np) ((struct rt_ofw_node *)np)->rt_data
rt_inline rt_bool_t rt_ofw_node_test_flag(const struct rt_ofw_node *np, int flag)
{
return rt_bitmap_test_bit((rt_bitmap_t *)&np->flags, flag);
}
rt_inline void rt_ofw_node_set_flag(struct rt_ofw_node *np, int flag)
{
rt_bitmap_set_bit(&np->flags, flag);
}
rt_inline rt_bool_t rt_ofw_node_test_and_set_flag(struct rt_ofw_node *np, int flag)
{
rt_bool_t res = rt_ofw_node_test_flag(np, flag);
rt_ofw_node_set_flag(np, flag);
return res;
}
rt_inline void rt_ofw_node_clear_flag(struct rt_ofw_node *np, int flag)
{
rt_bitmap_clear_bit(&np->flags, flag);
}
rt_err_t rt_ofw_node_destroy(struct rt_ofw_node *np);
struct rt_ofw_node *rt_ofw_node_get(struct rt_ofw_node *np);
void rt_ofw_node_put(struct rt_ofw_node *np);
rt_bool_t rt_ofw_node_tag_equ(const struct rt_ofw_node *np, const char *tag);
rt_bool_t rt_ofw_node_tag_prefix(const struct rt_ofw_node *np, const char *prefix);
rt_inline const char *rt_ofw_node_name(const struct rt_ofw_node *np)
{
return np ? np->name : "<no-node>";
}
rt_inline const char *rt_ofw_node_full_name(const struct rt_ofw_node *np)
{
return np ? np->full_name : "<no-node>";
}
rt_bool_t rt_ofw_machine_is_compatible(const char *compatible);
rt_bool_t rt_ofw_node_is_available(const struct rt_ofw_node *np);
rt_bool_t rt_ofw_node_is_compatible(const struct rt_ofw_node *np, const char *compatible);
struct rt_ofw_node_id *rt_ofw_prop_match(struct rt_ofw_prop *prop, const struct rt_ofw_node_id *ids);
struct rt_ofw_node_id *rt_ofw_node_match(struct rt_ofw_node *np, const struct rt_ofw_node_id *ids);
struct rt_ofw_node *rt_ofw_find_node_by_tag(struct rt_ofw_node *from, const char *tag);
struct rt_ofw_node *rt_ofw_find_node_by_prop_r(struct rt_ofw_node *from, const char *propname,
const struct rt_ofw_prop **out_prop);
rt_inline struct rt_ofw_node *rt_ofw_find_node_by_prop(struct rt_ofw_node *from, const char *propname)
{
return rt_ofw_find_node_by_prop_r(from, propname, RT_NULL);
}
struct rt_ofw_node *rt_ofw_find_node_by_name(struct rt_ofw_node *from, const char *name);
struct rt_ofw_node *rt_ofw_find_node_by_type(struct rt_ofw_node *from, const char *type);
struct rt_ofw_node *rt_ofw_find_node_by_compatible(struct rt_ofw_node *from, const char *compatible);
struct rt_ofw_node *rt_ofw_find_node_by_ids_r(struct rt_ofw_node *from, const struct rt_ofw_node_id *ids,
const struct rt_ofw_node_id **out_id);
struct rt_ofw_node *rt_ofw_find_node_by_path(const char *path);
struct rt_ofw_node *rt_ofw_find_node_by_phandle(rt_phandle phandle);
rt_inline struct rt_ofw_node *rt_ofw_find_node_by_ids(struct rt_ofw_node *from, const struct rt_ofw_node_id *ids)
{
return rt_ofw_find_node_by_ids_r(from, ids, RT_NULL);
}
struct rt_ofw_node *rt_ofw_get_parent(const struct rt_ofw_node *np);
struct rt_ofw_node *rt_ofw_get_child_by_tag(const struct rt_ofw_node *parent, const char *tag);
struct rt_ofw_node *rt_ofw_get_child_by_compatible(const struct rt_ofw_node *parent, const char *compatible);
int rt_ofw_get_child_count(const struct rt_ofw_node *np);
int rt_ofw_get_available_child_count(const struct rt_ofw_node *np);
struct rt_ofw_node *rt_ofw_get_next_node(struct rt_ofw_node *prev);
struct rt_ofw_node *rt_ofw_get_next_parent(struct rt_ofw_node *prev);
struct rt_ofw_node *rt_ofw_get_next_child(const struct rt_ofw_node *parent, struct rt_ofw_node *prev);
struct rt_ofw_node *rt_ofw_get_next_available_child(const struct rt_ofw_node *parent, struct rt_ofw_node *prev);
struct rt_ofw_node *rt_ofw_get_cpu_node(int cpu, int *thread, rt_bool_t (*match_cpu_hwid)(int cpu, rt_uint64_t hwid));
struct rt_ofw_node *rt_ofw_get_next_cpu_node(struct rt_ofw_node *prev);
struct rt_ofw_node *rt_ofw_get_cpu_state_node(struct rt_ofw_node *cpu_np, int index);
rt_uint64_t rt_ofw_get_cpu_id(struct rt_ofw_node *cpu_np);
rt_uint64_t rt_ofw_get_cpu_hwid(struct rt_ofw_node *cpu_np, unsigned int thread);
struct rt_ofw_node *rt_ofw_get_alias_node(const char *tag, int id);
int rt_ofw_get_alias_id(struct rt_ofw_node *np, const char *tag);
int rt_ofw_get_alias_last_id(const char *tag);
struct rt_ofw_node *rt_ofw_parse_phandle(const struct rt_ofw_node *np, const char *phandle_name, int index);
rt_err_t rt_ofw_parse_phandle_cells(const struct rt_ofw_node *np, const char *list_name, const char *cells_name,
int index, struct rt_ofw_cell_args *out_args);
int rt_ofw_count_phandle_cells(const struct rt_ofw_node *np, const char *list_name, const char *cells_name);
struct rt_ofw_prop *rt_ofw_get_prop(const struct rt_ofw_node *np, const char *name, rt_ssize_t *out_length);
rt_inline const void *rt_ofw_prop_read_raw(const struct rt_ofw_node *np, const char *name, rt_ssize_t *out_length)
{
struct rt_ofw_prop *prop = rt_ofw_get_prop(np, name, out_length);
return prop ? prop->value : RT_NULL;
}
int rt_ofw_prop_read_u8_array_index(const struct rt_ofw_node *np, const char *propname,
int index, int nr, rt_uint8_t *out_values);
int rt_ofw_prop_read_u16_array_index(const struct rt_ofw_node *np, const char *propname,
int index, int nr, rt_uint16_t *out_values);
int rt_ofw_prop_read_u32_array_index(const struct rt_ofw_node *np, const char *propname,
int index, int nr, rt_uint32_t *out_values);
int rt_ofw_prop_read_u64_array_index(const struct rt_ofw_node *np, const char *propname,
int index, int nr, rt_uint64_t *out_values);
int rt_ofw_prop_read_string_array_index(const struct rt_ofw_node *np, const char *propname,
int index, int nr, const char **out_strings);
int rt_ofw_prop_count_of_size(const struct rt_ofw_node *np, const char *propname, int size);
int rt_ofw_prop_index_of_string(const struct rt_ofw_node *np, const char *propname, const char *string);
const fdt32_t *rt_ofw_prop_next_u32(struct rt_ofw_prop *prop, const fdt32_t *cur, rt_uint32_t *out_value);
const char *rt_ofw_prop_next_string(struct rt_ofw_prop *prop, const char *cur);
rt_inline rt_err_t rt_ofw_prop_read_u8_index(const struct rt_ofw_node *np, const char *propname,
int index, rt_uint8_t *out_value)
{
int nr = rt_ofw_prop_read_u8_array_index(np, propname, index, 1, out_value);
return nr > 0 ? RT_EOK : (rt_err_t)nr;
}
rt_inline rt_err_t rt_ofw_prop_read_u16_index(const struct rt_ofw_node *np, const char *propname,
int index, rt_uint16_t *out_value)
{
int nr = rt_ofw_prop_read_u16_array_index(np, propname, index, 1, out_value);
return nr > 0 ? RT_EOK : (rt_err_t)nr;
}
rt_inline rt_err_t rt_ofw_prop_read_u32_index(const struct rt_ofw_node *np, const char *propname,
int index, rt_uint32_t *out_value)
{
int nr = rt_ofw_prop_read_u32_array_index(np, propname, index, 1, out_value);
return nr > 0 ? RT_EOK : (rt_err_t)nr;
}
rt_inline rt_err_t rt_ofw_prop_read_u64_index(const struct rt_ofw_node *np, const char *propname,
int index, rt_uint64_t *out_value)
{
int nr = rt_ofw_prop_read_u64_array_index(np, propname, index, 1, out_value);
return nr > 0 ? RT_EOK : (rt_err_t)nr;
}
rt_inline rt_err_t rt_ofw_prop_read_string_index(const struct rt_ofw_node *np, const char *propname,
int index, const char **out_string)
{
int nr = rt_ofw_prop_read_string_array_index(np, propname, index, 1, out_string);
return nr > 0 ? RT_EOK : (rt_err_t)nr;
}
rt_inline rt_err_t rt_ofw_prop_read_u8(const struct rt_ofw_node *np, const char *propname,
rt_uint8_t *out_value)
{
return rt_ofw_prop_read_u8_index(np, propname, 0, out_value);
}
rt_inline rt_err_t rt_ofw_prop_read_u16(const struct rt_ofw_node *np, const char *propname,
rt_uint16_t *out_value)
{
return rt_ofw_prop_read_u16_index(np, propname, 0, out_value);
}
rt_inline rt_err_t rt_ofw_prop_read_u32(const struct rt_ofw_node *np, const char *propname,
rt_uint32_t *out_value)
{
return rt_ofw_prop_read_u32_index(np, propname, 0, out_value);
}
rt_inline rt_err_t rt_ofw_prop_read_s32(const struct rt_ofw_node *np, const char *propname,
rt_int32_t *out_value)
{
return rt_ofw_prop_read_u32_index(np, propname, 0, (rt_uint32_t *)out_value);
}
rt_inline rt_err_t rt_ofw_prop_read_u64(const struct rt_ofw_node *np, const char *propname,
rt_uint64_t *out_value)
{
return rt_ofw_prop_read_u64_index(np, propname, 0, out_value);
}
rt_inline rt_err_t rt_ofw_prop_read_string(const struct rt_ofw_node *np, const char *propname,
const char **out_string)
{
return rt_ofw_prop_read_string_index(np, propname, 0, out_string);
}
rt_inline rt_bool_t rt_ofw_prop_read_bool(const struct rt_ofw_node *np, const char *propname)
{
return rt_ofw_get_prop(np, propname, RT_NULL) ? RT_TRUE : RT_FALSE;
}
rt_inline int rt_ofw_prop_count_of_u8(const struct rt_ofw_node *np, const char *propname)
{
return rt_ofw_prop_count_of_size(np, propname, sizeof(rt_uint8_t));
}
rt_inline int rt_ofw_prop_count_of_u16(const struct rt_ofw_node *np, const char *propname)
{
return rt_ofw_prop_count_of_size(np, propname, sizeof(rt_uint16_t));
}
rt_inline int rt_ofw_prop_count_of_u32(const struct rt_ofw_node *np, const char *propname)
{
return rt_ofw_prop_count_of_size(np, propname, sizeof(rt_uint32_t));
}
rt_inline int rt_ofw_prop_count_of_u64(const struct rt_ofw_node *np, const char *propname)
{
return rt_ofw_prop_count_of_size(np, propname, sizeof(rt_uint64_t));
}
rt_inline const char *rt_ofw_node_type(const struct rt_ofw_node *np)
{
return rt_ofw_prop_read_raw(np, "device_type", RT_NULL);
}
rt_inline rt_bool_t rt_ofw_node_is_type(const struct rt_ofw_node *np, const char *type)
{
const char *get_type = rt_ofw_node_type(np);
return np && get_type && type && !rt_strcmp(get_type, type);
}
#define rt_ofw_foreach_node_by_tag(np, name) \
for (np = rt_ofw_find_node_by_tag(RT_NULL, name); np; \
np = rt_ofw_find_node_by_tag(np, name))
#define rt_ofw_foreach_node_by_prop(np, prop_name) \
for (np = rt_ofw_find_node_by_prop(RT_NULL, prop_name); \
np; np = rt_ofw_find_node_by_prop(np, prop_name))
#define rt_ofw_foreach_node_by_prop_r(np, prop_name, prop) \
for (np = rt_ofw_find_node_by_prop_r(RT_NULL, prop_name, prop); \
np; np = rt_ofw_find_node_by_prop_r(np, prop_name, prop))
#define rt_ofw_foreach_node_by_name(np, name) \
for (np = rt_ofw_find_node_by_name(RT_NULL, name); np; \
np = rt_ofw_find_node_by_name(np, name))
#define rt_ofw_foreach_node_by_type(np, type) \
for (np = rt_ofw_find_node_by_type(RT_NULL, type); np; \
np = rt_ofw_find_node_by_type(np, type))
#define rt_ofw_foreach_node_by_compatible(np, type, compatible) \
for (np = rt_ofw_find_node_by_compatible(RT_NULL, type, compatible); np; \
np = rt_ofw_find_node_by_compatible(np, type, compatible))
#define rt_ofw_foreach_node_by_ids_r(np, id, ids) \
for (np = rt_ofw_find_node_by_ids_r(RT_NULL, ids, id); \
np; np = rt_ofw_find_node_by_ids_r(np, ids, id))
#define rt_ofw_foreach_node_by_ids(np, ids) \
for (np = rt_ofw_find_node_by_ids(RT_NULL, ids); np; \
np = rt_ofw_find_node_by_ids(np, ids))
#define rt_ofw_foreach_nodes(from, np) \
for (np = rt_ofw_get_next_node(from); \
np; np = rt_ofw_get_next_node(np))
#define rt_ofw_foreach_allnodes(np) \
rt_ofw_foreach_nodes(RT_NULL, np)
#define rt_ofw_foreach_parent_node(np) \
for (np = rt_ofw_get_next_parent(rt_ofw_node_get(np)); \
np; np = rt_ofw_get_next_parent(np))
#define rt_ofw_foreach_child_node(parent, child) \
for (child = rt_ofw_get_next_child(parent, RT_NULL); \
child; child = rt_ofw_get_next_child(parent, child))
#define rt_ofw_foreach_available_child_node(parent, child) \
for (child = rt_ofw_get_next_available_child(parent, RT_NULL); child; \
child = rt_ofw_get_next_available_child(parent, child))
#define rt_ofw_foreach_cpu_node(cpu_np) \
for (cpu_np = rt_ofw_get_next_cpu_node(RT_NULL); \
cpu_np; cpu_np = rt_ofw_get_next_cpu_node(cpu_np))
#define rt_ofw_foreach_prop(np, prop) \
for (prop = np->props; prop; prop = prop->next)
#define rt_ofw_foreach_prop_u32(np, propname, prop, p, u) \
for (prop = rt_ofw_get_prop(np, propname, RT_NULL), \
p = rt_ofw_prop_next_u32(prop, RT_NULL, &u); p; \
p = rt_ofw_prop_next_u32(prop, p, &u))
#define rt_ofw_foreach_prop_string(np, propname, prop, s) \
for (prop = rt_ofw_get_prop(np, propname, RT_NULL), \
s = rt_ofw_prop_next_string(prop, RT_NULL); s; \
s = rt_ofw_prop_next_string(prop, s))
#define rt_ofw_foreach_stub(stub, stub_start, stub_end) \
for (stub = stub_start; stub <= stub_end; ++stub)
struct rt_ofw_stub *rt_ofw_stub_probe_range(struct rt_ofw_node *np,
const struct rt_ofw_stub *stub_start, const struct rt_ofw_stub *stub_end);
rt_err_t rt_ofw_console_setup(void);
const char *rt_ofw_bootargs_select(const char *key, int index);
#ifdef RT_USING_CONSOLE
void rt_ofw_node_dump_dts(struct rt_ofw_node *np, rt_bool_t sibling_too);
#endif
#endif /* __OFW_H__ */

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-08-25 GuEe-GUI first version
*/
#ifndef __OFW_FDT_H__
#define __OFW_FDT_H__
#include <mm_page.h>
#include <drivers/ofw.h>
struct rt_fdt_earlycon
{
union { rt_ubase_t mmio, port; };
union { rt_ubase_t size, width; };
void *fdt;
long nodeoffset;
void *data;
void (*console_putc)(void *data, char c);
#define FDT_EARLYCON_KICK_UPDATE 0
#define FDT_EARLYCON_KICK_COMPLETED 1
void (*console_kick)(struct rt_fdt_earlycon *earlycon, int why);
long msg_idx;
char msg[RT_FDT_EARLYCON_MSG_SIZE * 1024];
};
struct rt_fdt_earlycon_id
{
char *name;
char *type;
char *compatible;
rt_err_t (*setup)(struct rt_fdt_earlycon *earlycon, const char *options);
};
#define RT_FDT_EARLYCON_OPTION_SIGNATURE '\n'
#define RT_FDT_EARLYCON_EXPORT(_name, _type, _compatible, _setup) \
static const struct rt_fdt_earlycon_id __rt_fdt_##_name##_earlycon \
rt_used RT_OFW_SYMBOL(earlycon, _) = \
{ \
.name = #_name, \
.type = _type, \
.compatible = _compatible, \
.setup = _setup, \
}
const char *rt_fdt_node_name(const char *full_name);
rt_uint64_t rt_fdt_read_number(const fdt32_t *cell, int size);
rt_uint64_t rt_fdt_next_cell(const fdt32_t **cellptr, int size);
rt_uint64_t rt_fdt_translate_address(void *fdt, int nodeoffset, rt_uint64_t address);
rt_bool_t rt_fdt_device_is_available(void *fdt, int nodeoffset);
rt_err_t rt_fdt_commit_memregion_early(rt_region_t *region, rt_bool_t is_reserved);
rt_err_t rt_fdt_commit_memregion_request(rt_region_t **out_region, rt_size_t *out_nr, rt_bool_t is_reserved);
rt_err_t rt_fdt_prefetch(void *fdt);
rt_err_t rt_fdt_scan_root(void);
rt_err_t rt_fdt_scan_memory(void);
rt_err_t rt_fdt_scan_initrd(rt_uint64_t *ranges);
rt_err_t rt_fdt_model_dump(void);
rt_err_t rt_fdt_boot_dump(void);
void rt_fdt_earlycon_output(const char *str);
void rt_fdt_earlycon_kick(int why);
rt_err_t rt_fdt_scan_chosen_stdout(void);
rt_err_t rt_fdt_unflatten(void);
struct rt_ofw_node *rt_fdt_unflatten_single(void *fdt);
#endif /* __OFW_FDT_H__ */

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-08-25 GuEe-GUI first version
*/
#ifndef __OFW_IO_H__
#define __OFW_IO_H__
#include <drivers/ofw.h>
int rt_ofw_bus_addr_cells(struct rt_ofw_node *np);
int rt_ofw_bus_size_cells(struct rt_ofw_node *np);
int rt_ofw_io_addr_cells(struct rt_ofw_node *np);
int rt_ofw_io_size_cells(struct rt_ofw_node *np);
int rt_ofw_get_address_count(struct rt_ofw_node *np);
rt_err_t rt_ofw_get_address(struct rt_ofw_node *np, int index, rt_uint64_t *out_address, rt_uint64_t *out_size);
rt_err_t rt_ofw_get_address_by_name(struct rt_ofw_node *np, const char *name,
rt_uint64_t *out_address, rt_uint64_t *out_size);
int rt_ofw_get_address_array(struct rt_ofw_node *np, int nr, rt_uint64_t *out_regs);
rt_uint64_t rt_ofw_translate_address(struct rt_ofw_node *np, const char *range_type, rt_uint64_t address);
void *rt_ofw_iomap(struct rt_ofw_node *np, int index);
void *rt_ofw_iomap_by_name(struct rt_ofw_node *np, const char *name);
#endif /* __OFW_IO_H__ */

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-08-25 GuEe-GUI first version
*/
#ifndef __OFW_IRQ_H__
#define __OFW_IRQ_H__
#include <drivers/ofw.h>
int rt_ofw_irq_cells(struct rt_ofw_node *np);
rt_err_t rt_ofw_parse_irq_map(struct rt_ofw_node *np, struct rt_ofw_cell_args *irq_args);
rt_err_t rt_ofw_parse_irq_cells(struct rt_ofw_node *np, int index, struct rt_ofw_cell_args *out_irq_args);
struct rt_ofw_node *rt_ofw_find_irq_parent(struct rt_ofw_node *np, int *out_interrupt_cells);
int rt_ofw_map_irq(struct rt_ofw_cell_args *irq_args);
int rt_ofw_get_irq_count(struct rt_ofw_node *np);
int rt_ofw_get_irq(struct rt_ofw_node *np, int index);
int rt_ofw_get_irq_by_name(struct rt_ofw_node *np, const char *name);
#endif /* __OFW_IRQ_H__ */

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-08-25 GuEe-GUI first version
*/
#ifndef __OFW_RAW_H__
#define __OFW_RAW_H__
#include <libfdt/libfdt.h>
#define FDT_SIZE_KB 1024
#define FDT_SIZE_MB (1024 * FDT_SIZE_KB)
#define FDT_SIZE_MAX (2 * FDT_SIZE_MB)
#define FDT_PADDING_SIZE (1 * FDT_SIZE_KB)
typedef uint8_t fdt8_t;
static inline uint8_t fdt8_to_cpu(fdt8_t x)
{
return (uint8_t)x;
}
int fdt_add_subnode_possible(void *fdt, int parentoffset, const char *name);
int fdt_add_mem_rsv_possible(void *fdt, size_t addr, size_t size);
#define fdt_setprop_cstring(fdt, nodeoffset, name, str) \
fdt_setprop((fdt), (nodeoffset), (name), (str), sizeof(str))
#define fdt_prop_cells_ops(ops, fdt, nodeoffset, prop, ...) \
({ \
int ret = 0; \
uint32_t tmp[] = { __VA_ARGS__ }; \
for (int i = 0; i < sizeof(tmp) / sizeof(tmp[0]); ++i) \
{ \
tmp[i] = cpu_to_fdt32(tmp[i]); \
} \
ret += ops(fdt, nodeoffset, prop, tmp, sizeof(tmp)); \
ret; \
})
#define fdt_setprop_cells(fdt, nodeoffset, prop, ...) \
fdt_prop_cells_ops(fdt_setprop, fdt, nodeoffset, prop, __VA_ARGS__)
#define fdt_appendprop_cells(fdt, nodeoffset, prop, ...) \
fdt_prop_cells_ops(fdt_appendprop, fdt, nodeoffset, prop, __VA_ARGS__)
int fdt_setprop_uxx(void *fdt, int nodeoffset, const char *name, uint64_t val, bool is_u64);
int fdt_getprop_u8(void *fdt, int nodeoffset, const char *name, uint8_t *out_value, int *lenp);
int fdt_getprop_s8(void *fdt, int nodeoffset, const char *name, int8_t *out_value, int *lenp);
int fdt_getprop_u16(void *fdt, int nodeoffset, const char *name, uint16_t *out_value, int *lenp);
int fdt_getprop_s16(void *fdt, int nodeoffset, const char *name, int16_t *out_value, int *lenp);
int fdt_getprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t *out_value, int *lenp);
int fdt_getprop_s32(void *fdt, int nodeoffset, const char *name, int32_t *out_value, int *lenp);
int fdt_io_addr_cells(void *fdt, int nodeoffset);
int fdt_io_size_cells(void *fdt, int nodeoffset);
int fdt_install_initrd(void *fdt, char *os_name, size_t initrd_addr, size_t initrd_size);
#endif /* __OFW_RAW_H__ */

View File

@@ -0,0 +1,167 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-08-24 GuEe-GUI first version
*/
#ifndef __PIC_H__
#define __PIC_H__
#include <rthw.h>
#include <bitmap.h>
#include <drivers/ofw.h>
#include <drivers/core/rtdm.h>
struct rt_pci_msi_desc;
struct rt_pci_msi_msg;
struct rt_pic_ops;
struct rt_pic_irq;
struct rt_pic
{
rt_list_t list;
struct rt_pic_ops *ops;
void *priv_data;
void *user_data;
struct rt_pic *parent;
int irq_start;
rt_size_t irq_nr;
struct rt_pic_irq *pirqs;
};
struct rt_pic_ops
{
const char *name;
rt_err_t (*irq_init)(struct rt_pic *pic);
rt_err_t (*irq_finit)(struct rt_pic *pic);
void (*irq_enable)(struct rt_pic_irq *pirq);
void (*irq_disable)(struct rt_pic_irq *pirq);
void (*irq_ack)(struct rt_pic_irq *pirq);
void (*irq_mask)(struct rt_pic_irq *pirq);
void (*irq_unmask)(struct rt_pic_irq *pirq);
void (*irq_eoi)(struct rt_pic_irq *pirq);
rt_err_t (*irq_set_priority)(struct rt_pic_irq *pirq, rt_uint32_t priority);
rt_err_t (*irq_set_affinity)(struct rt_pic_irq *pirq, rt_bitmap_t *affinity);
rt_err_t (*irq_set_triger_mode)(struct rt_pic_irq *pirq, rt_uint32_t mode);
void (*irq_send_ipi)(struct rt_pic_irq *pirq, rt_bitmap_t *cpumask);
void (*irq_compose_msi_msg)(struct rt_pic_irq *pirq, struct rt_pci_msi_msg *msg);
void (*irq_write_msi_msg)(struct rt_pic_irq *pirq, struct rt_pci_msi_msg *msg);
int (*irq_alloc_msi)(struct rt_pic *pic, struct rt_pci_msi_desc *msi_desc);
void (*irq_free_msi)(struct rt_pic *pic, int irq);
int (*irq_map)(struct rt_pic *pic, int hwirq, rt_uint32_t mode);
rt_err_t (*irq_parse)(struct rt_pic *pic, struct rt_ofw_cell_args *args, struct rt_pic_irq *out_pirq);
};
struct rt_pic_isr
{
rt_list_t list;
#define RT_IRQ_F_NONE 0
int flags;
struct rt_irq_desc action;
};
struct rt_pic_irq
{
int irq;
int hwirq;
#define RT_IRQ_MODE_NONE 0
#define RT_IRQ_MODE_EDGE_RISING 1
#define RT_IRQ_MODE_EDGE_FALLING 2
#define RT_IRQ_MODE_EDGE_BOTH (RT_IRQ_MODE_EDGE_FALLING | RT_IRQ_MODE_EDGE_RISING)
#define RT_IRQ_MODE_LEVEL_HIGH 4
#define RT_IRQ_MODE_LEVEL_LOW 8
#define RT_IRQ_MODE_LEVEL_MASK (RT_IRQ_MODE_LEVEL_LOW | RT_IRQ_MODE_LEVEL_HIGH)
#define RT_IRQ_MODE_MASK 0xf
rt_uint32_t mode;
rt_uint32_t priority;
RT_DECLARE_BITMAP(affinity, RT_CPUS_NR);
struct rt_pci_msi_desc *msi_desc;
struct rt_pic_isr isr;
struct rt_spinlock rw_lock;
struct rt_pic *pic;
};
rt_err_t rt_pic_linear_irq(struct rt_pic *pic, rt_size_t irq_nr);
int rt_pic_config_ipi(struct rt_pic *pic, int ipi_index, int hwirq);
int rt_pic_config_irq(struct rt_pic *pic, int irq_index, int hwirq);
rt_inline struct rt_pic_irq *rt_pic_find_irq(struct rt_pic *pic, int irq_index)
{
/* This is a quickly interface */
RT_ASSERT(pic != RT_NULL);
RT_ASSERT(pic->pirqs != RT_NULL);
RT_ASSERT(irq_index < pic->irq_nr);
return &pic->pirqs[irq_index];
}
struct rt_pic_irq *rt_pic_find_ipi(struct rt_pic *pic, int ipi_index);
int rt_pic_cascade(struct rt_pic *pic, struct rt_pic *parent_pic, int hwirq, rt_uint32_t mode);
void rt_pic_uncascade(struct rt_pic *pic, int irq);
rt_err_t rt_pic_attach_irq(int irq, rt_isr_handler_t handler, void *uid, const char *name, int flags);
rt_err_t rt_pic_detach_irq(int irq, void *uid);
rt_err_t rt_pic_add_traps(rt_bool_t (*handler)(void *), void *data);
rt_err_t rt_pic_do_traps(void);
rt_err_t rt_pic_handle_isr(struct rt_pic_irq *pirq);
/* User-implemented extensions */
rt_err_t rt_pic_user_extends(struct rt_pic *pic);
rt_err_t rt_pic_irq_init(void);
rt_err_t rt_pic_irq_finit(void);
void rt_pic_irq_enable(int irq);
void rt_pic_irq_disable(int irq);
void rt_pic_irq_ack(int irq);
void rt_pic_irq_mask(int irq);
void rt_pic_irq_unmask(int irq);
void rt_pic_irq_eoi(int irq);
rt_err_t rt_pic_irq_set_priority(int irq, rt_uint32_t priority);
rt_uint32_t rt_pic_irq_get_priority(int irq);
rt_err_t rt_pic_irq_set_affinity(int irq, rt_bitmap_t *affinity);
rt_err_t rt_pic_irq_get_affinity(int irq, rt_bitmap_t *out_affinity);
rt_err_t rt_pic_irq_set_triger_mode(int irq, rt_uint32_t mode);
rt_uint32_t rt_pic_irq_get_triger_mode(int irq);
void rt_pic_irq_send_ipi(int irq, rt_bitmap_t *cpumask);
void rt_pic_irq_parent_enable(struct rt_pic *ppic, struct rt_pic_irq *pirq);
void rt_pic_irq_parent_disable(struct rt_pic *ppic, struct rt_pic_irq *pirq);
void rt_pic_irq_parent_ack(struct rt_pic *ppic, struct rt_pic_irq *pirq);
void rt_pic_irq_parent_mask(struct rt_pic *ppic, struct rt_pic_irq *pirq);
void rt_pic_irq_parent_unmask(struct rt_pic *ppic, struct rt_pic_irq *pirq);
void rt_pic_irq_parent_eoi(struct rt_pic *ppic, struct rt_pic_irq *pirq);
rt_err_t rt_pic_irq_parent_set_priority(struct rt_pic *ppic, struct rt_pic_irq *pirq, rt_uint32_t priority);
rt_err_t rt_pic_irq_parent_set_affinity(struct rt_pic *ppic, struct rt_pic_irq *pirq, rt_bitmap_t *affinity);
rt_err_t rt_pic_irq_parent_set_triger_mode(struct rt_pic *ppic, struct rt_pic_irq *pirq, rt_uint32_t mode);
#define RT_PIC_OFW_DECLARE(name, ids, handler) RT_OFW_STUB_EXPORT(name, ids, pic, handler)
rt_err_t rt_pic_init(void);
#endif /* __PIC_H__ */

View File

@@ -171,6 +171,18 @@ extern "C" {
#ifdef RT_USING_DM
#include "drivers/core/rtdm.h"
#ifdef RT_USING_OFW
#include "drivers/ofw.h"
#include "drivers/ofw_fdt.h"
#include "drivers/ofw_io.h"
#include "drivers/ofw_irq.h"
#include "drivers/ofw_raw.h"
#endif /* RT_USING_OFW */
#ifdef RT_USING_PIC
#include "drivers/pic.h"
#endif
#endif /* RT_USING_DM */
#ifdef __cplusplus

22
components/drivers/ofw/Kconfig Executable file
View File

@@ -0,0 +1,22 @@
menuconfig RT_USING_OFW
bool "Using Open Firmware (OFW)"
select RT_USING_ADT
select RT_USING_ADT_REF
select RT_USING_ADT_BITMAP
depends on RT_USING_DM
default n
config RT_USING_BUILTIN_FDT
bool "Using builtin fdt in kernel"
depends on RT_USING_OFW
default n
config RT_BUILTIN_FDT_PATH
string "Builtin fdt path, will rebuild if have dts"
depends on RT_USING_BUILTIN_FDT
default "rtthread.dtb"
config RT_FDT_EARLYCON_MSG_SIZE
int "Earlycon message buffer size (KB)"
depends on RT_USING_OFW
default 128

Some files were not shown because too many files have changed in this diff Show More