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
935583d7
Commit
935583d7
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: ia64 pci_ops changes
ia64 pci ops changes
parent
00ed5b65
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
211 deletions
+28
-211
arch/ia64/kernel/pci.c
arch/ia64/kernel/pci.c
+10
-70
arch/ia64/sn/io/pci.c
arch/ia64/sn/io/pci.c
+18
-139
include/asm-ia64/pci.h
include/asm-ia64/pci.h
+0
-2
No files found.
arch/ia64/kernel/pci.c
View file @
935583d7
...
...
@@ -46,9 +46,6 @@ struct pci_fixup pcibios_fixups[1];
struct
pci_ops
*
pci_root_ops
;
int
(
*
pci_config_read
)(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
*
value
);
int
(
*
pci_config_write
)(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
value
);
/*
* Low-level SAL-based PCI configuration access functions. Note that SAL
...
...
@@ -60,7 +57,7 @@ int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32
((u64)(bus << 16) | (u64)(dev << 11) | (u64)(fn << 8) | (u64)(reg))
static
int
pci_sal_read
(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
*
value
)
__
pci_sal_read
(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
*
value
)
{
int
result
=
0
;
u64
data
=
0
;
...
...
@@ -76,7 +73,7 @@ pci_sal_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value)
}
static
int
pci_sal_write
(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
value
)
__
pci_sal_write
(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
value
)
{
if
((
bus
>
255
)
||
(
dev
>
31
)
||
(
fn
>
7
)
||
(
reg
>
255
))
return
-
EINVAL
;
...
...
@@ -86,77 +83,22 @@ pci_sal_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value)
static
int
pci_sal_read_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
*
value
)
{
int
result
=
0
;
u32
data
=
0
;
if
(
!
value
)
return
-
EINVAL
;
result
=
pci_sal_read
(
0
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
),
where
,
1
,
&
data
);
*
value
=
(
u8
)
data
;
return
result
;
}
static
int
pci_sal_read_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
*
value
)
{
int
result
=
0
;
u32
data
=
0
;
if
(
!
value
)
return
-
EINVAL
;
result
=
pci_sal_read
(
0
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
),
where
,
2
,
&
data
);
*
value
=
(
u16
)
data
;
return
result
;
}
static
int
pci_sal_read_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
u32
*
value
)
{
if
(
!
value
)
return
-
EINVAL
;
return
pci_sal_read
(
0
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
),
where
,
4
,
value
);
}
static
int
pci_sal_write_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
u8
value
)
{
return
pci_sal_write
(
0
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
),
where
,
1
,
value
);
}
static
int
pci_sal_write_config_word
(
struct
pci_dev
*
dev
,
int
where
,
u16
value
)
pci_sal_read
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
int
size
,
u32
*
value
)
{
return
pci_sal_write
(
0
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
),
where
,
2
,
value
);
return
__pci_sal_read
(
0
,
bus
->
number
,
PCI_SLOT
(
devfn
),
PCI_FUNC
(
devfn
),
where
,
size
,
value
);
}
static
int
pci_sal_write
_config_dword
(
struct
pci_dev
*
dev
,
int
wher
e
,
u32
value
)
pci_sal_write
(
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
int
siz
e
,
u32
value
)
{
return
pci_sal_write
(
0
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
),
where
,
4
,
value
);
return
__pci_sal_write
(
0
,
bus
->
number
,
PCI_SLOT
(
devfn
),
PCI_FUNC
(
dev
fn
),
where
,
size
,
value
);
}
struct
pci_ops
pci_sal_ops
=
{
pci_sal_read_config_byte
,
pci_sal_read_config_word
,
pci_sal_read_config_dword
,
pci_sal_write_config_byte
,
pci_sal_write_config_word
,
pci_sal_write_config_dword
.
read
=
pci_sal_read
,
.
write
=
pci_sal_write
,
};
...
...
@@ -193,8 +135,6 @@ pcibios_config_init (void)
printk
(
"PCI: Using SAL to access configuration space
\n
"
);
pci_root_ops
=
&
pci_sal_ops
;
pci_config_read
=
pci_sal_read
;
pci_config_write
=
pci_sal_write
;
return
;
}
...
...
arch/ia64/sn/io/pci.c
View file @
935583d7
...
...
@@ -44,22 +44,21 @@ extern devfs_handle_t pci_bus_to_vertex(unsigned char);
extern
devfs_handle_t
devfn_to_vertex
(
unsigned
char
bus
,
unsigned
char
devfn
);
/*
* snia64_read
_config_byte - Read a byte
from the config area of the device.
* snia64_read
- Read
from the config area of the device.
*/
static
int
snia64_read
_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
unsigned
char
*
val
)
static
int
snia64_read
(
struct
pci_bus
*
bus
,
unsigned
char
devfn
,
int
where
,
int
size
,
unsigned
char
*
val
)
{
unsigned
long
res
=
0
;
unsigned
size
=
1
;
devfs_handle_t
device_vertex
;
if
(
(
dev
==
(
struct
pci_dev
*
)
0
)
||
(
val
==
(
unsigned
char
*
)
0
)
)
{
if
(
(
bus
==
NULL
)
||
(
val
==
(
unsigned
char
*
)
0
)
)
{
return
PCIBIOS_DEVICE_NOT_FOUND
;
}
device_vertex
=
devfn_to_vertex
(
dev
->
bus
->
number
,
dev
->
devfn
);
device_vertex
=
devfn_to_vertex
(
bus
->
number
,
devfn
);
if
(
!
device_vertex
)
{
DBG
(
"%s : nonexistent device: bus= 0x%x slot= 0x%x func= 0x%x
\n
"
,
__FUNCTION__
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
));
__FUNCTION__
,
bus
->
number
,
PCI_SLOT
(
devfn
),
PCI_FUNC
(
devfn
));
return
(
-
1
);
}
res
=
pciio_config_get
(
device_vertex
,
(
unsigned
)
where
,
size
);
...
...
@@ -68,160 +67,40 @@ static int snia64_read_config_byte (struct pci_dev *dev,
}
/*
* snia64_
read_config_word - Read 2 bytes from
the config area of the device.
* snia64_
write - Writes to
the config area of the device.
*/
static
int
snia64_
read_config_word
(
struct
pci_dev
*
dev
,
int
where
,
unsigned
short
*
val
)
static
int
snia64_
write
(
struct
pci_bus
*
bus
,
unsigned
char
devfn
,
int
where
,
int
size
,
unsigned
char
val
)
{
unsigned
long
res
=
0
;
unsigned
size
=
2
;
/* 2 bytes */
devfs_handle_t
device_vertex
;
if
(
(
dev
==
(
struct
pci_dev
*
)
0
)
||
(
val
==
(
unsigned
short
*
)
0
)
)
{
return
PCIBIOS_DEVICE_NOT_FOUND
;
}
device_vertex
=
devfn_to_vertex
(
dev
->
bus
->
number
,
dev
->
devfn
);
if
(
!
device_vertex
)
{
DBG
(
"%s : nonexistent device: bus= 0x%x slot= 0x%x func= 0x%x
\n
"
,
__FUNCTION__
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
));
return
(
-
1
);
}
res
=
pciio_config_get
(
device_vertex
,
(
unsigned
)
where
,
size
);
*
val
=
(
unsigned
short
)
res
;
return
PCIBIOS_SUCCESSFUL
;
}
/*
* snia64_read_config_dword - Read 4 bytes from the config area of the device.
*/
static
int
snia64_read_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
unsigned
int
*
val
)
{
unsigned
long
res
=
0
;
unsigned
size
=
4
;
/* 4 bytes */
devfs_handle_t
device_vertex
;
if
(
where
&
3
)
{
return
PCIBIOS_BAD_REGISTER_NUMBER
;
}
if
(
(
dev
==
(
struct
pci_dev
*
)
0
)
||
(
val
==
(
unsigned
int
*
)
0
)
)
{
return
PCIBIOS_DEVICE_NOT_FOUND
;
}
device_vertex
=
devfn_to_vertex
(
dev
->
bus
->
number
,
dev
->
devfn
);
if
(
!
device_vertex
)
{
DBG
(
"%s : nonexistent device: bus= 0x%x slot= 0x%x func= 0x%x
\n
"
,
__FUNCTION__
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
));
return
(
-
1
);
}
res
=
pciio_config_get
(
device_vertex
,
(
unsigned
)
where
,
size
);
*
val
=
(
unsigned
int
)
res
;
return
PCIBIOS_SUCCESSFUL
;
}
/*
* snia64_write_config_byte - Writes 1 byte to the config area of the device.
*/
static
int
snia64_write_config_byte
(
struct
pci_dev
*
dev
,
int
where
,
unsigned
char
val
)
{
devfs_handle_t
device_vertex
;
if
(
dev
==
(
struct
pci_dev
*
)
0
)
{
if
(
bus
==
NULL
)
{
return
PCIBIOS_DEVICE_NOT_FOUND
;
}
/*
* if it's an IOC3 then we bail out, we special
* case them with pci_fixup_ioc3
*/
if
(
dev
->
vendor
==
PCI_VENDOR_ID_SGI
&&
/* Starting 2.5.32 struct pci_dev is not passed down */
/*if (dev->vendor == PCI_VENDOR_ID_SGI &&
dev->device == PCI_DEVICE_ID_SGI_IOC3 )
return PCIBIOS_SUCCESSFUL;
*/
device_vertex
=
devfn_to_vertex
(
dev
->
bus
->
number
,
dev
->
devfn
);
if
(
!
device_vertex
)
{
DBG
(
"%s : nonexistent device: bus= 0x%x slot= 0x%x func= 0x%x
\n
"
,
__FUNCTION__
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
));
return
(
-
1
);
}
pciio_config_set
(
device_vertex
,
(
unsigned
)
where
,
1
,
(
uint64_t
)
val
);
return
PCIBIOS_SUCCESSFUL
;
}
/*
* snia64_write_config_word - Writes 2 bytes to the config area of the device.
*/
static
int
snia64_write_config_word
(
struct
pci_dev
*
dev
,
int
where
,
unsigned
short
val
)
{
devfs_handle_t
device_vertex
=
NULL
;
if
(
where
&
1
)
{
return
PCIBIOS_BAD_REGISTER_NUMBER
;
}
if
(
dev
==
(
struct
pci_dev
*
)
0
)
{
return
PCIBIOS_DEVICE_NOT_FOUND
;
}
/*
* if it's an IOC3 then we bail out, we special
* case them with pci_fixup_ioc3
*/
if
(
dev
->
vendor
==
PCI_VENDOR_ID_SGI
&&
dev
->
device
==
PCI_DEVICE_ID_SGI_IOC3
)
return
PCIBIOS_SUCCESSFUL
;
device_vertex
=
devfn_to_vertex
(
dev
->
bus
->
number
,
dev
->
devfn
);
if
(
!
device_vertex
)
{
DBG
(
"%s : nonexistent device: bus= 0x%x slot= 0x%x func= 0x%x
\n
"
,
__FUNCTION__
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
));
return
(
-
1
);
}
pciio_config_set
(
device_vertex
,
(
unsigned
)
where
,
2
,
(
uint64_t
)
val
);
return
PCIBIOS_SUCCESSFUL
;
}
/*
* snia64_write_config_dword - Writes 4 bytes to the config area of the device.
*/
static
int
snia64_write_config_dword
(
struct
pci_dev
*
dev
,
int
where
,
unsigned
int
val
)
{
devfs_handle_t
device_vertex
;
if
(
where
&
3
)
{
return
PCIBIOS_BAD_REGISTER_NUMBER
;
}
if
(
dev
==
(
struct
pci_dev
*
)
0
)
{
return
PCIBIOS_DEVICE_NOT_FOUND
;
}
/*
* if it's an IOC3 then we bail out, we special
* case them with pci_fixup_ioc3
*/
if
(
dev
->
vendor
==
PCI_VENDOR_ID_SGI
&&
dev
->
device
==
PCI_DEVICE_ID_SGI_IOC3
)
return
PCIBIOS_SUCCESSFUL
;
device_vertex
=
devfn_to_vertex
(
dev
->
bus
->
number
,
dev
->
devfn
);
device_vertex
=
devfn_to_vertex
(
bus
->
number
,
devfn
);
if
(
!
device_vertex
)
{
DBG
(
"%s : nonexistent device: bus= 0x%x slot= 0x%x func= 0x%x
\n
"
,
__FUNCTION__
,
dev
->
bus
->
number
,
PCI_SLOT
(
dev
->
devfn
),
PCI_FUNC
(
dev
->
devfn
));
__FUNCTION__
,
bus
->
number
,
PCI_SLOT
(
devfn
),
PCI_FUNC
(
devfn
));
return
(
-
1
);
}
pciio_config_set
(
device_vertex
,
(
unsigned
)
where
,
4
,
(
uint64_t
)
val
);
pciio_config_set
(
device_vertex
,
(
unsigned
)
where
,
size
,
(
uint64_t
)
val
);
return
PCIBIOS_SUCCESSFUL
;
}
static
struct
pci_ops
snia64_pci_ops
=
{
snia64_read_config_byte
,
snia64_read_config_word
,
snia64_read_config_dword
,
snia64_write_config_byte
,
snia64_write_config_word
,
snia64_write_config_dword
.
read
=
snia64_read
,
.
write
=
snia64_write
,
};
/*
...
...
include/asm-ia64/pci.h
View file @
935583d7
...
...
@@ -22,8 +22,6 @@
void
pcibios_config_init
(
void
);
struct
pci_bus
*
pcibios_scan_root
(
int
bus
);
extern
int
(
*
pci_config_read
)(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
*
value
);
extern
int
(
*
pci_config_write
)(
int
seg
,
int
bus
,
int
dev
,
int
fn
,
int
reg
,
int
len
,
u32
value
);
struct
pci_dev
;
...
...
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