linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andre Heider <a.heider@gmail.com>
To: Geoff Levand <geoff@infradead.org>
Cc: cbe-oss-dev@lists.ozlabs.org,
	Hector Martin <hector@marcansoft.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 12/15] ps3stor_lib: Add support for storage access flags
Date: Mon,  1 Aug 2011 22:03:03 +0200	[thread overview]
Message-ID: <1312228986-32307-13-git-send-email-a.heider@gmail.com> (raw)
In-Reply-To: <1312228986-32307-1-git-send-email-a.heider@gmail.com>

Users can now set the access flags in the region struct. This is
required for accessing the first region, or selecting an alternative
decryption key for the vflash partitions.

Signed-off-by: Andre Heider <a.heider@gmail.com>
---
 arch/powerpc/include/asm/ps3stor.h       |    8 +++++++-
 arch/powerpc/platforms/ps3/device-init.c |    1 +
 drivers/block/ps3disk.c                  |    5 +++--
 drivers/ps3/ps3stor_lib.c                |    5 +++--
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/ps3stor.h b/arch/powerpc/include/asm/ps3stor.h
index 9871c05..f29aa37 100644
--- a/arch/powerpc/include/asm/ps3stor.h
+++ b/arch/powerpc/include/asm/ps3stor.h
@@ -25,12 +25,18 @@
 
 #include <asm/ps3.h>
 
-#define PS3_STORAGE_MAX_REGIONS		(8)
+#define PS3_STORAGE_MAX_REGIONS			(8)
+
+#define PS3_STORAGE_FLAG_DEFAULT		(0)
+#define PS3_STORAGE_FLAG_SKIP_ACL		(1 << 1)
+#define PS3_STORAGE_FLAG_ALT_KEY		(1 << 2)
+#define PS3_STORAGE_FLAG_UNENCRYPTED	(1 << 5)
 
 struct ps3_storage_region {
 	unsigned int id;
 	u64 start;
 	u64 size;
+	u64 flags;
 };
 
 struct ps3_storage_device {
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index 830d741..7a3dbf8 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -409,6 +409,7 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
 		p->regions[i].id = id;
 		p->regions[i].start = start;
 		p->regions[i].size = size;
+		p->regions[i].flags = PS3_STORAGE_FLAG_DEFAULT;
 	}
 
 	result = ps3_system_bus_device_register(&p->sbd);
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index cba8b45..30dae10 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -130,6 +130,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
 	unsigned int region_idx = MINOR(disk_devt(req->rq_disk)) &
 				  (PS3DISK_MINORS - 1);
 	unsigned int region_id = dev->regions[region_idx].id;
+	u64 flags = dev->regions[region_idx].flags;
 
 #ifdef DEBUG
 	unsigned int n = 0;
