Skip to content

Commit

Permalink
[POWERPC] Store the base address in dcr_host_t
Browse files Browse the repository at this point in the history
In its current form, dcr_map() doesn't remember the base address you passed
it, which means you need to store it somewhere else.  Rather than adding the
base to another struct it seems simpler to store it in the dcr_host_t.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Oct 3, 2007
1 parent ca786f8 commit 0b94a1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/dcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ u64 of_translate_dcr_address(struct device_node *dev,
dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
unsigned int dcr_c)
{
dcr_host_t ret = { .token = NULL, .stride = 0 };
dcr_host_t ret = { .token = NULL, .stride = 0, .base = dcr_n };
u64 addr;

pr_debug("dcr_map(%s, 0x%x, 0x%x)\n",
Expand Down
6 changes: 5 additions & 1 deletion include/asm-powerpc/dcr-mmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@

#include <asm/io.h>

typedef struct { void __iomem *token; unsigned int stride; } dcr_host_t;
typedef struct {
void __iomem *token;
unsigned int stride;
unsigned int base;
} dcr_host_t;

#define DCR_MAP_OK(host) ((host).token != NULL)

Expand Down
6 changes: 4 additions & 2 deletions include/asm-powerpc/dcr-native.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
#ifdef __KERNEL__
#ifndef __ASSEMBLY__

typedef struct {} dcr_host_t;
typedef struct {
unsigned int base;
} dcr_host_t;

#define DCR_MAP_OK(host) (1)

#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){})
#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) })
#define dcr_unmap(host, dcr_n, dcr_c) do {} while (0)
#define dcr_read(host, dcr_n) mfdcr(dcr_n)
#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value)
Expand Down

0 comments on commit 0b94a1e

Please sign in to comment.