kernel/uart: Fix PPC, drop needless abstraction
Change-Id: I4b8f69271ede117701725f9cce30de5bb8ba30bb Reviewed-on: https://review.haiku-os.org/c/haiku/+/4332 Reviewed-by: Alex von Gluck IV <[email protected]> Reviewed-by: Jessica Hamilton <[email protected]>
This commit is contained in:
committed by
Alex von Gluck IV
parent
1648ab5277
commit
950f68e3b2
@@ -4,6 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* François Revol, [email protected]
|
* François Revol, [email protected]
|
||||||
|
* Alexander von Gluck IV, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef _KERNEL_ARCH_DEBUG_UART_8250_H
|
#ifndef _KERNEL_ARCH_DEBUG_UART_8250_H
|
||||||
#define _KERNEL_ARCH_DEBUG_UART_8250_H
|
#define _KERNEL_ARCH_DEBUG_UART_8250_H
|
||||||
@@ -30,6 +31,8 @@ public:
|
|||||||
|
|
||||||
void FlushTx();
|
void FlushTx();
|
||||||
void FlushRx();
|
void FlushRx();
|
||||||
|
|
||||||
|
virtual void Barrier();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,18 @@ DebugUART8250::FlushRx()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DebugUART8250::Barrier()
|
||||||
|
{
|
||||||
|
// Simple memory barriers
|
||||||
|
#if defined(__POWERPC__)
|
||||||
|
asm volatile("eieio; sync");
|
||||||
|
#elif defined(__ARM__)
|
||||||
|
asm volatile ("" : : : "memory");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DebugUART8250*
|
DebugUART8250*
|
||||||
arch_get_uart_8250(addr_t base, int64 clock)
|
arch_get_uart_8250(addr_t base, int64 clock)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ KernelMergeObject kernel_arch_ppc.o :
|
|||||||
|
|
||||||
# serial uart
|
# serial uart
|
||||||
debug_uart_8250.cpp
|
debug_uart_8250.cpp
|
||||||
arch_uart_8250.cpp
|
|
||||||
|
|
||||||
# paging
|
# paging
|
||||||
generic_vm_physical_page_mapper.cpp
|
generic_vm_physical_page_mapper.cpp
|
||||||
|
|||||||
@@ -15,24 +15,22 @@
|
|||||||
#include <real_time_clock.h>
|
#include <real_time_clock.h>
|
||||||
#include <util/kernel_cpp.h>
|
#include <util/kernel_cpp.h>
|
||||||
|
|
||||||
#include "fdt_serial.h"
|
|
||||||
|
|
||||||
void *gFDT;
|
void *gFDT;
|
||||||
static PPCPlatform *sPPCPlatform;
|
static PPCPlatform *sPPCPlatform;
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
|
||||||
PPCPlatform::PPCPlatform(ppc_platform_type platformType)
|
PPCPlatform::PPCPlatform(ppc_platform_type platformType)
|
||||||
: fPlatformType(platformType)
|
: fPlatformType(platformType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
PPCPlatform::~PPCPlatform()
|
PPCPlatform::~PPCPlatform()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default
|
|
||||||
PPCPlatform *
|
PPCPlatform *
|
||||||
PPCPlatform::Default()
|
PPCPlatform::Default()
|
||||||
{
|
{
|
||||||
@@ -72,12 +70,13 @@ private:
|
|||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
using BPrivate::PPCOpenFirmware;
|
using BPrivate::PPCOpenFirmware;
|
||||||
|
|
||||||
|
|
||||||
// OF debugger commands
|
// OF debugger commands
|
||||||
|
|
||||||
// debug_command_of_exit
|
|
||||||
static int
|
static int
|
||||||
debug_command_of_exit(int argc, char **argv)
|
debug_command_of_exit(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -86,7 +85,7 @@ debug_command_of_exit(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug_command_of_enter
|
|
||||||
static int
|
static int
|
||||||
debug_command_of_enter(int argc, char **argv)
|
debug_command_of_enter(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -95,7 +94,6 @@ debug_command_of_enter(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
|
||||||
PPCOpenFirmware::PPCOpenFirmware()
|
PPCOpenFirmware::PPCOpenFirmware()
|
||||||
: PPCPlatform(PPC_PLATFORM_OPEN_FIRMWARE),
|
: PPCPlatform(PPC_PLATFORM_OPEN_FIRMWARE),
|
||||||
fInput(-1),
|
fInput(-1),
|
||||||
@@ -104,12 +102,12 @@ PPCOpenFirmware::PPCOpenFirmware()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
PPCOpenFirmware::~PPCOpenFirmware()
|
PPCOpenFirmware::~PPCOpenFirmware()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
|
||||||
status_t
|
status_t
|
||||||
PPCOpenFirmware::Init(struct kernel_args *kernelArgs)
|
PPCOpenFirmware::Init(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
@@ -117,7 +115,7 @@ PPCOpenFirmware::Init(struct kernel_args *kernelArgs)
|
|||||||
(intptr_t(*)(void*))kernelArgs->platform_args.openfirmware_entry);
|
(intptr_t(*)(void*))kernelArgs->platform_args.openfirmware_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitSerialDebug
|
|
||||||
status_t
|
status_t
|
||||||
PPCOpenFirmware::InitSerialDebug(struct kernel_args *kernelArgs)
|
PPCOpenFirmware::InitSerialDebug(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
@@ -131,7 +129,7 @@ PPCOpenFirmware::InitSerialDebug(struct kernel_args *kernelArgs)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitPostVM
|
|
||||||
status_t
|
status_t
|
||||||
PPCOpenFirmware::InitPostVM(struct kernel_args *kernelArgs)
|
PPCOpenFirmware::InitPostVM(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
@@ -144,6 +142,7 @@ PPCOpenFirmware::InitPostVM(struct kernel_args *kernelArgs)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// InitRTC
|
// InitRTC
|
||||||
status_t
|
status_t
|
||||||
PPCOpenFirmware::InitRTC(struct kernel_args *kernelArgs,
|
PPCOpenFirmware::InitRTC(struct kernel_args *kernelArgs,
|
||||||
@@ -159,7 +158,7 @@ PPCOpenFirmware::InitRTC(struct kernel_args *kernelArgs,
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugSerialGetChar
|
|
||||||
char
|
char
|
||||||
PPCOpenFirmware::SerialDebugGetChar()
|
PPCOpenFirmware::SerialDebugGetChar()
|
||||||
{
|
{
|
||||||
@@ -169,7 +168,7 @@ PPCOpenFirmware::SerialDebugGetChar()
|
|||||||
return (char)key;
|
return (char)key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugSerialPutChar
|
|
||||||
void
|
void
|
||||||
PPCOpenFirmware::SerialDebugPutChar(char c)
|
PPCOpenFirmware::SerialDebugPutChar(char c)
|
||||||
{
|
{
|
||||||
@@ -182,7 +181,7 @@ PPCOpenFirmware::SerialDebugPutChar(char c)
|
|||||||
of_write(fOutput, &c, 1);
|
of_write(fOutput, &c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHardwareRTC
|
|
||||||
void
|
void
|
||||||
PPCOpenFirmware::SetHardwareRTC(uint32 seconds)
|
PPCOpenFirmware::SetHardwareRTC(uint32 seconds)
|
||||||
{
|
{
|
||||||
@@ -198,7 +197,7 @@ PPCOpenFirmware::SetHardwareRTC(uint32 seconds)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHardwareRTC
|
|
||||||
uint32
|
uint32
|
||||||
PPCOpenFirmware::GetHardwareRTC()
|
PPCOpenFirmware::GetHardwareRTC()
|
||||||
{
|
{
|
||||||
@@ -215,7 +214,7 @@ PPCOpenFirmware::GetHardwareRTC()
|
|||||||
return rtc_tm_to_secs(&t);
|
return rtc_tm_to_secs(&t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShutDown
|
|
||||||
void
|
void
|
||||||
PPCOpenFirmware::ShutDown(bool reboot)
|
PPCOpenFirmware::ShutDown(bool reboot)
|
||||||
{
|
{
|
||||||
@@ -264,7 +263,6 @@ private:
|
|||||||
using BPrivate::PPCUBoot;
|
using BPrivate::PPCUBoot;
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
|
||||||
PPCUBoot::PPCUBoot()
|
PPCUBoot::PPCUBoot()
|
||||||
: PPCPlatform(PPC_PLATFORM_U_BOOT),
|
: PPCPlatform(PPC_PLATFORM_U_BOOT),
|
||||||
fInput(-1),
|
fInput(-1),
|
||||||
@@ -274,12 +272,12 @@ PPCUBoot::PPCUBoot()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
PPCUBoot::~PPCUBoot()
|
PPCUBoot::~PPCUBoot()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
|
||||||
status_t
|
status_t
|
||||||
PPCUBoot::Init(struct kernel_args *kernelArgs)
|
PPCUBoot::Init(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
@@ -288,24 +286,25 @@ PPCUBoot::Init(struct kernel_args *kernelArgs)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitSerialDebug
|
|
||||||
status_t
|
status_t
|
||||||
PPCUBoot::InitSerialDebug(struct kernel_args *kernelArgs)
|
PPCUBoot::InitSerialDebug(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
fDebugUART = debug_uart_from_fdt(gFDT);
|
// TODO: get relevant debug uart from fdt
|
||||||
|
//fDebugUART = debug_uart_from_fdt(gFDT);
|
||||||
if (fDebugUART == NULL)
|
if (fDebugUART == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitPostVM
|
|
||||||
status_t
|
status_t
|
||||||
PPCUBoot::InitPostVM(struct kernel_args *kernelArgs)
|
PPCUBoot::InitPostVM(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitRTC
|
|
||||||
status_t
|
status_t
|
||||||
PPCUBoot::InitRTC(struct kernel_args *kernelArgs,
|
PPCUBoot::InitRTC(struct kernel_args *kernelArgs,
|
||||||
struct real_time_data *data)
|
struct real_time_data *data)
|
||||||
@@ -313,7 +312,7 @@ PPCUBoot::InitRTC(struct kernel_args *kernelArgs,
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugSerialGetChar
|
|
||||||
char
|
char
|
||||||
PPCUBoot::SerialDebugGetChar()
|
PPCUBoot::SerialDebugGetChar()
|
||||||
{
|
{
|
||||||
@@ -322,7 +321,7 @@ PPCUBoot::SerialDebugGetChar()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugSerialPutChar
|
|
||||||
void
|
void
|
||||||
PPCUBoot::SerialDebugPutChar(char c)
|
PPCUBoot::SerialDebugPutChar(char c)
|
||||||
{
|
{
|
||||||
@@ -330,20 +329,20 @@ PPCUBoot::SerialDebugPutChar(char c)
|
|||||||
fDebugUART->PutChar(c);
|
fDebugUART->PutChar(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHardwareRTC
|
|
||||||
void
|
void
|
||||||
PPCUBoot::SetHardwareRTC(uint32 seconds)
|
PPCUBoot::SetHardwareRTC(uint32 seconds)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHardwareRTC
|
|
||||||
uint32
|
uint32
|
||||||
PPCUBoot::GetHardwareRTC()
|
PPCUBoot::GetHardwareRTC()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShutDown
|
|
||||||
void
|
void
|
||||||
PPCUBoot::ShutDown(bool reboot)
|
PPCUBoot::ShutDown(bool reboot)
|
||||||
{
|
{
|
||||||
@@ -357,6 +356,7 @@ PPCUBoot::ShutDown(bool reboot)
|
|||||||
// static buffer for constructing the actual PPCPlatform
|
// static buffer for constructing the actual PPCPlatform
|
||||||
static char *sPPCPlatformBuffer[PLATFORM_BUFFER_SIZE];
|
static char *sPPCPlatformBuffer[PLATFORM_BUFFER_SIZE];
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_platform_init(struct kernel_args *kernelArgs)
|
arch_platform_init(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012, François Revol, [email protected]
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <debug.h>
|
|
||||||
#include <arch/generic/debug_uart_8250.h>
|
|
||||||
#include <arch/ppc/arch_cpu.h>
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
|
|
||||||
class ArchUART8250 : public DebugUART8250 {
|
|
||||||
public:
|
|
||||||
ArchUART8250(addr_t base, int64 clock);
|
|
||||||
~ArchUART8250();
|
|
||||||
|
|
||||||
virtual void Barrier();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ArchUART8250::ArchUART8250(addr_t base, int64 clock)
|
|
||||||
: DebugUART8250(base, clock)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ArchUART8250::~ArchUART8250()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ArchUART8250::Barrier()
|
|
||||||
{
|
|
||||||
eieio();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DebugUART8250 *arch_get_uart_8250(addr_t base, int64 clock)
|
|
||||||
{
|
|
||||||
static char buffer[sizeof(ArchUART8250)];
|
|
||||||
ArchUART8250 *uart = new(buffer) ArchUART8250(base, clock);
|
|
||||||
return uart;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user