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
82475a64
Commit
82475a64
authored
Sep 09, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compaq PCI Hotplug driver: changed calls to pci_*_nodev() to pci_bus_*()
parent
3d1a6602
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
198 additions
and
153 deletions
+198
-153
drivers/hotplug/cpqphp.h
drivers/hotplug/cpqphp.h
+2
-4
drivers/hotplug/cpqphp_core.c
drivers/hotplug/cpqphp_core.c
+26
-14
drivers/hotplug/cpqphp_ctrl.c
drivers/hotplug/cpqphp_ctrl.c
+64
-49
drivers/hotplug/cpqphp_nvram.c
drivers/hotplug/cpqphp_nvram.c
+5
-4
drivers/hotplug/cpqphp_pci.c
drivers/hotplug/cpqphp_pci.c
+95
-78
drivers/hotplug/cpqphp_proc.c
drivers/hotplug/cpqphp_proc.c
+6
-4
No files found.
drivers/hotplug/cpqphp.h
View file @
82475a64
...
...
@@ -292,16 +292,14 @@ struct controller {
struct
pci_resource
*
io_head
;
struct
pci_resource
*
bus_head
;
struct
pci_dev
*
pci_dev
;
struct
pci_
ops
*
pci_op
s
;
struct
pci_
bus
*
pci_bu
s
;
struct
proc_dir_entry
*
proc_entry
;
struct
proc_dir_entry
*
proc_entry2
;
struct
event_info
event_queue
[
10
];
struct
slot
*
slot
;
u8
next_event
;
u8
interrupt
;
u8
bus
;
u8
device
;
u8
function
;
u8
bus
;
/* bus number for the pci hotplug controller */
u8
rev
;
u8
slot_device_offset
;
u8
first_slot
;
...
...
drivers/hotplug/cpqphp_core.c
View file @
82475a64
...
...
@@ -467,7 +467,7 @@ static int ctrl_slot_cleanup (struct controller * ctrl)
//
// Output: SUCCESS or FAILURE
//=============================================================================
static
int
get_slot_mapping
(
struct
pci_
ops
*
op
s
,
u8
bus_num
,
u8
dev_num
,
u8
*
slot
)
static
int
get_slot_mapping
(
struct
pci_
bus
*
bu
s
,
u8
bus_num
,
u8
dev_num
,
u8
*
slot
)
{
struct
irq_routing_table
*
PCIIRQRoutingInfoLength
;
u32
work
;
...
...
@@ -476,7 +476,7 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
u8
tbus
,
tdevice
,
tslot
,
bridgeSlot
;
dbg
(
"%s: %p, %d, %d, %p
\n
"
,
__FUNCTION__
,
op
s
,
bus_num
,
dev_num
,
slot
);
dbg
(
"%s: %p, %d, %d, %p
\n
"
,
__FUNCTION__
,
bu
s
,
bus_num
,
dev_num
,
slot
);
bridgeSlot
=
0xFF
;
...
...
@@ -490,7 +490,6 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
return
-
1
;
}
for
(
loop
=
0
;
loop
<
len
;
++
loop
)
{
tbus
=
PCIIRQRoutingInfoLength
->
slots
[
loop
].
bus
;
tdevice
=
PCIIRQRoutingInfoLength
->
slots
[
loop
].
devfn
>>
3
;
...
...
@@ -499,7 +498,8 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
if
((
tbus
==
bus_num
)
&&
(
tdevice
==
dev_num
))
{
*
slot
=
tslot
;
if
(
PCIIRQRoutingInfoLength
!=
NULL
)
kfree
(
PCIIRQRoutingInfoLength
);
if
(
PCIIRQRoutingInfoLength
!=
NULL
)
kfree
(
PCIIRQRoutingInfoLength
);
return
0
;
}
else
{
// Didn't get a match on the target PCI device. Check if the
...
...
@@ -508,10 +508,11 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
// device, I need to save the bridge's slot number. If I can't
// find an entry for the target device, I will have to assume it's
// on the other side of the bridge, and assign it the bridge's slot.
pci_read_config_dword_nodev
(
ops
,
tbus
,
tdevice
,
0
,
PCI_REVISION_ID
,
&
work
);
bus
->
number
=
tbus
;
pci_bus_read_config_dword
(
bus
,
PCI_DEVFN
(
tdevice
,
0
),
PCI_REVISION_ID
,
&
work
);
if
((
work
>>
8
)
==
PCI_TO_PCI_BRIDGE_CLASS
)
{
pci_
read_config_dword_nodev
(
ops
,
tbus
,
tdevice
,
0
,
PCI_PRIMARY_BUS
,
&
work
);
pci_
bus_read_config_dword
(
bus
,
PCI_DEVFN
(
tdevice
,
0
)
,
PCI_PRIMARY_BUS
,
&
work
);
// See if bridge's secondary bus matches target bus.
if
(((
work
>>
8
)
&
0x000000FF
)
==
(
long
)
bus_num
)
{
bridgeSlot
=
tslot
;
...
...
@@ -521,7 +522,6 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
}
// If we got here, we didn't find an entry in the IRQ mapping table
// for the target PCI device. If we did determine that the target
// device is on the other side of a PCI-to-PCI bridge, return the
...
...
@@ -991,12 +991,20 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dbg
(
" pcix_support %s
\n
"
,
ctrl
->
pcix_support
==
0
?
"not supported"
:
"supported"
);
ctrl
->
pci_dev
=
pdev
;
ctrl
->
pci_ops
=
pdev
->
bus
->
ops
;
/* make our own copy of the pci bus structure, as we like tweaking it a lot */
ctrl
->
pci_bus
=
kmalloc
(
sizeof
(
*
ctrl
->
pci_bus
),
GFP_KERNEL
);
if
(
!
ctrl
->
pci_bus
)
{
err
(
"out of memory
\n
"
);
rc
=
-
ENOMEM
;
goto
err_free_ctrl
;
}
memcpy
(
ctrl
->
pci_bus
,
pdev
->
bus
,
sizeof
(
*
ctrl
->
pci_bus
));
ctrl
->
bus
=
pdev
->
bus
->
number
;
ctrl
->
device
=
PCI_SLOT
(
pdev
->
devfn
);
ctrl
->
function
=
PCI_FUNC
(
pdev
->
devfn
);
ctrl
->
rev
=
rev
;
dbg
(
"bus device function rev: %d %d %d %d
\n
"
,
ctrl
->
bus
,
ctrl
->
device
,
ctrl
->
function
,
ctrl
->
rev
);
dbg
(
"bus device function rev: %d %d %d %d
\n
"
,
ctrl
->
bus
,
PCI_SLOT
(
pdev
->
devfn
),
PCI_FUNC
(
pdev
->
devfn
),
ctrl
->
rev
);
init_MUTEX
(
&
ctrl
->
crit_sect
);
init_waitqueue_head
(
&
ctrl
->
queue
);
...
...
@@ -1004,7 +1012,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* initialize our threads if they haven't already been started up */
rc
=
one_time_init
();
if
(
rc
)
{
goto
err_free_
ctrl
;
goto
err_free_
bus
;
}
dbg
(
"pdev = %p
\n
"
,
pdev
);
...
...
@@ -1015,7 +1023,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_resource_len
(
pdev
,
0
),
MY_NAME
))
{
err
(
"cannot reserve MMIO region
\n
"
);
rc
=
-
ENOMEM
;
goto
err_free_
ctrl
;
goto
err_free_
bus
;
}
ctrl
->
hpc_reg
=
ioremap
(
pci_resource_start
(
pdev
,
0
),
pci_resource_len
(
pdev
,
0
));
...
...
@@ -1043,7 +1051,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
// in this case it will always be called for the "base"
// bus/dev/func of a slot.
// CS: this is leveraging the PCIIRQ routing code from the kernel (pci-pc.c: get_irq_routing_table)
rc
=
get_slot_mapping
(
ctrl
->
pci_
op
s
,
pdev
->
bus
->
number
,
(
readb
(
ctrl
->
hpc_reg
+
SLOT_MASK
)
>>
4
),
&
(
ctrl
->
first_slot
));
rc
=
get_slot_mapping
(
ctrl
->
pci_
bu
s
,
pdev
->
bus
->
number
,
(
readb
(
ctrl
->
hpc_reg
+
SLOT_MASK
)
>>
4
),
&
(
ctrl
->
first_slot
));
dbg
(
"get_slot_mapping: first_slot = %d, returned = %d
\n
"
,
ctrl
->
first_slot
,
rc
);
if
(
rc
)
{
err
(
msg_initialization_err
,
rc
);
...
...
@@ -1188,6 +1196,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap
(
ctrl
->
hpc_reg
);
err_free_mem_region:
release_mem_region
(
pci_resource_start
(
pdev
,
0
),
pci_resource_len
(
pdev
,
0
));
err_free_bus:
kfree
(
ctrl
->
pci_bus
);
err_free_ctrl:
kfree
(
ctrl
);
return
rc
;
...
...
@@ -1328,6 +1338,8 @@ static void unload_cpqphpd(void)
kfree
(
tres
);
}
kfree
(
ctrl
->
pci_bus
);
tctrl
=
ctrl
;
ctrl
=
ctrl
->
next
;
kfree
(
tctrl
);
...
...
drivers/hotplug/cpqphp_ctrl.c
View file @
82475a64
This diff is collapsed.
Click to expand it.
drivers/hotplug/cpqphp_nvram.c
View file @
82475a64
...
...
@@ -286,12 +286,12 @@ static u32 store_HRT (void *rom_start)
return
(
rc
);
// The device Number
rc
=
add_byte
(
&
pFill
,
ctrl
->
device
,
&
usedbytes
,
&
available
);
rc
=
add_byte
(
&
pFill
,
PCI_SLOT
(
ctrl
->
pci_dev
->
devfn
)
,
&
usedbytes
,
&
available
);
if
(
rc
)
return
(
rc
);
// The function Number
rc
=
add_byte
(
&
pFill
,
ctrl
->
function
,
&
usedbytes
,
&
available
);
rc
=
add_byte
(
&
pFill
,
PCI_FUNC
(
ctrl
->
pci_dev
->
devfn
)
,
&
usedbytes
,
&
available
);
if
(
rc
)
return
(
rc
);
...
...
@@ -479,8 +479,9 @@ int compaq_nvram_load (void *rom_start, struct controller *ctrl)
device
=
p_ev_ctrl
->
device
;
function
=
p_ev_ctrl
->
function
;
while
((
bus
!=
ctrl
->
bus
)
||
(
device
!=
ctrl
->
device
)
||
(
function
!=
ctrl
->
function
))
{
while
((
bus
!=
ctrl
->
bus
)
||
(
device
!=
PCI_SLOT
(
ctrl
->
pci_dev
->
devfn
))
||
(
function
!=
PCI_FUNC
(
ctrl
->
pci_dev
->
devfn
)))
{
nummem
=
p_ev_ctrl
->
mem_avail
;
numpmem
=
p_ev_ctrl
->
p_mem_avail
;
numio
=
p_ev_ctrl
->
io_avail
;
...
...
drivers/hotplug/cpqphp_pci.c
View file @
82475a64
This diff is collapsed.
Click to expand it.
drivers/hotplug/cpqphp_proc.c
View file @
82475a64
...
...
@@ -53,8 +53,9 @@ static int read_ctrl (char *buf, char **start, off_t offset, int len, int *eof,
*
eof
=
1
;
out
+=
sprintf
(
out
,
"hot plug ctrl Info Page
\n
"
);
out
+=
sprintf
(
out
,
"bus = %d, device = %d, function = %d
\n
"
,
ctrl
->
bus
,
ctrl
->
device
,
ctrl
->
function
);
out
+=
sprintf
(
out
,
"bus = %d, device = %d, function = %d
\n
"
,
ctrl
->
bus
,
PCI_SLOT
(
ctrl
->
pci_dev
->
devfn
),
PCI_FUNC
(
ctrl
->
pci_dev
->
devfn
));
out
+=
sprintf
(
out
,
"Free resources: memory
\n
"
);
index
=
11
;
res
=
ctrl
->
mem_head
;
...
...
@@ -104,8 +105,9 @@ static int read_dev (char *buf, char **start, off_t offset, int len, int *eof, v
*
eof
=
1
;
out
+=
sprintf
(
out
,
"hot plug ctrl Info Page
\n
"
);
out
+=
sprintf
(
out
,
"bus = %d, device = %d, function = %d
\n
"
,
ctrl
->
bus
,
ctrl
->
device
,
ctrl
->
function
);
out
+=
sprintf
(
out
,
"bus = %d, device = %d, function = %d
\n
"
,
ctrl
->
bus
,
PCI_SLOT
(
ctrl
->
pci_dev
->
devfn
),
PCI_FUNC
(
ctrl
->
pci_dev
->
devfn
));
slot
=
ctrl
->
slot
;
...
...
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