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
94030996
Commit
94030996
authored
Dec 29, 2003
by
Ben Collins
Browse files
Options
Browse Files
Download
Plain Diff
Merge
http://linux.bkbits.net/linux-2.5
into debian.org:/usr/src/kernel/linux-2.6
parents
88891ed3
d911e854
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
470 additions
and
423 deletions
+470
-423
drivers/ieee1394/Kconfig
drivers/ieee1394/Kconfig
+10
-10
drivers/ieee1394/eth1394.c
drivers/ieee1394/eth1394.c
+8
-8
drivers/ieee1394/highlevel.c
drivers/ieee1394/highlevel.c
+24
-20
drivers/ieee1394/highlevel.h
drivers/ieee1394/highlevel.h
+3
-2
drivers/ieee1394/hosts.c
drivers/ieee1394/hosts.c
+21
-83
drivers/ieee1394/hosts.h
drivers/ieee1394/hosts.h
+3
-19
drivers/ieee1394/ieee1394_core.c
drivers/ieee1394/ieee1394_core.c
+63
-57
drivers/ieee1394/ieee1394_core.h
drivers/ieee1394/ieee1394_core.h
+12
-12
drivers/ieee1394/ieee1394_transactions.c
drivers/ieee1394/ieee1394_transactions.c
+29
-40
drivers/ieee1394/iso.c
drivers/ieee1394/iso.c
+12
-4
drivers/ieee1394/iso.h
drivers/ieee1394/iso.h
+11
-0
drivers/ieee1394/nodemgr.c
drivers/ieee1394/nodemgr.c
+46
-42
drivers/ieee1394/nodemgr.h
drivers/ieee1394/nodemgr.h
+9
-0
drivers/ieee1394/ohci1394.c
drivers/ieee1394/ohci1394.c
+31
-20
drivers/ieee1394/oui.db
drivers/ieee1394/oui.db
+3
-3
drivers/ieee1394/pcilynx.c
drivers/ieee1394/pcilynx.c
+17
-13
drivers/ieee1394/raw1394.c
drivers/ieee1394/raw1394.c
+116
-10
drivers/ieee1394/raw1394.h
drivers/ieee1394/raw1394.h
+5
-0
drivers/ieee1394/sbp2.c
drivers/ieee1394/sbp2.c
+47
-80
No files found.
drivers/ieee1394/Kconfig
View file @
94030996
# -*- shell-script -*-
# -*- shell-script -*-
menu "IEEE 1394 (FireWire) support (EXPERIMENTAL)"
menu "IEEE 1394 (FireWire) support (EXPERIMENTAL)"
depends on
PCI &&
EXPERIMENTAL
depends on EXPERIMENTAL
config IEEE1394
config IEEE1394
tristate "IEEE 1394 (FireWire) support (EXPERIMENTAL)"
tristate "IEEE 1394 (FireWire) support (EXPERIMENTAL)"
...
@@ -15,7 +15,7 @@ config IEEE1394
...
@@ -15,7 +15,7 @@ config IEEE1394
is the core support only, you will also need to select a driver for
is the core support only, you will also need to select a driver for
your IEEE 1394 adapter.
your IEEE 1394 adapter.
To compile this driver as a module,
choose
M here: the
To compile this driver as a module,
say
M here: the
module will be called ieee1394.
module will be called ieee1394.
comment "Subsystem Options"
comment "Subsystem Options"
...
@@ -56,13 +56,13 @@ comment "Texas Instruments PCILynx requires I2C bit-banging"
...
@@ -56,13 +56,13 @@ comment "Texas Instruments PCILynx requires I2C bit-banging"
config IEEE1394_PCILYNX
config IEEE1394_PCILYNX
tristate "Texas Instruments PCILynx support"
tristate "Texas Instruments PCILynx support"
depends on IEEE1394 && I2C_ALGOBIT
depends on
PCI &&
IEEE1394 && I2C_ALGOBIT
help
help
Say Y here if you have an IEEE-1394 controller with the Texas
Say Y here if you have an IEEE-1394 controller with the Texas
Instruments PCILynx chip. Note: this driver is written for revision
Instruments PCILynx chip. Note: this driver is written for revision
2 of this chip and may not work with revision 0.
2 of this chip and may not work with revision 0.
To compile this driver as a module,
choose
M here: the
To compile this driver as a module,
say
M here: the
module will be called pcilynx.
module will be called pcilynx.
# Non-maintained pcilynx options
# Non-maintained pcilynx options
...
@@ -72,7 +72,7 @@ config IEEE1394_PCILYNX
...
@@ -72,7 +72,7 @@ config IEEE1394_PCILYNX
# fi
# fi
config IEEE1394_OHCI1394
config IEEE1394_OHCI1394
tristate "OHCI-1394 support"
tristate "OHCI-1394 support"
depends on IEEE1394
depends on
PCI &&
IEEE1394
help
help
Enable this driver if you have an IEEE 1394 controller based on the
Enable this driver if you have an IEEE 1394 controller based on the
OHCI-1394 specification. The current driver is only tested with OHCI
OHCI-1394 specification. The current driver is only tested with OHCI
...
@@ -80,7 +80,7 @@ config IEEE1394_OHCI1394
...
@@ -80,7 +80,7 @@ config IEEE1394_OHCI1394
use one of these chipsets. It should work with any OHCI-1394
use one of these chipsets. It should work with any OHCI-1394
compliant card, however.
compliant card, however.
To compile this driver as a module,
choose
M here: the
To compile this driver as a module,
say
M here: the
module will be called ohci1394.
module will be called ohci1394.
comment "Protocol Drivers"
comment "Protocol Drivers"
...
@@ -122,7 +122,7 @@ config IEEE1394_DV1394
...
@@ -122,7 +122,7 @@ config IEEE1394_DV1394
The user-space API for dv1394 is documented in dv1394.h.
The user-space API for dv1394 is documented in dv1394.h.
To compile this driver as a module,
choose
M here: the
To compile this driver as a module,
say
M here: the
module will be called dv1394.
module will be called dv1394.
config IEEE1394_RAWIO
config IEEE1394_RAWIO
...
@@ -134,7 +134,7 @@ config IEEE1394_RAWIO
...
@@ -134,7 +134,7 @@ config IEEE1394_RAWIO
direct communication of user programs with the IEEE 1394 bus and
direct communication of user programs with the IEEE 1394 bus and
thus with the attached peripherals.
thus with the attached peripherals.
To compile this driver as a module,
choose
M here: the
To compile this driver as a module,
say
M here: the
module will be called raw1394.
module will be called raw1394.
config IEEE1394_CMP
config IEEE1394_CMP
...
@@ -144,7 +144,7 @@ config IEEE1394_CMP
...
@@ -144,7 +144,7 @@ config IEEE1394_CMP
This option enables the Connection Management Procedures
This option enables the Connection Management Procedures
(IEC61883-1) driver, which implements input and output plugs.
(IEC61883-1) driver, which implements input and output plugs.
To compile this driver as a module,
choose
M here: the
To compile this driver as a module,
say
M here: the
module will be called cmp.
module will be called cmp.
config IEEE1394_AMDTP
config IEEE1394_AMDTP
...
@@ -157,7 +157,7 @@ config IEEE1394_AMDTP
...
@@ -157,7 +157,7 @@ config IEEE1394_AMDTP
The userspace interface is documented in amdtp.h.
The userspace interface is documented in amdtp.h.
To compile this driver as a module,
choose
M here: the
To compile this driver as a module,
say
M here: the
module will be called amdtp.
module will be called amdtp.
endmenu
endmenu
drivers/ieee1394/eth1394.c
View file @
94030996
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
static
char
version
[]
__devinitdata
=
static
char
version
[]
__devinitdata
=
"$Rev: 10
43
$ Ben Collins <bcollins@debian.org>"
;
"$Rev: 10
79
$ Ben Collins <bcollins@debian.org>"
;
struct
fragment_info
{
struct
fragment_info
{
struct
list_head
list
;
struct
list_head
list
;
...
@@ -220,7 +220,7 @@ static int ether1394_init_bc(struct net_device *dev)
...
@@ -220,7 +220,7 @@ static int ether1394_init_bc(struct net_device *dev)
priv
->
iso
=
hpsb_iso_recv_init
(
priv
->
host
,
16
*
4096
,
priv
->
iso
=
hpsb_iso_recv_init
(
priv
->
host
,
16
*
4096
,
16
,
priv
->
broadcast_channel
,
16
,
priv
->
broadcast_channel
,
1
,
ether1394_iso
);
HPSB_ISO_DMA_PACKET_PER_BUFFER
,
1
,
ether1394_iso
);
if
(
priv
->
iso
==
NULL
)
{
if
(
priv
->
iso
==
NULL
)
{
ETH1394_PRINT
(
KERN_ERR
,
dev
->
name
,
ETH1394_PRINT
(
KERN_ERR
,
dev
->
name
,
"failed to change broadcast "
"failed to change broadcast "
...
@@ -475,7 +475,7 @@ static void ether1394_add_host (struct hpsb_host *host)
...
@@ -475,7 +475,7 @@ static void ether1394_add_host (struct hpsb_host *host)
priv
->
broadcast_channel
=
host
->
csr
.
broadcast_channel
&
0x3f
;
priv
->
broadcast_channel
=
host
->
csr
.
broadcast_channel
&
0x3f
;
priv
->
iso
=
hpsb_iso_recv_init
(
host
,
16
*
4096
,
16
,
priv
->
broadcast_channel
,
priv
->
iso
=
hpsb_iso_recv_init
(
host
,
16
*
4096
,
16
,
priv
->
broadcast_channel
,
1
,
ether1394_iso
);
HPSB_ISO_DMA_PACKET_PER_BUFFER
,
1
,
ether1394_iso
);
if
(
priv
->
iso
==
NULL
)
{
if
(
priv
->
iso
==
NULL
)
{
priv
->
bc_state
=
ETHER1394_BC_CLOSED
;
priv
->
bc_state
=
ETHER1394_BC_CLOSED
;
}
}
...
@@ -1258,7 +1258,7 @@ static inline struct hpsb_packet *ether1394_alloc_common_packet(struct hpsb_host
...
@@ -1258,7 +1258,7 @@ static inline struct hpsb_packet *ether1394_alloc_common_packet(struct hpsb_host
{
{
struct
hpsb_packet
*
p
;
struct
hpsb_packet
*
p
;
p
=
alloc_hpsb
_packet
(
0
);
p
=
hpsb_alloc
_packet
(
0
);
if
(
p
)
{
if
(
p
)
{
p
->
host
=
host
;
p
->
host
=
host
;
p
->
data
=
NULL
;
p
->
data
=
NULL
;
...
@@ -1327,7 +1327,7 @@ static inline void ether1394_free_packet(struct hpsb_packet *packet)
...
@@ -1327,7 +1327,7 @@ static inline void ether1394_free_packet(struct hpsb_packet *packet)
if
(
packet
->
tcode
!=
TCODE_STREAM_DATA
)
if
(
packet
->
tcode
!=
TCODE_STREAM_DATA
)
hpsb_free_tlabel
(
packet
);
hpsb_free_tlabel
(
packet
);
packet
->
data
=
NULL
;
packet
->
data
=
NULL
;
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
}
}
static
void
ether1394_complete_cb
(
void
*
__ptask
);
static
void
ether1394_complete_cb
(
void
*
__ptask
);
...
@@ -1349,7 +1349,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
...
@@ -1349,7 +1349,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
ptask
->
dest_node
,
ptask
->
dest_node
,
ptask
->
addr
,
ptask
->
skb
->
data
,
ptask
->
addr
,
ptask
->
skb
->
data
,
tx_len
))
{
tx_len
))
{
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1357,7 +1357,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
...
@@ -1357,7 +1357,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
hpsb_set_packet_complete_task
(
ptask
->
packet
,
ether1394_complete_cb
,
hpsb_set_packet_complete_task
(
ptask
->
packet
,
ether1394_complete_cb
,
ptask
);
ptask
);
if
(
!
hpsb_send_packet
(
packet
)
)
{
if
(
hpsb_send_packet
(
packet
)
<
0
)
{
ether1394_free_packet
(
packet
);
ether1394_free_packet
(
packet
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1599,7 +1599,7 @@ static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr)
...
@@ -1599,7 +1599,7 @@ static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr)
case
ETHTOOL_GDRVINFO
:
{
case
ETHTOOL_GDRVINFO
:
{
struct
ethtool_drvinfo
info
=
{
ETHTOOL_GDRVINFO
};
struct
ethtool_drvinfo
info
=
{
ETHTOOL_GDRVINFO
};
strcpy
(
info
.
driver
,
driver_name
);
strcpy
(
info
.
driver
,
driver_name
);
strcpy
(
info
.
version
,
"$Rev: 10
43
$"
);
strcpy
(
info
.
version
,
"$Rev: 10
79
$"
);
/* FIXME XXX provide sane businfo */
/* FIXME XXX provide sane businfo */
strcpy
(
info
.
bus_info
,
"ieee1394"
);
strcpy
(
info
.
bus_info
,
"ieee1394"
);
if
(
copy_to_user
(
useraddr
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
useraddr
,
&
info
,
sizeof
(
info
)))
...
...
drivers/ieee1394/highlevel.c
View file @
94030996
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "hosts.h"
#include "hosts.h"
#include "ieee1394_core.h"
#include "ieee1394_core.h"
#include "highlevel.h"
#include "highlevel.h"
#include "nodemgr.h"
struct
hl_host_info
{
struct
hl_host_info
{
...
@@ -227,10 +228,17 @@ struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long k
...
@@ -227,10 +228,17 @@ struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long k
return
host
;
return
host
;
}
}
static
int
highlevel_for_each_host_reg
(
struct
hpsb_host
*
host
,
void
*
__data
)
{
struct
hpsb_highlevel
*
hl
=
__data
;
hl
->
add_host
(
host
);
return
0
;
}
void
hpsb_register_highlevel
(
struct
hpsb_highlevel
*
hl
)
void
hpsb_register_highlevel
(
struct
hpsb_highlevel
*
hl
)
{
{
struct
list_head
*
lh
;
unsigned
long
flags
;
unsigned
long
flags
;
INIT_LIST_HEAD
(
&
hl
->
addr_list
);
INIT_LIST_HEAD
(
&
hl
->
addr_list
);
...
@@ -242,21 +250,25 @@ void hpsb_register_highlevel(struct hpsb_highlevel *hl)
...
@@ -242,21 +250,25 @@ void hpsb_register_highlevel(struct hpsb_highlevel *hl)
list_add_tail
(
&
hl
->
hl_list
,
&
hl_drivers
);
list_add_tail
(
&
hl
->
hl_list
,
&
hl_drivers
);
write_unlock_irqrestore
(
&
hl_drivers_lock
,
flags
);
write_unlock_irqrestore
(
&
hl_drivers_lock
,
flags
);
if
(
hl
->
add_host
)
{
if
(
hl
->
add_host
)
down
(
&
hpsb_hosts_lock
);
nodemgr_for_each_host
(
hl
,
highlevel_for_each_host_reg
);
list_for_each
(
lh
,
&
hpsb_hosts
)
{
struct
hpsb_host
*
host
=
list_entry
(
lh
,
struct
hpsb_host
,
host_list
);
hl
->
add_host
(
host
);
}
up
(
&
hpsb_hosts_lock
);
}
return
;
return
;
}
}
static
int
highlevel_for_each_host_unreg
(
struct
hpsb_host
*
host
,
void
*
__data
)
{
struct
hpsb_highlevel
*
hl
=
__data
;
hl
->
remove_host
(
host
);
hpsb_destroy_hostinfo
(
hl
,
host
);
return
0
;
}
void
hpsb_unregister_highlevel
(
struct
hpsb_highlevel
*
hl
)
void
hpsb_unregister_highlevel
(
struct
hpsb_highlevel
*
hl
)
{
{
struct
list_head
*
lh
,
*
next
;
struct
list_head
*
lh
,
*
next
;
struct
hpsb_address_serve
*
as
;
struct
hpsb_address_serve
*
as
;
unsigned
long
flags
;
unsigned
long
flags
;
...
@@ -272,16 +284,8 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl)
...
@@ -272,16 +284,8 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl)
list_del
(
&
hl
->
hl_list
);
list_del
(
&
hl
->
hl_list
);
write_unlock_irqrestore
(
&
hl_drivers_lock
,
flags
);
write_unlock_irqrestore
(
&
hl_drivers_lock
,
flags
);
if
(
hl
->
remove_host
)
{
if
(
hl
->
remove_host
)
down
(
&
hpsb_hosts_lock
);
nodemgr_for_each_host
(
hl
,
highlevel_for_each_host_unreg
);
list_for_each
(
lh
,
&
hpsb_hosts
)
{
struct
hpsb_host
*
host
=
list_entry
(
lh
,
struct
hpsb_host
,
host_list
);
hl
->
remove_host
(
host
);
hpsb_destroy_hostinfo
(
hl
,
host
);
}
up
(
&
hpsb_hosts_lock
);
}
}
}
int
hpsb_register_addrspace
(
struct
hpsb_highlevel
*
hl
,
int
hpsb_register_addrspace
(
struct
hpsb_highlevel
*
hl
,
...
...
drivers/ieee1394/highlevel.h
View file @
94030996
...
@@ -92,8 +92,6 @@ struct hpsb_address_ops {
...
@@ -92,8 +92,6 @@ struct hpsb_address_ops {
};
};
void
init_hpsb_highlevel
(
void
);
void
highlevel_add_host
(
struct
hpsb_host
*
host
);
void
highlevel_add_host
(
struct
hpsb_host
*
host
);
void
highlevel_remove_host
(
struct
hpsb_host
*
host
);
void
highlevel_remove_host
(
struct
hpsb_host
*
host
);
void
highlevel_host_reset
(
struct
hpsb_host
*
host
);
void
highlevel_host_reset
(
struct
hpsb_host
*
host
);
...
@@ -180,4 +178,7 @@ int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, void *d
...
@@ -180,4 +178,7 @@ int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, void *d
/* Retrieve hpsb_host using a highlevel handle and a key */
/* Retrieve hpsb_host using a highlevel handle and a key */
struct
hpsb_host
*
hpsb_get_host_bykey
(
struct
hpsb_highlevel
*
hl
,
unsigned
long
key
);
struct
hpsb_host
*
hpsb_get_host_bykey
(
struct
hpsb_highlevel
*
hl
,
unsigned
long
key
);
/* Initialize the highlevel system */
void
init_hpsb_highlevel
(
void
);
#endif
/* IEEE1394_HIGHLEVEL_H */
#endif
/* IEEE1394_HIGHLEVEL_H */
drivers/ieee1394/hosts.c
View file @
94030996
...
@@ -16,14 +16,14 @@
...
@@ -16,14 +16,14 @@
#include <linux/list.h>
#include <linux/list.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include "ieee1394_types.h"
#include "ieee1394_types.h"
#include "hosts.h"
#include "hosts.h"
#include "ieee1394_core.h"
#include "ieee1394_core.h"
#include "highlevel.h"
#include "highlevel.h"
#include "nodemgr.h"
LIST_HEAD
(
hpsb_hosts
);
DECLARE_MUTEX
(
hpsb_hosts_lock
);
static
int
dummy_transmit_packet
(
struct
hpsb_host
*
h
,
struct
hpsb_packet
*
p
)
static
int
dummy_transmit_packet
(
struct
hpsb_host
*
h
,
struct
hpsb_packet
*
p
)
{
{
...
@@ -46,54 +46,14 @@ static struct hpsb_host_driver dummy_driver = {
...
@@ -46,54 +46,14 @@ static struct hpsb_host_driver dummy_driver = {
.
isoctl
=
dummy_isoctl
.
isoctl
=
dummy_isoctl
};
};
/**
static
int
alloc_hostnum_cb
(
struct
hpsb_host
*
host
,
void
*
__data
)
* hpsb_ref_host - increase reference count for host controller.
* @host: the host controller
*
* Increase the reference count for the specified host controller.
* When holding a reference to a host, the memory allocated for the
* host struct will not be freed and the host is guaranteed to be in a
* consistent state. The driver may be unloaded or the controller may
* be removed (PCMCIA), but the host struct will remain valid.
*/
int
hpsb_ref_host
(
struct
hpsb_host
*
host
)
{
{
struct
list_head
*
lh
;
int
*
hostnum
=
__data
;
int
retval
=
0
;
down
(
&
hpsb_hosts_lock
);
list_for_each
(
lh
,
&
hpsb_hosts
)
{
if
(
host
==
list_entry
(
lh
,
struct
hpsb_host
,
host_list
))
{
if
(
try_module_get
(
host
->
driver
->
owner
))
{
atomic_inc
(
&
host
->
refcount
);
retval
=
1
;
}
break
;
}
}
up
(
&
hpsb_hosts_lock
);
return
retval
;
if
(
host
->
id
==
*
hostnum
)
}
return
1
;
/**
return
0
;
* hpsb_unref_host - decrease reference count for host controller.
* @host: the host controller
*
* Decrease the reference count for the specified host controller.
* When the reference count reaches zero, the memory allocated for the
* &hpsb_host will be freed.
*/
void
hpsb_unref_host
(
struct
hpsb_host
*
host
)
{
module_put
(
host
->
driver
->
owner
);
down
(
&
hpsb_hosts_lock
);
if
(
atomic_dec_and_test
(
&
host
->
refcount
)
&&
host
->
is_shutdown
)
device_unregister
(
&
host
->
device
);
up
(
&
hpsb_hosts_lock
);
}
}
/**
/**
...
@@ -108,19 +68,16 @@ void hpsb_unref_host(struct hpsb_host *host)
...
@@ -108,19 +68,16 @@ void hpsb_unref_host(struct hpsb_host *host)
* driver specific parts, enable the controller and make it available
* driver specific parts, enable the controller and make it available
* to the general subsystem using hpsb_add_host().
* to the general subsystem using hpsb_add_host().
*
*
* The &hpsb_host is allocated with an single initial reference
* belonging to the driver. Once the driver is done with the struct,
* for example, when the driver is unloaded, it should release this
* reference using hpsb_unref_host().
*
* Return Value: a pointer to the &hpsb_host if succesful, %NULL if
* Return Value: a pointer to the &hpsb_host if succesful, %NULL if
* no memory was available.
* no memory was available.
*/
*/
struct
hpsb_host
*
hpsb_alloc_host
(
struct
hpsb_host_driver
*
drv
,
size_t
extra
)
struct
hpsb_host
*
hpsb_alloc_host
(
struct
hpsb_host_driver
*
drv
,
size_t
extra
,
struct
device
*
dev
)
{
{
struct
hpsb_host
*
h
;
struct
hpsb_host
*
h
;
int
i
;
int
i
;
int
hostnum
=
0
;
h
=
kmalloc
(
sizeof
(
struct
hpsb_host
)
+
extra
,
SLAB_KERNEL
);
h
=
kmalloc
(
sizeof
(
struct
hpsb_host
)
+
extra
,
SLAB_KERNEL
);
if
(
!
h
)
return
NULL
;
if
(
!
h
)
return
NULL
;
...
@@ -128,7 +85,6 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra)
...
@@ -128,7 +85,6 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra)
h
->
hostdata
=
h
+
1
;
h
->
hostdata
=
h
+
1
;
h
->
driver
=
drv
;
h
->
driver
=
drv
;
atomic_set
(
&
h
->
refcount
,
1
);
INIT_LIST_HEAD
(
&
h
->
pending_packets
);
INIT_LIST_HEAD
(
&
h
->
pending_packets
);
spin_lock_init
(
&
h
->
pending_pkt_lock
);
spin_lock_init
(
&
h
->
pending_pkt_lock
);
...
@@ -146,53 +102,35 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra)
...
@@ -146,53 +102,35 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra)
h
->
topology_map
=
h
->
csr
.
topology_map
+
3
;
h
->
topology_map
=
h
->
csr
.
topology_map
+
3
;
h
->
speed_map
=
(
u8
*
)(
h
->
csr
.
speed_map
+
2
);
h
->
speed_map
=
(
u8
*
)(
h
->
csr
.
speed_map
+
2
);
return
h
;
}
static
int
alloc_hostnum
(
void
)
{
int
hostnum
=
0
;
while
(
1
)
{
while
(
1
)
{
struct
list_head
*
lh
;
if
(
!
nodemgr_for_each_host
(
&
hostnum
,
alloc_hostnum_cb
))
{
int
found
=
0
;
h
->
id
=
hostnum
;
break
;
list_for_each
(
lh
,
&
hpsb_hosts
)
{
struct
hpsb_host
*
host
=
list_entry
(
lh
,
struct
hpsb_host
,
host_list
);
if
(
host
->
id
==
hostnum
)
{
found
=
1
;
break
;
}
}
}
if
(
!
found
)
return
hostnum
;
hostnum
++
;
hostnum
++
;
}
}
return
0
;
memcpy
(
&
h
->
device
,
&
nodemgr_dev_template_host
,
sizeof
(
h
->
device
));
h
->
device
.
parent
=
dev
;
snprintf
(
h
->
device
.
bus_id
,
BUS_ID_SIZE
,
"fw-host%d"
,
h
->
id
);
device_register
(
&
h
->
device
);
return
h
;
}
}
void
hpsb_add_host
(
struct
hpsb_host
*
host
)
void
hpsb_add_host
(
struct
hpsb_host
*
host
)
{
{
down
(
&
hpsb_hosts_lock
);
host
->
id
=
alloc_hostnum
();
list_add_tail
(
&
host
->
host_list
,
&
hpsb_hosts
);
up
(
&
hpsb_hosts_lock
);
highlevel_add_host
(
host
);
highlevel_add_host
(
host
);
host
->
driver
->
devctl
(
host
,
RESET_BUS
,
LONG_RESET
);
host
->
driver
->
devctl
(
host
,
RESET_BUS
,
LONG_RESET
);
}
}
void
hpsb_remove_host
(
struct
hpsb_host
*
host
)
void
hpsb_remove_host
(
struct
hpsb_host
*
host
)
{
{
down
(
&
hpsb_hosts_lock
);
host
->
is_shutdown
=
1
;
host
->
is_shutdown
=
1
;
host
->
driver
=
&
dummy_driver
;
host
->
driver
=
&
dummy_driver
;
list_del
(
&
host
->
host_list
);
up
(
&
hpsb_hosts_lock
);
highlevel_remove_host
(
host
);
highlevel_remove_host
(
host
);
device_unregister
(
&
host
->
device
);
}
}
drivers/ieee1394/hosts.h
View file @
94030996
...
@@ -29,8 +29,6 @@ struct hpsb_host {
...
@@ -29,8 +29,6 @@ struct hpsb_host {
atomic_t
generation
;
atomic_t
generation
;
atomic_t
refcount
;
struct
list_head
pending_packets
;
struct
list_head
pending_packets
;
spinlock_t
pending_pkt_lock
;
spinlock_t
pending_pkt_lock
;
struct
timer_list
timeout
;
struct
timer_list
timeout
;
...
@@ -165,7 +163,7 @@ struct hpsb_host_driver {
...
@@ -165,7 +163,7 @@ struct hpsb_host_driver {
* packet->type == raw) and do byte-swapping as necessary or instruct
* packet->type == raw) and do byte-swapping as necessary or instruct
* the hardware to do so. It can return immediately after the packet
* the hardware to do so. It can return immediately after the packet
* was queued for sending. After sending, hpsb_sent_packet() has to be
* was queued for sending. After sending, hpsb_sent_packet() has to be
* called. Return 0
for
failure.
* called. Return 0
on success, negative errno on
failure.
* NOTE: The function must be callable in interrupt context.
* NOTE: The function must be callable in interrupt context.
*/
*/
int
(
*
transmit_packet
)
(
struct
hpsb_host
*
host
,
int
(
*
transmit_packet
)
(
struct
hpsb_host
*
host
,
...
@@ -195,22 +193,8 @@ struct hpsb_host_driver {
...
@@ -195,22 +193,8 @@ struct hpsb_host_driver {
};
};
extern
struct
list_head
hpsb_hosts
;
struct
hpsb_host
*
hpsb_alloc_host
(
struct
hpsb_host_driver
*
drv
,
size_t
extra
,
extern
struct
semaphore
hpsb_hosts_lock
;
struct
device
*
dev
);
/*
* In order to prevent hosts from unloading, use hpsb_ref_host(). This prevents
* the host from going away (e.g. makes module unloading of the driver
* impossible), but still can not guarantee it (e.g. PC-Card being pulled by the
* user). hpsb_ref_host() returns false if host could not be locked. If it is
* successful, host is valid as a pointer until hpsb_unref_host() (not just
* until after remove_host).
*/
int
hpsb_ref_host
(
struct
hpsb_host
*
host
);
void
hpsb_unref_host
(
struct
hpsb_host
*
host
);
struct
hpsb_host
*
hpsb_alloc_host
(
struct
hpsb_host_driver
*
drv
,
size_t
extra
);
void
hpsb_add_host
(
struct
hpsb_host
*
host
);
void
hpsb_add_host
(
struct
hpsb_host
*
host
);
void
hpsb_remove_host
(
struct
hpsb_host
*
h
);
void
hpsb_remove_host
(
struct
hpsb_host
*
h
);
...
...
drivers/ieee1394/ieee1394_core.c
View file @
94030996
This diff is collapsed.
Click to expand it.
drivers/ieee1394/ieee1394_core.h
View file @
94030996
...
@@ -40,11 +40,6 @@ struct hpsb_packet {
...
@@ -40,11 +40,6 @@ struct hpsb_packet {
unsigned
expect_response
:
1
;
unsigned
expect_response
:
1
;
unsigned
no_waiter
:
1
;
unsigned
no_waiter
:
1
;
/* Data big endianness flag - may vary from request to request. The
* header is always in machine byte order.
* Not really used currently. */
unsigned
data_be
:
1
;
/* Speed to transmit with: 0 = 100Mbps, 1 = 200Mbps, 2 = 400Mbps */
/* Speed to transmit with: 0 = 100Mbps, 1 = 200Mbps, 2 = 400Mbps */
unsigned
speed_code
:
2
;
unsigned
speed_code
:
2
;
...
@@ -64,9 +59,6 @@ struct hpsb_packet {
...
@@ -64,9 +59,6 @@ struct hpsb_packet {
struct
hpsb_host
*
host
;
struct
hpsb_host
*
host
;
unsigned
int
generation
;
unsigned
int
generation
;
/* Very core internal, don't care. */
struct
semaphore
state_change
;
/* Function (and possible data to pass to it) to call when this
/* Function (and possible data to pass to it) to call when this
* packet is completed. */
* packet is completed. */
void
(
*
complete_routine
)(
void
*
);
void
(
*
complete_routine
)(
void
*
);
...
@@ -90,8 +82,8 @@ static inline struct hpsb_packet *driver_packet(struct list_head *l)
...
@@ -90,8 +82,8 @@ static inline struct hpsb_packet *driver_packet(struct list_head *l)
void
abort_timedouts
(
unsigned
long
__opaque
);
void
abort_timedouts
(
unsigned
long
__opaque
);
void
abort_requests
(
struct
hpsb_host
*
host
);
void
abort_requests
(
struct
hpsb_host
*
host
);
struct
hpsb_packet
*
alloc_hpsb
_packet
(
size_t
data_size
);
struct
hpsb_packet
*
hpsb_alloc
_packet
(
size_t
data_size
);
void
free_hpsb
_packet
(
struct
hpsb_packet
*
packet
);
void
hpsb_free
_packet
(
struct
hpsb_packet
*
packet
);
/*
/*
...
@@ -108,15 +100,23 @@ static inline unsigned int get_hpsb_generation(struct hpsb_host *host)
...
@@ -108,15 +100,23 @@ static inline unsigned int get_hpsb_generation(struct hpsb_host *host)
}
}
/*
/*
* Send a PHY configuration packet.
* Send a PHY configuration packet, return 0 on success, negative
* errno on failure.
*/
*/
int
hpsb_send_phy_config
(
struct
hpsb_host
*
host
,
int
rootid
,
int
gapcnt
);
int
hpsb_send_phy_config
(
struct
hpsb_host
*
host
,
int
rootid
,
int
gapcnt
);
/*
/*
* Queue packet for transmitting, return 0 for failure.
* Queue packet for transmitting, return 0 on success, negative errno
* on failure.
*/
*/
int
hpsb_send_packet
(
struct
hpsb_packet
*
packet
);
int
hpsb_send_packet
(
struct
hpsb_packet
*
packet
);
/*
* Queue packet for transmitting, and block until the transaction
* completes. Return 0 on success, negative errno on failure.
*/
int
hpsb_send_packet_and_wait
(
struct
hpsb_packet
*
packet
);
/* Initiate bus reset on the given host. Returns 1 if bus reset already in
/* Initiate bus reset on the given host. Returns 1 if bus reset already in
* progress, 0 otherwise. */
* progress, 0 otherwise. */
int
hpsb_reset_bus
(
struct
hpsb_host
*
host
,
int
type
);
int
hpsb_reset_bus
(
struct
hpsb_host
*
host
,
int
type
);
...
...
drivers/ieee1394/ieee1394_transactions.c
View file @
94030996
...
@@ -263,7 +263,7 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
...
@@ -263,7 +263,7 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
if
(
length
==
0
)
if
(
length
==
0
)
return
NULL
;
return
NULL
;
packet
=
alloc_hpsb
_packet
(
length
+
(
length
%
4
?
4
-
(
length
%
4
)
:
0
));
packet
=
hpsb_alloc
_packet
(
length
+
(
length
%
4
?
4
-
(
length
%
4
)
:
0
));
if
(
!
packet
)
if
(
!
packet
)
return
NULL
;
return
NULL
;
...
@@ -271,7 +271,7 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
...
@@ -271,7 +271,7 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
packet
->
node_id
=
node
;
packet
->
node_id
=
node
;
if
(
hpsb_get_tlabel
(
packet
))
{
if
(
hpsb_get_tlabel
(
packet
))
{
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
NULL
;
return
NULL
;
}
}
...
@@ -291,7 +291,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
...
@@ -291,7 +291,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
if
(
length
==
0
)
if
(
length
==
0
)
return
NULL
;
return
NULL
;
packet
=
alloc_hpsb
_packet
(
length
+
(
length
%
4
?
4
-
(
length
%
4
)
:
0
));
packet
=
hpsb_alloc
_packet
(
length
+
(
length
%
4
?
4
-
(
length
%
4
)
:
0
));
if
(
!
packet
)
if
(
!
packet
)
return
NULL
;
return
NULL
;
...
@@ -302,7 +302,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
...
@@ -302,7 +302,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
packet
->
node_id
=
node
;
packet
->
node_id
=
node
;
if
(
hpsb_get_tlabel
(
packet
))
{
if
(
hpsb_get_tlabel
(
packet
))
{
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
NULL
;
return
NULL
;
}
}
...
@@ -325,7 +325,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
...
@@ -325,7 +325,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
if
(
length
==
0
)
if
(
length
==
0
)
return
NULL
;
return
NULL
;
packet
=
alloc_hpsb
_packet
(
length
+
(
length
%
4
?
4
-
(
length
%
4
)
:
0
));
packet
=
hpsb_alloc
_packet
(
length
+
(
length
%
4
?
4
-
(
length
%
4
)
:
0
));
if
(
!
packet
)
if
(
!
packet
)
return
NULL
;
return
NULL
;
...
@@ -335,7 +335,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
...
@@ -335,7 +335,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
packet
->
host
=
host
;
packet
->
host
=
host
;
if
(
hpsb_get_tlabel
(
packet
))
{
if
(
hpsb_get_tlabel
(
packet
))
{
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
NULL
;
return
NULL
;
}
}
...
@@ -353,13 +353,13 @@ struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
...
@@ -353,13 +353,13 @@ struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
struct
hpsb_packet
*
p
;
struct
hpsb_packet
*
p
;
u32
length
;
u32
length
;
p
=
alloc_hpsb
_packet
(
8
);
p
=
hpsb_alloc
_packet
(
8
);
if
(
!
p
)
return
NULL
;
if
(
!
p
)
return
NULL
;
p
->
host
=
host
;
p
->
host
=
host
;
p
->
node_id
=
node
;
p
->
node_id
=
node
;
if
(
hpsb_get_tlabel
(
p
))
{
if
(
hpsb_get_tlabel
(
p
))
{
free_hpsb
_packet
(
p
);
hpsb_free
_packet
(
p
);
return
NULL
;
return
NULL
;
}
}
...
@@ -390,13 +390,13 @@ struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node
...
@@ -390,13 +390,13 @@ struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node
struct
hpsb_packet
*
p
;
struct
hpsb_packet
*
p
;
u32
length
;
u32
length
;
p
=
alloc_hpsb
_packet
(
16
);
p
=
hpsb_alloc
_packet
(
16
);
if
(
!
p
)
return
NULL
;
if
(
!
p
)
return
NULL
;
p
->
host
=
host
;
p
->
host
=
host
;
p
->
node_id
=
node
;
p
->
node_id
=
node
;
if
(
hpsb_get_tlabel
(
p
))
{
if
(
hpsb_get_tlabel
(
p
))
{
free_hpsb
_packet
(
p
);
hpsb_free
_packet
(
p
);
return
NULL
;
return
NULL
;
}
}
...
@@ -429,7 +429,7 @@ struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host,
...
@@ -429,7 +429,7 @@ struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host,
{
{
struct
hpsb_packet
*
p
;
struct
hpsb_packet
*
p
;
p
=
alloc_hpsb
_packet
(
0
);
p
=
hpsb_alloc
_packet
(
0
);
if
(
!
p
)
return
NULL
;
if
(
!
p
)
return
NULL
;
p
->
host
=
host
;
p
->
host
=
host
;
...
@@ -444,7 +444,7 @@ struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host,
...
@@ -444,7 +444,7 @@ struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host,
{
{
struct
hpsb_packet
*
p
;
struct
hpsb_packet
*
p
;
p
=
alloc_hpsb
_packet
(
length
);
p
=
hpsb_alloc
_packet
(
length
);
if
(
!
p
)
return
NULL
;
if
(
!
p
)
return
NULL
;
p
->
host
=
host
;
p
->
host
=
host
;
...
@@ -478,13 +478,10 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
...
@@ -478,13 +478,10 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
}
}
packet
->
generation
=
generation
;
packet
->
generation
=
generation
;
if
(
!
hpsb_send_packet
(
packet
))
{
retval
=
hpsb_send_packet_and_wait
(
packet
);
retval
=
-
EINVAL
;
if
(
retval
<
0
)
goto
hpsb_read_fail
;
goto
hpsb_read_fail
;
}
down
(
&
packet
->
state_change
);
down
(
&
packet
->
state_change
);
retval
=
hpsb_packet_success
(
packet
);
retval
=
hpsb_packet_success
(
packet
);
if
(
retval
==
0
)
{
if
(
retval
==
0
)
{
...
@@ -497,7 +494,7 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
...
@@ -497,7 +494,7 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
hpsb_read_fail:
hpsb_read_fail:
hpsb_free_tlabel
(
packet
);
hpsb_free_tlabel
(
packet
);
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
retval
;
return
retval
;
}
}
...
@@ -520,18 +517,15 @@ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
...
@@ -520,18 +517,15 @@ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
return
-
ENOMEM
;
return
-
ENOMEM
;
packet
->
generation
=
generation
;
packet
->
generation
=
generation
;
if
(
!
hpsb_send_packet
(
packet
))
{
retval
=
hpsb_send_packet_and_wait
(
packet
);
retval
=
-
EINVAL
;
if
(
retval
<
0
)
goto
hpsb_write_fail
;
goto
hpsb_write_fail
;
}
down
(
&
packet
->
state_change
);
down
(
&
packet
->
state_change
);
retval
=
hpsb_packet_success
(
packet
);
retval
=
hpsb_packet_success
(
packet
);
hpsb_write_fail:
hpsb_write_fail:
hpsb_free_tlabel
(
packet
);
hpsb_free_tlabel
(
packet
);
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
retval
;
return
retval
;
}
}
...
@@ -550,12 +544,10 @@ int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
...
@@ -550,12 +544,10 @@ int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
return
-
ENOMEM
;
return
-
ENOMEM
;
packet
->
generation
=
generation
;
packet
->
generation
=
generation
;
if
(
!
hpsb_send_packet
(
packet
))
{
retval
=
hpsb_send_packet_and_wait
(
packet
);
retval
=
-
EINVAL
;
if
(
retval
<
0
)
goto
hpsb_lock_fail
;
goto
hpsb_lock_fail
;
}
down
(
&
packet
->
state_change
);
down
(
&
packet
->
state_change
);
retval
=
hpsb_packet_success
(
packet
);
retval
=
hpsb_packet_success
(
packet
);
if
(
retval
==
0
)
{
if
(
retval
==
0
)
{
...
@@ -564,7 +556,7 @@ int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
...
@@ -564,7 +556,7 @@ int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
hpsb_lock_fail:
hpsb_lock_fail:
hpsb_free_tlabel
(
packet
);
hpsb_free_tlabel
(
packet
);
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
retval
;
return
retval
;
}
}
...
@@ -582,12 +574,10 @@ int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation,
...
@@ -582,12 +574,10 @@ int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation,
return
-
ENOMEM
;
return
-
ENOMEM
;
packet
->
generation
=
generation
;
packet
->
generation
=
generation
;
if
(
!
hpsb_send_packet
(
packet
))
{
retval
=
hpsb_send_packet_and_wait
(
packet
);
retval
=
-
EINVAL
;
if
(
retval
<
0
)
goto
hpsb_lock64_fail
;
goto
hpsb_lock64_fail
;
}
down
(
&
packet
->
state_change
);
down
(
&
packet
->
state_change
);
retval
=
hpsb_packet_success
(
packet
);
retval
=
hpsb_packet_success
(
packet
);
if
(
retval
==
0
)
if
(
retval
==
0
)
...
@@ -595,7 +585,7 @@ int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation,
...
@@ -595,7 +585,7 @@ int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation,
hpsb_lock64_fail:
hpsb_lock64_fail:
hpsb_free_tlabel
(
packet
);
hpsb_free_tlabel
(
packet
);
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
return
retval
;
return
retval
;
}
}
...
@@ -626,10 +616,9 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
...
@@ -626,10 +616,9 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
packet
->
no_waiter
=
1
;
packet
->
no_waiter
=
1
;
if
(
!
hpsb_send_packet
(
packet
))
{
retval
=
hpsb_send_packet
(
packet
);
free_hpsb_packet
(
packet
);
if
(
retval
<
0
)
retval
=
-
EINVAL
;
hpsb_free_packet
(
packet
);
}
return
retval
;
return
retval
;
}
}
drivers/ieee1394/iso.c
View file @
94030996
...
@@ -40,6 +40,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
...
@@ -40,6 +40,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
unsigned
int
data_buf_size
,
unsigned
int
data_buf_size
,
unsigned
int
buf_packets
,
unsigned
int
buf_packets
,
int
channel
,
int
channel
,
int
dma_mode
,
int
irq_interval
,
int
irq_interval
,
void
(
*
callback
)(
struct
hpsb_iso
*
))
void
(
*
callback
)(
struct
hpsb_iso
*
))
{
{
...
@@ -58,8 +59,13 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
...
@@ -58,8 +59,13 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
if
(
buf_packets
<
2
)
if
(
buf_packets
<
2
)
buf_packets
=
2
;
buf_packets
=
2
;
if
(
irq_interval
<
1
||
irq_interval
>
buf_packets
/
2
)
if
((
dma_mode
<
HPSB_ISO_DMA_DEFAULT
)
||
(
dma_mode
>
HPSB_ISO_DMA_PACKET_PER_BUFFER
))
irq_interval
=
buf_packets
/
2
;
dma_mode
=
HPSB_ISO_DMA_DEFAULT
;
if
(
irq_interval
==
0
)
/* really interrupt for each packet*/
irq_interval
=
1
;
else
if
((
irq_interval
<
0
)
||
(
irq_interval
>
buf_packets
/
4
))
irq_interval
=
buf_packets
/
4
;
if
(
channel
<
-
1
||
channel
>=
64
)
if
(
channel
<
-
1
||
channel
>=
64
)
return
NULL
;
return
NULL
;
...
@@ -83,6 +89,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
...
@@ -83,6 +89,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
init_waitqueue_head
(
&
iso
->
waitq
);
init_waitqueue_head
(
&
iso
->
waitq
);
iso
->
channel
=
channel
;
iso
->
channel
=
channel
;
iso
->
irq_interval
=
irq_interval
;
iso
->
irq_interval
=
irq_interval
;
iso
->
dma_mode
=
dma_mode
;
dma_region_init
(
&
iso
->
data_buf
);
dma_region_init
(
&
iso
->
data_buf
);
iso
->
buf_size
=
round_up_to_page
(
data_buf_size
);
iso
->
buf_size
=
round_up_to_page
(
data_buf_size
);
iso
->
buf_packets
=
buf_packets
;
iso
->
buf_packets
=
buf_packets
;
...
@@ -136,7 +143,7 @@ struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host,
...
@@ -136,7 +143,7 @@ struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host,
{
{
struct
hpsb_iso
*
iso
=
hpsb_iso_common_init
(
host
,
HPSB_ISO_XMIT
,
struct
hpsb_iso
*
iso
=
hpsb_iso_common_init
(
host
,
HPSB_ISO_XMIT
,
data_buf_size
,
buf_packets
,
data_buf_size
,
buf_packets
,
channel
,
irq_interval
,
callback
);
channel
,
HPSB_ISO_DMA_DEFAULT
,
irq_interval
,
callback
);
if
(
!
iso
)
if
(
!
iso
)
return
NULL
;
return
NULL
;
...
@@ -158,12 +165,13 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
...
@@ -158,12 +165,13 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
unsigned
int
data_buf_size
,
unsigned
int
data_buf_size
,
unsigned
int
buf_packets
,
unsigned
int
buf_packets
,
int
channel
,
int
channel
,
int
dma_mode
,
int
irq_interval
,
int
irq_interval
,
void
(
*
callback
)(
struct
hpsb_iso
*
))
void
(
*
callback
)(
struct
hpsb_iso
*
))
{
{
struct
hpsb_iso
*
iso
=
hpsb_iso_common_init
(
host
,
HPSB_ISO_RECV
,
struct
hpsb_iso
*
iso
=
hpsb_iso_common_init
(
host
,
HPSB_ISO_RECV
,
data_buf_size
,
buf_packets
,
data_buf_size
,
buf_packets
,
channel
,
irq_interval
,
callback
);
channel
,
dma_mode
,
irq_interval
,
callback
);
if
(
!
iso
)
if
(
!
iso
)
return
NULL
;
return
NULL
;
...
...
drivers/ieee1394/iso.h
View file @
94030996
...
@@ -51,6 +51,14 @@ struct hpsb_iso_packet_info {
...
@@ -51,6 +51,14 @@ struct hpsb_iso_packet_info {
enum
hpsb_iso_type
{
HPSB_ISO_RECV
=
0
,
HPSB_ISO_XMIT
=
1
};
enum
hpsb_iso_type
{
HPSB_ISO_RECV
=
0
,
HPSB_ISO_XMIT
=
1
};
/* The mode of the dma when receiving iso data. Must be supported by chip */
enum
raw1394_iso_dma_recv_mode
{
HPSB_ISO_DMA_DEFAULT
=
-
1
,
HPSB_ISO_DMA_OLD_ABI
=
0
,
HPSB_ISO_DMA_BUFFERFILL
=
1
,
HPSB_ISO_DMA_PACKET_PER_BUFFER
=
2
};
struct
hpsb_iso
{
struct
hpsb_iso
{
enum
hpsb_iso_type
type
;
enum
hpsb_iso_type
type
;
...
@@ -68,6 +76,8 @@ struct hpsb_iso {
...
@@ -68,6 +76,8 @@ struct hpsb_iso {
int
speed
;
/* IEEE1394_SPEED_100, 200, or 400 */
int
speed
;
/* IEEE1394_SPEED_100, 200, or 400 */
int
channel
;
/* -1 if multichannel */
int
channel
;
/* -1 if multichannel */
int
dma_mode
;
/* dma receive mode */
/* greatest # of packets between interrupts - controls
/* greatest # of packets between interrupts - controls
the maximum latency of the buffer */
the maximum latency of the buffer */
...
@@ -139,6 +149,7 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
...
@@ -139,6 +149,7 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
unsigned
int
data_buf_size
,
unsigned
int
data_buf_size
,
unsigned
int
buf_packets
,
unsigned
int
buf_packets
,
int
channel
,
int
channel
,
int
dma_mode
,
int
irq_interval
,
int
irq_interval
,
void
(
*
callback
)(
struct
hpsb_iso
*
));
void
(
*
callback
)(
struct
hpsb_iso
*
));
...
...
drivers/ieee1394/nodemgr.c
View file @
94030996
...
@@ -516,8 +516,7 @@ static struct device nodemgr_dev_template_ne = {
...
@@ -516,8 +516,7 @@ static struct device nodemgr_dev_template_ne = {
.
driver_data
=
&
nodemgr_driverdata_ne
,
.
driver_data
=
&
nodemgr_driverdata_ne
,
};
};
struct
device
nodemgr_dev_template_host
=
{
static
struct
device
nodemgr_dev_template_host
=
{
.
bus
=
&
ieee1394_bus_type
,
.
bus
=
&
ieee1394_bus_type
,
.
release
=
nodemgr_release_host
,
.
release
=
nodemgr_release_host
,
.
driver
=
&
nodemgr_driver_host
,
.
driver
=
&
nodemgr_driver_host
,
...
@@ -1255,36 +1254,6 @@ void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver)
...
@@ -1255,36 +1254,6 @@ void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver)
}
}
/* Searches the list of ud's that match a ne as the parent. If the ud has
* a driver associated with it, we call that driver's update function
* with the ud as the argument. */
static
int
nodemgr_driver_search_cb
(
struct
device
*
dev
,
void
*
__data
)
{
struct
node_entry
*
ne
=
__data
;
struct
unit_directory
*
ud
;
if
(
dev
->
driver_data
==
&
nodemgr_driverdata_ne
||
dev
->
driver_data
==
&
nodemgr_driverdata_host
)
return
0
;
ud
=
container_of
(
dev
,
struct
unit_directory
,
device
);
if
(
&
ne
->
device
!=
ud
->
device
.
parent
)
return
0
;
if
(
ud
->
device
.
driver
)
{
struct
hpsb_protocol_driver
*
pdrv
;
pdrv
=
container_of
(
ud
->
device
.
driver
,
struct
hpsb_protocol_driver
,
driver
);
if
(
pdrv
->
update
)
pdrv
->
update
(
ud
);
}
return
0
;
}
/*
/*
* This function updates nodes that were present on the bus before the
* This function updates nodes that were present on the bus before the
* reset and still are after the reset. The nodeid and the config rom
* reset and still are after the reset. The nodeid and the config rom
...
@@ -1480,9 +1449,24 @@ static int nodemgr_probe_ne_cb(struct device *dev, void *__data)
...
@@ -1480,9 +1449,24 @@ static int nodemgr_probe_ne_cb(struct device *dev, void *__data)
ne
->
needs_probe
=
0
;
ne
->
needs_probe
=
0
;
return
1
;
return
1
;
}
else
{
}
else
{
struct
list_head
*
lh
;
/* Update unit_dirs with attached drivers */
/* Update unit_dirs with attached drivers */
bus_for_each_dev
(
&
ieee1394_bus_type
,
NULL
,
ne
,
list_for_each
(
lh
,
&
dev
->
children
)
{
nodemgr_driver_search_cb
);
struct
unit_directory
*
ud
;
ud
=
container_of
(
list_to_dev
(
lh
),
struct
unit_directory
,
device
);
if
(
ud
->
device
.
driver
)
{
struct
hpsb_protocol_driver
*
pdrv
;
pdrv
=
container_of
(
ud
->
device
.
driver
,
struct
hpsb_protocol_driver
,
driver
);
if
(
pdrv
->
update
)
pdrv
->
update
(
ud
);
}
}
}
}
return
0
;
return
0
;
}
}
...
@@ -1664,7 +1648,6 @@ static int nodemgr_host_thread(void *__hi)
...
@@ -1664,7 +1648,6 @@ static int nodemgr_host_thread(void *__hi)
allow_signal
(
SIGTERM
);
allow_signal
(
SIGTERM
);
/* Setup our device-model entries */
/* Setup our device-model entries */
device_register
(
&
host
->
device
);
nodemgr_create_host_dev_files
(
host
);
nodemgr_create_host_dev_files
(
host
);
/* Sit and wait for a signal to probe the nodes on the bus. This
/* Sit and wait for a signal to probe the nodes on the bus. This
...
@@ -1753,6 +1736,34 @@ struct node_entry *hpsb_nodeid_get_entry(struct hpsb_host *host, nodeid_t nodeid
...
@@ -1753,6 +1736,34 @@ struct node_entry *hpsb_nodeid_get_entry(struct hpsb_host *host, nodeid_t nodeid
return
ne
;
return
ne
;
}
}
struct
for_each_host_struct
{
int
(
*
cb
)(
struct
hpsb_host
*
,
void
*
);
void
*
data
;
};
static
int
nodemgr_for_each_host_cb
(
struct
device
*
dev
,
void
*
__data
)
{
struct
for_each_host_struct
*
host_data
=
__data
;
struct
hpsb_host
*
host
;
if
(
dev
->
driver_data
!=
&
nodemgr_driverdata_host
)
return
0
;
host
=
container_of
(
dev
,
struct
hpsb_host
,
device
);
return
host_data
->
cb
(
host
,
host_data
->
data
);
}
int
nodemgr_for_each_host
(
void
*
__data
,
int
(
*
cb
)(
struct
hpsb_host
*
,
void
*
))
{
struct
for_each_host_struct
host_data
;
host_data
.
cb
=
cb
;
host_data
.
data
=
__data
;
return
bus_for_each_dev
(
&
ieee1394_bus_type
,
NULL
,
&
host_data
,
nodemgr_for_each_host_cb
);
}
/* The following four convenience functions use a struct node_entry
/* The following four convenience functions use a struct node_entry
* for addressing a node on the bus. They are intended for use by any
* for addressing a node on the bus. They are intended for use by any
* process context, not just the nodemgr thread, so we need to be a
* process context, not just the nodemgr thread, so we need to be a
...
@@ -1821,11 +1832,6 @@ static void nodemgr_add_host(struct hpsb_host *host)
...
@@ -1821,11 +1832,6 @@ static void nodemgr_add_host(struct hpsb_host *host)
init_completion
(
&
hi
->
exited
);
init_completion
(
&
hi
->
exited
);
sema_init
(
&
hi
->
reset_sem
,
0
);
sema_init
(
&
hi
->
reset_sem
,
0
);
memcpy
(
&
host
->
device
,
&
nodemgr_dev_template_host
,
sizeof
(
host
->
device
));
host
->
device
.
parent
=
&
host
->
pdev
->
dev
;
snprintf
(
host
->
device
.
bus_id
,
BUS_ID_SIZE
,
"fw-host%d"
,
host
->
id
);
sprintf
(
hi
->
daemon_name
,
"knodemgrd_%d"
,
host
->
id
);
sprintf
(
hi
->
daemon_name
,
"knodemgrd_%d"
,
host
->
id
);
hi
->
pid
=
kernel_thread
(
nodemgr_host_thread
,
hi
,
CLONE_KERNEL
);
hi
->
pid
=
kernel_thread
(
nodemgr_host_thread
,
hi
,
CLONE_KERNEL
);
...
@@ -1879,7 +1885,6 @@ static struct hpsb_highlevel nodemgr_highlevel = {
...
@@ -1879,7 +1885,6 @@ static struct hpsb_highlevel nodemgr_highlevel = {
void
init_ieee1394_nodemgr
(
void
)
void
init_ieee1394_nodemgr
(
void
)
{
{
bus_register
(
&
ieee1394_bus_type
);
driver_register
(
&
nodemgr_driver_host
);
driver_register
(
&
nodemgr_driver_host
);
driver_register
(
&
nodemgr_driver_ne
);
driver_register
(
&
nodemgr_driver_ne
);
...
@@ -1892,5 +1897,4 @@ void cleanup_ieee1394_nodemgr(void)
...
@@ -1892,5 +1897,4 @@ void cleanup_ieee1394_nodemgr(void)
driver_unregister
(
&
nodemgr_driver_ne
);
driver_unregister
(
&
nodemgr_driver_ne
);
driver_unregister
(
&
nodemgr_driver_host
);
driver_unregister
(
&
nodemgr_driver_host
);
bus_unregister
(
&
ieee1394_bus_type
);
}
}
drivers/ieee1394/nodemgr.h
View file @
94030996
...
@@ -219,7 +219,16 @@ int hpsb_node_lock(struct node_entry *ne, u64 addr,
...
@@ -219,7 +219,16 @@ int hpsb_node_lock(struct node_entry *ne, u64 addr,
int
extcode
,
quadlet_t
*
data
,
quadlet_t
arg
);
int
extcode
,
quadlet_t
*
data
,
quadlet_t
arg
);
/* Iterate the hosts, calling a given function with supplied data for each
* host. */
int
nodemgr_for_each_host
(
void
*
__data
,
int
(
*
cb
)(
struct
hpsb_host
*
,
void
*
));
void
init_ieee1394_nodemgr
(
void
);
void
init_ieee1394_nodemgr
(
void
);
void
cleanup_ieee1394_nodemgr
(
void
);
void
cleanup_ieee1394_nodemgr
(
void
);
/* The template for a host device */
extern
struct
device
nodemgr_dev_template_host
;
#endif
/* _IEEE1394_NODEMGR_H */
#endif
/* _IEEE1394_NODEMGR_H */
drivers/ieee1394/ohci1394.c
View file @
94030996
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
#ifdef OHCI1394_DEBUG
#ifdef OHCI1394_DEBUG
#define DBGMSG(card, fmt, args...) \
#define DBGMSG(card, fmt, args...) \
printk(KERN_INFO "%s
_
%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
printk(KERN_INFO "%s
: fw-host
%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
#else
#else
#define DBGMSG(card, fmt, args...)
#define DBGMSG(card, fmt, args...)
#endif
#endif
...
@@ -158,10 +158,10 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
...
@@ -158,10 +158,10 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
/* print card specific information */
/* print card specific information */
#define PRINT(level, card, fmt, args...) \
#define PRINT(level, card, fmt, args...) \
printk(level "%s
_
%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
printk(level "%s
: fw-host
%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
static
char
version
[]
__devinitdata
=
static
char
version
[]
__devinitdata
=
"$Rev: 10
45
$ Ben Collins <bcollins@debian.org>"
;
"$Rev: 10
87
$ Ben Collins <bcollins@debian.org>"
;
/* Module Parameters */
/* Module Parameters */
static
int
phys_dma
=
1
;
static
int
phys_dma
=
1
;
...
@@ -845,7 +845,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -845,7 +845,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
PRINT
(
KERN_ERR
,
ohci
->
id
,
PRINT
(
KERN_ERR
,
ohci
->
id
,
"Transmit packet size %Zd is too big"
,
"Transmit packet size %Zd is too big"
,
packet
->
data_size
);
packet
->
data_size
);
return
0
;
return
-
EOVERFLOW
;
}
}
/* Decide whether we have an iso, a request, or a response packet */
/* Decide whether we have an iso, a request, or a response packet */
...
@@ -862,7 +862,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -862,7 +862,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
if
(
in_interrupt
())
{
if
(
in_interrupt
())
{
PRINT
(
KERN_ERR
,
ohci
->
id
,
PRINT
(
KERN_ERR
,
ohci
->
id
,
"legacy IT context cannot be initialized during interrupt"
);
"legacy IT context cannot be initialized during interrupt"
);
return
0
;
return
-
EINVAL
;
}
}
if
(
alloc_dma_trm_ctx
(
ohci
,
&
ohci
->
it_legacy_context
,
if
(
alloc_dma_trm_ctx
(
ohci
,
&
ohci
->
it_legacy_context
,
...
@@ -870,7 +870,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -870,7 +870,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
OHCI1394_IsoXmitContextBase
)
<
0
)
{
OHCI1394_IsoXmitContextBase
)
<
0
)
{
PRINT
(
KERN_ERR
,
ohci
->
id
,
PRINT
(
KERN_ERR
,
ohci
->
id
,
"error initializing legacy IT context"
);
"error initializing legacy IT context"
);
return
0
;
return
-
ENOMEM
;
}
}
initialize_dma_trm_ctx
(
&
ohci
->
it_legacy_context
);
initialize_dma_trm_ctx
(
&
ohci
->
it_legacy_context
);
...
@@ -890,7 +890,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -890,7 +890,7 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
return
1
;
return
0
;
}
}
static
int
ohci_devctl
(
struct
hpsb_host
*
host
,
enum
devctl_cmd
cmd
,
int
arg
)
static
int
ohci_devctl
(
struct
hpsb_host
*
host
,
enum
devctl_cmd
cmd
,
int
arg
)
...
@@ -1113,8 +1113,8 @@ struct ohci_iso_recv {
...
@@ -1113,8 +1113,8 @@ struct ohci_iso_recv {
struct
ohci1394_iso_tasklet
task
;
struct
ohci1394_iso_tasklet
task
;
int
task_active
;
int
task_active
;
enum
{
BUFFER_FILL_MODE
,
enum
{
BUFFER_FILL_MODE
=
0
,
PACKET_PER_BUFFER_MODE
}
dma_mode
;
PACKET_PER_BUFFER_MODE
=
1
}
dma_mode
;
/* memory and PCI mapping for the DMA descriptors */
/* memory and PCI mapping for the DMA descriptors */
struct
dma_prog_region
prog
;
struct
dma_prog_region
prog
;
...
@@ -1175,7 +1175,8 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1175,7 +1175,8 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
/* use buffer-fill mode, unless irq_interval is 1
/* use buffer-fill mode, unless irq_interval is 1
(note: multichannel requires buffer-fill) */
(note: multichannel requires buffer-fill) */
if
(
iso
->
irq_interval
==
1
&&
iso
->
channel
!=
-
1
)
{
if
(((
iso
->
irq_interval
==
1
&&
iso
->
dma_mode
==
HPSB_ISO_DMA_OLD_ABI
)
||
iso
->
dma_mode
==
HPSB_ISO_DMA_PACKET_PER_BUFFER
)
&&
iso
->
channel
!=
-
1
)
{
recv
->
dma_mode
=
PACKET_PER_BUFFER_MODE
;
recv
->
dma_mode
=
PACKET_PER_BUFFER_MODE
;
}
else
{
}
else
{
recv
->
dma_mode
=
BUFFER_FILL_MODE
;
recv
->
dma_mode
=
BUFFER_FILL_MODE
;
...
@@ -1194,8 +1195,11 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1194,8 +1195,11 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
}
}
/* iso->irq_interval is in packets - translate that to blocks */
/* iso->irq_interval is in packets - translate that to blocks */
/* (err, sort of... 1 is always the safest value) */
if
(
iso
->
irq_interval
==
1
)
recv
->
block_irq_interval
=
iso
->
irq_interval
/
recv
->
nblocks
;
recv
->
block_irq_interval
=
1
;
else
recv
->
block_irq_interval
=
iso
->
irq_interval
*
((
recv
->
nblocks
+
1
)
/
iso
->
buf_packets
);
if
(
recv
->
block_irq_interval
*
4
>
recv
->
nblocks
)
if
(
recv
->
block_irq_interval
*
4
>
recv
->
nblocks
)
recv
->
block_irq_interval
=
recv
->
nblocks
/
4
;
recv
->
block_irq_interval
=
recv
->
nblocks
/
4
;
if
(
recv
->
block_irq_interval
<
1
)
if
(
recv
->
block_irq_interval
<
1
)
...
@@ -1205,6 +1209,10 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1205,6 +1209,10 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
int
max_packet_size
;
int
max_packet_size
;
recv
->
nblocks
=
iso
->
buf_packets
;
recv
->
nblocks
=
iso
->
buf_packets
;
recv
->
block_irq_interval
=
iso
->
irq_interval
;
if
(
recv
->
block_irq_interval
*
4
>
iso
->
buf_packets
)
recv
->
block_irq_interval
=
iso
->
buf_packets
/
4
;
if
(
recv
->
block_irq_interval
<
1
)
recv
->
block_irq_interval
=
1
;
recv
->
block_irq_interval
=
1
;
/* choose a buffer stride */
/* choose a buffer stride */
...
@@ -3271,7 +3279,6 @@ do { \
...
@@ -3271,7 +3279,6 @@ do { \
static
int
__devinit
ohci1394_pci_probe
(
struct
pci_dev
*
dev
,
static
int
__devinit
ohci1394_pci_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
const
struct
pci_device_id
*
ent
)
{
{
static
unsigned
int
card_id_counter
=
0
;
static
int
version_printed
=
0
;
static
int
version_printed
=
0
;
struct
hpsb_host
*
host
;
struct
hpsb_host
*
host
;
...
@@ -3282,15 +3289,14 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
...
@@ -3282,15 +3289,14 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
PRINT_G
(
KERN_INFO
,
"%s"
,
version
);
PRINT_G
(
KERN_INFO
,
"%s"
,
version
);
if
(
pci_enable_device
(
dev
))
if
(
pci_enable_device
(
dev
))
FAIL
(
-
ENXIO
,
"Failed to enable OHCI hardware %d"
,
FAIL
(
-
ENXIO
,
"Failed to enable OHCI hardware"
);
card_id_counter
++
);
pci_set_master
(
dev
);
pci_set_master
(
dev
);
host
=
hpsb_alloc_host
(
&
ohci1394_driver
,
sizeof
(
struct
ti_ohci
));
host
=
hpsb_alloc_host
(
&
ohci1394_driver
,
sizeof
(
struct
ti_ohci
)
,
&
dev
->
dev
);
if
(
!
host
)
FAIL
(
-
ENOMEM
,
"Failed to allocate host structure"
);
if
(
!
host
)
FAIL
(
-
ENOMEM
,
"Failed to allocate host structure"
);
ohci
=
host
->
hostdata
;
ohci
=
host
->
hostdata
;
ohci
->
id
=
card_id_counter
++
;
ohci
->
id
=
host
->
id
;
ohci
->
dev
=
dev
;
ohci
->
dev
=
dev
;
ohci
->
host
=
host
;
ohci
->
host
=
host
;
ohci
->
init_state
=
OHCI_INIT_ALLOC_HOST
;
ohci
->
init_state
=
OHCI_INIT_ALLOC_HOST
;
...
@@ -3462,11 +3468,14 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
...
@@ -3462,11 +3468,14 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
static
void
ohci1394_pci_remove
(
struct
pci_dev
*
pdev
)
static
void
ohci1394_pci_remove
(
struct
pci_dev
*
pdev
)
{
{
struct
ti_ohci
*
ohci
;
struct
ti_ohci
*
ohci
;
struct
device
*
dev
;
ohci
=
pci_get_drvdata
(
pdev
);
ohci
=
pci_get_drvdata
(
pdev
);
if
(
!
ohci
)
if
(
!
ohci
)
return
;
return
;
dev
=
get_device
(
&
ohci
->
host
->
device
);
switch
(
ohci
->
init_state
)
{
switch
(
ohci
->
init_state
)
{
case
OHCI_INIT_DONE
:
case
OHCI_INIT_DONE
:
hpsb_remove_host
(
ohci
->
host
);
hpsb_remove_host
(
ohci
->
host
);
...
@@ -3489,7 +3498,7 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
...
@@ -3489,7 +3498,7 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
/* Disable IRM Contender */
/* Disable IRM Contender */
set_phy_reg
(
ohci
,
4
,
~
0xc0
&
get_phy_reg
(
ohci
,
4
));
set_phy_reg
(
ohci
,
4
,
~
0xc0
&
get_phy_reg
(
ohci
,
4
));
/* Clear link control register */
/* Clear link control register */
reg_write
(
ohci
,
OHCI1394_LinkControlClear
,
0xffffffff
);
reg_write
(
ohci
,
OHCI1394_LinkControlClear
,
0xffffffff
);
...
@@ -3521,7 +3530,7 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
...
@@ -3521,7 +3530,7 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
ohci
->
selfid_buf_cpu
,
ohci
->
selfid_buf_cpu
,
ohci
->
selfid_buf_bus
);
ohci
->
selfid_buf_bus
);
OHCI_DMA_FREE
(
"consistent selfid_buf"
);
OHCI_DMA_FREE
(
"consistent selfid_buf"
);
case
OHCI_INIT_HAVE_CONFIG_ROM_BUFFER
:
case
OHCI_INIT_HAVE_CONFIG_ROM_BUFFER
:
pci_free_consistent
(
ohci
->
dev
,
OHCI_CONFIG_ROM_LEN
,
pci_free_consistent
(
ohci
->
dev
,
OHCI_CONFIG_ROM_LEN
,
ohci
->
csr_config_rom_cpu
,
ohci
->
csr_config_rom_cpu
,
...
@@ -3555,8 +3564,10 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
...
@@ -3555,8 +3564,10 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
case
OHCI_INIT_ALLOC_HOST
:
case
OHCI_INIT_ALLOC_HOST
:
pci_set_drvdata
(
ohci
->
dev
,
NULL
);
pci_set_drvdata
(
ohci
->
dev
,
NULL
);
hpsb_unref_host
(
ohci
->
host
);
}
}
if
(
dev
)
put_device
(
dev
);
}
}
...
...
drivers/ieee1394/oui.db
View file @
94030996
...
@@ -1612,7 +1612,7 @@
...
@@ -1612,7 +1612,7 @@
000658 Helmut Fischer GmbH & Co. KG
000658 Helmut Fischer GmbH & Co. KG
000659 EAL (Apeldoorn) B.V.
000659 EAL (Apeldoorn) B.V.
00065A Strix Systems
00065A Strix Systems
00065B Dell
Inc
.
00065B Dell
Computer Corp
.
00065C Malachite Technologies, Inc.
00065C Malachite Technologies, Inc.
00065D Heidelberg Web Systems
00065D Heidelberg Web Systems
00065E Photuris, Inc.
00065E Photuris, Inc.
...
@@ -3965,7 +3965,7 @@
...
@@ -3965,7 +3965,7 @@
00B0C2 Cisco Systems, Inc.
00B0C2 Cisco Systems, Inc.
00B0C7 Tellabs Operations, Inc.
00B0C7 Tellabs Operations, Inc.
00B0CE TECHNOLOGY RESCUE
00B0CE TECHNOLOGY RESCUE
00B0D0 Dell
Inc
.
00B0D0 Dell
Computer Corp
.
00B0DB Nextcell, Inc.
00B0DB Nextcell, Inc.
00B0DF Reliable Data Technology, Inc.
00B0DF Reliable Data Technology, Inc.
00B0E7 British Federal Ltd.
00B0E7 British Federal Ltd.
...
@@ -4054,7 +4054,7 @@
...
@@ -4054,7 +4054,7 @@
00C04C DEPARTMENT OF FOREIGN AFFAIRS
00C04C DEPARTMENT OF FOREIGN AFFAIRS
00C04D MITEC, INC.
00C04D MITEC, INC.
00C04E COMTROL CORPORATION
00C04E COMTROL CORPORATION
00C04F D
ell Inc.
00C04F D
ELL COMPUTER CORPORATION
00C050 TOYO DENKI SEIZO K.K.
00C050 TOYO DENKI SEIZO K.K.
00C051 ADVANCED INTEGRATION RESEARCH
00C051 ADVANCED INTEGRATION RESEARCH
00C052 BURR-BROWN
00C052 BURR-BROWN
...
...
drivers/ieee1394/pcilynx.c
View file @
94030996
...
@@ -521,10 +521,6 @@ static void send_next(struct ti_lynx *lynx, int what)
...
@@ -521,10 +521,6 @@ static void send_next(struct ti_lynx *lynx, int what)
break
;
break
;
}
}
if
(
!
packet
->
data_be
)
{
pcl
.
buffer
[
1
].
control
|=
PCL_BIGENDIAN
;
}
put_pcl
(
lynx
,
d
->
pcl
,
&
pcl
);
put_pcl
(
lynx
,
d
->
pcl
,
&
pcl
);
run_pcl
(
lynx
,
d
->
pcl_start
,
d
->
channel
);
run_pcl
(
lynx
,
d
->
pcl_start
,
d
->
channel
);
}
}
...
@@ -540,7 +536,7 @@ static int lynx_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -540,7 +536,7 @@ static int lynx_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
if
(
packet
->
data_size
>=
4096
)
{
if
(
packet
->
data_size
>=
4096
)
{
PRINT
(
KERN_ERR
,
lynx
->
id
,
"transmit packet data too big (%Zd)"
,
PRINT
(
KERN_ERR
,
lynx
->
id
,
"transmit packet data too big (%Zd)"
,
packet
->
data_size
);
packet
->
data_size
);
return
0
;
return
-
EOVERFLOW
;
}
}
switch
(
packet
->
type
)
{
switch
(
packet
->
type
)
{
...
@@ -554,7 +550,7 @@ static int lynx_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -554,7 +550,7 @@ static int lynx_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
default:
default:
PRINT
(
KERN_ERR
,
lynx
->
id
,
"invalid packet type %d"
,
PRINT
(
KERN_ERR
,
lynx
->
id
,
"invalid packet type %d"
,
packet
->
type
);
packet
->
type
);
return
0
;
return
-
EINVAL
;
}
}
if
(
packet
->
tcode
==
TCODE_WRITEQ
if
(
packet
->
tcode
==
TCODE_WRITEQ
...
@@ -570,7 +566,7 @@ static int lynx_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -570,7 +566,7 @@ static int lynx_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
spin_unlock_irqrestore
(
&
d
->
queue_lock
,
flags
);
spin_unlock_irqrestore
(
&
d
->
queue_lock
,
flags
);
return
1
;
return
0
;
}
}
...
@@ -1120,7 +1116,7 @@ static ssize_t mem_read(struct file *file, char *buffer, size_t count,
...
@@ -1120,7 +1116,7 @@ static ssize_t mem_read(struct file *file, char *buffer, size_t count,
retval
=
copy_to_user
(
buffer
,
md
->
lynx
->
mem_dma_buffer
,
count
);
retval
=
copy_to_user
(
buffer
,
md
->
lynx
->
mem_dma_buffer
,
count
);
up
(
&
md
->
lynx
->
mem_dma_mutex
);
up
(
&
md
->
lynx
->
mem_dma_mutex
);
if
(
retval
<
0
)
return
retval
;
if
(
retval
)
return
-
EFAULT
;
*
offset
+=
count
;
*
offset
+=
count
;
return
count
;
return
count
;
}
}
...
@@ -1141,14 +1137,17 @@ static ssize_t mem_write(struct file *file, const char *buffer, size_t count,
...
@@ -1141,14 +1137,17 @@ static ssize_t mem_write(struct file *file, const char *buffer, size_t count,
/* FIXME: dereferencing pointers to PCI mem doesn't work everywhere */
/* FIXME: dereferencing pointers to PCI mem doesn't work everywhere */
switch
(
md
->
type
)
{
switch
(
md
->
type
)
{
case
aux
:
case
aux
:
copy_from_user
(
md
->
lynx
->
aux_port
+
(
*
offset
),
buffer
,
count
);
if
(
copy_from_user
(
md
->
lynx
->
aux_port
+
(
*
offset
),
buffer
,
count
))
return
-
EFAULT
;
break
;
break
;
case
ram
:
case
ram
:
copy_from_user
(
md
->
lynx
->
local_ram
+
(
*
offset
),
buffer
,
count
);
if
(
copy_from_user
(
md
->
lynx
->
local_ram
+
(
*
offset
),
buffer
,
count
))
return
-
EFAULT
;
break
;
break
;
case
rom
:
case
rom
:
/* the ROM may be writeable */
/* the ROM may be writeable */
copy_from_user
(
md
->
lynx
->
local_rom
+
(
*
offset
),
buffer
,
count
);
if
(
copy_from_user
(
md
->
lynx
->
local_rom
+
(
*
offset
),
buffer
,
count
))
return
-
EFAULT
;
break
;
break
;
}
}
...
@@ -1443,12 +1442,15 @@ static void iso_rcv_bh(struct ti_lynx *lynx)
...
@@ -1443,12 +1442,15 @@ static void iso_rcv_bh(struct ti_lynx *lynx)
static
void
remove_card
(
struct
pci_dev
*
dev
)
static
void
remove_card
(
struct
pci_dev
*
dev
)
{
{
struct
ti_lynx
*
lynx
;
struct
ti_lynx
*
lynx
;
struct
device
*
lynx_dev
;
int
i
;
int
i
;
lynx
=
pci_get_drvdata
(
dev
);
lynx
=
pci_get_drvdata
(
dev
);
if
(
!
lynx
)
return
;
if
(
!
lynx
)
return
;
pci_set_drvdata
(
dev
,
NULL
);
pci_set_drvdata
(
dev
,
NULL
);
lynx_dev
=
get_device
(
&
lynx
->
host
->
device
);
switch
(
lynx
->
state
)
{
switch
(
lynx
->
state
)
{
case
is_host
:
case
is_host
:
reg_write
(
lynx
,
PCI_INT_ENABLE
,
0
);
reg_write
(
lynx
,
PCI_INT_ENABLE
,
0
);
...
@@ -1498,7 +1500,9 @@ static void remove_card(struct pci_dev *dev)
...
@@ -1498,7 +1500,9 @@ static void remove_card(struct pci_dev *dev)
}
}
tasklet_kill
(
&
lynx
->
iso_rcv
.
tq
);
tasklet_kill
(
&
lynx
->
iso_rcv
.
tq
);
hpsb_unref_host
(
lynx
->
host
);
if
(
lynx_dev
)
put_device
(
lynx_dev
);
}
}
...
@@ -1535,7 +1539,7 @@ static int __devinit add_card(struct pci_dev *dev,
...
@@ -1535,7 +1539,7 @@ static int __devinit add_card(struct pci_dev *dev,
error
=
-
ENOMEM
;
error
=
-
ENOMEM
;
host
=
hpsb_alloc_host
(
&
lynx_driver
,
sizeof
(
struct
ti_lynx
));
host
=
hpsb_alloc_host
(
&
lynx_driver
,
sizeof
(
struct
ti_lynx
)
,
&
dev
->
dev
);
if
(
!
host
)
FAIL
(
"failed to allocate control structure memory"
);
if
(
!
host
)
FAIL
(
"failed to allocate control structure memory"
);
lynx
=
host
->
hostdata
;
lynx
=
host
->
hostdata
;
...
...
drivers/ieee1394/raw1394.c
View file @
94030996
...
@@ -128,7 +128,7 @@ static void free_pending_request(struct pending_request *req)
...
@@ -128,7 +128,7 @@ static void free_pending_request(struct pending_request *req)
}
else
if
(
req
->
free_data
)
{
}
else
if
(
req
->
free_data
)
{
kfree
(
req
->
data
);
kfree
(
req
->
data
);
}
}
free_hpsb
_packet
(
req
->
packet
);
hpsb_free
_packet
(
req
->
packet
);
kfree
(
req
);
kfree
(
req
);
}
}
...
@@ -558,7 +558,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req)
...
@@ -558,7 +558,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req)
lh
=
lh
->
next
;
lh
=
lh
->
next
;
}
}
hi
=
list_entry
(
lh
,
struct
host_info
,
list
);
hi
=
list_entry
(
lh
,
struct
host_info
,
list
);
hpsb_ref_host
(
hi
->
host
);
// XXX Need to handle failure case
get_device
(
&
hi
->
host
->
device
);
// XXX Need to handle failure case
list_add_tail
(
&
fi
->
list
,
&
hi
->
file_info_list
);
list_add_tail
(
&
fi
->
list
,
&
hi
->
file_info_list
);
fi
->
host
=
hi
->
host
;
fi
->
host
=
hi
->
host
;
fi
->
state
=
connected
;
fi
->
state
=
connected
;
...
@@ -782,7 +782,7 @@ static int handle_async_request(struct file_info *fi,
...
@@ -782,7 +782,7 @@ static int handle_async_request(struct file_info *fi,
packet
->
generation
=
req
->
req
.
generation
;
packet
->
generation
=
req
->
req
.
generation
;
if
(
!
hpsb_send_packet
(
packet
)
)
{
if
(
hpsb_send_packet
(
packet
)
<
0
)
{
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
req
->
req
.
length
=
0
;
req
->
req
.
length
=
0
;
hpsb_free_tlabel
(
packet
);
hpsb_free_tlabel
(
packet
);
...
@@ -823,7 +823,7 @@ static int handle_iso_send(struct file_info *fi, struct pending_request *req,
...
@@ -823,7 +823,7 @@ static int handle_iso_send(struct file_info *fi, struct pending_request *req,
/* Update the generation of the packet just before sending. */
/* Update the generation of the packet just before sending. */
packet
->
generation
=
req
->
req
.
generation
;
packet
->
generation
=
req
->
req
.
generation
;
if
(
!
hpsb_send_packet
(
packet
)
)
{
if
(
hpsb_send_packet
(
packet
)
<
0
)
{
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
queue_complete_req
(
req
);
queue_complete_req
(
req
);
}
}
...
@@ -846,7 +846,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
...
@@ -846,7 +846,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
return
sizeof
(
struct
raw1394_request
);
return
sizeof
(
struct
raw1394_request
);
}
}
packet
=
alloc_hpsb
_packet
(
req
->
req
.
length
-
header_length
);
packet
=
hpsb_alloc
_packet
(
req
->
req
.
length
-
header_length
);
req
->
packet
=
packet
;
req
->
packet
=
packet
;
if
(
!
packet
)
return
-
ENOMEM
;
if
(
!
packet
)
return
-
ENOMEM
;
...
@@ -885,7 +885,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
...
@@ -885,7 +885,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
/* Update the generation of the packet just before sending. */
/* Update the generation of the packet just before sending. */
packet
->
generation
=
req
->
req
.
generation
;
packet
->
generation
=
req
->
req
.
generation
;
if
(
!
hpsb_send_packet
(
packet
)
)
{
if
(
hpsb_send_packet
(
packet
)
<
0
)
{
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
queue_complete_req
(
req
);
queue_complete_req
(
req
);
}
}
...
@@ -1797,6 +1797,106 @@ static int arm_unregister(struct file_info *fi, struct pending_request *req)
...
@@ -1797,6 +1797,106 @@ static int arm_unregister(struct file_info *fi, struct pending_request *req)
return
sizeof
(
struct
raw1394_request
);
return
sizeof
(
struct
raw1394_request
);
}
}
/* Copy data from ARM buffer(s) to user buffer. */
static
int
arm_get_buf
(
struct
file_info
*
fi
,
struct
pending_request
*
req
)
{
struct
arm_addr
*
arm_addr
=
NULL
;
unsigned
long
flags
;
unsigned
long
offset
;
struct
list_head
*
entry
;
DBGMSG
(
"arm_get_buf "
"addr(Offset): %04X %08X length: %u"
,
(
u32
)
((
req
->
req
.
address
>>
32
)
&
0xFFFF
),
(
u32
)
(
req
->
req
.
address
&
0xFFFFFFFF
),
(
u32
)
req
->
req
.
length
);
spin_lock_irqsave
(
&
host_info_lock
,
flags
);
entry
=
fi
->
addr_list
.
next
;
while
(
entry
!=
&
(
fi
->
addr_list
))
{
arm_addr
=
list_entry
(
entry
,
struct
arm_addr
,
addr_list
);
if
((
arm_addr
->
start
<=
req
->
req
.
address
)
&&
(
arm_addr
->
end
>
req
->
req
.
address
))
{
if
(
req
->
req
.
address
+
req
->
req
.
length
<=
arm_addr
->
end
)
{
offset
=
req
->
req
.
address
-
arm_addr
->
start
;
DBGMSG
(
"arm_get_buf copy_to_user( %08X, %08X, %u )"
,
(
u32
)
req
->
req
.
recvb
,
(
u32
)
(
arm_addr
->
addr_space_buffer
+
offset
),
(
u32
)
req
->
req
.
length
);
if
(
copy_to_user
(
int2ptr
(
req
->
req
.
recvb
),
arm_addr
->
addr_space_buffer
+
offset
,
req
->
req
.
length
))
{
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
return
(
-
EFAULT
);
}
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
free_pending_request
(
req
);
/* we have to free the request, because we queue no response, and therefore nobody will free it */
return
sizeof
(
struct
raw1394_request
);
}
else
{
DBGMSG
(
"arm_get_buf request exceeded mapping"
);
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
return
(
-
EINVAL
);
}
}
entry
=
entry
->
next
;
}
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
return
(
-
EINVAL
);
}
/* Copy data from user buffer to ARM buffer(s). */
static
int
arm_set_buf
(
struct
file_info
*
fi
,
struct
pending_request
*
req
)
{
struct
arm_addr
*
arm_addr
=
NULL
;
unsigned
long
flags
;
unsigned
long
offset
;
struct
list_head
*
entry
;
DBGMSG
(
"arm_set_buf "
"addr(Offset): %04X %08X length: %u"
,
(
u32
)
((
req
->
req
.
address
>>
32
)
&
0xFFFF
),
(
u32
)
(
req
->
req
.
address
&
0xFFFFFFFF
),
(
u32
)
req
->
req
.
length
);
spin_lock_irqsave
(
&
host_info_lock
,
flags
);
entry
=
fi
->
addr_list
.
next
;
while
(
entry
!=
&
(
fi
->
addr_list
))
{
arm_addr
=
list_entry
(
entry
,
struct
arm_addr
,
addr_list
);
if
((
arm_addr
->
start
<=
req
->
req
.
address
)
&&
(
arm_addr
->
end
>
req
->
req
.
address
))
{
if
(
req
->
req
.
address
+
req
->
req
.
length
<=
arm_addr
->
end
)
{
offset
=
req
->
req
.
address
-
arm_addr
->
start
;
DBGMSG
(
"arm_set_buf copy_from_user( %08X, %08X, %u )"
,
(
u32
)
(
arm_addr
->
addr_space_buffer
+
offset
),
(
u32
)
req
->
req
.
sendb
,
(
u32
)
req
->
req
.
length
);
if
(
copy_from_user
(
arm_addr
->
addr_space_buffer
+
offset
,
int2ptr
(
req
->
req
.
sendb
),
req
->
req
.
length
))
{
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
return
(
-
EFAULT
);
}
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
free_pending_request
(
req
);
/* we have to free the request, because we queue no response, and therefore nobody will free it */
return
sizeof
(
struct
raw1394_request
);
}
else
{
DBGMSG
(
"arm_set_buf request exceeded mapping"
);
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
return
(
-
EINVAL
);
}
}
entry
=
entry
->
next
;
}
spin_unlock_irqrestore
(
&
host_info_lock
,
flags
);
return
(
-
EINVAL
);
}
static
int
reset_notification
(
struct
file_info
*
fi
,
struct
pending_request
*
req
)
static
int
reset_notification
(
struct
file_info
*
fi
,
struct
pending_request
*
req
)
{
{
DBGMSG
(
"reset_notification called - switch %s "
,
DBGMSG
(
"reset_notification called - switch %s "
,
...
@@ -1829,9 +1929,8 @@ static int write_phypacket(struct file_info *fi, struct pending_request *req)
...
@@ -1829,9 +1929,8 @@ static int write_phypacket(struct file_info *fi, struct pending_request *req)
spin_unlock_irq
(
&
fi
->
reqlists_lock
);
spin_unlock_irq
(
&
fi
->
reqlists_lock
);
packet
->
generation
=
req
->
req
.
generation
;
packet
->
generation
=
req
->
req
.
generation
;
retval
=
hpsb_send_packet
(
packet
);
retval
=
hpsb_send_packet
(
packet
);
DBGMSG
(
"write_phypacket send_packet called => retval: %d "
,
DBGMSG
(
"write_phypacket send_packet called => retval: %d "
,
retval
);
retval
);
if
(
retval
<
0
)
{
if
(
!
retval
)
{
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
req
->
req
.
error
=
RAW1394_ERROR_SEND_ERROR
;
req
->
req
.
length
=
0
;
req
->
req
.
length
=
0
;
queue_complete_req
(
req
);
queue_complete_req
(
req
);
...
@@ -1912,6 +2011,12 @@ static int state_connected(struct file_info *fi, struct pending_request *req)
...
@@ -1912,6 +2011,12 @@ static int state_connected(struct file_info *fi, struct pending_request *req)
case
RAW1394_REQ_ARM_UNREGISTER
:
case
RAW1394_REQ_ARM_UNREGISTER
:
return
arm_unregister
(
fi
,
req
);
return
arm_unregister
(
fi
,
req
);
case
RAW1394_REQ_ARM_SET_BUF
:
return
arm_set_buf
(
fi
,
req
);
case
RAW1394_REQ_ARM_GET_BUF
:
return
arm_get_buf
(
fi
,
req
);
case
RAW1394_REQ_RESET_NOTIFY
:
case
RAW1394_REQ_RESET_NOTIFY
:
return
reset_notification
(
fi
,
req
);
return
reset_notification
(
fi
,
req
);
...
@@ -2137,6 +2242,7 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
...
@@ -2137,6 +2242,7 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
stat
.
config
.
data_buf_size
,
stat
.
config
.
data_buf_size
,
stat
.
config
.
buf_packets
,
stat
.
config
.
buf_packets
,
stat
.
config
.
channel
,
stat
.
config
.
channel
,
stat
.
config
.
dma_mode
,
stat
.
config
.
irq_interval
,
stat
.
config
.
irq_interval
,
rawiso_activity_cb
);
rawiso_activity_cb
);
if
(
!
fi
->
iso_handle
)
if
(
!
fi
->
iso_handle
)
...
@@ -2489,7 +2595,7 @@ static int raw1394_release(struct inode *inode, struct file *file)
...
@@ -2489,7 +2595,7 @@ static int raw1394_release(struct inode *inode, struct file *file)
list_del
(
&
fi
->
list
);
list_del
(
&
fi
->
list
);
spin_unlock_irq
(
&
host_info_lock
);
spin_unlock_irq
(
&
host_info_lock
);
hpsb_unref_host
(
fi
->
host
);
put_device
(
&
fi
->
host
->
device
);
}
}
kfree
(
fi
);
kfree
(
fi
);
...
...
drivers/ieee1394/raw1394.h
View file @
94030996
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
#define RAW1394_REQ_ARM_REGISTER 300
#define RAW1394_REQ_ARM_REGISTER 300
#define RAW1394_REQ_ARM_UNREGISTER 301
#define RAW1394_REQ_ARM_UNREGISTER 301
#define RAW1394_REQ_ARM_SET_BUF 302
#define RAW1394_REQ_ARM_GET_BUF 303
#define RAW1394_REQ_RESET_NOTIFY 400
#define RAW1394_REQ_RESET_NOTIFY 400
...
@@ -149,6 +151,9 @@ struct raw1394_iso_config {
...
@@ -149,6 +151,9 @@ struct raw1394_iso_config {
/* xmit only - iso transmission speed */
/* xmit only - iso transmission speed */
__u8
speed
;
__u8
speed
;
/* The mode of the dma when receiving iso data. Must be supported by chip */
__u8
dma_mode
;
/* max. latency of buffer, in packets (-1 if you don't care) */
/* max. latency of buffer, in packets (-1 if you don't care) */
__s32
irq_interval
;
__s32
irq_interval
;
};
};
...
...
drivers/ieee1394/sbp2.c
View file @
94030996
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
#include "sbp2.h"
#include "sbp2.h"
static
char
version
[]
__devinitdata
=
static
char
version
[]
__devinitdata
=
"$Rev: 10
34
$ Ben Collins <bcollins@debian.org>"
;
"$Rev: 10
82
$ Ben Collins <bcollins@debian.org>"
;
/*
/*
* Module load parameter definitions
* Module load parameter definitions
...
@@ -361,38 +361,34 @@ static int sbp2util_down_timeout(atomic_t *done, int timeout)
...
@@ -361,38 +361,34 @@ static int sbp2util_down_timeout(atomic_t *done, int timeout)
static
void
sbp2_free_packet
(
struct
hpsb_packet
*
packet
)
static
void
sbp2_free_packet
(
struct
hpsb_packet
*
packet
)
{
{
hpsb_free_tlabel
(
packet
);
hpsb_free_tlabel
(
packet
);
free_hpsb
_packet
(
packet
);
hpsb_free
_packet
(
packet
);
}
}
/*
/* This is much like hpsb_node_write(), except it ignores the response
* This function is called to retrieve a block write packet from our
* subaction and returns immediately. Can be used from interrupts.
* packet pool. This function is used in place of calling
* alloc_hpsb_packet (which costs us three kmallocs). Instead we just pull
* out a free request packet and re-initialize values in it. I'm sure this
* can still stand some more optimization.
*/
*/
static
struct
hpsb_packet
*
int
sbp2util_node_write_no_wait
(
struct
node_entry
*
ne
,
u64
addr
,
sbp2util_allocate_write_packet
(
struct
sbp2scsi_host_info
*
hi
,
quadlet_t
*
buffer
,
size_t
length
)
struct
node_entry
*
ne
,
u64
addr
,
size_t
data_size
,
quadlet_t
*
data
)
{
{
struct
hpsb_packet
*
packet
;
struct
hpsb_packet
*
packet
;
packet
=
hpsb_make_writepacket
(
hi
->
host
,
ne
->
nodeid
,
packet
=
hpsb_make_writepacket
(
ne
->
host
,
ne
->
nodeid
,
addr
,
data
,
data_size
);
addr
,
buffer
,
length
);
if
(
!
packet
)
if
(
!
packet
)
return
NULL
;
return
-
ENOMEM
;
hpsb_set_packet_complete_task
(
packet
,
(
void
(
*
)(
void
*
))
sbp2_free_packet
,
hpsb_set_packet_complete_task
(
packet
,
(
void
(
*
)(
void
*
))
sbp2_free_packet
,
packet
);
packet
);
hpsb_node_fill_packet
(
ne
,
packet
);
hpsb_node_fill_packet
(
ne
,
packet
);
return
packet
;
if
(
hpsb_send_packet
(
packet
)
<
0
)
{
}
sbp2_free_packet
(
packet
);
return
-
EIO
;
}
return
0
;
}
/*
/*
* This function is called to create a pool of command orbs used for
* This function is called to create a pool of command orbs used for
...
@@ -1734,35 +1730,26 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
...
@@ -1734,35 +1730,26 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
*/
*/
static
int
sbp2_agent_reset
(
struct
scsi_id_instance_data
*
scsi_id
,
int
wait
)
static
int
sbp2_agent_reset
(
struct
scsi_id_instance_data
*
scsi_id
,
int
wait
)
{
{
struct
sbp2scsi_host_info
*
hi
=
scsi_id
->
hi
;
struct
hpsb_packet
*
packet
;
quadlet_t
data
;
quadlet_t
data
;
u64
addr
;
int
retval
;
SBP2_DEBUG
(
"sbp2_agent_reset"
);
SBP2_DEBUG
(
"sbp2_agent_reset"
);
/*
/*
* Ok, let's write to the target's management agent register
* Ok, let's write to the target's management agent register
*/
*/
data
=
ntohl
(
SBP2_AGENT_RESET_DATA
);
data
=
ntohl
(
SBP2_AGENT_RESET_DATA
);
packet
=
sbp2util_allocate_write_packet
(
hi
,
scsi_id
->
ne
,
addr
=
scsi_id
->
sbp2_command_block_agent_addr
+
SBP2_AGENT_RESET_OFFSET
;
scsi_id
->
sbp2_command_block_agent_addr
+
SBP2_AGENT_RESET_OFFSET
,
4
,
&
data
);
if
(
!
packet
)
{
SBP2_ERR
(
"sbp2util_allocate_write_packet failed"
);
return
(
-
ENOMEM
);
}
if
(
!
hpsb_send_packet
(
packet
))
{
if
(
wait
)
SBP2_ERR
(
"hpsb_send_packet failed"
);
retval
=
hpsb_node_write
(
scsi_id
->
ne
,
addr
,
&
data
,
4
);
sbp2_free_packet
(
packet
);
else
return
(
-
EIO
);
retval
=
sbp2util_node_write_no_wait
(
scsi_id
->
ne
,
addr
,
&
data
,
4
);
}
if
(
wait
)
{
if
(
retval
<
0
)
{
down
(
&
packet
->
state_change
);
SBP2_ERR
(
"hpsb_node_write failed.
\n
"
);
down
(
&
packet
->
state_change
)
;
return
-
EIO
;
}
}
/*
/*
...
@@ -2032,8 +2019,9 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
...
@@ -2032,8 +2019,9 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
struct
sbp2_command_info
*
command
)
struct
sbp2_command_info
*
command
)
{
{
struct
sbp2scsi_host_info
*
hi
=
scsi_id
->
hi
;
struct
sbp2scsi_host_info
*
hi
=
scsi_id
->
hi
;
struct
hpsb_packet
*
packet
;
struct
sbp2_command_orb
*
command_orb
=
&
command
->
command_orb
;
struct
sbp2_command_orb
*
command_orb
=
&
command
->
command_orb
;
struct
node_entry
*
ne
=
scsi_id
->
ne
;
u64
addr
;
outstanding_orb_incr
;
outstanding_orb_incr
;
SBP2_ORB_DEBUG
(
"sending command orb %p, total orbs = %x"
,
SBP2_ORB_DEBUG
(
"sending command orb %p, total orbs = %x"
,
...
@@ -2049,40 +2037,30 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
...
@@ -2049,40 +2037,30 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
* Check to see if there are any previous orbs to use
* Check to see if there are any previous orbs to use
*/
*/
if
(
scsi_id
->
last_orb
==
NULL
)
{
if
(
scsi_id
->
last_orb
==
NULL
)
{
quadlet_t
data
[
2
];
/*
/*
* Ok, let's write to the target's management agent register
* Ok, let's write to the target's management agent register
*/
*/
if
(
hpsb_node_entry_valid
(
scsi_id
->
ne
))
{
addr
=
scsi_id
->
sbp2_command_block_agent_addr
+
SBP2_ORB_POINTER_OFFSET
;
data
[
0
]
=
ORB_SET_NODE_ID
(
hi
->
host
->
node_id
);
packet
=
sbp2util_allocate_write_packet
(
hi
,
scsi_id
->
ne
,
data
[
1
]
=
command
->
command_orb_dma
;
scsi_id
->
sbp2_command_block_agent_addr
+
sbp2util_cpu_to_be32_buffer
(
data
,
8
);
SBP2_ORB_POINTER_OFFSET
,
8
,
NULL
);
if
(
!
packet
)
{
SBP2_ERR
(
"sbp2util_allocate_write_packet failed"
);
return
(
-
ENOMEM
);
}
packet
->
data
[
0
]
=
ORB_SET_NODE_ID
(
hi
->
host
->
node_id
);
packet
->
data
[
1
]
=
command
->
command_orb_dma
;
sbp2util_cpu_to_be32_buffer
(
packet
->
data
,
8
);
SBP2_ORB_DEBUG
(
"write command agent, command orb %p"
,
command_orb
);
if
(
!
hpsb_send_packet
(
packet
))
{
SBP2_ORB_DEBUG
(
"write command agent, command orb %p"
,
command_orb
);
SBP2_ERR
(
"hpsb_send_packet failed"
);
sbp2_free_packet
(
packet
);
return
(
-
EIO
);
}
SBP2_ORB_DEBUG
(
"write command agent complete"
);
if
(
sbp2util_node_write_no_wait
(
ne
,
addr
,
data
,
8
)
<
0
)
{
SBP2_ERR
(
"sbp2util_node_write_no_wait failed.
\n
"
);
return
-
EIO
;
}
}
SBP2_ORB_DEBUG
(
"write command agent complete"
);
scsi_id
->
last_orb
=
command_orb
;
scsi_id
->
last_orb
=
command_orb
;
scsi_id
->
last_orb_dma
=
command
->
command_orb_dma
;
scsi_id
->
last_orb_dma
=
command
->
command_orb_dma
;
}
else
{
}
else
{
quadlet_t
data
;
/*
/*
* We have an orb already sent (maybe or maybe not
* We have an orb already sent (maybe or maybe not
...
@@ -2102,25 +2080,14 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
...
@@ -2102,25 +2080,14 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
/*
/*
* Ring the doorbell
* Ring the doorbell
*/
*/
if
(
hpsb_node_entry_valid
(
scsi_id
->
ne
))
{
data
=
cpu_to_be32
(
command
->
command_orb_dma
);
quadlet_t
data
=
cpu_to_be32
(
command
->
command_orb_dma
)
;
addr
=
scsi_id
->
sbp2_command_block_agent_addr
+
SBP2_DOORBELL_OFFSET
;
packet
=
sbp2util_allocate_write_packet
(
hi
,
scsi_id
->
ne
,
SBP2_ORB_DEBUG
(
"ring doorbell, command orb %p"
,
command_orb
);
scsi_id
->
sbp2_command_block_agent_addr
+
SBP2_DOORBELL_OFFSET
,
4
,
&
data
);
if
(
!
packet
)
{
SBP2_ERR
(
"sbp2util_allocate_write_packet failed"
);
return
(
-
ENOMEM
);
}
SBP2_ORB_DEBUG
(
"ring doorbell, command orb %p"
,
command_orb
);
if
(
sbp2util_node_write_no_wait
(
ne
,
addr
,
&
data
,
4
)
<
0
)
{
SBP2_ERR
(
"sbp2util_node_write_no_wait failed"
);
if
(
!
hpsb_send_packet
(
packet
))
{
return
(
-
EIO
);
SBP2_ERR
(
"hpsb_send_packet failed"
);
sbp2_free_packet
(
packet
);
return
(
-
EIO
);
}
}
}
scsi_id
->
last_orb
=
command_orb
;
scsi_id
->
last_orb
=
command_orb
;
...
...
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