Skip to contentSkip to conversation

grub: Add ieee1275 interfaces for phys and virt memory allocation on sparc64.

PATCH David Miller 1 participant 1 message Apr 13, 2009

lore
Share & tools
lore
#0 lore raw

This adds the ieee1275 interfaces sparc64's openboot has for allocating physical memory, creating mappings, etc.

We can't reuse any of the existing similar calls used by powerpc since these use two cells for passing physical addresses (even though only one of those cell slots is used, this is legacy carry over from 32-bit sparc times).

Committed.

2009-04-13 David S. Miller <[email protected]>

	* kern/sparc64/ieee1275/ieee1275.c: New file.
	* include/grub/sparc64/ieee1275/ieee1275.h (IEEE1275_MAP_WRITE,
	IEEE1275_MAP_READ, IEEE1275_MAP_EXEC, IEEE1275_MAP_LOCKED,
	IEEE1275_MAP_CACHED, IEEE1275_MAP_SE, IEEE1275_MAP_GLOBAL,
	IEEE1275_MAP_IE, IEEE1275_MAP_DEFAULT): Define.
	(grub_ieee1275_map_physical, grub_ieee1275_claim_vaddr,
	grub_ieee1275_alloc_physmem): Declare new exported functions.
---
 include/grub/sparc64/ieee1275/ieee1275.h |   22 +++++
 kern/sparc64/ieee1275/ieee1275.c         |  124 ++++++++++++++++++++++++++++++
 2 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 kern/sparc64/ieee1275/ieee1275.c
include/grub/sparc64/ieee1275/ieee1275.h +22 -0
index 1ef95f9..7626e93 100644
@@ -24,4 +24,26 @@
 
 typedef grub_uint64_t grub_ieee1275_cell_t;
 
+/* Encoding of 'mode' argument to grub_ieee1275_map_physical() */
+#define IEEE1275_MAP_WRITE	0x0001 /* Writable */
+#define IEEE1275_MAP_READ	0x0002 /* Readable */
+#define IEEE1275_MAP_EXEC	0x0004 /* Executable */
+#define IEEE1275_MAP_LOCKED	0x0010 /* Locked in TLB */
+#define IEEE1275_MAP_CACHED	0x0020 /* Cacheable */
+#define IEEE1275_MAP_SE		0x0040 /* Side-effects */
+#define IEEE1275_MAP_GLOBAL	0x0080 /* Global */
+#define IEEE1275_MAP_IE		0x0100 /* Invert Endianness */
+#define IEEE1275_MAP_DEFAULT	(IEEE1275_MAP_WRITE | IEEE1275_MAP_READ | \
+				 IEEE1275_MAP_EXEC | IEEE1275_MAP_CACHED)
+
+extern int EXPORT_FUNC(grub_ieee1275_map_physical) (grub_addr_t paddr,
+						    grub_addr_t vaddr,
+						    grub_size_t size,
+						    grub_uint32_t mode);
+extern int EXPORT_FUNC(grub_ieee1275_claim_vaddr) (grub_addr_t vaddr,
+						   grub_size_t size);
+extern int EXPORT_FUNC(grub_ieee1275_alloc_physmem) (grub_addr_t *paddr,
+						     grub_size_t size,
+						     grub_uint32_t align);
+
 #endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
kern/sparc64/ieee1275/ieee1275.c new file +124 -0

124 lines not on this page · raw message

Signature · 1 line
1.6.2.3