@@ -152,11 +153,11 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
 		ps3disk_scatter_gather(dev, req, 1);
 
 		res = lv1_storage_write(dev->sbd.dev_id, region_id,
-					start_sector, sectors, 0,
+					start_sector, sectors, flags,
 					dev->bounce_lpar, &dev->tag);
 	} else {
 		res = lv1_storage_read(dev->sbd.dev_id, region_id,
-				       start_sector, sectors, 0,
+				       start_sector, sectors, flags,
 				       dev->bounce_lpar, &dev->tag);
 	}
 	if (res) {
diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c
index 5bbc023..8bb54ac 100644
--- a/drivers/ps3/ps3stor_lib.c
+++ b/drivers/ps3/ps3stor_lib.c
@@ -275,6 +275,7 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev,
 			       u64 start_sector, u64 sectors, int write)
 {
 	unsigned int region_id = dev->regions[region_idx].id;
+	u64 flags = dev->regions[region_idx].flags;
 	const char *op = write ? "write" : "read";
 	int res;
 
@@ -283,10 +284,10 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev,
 
 	init_completion(&dev->done);
 	res = write ? lv1_storage_write(dev->sbd.dev_id, region_id,
-					start_sector, sectors, 0, lpar,
+					start_sector, sectors, flags, lpar,
 					&dev->tag)
 		    : lv1_storage_read(dev->sbd.dev_id, region_id,
-				       start_sector, sectors, 0, lpar,
+				       start_sector, sectors, flags, lpar,
 				       &dev->tag);
 	if (res) {
 		dev_dbg(&dev->sbd.core, "%s:%u: %s failed %d\n", __func__,
-- 
1.7.5.4

  parent reply	other threads:[~2011-08-01 20:03 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 20:02 [PATCH 00/15] ps3: Support more than the OtherOS lpar Andre Heider
2011-08-01 20:02 ` [PATCH 01/15] [PS3] Add udbg driver using the PS3 gelic Ethernet device Andre Heider
2011-08-03 22:32   ` Geoff Levand
2011-08-04 16:35     ` Andre Heider
2011-08-11 12:13     ` [Cbe-oss-dev] " Arnd Bergmann
2011-08-11 17:32       ` Andre Heider
2011-08-31  4:26         ` Benjamin Herrenschmidt
2011-08-01 20:02 ` [PATCH 02/15] [PS3] Get lv1 high memory region from devtree Andre Heider
2011-08-03 22:30   ` Geoff Levand
2011-08-04  1:19     ` Hector Martin
2011-08-04 19:24       ` Geoff Levand
2011-08-06 11:50         ` Andre Heider
2011-08-01 20:02 ` [PATCH 03/15] [PS3] Add region 1 memory early Andre Heider
2011-08-03 22:32   ` Geoff Levand
2011-08-04  0:08     ` Hector Martin
2011-08-04  7:05       ` Geert Uytterhoeven
2011-08-04 11:13         ` Hector Martin
2011-08-04 15:57       ` Geoff Levand
2011-08-01 20:02 ` [PATCH 04/15] ps3: MEMORY_HOTPLUG is not a requirement anymore Andre Heider
2011-08-01 20:02 ` [PATCH 05/15] ps3: Detect the current lpar environment Andre Heider
2011-08-03 22:31   ` Geoff Levand
2011-08-04 16:34     ` Andre Heider
2011-08-01 20:02 ` [PATCH 06/15] ps3flash: Fix region align checks Andre Heider
2011-08-01 20:29   ` [Cbe-oss-dev] " Geert Uytterhoeven
2011-08-01 20:56     ` Andre Heider
2011-08-01 21:00       ` Geert Uytterhoeven
2011-08-01 20:02 ` [PATCH 07/15] ps3flash: Refuse to work in lpars other than OtherOS Andre Heider
2011-08-03 22:34   ` Geoff Levand
2011-08-04 16:40     ` Andre Heider
2011-08-04 19:27       ` [Cbe-oss-dev] " Geert Uytterhoeven
2011-08-06 12:40         ` Andre Heider
2011-08-01 20:02 ` [PATCH 08/15] ps3: Only prealloc the flash bounce buffer for the OtherOS lpar Andre Heider
2011-08-01 20:03 ` [PATCH 09/15] ps3: Limit the number of regions per storage device Andre Heider
2011-08-01 20:30   ` [Cbe-oss-dev] " Geert Uytterhoeven
2011-08-01 20:58     ` Andre Heider
2011-08-06 12:28       ` Andre Heider
2011-08-06 12:47         ` Andre Heider
2011-08-01 20:03 ` [PATCH 10/15] ps3stor_lib: Add support for multiple regions Andre Heider
2011-08-01 20:35   ` Geert Uytterhoeven
2011-08-01 21:01     ` Andre Heider
2011-08-01 20:03 ` [PATCH 11/15] ps3disk: Provide a gendisk per accessible region Andre Heider
2011-08-01 20:03 ` Andre Heider [this message]
2011-08-01 20:03 ` [PATCH 13/15] ps3disk: Use region flags Andre Heider
2011-08-01 20:03 ` [PATCH 14/15] ps3: Add a vflash driver for lpars other than OtherOS Andre Heider
2011-08-01 20:03 ` [PATCH 15/15] ps3: Add a NOR FLASH driver for PS3s without NAND Andre Heider
2011-08-03 22:23 ` [PATCH 00/15] ps3: Support more than the OtherOS lpar Geoff Levand
2011-08-04 16:31   ` Andre Heider
2011-08-11 12:17 ` [Cbe-oss-dev] " Arnd Bergmann
2011-08-11 17:34   ` Andre Heider
2011-08-11 19:31 ` [PATCH part1 v2 0/9] ps3: General improvements and preparation for support " Andre Heider
2011-08-11 19:31   ` [PATCH part1 v2 1/9] Add udbg driver using the PS3 gelic Ethernet device Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-31 16:32       ` [PATCH] [ps3] Add gelic udbg driver Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 2/9] ps3: Add helper functions to read highmem info from the repository Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 3/9] ps3: Get lv1 high memory region " Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 4/9] Add region 1 memory early Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-23 22:37       ` [Cbe-oss-dev] " Antonio Ospite
2011-08-24  2:15         ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 5/9] ps3: MEMORY_HOTPLUG is not a requirement anymore Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 6/9] ps3: Detect the current lpar Andre Heider
2011-08-23 22:08     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 7/9] ps3: Log the detected lpar on startup Andre Heider
2011-08-11 19:31   ` [PATCH part1 v2 8/9] ps3flash: Refuse to work in lpars other than OtherOS Andre Heider
2011-08-23 22:12     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 9/9] ps3: Only prealloc the flash bounce buffer for the OtherOS lpar Andre Heider
2011-08-31  4:29   ` [PATCH part1 v2 0/9] ps3: General improvements and preparation for support more than " Benjamin Herrenschmidt

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=1312228986-32307-13-git-send-email-a.heider@gmail.com \
    --to=a.heider@gmail.com \
    --cc=cbe-oss-dev@lists.ozlabs.org \
    --cc=geoff@infradead.org \
    --cc=hector@marcansoft.com \
    --cc=linuxppc-dev@lists.ozlabs.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).