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
91d6d308
Commit
91d6d308
authored
Mar 21, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sun HME/GEM driver probing cleanups.
parent
d241f6b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
68 deletions
+101
-68
drivers/net/sungem.c
drivers/net/sungem.c
+30
-19
drivers/net/sunhme.c
drivers/net/sunhme.c
+71
-49
No files found.
drivers/net/sungem.c
View file @
91d6d308
...
@@ -2923,21 +2923,21 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
...
@@ -2923,21 +2923,21 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
return
-
ENODEV
;
return
-
ENODEV
;
}
}
dev
=
init_etherdev
(
NULL
,
sizeof
(
*
gp
));
dev
=
alloc_etherdev
(
sizeof
(
*
gp
));
if
(
!
dev
)
{
if
(
!
dev
)
{
printk
(
KERN_ERR
PFX
"Etherdev
init
failed, aborting.
\n
"
);
printk
(
KERN_ERR
PFX
"Etherdev
alloc
failed, aborting.
\n
"
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
if
(
!
request_mem_region
(
gemreg_base
,
gemreg_len
,
dev
->
name
))
{
gp
=
dev
->
priv
;
printk
(
KERN_ERR
PFX
"MMIO resource (0x%lx@0x%lx) unavailable, "
"aborting.
\n
"
,
gemreg_base
,
gemreg_len
);
if
(
pci_request_regions
(
pdev
,
dev
->
name
))
{
printk
(
KERN_ERR
PFX
"Cannot obtain PCI resources, "
"aborting.
\n
"
);
goto
err_out_free_netdev
;
goto
err_out_free_netdev
;
}
}
gp
=
dev
->
priv
;
gp
->
pdev
=
pdev
;
gp
->
pdev
=
pdev
;
dev
->
base_addr
=
(
long
)
pdev
;
dev
->
base_addr
=
(
long
)
pdev
;
gp
->
dev
=
dev
;
gp
->
dev
=
dev
;
...
@@ -2970,7 +2970,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
...
@@ -2970,7 +2970,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if
(
gp
->
regs
==
0UL
)
{
if
(
gp
->
regs
==
0UL
)
{
printk
(
KERN_ERR
PFX
"Cannot map device registers, "
printk
(
KERN_ERR
PFX
"Cannot map device registers, "
"aborting.
\n
"
);
"aborting.
\n
"
);
goto
err_out_free_
mmio_
res
;
goto
err_out_free_res
;
}
}
/* On Apple, we power the chip up now in order for check
/* On Apple, we power the chip up now in order for check
...
@@ -3006,22 +3006,28 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
...
@@ -3006,22 +3006,28 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
goto
err_out_iounmap
;
goto
err_out_iounmap
;
}
}
pci_set_drvdata
(
pdev
,
dev
);
printk
(
KERN_INFO
"%s: Sun GEM (PCI) 10/100/1000BaseT Ethernet "
,
dev
->
name
);
#ifdef CONFIG_ALL_PPC
#ifdef CONFIG_ALL_PPC
gp
->
of_node
=
pci_device_to_OF_node
(
pdev
);
gp
->
of_node
=
pci_device_to_OF_node
(
pdev
);
#endif
#endif
if
(
gem_get_device_address
(
gp
))
if
(
gem_get_device_address
(
gp
))
goto
err_out_iounmap
;
goto
err_out_free_consistent
;
if
(
register_netdev
(
dev
))
{
printk
(
KERN_ERR
PFX
"Cannot register net device, "
"aborting.
\n
"
);
goto
err_out_free_consistent
;
}
printk
(
KERN_INFO
"%s: Sun GEM (PCI) 10/100/1000BaseT Ethernet "
,
dev
->
name
);
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
printk
(
"
\n
"
);
pci_set_drvdata
(
pdev
,
dev
);
dev
->
open
=
gem_open
;
dev
->
open
=
gem_open
;
dev
->
stop
=
gem_close
;
dev
->
stop
=
gem_close
;
dev
->
hard_start_xmit
=
gem_start_xmit
;
dev
->
hard_start_xmit
=
gem_start_xmit
;
...
@@ -3045,6 +3051,12 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
...
@@ -3045,6 +3051,12 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
return
0
;
return
0
;
err_out_free_consistent:
pci_free_consistent
(
pdev
,
sizeof
(
struct
gem_init_block
),
gp
->
init_block
,
gp
->
gblock_dvma
);
err_out_iounmap:
err_out_iounmap:
down
(
&
gp
->
pm_sem
);
down
(
&
gp
->
pm_sem
);
/* Stop the PM timer & task */
/* Stop the PM timer & task */
...
@@ -3053,13 +3065,13 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
...
@@ -3053,13 +3065,13 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if
(
gp
->
hw_running
)
if
(
gp
->
hw_running
)
gem_shutdown
(
gp
);
gem_shutdown
(
gp
);
up
(
&
gp
->
pm_sem
);
up
(
&
gp
->
pm_sem
);
iounmap
((
void
*
)
gp
->
regs
);
iounmap
((
void
*
)
gp
->
regs
);
err_out_free_
mmio_
res:
err_out_free_res:
release_mem_region
(
gemreg_base
,
gemreg_len
);
pci_release_regions
(
pdev
);
err_out_free_netdev:
err_out_free_netdev:
unregister_netdev
(
dev
);
kfree
(
dev
);
kfree
(
dev
);
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -3088,8 +3100,7 @@ static void __devexit gem_remove_one(struct pci_dev *pdev)
...
@@ -3088,8 +3100,7 @@ static void __devexit gem_remove_one(struct pci_dev *pdev)
gp
->
init_block
,
gp
->
init_block
,
gp
->
gblock_dvma
);
gp
->
gblock_dvma
);
iounmap
((
void
*
)
gp
->
regs
);
iounmap
((
void
*
)
gp
->
regs
);
release_mem_region
(
pci_resource_start
(
pdev
,
0
),
pci_release_regions
(
pdev
);
pci_resource_len
(
pdev
,
0
));
kfree
(
dev
);
kfree
(
dev
);
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
...
...
drivers/net/sunhme.c
View file @
91d6d308
...
@@ -2658,7 +2658,7 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
...
@@ -2658,7 +2658,7 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
}
}
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
happy_meal
));
dev
=
alloc_etherdev
(
sizeof
(
struct
happy_meal
));
if
(
!
dev
)
if
(
!
dev
)
goto
err_out
;
goto
err_out
;
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
...
@@ -2666,13 +2666,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
...
@@ -2666,13 +2666,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
if
(
hme_version_printed
++
==
0
)
if
(
hme_version_printed
++
==
0
)
printk
(
KERN_INFO
"%s"
,
version
);
printk
(
KERN_INFO
"%s"
,
version
);
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (SBUS) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (SBUS) 10/100baseT Ethernet "
,
dev
->
name
);
/* If user did not specify a MAC address specifically, use
/* If user did not specify a MAC address specifically, use
* the Quattro local-mac-address property...
* the Quattro local-mac-address property...
*/
*/
...
@@ -2693,11 +2686,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
...
@@ -2693,11 +2686,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
memcpy
(
dev
->
dev_addr
,
idprom
->
id_ethaddr
,
6
);
memcpy
(
dev
->
dev_addr
,
idprom
->
id_ethaddr
,
6
);
}
}
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
hp
=
dev
->
priv
;
hp
=
dev
->
priv
;
memset
(
hp
,
0
,
sizeof
(
*
hp
));
memset
(
hp
,
0
,
sizeof
(
*
hp
));
...
@@ -2822,17 +2810,38 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
...
@@ -2822,17 +2810,38 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
*/
*/
happy_meal_set_initial_advertisement
(
hp
);
happy_meal_set_initial_advertisement
(
hp
);
ether_setup
(
dev
);
if
(
register_netdev
(
hp
->
dev
))
{
printk
(
KERN_ERR
"happymeal: Cannot register net device, "
"aborting.
\n
"
);
goto
err_out_free_consistent
;
}
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (SBUS) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (SBUS) 10/100baseT Ethernet "
,
dev
->
name
);
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
/* We are home free at this point, link us in to the happy
/* We are home free at this point, link us in to the happy
* device list.
* device list.
*/
*/
dev
->
ifindex
=
dev_new_index
();
hp
->
next_module
=
root_happy_dev
;
hp
->
next_module
=
root_happy_dev
;
root_happy_dev
=
hp
;
root_happy_dev
=
hp
;
return
0
;
return
0
;
err_out_free_consistent:
sbus_free_consistent
(
hp
->
happy_dev
,
PAGE_SIZE
,
hp
->
happy_block
,
hp
->
hblock_dvma
);
err_out_iounmap:
err_out_iounmap:
if
(
hp
->
gregs
)
if
(
hp
->
gregs
)
sbus_iounmap
(
hp
->
gregs
,
GREG_REG_SIZE
);
sbus_iounmap
(
hp
->
gregs
,
GREG_REG_SIZE
);
...
@@ -2846,7 +2855,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
...
@@ -2846,7 +2855,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
sbus_iounmap
(
hp
->
tcvregs
,
TCVR_REG_SIZE
);
sbus_iounmap
(
hp
->
tcvregs
,
TCVR_REG_SIZE
);
err_out_free_netdev:
err_out_free_netdev:
unregister_netdev
(
dev
);
kfree
(
dev
);
kfree
(
dev
);
err_out:
err_out:
...
@@ -2996,7 +3004,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
...
@@ -2996,7 +3004,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
goto
err_out
;
goto
err_out
;
}
}
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
happy_meal
));
dev
=
alloc_etherdev
(
sizeof
(
struct
happy_meal
));
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
if
(
!
dev
)
if
(
!
dev
)
goto
err_out
;
goto
err_out
;
...
@@ -3005,29 +3013,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
...
@@ -3005,29 +3013,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
if
(
hme_version_printed
++
==
0
)
if
(
hme_version_printed
++
==
0
)
printk
(
KERN_INFO
"%s"
,
version
);
printk
(
KERN_INFO
"%s"
,
version
);
if
(
!
qfe_slot
)
{
struct
pci_dev
*
qpdev
=
qp
->
quattro_dev
;
prom_name
[
0
]
=
0
;
if
(
!
strncmp
(
dev
->
name
,
"eth"
,
3
))
{
int
i
=
simple_strtoul
(
dev
->
name
+
3
,
NULL
,
10
);
sprintf
(
prom_name
,
"-%d"
,
i
+
3
);
}
printk
(
KERN_INFO
"%s%s: Quattro HME (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
prom_name
);
if
(
qpdev
->
vendor
==
PCI_VENDOR_ID_DEC
&&
qpdev
->
device
==
PCI_DEVICE_ID_DEC_21153
)
printk
(
"DEC 21153 PCI Bridge
\n
"
);
else
printk
(
"unknown bridge %04x.%04x
\n
"
,
qpdev
->
vendor
,
qpdev
->
device
);
}
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (PCI/CheerIO) 10/100BaseT Ethernet "
,
dev
->
name
);
dev
->
base_addr
=
(
long
)
pdev
;
dev
->
base_addr
=
(
long
)
pdev
;
hp
=
(
struct
happy_meal
*
)
dev
->
priv
;
hp
=
(
struct
happy_meal
*
)
dev
->
priv
;
...
@@ -3049,9 +3034,15 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
...
@@ -3049,9 +3034,15 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
printk
(
KERN_ERR
"happymeal(PCI): Cannot find proper PCI device base address.
\n
"
);
printk
(
KERN_ERR
"happymeal(PCI): Cannot find proper PCI device base address.
\n
"
);
goto
err_out_clear_quattro
;
goto
err_out_clear_quattro
;
}
}
if
(
pci_request_regions
(
pdev
,
dev
->
name
))
{
printk
(
KERN_ERR
"happymeal(PCI): Cannot obtain PCI resources, "
"aborting.
\n
"
);
goto
err_out_clear_quattro
;
}
if
((
hpreg_base
=
(
unsigned
long
)
ioremap
(
hpreg_base
,
0x8000
))
==
0
)
{
if
((
hpreg_base
=
(
unsigned
long
)
ioremap
(
hpreg_base
,
0x8000
))
==
0
)
{
printk
(
KERN_ERR
"happymeal(PCI): Unable to remap card memory.
\n
"
);
printk
(
KERN_ERR
"happymeal(PCI): Unable to remap card memory.
\n
"
);
return
-
ENODEV
;
goto
err_out_free_res
;
}
}
for
(
i
=
0
;
i
<
6
;
i
++
)
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
...
@@ -3076,11 +3067,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
...
@@ -3076,11 +3067,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
#endif
#endif
}
}
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
/* Layout registers. */
/* Layout registers. */
hp
->
gregs
=
(
hpreg_base
+
0x0000UL
);
hp
->
gregs
=
(
hpreg_base
+
0x0000UL
);
hp
->
etxregs
=
(
hpreg_base
+
0x2000UL
);
hp
->
etxregs
=
(
hpreg_base
+
0x2000UL
);
...
@@ -3159,12 +3145,44 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
...
@@ -3159,12 +3145,44 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
*/
*/
happy_meal_set_initial_advertisement
(
hp
);
happy_meal_set_initial_advertisement
(
hp
);
ether_setup
(
dev
);
if
(
register_netdev
(
hp
->
dev
))
{
printk
(
KERN_ERR
"happymeal(PCI): Cannot register net device, "
"aborting.
\n
"
);
goto
err_out_iounmap
;
}
if
(
!
qfe_slot
)
{
struct
pci_dev
*
qpdev
=
qp
->
quattro_dev
;
prom_name
[
0
]
=
0
;
if
(
!
strncmp
(
dev
->
name
,
"eth"
,
3
))
{
int
i
=
simple_strtoul
(
dev
->
name
+
3
,
NULL
,
10
);
sprintf
(
prom_name
,
"-%d"
,
i
+
3
);
}
printk
(
KERN_INFO
"%s%s: Quattro HME (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
prom_name
);
if
(
qpdev
->
vendor
==
PCI_VENDOR_ID_DEC
&&
qpdev
->
device
==
PCI_DEVICE_ID_DEC_21153
)
printk
(
"DEC 21153 PCI Bridge
\n
"
);
else
printk
(
"unknown bridge %04x.%04x
\n
"
,
qpdev
->
vendor
,
qpdev
->
device
);
}
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (PCI/CheerIO) 10/100BaseT Ethernet "
,
dev
->
name
);
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
/* We are home free at this point, link us in to the happy
/* We are home free at this point, link us in to the happy
* device list.
* device list.
*/
*/
dev
->
ifindex
=
dev_new_index
();
hp
->
next_module
=
root_happy_dev
;
hp
->
next_module
=
root_happy_dev
;
root_happy_dev
=
hp
;
root_happy_dev
=
hp
;
...
@@ -3173,11 +3191,13 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
...
@@ -3173,11 +3191,13 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
err_out_iounmap:
err_out_iounmap:
iounmap
((
void
*
)
hp
->
gregs
);
iounmap
((
void
*
)
hp
->
gregs
);
err_out_free_res:
pci_release_regions
(
pdev
);
err_out_clear_quattro:
err_out_clear_quattro:
if
(
qp
!=
NULL
)
if
(
qp
!=
NULL
)
qp
->
happy_meals
[
qfe_slot
]
=
NULL
;
qp
->
happy_meals
[
qfe_slot
]
=
NULL
;
unregister_netdev
(
dev
);
kfree
(
dev
);
kfree
(
dev
);
err_out:
err_out:
...
@@ -3228,6 +3248,7 @@ static int __init happy_meal_pci_probe(void)
...
@@ -3228,6 +3248,7 @@ static int __init happy_meal_pci_probe(void)
PCI_DEVICE_ID_SUN_HAPPYMEAL
,
pdev
))
!=
NULL
)
{
PCI_DEVICE_ID_SUN_HAPPYMEAL
,
pdev
))
!=
NULL
)
{
if
(
pci_enable_device
(
pdev
))
if
(
pci_enable_device
(
pdev
))
continue
;
continue
;
pci_set_master
(
pdev
);
cards
++
;
cards
++
;
happy_meal_pci_init
(
pdev
);
happy_meal_pci_init
(
pdev
);
}
}
...
@@ -3302,6 +3323,7 @@ static void __exit happy_meal_cleanup_module(void)
...
@@ -3302,6 +3323,7 @@ static void __exit happy_meal_cleanup_module(void)
hp
->
happy_block
,
hp
->
happy_block
,
hp
->
hblock_dvma
);
hp
->
hblock_dvma
);
iounmap
((
void
*
)
hp
->
gregs
);
iounmap
((
void
*
)
hp
->
gregs
);
pci_release_regions
(
hp
->
happy_dev
);
}
}
#endif
#endif
kfree
(
dev
);
kfree
(
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