system/kernel: Rework uart management
Change-Id: I6cb31760519c8ba4542d217d6e68439602eda558 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4356 Reviewed-by: Jessica Hamilton <[email protected]> Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
committed by
Alex von Gluck IV
parent
fbd2589b8c
commit
d637e0bec1
@@ -11,17 +11,19 @@
|
||||
|
||||
|
||||
#include <util/FixedWidthPointer.h>
|
||||
#include <boot/uart.h>
|
||||
|
||||
|
||||
#define _PACKED __attribute__((packed))
|
||||
|
||||
|
||||
// kernel args
|
||||
typedef struct {
|
||||
int cpu_type;
|
||||
int fpu_type;
|
||||
int mmu_type;
|
||||
int platform;
|
||||
int machine; // platform specific machine type
|
||||
int cpu_type;
|
||||
int fpu_type;
|
||||
int mmu_type;
|
||||
int platform;
|
||||
int machine; // platform specific machine type
|
||||
|
||||
// architecture specific
|
||||
uint32 phys_pgdir;
|
||||
@@ -31,6 +33,8 @@ typedef struct {
|
||||
// needed for UEFI, otherwise kernel acpi support can't find ACPI root
|
||||
FixedWidthPointer<void> acpi_root;
|
||||
FixedWidthPointer<void> fdt;
|
||||
|
||||
uart_info uart;
|
||||
} _PACKED arch_kernel_args;
|
||||
|
||||
#endif /* KERNEL_ARCH_ARM_KERNEL_ARGS_H */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2012 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2011-2021 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -16,6 +16,9 @@
|
||||
#include <arch/generic/debug_uart.h>
|
||||
|
||||
|
||||
#define UART_KIND_PL011 "pl011"
|
||||
|
||||
|
||||
class ArchUARTPL011 : public DebugUART {
|
||||
public:
|
||||
ArchUARTPL011(addr_t base, int64 clock);
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
#include "debug_uart.h"
|
||||
|
||||
|
||||
#define UART_KIND_8250 "8250"
|
||||
|
||||
|
||||
class DebugUART8250 : public DebugUART {
|
||||
public:
|
||||
DebugUART8250(addr_t base, int64 clock);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
#include <util/FixedWidthPointer.h>
|
||||
#include <boot/uart.h>
|
||||
|
||||
|
||||
#define _PACKED __attribute__((packed))
|
||||
@@ -24,21 +25,6 @@ enum {
|
||||
kPlatformSbi,
|
||||
};
|
||||
|
||||
enum {
|
||||
kUartKindNone,
|
||||
kUartKind8250,
|
||||
kUartKindSifive,
|
||||
kUartKindPl011,
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32 kind;
|
||||
addr_range regs;
|
||||
uint32 irq;
|
||||
int64 clock;
|
||||
} _PACKED ArchUart;
|
||||
|
||||
|
||||
// kernel args
|
||||
typedef struct {
|
||||
@@ -62,7 +48,8 @@ typedef struct {
|
||||
addr_range htif;
|
||||
addr_range plic;
|
||||
addr_range clint;
|
||||
ArchUart uart;
|
||||
|
||||
uart_info uart;
|
||||
} _PACKED arch_kernel_args;
|
||||
|
||||
#endif /* KERNEL_ARCH_RISCV64_KERNEL_ARGS_H */
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include <arch/generic/debug_uart.h>
|
||||
|
||||
|
||||
#define UART_KIND_SIFIVE "sifive"
|
||||
|
||||
|
||||
// UARTSifiveRegs.ie, ip
|
||||
enum {
|
||||
kUartSifiveTxwm = 1 << 0,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2021 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef KERNEL_BOOT_UART_H
|
||||
#define KERNEL_BOOT_UART_H
|
||||
|
||||
|
||||
#include <boot/addr_range.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
char kind[32];
|
||||
addr_range regs;
|
||||
uint32 irq;
|
||||
int64 clock;
|
||||
} __attribute__((packed)) uart_info;
|
||||
|
||||
|
||||
#endif /* KERNEL_BOOT_UART_H */
|
||||
Reference in New Issue
Block a user