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
4ce2b158
Commit
4ce2b158
authored
Aug 30, 2002
by
Hanna V. Linder
Committed by
Greg Kroah-Hartman
Aug 30, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] PCI: sh pci_ops changes
sh pci ops changes
parent
cd7ab7bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
250 deletions
+145
-250
arch/sh/kernel/pci-dc.c
arch/sh/kernel/pci-dc.c
+43
-62
arch/sh/kernel/pci-sh7751.c
arch/sh/kernel/pci-sh7751.c
+61
-117
arch/sh/kernel/pci_st40.c
arch/sh/kernel/pci_st40.c
+41
-71
No files found.
arch/sh/kernel/pci-dc.c
View file @
4ce2b158
...
...
@@ -31,76 +31,57 @@ struct pci_fixup pcibios_fixups[] = {
{
0
,
0
,
0
,
NULL
}
};
#define BBA_SELECTED(
dev) (dev->bus->number==0 && dev->
devfn==0)
#define BBA_SELECTED(
bus,devfn) (bus->number==0 &&
devfn==0)
static
int
gapspci_read_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
*
val
)
static
int
gapspci_read
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
int
size
,
u32
*
val
)
{
if
(
BBA_SELECTED
(
dev
))
*
val
=
inb
(
GAPSPCI_BBA_CONFIG
+
where
);
else
*
val
=
0xff
;
switch
(
size
)
{
case
1
:
if
(
BBA_SELECTED
(
bus
,
devfn
))
*
val
=
(
u8
)
inb
(
GAPSPCI_BBA_CONFIG
+
where
);
else
*
val
=
(
u8
)
0xff
;
break
;
case
2
:
if
(
BBA_SELECTED
(
bus
,
devfn
))
*
val
=
(
u16
)
inw
(
GAPSPCI_BBA_CONFIG
+
where
);
else
*
val
=
(
u16
)
0xffff
;
break
;
case
4
:
if
(
BBA_SELECTED
(
bus
,
devfn
))
*
val
=
inl
(
GAPSPCI_BBA_CONFIG
+
where
);
else
*
val
=
0xffffffff
;
break
;
}
return
PCIBIOS_SUCCESSFUL
;
}
static
int
gapspci_read_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
*
val
)
{
if
(
BBA_SELECTED
(
dev
))
*
val
=
inw
(
GAPSPCI_BBA_CONFIG
+
where
);
else
*
val
=
0xffff
;
return
PCIBIOS_SUCCESSFUL
;
}
static
int
gapspci_read_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
u32
*
val
)
static
int
gapspci_write
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
int
size
,
u32
val
)
{
if
(
BBA_SELECTED
(
dev
))
*
val
=
inl
(
GAPSPCI_BBA_CONFIG
+
where
);
else
*
val
=
0xffffffff
;
return
PCIBIOS_SUCCESSFUL
;
}
static
int
gapspci_write_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
val
)
{
if
(
BBA_SELECTED
(
dev
))
outb
(
val
,
GAPSPCI_BBA_CONFIG
+
where
);
return
PCIBIOS_SUCCESSFUL
;
}
static
int
gapspci_write_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
val
)
{
if
(
BBA_SELECTED
(
dev
))
outw
(
val
,
GAPSPCI_BBA_CONFIG
+
where
);
return
PCIBIOS_SUCCESSFUL
;
}
static
int
gapspci_write_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
u32
val
)
{
if
(
BBA_SELECTED
(
dev
))
outl
(
val
,
GAPSPCI_BBA_CONFIG
+
where
);
return
PCIBIOS_SUCCESSFUL
;
if
(
BBA_SELECTED
(
bus
,
devfn
))
{
switch
(
size
)
{
case
1
:
if
(
BBA_SELECTED
(
bus
,
devfn
))
outb
((
u8
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
2
:
if
(
BBA_SELECTED
(
bus
,
devfn
))
outw
((
u16
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
4
:
if
(
BBA_SELECTED
(
bus
,
devfn
))
outl
(
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
}
}
return
PCIBIOS_SUCCESSFUL
;
}
static
struct
pci_ops
pci_config_ops
=
{
gapspci_read_config_byte
,
gapspci_read_config_word
,
gapspci_read_config_dword
,
gapspci_write_config_byte
,
gapspci_write_config_word
,
gapspci_write_config_dword
.
read
=
gapspci_read
,
.
write
=
gapspci_write
,
};
...
...
@@ -143,7 +124,7 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
for
(
ln
=
bus
->
devices
.
next
;
ln
!=
&
bus
->
devices
;
ln
=
ln
->
next
)
{
dev
=
pci_dev_b
(
ln
);
if
(
!
BBA_SELECTED
(
dev
))
continue
;
if
(
!
BBA_SELECTED
(
bus
,
dev
->
devfn
))
continue
;
printk
(
"PCI: MMIO fixup to %s
\n
"
,
dev
->
name
);
dev
->
resource
[
1
].
start
=
0x01001700
;
...
...
arch/sh/kernel/pci-sh7751.c
View file @
4ce2b158
...
...
@@ -41,14 +41,14 @@ struct pci_ops *pci_root_ops;
#ifdef CONFIG_PCI_DIRECT
#define CONFIG_CMD(
dev, where) (0x80000000 | (dev->bus->number << 16) | (dev->
devfn << 8) | (where & ~3))
#define CONFIG_CMD(
bus, devfn, where) (0x80000000 | (bus->number << 16) | (
devfn << 8) | (where & ~3))
#define PCI_REG(reg) (SH7751_PCIREG_BASE+reg)
/*
* Functions for accessing PCI configuration space with type 1 accesses
*/
static
int
pci_conf1_read
_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
*
value
)
static
int
pci_conf1_read
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
int
size
,
u32
*
value
)
{
u32
word
;
unsigned
long
flags
;
...
...
@@ -57,144 +57,88 @@ static int pci_conf1_read_config_byte(struct pci_dev *dev, int where, u8 *value)
* so we must do byte alignment by hand
*/
save_and_cli
(
flags
);
outl
(
CONFIG_CMD
(
dev
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
outl
(
CONFIG_CMD
(
bus
,
devfn
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
word
=
inl
(
PCI_REG
(
SH7751_PCIPDR
));
restore_flags
(
flags
);
switch
(
where
&
0x3
)
{
case
3
:
*
value
=
(
u8
)(
word
>>
24
);
break
;
case
2
:
*
value
=
(
u8
)(
word
>>
16
);
break
;
case
1
:
*
value
=
(
u8
)(
word
>>
8
);
break
;
default:
*
value
=
(
u8
)
word
;
break
;
}
PCIDBG
(
4
,
"pci_conf1_read_config_byte@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
dev
,
where
),
*
value
);
return
PCIBIOS_SUCCESSFUL
;
}
static
int
pci_conf1_read_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
*
value
)
{
u32
word
;
unsigned
long
flags
;
/* PCIPDR may only be accessed as 32 bit words,
* so we must do word alignment by hand
*/
save_and_cli
(
flags
);
outl
(
CONFIG_CMD
(
dev
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
word
=
inl
(
PCI_REG
(
SH7751_PCIPDR
));
restore_flags
(
flags
);
switch
(
where
&
0x3
)
{
case
3
:
// This should never happen...
printk
(
KERN_ERR
"PCI BIOS: read_config_word: Illegal u16 alignment"
);
return
PCIBIOS_BAD_REGISTER_NUMBER
;
case
2
:
*
value
=
(
u16
)(
word
>>
16
);
break
;
switch
(
size
)
{
case
1
:
*
value
=
(
u16
)(
word
>>
8
);
break
;
default:
*
value
=
(
u16
)
word
;
switch
(
where
&
0x3
)
{
case
3
:
*
value
=
(
u8
)(
word
>>
24
);
break
;
case
2
:
*
value
=
(
u8
)(
word
>>
16
);
break
;
case
1
:
*
value
=
(
u8
)(
word
>>
8
);
break
;
default:
*
value
=
(
u8
)
word
;
break
;
}
case
2
:
switch
(
where
&
0x3
)
{
case
3
:
/*This should never happen.*/
printk
(
KERN_ERR
"PCI BIOS: read_config: Illegal u16 alignment"
);
return
PCIBIOS_BAD_REGISTER_NUMBER
;
case
2
:
*
value
=
(
u16
)(
word
>>
16
);
break
;
case
1
:
*
value
=
(
u16
)(
word
>>
8
);
break
;
default:
*
value
=
(
u16
)
word
;
break
;
}
case
4
:
*
value
=
word
;
break
;
}
PCIDBG
(
4
,
"pci_conf1_read_config_word@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
dev
,
where
),
*
value
);
return
PCIBIOS_SUCCESSFUL
;
}
static
int
pci_conf1_read_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
u32
*
value
)
{
unsigned
long
flags
;
save_and_cli
(
flags
);
outl
(
CONFIG_CMD
(
dev
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
*
value
=
inl
(
PCI_REG
(
SH7751_PCIPDR
));
restore_flags
(
flags
);
PCIDBG
(
4
,
"pci_conf1_read_config_dword@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
dev
,
where
),
*
value
);
}
PCIDBG
(
4
,
"pci_conf1_read@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
bus
,
devfn
,
where
),
*
value
);
return
PCIBIOS_SUCCESSFUL
;
}
static
int
pci_conf1_write_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
value
)
/*
* Since SH7751 only does 32bit access we'll have to do a read,mask,write operation.
* We'll allow an odd byte offset, though it should be illegal.
*/
static
int
pci_conf1_write
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
int
size
,
u32
value
)
{
u32
word
;
u32
shift
=
(
where
&
3
)
*
8
;
u32
mask
=
((
1
<<
8
)
-
1
)
<<
shift
;
// create the byte mask
u32
word
,
mask
;
unsigned
long
flags
;
/* Since SH7751 only does 32bit access we'll have to do a
* read,mask,write operation
*/
save_and_cli
(
flags
);
outl
(
CONFIG_CMD
(
dev
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
word
=
inl
(
PCI_REG
(
SH7751_PCIPDR
))
;
word
&=
~
mask
;
word
|=
value
<<
shift
;
outl
(
word
,
PCI_REG
(
SH7751_PCIPDR
));
restore_flags
(
flags
);
PCIDBG
(
4
,
"pci_conf1_write_config_byte@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
dev
,
where
),
word
);
return
PCIBIOS_SUCCESSFUL
;
}
static
int
pci_conf1_write_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
value
)
{
u32
word
;
u32
shift
=
(
where
&
3
)
*
8
;
u32
mask
=
((
1
<<
16
)
-
1
)
<<
shift
;
// create the word mask
unsigned
long
flags
;
/* Since SH7751 only does 32bit access we'll have to do a
* read,mask,write operation. We'll allow an odd byte offset,
* though it should be illegal.
*/
if
(
shift
==
24
)
return
PCIBIOS_BAD_REGISTER_NUMBER
;
if
(
size
==
1
)
{
mask
=
((
1
<<
8
)
-
1
)
<<
shift
;
// create the byte mask
}
else
if
(
size
==
2
){
if
(
shift
==
24
)
return
PCIBIOS_BAD_REGISTER_NUMBER
;
mask
=
((
1
<<
16
)
-
1
)
<<
shift
;
// create the word mask
}
save_and_cli
(
flags
);
outl
(
CONFIG_CMD
(
dev
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
outl
(
CONFIG_CMD
(
bus
,
devfn
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
if
(
size
==
4
){
outl
(
value
,
PCI_REG
(
SH7751_PCIPDR
));
restore_flags
(
flags
);
PCIDBG
(
4
,
"pci_conf1_write@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
bus
,
devfn
,
where
),
value
);
return
PCIBIOS_SUCCESSFUL
;
}
word
=
inl
(
PCI_REG
(
SH7751_PCIPDR
))
;
word
&=
~
mask
;
word
|=
value
<<
shift
;
outl
(
value
,
PCI_REG
(
SH7751_PCIPDR
));
restore_flags
(
flags
);
PCIDBG
(
4
,
"pci_conf1_write_config_word@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
dev
,
where
),
word
);
return
PCIBIOS_SUCCESSFUL
;
}
static
int
pci_conf1_write_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
u32
value
)
{
unsigned
long
flags
;
save_and_cli
(
flags
);
outl
(
CONFIG_CMD
(
dev
,
where
),
PCI_REG
(
SH7751_PCIPAR
));
outl
(
value
,
PCI_REG
(
SH7751_PCIPDR
));
outl
(
word
,
PCI_REG
(
SH7751_PCIPDR
));
restore_flags
(
flags
);
PCIDBG
(
4
,
"pci_conf1_write_config_dword@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
dev
,
where
),
value
);
PCIDBG
(
4
,
"pci_conf1_write@0x%08x=0x%x
\n
"
,
CONFIG_CMD
(
bus
,
devfn
,
where
),
word
);
return
PCIBIOS_SUCCESSFUL
;
}
#undef CONFIG_CMD
static
struct
pci_ops
pci_direct_conf1
=
{
pci_conf1_read_config_byte
,
pci_conf1_read_config_word
,
pci_conf1_read_config_dword
,
pci_conf1_write_config_byte
,
pci_conf1_write_config_word
,
pci_conf1_write_config_dword
.
read
=
pci_conf1_read
,
.
write
=
pci_conf1_write
,
};
struct
pci_ops
*
__init
pci_check_direct
(
void
)
...
...
arch/sh/kernel/pci_st40.c
View file @
4ce2b158
...
...
@@ -268,7 +268,7 @@ char * __init pcibios_setup(char *str)
#define SET_CONFIG_BITS(bus,devfn,where)\
(((bus) << 16) | ((devfn) << 8) | ((where) & ~3) | (bus!=0))
#define CONFIG_CMD(
dev, where) SET_CONFIG_BITS((dev)->bus->number,(dev)->
devfn,where)
#define CONFIG_CMD(
bus, devfn, where) SET_CONFIG_BITS(bus->number,
devfn,where)
static
int
CheckForMasterAbort
(
void
)
...
...
@@ -284,79 +284,53 @@ static int CheckForMasterAbort(void)
}
/* Write to config register */
static
int
st40pci_read_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
*
val
)
static
int
st40pci_read
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
int
size
,
u32
*
val
)
{
ST40PCI_WRITE
(
PAR
,
CONFIG_CMD
(
dev
,
where
));
*
val
=
ST40PCI_READ_BYTE
(
PDR
+
(
where
&
3
));
if
(
CheckForMasterAbort
())
*
val
=
0xff
;
return
PCIBIOS_SUCCESSFUL
;
}
static
int
st40pci_read_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
*
val
)
{
ST40PCI_WRITE
(
PAR
,
CONFIG_CMD
(
dev
,
where
));
*
val
=
ST40PCI_READ_SHORT
(
PDR
+
(
where
&
2
));
if
(
CheckForMasterAbort
())
*
val
=
0xffff
;
return
PCIBIOS_SUCCESSFUL
;
}
static
int
st40pci_read_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
u32
*
val
)
{
ST40PCI_WRITE
(
PAR
,
CONFIG_CMD
(
dev
,
where
));
*
val
=
ST40PCI_READ
(
PDR
);
if
(
CheckForMasterAbort
())
*
val
=
0xffffffff
;
return
PCIBIOS_SUCCESSFUL
;
}
static
int
st40pci_write_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
val
)
{
ST40PCI_WRITE
(
PAR
,
CONFIG_CMD
(
dev
,
where
));
ST40PCI_WRITE_BYTE
(
PDR
+
(
where
&
3
),
val
);
CheckForMasterAbort
();
return
PCIBIOS_SUCCESSFUL
;
}
static
int
st40pci_write_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
val
)
{
ST40PCI_WRITE
(
PAR
,
CONFIG_CMD
(
dev
,
where
));
ST40PCI_WRITE_SHORT
(
PDR
+
(
where
&
2
),
val
);
ST40PCI_WRITE
(
PAR
,
CONFIG_CMD
(
bus
,
devfn
,
where
));
switch
(
size
)
{
case
1
:
*
val
=
(
u8
)
ST40PCI_READ_BYTE
(
PDR
+
(
where
&
3
));
break
;
case
2
:
*
val
=
(
u16
)
ST40PCI_READ_SHORT
(
PDR
+
(
where
&
2
));
break
;
case
4
:
*
val
=
ST40PCI_READ
(
PDR
);
break
;
}
CheckForMasterAbort
();
if
(
CheckForMasterAbort
()){
switch
(
size
)
{
case
1
:
*
val
=
(
u8
)
0xff
;
break
;
case
2
:
*
val
=
(
u16
)
0xffff
;
break
;
case
4
:
*
val
=
0xffffffff
;
break
;
}
}
return
PCIBIOS_SUCCESSFUL
;
}
static
int
st40pci_write_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
u32
val
)
static
int
st40pci_write
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
;
int
where
,
int
size
,
u32
val
)
{
ST40PCI_WRITE
(
PAR
,
CONFIG_CMD
(
dev
,
where
));
ST40PCI_WRITE
(
PDR
,
val
);
switch
(
size
)
{
case
1
:
ST40PCI_WRITE_BYTE
(
PDR
+
(
where
&
3
),
(
u8
)
val
);
break
;
case
2
:
ST40PCI_WRITE_SHORT
(
PDR
+
(
where
&
2
),
(
u16
)
val
);
break
;
case
4
:
ST40PCI_WRITE
(
PDR
,
val
);
break
;
}
CheckForMasterAbort
();
...
...
@@ -364,12 +338,8 @@ static int st40pci_write_config_dword(struct pci_dev *dev, int where,
}
static
struct
pci_ops
pci_config_ops
=
{
st40pci_read_config_byte
,
st40pci_read_config_word
,
st40pci_read_config_dword
,
st40pci_write_config_byte
,
st40pci_write_config_word
,
st40pci_write_config_dword
.
read
=
st40pci_read
,
.
write
=
st40pci_write
,
};
...
...
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