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
nexedi
linux
Commits
567eee97
Commit
567eee97
authored
Sep 10, 2002
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PPC32: Update the PCI config-space access functions for PReP.
These got missed in my previous commit.
parent
a7df4a00
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
39 deletions
+72
-39
arch/ppc/platforms/prep_pci.c
arch/ppc/platforms/prep_pci.c
+72
-39
No files found.
arch/ppc/platforms/prep_pci.c
View file @
567eee97
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#include <asm/machdep.h>
#include <asm/machdep.h>
#include <asm/open_pic.h>
#include <asm/open_pic.h>
#define MAX_DEVNR 22
/* Which PCI interrupt line does a given device [slot] use? */
/* Which PCI interrupt line does a given device [slot] use? */
/* Note: This really should be two dimensional based in slot/pin used */
/* Note: This really should be two dimensional based in slot/pin used */
...
@@ -616,47 +615,79 @@ static unsigned char prep_pci_intpins[4][4] __prepdata =
...
@@ -616,47 +615,79 @@ static unsigned char prep_pci_intpins[4][4] __prepdata =
#define ELCRM_INT7_LVL 0x80
#define ELCRM_INT7_LVL 0x80
#define ELCRM_INT5_LVL 0x20
#define ELCRM_INT5_LVL 0x20
#define CFGPTR(dev) (0x80800000 | (1<<(dev>>3)) | ((dev&7)<<8) | offset)
/*
* PCI config space access.
*/
#define CFGADDR(dev) ((1<<(dev>>3)) | ((dev&7)<<8))
#define DEVNO(dev) (dev>>3)
#define DEVNO(dev) (dev>>3)
#define cfg_read(val, addr, type, op) *val = op((type)(addr))
#define MIN_DEVNR 11
#define cfg_write(val, addr, type, op) op((type *)(addr), (val))
#define MAX_DEVNR 22
#define cfg_read_bad(val, size) *val = bad_##size;
static
int
__prep
#define cfg_write_bad(val, size)
prep_read_config
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
offset
,
int
len
,
u32
*
val
)
#define bad_byte 0xff
{
#define bad_word 0xffff
struct
pci_controller
*
hose
=
bus
->
sysdata
;
#define bad_dword 0xffffffffU
volatile
unsigned
char
*
cfg_data
;
#define PREP_PCI_OP(rw, size, type, op) \
if
(
bus
->
number
!=
0
||
DEVNO
(
devfn
)
<
MIN_DEVNR
static int __prep \
||
DEVNO
(
devfn
)
>
MAX_DEVNR
)
prep_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \
return
PCIBIOS_DEVICE_NOT_FOUND
;
{ \
if ((dev->bus->number != 0) || (DEVNO(dev->devfn) > MAX_DEVNR)) \
/*
{ \
* Note: the caller has already checked that offset is
cfg_##rw##_bad(val, size) \
* suitably aligned and that len is 1, 2 or 4.
return PCIBIOS_DEVICE_NOT_FOUND; \
*/
} \
cfg_data
=
hose
->
cfg_data
+
CFGADDR
(
devfn
)
+
offset
;
cfg_##rw(val, CFGPTR(dev->devfn), type, op); \
switch
(
len
)
{
return PCIBIOS_SUCCESSFUL; \
case
1
:
*
val
=
in_8
((
u8
*
)
cfg_data
);
break
;
case
2
:
*
val
=
in_le16
((
u16
*
)
cfg_data
);
break
;
default:
*
val
=
in_le32
((
u32
*
)
cfg_data
);
break
;
}
return
PCIBIOS_SUCCESSFUL
;
}
}
PREP_PCI_OP
(
read
,
byte
,
u8
*
,
in_8
)
static
int
__prep
PREP_PCI_OP
(
read
,
word
,
u16
*
,
in_le16
)
prep_write_config
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
offset
,
PREP_PCI_OP
(
read
,
dword
,
u32
*
,
in_le32
)
int
len
,
u32
val
)
PREP_PCI_OP
(
write
,
byte
,
u8
,
out_8
)
{
PREP_PCI_OP
(
write
,
word
,
u16
,
out_le16
)
struct
pci_controller
*
hose
=
bus
->
sysdata
;
PREP_PCI_OP
(
write
,
dword
,
u32
,
out_le32
)
volatile
unsigned
char
*
cfg_data
;
if
(
bus
->
number
!=
0
||
DEVNO
(
devfn
)
<
MIN_DEVNR
||
DEVNO
(
devfn
)
>
MAX_DEVNR
)
return
PCIBIOS_DEVICE_NOT_FOUND
;
/*
* Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4.
*/
cfg_data
=
hose
->
cfg_data
+
CFGADDR
(
devfn
)
+
offset
;
switch
(
len
)
{
case
1
:
out_8
((
u8
*
)
cfg_data
,
val
);
break
;
case
2
:
out_le16
((
u16
*
)
cfg_data
,
val
);
break
;
default:
out_le32
((
u32
*
)
cfg_data
,
val
);
break
;
}
return
PCIBIOS_SUCCESSFUL
;
}
static
struct
pci_ops
prep_pci_ops
=
static
struct
pci_ops
prep_pci_ops
=
{
{
prep_read_config_byte
,
prep_read_config
,
prep_read_config_word
,
prep_write_config
prep_read_config_dword
,
prep_write_config_byte
,
prep_write_config_word
,
prep_write_config_dword
};
};
#define MOTOROLA_CPUTYPE_REG 0x800
#define MOTOROLA_CPUTYPE_REG 0x800
...
@@ -1239,10 +1270,12 @@ prep_find_bridges(void)
...
@@ -1239,10 +1270,12 @@ prep_find_bridges(void)
hose
->
last_busno
=
0xff
;
hose
->
last_busno
=
0xff
;
hose
->
pci_mem_offset
=
PREP_ISA_MEM_BASE
;
hose
->
pci_mem_offset
=
PREP_ISA_MEM_BASE
;
hose
->
io_base_phys
=
PREP_ISA_IO_BASE
;
hose
->
io_base_phys
=
PREP_ISA_IO_BASE
;
hose
->
io_base_virt
=
(
void
*
)
0x80000000
;
/* see prep_map_io() */
hose
->
io_base_virt
=
ioremap
(
PREP_ISA_IO_BASE
,
0x800000
);
prep_init_resource
(
&
hose
->
io_resource
,
0
,
0x00
f
fffff
,
IORESOURCE_IO
);
prep_init_resource
(
&
hose
->
io_resource
,
0
,
0x00
7
fffff
,
IORESOURCE_IO
);
prep_init_resource
(
&
hose
->
mem_resources
[
0
],
0xc0000000
,
0xfeffffff
,
prep_init_resource
(
&
hose
->
mem_resources
[
0
],
0xc0000000
,
0xfeffffff
,
IORESOURCE_MEM
);
IORESOURCE_MEM
);
/* XXX why can't we use the indirect config space access method? */
hose
->
cfg_data
=
ioremap
(
PREP_ISA_IO_BASE
+
0x800000
,
0x800000
);
hose
->
ops
=
&
prep_pci_ops
;
hose
->
ops
=
&
prep_pci_ops
;
printk
(
"PReP architecture
\n
"
);
printk
(
"PReP architecture
\n
"
);
...
...
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