blob: 9a6c246b0e65d4ec763b46e7ab375bec4c34ed9a [file] [log] [blame]
From Aaditya.Kumar@ap.sony.com Fri Nov 23 03:42:02 2012
From: Aaditya Kumar <aaditya.kumar@ap.sony.com>
Date: Fri, 23 Nov 2012 17:06:20 +0530
Subject: [PATCH v2 RESEND 07/15] AXFS: axfs_physmem.c
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "ltsi-dev@lists.linuxfoundation.org" <ltsi-dev@lists.linuxfoundation.org>, tim.bird@am.sony.com, frank.rowand@am.sony.com, takuzo.ohara@ap.sony.com, amit.agarwal@ap.sony.com, kan.iibuchi@jp.sony.com, aaditya.kumar.30@gmail.com
Message-ID: <50AF5FB4.4000102@ap.sony.com>
From: Jared Hulbert <jaredeh@gmail.com>
Allows axfs to use striaght memory or has dummy functions if
this is a UML system.
Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
Signed-off-by: Aaditya Kumar <aaditya.kumar@ap.sony.com>
---
fs/axfs/axfs_physmem.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 fs/axfs/axfs_physmem.c
--- /dev/null
+++ b/fs/axfs/axfs_physmem.c
@@ -0,0 +1,65 @@
+/*
+ * Advanced XIP File System for Linux - AXFS
+ * Readonly, compressed, and XIP filesystem for Linux systems big and small
+ *
+ * Copyright(c) 2008 Numonyx
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * Authors:
+ * Jared Hulbert <jaredeh@gmail.com>
+ *
+ * Project url: http://axfs.sourceforge.net
+ *
+ * axfs_physmem.c -
+ * Allows axfs to use striaght memory or has dummy functions if
+ * this is a UML system.
+ */
+#include "axfs.h"
+
+#include <linux/fs.h>
+#ifdef CONFIG_UML
+
+void axfs_map_physmem(struct axfs_super *sbi, unsigned long size)
+{
+}
+
+void axfs_unmap_physmem(struct super_block *sb)
+{
+}
+
+#else
+#include <linux/io.h>
+
+#ifdef ioremap_cached
+#define AXFS_REMAP(a, b) (void __force *)ioremap_cached((a), (b))
+#else
+#define AXFS_REMAP(a, b) (void __force *)ioremap((a), (b))
+#endif /* ioremap_cached */
+
+void axfs_map_physmem(struct axfs_super *sbi, unsigned long size)
+{
+ void *addr;
+
+ if (axfs_is_physmem(sbi)) {
+ addr = AXFS_REMAP(sbi->phys_start_addr, size);
+ sbi->virt_start_addr = (unsigned long)addr;
+ }
+}
+
+void axfs_unmap_physmem(struct super_block *sb)
+{
+ struct axfs_super *sbi = AXFS_SB(sb);
+
+ if (!sbi)
+ return;
+
+ if (axfs_is_physmem(sbi) && axfs_virtaddr_is_valid(sbi)) {
+ iounmap((void *)(sbi->virt_start_addr));
+ sbi->virt_start_addr = 0;
+ }
+}
+
+#endif /* CONFIG_UML */