introduce RISC-V headers

Change-Id: I9a8b6a1011cbefd4bd173852e7111e92efd0c730
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4003
Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
X512
2021-05-27 15:43:19 +00:00
committed by Alex von Gluck IV
parent 1b41be049b
commit b8b1ad6fc4
4 changed files with 405 additions and 29 deletions
@@ -0,0 +1,23 @@
/*
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _CLINT_H_
#define _CLINT_H_
#include <SupportDefs.h>
// core local interruptor
struct ClintRegs
{
uint8 unknown1[0x4000];
uint64 mTimeCmp[4095]; // per CPU core, but not implemented in temu
uint64 mTime; // @0xBFF8
};
extern ClintRegs* volatile gClintRegs;
#endif // _CLINT_H_
@@ -0,0 +1,33 @@
/*
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _HTIF_H_
#define _HTIF_H_
#include <SupportDefs.h>
// host-target interface
struct HtifRegs
{
uint32 toHostLo;
uint32 toHostHi;
uint32 fromHostLo;
uint32 fromHostHi;
};
extern HtifRegs* volatile gHtifRegs;
uint64 HtifCmd(uint32 device, uint8 cmd, uint32 arg);
void HtifShutdown();
void HtifOutChar(char ch);
void HtifOutString(const char* str);
void HtifOutString(const char* str, size_t len);
#endif // _HTIF_H_
@@ -0,0 +1,31 @@
/*
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PLIC_H_
#define _PLIC_H_
#include <SupportDefs.h>
// platform-level interrupt controller
struct PlicRegs
{
// context = hart * 2 + mode, mode: 0 - machine, 1 - supervisor
uint32 priority[1024]; // 0x000000
uint32 pending[1024 / 32]; // 0x001000, bitfield
uint8 unused1[0x2000 - 0x1080];
uint32 enable[15872][1024 / 32]; // 0x002000, bitfield, [context][enable]
uint8 unused2[0xe000];
struct {
uint32 priorityThreshold;
uint32 claimAndComplete;
uint8 unused[0xff8];
} contexts[15872]; // 0x200000
};
extern PlicRegs* volatile gPlicRegs;
#endif // _PLIC_H_