Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
e6cc3360
Commit
e6cc3360
authored
Sep 10, 2004
by
Linus Torvalds
Committed by
Linus Torvalds
Sep 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppc64: PCI memory annotation infrastructure
parent
ad3754d9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
151 additions
and
123 deletions
+151
-123
arch/ppc64/kernel/eeh.c
arch/ppc64/kernel/eeh.c
+3
-3
arch/ppc64/kernel/iSeries_pci.c
arch/ppc64/kernel/iSeries_pci.c
+18
-23
arch/ppc64/mm/init.c
arch/ppc64/mm/init.c
+27
-22
include/asm-ppc64/eeh.h
include/asm-ppc64/eeh.h
+28
-27
include/asm-ppc64/iSeries/iSeries_io.h
include/asm-ppc64/iSeries/iSeries_io.h
+9
-9
include/asm-ppc64/io.h
include/asm-ppc64/io.h
+66
-39
No files found.
arch/ppc64/kernel/eeh.c
View file @
e6cc3360
...
...
@@ -473,7 +473,7 @@ EXPORT_SYMBOL(eeh_dn_check_failure);
*
* Note this routine is safe to call in an interrupt context.
*/
unsigned
long
eeh_check_failure
(
void
*
token
,
unsigned
long
val
)
unsigned
long
eeh_check_failure
(
const
volatile
void
__iomem
*
token
,
unsigned
long
val
)
{
unsigned
long
addr
;
struct
pci_dev
*
dev
;
...
...
@@ -739,7 +739,7 @@ EXPORT_SYMBOL(eeh_remove_device);
* Remap the addr (trivially) to the EEH region if EEH checking enabled.
* For addresses not known to PCI the vaddr is simply returned unchanged.
*/
void
*
eeh_ioremap
(
unsigned
long
addr
,
void
*
vaddr
)
void
__iomem
*
eeh_ioremap
(
unsigned
long
addr
,
void
__iomem
*
vaddr
)
{
struct
pci_dev
*
dev
;
struct
device_node
*
dn
;
...
...
@@ -763,7 +763,7 @@ void *eeh_ioremap(unsigned long addr, void *vaddr)
}
pci_dev_put
(
dev
);
return
(
void
*
)
IO_ADDR_TO_TOKEN
(
vaddr
);
return
(
void
__iomem
*
)
IO_ADDR_TO_TOKEN
(
vaddr
);
}
static
int
proc_eeh_show
(
struct
seq_file
*
m
,
void
*
v
)
...
...
arch/ppc64/kernel/iSeries_pci.c
View file @
e6cc3360
...
...
@@ -419,46 +419,39 @@ static int iSeries_Scan_Bridge_Slot(HvBusNumber Bus,
* I/0 Memory copy MUST use mmio commands on iSeries
* To do; For performance, include the hv call directly
*/
void
*
iSeries_memset_io
(
void
*
dest
,
char
c
,
size_t
Count
)
void
iSeries_memset_io
(
volatile
void
__iomem
*
dest
,
char
c
,
size_t
Count
)
{
u8
ByteValue
=
c
;
long
NumberOfBytes
=
Count
;
char
*
IoBuffer
=
dest
;
while
(
NumberOfBytes
>
0
)
{
iSeries_Write_Byte
(
ByteValue
,
(
void
*
)
IoBuffer
);
++
IoBuffer
;
iSeries_Write_Byte
(
ByteValue
,
dest
++
);
--
NumberOfBytes
;
}
return
dest
;
}
EXPORT_SYMBOL
(
iSeries_memset_io
);
void
*
iSeries_memcpy_toio
(
void
*
dest
,
void
*
source
,
size_t
count
)
void
iSeries_memcpy_toio
(
volatile
void
__iomem
*
dest
,
void
*
source
,
size_t
count
)
{
char
*
dst
=
dest
;
char
*
src
=
source
;
long
NumberOfBytes
=
count
;
while
(
NumberOfBytes
>
0
)
{
iSeries_Write_Byte
(
*
src
++
,
(
void
*
)
d
st
++
);
iSeries_Write_Byte
(
*
src
++
,
de
st
++
);
--
NumberOfBytes
;
}
return
dest
;
}
EXPORT_SYMBOL
(
iSeries_memcpy_toio
);
void
*
iSeries_memcpy_fromio
(
void
*
dest
,
void
*
source
,
size_t
count
)
void
iSeries_memcpy_fromio
(
void
*
dest
,
const
volatile
void
__iomem
*
src
,
size_t
count
)
{
char
*
dst
=
dest
;
char
*
src
=
source
;
long
NumberOfBytes
=
count
;
while
(
NumberOfBytes
>
0
)
{
*
dst
++
=
iSeries_Read_Byte
(
(
void
*
)
src
++
);
*
dst
++
=
iSeries_Read_Byte
(
src
++
);
--
NumberOfBytes
;
}
return
dest
;
}
EXPORT_SYMBOL
(
iSeries_memcpy_fromio
);
...
...
@@ -612,17 +605,19 @@ static int CheckReturnCode(char *TextHdr, struct iSeries_Device_Node *DevNode,
* Note: Make sure the passed variable end up on the stack to avoid
* the exposure of being device global.
*/
static
inline
struct
iSeries_Device_Node
*
xlateIoMmAddress
(
void
*
IoAddress
,
static
inline
struct
iSeries_Device_Node
*
xlateIoMmAddress
(
const
volatile
void
__iomem
*
IoAddress
,
u64
*
dsaptr
,
u64
*
BarOffsetPtr
)
{
unsigned
long
OrigIoAddr
;
unsigned
long
BaseIoAddr
;
unsigned
long
TableIndex
;
struct
iSeries_Device_Node
*
DevNode
;
if
(((
unsigned
long
)
IoAddress
<
iSeries_Base_Io_Memory
)
||
((
unsigned
long
)
IoAddress
>=
iSeries_Max_Io_Memory
))
OrigIoAddr
=
(
unsigned
long
__force
)
IoAddress
;
if
((
OrigIoAddr
<
iSeries_Base_Io_Memory
)
||
(
OrigIoAddr
>=
iSeries_Max_Io_Memory
))
return
NULL
;
BaseIoAddr
=
(
unsigned
long
)
IoAddress
-
iSeries_Base_Io_Memory
;
BaseIoAddr
=
OrigIoAddr
-
iSeries_Base_Io_Memory
;
TableIndex
=
BaseIoAddr
/
iSeries_IoMmTable_Entry_Size
;
DevNode
=
iSeries_IoMmTable
[
TableIndex
];
...
...
@@ -644,7 +639,7 @@ static inline struct iSeries_Device_Node *xlateIoMmAddress(void *IoAddress,
* iSeries_Read_Word = Read Word (16 bit)
* iSeries_Read_Long = Read Long (32 bit)
*/
u8
iSeries_Read_Byte
(
void
*
IoAddress
)
u8
iSeries_Read_Byte
(
const
volatile
void
__iomem
*
IoAddress
)
{
u64
BarOffset
;
u64
dsa
;
...
...
@@ -673,7 +668,7 @@ u8 iSeries_Read_Byte(void *IoAddress)
}
EXPORT_SYMBOL
(
iSeries_Read_Byte
);
u16
iSeries_Read_Word
(
void
*
IoAddress
)
u16
iSeries_Read_Word
(
const
volatile
void
__iomem
*
IoAddress
)
{
u64
BarOffset
;
u64
dsa
;
...
...
@@ -703,7 +698,7 @@ u16 iSeries_Read_Word(void *IoAddress)
}
EXPORT_SYMBOL
(
iSeries_Read_Word
);
u32
iSeries_Read_Long
(
void
*
IoAddress
)
u32
iSeries_Read_Long
(
const
volatile
void
__iomem
*
IoAddress
)
{
u64
BarOffset
;
u64
dsa
;
...
...
@@ -740,7 +735,7 @@ EXPORT_SYMBOL(iSeries_Read_Long);
* iSeries_Write_Word = Write Word(16 bit)
* iSeries_Write_Long = Write Long(32 bit)
*/
void
iSeries_Write_Byte
(
u8
data
,
vo
id
*
IoAddress
)
void
iSeries_Write_Byte
(
u8
data
,
vo
latile
void
__iomem
*
IoAddress
)
{
u64
BarOffset
;
u64
dsa
;
...
...
@@ -767,7 +762,7 @@ void iSeries_Write_Byte(u8 data, void *IoAddress)
}
EXPORT_SYMBOL
(
iSeries_Write_Byte
);
void
iSeries_Write_Word
(
u16
data
,
vo
id
*
IoAddress
)
void
iSeries_Write_Word
(
u16
data
,
vo
latile
void
__iomem
*
IoAddress
)
{
u64
BarOffset
;
u64
dsa
;
...
...
@@ -794,7 +789,7 @@ void iSeries_Write_Word(u16 data, void *IoAddress)
}
EXPORT_SYMBOL
(
iSeries_Write_Word
);
void
iSeries_Write_Long
(
u32
data
,
vo
id
*
IoAddress
)
void
iSeries_Write_Long
(
u32
data
,
vo
latile
void
__iomem
*
IoAddress
)
{
u64
BarOffset
;
u64
dsa
;
...
...
arch/ppc64/mm/init.c
View file @
e6cc3360
...
...
@@ -117,18 +117,18 @@ void show_mem(void)
#ifdef CONFIG_PPC_ISERIES
void
*
ioremap
(
unsigned
long
addr
,
unsigned
long
size
)
void
__iomem
*
ioremap
(
unsigned
long
addr
,
unsigned
long
size
)
{
return
(
void
*
)
addr
;
return
(
void
__iomem
*
)
addr
;
}
extern
void
*
__ioremap
(
unsigned
long
addr
,
unsigned
long
size
,
extern
void
__iomem
*
__ioremap
(
unsigned
long
addr
,
unsigned
long
size
,
unsigned
long
flags
)
{
return
(
void
*
)
addr
;
return
(
void
__iomem
*
)
addr
;
}
void
iounmap
(
vo
id
*
addr
)
void
iounmap
(
vo
latile
void
__iomem
*
addr
)
{
return
;
}
...
...
@@ -182,7 +182,7 @@ static void map_io_page(unsigned long ea, unsigned long pa, int flags)
}
static
void
*
__ioremap_com
(
unsigned
long
addr
,
unsigned
long
pa
,
static
void
__iomem
*
__ioremap_com
(
unsigned
long
addr
,
unsigned
long
pa
,
unsigned
long
ea
,
unsigned
long
size
,
unsigned
long
flags
)
{
...
...
@@ -197,20 +197,20 @@ static void * __ioremap_com(unsigned long addr, unsigned long pa,
map_io_page
(
ea
+
i
,
pa
+
i
,
flags
);
}
return
(
void
*
)
(
ea
+
(
addr
&
~
PAGE_MASK
));
return
(
void
__iomem
*
)
(
ea
+
(
addr
&
~
PAGE_MASK
));
}
void
*
void
__iomem
*
ioremap
(
unsigned
long
addr
,
unsigned
long
size
)
{
void
*
ret
=
__ioremap
(
addr
,
size
,
_PAGE_NO_CACHE
);
void
__iomem
*
ret
=
__ioremap
(
addr
,
size
,
_PAGE_NO_CACHE
);
if
(
mem_init_done
)
return
eeh_ioremap
(
addr
,
ret
);
/* may remap the addr */
return
ret
;
}
void
*
void
__iomem
*
__ioremap
(
unsigned
long
addr
,
unsigned
long
size
,
unsigned
long
flags
)
{
unsigned
long
pa
,
ea
;
...
...
@@ -353,11 +353,12 @@ static void unmap_im_area_pmd(pgd_t *dir, unsigned long address,
*
* XXX what about calls before mem_init_done (ie python_countermeasures())
*/
void
iounmap
(
vo
id
*
addr
)
void
iounmap
(
vo
latile
void
__iomem
*
token
)
{
unsigned
long
address
,
start
,
end
,
size
;
struct
mm_struct
*
mm
;
pgd_t
*
dir
;
void
*
addr
;
if
(
!
mem_init_done
)
{
return
;
...
...
@@ -365,7 +366,7 @@ void iounmap(void *addr)
/* addr could be in EEH or IO region, map it to IO region regardless.
*/
addr
=
(
void
*
)
(
IO_TOKEN_TO_ADDR
(
addr
)
&
PAGE_MASK
);
addr
=
(
void
*
)
(
IO_TOKEN_TO_ADDR
(
token
)
&
PAGE_MASK
);
if
((
size
=
im_free
(
addr
))
==
0
)
{
return
;
...
...
@@ -391,38 +392,39 @@ void iounmap(void *addr)
return
;
}
static
int
iounmap_subset_regions
(
void
*
addr
,
unsigned
long
size
)
static
int
iounmap_subset_regions
(
unsigned
long
addr
,
unsigned
long
size
)
{
struct
vm_struct
*
area
;
/* Check whether subsets of this region exist */
area
=
im_get_area
(
(
unsigned
long
)
addr
,
size
,
IM_REGION_SUPERSET
);
area
=
im_get_area
(
addr
,
size
,
IM_REGION_SUPERSET
);
if
(
area
==
NULL
)
return
1
;
while
(
area
)
{
iounmap
(
area
->
addr
);
area
=
im_get_area
(
(
unsigned
long
)
addr
,
size
,
iounmap
(
(
void
__iomem
*
)
area
->
addr
);
area
=
im_get_area
(
addr
,
size
,
IM_REGION_SUPERSET
);
}
return
0
;
}
int
iounmap_explicit
(
vo
id
*
addr
,
unsigned
long
size
)
int
iounmap_explicit
(
vo
latile
void
__iomem
*
start
,
unsigned
long
size
)
{
struct
vm_struct
*
area
;
unsigned
long
addr
;
int
rc
;
/* addr could be in EEH or IO region, map it to IO region regardless.
*/
addr
=
(
void
*
)
(
IO_TOKEN_TO_ADDR
(
addr
)
&
PAGE_MASK
);
addr
=
(
IO_TOKEN_TO_ADDR
(
start
)
&
PAGE_MASK
);
/* Verify that the region either exists or is a subset of an existing
* region. In the latter case, split the parent region to create
* the exact region
*/
area
=
im_get_area
(
(
unsigned
long
)
addr
,
size
,
area
=
im_get_area
(
addr
,
size
,
IM_REGION_EXISTS
|
IM_REGION_SUBSET
);
if
(
area
==
NULL
)
{
/* Determine whether subset regions exist. If so, unmap */
...
...
@@ -430,14 +432,17 @@ int iounmap_explicit(void *addr, unsigned long size)
if
(
rc
)
{
printk
(
KERN_ERR
"%s() cannot unmap nonexistent range 0x%lx
\n
"
,
__FUNCTION__
,
(
unsigned
long
)
addr
);
__FUNCTION__
,
addr
);
return
1
;
}
}
else
{
iounmap
(
area
->
addr
);
iounmap
(
(
void
__iomem
*
)
area
->
addr
);
}
/*
* FIXME! This can't be right:
iounmap(area->addr);
* Maybe it should be "iounmap(area);"
*/
return
0
;
}
...
...
include/asm-ppc64/eeh.h
View file @
e6cc3360
...
...
@@ -31,7 +31,7 @@ struct device_node;
* never actually mapped. Translation between IO <-> EEH region is 1 to 1.
*/
#define IO_TOKEN_TO_ADDR(token) \
(((unsigned long)(token) & ~(0xfUL << REGION_SHIFT)) | \
(((unsigned long
__force
)(token) & ~(0xfUL << REGION_SHIFT)) | \
(IO_REGION_ID << REGION_SHIFT))
#define IO_ADDR_TO_TOKEN(addr) \
...
...
@@ -43,9 +43,9 @@ struct device_node;
#define EEH_MODE_NOCHECK (1<<1)
extern
void
__init
eeh_init
(
void
);
unsigned
long
eeh_check_failure
(
void
*
token
,
unsigned
long
val
);
unsigned
long
eeh_check_failure
(
const
volatile
void
__iomem
*
token
,
unsigned
long
val
);
int
eeh_dn_check_failure
(
struct
device_node
*
dn
,
struct
pci_dev
*
dev
);
void
*
eeh_ioremap
(
unsigned
long
addr
,
void
*
vaddr
);
void
__iomem
*
eeh_ioremap
(
unsigned
long
addr
,
void
__iomem
*
vaddr
);
void
__init
pci_addr_cache_build
(
void
);
/**
...
...
@@ -108,83 +108,83 @@ int eeh_set_option(struct pci_dev *dev, int options);
/*
* MMIO read/write operations with EEH support.
*/
static
inline
u8
eeh_readb
(
void
*
addr
)
{
static
inline
u8
eeh_readb
(
const
volatile
void
__iomem
*
addr
)
{
volatile
u8
*
vaddr
=
(
volatile
u8
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u8
val
=
in_8
(
vaddr
);
if
(
EEH_POSSIBLE_ERROR
(
addr
,
vaddr
,
val
,
u8
))
return
eeh_check_failure
(
addr
,
val
);
return
val
;
}
static
inline
void
eeh_writeb
(
u8
val
,
vo
id
*
addr
)
{
static
inline
void
eeh_writeb
(
u8
val
,
vo
latile
void
__iomem
*
addr
)
{
volatile
u8
*
vaddr
=
(
volatile
u8
*
)
IO_TOKEN_TO_ADDR
(
addr
);
out_8
(
vaddr
,
val
);
}
static
inline
u16
eeh_readw
(
void
*
addr
)
{
static
inline
u16
eeh_readw
(
const
volatile
void
__iomem
*
addr
)
{
volatile
u16
*
vaddr
=
(
volatile
u16
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u16
val
=
in_le16
(
vaddr
);
if
(
EEH_POSSIBLE_ERROR
(
addr
,
vaddr
,
val
,
u16
))
return
eeh_check_failure
(
addr
,
val
);
return
val
;
}
static
inline
void
eeh_writew
(
u16
val
,
vo
id
*
addr
)
{
static
inline
void
eeh_writew
(
u16
val
,
vo
latile
void
__iomem
*
addr
)
{
volatile
u16
*
vaddr
=
(
volatile
u16
*
)
IO_TOKEN_TO_ADDR
(
addr
);
out_le16
(
vaddr
,
val
);
}
static
inline
u16
eeh_raw_readw
(
void
*
addr
)
{
static
inline
u16
eeh_raw_readw
(
const
volatile
void
__iomem
*
addr
)
{
volatile
u16
*
vaddr
=
(
volatile
u16
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u16
val
=
in_be16
(
vaddr
);
if
(
EEH_POSSIBLE_ERROR
(
addr
,
vaddr
,
val
,
u16
))
return
eeh_check_failure
(
addr
,
val
);
return
val
;
}
static
inline
void
eeh_raw_writew
(
u16
val
,
vo
id
*
addr
)
{
static
inline
void
eeh_raw_writew
(
u16
val
,
vo
latile
void
__iomem
*
addr
)
{
volatile
u16
*
vaddr
=
(
volatile
u16
*
)
IO_TOKEN_TO_ADDR
(
addr
);
out_be16
(
vaddr
,
val
);
}
static
inline
u32
eeh_readl
(
void
*
addr
)
{
static
inline
u32
eeh_readl
(
const
volatile
void
__iomem
*
addr
)
{
volatile
u32
*
vaddr
=
(
volatile
u32
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u32
val
=
in_le32
(
vaddr
);
if
(
EEH_POSSIBLE_ERROR
(
addr
,
vaddr
,
val
,
u32
))
return
eeh_check_failure
(
addr
,
val
);
return
val
;
}
static
inline
void
eeh_writel
(
u32
val
,
vo
id
*
addr
)
{
static
inline
void
eeh_writel
(
u32
val
,
vo
latile
void
__iomem
*
addr
)
{
volatile
u32
*
vaddr
=
(
volatile
u32
*
)
IO_TOKEN_TO_ADDR
(
addr
);
out_le32
(
vaddr
,
val
);
}
static
inline
u32
eeh_raw_readl
(
void
*
addr
)
{
static
inline
u32
eeh_raw_readl
(
const
volatile
void
__iomem
*
addr
)
{
volatile
u32
*
vaddr
=
(
volatile
u32
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u32
val
=
in_be32
(
vaddr
);
if
(
EEH_POSSIBLE_ERROR
(
addr
,
vaddr
,
val
,
u32
))
return
eeh_check_failure
(
addr
,
val
);
return
val
;
}
static
inline
void
eeh_raw_writel
(
u32
val
,
vo
id
*
addr
)
{
static
inline
void
eeh_raw_writel
(
u32
val
,
vo
latile
void
__iomem
*
addr
)
{
volatile
u32
*
vaddr
=
(
volatile
u32
*
)
IO_TOKEN_TO_ADDR
(
addr
);
out_be32
(
vaddr
,
val
);
}
static
inline
u64
eeh_readq
(
void
*
addr
)
{
static
inline
u64
eeh_readq
(
const
volatile
void
__iomem
*
addr
)
{
volatile
u64
*
vaddr
=
(
volatile
u64
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u64
val
=
in_le64
(
vaddr
);
if
(
EEH_POSSIBLE_ERROR
(
addr
,
vaddr
,
val
,
u64
))
return
eeh_check_failure
(
addr
,
val
);
return
val
;
}
static
inline
void
eeh_writeq
(
u64
val
,
vo
id
*
addr
)
{
static
inline
void
eeh_writeq
(
u64
val
,
vo
latile
void
__iomem
*
addr
)
{
volatile
u64
*
vaddr
=
(
volatile
u64
*
)
IO_TOKEN_TO_ADDR
(
addr
);
out_le64
(
vaddr
,
val
);
}
static
inline
u64
eeh_raw_readq
(
void
*
addr
)
{
static
inline
u64
eeh_raw_readq
(
const
volatile
void
__iomem
*
addr
)
{
volatile
u64
*
vaddr
=
(
volatile
u64
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u64
val
=
in_be64
(
vaddr
);
if
(
EEH_POSSIBLE_ERROR
(
addr
,
vaddr
,
val
,
u64
))
return
eeh_check_failure
(
addr
,
val
);
return
val
;
}
static
inline
void
eeh_raw_writeq
(
u64
val
,
vo
id
*
addr
)
{
static
inline
void
eeh_raw_writeq
(
u64
val
,
vo
latile
void
__iomem
*
addr
)
{
volatile
u64
*
vaddr
=
(
volatile
u64
*
)
IO_TOKEN_TO_ADDR
(
addr
);
out_be64
(
vaddr
,
val
);
}
...
...
@@ -192,7 +192,7 @@ static inline void eeh_raw_writeq(u64 val, void *addr) {
#define EEH_CHECK_ALIGN(v,a) \
((((unsigned long)(v)) & ((a) - 1)) == 0)
static
inline
void
eeh_memset_io
(
vo
id
*
addr
,
int
c
,
unsigned
long
n
)
{
static
inline
void
eeh_memset_io
(
vo
latile
void
__iomem
*
addr
,
int
c
,
unsigned
long
n
)
{
void
*
vaddr
=
(
void
*
)
IO_TOKEN_TO_ADDR
(
addr
);
u32
lc
=
c
;
lc
|=
lc
<<
8
;
...
...
@@ -215,9 +215,10 @@ static inline void eeh_memset_io(void *addr, int c, unsigned long n) {
}
__asm__
__volatile__
(
"sync"
:
:
:
"memory"
);
}
static
inline
void
eeh_memcpy_fromio
(
void
*
dest
,
void
*
src
,
unsigned
long
n
)
{
static
inline
void
eeh_memcpy_fromio
(
void
*
dest
,
const
volatile
void
__iomem
*
src
,
unsigned
long
n
)
{
void
*
vsrc
=
(
void
*
)
IO_TOKEN_TO_ADDR
(
src
);
void
*
vsrcsave
=
vsrc
,
*
destsave
=
dest
,
*
srcsave
=
src
;
void
*
vsrcsave
=
vsrc
,
*
destsave
=
dest
;
const
volatile
void
__iomem
*
srcsave
=
src
;
unsigned
long
nsave
=
n
;
while
(
n
&&
(
!
EEH_CHECK_ALIGN
(
vsrc
,
4
)
||
!
EEH_CHECK_ALIGN
(
dest
,
4
)))
{
...
...
@@ -253,7 +254,7 @@ static inline void eeh_memcpy_fromio(void *dest, void *src, unsigned long n) {
}
}
static
inline
void
eeh_memcpy_toio
(
vo
id
*
dest
,
const
void
*
src
,
unsigned
long
n
)
{
static
inline
void
eeh_memcpy_toio
(
vo
latile
void
__iomem
*
dest
,
const
void
*
src
,
unsigned
long
n
)
{
void
*
vdest
=
(
void
*
)
IO_TOKEN_TO_ADDR
(
dest
);
while
(
n
&&
(
!
EEH_CHECK_ALIGN
(
vdest
,
4
)
||
!
EEH_CHECK_ALIGN
(
src
,
4
)))
{
...
...
@@ -289,7 +290,7 @@ static inline u8 eeh_inb(unsigned long port) {
return
~
0
;
val
=
in_8
((
u8
*
)(
port
+
pci_io_base
));
if
(
EEH_POSSIBLE_IO_ERROR
(
val
,
u8
))
return
eeh_check_failure
((
void
*
)(
port
),
val
);
return
eeh_check_failure
((
void
__iomem
*
)(
port
),
val
);
return
val
;
}
...
...
@@ -304,7 +305,7 @@ static inline u16 eeh_inw(unsigned long port) {
return
~
0
;
val
=
in_le16
((
u16
*
)(
port
+
pci_io_base
));
if
(
EEH_POSSIBLE_IO_ERROR
(
val
,
u16
))
return
eeh_check_failure
((
void
*
)(
port
),
val
);
return
eeh_check_failure
((
void
__iomem
*
)(
port
),
val
);
return
val
;
}
...
...
@@ -319,7 +320,7 @@ static inline u32 eeh_inl(unsigned long port) {
return
~
0
;
val
=
in_le32
((
u32
*
)(
port
+
pci_io_base
));
if
(
EEH_POSSIBLE_IO_ERROR
(
val
,
u32
))
return
eeh_check_failure
((
void
*
)(
port
),
val
);
return
eeh_check_failure
((
void
__iomem
*
)(
port
),
val
);
return
val
;
}
...
...
@@ -332,19 +333,19 @@ static inline void eeh_outl(u32 val, unsigned long port) {
static
inline
void
eeh_insb
(
unsigned
long
port
,
void
*
buf
,
int
ns
)
{
_insb
((
u8
*
)(
port
+
pci_io_base
),
buf
,
ns
);
if
(
EEH_POSSIBLE_IO_ERROR
((
*
(((
u8
*
)
buf
)
+
ns
-
1
)),
u8
))
eeh_check_failure
((
void
*
)(
port
),
*
(
u8
*
)
buf
);
eeh_check_failure
((
void
__iomem
*
)(
port
),
*
(
u8
*
)
buf
);
}
static
inline
void
eeh_insw_ns
(
unsigned
long
port
,
void
*
buf
,
int
ns
)
{
_insw_ns
((
u16
*
)(
port
+
pci_io_base
),
buf
,
ns
);
if
(
EEH_POSSIBLE_IO_ERROR
((
*
(((
u16
*
)
buf
)
+
ns
-
1
)),
u16
))
eeh_check_failure
((
void
*
)(
port
),
*
(
u16
*
)
buf
);
eeh_check_failure
((
void
__iomem
*
)(
port
),
*
(
u16
*
)
buf
);
}
static
inline
void
eeh_insl_ns
(
unsigned
long
port
,
void
*
buf
,
int
nl
)
{
_insl_ns
((
u32
*
)(
port
+
pci_io_base
),
buf
,
nl
);
if
(
EEH_POSSIBLE_IO_ERROR
((
*
(((
u32
*
)
buf
)
+
nl
-
1
)),
u32
))
eeh_check_failure
((
void
*
)(
port
),
*
(
u32
*
)
buf
);
eeh_check_failure
((
void
__iomem
*
)(
port
),
*
(
u32
*
)
buf
);
}
#endif
/* _PPC64_EEH_H */
include/asm-ppc64/iSeries/iSeries_io.h
View file @
e6cc3360
...
...
@@ -31,16 +31,16 @@
/* Created December 28, 2000 */
/* End Change Activity */
/************************************************************************/
extern
u8
iSeries_Read_Byte
(
void
*
IoAddress
);
extern
u16
iSeries_Read_Word
(
void
*
IoAddress
);
extern
u32
iSeries_Read_Long
(
void
*
IoAddress
);
extern
void
iSeries_Write_Byte
(
u8
IoData
,
void
*
IoAddress
);
extern
void
iSeries_Write_Word
(
u16
IoData
,
void
*
IoAddress
);
extern
void
iSeries_Write_Long
(
u32
IoData
,
void
*
IoAddress
);
extern
u8
iSeries_Read_Byte
(
const
volatile
void
__iomem
*
IoAddress
);
extern
u16
iSeries_Read_Word
(
const
volatile
void
__iomem
*
IoAddress
);
extern
u32
iSeries_Read_Long
(
const
volatile
void
__iomem
*
IoAddress
);
extern
void
iSeries_Write_Byte
(
u8
IoData
,
volatile
void
__iomem
*
IoAddress
);
extern
void
iSeries_Write_Word
(
u16
IoData
,
volatile
void
__iomem
*
IoAddress
);
extern
void
iSeries_Write_Long
(
u32
IoData
,
volatile
void
__iomem
*
IoAddress
);
extern
void
*
iSeries_memset_io
(
void
*
dest
,
char
x
,
size_t
n
);
extern
void
*
iSeries_memcpy_toio
(
void
*
dest
,
void
*
source
,
size_t
n
);
extern
void
*
iSeries_memcpy_fromio
(
void
*
dest
,
void
*
source
,
size_t
n
);
extern
void
iSeries_memset_io
(
volatile
void
__iomem
*
dest
,
char
x
,
size_t
n
);
extern
void
iSeries_memcpy_toio
(
volatile
void
__iomem
*
dest
,
void
*
source
,
size_t
n
);
extern
void
iSeries_memcpy_fromio
(
void
*
dest
,
const
volatile
void
__iomem
*
source
,
size_t
n
);
#endif
/* CONFIG_PPC_ISERIES */
#endif
/* _ISERIES_IO_H */
include/asm-ppc64/io.h
View file @
e6cc3360
...
...
@@ -9,6 +9,7 @@
*/
#include <linux/config.h>
#include <linux/compiler.h>
#include <asm/page.h>
#include <asm/byteorder.h>
#ifdef CONFIG_PPC_ISERIES
...
...
@@ -41,21 +42,22 @@ extern unsigned long pci_io_base;
#define __raw_writew(v, addr) { BUG(); 0; }
#define __raw_writel(v, addr) { BUG(); 0; }
#define __raw_writeq(v, addr) { BUG(); 0; }
#define readb(addr) iSeries_Read_Byte((void*)(addr))
#define readw(addr) iSeries_Read_Word((void*)(addr))
#define readl(addr) iSeries_Read_Long((void*)(addr))
#define writeb(data, addr) iSeries_Write_Byte(data,((void*)(addr)))
#define writew(data, addr) iSeries_Write_Word(data,((void*)(addr)))
#define writel(data, addr) iSeries_Write_Long(data,((void*)(addr)))
#define memset_io(a,b,c) iSeries_memset_io((void *)(a),(b),(c))
#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((void *)(a), (void *)(b), (c))
#define memcpy_toio(a,b,c) iSeries_memcpy_toio((void *)(a), (void *)(b), (c))
#define inb(addr) readb(((unsigned long)(addr)))
#define inw(addr) readw(((unsigned long)(addr)))
#define inl(addr) readl(((unsigned long)(addr)))
#define outb(data,addr) writeb(data,((unsigned long)(addr)))
#define outw(data,addr) writew(data,((unsigned long)(addr)))
#define outl(data,addr) writel(data,((unsigned long)(addr)))
#define readb(addr) iSeries_Read_Byte(addr)
#define readw(addr) iSeries_Read_Word(addr)
#define readl(addr) iSeries_Read_Long(addr)
#define writeb(data, addr) iSeries_Write_Byte((data),(addr))
#define writew(data, addr) iSeries_Write_Word((data),(addr))
#define writel(data, addr) iSeries_Write_Long((data),(addr))
#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c))
#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c))
#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c))
#define inb(addr) readb(((void __iomem *)(long)(addr)))
#define inw(addr) readw(((void __iomem *)(long)(addr)))
#define inl(addr) readl(((void __iomem *)(long)(addr)))
#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr)))
#define outw(data,addr) writew(data,((void __iomem *)(long)(addr)))
#define outl(data,addr) writel(data,((void __iomem *)(long)(addr)))
/*
* The *_ns versions below don't do byte-swapping.
* Neither do the standard versions now, these are just here
...
...
@@ -64,25 +66,50 @@ extern unsigned long pci_io_base;
#define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+pci_io_base), (buf), (ns))
#define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+pci_io_base), (buf), (nl))
#else
#define __raw_readb(addr) (*(volatile unsigned char *)(addr))
#define __raw_readw(addr) (*(volatile unsigned short *)(addr))
#define __raw_readl(addr) (*(volatile unsigned int *)(addr))
#define __raw_readq(addr) (*(volatile unsigned long *)(addr))
#define __raw_writeb(v, addr) (*(volatile unsigned char *)(addr) = (v))
#define __raw_writew(v, addr) (*(volatile unsigned short *)(addr) = (v))
#define __raw_writel(v, addr) (*(volatile unsigned int *)(addr) = (v))
#define __raw_writeq(v, addr) (*(volatile unsigned long *)(addr) = (v))
#define readb(addr) eeh_readb((void*)(addr))
#define readw(addr) eeh_readw((void*)(addr))
#define readl(addr) eeh_readl((void*)(addr))
#define readq(addr) eeh_readq((void*)(addr))
#define writeb(data, addr) eeh_writeb((data), ((void*)(addr)))
#define writew(data, addr) eeh_writew((data), ((void*)(addr)))
#define writel(data, addr) eeh_writel((data), ((void*)(addr)))
#define writeq(data, addr) eeh_writeq((data), ((void*)(addr)))
#define memset_io(a,b,c) eeh_memset_io((void *)(a),(b),(c))
#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(void *)(b),(c))
#define memcpy_toio(a,b,c) eeh_memcpy_toio((void *)(a),(b),(c))
static
inline
unsigned
char
__raw_readb
(
const
volatile
void
__iomem
*
addr
)
{
return
*
(
unsigned
char
__force
*
)
addr
;
}
static
inline
unsigned
short
__raw_readw
(
const
volatile
void
__iomem
*
addr
)
{
return
*
(
unsigned
short
__force
*
)
addr
;
}
static
inline
unsigned
int
__raw_readl
(
const
volatile
void
__iomem
*
addr
)
{
return
*
(
unsigned
int
__force
*
)
addr
;
}
static
inline
unsigned
long
__raw_readq
(
const
volatile
void
__iomem
*
addr
)
{
return
*
(
unsigned
long
__force
*
)
addr
;
}
static
inline
void
__raw_writeb
(
unsigned
char
v
,
volatile
void
__iomem
*
addr
)
{
*
(
unsigned
char
__force
*
)
addr
=
v
;
}
static
inline
void
__raw_writew
(
unsigned
short
v
,
volatile
void
__iomem
*
addr
)
{
*
(
unsigned
short
__force
*
)
addr
=
v
;
}
static
inline
void
__raw_writel
(
unsigned
int
v
,
volatile
void
__iomem
*
addr
)
{
*
(
unsigned
int
__force
*
)
addr
=
v
;
}
static
inline
void
__raw_writeq
(
unsigned
long
v
,
volatile
void
__iomem
*
addr
)
{
*
(
unsigned
long
__force
*
)
addr
=
v
;
}
#define readb(addr) eeh_readb(addr)
#define readw(addr) eeh_readw(addr)
#define readl(addr) eeh_readl(addr)
#define readq(addr) eeh_readq(addr)
#define writeb(data, addr) eeh_writeb((data), (addr))
#define writew(data, addr) eeh_writew((data), (addr))
#define writel(data, addr) eeh_writel((data), (addr))
#define writeq(data, addr) eeh_writeq((data), (addr))
#define memset_io(a,b,c) eeh_memset_io((a),(b),(c))
#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
#define inb(port) eeh_inb((unsigned long)port)
#define outb(val, port) eeh_outb(val, (unsigned long)port)
#define inw(port) eeh_inw((unsigned long)port)
...
...
@@ -149,7 +176,7 @@ extern void _outsl_ns(volatile u32 *port, const void *buf, int nl);
#ifdef __KERNEL__
extern
int
__ioremap_explicit
(
unsigned
long
p_addr
,
unsigned
long
v_addr
,
unsigned
long
size
,
unsigned
long
flags
);
extern
void
*
__ioremap
(
unsigned
long
address
,
unsigned
long
size
,
extern
void
__iomem
*
__ioremap
(
unsigned
long
address
,
unsigned
long
size
,
unsigned
long
flags
);
/**
...
...
@@ -163,11 +190,11 @@ extern void *__ioremap(unsigned long address, unsigned long size,
* address is not guaranteed to be usable directly as a virtual
* address.
*/
extern
void
*
ioremap
(
unsigned
long
address
,
unsigned
long
size
);
extern
void
__iomem
*
ioremap
(
unsigned
long
address
,
unsigned
long
size
);
#define ioremap_nocache(addr, size) ioremap((addr), (size))
extern
int
iounmap_explicit
(
vo
id
*
addr
,
unsigned
long
size
);
extern
void
iounmap
(
vo
id
*
addr
);
extern
int
iounmap_explicit
(
vo
latile
void
__iomem
*
addr
,
unsigned
long
size
);
extern
void
iounmap
(
vo
latile
void
__iomem
*
addr
);
extern
void
*
reserve_phb_iospace
(
unsigned
long
size
);
/**
...
...
@@ -377,7 +404,7 @@ static inline void out_be64(volatile unsigned long *addr, unsigned long val)
* address should have been obtained by ioremap.
* Returns 1 on a match.
*/
static
inline
int
check_signature
(
unsigned
long
io_addr
,
static
inline
int
check_signature
(
const
volatile
void
__iomem
*
io_addr
,
const
unsigned
char
*
signature
,
int
length
)
{
int
retval
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment