linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Geoff Levand <geoff@infradead.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: cbe-oss-dev@lists.ozlabs.org, linuxppc-dev@lists.ozlabs.org,
	Nathan Whitehorn <nwhitehorn@freebsd.org>
Subject: [PATCH 2/6] powerpc/ps3: Add ps3_mm_set_repository_highmem
Date: Tue, 13 Jan 2015 01:00:20 +0000	[thread overview]
Message-ID: <ee18686aeef86b3d0cefd9db70ee0f6283f4fb2e.1421109719.git.geoff@infradead.org> (raw)
In-Reply-To: <cover.1421109719.git.geoff@infradead.org>

Add the new routine ps3_mm_set_repository_highmem() that saves highmem info to
the ps3 repository.  Also, move the existing ps3_mm_get_repository_highmem()
routine up in the source file.

This inplementation of ps3_mm_set_repository_highmem() assumes the repository
will have a single highmem region entry (at index 0).

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/powerpc/platforms/ps3/mm.c | 68 +++++++++++++++++++++++------------------
 1 file changed, 38 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 0c9f643..04c1b93 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -223,6 +223,44 @@ void ps3_mm_vas_destroy(void)
 	}
 }
 
+static int ps3_mm_get_repository_highmem(struct mem_region *r)
+{
+	int result;
+
+	/* Assume a single highmem region. */
+
+	result = ps3_repository_read_highmem_info(0, &r->base, &r->size);
+
+	if (result)
+		goto zero_region;
+
+	if (!r->base || !r->size) {
+		result = -1;
+		goto zero_region;
+	}
+
+	r->offset = r->base - map.rm.size;
+
+	DBG("%s:%d: Found high region in repository: %llxh %llxh\n",
+	    __func__, __LINE__, r->base, r->size);
+
+	return 0;
+
+zero_region:
+	DBG("%s:%d: No high region in repository.\n", __func__, __LINE__);
+
+	r->size = r->base = r->offset = 0;
+	return result;
+}
+
+static int ps3_mm_set_repository_highmem(const struct mem_region *r)
+{
+	/* Assume a single highmem region. */
+
+	return r ? ps3_repository_write_highmem_info(0, r->base, r->size) :
+		ps3_repository_write_highmem_info(0, 0, 0);
+}
+
 /**
  * ps3_mm_region_create - create a memory region in the vas
  * @r: pointer to a struct mem_region to accept initialized values
@@ -293,36 +331,6 @@ static void ps3_mm_region_destroy(struct mem_region *r)
 	}
 }
 
-static int ps3_mm_get_repository_highmem(struct mem_region *r)
-{
-	int result;
-
-	/* Assume a single highmem region. */
-
-	result = ps3_repository_read_highmem_info(0, &r->base, &r->size);
-
-	if (result)
-		goto zero_region;
-
-	if (!r->base || !r->size) {
-		result = -1;
-		goto zero_region;
-	}
-
-	r->offset = r->base - map.rm.size;
-
-	DBG("%s:%d: Found high region in repository: %llxh %llxh\n",
-	    __func__, __LINE__, r->base, r->size);
-
-	return 0;
-
-zero_region:
-	DBG("%s:%d: No high region in repository.\n", __func__, __LINE__);
-
-	r->size = r->base = r->offset = 0;
-	return result;
-}
-
 /*============================================================================*/
 /* dma routines                                                               */
 /*============================================================================*/
-- 
1.9.1

  parent reply	other threads:[~2015-01-13  1:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  1:00 [PATCH 0/6] *** SUBJECT HERE *** Geoff Levand
2015-01-13  1:00 ` [PATCH 4/6] powerpc/ps3: Fix vuart sparse warnings Geoff Levand
2015-01-13  1:00 ` Geoff Levand [this message]
2015-01-13  1:00 ` [PATCH 3/6] powerpc/ps3: Write highmem info to repository Geoff Levand
2015-01-13  3:04   ` Michael Ellerman
2015-01-13 18:33     ` Geoff Levand
2015-01-13  1:00 ` [PATCH 1/6] powerpc/ps3: Add empty repository highmem routines Geoff Levand
2015-01-13  1:00 ` [PATCH 5/6] powerpc/ps3: Fix sys-manager-core sparse warnings Geoff Levand
2015-01-13  1:00 ` [PATCH 6/6] powerpc/ps3: Update ps3_defconfig Geoff Levand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee18686aeef86b3d0cefd9db70ee0f6283f4fb2e.1421109719.git.geoff@infradead.org \
    --to=geoff@infradead.org \
    --cc=benh@kernel.crashing.org \
    --cc=cbe-oss-dev@lists.ozlabs.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nwhitehorn@freebsd.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).