diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-28 09:09:27 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-28 09:09:27 +0100 |
| commit | f204ff88659e058d70213fc7224a2c95c6a48c9d (patch) | |
| tree | b4d62fa0dc6da921e25aa3fac400cab892a78e57 /lib | |
| parent | 08f96fce677d9cf4f8757cf064c07f80e30d378e (diff) | |
coreboot: rename from NeKernel firmware, refactor symbols to `cb_`, update docs
This patch completes a major renaming and cleanup of the firmware codebase:
- Rename project from "NeKernel Firmware" to "CoreBoot" in README and comments.
- Replace all `mp_`-prefixed symbols with `cb_` to reflect the new naming scheme.
- Remove obsolete SPECIFICATION.TXT and replace with SPECIFICATION_FIRMWARE.md.
- Update memory-mapped I/O helpers, TLB init, and platform-specific code to match `cb_*` naming.
- Refactor low-level UART, panic, PCI-tree, partition map, and context setup to use unified `cb_` API.
- Adjust linker scripts and boot vectors for ARM64, PPC64, and RV64 targets accordingly.
- Add Doxygen documentation note to README.
This change is part of an ongoing effort to rebrand and unify the firmware interface, improve naming clarity, and better align with platform-specific toolchains.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/30pin.h | 8 | ||||
| -rw-r--r-- | lib/boot.h | 37 | ||||
| -rw-r--r-- | lib/fd.h | 22 | ||||
| -rw-r--r-- | lib/mp-bit.h | 10 | ||||
| -rw-r--r-- | lib/netboot.h | 8 | ||||
| -rw-r--r-- | lib/partition-map.h | 6 | ||||
| -rw-r--r-- | lib/pci-tree.h | 36 |
7 files changed, 64 insertions, 63 deletions
diff --git a/lib/30pin.h b/lib/30pin.h index 6782cfb..f96d91d 100644 --- a/lib/30pin.h +++ b/lib/30pin.h @@ -10,8 +10,8 @@ struct TRB_PACKET { - char mag[2]; - char kind; - char buffer[498]; - char eop[11]; + char mag[2]; + char kind; + char buffer[498]; + char eop[11]; };
\ No newline at end of file @@ -78,7 +78,7 @@ typedef ptrtype_t size_t; #define SYS_UART_BASE 0x10000000 #define SYS_FLASH_BASE_ADDR 0x08000000 -#define mp_sync_synchronize() __sync_synchronize() +#define cb_sync_synchronize() __sync_synchronize() #elif defined(__COMPILE_POWERPC__) #define SYS_UART_BASE 0x10000000 #define SYS_BOOT_ADDR 0x1030000 @@ -86,7 +86,7 @@ typedef ptrtype_t size_t; #define SYS_FRAMEBUFFER_ADDR 0x40000000L #define SYS_FLASH_BASE_ADDR 0x08000000 -#define mp_sync_synchronize() __sync_synchronize() +#define cb_sync_synchronize() __sync_synchronize() #elif defined(__COMPILE_ARM64__) #define SYS_UART_BASE 0x09000000 @@ -97,9 +97,10 @@ typedef ptrtype_t size_t; static inline void __sync_synchronize(void) { + cb_put_string("CB: warning: __sync_synchronize is not implemented!\r\n"); } -#define mp_sync_synchronize() __sync_synchronize() +#define cb_sync_synchronize() __sync_synchronize() #endif // ifndef __COMPILE_POWERPC__ #define SYS_BAUDRATE_TABLE \ @@ -115,16 +116,16 @@ static inline void __sync_synchronize(void) #define SYS_BOOT_VER 0x101 #define SYS_BOOT_CALL(struct, offset) \ - mp_proc_t proc_##offset = (mp_proc_t)(struct->offset); \ + cb_proc_t proc_##offset = (cb_proc_t)(struct->offset); \ proc_##offset(); -/// @brief float type. +/// @brief floating point representation (IEE 7554) in a C structure typedef union { struct { - char sign; - int mantissa; - short exponent; + char sign; + int32_t mantissa; + int16_t exponent; }; float f; @@ -135,36 +136,36 @@ typedef uint32_t utf_char_t; /// @brief panic the entire system. /// @param reason why text. -void mp_panic(const char* reason); +void cb_panic(const char* reason); /// @brief update the power status of the machine. -void mp_update_power_status(boolean restart); +void cb_update_power_status(boolean restart); /// @brief puts a string in serial /// @param text /// @return -size_t mp_put_string(const char* text); +size_t cb_put_string(const char* text); /// @brief gets a char from serial /// @param /// @return -utf_char_t mp_get_char(void); +utf_char_t cb_get_char(void); /// @brief puts a char in serial /// @param ch -void mp_put_char(utf_char_t ch); +void cb_put_char(utf_char_t ch); /// @brief Hangs the firmware. /// @param void no args. -void mp_restart_machine(void); +void cb_restart_machine(void); /// @brief Flushs the TLB. /// @param void no args. -void mp_flush_tlb(void); +void cb_flush_tlb(void); /// @brief Print current kernel name. /// @param -void mp_print_name(void); +void cb_print_name(void); /// @brief String length getter /// @param str the string. @@ -177,14 +178,14 @@ size_t strlen(caddr_t str); /// @return size_t strcmp(caddr_t src, caddr_t cmp); -typedef void (*mp_proc_t)(); +typedef void (*cb_proc_t)(); /// \brief ASCII character. typedef char ascii_char_t; /// @brief Linear Executable Header /// @author Amlal EL Mahrouss (Amlal EL Mahrouss) -struct __attribute__((aligned(4))) mp_boot_header +struct __attribute__((aligned(4))) cb_boot_header { const ascii_char_t h_mag[2]; // magic number const ascii_char_t h_name[10]; // operating system name @@ -8,25 +8,25 @@ #include <lib/boot.h> -struct _mp_file_descriptor; +struct _cb_file_descriptor; /// @brief CoreBoot file/device descriptor. /// @version 1 -typedef struct _mp_file_descriptor +typedef struct _cb_file_descriptor { int32_t f_kind; int32_t f_filesystem; - size_t (*f_write)(void* ptr, size_t size, size_t nitems, struct _mp_file_descriptor* self); - size_t (*f_read)(void* ptr, size_t size, size_t nitems, struct _mp_file_descriptor* self); - int (*f_seek)(struct _mp_file_descriptor* self, size_t off, int whence); - int (*f_tell)(struct _mp_file_descriptor* self); - int (*f_rewind)(struct _mp_file_descriptor* self); - int (*f_eof)(struct _mp_file_descriptor* self); - int (*f_close)(struct _mp_file_descriptor* self); -} mp_file_descriptor_t; + size_t (*f_write)(void* ptr, size_t size, size_t nitems, struct _cb_file_descriptor* self); + size_t (*f_read)(void* ptr, size_t size, size_t nitems, struct _cb_file_descriptor* self); + int (*f_seek)(struct _cb_file_descriptor* self, size_t off, int whence); + int (*f_tell)(struct _cb_file_descriptor* self); + int (*f_rewind)(struct _cb_file_descriptor* self); + int (*f_eof)(struct _cb_file_descriptor* self); + int (*f_close)(struct _cb_file_descriptor* self); +} cb_file_descriptor_t; /// @brief Grabs a new device reference. /// @param path the device path. /// @return -mp_file_descriptor_t* mp_grab_fd(const char* path); +cb_file_descriptor_t* cb_grab_fd(const char* path); diff --git a/lib/mp-bit.h b/lib/mp-bit.h index 7195fc0..8d89a7c 100644 --- a/lib/mp-bit.h +++ b/lib/mp-bit.h @@ -10,10 +10,10 @@ /// Name: CoreBoot Bits API. /// Purpose: Bit manip helpers. -#define mp_set_bit(X, O) X = (1 << O) | X -#define mp_clear_bit(X, O) X = ~(1 << O) & X -#define mp_toogle(X, O) X = (1 << O) ^ X -#define mp_lsb(X) X = X & -X -#define mp_msb(X) X = -(mp_lsb(X)) & X +#define cb_set_bit(X, O) X = (1 << O) | X +#define cb_clear_bit(X, O) X = ~(1 << O) & X +#define cb_toogle(X, O) X = (1 << O) ^ X +#define cb_lsb(X) X = X & -X +#define cb_msb(X) X = -(cb_lsb(X)) & X #endif // ifndef __BITMANIP_H__ diff --git a/lib/netboot.h b/lib/netboot.h index 6976359..20530fb 100644 --- a/lib/netboot.h +++ b/lib/netboot.h @@ -22,9 +22,9 @@ typedef struct NETBOOT_INET_HEADER char m_nb4; /// magic char 4 'B' char m_patch_name[255]; /// example: ColdChoco - int32_t m_length; /// the patch length. - char m_target[255]; /// the target file. - uint8_t m_implies_rom; /// does it imply an EEPROM reprogram? - uint8_t m_preflight; /// Do we just check if this endpoint exists/is valid? + int32_t m_length; /// The patch's length. + char m_target[255]; /// The target file. + uint8_t m_implies_rom; /// does it imply an EEPROM program? + uint8_t m_preflight; /// Do we just check if this endpoint exists/is valid? uint8_t m_blob[]; } NETBOOT_INET_HEADER; diff --git a/lib/partition-map.h b/lib/partition-map.h index 74f1031..a02f88b 100644 --- a/lib/partition-map.h +++ b/lib/partition-map.h @@ -93,11 +93,11 @@ enum }; /// @brief check for supported filesystem. -boolean mp_filesystem_exists(caddr_t fs, size_t len); +boolean cb_filesystem_exists(caddr_t fs, size_t len); /// @brief Parse EPM block from blob. -bool mp_parse_partition_block_data_at(voidptr_t blob, size_t blob_sz, size_t index, size_t* end_lba, size_t* start_lba, size_t* sector_sz); +bool cb_parse_partition_block_data_at(voidptr_t blob, size_t blob_sz, size_t index, size_t* end_lba, size_t* start_lba, size_t* sector_sz); -part_block_t* mp_parse_partition_block_at(voidptr_t blob, size_t blob_sz, size_t index); +part_block_t* cb_parse_partition_block_at(voidptr_t blob, size_t blob_sz, size_t index); #endif // ifndef __PARTITION_MAP_H__ diff --git a/lib/pci-tree.h b/lib/pci-tree.h index 4ca8d57..1a31278 100644 --- a/lib/pci-tree.h +++ b/lib/pci-tree.h @@ -29,42 +29,42 @@ #define SYS_PCI_VERSION (0x0100) #define SYS_PCI_DEV_MAGIC (0xfeedd00d) -#define SYS_PCI_INT_SZ sizeof(mp_pci_num_t) +#define SYS_PCI_INT_SZ sizeof(cb_pci_num_t) #define SYS_PCI_NAME_LEN (255U) -typedef char mp_pci_char_t; -typedef uintptr_t mp_pci_num_t; +typedef char cb_pci_char_t; +typedef uintptr_t cb_pci_num_t; -typedef uint8_t mp_pci_fn_t; -typedef uint8_t mp_pci_bus_t; -typedef uint8_t mp_pci_device_t; +typedef uint8_t cb_pci_fn_t; +typedef uint8_t cb_pci_bus_t; +typedef uint8_t cb_pci_device_t; /// @brief hardware tree header /// used by guest to resolve hardware peripherals. -struct hw_mp_pci_tree +struct hw_cb_pci_tree { - mp_pci_num_t d_magic; - mp_pci_num_t d_version; - mp_pci_num_t d_off_props; - mp_pci_num_t d_off_struct; - mp_pci_num_t d_sz_props; - mp_pci_num_t d_sz_struct; + cb_pci_num_t d_magic; + cb_pci_num_t d_version; + cb_pci_num_t d_off_props; + cb_pci_num_t d_off_struct; + cb_pci_num_t d_sz_props; + cb_pci_num_t d_sz_struct; - mp_pci_num_t d_first_node; - mp_pci_num_t d_next_sibling; + cb_pci_num_t d_first_node; + cb_pci_num_t d_next_sibling; - mp_pci_char_t d_name[SYS_PCI_NAME_LEN]; + cb_pci_char_t d_name[SYS_PCI_NAME_LEN]; }; /// @brief Init PCI tree. /// @param void /// @return if it's successful or not. -boolean mp_pci_init_tree(void); +boolean cb_pci_init_tree(void); /// @brief Adds a new tree into the internal data structure. /// @param name device name /// @param struct_ptr device structure /// @param struct_sz the structure size of the device. /// @return if it was successful or not. -boolean mp_pci_append_tree(const caddr_t name, mp_pci_num_t struct_ptr, mp_pci_num_t struct_sz); +boolean cb_pci_append_tree(const caddr_t name, cb_pci_num_t struct_ptr, cb_pci_num_t struct_sz); |
