#include <stdint.h>
#include <strings.h>
#include <assert.h>
+#include <ipxe/hart.h>
#include <ipxe/iomap.h>
/** @file
PTE_LAST = 0x100,
};
+/** Page-based memory type (Svpbmt) */
+#define PTE_SVPBMT( x ) ( ( ( unsigned long long ) (x) ) << 61 )
+
+/** Page is non-cacheable memory (Svpbmt) */
+#define PTE_SVPBMT_NC PTE_SVPBMT ( 1 )
+
+/** Page maps I/O addresses (Svpbmt) */
+#define PTE_SVPBMT_IO PTE_SVPBMT ( 2 )
+
/** Page table entry address */
#define PTE_PPN( addr ) ( (addr) >> 2 )
*/
static void * svpage_ioremap ( unsigned long bus_addr, size_t len ) {
unsigned long attrs = ( PTE_V | PTE_R | PTE_W | PTE_A | PTE_D );
+ int rc;
+
+ /* Add Svpbmt attributes if applicable */
+ if ( ( rc = hart_supported ( "_svpbmt" ) ) == 0 )
+ attrs |= PTE_SVPBMT_IO;
/* Map pages for I/O */
return svpage_map ( bus_addr, len, attrs );
*/
void * svpage_dma32 ( void ) {
unsigned long attrs = ( PTE_V | PTE_R | PTE_W | PTE_A | PTE_D );
+ int rc;
+
+ /* Add Svpbmt attributes if applicable */
+ if ( ( rc = hart_supported ( "_svpbmt" ) ) == 0 )
+ attrs |= PTE_SVPBMT_NC;
/* Create mapping, if necessary */
if ( ! svpage_dma32_base )