Commit 434cbf28 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: unisys: Finally remove the last remnants of memregion

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 34b479ae
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "periodic_work.h" #include "periodic_work.h"
#include "channel.h" #include "channel.h"
#include "memregion.h"
#ifndef HOSTADDRESS #ifndef HOSTADDRESS
#define HOSTADDRESS u64 #define HOSTADDRESS u64
......
...@@ -17,12 +17,9 @@ ...@@ -17,12 +17,9 @@
/* /*
* This provides Supervisor channel communication primitives, which are * This provides Supervisor channel communication primitives, which are
* independent of the mechanism used to access the channel data. All channel * independent of the mechanism used to access the channel data.
* data is accessed using the memregion abstraction. (memregion has both
* a CM2 implementation and a direct memory implementation.)
*/ */
#include "memregion.h"
#include "version.h" #include "version.h"
#include "visorbus.h" #include "visorbus.h"
#include <linux/uuid.h> #include <linux/uuid.h>
...@@ -30,7 +27,9 @@ ...@@ -30,7 +27,9 @@
#define MYDRVNAME "visorchannel" #define MYDRVNAME "visorchannel"
struct visorchannel { struct visorchannel {
struct memregion memregion; /* from visor_memregion_create() */ HOSTADDRESS physaddr;
ulong nbytes;
void __iomem *mapped;
struct channel_header chan_hdr; struct channel_header chan_hdr;
uuid_le guid; uuid_le guid;
ulong size; ulong size;
...@@ -69,14 +68,14 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, ...@@ -69,14 +68,14 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
if (!request_mem_region(physaddr, size, MYDRVNAME)) if (!request_mem_region(physaddr, size, MYDRVNAME))
goto cleanup; goto cleanup;
channel->memregion.mapped = ioremap_cache(physaddr, size); channel->mapped = ioremap_cache(physaddr, size);
if (!channel->memregion.mapped) { if (!channel->mapped) {
release_mem_region(physaddr, size); release_mem_region(physaddr, size);
goto cleanup; goto cleanup;
} }
channel->memregion.physaddr = physaddr; channel->physaddr = physaddr;
channel->memregion.nbytes = size; channel->nbytes = size;
err = visorchannel_read(channel, 0, &channel->chan_hdr, err = visorchannel_read(channel, 0, &channel->chan_hdr,
sizeof(struct channel_header)); sizeof(struct channel_header));
...@@ -89,22 +88,19 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes, ...@@ -89,22 +88,19 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
if (uuid_le_cmp(guid, NULL_UUID_LE) == 0) if (uuid_le_cmp(guid, NULL_UUID_LE) == 0)
guid = channel->chan_hdr.chtype; guid = channel->chan_hdr.chtype;
iounmap(channel->memregion.mapped); iounmap(channel->mapped);
release_mem_region(channel->memregion.physaddr, release_mem_region(channel->physaddr, channel->nbytes);
channel->memregion.nbytes); channel->mapped = NULL;
channel->memregion.mapped = NULL; if (!request_mem_region(channel->physaddr, channel_bytes, MYDRVNAME))
if (!request_mem_region(channel->memregion.physaddr, channel_bytes,
MYDRVNAME))
goto cleanup; goto cleanup;
channel->memregion.mapped = ioremap_cache(channel->memregion.physaddr, channel->mapped = ioremap_cache(channel->physaddr, channel_bytes);
channel_bytes); if (!channel->mapped) {
if (!channel->memregion.mapped) { release_mem_region(channel->physaddr, channel_bytes);
release_mem_region(channel->memregion.physaddr, channel_bytes);
goto cleanup; goto cleanup;
} }
channel->memregion.nbytes = channel_bytes; channel->nbytes = channel_bytes;
channel->size = channel_bytes; channel->size = channel_bytes;
channel->guid = guid; channel->guid = guid;
...@@ -137,10 +133,9 @@ visorchannel_destroy(struct visorchannel *channel) ...@@ -137,10 +133,9 @@ visorchannel_destroy(struct visorchannel *channel)
{ {
if (!channel) if (!channel)
return; return;
if (channel->memregion.mapped) { if (channel->mapped) {
iounmap(channel->memregion.mapped); iounmap(channel->mapped);
release_mem_region(channel->memregion.physaddr, release_mem_region(channel->physaddr, channel->nbytes);
channel->memregion.nbytes);
} }
kfree(channel); kfree(channel);
} }
...@@ -149,7 +144,7 @@ EXPORT_SYMBOL_GPL(visorchannel_destroy); ...@@ -149,7 +144,7 @@ EXPORT_SYMBOL_GPL(visorchannel_destroy);
HOSTADDRESS HOSTADDRESS
visorchannel_get_physaddr(struct visorchannel *channel) visorchannel_get_physaddr(struct visorchannel *channel)
{ {
return channel->memregion.physaddr; return channel->physaddr;
} }
EXPORT_SYMBOL_GPL(visorchannel_get_physaddr); EXPORT_SYMBOL_GPL(visorchannel_get_physaddr);
...@@ -200,10 +195,10 @@ int ...@@ -200,10 +195,10 @@ int
visorchannel_read(struct visorchannel *channel, ulong offset, visorchannel_read(struct visorchannel *channel, ulong offset,
void *local, ulong nbytes) void *local, ulong nbytes)
{ {
if (offset + nbytes > channel->memregion.nbytes) if (offset + nbytes > channel->nbytes)
return -EIO; return -EIO;
memcpy_fromio(local, channel->memregion.mapped + offset, nbytes); memcpy_fromio(local, channel->mapped + offset, nbytes);
return 0; return 0;
} }
...@@ -216,7 +211,7 @@ visorchannel_write(struct visorchannel *channel, ulong offset, ...@@ -216,7 +211,7 @@ visorchannel_write(struct visorchannel *channel, ulong offset,
size_t chdr_size = sizeof(struct channel_header); size_t chdr_size = sizeof(struct channel_header);
size_t copy_size; size_t copy_size;
if (offset + nbytes > channel->memregion.nbytes) if (offset + nbytes > channel->nbytes)
return -EIO; return -EIO;
if (offset < chdr_size) { if (offset < chdr_size) {
...@@ -224,7 +219,7 @@ visorchannel_write(struct visorchannel *channel, ulong offset, ...@@ -224,7 +219,7 @@ visorchannel_write(struct visorchannel *channel, ulong offset,
memcpy(&channel->chan_hdr + offset, local, copy_size); memcpy(&channel->chan_hdr + offset, local, copy_size);
} }
memcpy_toio(channel->memregion.mapped + offset, local, nbytes); memcpy_toio(channel->mapped + offset, local, nbytes);
return 0; return 0;
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#define __VISORCHANNEL_GLOBALS_H__ #define __VISORCHANNEL_GLOBALS_H__
#include "timskmod.h" #include "timskmod.h"
#include "memregion.h"
#include "version.h" #include "version.h"
#define MYDRVNAME "visorchannel" #define MYDRVNAME "visorchannel"
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
obj-$(CONFIG_UNISYS_VISORUTIL) += visorutil.o obj-$(CONFIG_UNISYS_VISORUTIL) += visorutil.o
visorutil-y := charqueue.o periodic_work.o memregion_direct.o visorkmodutils.o visorutil-y := charqueue.o periodic_work.o visorkmodutils.o
ccflags-y += -Idrivers/staging/unisys/include ccflags-y += -Idrivers/staging/unisys/include
/* memregion.h
*
* Copyright (C) 2010 - 2013 UNISYS CORPORATION
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*/
#ifndef __MEMREGION_H__
#define __MEMREGION_H__
#include "timskmod.h"
/* struct memregion is an opaque structure to users.
* Fields are declared only in the implementation .c files.
*/
struct memregion {
HOSTADDRESS physaddr;
ulong nbytes;
void __iomem *mapped;
};
void memregion_dump(struct memregion *memregion, char *s,
ulong off, ulong len, struct seq_file *seq);
#endif
/* memregion_direct.c
*
* Copyright (C) 2010 - 2013 UNISYS CORPORATION
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*/
/*
* This is an implementation of memory regions that can be used to read/write
* channel memory (in main memory of the host system) from code running in
* a virtual partition.
*/
#include "timskmod.h"
#include "memregion.h"
#define MYDRVNAME "memregion"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment