Skip to contentSkip to conversation

Subject: [PATCH 20/33] score: create head files fixmap.h param.h resource.h setup.h sections.h segment.h string.h system.h

PATCH Chen Liqin 1 participant 1 message Aug 26, 2009 Generic include/asm header files

lore
Share & tools
lore

Chen Liqin

author
#0 lore raw

From 17bfd28056f3b690d854ec92257e71e895930d62 Mon Sep 17 00:00:00 2001
From: Chen Liqin <[email protected]>
Date: Wed, 26 Aug 2009 10:05:06 +0800
Subject: [PATCH 20/33] score: create head files fixmap.h param.h resource.h setup.h sections.h segment.h string.h system.h

---
 arch/score/include/asm/fixmap.h   |   82 +++++++++++++++++++++++++++++++++
 arch/score/include/asm/param.h    |    6 +++
 arch/score/include/asm/resource.h |    6 +++
 arch/score/include/asm/sections.h |    6 +++
 arch/score/include/asm/segment.h  |   21 +++++++++
 arch/score/include/asm/setup.h    |   41 +++++++++++++++++
 arch/score/include/asm/string.h   |    8 +++
 arch/score/include/asm/system.h   |   90 +++++++++++++++++++++++++++++++++++++
 8 files changed, 260 insertions(+), 0 deletions(-)
 create mode 100644 arch/score/include/asm/fixmap.h
 create mode 100644 arch/score/include/asm/param.h
 create mode 100644 arch/score/include/asm/resource.h
 create mode 100644 arch/score/include/asm/sections.h
 create mode 100644 arch/score/include/asm/segment.h
 create mode 100644 arch/score/include/asm/setup.h
 create mode 100644 arch/score/include/asm/string.h
 create mode 100644 arch/score/include/asm/system.h
arch/score/include/asm/fixmap.h new file +82 -0
new file mode 100644
index 0000000..ee16766
@@ -0,0 +1,82 @@
+#ifndef _ASM_SCORE_FIXMAP_H
+#define _ASM_SCORE_FIXMAP_H
+
+#include <asm/page.h>
+
+#define PHY_RAM_BASE		0x00000000
+#define PHY_IO_BASE		0x10000000
+
+#define VIRTUAL_RAM_BASE	0xa0000000
+#define VIRTUAL_IO_BASE		0xb0000000
+
+#define RAM_SPACE_SIZE		0x10000000
+#define IO_SPACE_SIZE		0x10000000
+
+/* Kernel unmapped, cached 512MB */
+#define KSEG1			0xa0000000
+
+/*
+ * Here we define all the compile-time 'special' virtual
+ * addresses. The point is to have a constant address at
+ * compile time, but to set the physical address only
+ * in the boot process. We allocate these special addresses
+ * from the end of virtual memory (0xfffff000) backwards.
+ * Also this lets us do fail-safe vmalloc(), we
+ * can guarantee that these special addresses and
+ * vmalloc()-ed addresses never overlap.
+ *
+ * these 'compile-time allocated' memory buffers are
+ * fixed-size 4k pages. (or larger if used with an increment
+ * highger than 1) use fixmap_set(idx,phys) to associate
+ * physical memory with fixmap indices.
+ *
+ * TLB entries of such buffers will not be flushed across
+ * task switches.
+ */
+
+/*
+ * on UP currently we will have no trace of the fixmap mechanizm,
+ * no page table allocations, etc. This might change in the
+ * future, say framebuffers for the console driver(s) could be
+ * fix-mapped?
+ */
+enum fixed_addresses {
+#define FIX_N_COLOURS 8
+	FIX_CMAP_BEGIN,
+	FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
+	__end_of_fixed_addresses
+};
+
+/*
+ * used by vmalloc.c.
+ *
+ * Leave one empty page between vmalloc'ed areas and
+ * the start of the fixmap, and leave one page empty
+ * at the top of mem..
+ */
+#define FIXADDR_TOP	((unsigned long)(long)(int)0xfefe0000)
+#define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
+#define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE)
+
+#define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT))
+#define __virt_to_fix(x)	\
+	((FIXADDR_TOP - ((x) & PAGE_MASK)) >> PAGE_SHIFT)
+
+extern void __this_fixmap_does_not_exist(void);
+
+/*
+ * 'index to address' translation. If anyone tries to use the idx
+ * directly without tranlation, we catch the bug with a NULL-deference
+ * kernel oops. Illegal ranges of incoming indices are caught too.
+ */
+static inline unsigned long fix_to_virt(const unsigned int idx)
+{
+	return __fix_to_virt(idx);
+}
+
+static inline unsigned long virt_to_fix(const unsigned long vaddr)
+{
+	return __virt_to_fix(vaddr);
+}
+
+#endif /* _ASM_SCORE_FIXMAP_H */
arch/score/include/asm/param.h new file +6 -0
new file mode 100644
index 0000000..916b869
@@ -0,0 +1,6 @@
+#ifndef _ASM_SCORE_PARAM_H
+#define _ASM_SCORE_PARAM_H
+
+#include <asm-generic/param.h>
+
+#endif /* _ASM_SCORE_PARAM_H */
arch/score/include/asm/resource.h new file +6 -0
new file mode 100644
index 0000000..9ce22bc
@@ -0,0 +1,6 @@
+#ifndef _ASM_SCORE_RESOURCE_H
+#define _ASM_SCORE_RESOURCE_H
+
+#include <asm-generic/resource.h>
+
+#endif /* _ASM_SCORE_RESOURCE_H */
arch/score/include/asm/sections.h new file +6 -0
new file mode 100644
index 0000000..9441d23
@@ -0,0 +1,6 @@
+#ifndef _ASM_SCORE_SECTIONS_H
+#define _ASM_SCORE_SECTIONS_H
+
+#include <asm-generic/sections.h>
+
+#endif /* _ASM_SCORE_SECTIONS_H */
arch/score/include/asm/segment.h new file +21 -0
new file mode 100644
index 0000000..e16cf6a
@@ -0,0 +1,21 @@
+#ifndef _ASM_SCORE_SEGMENT_H
+#define _ASM_SCORE_SEGMENT_H
+
+#ifndef __ASSEMBLY__
+
+typedef struct {
+	unsigned long seg;
+} mm_segment_t;
+
+#define KERNEL_DS	((mm_segment_t){0})
+#define USER_DS	KERNEL_DS
+
+# define get_ds()	(KERNEL_DS)
+# define get_fs()	(current_thread_info()->addr_limit)
+# define set_fs(x)	\
+	do { current_thread_info()->addr_limit = (x); } while (0)
+
+# define segment_eq(a, b)	((a).seg == (b).seg)
+
+# endif /* __ASSEMBLY__ */
+#endif /* _ASM_SCORE_SEGMENT_H */
arch/score/include/asm/setup.h new file +41 -0

41 lines not on this page · raw message

arch/score/include/asm/string.h new file +8 -0
new file mode 100644
index 0000000..8a6bf50
@@ -0,0 +1,8 @@
+#ifndef _ASM_SCORE_STRING_H
+#define _ASM_SCORE_STRING_H
+
+extern void *memset(void *__s, int __c, size_t __count);
+extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
+extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
+
+#endif /* _ASM_SCORE_STRING_H */
arch/score/include/asm/system.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.6.2