Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
11092356
Commit
11092356
authored
Jun 26, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/gregkh/linux/pci-2.5
into home.osdl.org:/home/torvalds/v2.5/linux
parents
09189bd8
3891cd30
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
609 additions
and
537 deletions
+609
-537
arch/m68knommu/Kconfig
arch/m68knommu/Kconfig
+1
-0
arch/m68knommu/kernel/time.c
arch/m68knommu/kernel/time.c
+11
-6
drivers/ieee1394/Makefile
drivers/ieee1394/Makefile
+4
-1
drivers/ieee1394/amdtp.c
drivers/ieee1394/amdtp.c
+1
-1
drivers/ieee1394/cmp.c
drivers/ieee1394/cmp.c
+1
-1
drivers/ieee1394/csr.h
drivers/ieee1394/csr.h
+4
-0
drivers/ieee1394/dma.c
drivers/ieee1394/dma.c
+17
-17
drivers/ieee1394/dma.h
drivers/ieee1394/dma.h
+1
-1
drivers/ieee1394/dv1394-private.h
drivers/ieee1394/dv1394-private.h
+3
-3
drivers/ieee1394/dv1394.c
drivers/ieee1394/dv1394.c
+162
-162
drivers/ieee1394/dv1394.h
drivers/ieee1394/dv1394.h
+5
-5
drivers/ieee1394/eth1394.c
drivers/ieee1394/eth1394.c
+206
-146
drivers/ieee1394/ieee1394.h
drivers/ieee1394/ieee1394.h
+7
-7
drivers/ieee1394/ieee1394_core.c
drivers/ieee1394/ieee1394_core.c
+10
-11
drivers/ieee1394/ieee1394_core.h
drivers/ieee1394/ieee1394_core.h
+1
-1
drivers/ieee1394/ieee1394_transactions.c
drivers/ieee1394/ieee1394_transactions.c
+2
-2
drivers/ieee1394/ieee1394_types.h
drivers/ieee1394/ieee1394_types.h
+1
-1
drivers/ieee1394/iso.c
drivers/ieee1394/iso.c
+46
-46
drivers/ieee1394/iso.h
drivers/ieee1394/iso.h
+1
-1
drivers/ieee1394/nodemgr.c
drivers/ieee1394/nodemgr.c
+4
-4
drivers/ieee1394/ohci1394.c
drivers/ieee1394/ohci1394.c
+74
-74
drivers/ieee1394/raw1394.c
drivers/ieee1394/raw1394.c
+30
-30
drivers/ieee1394/sbp2.c
drivers/ieee1394/sbp2.c
+4
-4
drivers/ieee1394/video1394.c
drivers/ieee1394/video1394.c
+13
-13
No files found.
arch/m68knommu/Kconfig
View file @
11092356
...
@@ -499,6 +499,7 @@ config KCORE_AOUT
...
@@ -499,6 +499,7 @@ config KCORE_AOUT
default y
default y
config KCORE_ELF
config KCORE_ELF
bool
default y
default y
source "fs/Kconfig.binfmt"
source "fs/Kconfig.binfmt"
...
...
arch/m68knommu/kernel/time.c
View file @
11092356
...
@@ -162,28 +162,33 @@ void do_gettimeofday(struct timeval *tv)
...
@@ -162,28 +162,33 @@ void do_gettimeofday(struct timeval *tv)
tv
->
tv_usec
=
usec
;
tv
->
tv_usec
=
usec
;
}
}
void
do_settimeofday
(
struct
timeval
*
tv
)
int
do_settimeofday
(
struct
timespec
*
tv
)
{
{
if
((
unsigned
long
)
tv
->
tv_nsec
>=
NSEC_PER_SEC
)
return
-
EINVAL
;
write_seqlock_irq
(
&
xtime_lock
);
write_seqlock_irq
(
&
xtime_lock
);
/* This is revolting. We need to set the xtime.tv_usec
/*
* This is revolting. We need to set the xtime.tv_usec
* correctly. However, the value in this location is
* correctly. However, the value in this location is
* is value at the last tick.
* is value at the last tick.
* Discover what correction gettimeofday
* Discover what correction gettimeofday
* would have done, and then undo it!
* would have done, and then undo it!
*/
*/
if
(
mach_gettimeoffset
)
if
(
mach_gettimeoffset
)
tv
->
tv_
usec
-=
mach_gettimeoffset
(
);
tv
->
tv_
nsec
-=
(
mach_gettimeoffset
()
*
1000
);
while
(
tv
->
tv_
u
sec
<
0
)
{
while
(
tv
->
tv_
n
sec
<
0
)
{
tv
->
tv_
usec
+=
1000000
;
tv
->
tv_
nsec
+=
NSEC_PER_SEC
;
tv
->
tv_sec
--
;
tv
->
tv_sec
--
;
}
}
xtime
.
tv_sec
=
tv
->
tv_sec
;
xtime
.
tv_sec
=
tv
->
tv_sec
;
xtime
.
tv_nsec
=
(
tv
->
tv_usec
*
1000
)
;
xtime
.
tv_nsec
=
tv
->
tv_nsec
;
time_adjust
=
0
;
/* stop active adjtime() */
time_adjust
=
0
;
/* stop active adjtime() */
time_status
|=
STA_UNSYNC
;
time_status
|=
STA_UNSYNC
;
time_maxerror
=
NTP_PHASE_LIMIT
;
time_maxerror
=
NTP_PHASE_LIMIT
;
time_esterror
=
NTP_PHASE_LIMIT
;
time_esterror
=
NTP_PHASE_LIMIT
;
write_sequnlock_irq
(
&
xtime_lock
);
write_sequnlock_irq
(
&
xtime_lock
);
return
0
;
}
}
drivers/ieee1394/Makefile
View file @
11092356
...
@@ -18,6 +18,9 @@ obj-$(CONFIG_IEEE1394_CMP) += cmp.o
...
@@ -18,6 +18,9 @@ obj-$(CONFIG_IEEE1394_CMP) += cmp.o
clean-files
:=
oui.c
clean-files
:=
oui.c
quiet_cmd_oui2c
=
OUI2C
$@
cmd_oui2c
=
$(CONFIG_SHELL)
$(obj)
/oui2c.sh <
$(obj)
/oui.db
>
$@
$(obj)/oui.o
:
$(obj)/oui.c
$(obj)/oui.o
:
$(obj)/oui.c
$(obj)/oui.c
:
$(obj)/oui.db $(obj)/oui2c.sh
$(obj)/oui.c
:
$(obj)/oui.db $(obj)/oui2c.sh
$(
CONFIG_SHELL)
$(obj)
/oui2c.sh <
$(obj)
/oui.db
>
$@
$(
call
if_changed,oui2c
)
drivers/ieee1394/amdtp.c
View file @
11092356
...
@@ -732,7 +732,7 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents)
...
@@ -732,7 +732,7 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents)
/* Fill IEEE1394 headers */
/* Fill IEEE1394 headers */
packet
->
db
->
header_desc
.
header
[
0
]
=
packet
->
db
->
header_desc
.
header
[
0
]
=
(
SPEED_100
<<
16
)
|
(
0x01
<<
14
)
|
(
IEEE1394_
SPEED_100
<<
16
)
|
(
0x01
<<
14
)
|
(
s
->
iso_channel
<<
8
)
|
(
TCODE_ISO_DATA
<<
4
);
(
s
->
iso_channel
<<
8
)
|
(
TCODE_ISO_DATA
<<
4
);
packet
->
db
->
header_desc
.
header
[
1
]
=
size
<<
16
;
packet
->
db
->
header_desc
.
header
[
1
]
=
size
<<
16
;
...
...
drivers/ieee1394/cmp.c
View file @
11092356
...
@@ -138,7 +138,7 @@ static void cmp_add_host(struct hpsb_host *host)
...
@@ -138,7 +138,7 @@ static void cmp_add_host(struct hpsb_host *host)
}
}
ch
->
host
=
host
;
ch
->
host
=
host
;
ch
->
u
.
ompr
.
rate
=
SPEED_100
;
ch
->
u
.
ompr
.
rate
=
IEEE1394_
SPEED_100
;
ch
->
u
.
ompr
.
bcast_channel_base
=
63
;
ch
->
u
.
ompr
.
bcast_channel_base
=
63
;
ch
->
u
.
ompr
.
nplugs
=
2
;
ch
->
u
.
ompr
.
nplugs
=
2
;
...
...
drivers/ieee1394/csr.h
View file @
11092356
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
#ifndef _IEEE1394_CSR_H
#ifndef _IEEE1394_CSR_H
#define _IEEE1394_CSR_H
#define _IEEE1394_CSR_H
#ifdef CONFIG_PREEMPT
#include <linux/sched.h>
#endif
#define CSR_REGISTER_BASE 0xfffff0000000ULL
#define CSR_REGISTER_BASE 0xfffff0000000ULL
/* register offsets relative to CSR_REGISTER_BASE */
/* register offsets relative to CSR_REGISTER_BASE */
...
...
drivers/ieee1394/dma.c
View file @
11092356
...
@@ -31,7 +31,7 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
...
@@ -31,7 +31,7 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
prog
->
n_pages
=
n_bytes
/
PAGE_SIZE
;
prog
->
n_pages
=
n_bytes
/
PAGE_SIZE
;
prog
->
kvirt
=
pci_alloc_consistent
(
dev
,
prog
->
n_pages
*
PAGE_SIZE
,
&
prog
->
bus_addr
);
prog
->
kvirt
=
pci_alloc_consistent
(
dev
,
prog
->
n_pages
*
PAGE_SIZE
,
&
prog
->
bus_addr
);
if
(
!
prog
->
kvirt
)
{
if
(
!
prog
->
kvirt
)
{
printk
(
KERN_ERR
"dma_prog_region_alloc: pci_alloc_consistent() failed
\n
"
);
printk
(
KERN_ERR
"dma_prog_region_alloc: pci_alloc_consistent() failed
\n
"
);
dma_prog_region_free
(
prog
);
dma_prog_region_free
(
prog
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -44,7 +44,7 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
...
@@ -44,7 +44,7 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
void
dma_prog_region_free
(
struct
dma_prog_region
*
prog
)
void
dma_prog_region_free
(
struct
dma_prog_region
*
prog
)
{
{
if
(
prog
->
kvirt
)
{
if
(
prog
->
kvirt
)
{
pci_free_consistent
(
prog
->
dev
,
prog
->
n_pages
*
PAGE_SIZE
,
prog
->
kvirt
,
prog
->
bus_addr
);
pci_free_consistent
(
prog
->
dev
,
prog
->
n_pages
*
PAGE_SIZE
,
prog
->
kvirt
,
prog
->
bus_addr
);
}
}
...
@@ -75,7 +75,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
...
@@ -75,7 +75,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
n_pages
=
n_bytes
/
PAGE_SIZE
;
n_pages
=
n_bytes
/
PAGE_SIZE
;
dma
->
kvirt
=
vmalloc_32
(
n_pages
*
PAGE_SIZE
);
dma
->
kvirt
=
vmalloc_32
(
n_pages
*
PAGE_SIZE
);
if
(
!
dma
->
kvirt
)
{
if
(
!
dma
->
kvirt
)
{
printk
(
KERN_ERR
"dma_region_alloc: vmalloc_32() failed
\n
"
);
printk
(
KERN_ERR
"dma_region_alloc: vmalloc_32() failed
\n
"
);
goto
err
;
goto
err
;
}
}
...
@@ -87,7 +87,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
...
@@ -87,7 +87,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
/* allocate scatter/gather list */
/* allocate scatter/gather list */
dma
->
sglist
=
kmalloc
(
dma
->
n_pages
*
sizeof
(
struct
scatterlist
),
GFP_KERNEL
);
dma
->
sglist
=
kmalloc
(
dma
->
n_pages
*
sizeof
(
struct
scatterlist
),
GFP_KERNEL
);
if
(
!
dma
->
sglist
)
{
if
(
!
dma
->
sglist
)
{
printk
(
KERN_ERR
"dma_region_alloc: kmalloc(sglist) failed
\n
"
);
printk
(
KERN_ERR
"dma_region_alloc: kmalloc(sglist) failed
\n
"
);
goto
err
;
goto
err
;
}
}
...
@@ -96,7 +96,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
...
@@ -96,7 +96,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
memset
(
dma
->
sglist
,
0
,
dma
->
n_pages
*
sizeof
(
struct
scatterlist
));
memset
(
dma
->
sglist
,
0
,
dma
->
n_pages
*
sizeof
(
struct
scatterlist
));
/* fill scatter/gather list with pages */
/* fill scatter/gather list with pages */
for
(
i
=
0
;
i
<
dma
->
n_pages
;
i
++
)
{
for
(
i
=
0
;
i
<
dma
->
n_pages
;
i
++
)
{
unsigned
long
va
=
(
unsigned
long
)
dma
->
kvirt
+
i
*
PAGE_SIZE
;
unsigned
long
va
=
(
unsigned
long
)
dma
->
kvirt
+
i
*
PAGE_SIZE
;
dma
->
sglist
[
i
].
page
=
vmalloc_to_page
((
void
*
)
va
);
dma
->
sglist
[
i
].
page
=
vmalloc_to_page
((
void
*
)
va
);
...
@@ -106,7 +106,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
...
@@ -106,7 +106,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
/* map sglist to the IOMMU */
/* map sglist to the IOMMU */
dma
->
n_dma_pages
=
pci_map_sg
(
dev
,
&
dma
->
sglist
[
0
],
dma
->
n_pages
,
direction
);
dma
->
n_dma_pages
=
pci_map_sg
(
dev
,
&
dma
->
sglist
[
0
],
dma
->
n_pages
,
direction
);
if
(
dma
->
n_dma_pages
==
0
)
{
if
(
dma
->
n_dma_pages
==
0
)
{
printk
(
KERN_ERR
"dma_region_alloc: pci_map_sg() failed
\n
"
);
printk
(
KERN_ERR
"dma_region_alloc: pci_map_sg() failed
\n
"
);
goto
err
;
goto
err
;
}
}
...
@@ -123,18 +123,18 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
...
@@ -123,18 +123,18 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
void
dma_region_free
(
struct
dma_region
*
dma
)
void
dma_region_free
(
struct
dma_region
*
dma
)
{
{
if
(
dma
->
n_dma_pages
)
{
if
(
dma
->
n_dma_pages
)
{
pci_unmap_sg
(
dma
->
dev
,
dma
->
sglist
,
dma
->
n_pages
,
dma
->
direction
);
pci_unmap_sg
(
dma
->
dev
,
dma
->
sglist
,
dma
->
n_pages
,
dma
->
direction
);
dma
->
n_dma_pages
=
0
;
dma
->
n_dma_pages
=
0
;
dma
->
dev
=
NULL
;
dma
->
dev
=
NULL
;
}
}
if
(
dma
->
sglist
)
{
if
(
dma
->
sglist
)
{
kfree
(
dma
->
sglist
);
kfree
(
dma
->
sglist
);
dma
->
sglist
=
NULL
;
dma
->
sglist
=
NULL
;
}
}
if
(
dma
->
kvirt
)
{
if
(
dma
->
kvirt
)
{
vfree
(
dma
->
kvirt
);
vfree
(
dma
->
kvirt
);
dma
->
kvirt
=
NULL
;
dma
->
kvirt
=
NULL
;
dma
->
n_pages
=
0
;
dma
->
n_pages
=
0
;
...
@@ -148,8 +148,8 @@ static inline int dma_region_find(struct dma_region *dma, unsigned long offset,
...
@@ -148,8 +148,8 @@ static inline int dma_region_find(struct dma_region *dma, unsigned long offset,
int
i
;
int
i
;
unsigned
long
off
=
offset
;
unsigned
long
off
=
offset
;
for
(
i
=
0
;
i
<
dma
->
n_dma_pages
;
i
++
)
{
for
(
i
=
0
;
i
<
dma
->
n_dma_pages
;
i
++
)
{
if
(
off
<
sg_dma_len
(
&
dma
->
sglist
[
i
]))
{
if
(
off
<
sg_dma_len
(
&
dma
->
sglist
[
i
]))
{
*
rem
=
off
;
*
rem
=
off
;
return
i
;
return
i
;
}
}
...
@@ -173,7 +173,7 @@ void dma_region_sync(struct dma_region *dma, unsigned long offset, unsigned long
...
@@ -173,7 +173,7 @@ void dma_region_sync(struct dma_region *dma, unsigned long offset, unsigned long
int
first
,
last
;
int
first
,
last
;
unsigned
long
rem
;
unsigned
long
rem
;
if
(
!
len
)
if
(
!
len
)
len
=
1
;
len
=
1
;
first
=
dma_region_find
(
dma
,
offset
,
&
rem
);
first
=
dma_region_find
(
dma
,
offset
,
&
rem
);
...
@@ -193,10 +193,10 @@ dma_region_pagefault(struct vm_area_struct *area, unsigned long address, int wri
...
@@ -193,10 +193,10 @@ dma_region_pagefault(struct vm_area_struct *area, unsigned long address, int wri
struct
dma_region
*
dma
=
(
struct
dma_region
*
)
area
->
vm_private_data
;
struct
dma_region
*
dma
=
(
struct
dma_region
*
)
area
->
vm_private_data
;
if
(
!
dma
->
kvirt
)
if
(
!
dma
->
kvirt
)
goto
out
;
goto
out
;
if
(
(
address
<
(
unsigned
long
)
area
->
vm_start
)
||
if
(
(
address
<
(
unsigned
long
)
area
->
vm_start
)
||
(
address
>
(
unsigned
long
)
area
->
vm_start
+
(
PAGE_SIZE
*
dma
->
n_pages
))
)
(
address
>
(
unsigned
long
)
area
->
vm_start
+
(
PAGE_SIZE
*
dma
->
n_pages
))
)
goto
out
;
goto
out
;
...
@@ -216,16 +216,16 @@ int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_st
...
@@ -216,16 +216,16 @@ int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_st
{
{
unsigned
long
size
;
unsigned
long
size
;
if
(
!
dma
->
kvirt
)
if
(
!
dma
->
kvirt
)
return
-
EINVAL
;
return
-
EINVAL
;
/* must be page-aligned */
/* must be page-aligned */
if
(
vma
->
vm_pgoff
!=
0
)
if
(
vma
->
vm_pgoff
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
/* check the length */
/* check the length */
size
=
vma
->
vm_end
-
vma
->
vm_start
;
size
=
vma
->
vm_end
-
vma
->
vm_start
;
if
(
size
>
(
PAGE_SIZE
*
dma
->
n_pages
))
if
(
size
>
(
PAGE_SIZE
*
dma
->
n_pages
))
return
-
EINVAL
;
return
-
EINVAL
;
vma
->
vm_ops
=
&
dma_region_vm_ops
;
vma
->
vm_ops
=
&
dma_region_vm_ops
;
...
...
drivers/ieee1394/dma.h
View file @
11092356
...
@@ -76,7 +76,7 @@ dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset
...
@@ -76,7 +76,7 @@ dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset
/* round up a number of bytes to be a multiple of the PAGE_SIZE */
/* round up a number of bytes to be a multiple of the PAGE_SIZE */
static
inline
unsigned
long
round_up_to_page
(
unsigned
long
len
)
static
inline
unsigned
long
round_up_to_page
(
unsigned
long
len
)
{
{
if
(
len
%
PAGE_SIZE
)
if
(
len
%
PAGE_SIZE
)
len
+=
PAGE_SIZE
-
(
len
%
PAGE_SIZE
);
len
+=
PAGE_SIZE
-
(
len
%
PAGE_SIZE
);
return
len
;
return
len
;
}
}
...
...
drivers/ieee1394/dv1394-private.h
View file @
11092356
...
@@ -97,7 +97,7 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi,
...
@@ -97,7 +97,7 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi,
omi
->
q
[
3
]
=
0
;
omi
->
q
[
3
]
=
0
;
/* IT packet header */
/* IT packet header */
omi
->
q
[
4
]
=
cpu_to_le32
(
(
0x0
<<
16
)
/*
DMA
_SPEED_100 */
omi
->
q
[
4
]
=
cpu_to_le32
(
(
0x0
<<
16
)
/*
IEEE1394
_SPEED_100 */
|
(
tag
<<
14
)
|
(
tag
<<
14
)
|
(
channel
<<
8
)
|
(
channel
<<
8
)
|
(
TCODE_ISO_DATA
<<
4
)
|
(
TCODE_ISO_DATA
<<
4
)
...
@@ -129,10 +129,10 @@ static inline void fill_output_last(struct output_last *ol,
...
@@ -129,10 +129,10 @@ static inline void fill_output_last(struct output_last *ol,
u32
temp
=
0
;
u32
temp
=
0
;
temp
|=
1
<<
28
;
/* OUTPUT_LAST */
temp
|=
1
<<
28
;
/* OUTPUT_LAST */
if
(
want_timestamp
)
/* controller will update timestamp at DMA time */
if
(
want_timestamp
)
/* controller will update timestamp at DMA time */
temp
|=
1
<<
27
;
temp
|=
1
<<
27
;
if
(
want_interrupt
)
if
(
want_interrupt
)
temp
|=
3
<<
20
;
temp
|=
3
<<
20
;
temp
|=
3
<<
18
;
/* must take branch */
temp
|=
3
<<
18
;
/* must take branch */
...
...
drivers/ieee1394/dv1394.c
View file @
11092356
...
@@ -201,14 +201,14 @@ static void frame_reset(struct frame *f)
...
@@ -201,14 +201,14 @@ static void frame_reset(struct frame *f)
static
struct
frame
*
frame_new
(
unsigned
int
frame_num
,
struct
video_card
*
video
)
static
struct
frame
*
frame_new
(
unsigned
int
frame_num
,
struct
video_card
*
video
)
{
{
struct
frame
*
f
=
kmalloc
(
sizeof
(
*
f
),
GFP_KERNEL
);
struct
frame
*
f
=
kmalloc
(
sizeof
(
*
f
),
GFP_KERNEL
);
if
(
!
f
)
if
(
!
f
)
return
NULL
;
return
NULL
;
f
->
video
=
video
;
f
->
video
=
video
;
f
->
frame_num
=
frame_num
;
f
->
frame_num
=
frame_num
;
f
->
header_pool
=
pci_alloc_consistent
(
f
->
video
->
ohci
->
dev
,
PAGE_SIZE
,
&
f
->
header_pool_dma
);
f
->
header_pool
=
pci_alloc_consistent
(
f
->
video
->
ohci
->
dev
,
PAGE_SIZE
,
&
f
->
header_pool_dma
);
if
(
!
f
->
header_pool
)
{
if
(
!
f
->
header_pool
)
{
printk
(
KERN_ERR
"dv1394: failed to allocate CIP header pool
\n
"
);
printk
(
KERN_ERR
"dv1394: failed to allocate CIP header pool
\n
"
);
kfree
(
f
);
kfree
(
f
);
return
NULL
;
return
NULL
;
...
@@ -224,7 +224,7 @@ static struct frame* frame_new(unsigned int frame_num, struct video_card *video)
...
@@ -224,7 +224,7 @@ static struct frame* frame_new(unsigned int frame_num, struct video_card *video)
f
->
descriptor_pool
=
pci_alloc_consistent
(
f
->
video
->
ohci
->
dev
,
f
->
descriptor_pool
=
pci_alloc_consistent
(
f
->
video
->
ohci
->
dev
,
f
->
descriptor_pool_size
,
f
->
descriptor_pool_size
,
&
f
->
descriptor_pool_dma
);
&
f
->
descriptor_pool_dma
);
if
(
!
f
->
descriptor_pool
)
{
if
(
!
f
->
descriptor_pool
)
{
pci_free_consistent
(
f
->
video
->
ohci
->
dev
,
PAGE_SIZE
,
f
->
header_pool
,
f
->
header_pool_dma
);
pci_free_consistent
(
f
->
video
->
ohci
->
dev
,
PAGE_SIZE
,
f
->
header_pool
,
f
->
header_pool_dma
);
kfree
(
f
);
kfree
(
f
);
return
NULL
;
return
NULL
;
...
@@ -284,12 +284,12 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -284,12 +284,12 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
if
(
video
->
pal_or_ntsc
==
DV1394_PAL
)
if
(
video
->
pal_or_ntsc
==
DV1394_PAL
)
packets_per_frame
=
DV1394_PAL_PACKETS_PER_FRAME
;
packets_per_frame
=
DV1394_PAL_PACKETS_PER_FRAME
;
else
else
packets_per_frame
=
DV1394_NTSC_PACKETS_PER_FRAME
;
packets_per_frame
=
DV1394_NTSC_PACKETS_PER_FRAME
;
while
(
full_packets
<
packets_per_frame
)
{
while
(
full_packets
<
packets_per_frame
)
{
empty_packet
=
first_packet
=
last_packet
=
mid_packet
=
0
;
empty_packet
=
first_packet
=
last_packet
=
mid_packet
=
0
;
data_p
=
f
->
data
+
full_packets
*
480
;
data_p
=
f
->
data
+
full_packets
*
480
;
...
@@ -300,7 +300,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -300,7 +300,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
/* note: these should NOT cross a page boundary (DMA restriction) */
/* note: these should NOT cross a page boundary (DMA restriction) */
if
(
f
->
n_packets
>=
MAX_PACKETS
)
{
if
(
f
->
n_packets
>=
MAX_PACKETS
)
{
printk
(
KERN_ERR
"dv1394: FATAL ERROR: max packet count exceeded
\n
"
);
printk
(
KERN_ERR
"dv1394: FATAL ERROR: max packet count exceeded
\n
"
);
return
;
return
;
}
}
...
@@ -316,7 +316,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -316,7 +316,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
/* the whole CIP pool fits on one page, so no worries about boundaries */
/* the whole CIP pool fits on one page, so no worries about boundaries */
if
(
((
unsigned
long
)
&
(
f
->
header_pool
[
f
->
n_packets
])
-
(
unsigned
long
)
f
->
header_pool
)
if
(
((
unsigned
long
)
&
(
f
->
header_pool
[
f
->
n_packets
])
-
(
unsigned
long
)
f
->
header_pool
)
>
PAGE_SIZE
)
{
>
PAGE_SIZE
)
{
printk
(
KERN_ERR
"dv1394: FATAL ERROR: no room to allocate CIP header
\n
"
);
printk
(
KERN_ERR
"dv1394: FATAL ERROR: no room to allocate CIP header
\n
"
);
return
;
return
;
...
@@ -331,7 +331,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -331,7 +331,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
/* is this an empty packet? */
/* is this an empty packet? */
if
(
video
->
cip_accum
>
(
video
->
cip_d
-
video
->
cip_n
))
{
if
(
video
->
cip_accum
>
(
video
->
cip_d
-
video
->
cip_n
))
{
empty_packet
=
1
;
empty_packet
=
1
;
payload_size
=
8
;
payload_size
=
8
;
video
->
cip_accum
-=
(
video
->
cip_d
-
video
->
cip_n
);
video
->
cip_accum
-=
(
video
->
cip_d
-
video
->
cip_n
);
...
@@ -364,7 +364,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -364,7 +364,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
the timestamp before DMA starts on the next frame.
the timestamp before DMA starts on the next frame.
*/
*/
if
(
f
->
n_packets
==
0
)
{
if
(
f
->
n_packets
==
0
)
{
first_packet
=
1
;
first_packet
=
1
;
}
else
if
(
full_packets
==
(
packets_per_frame
-
1
)
)
{
}
else
if
(
full_packets
==
(
packets_per_frame
-
1
)
)
{
last_packet
=
1
;
last_packet
=
1
;
...
@@ -383,12 +383,12 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -383,12 +383,12 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
need a timestamp. */
need a timestamp. */
/* first packet in the frame needs a timestamp */
/* first packet in the frame needs a timestamp */
if
(
first_packet
)
{
if
(
first_packet
)
{
f
->
cip_syt1
=
cip
;
f
->
cip_syt1
=
cip
;
if
(
empty_packet
)
if
(
empty_packet
)
first_packet_empty
=
1
;
first_packet_empty
=
1
;
}
else
if
(
first_packet_empty
&&
(
f
->
n_packets
==
1
)
)
{
}
else
if
(
first_packet_empty
&&
(
f
->
n_packets
==
1
)
)
{
/* if the first packet was empty, the second
/* if the first packet was empty, the second
packet's CIP header also needs a timestamp */
packet's CIP header also needs a timestamp */
f
->
cip_syt2
=
cip
;
f
->
cip_syt2
=
cip
;
...
@@ -402,7 +402,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -402,7 +402,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
0xFFFF
/* the timestamp is filled in later */
);
0xFFFF
/* the timestamp is filled in later */
);
/* advance counter, only for full packets */
/* advance counter, only for full packets */
if
(
!
empty_packet
)
if
(
!
empty_packet
)
video
->
continuity_counter
++
;
video
->
continuity_counter
++
;
/******************************/
/******************************/
...
@@ -412,7 +412,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -412,7 +412,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
/* first descriptor - OUTPUT_MORE_IMMEDIATE, for the controller's IT header */
/* first descriptor - OUTPUT_MORE_IMMEDIATE, for the controller's IT header */
fill_output_more_immediate
(
&
(
block
->
u
.
out
.
omi
),
1
,
video
->
channel
,
0
,
payload_size
);
fill_output_more_immediate
(
&
(
block
->
u
.
out
.
omi
),
1
,
video
->
channel
,
0
,
payload_size
);
if
(
empty_packet
)
{
if
(
empty_packet
)
{
/* second descriptor - OUTPUT_LAST for CIP header */
/* second descriptor - OUTPUT_LAST for CIP header */
fill_output_last
(
&
(
block
->
u
.
out
.
u
.
empty
.
ol
),
fill_output_last
(
&
(
block
->
u
.
out
.
u
.
empty
.
ol
),
...
@@ -425,18 +425,18 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -425,18 +425,18 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
sizeof
(
struct
CIP_header
),
/* data size */
sizeof
(
struct
CIP_header
),
/* data size */
cip_dma
);
cip_dma
);
if
(
first_packet
)
if
(
first_packet
)
f
->
frame_begin_timestamp
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
3
]);
f
->
frame_begin_timestamp
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
3
]);
else
if
(
mid_packet
)
else
if
(
mid_packet
)
f
->
mid_frame_timestamp
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
3
]);
f
->
mid_frame_timestamp
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
3
]);
else
if
(
last_packet
)
{
else
if
(
last_packet
)
{
f
->
frame_end_timestamp
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
3
]);
f
->
frame_end_timestamp
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
3
]);
f
->
frame_end_branch
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
2
]);
f
->
frame_end_branch
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
2
]);
}
}
branch_address
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
2
]);
branch_address
=
&
(
block
->
u
.
out
.
u
.
empty
.
ol
.
q
[
2
]);
n_descriptors
=
3
;
n_descriptors
=
3
;
if
(
first_packet
)
if
(
first_packet
)
f
->
first_n_descriptors
=
n_descriptors
;
f
->
first_n_descriptors
=
n_descriptors
;
}
else
{
/* full packet */
}
else
{
/* full packet */
...
@@ -452,7 +452,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -452,7 +452,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
we need to split it into two DMA descriptors */
we need to split it into two DMA descriptors */
/* does the 480-byte data payload cross a page boundary? */
/* does the 480-byte data payload cross a page boundary? */
if
(
(
PAGE_SIZE
-
((
unsigned
long
)
data_p
%
PAGE_SIZE
)
)
<
480
)
{
if
(
(
PAGE_SIZE
-
((
unsigned
long
)
data_p
%
PAGE_SIZE
)
)
<
480
)
{
/* page boundary crossed */
/* page boundary crossed */
...
@@ -479,11 +479,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -479,11 +479,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
dma_region_offset_to_bus
(
&
video
->
dv_buf
,
dma_region_offset_to_bus
(
&
video
->
dv_buf
,
data_p
+
PAGE_SIZE
-
(
data_p
%
PAGE_SIZE
)
-
(
unsigned
long
)
video
->
dv_buf
.
kvirt
));
data_p
+
PAGE_SIZE
-
(
data_p
%
PAGE_SIZE
)
-
(
unsigned
long
)
video
->
dv_buf
.
kvirt
));
if
(
first_packet
)
if
(
first_packet
)
f
->
frame_begin_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
3
]);
f
->
frame_begin_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
3
]);
else
if
(
mid_packet
)
else
if
(
mid_packet
)
f
->
mid_frame_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
3
]);
f
->
mid_frame_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
3
]);
else
if
(
last_packet
)
{
else
if
(
last_packet
)
{
f
->
frame_end_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
3
]);
f
->
frame_end_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
3
]);
f
->
frame_end_branch
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
2
]);
f
->
frame_end_branch
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
2
]);
}
}
...
@@ -491,7 +491,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -491,7 +491,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
branch_address
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
2
]);
branch_address
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
cross
.
ol
.
q
[
2
]);
n_descriptors
=
5
;
n_descriptors
=
5
;
if
(
first_packet
)
if
(
first_packet
)
f
->
first_n_descriptors
=
n_descriptors
;
f
->
first_n_descriptors
=
n_descriptors
;
full_packets
++
;
full_packets
++
;
...
@@ -514,11 +514,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -514,11 +514,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
dma_region_offset_to_bus
(
&
video
->
dv_buf
,
dma_region_offset_to_bus
(
&
video
->
dv_buf
,
data_p
-
(
unsigned
long
)
video
->
dv_buf
.
kvirt
));
data_p
-
(
unsigned
long
)
video
->
dv_buf
.
kvirt
));
if
(
first_packet
)
if
(
first_packet
)
f
->
frame_begin_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
3
]);
f
->
frame_begin_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
3
]);
else
if
(
mid_packet
)
else
if
(
mid_packet
)
f
->
mid_frame_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
3
]);
f
->
mid_frame_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
3
]);
else
if
(
last_packet
)
{
else
if
(
last_packet
)
{
f
->
frame_end_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
3
]);
f
->
frame_end_timestamp
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
3
]);
f
->
frame_end_branch
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
2
]);
f
->
frame_end_branch
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
2
]);
}
}
...
@@ -526,7 +526,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -526,7 +526,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
branch_address
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
2
]);
branch_address
=
&
(
block
->
u
.
out
.
u
.
full
.
u
.
nocross
.
ol
.
q
[
2
]);
n_descriptors
=
4
;
n_descriptors
=
4
;
if
(
first_packet
)
if
(
first_packet
)
f
->
first_n_descriptors
=
n_descriptors
;
f
->
first_n_descriptors
=
n_descriptors
;
full_packets
++
;
full_packets
++
;
...
@@ -538,7 +538,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -538,7 +538,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
/* note: we are not linked into the active DMA chain yet */
/* note: we are not linked into the active DMA chain yet */
if
(
last_branch_address
)
{
if
(
last_branch_address
)
{
*
(
last_branch_address
)
=
cpu_to_le32
(
block_dma
|
n_descriptors
);
*
(
last_branch_address
)
=
cpu_to_le32
(
block_dma
|
n_descriptors
);
}
}
...
@@ -564,7 +564,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -564,7 +564,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
video
->
n_clear_frames
--
;
video
->
n_clear_frames
--
;
last_frame
=
video
->
first_clear_frame
-
1
;
last_frame
=
video
->
first_clear_frame
-
1
;
if
(
last_frame
==
-
1
)
if
(
last_frame
==
-
1
)
last_frame
=
video
->
n_frames
-
1
;
last_frame
=
video
->
n_frames
-
1
;
video
->
first_clear_frame
=
(
video
->
first_clear_frame
+
1
)
%
video
->
n_frames
;
video
->
first_clear_frame
=
(
video
->
first_clear_frame
+
1
)
%
video
->
n_frames
;
...
@@ -578,11 +578,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -578,11 +578,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
(
unsigned
long
)
f
->
frame_end_timestamp
,
(
unsigned
long
)
f
->
frame_end_timestamp
,
(
unsigned
long
)
f
->
frame_end_branch
);
(
unsigned
long
)
f
->
frame_end_branch
);
if
(
video
->
active_frame
!=
-
1
)
{
if
(
video
->
active_frame
!=
-
1
)
{
/* if DMA is already active, we are almost done */
/* if DMA is already active, we are almost done */
/* just link us onto the active DMA chain */
/* just link us onto the active DMA chain */
if
(
video
->
frames
[
last_frame
]
->
frame_end_branch
)
{
if
(
video
->
frames
[
last_frame
]
->
frame_end_branch
)
{
u32
temp
;
u32
temp
;
/* point the previous frame's tail to this frame's head */
/* point the previous frame's tail to this frame's head */
...
@@ -650,11 +650,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -650,11 +650,11 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
f
->
assigned_timestamp
=
(
ts_cyc
&
0xF
)
<<
12
;
f
->
assigned_timestamp
=
(
ts_cyc
&
0xF
)
<<
12
;
/* now actually write the timestamp into the appropriate CIP headers */
/* now actually write the timestamp into the appropriate CIP headers */
if
(
f
->
cip_syt1
)
{
if
(
f
->
cip_syt1
)
{
f
->
cip_syt1
->
b
[
6
]
=
f
->
assigned_timestamp
>>
8
;
f
->
cip_syt1
->
b
[
6
]
=
f
->
assigned_timestamp
>>
8
;
f
->
cip_syt1
->
b
[
7
]
=
f
->
assigned_timestamp
&
0xFF
;
f
->
cip_syt1
->
b
[
7
]
=
f
->
assigned_timestamp
&
0xFF
;
}
}
if
(
f
->
cip_syt2
)
{
if
(
f
->
cip_syt2
)
{
f
->
cip_syt2
->
b
[
6
]
=
f
->
assigned_timestamp
>>
8
;
f
->
cip_syt2
->
b
[
6
]
=
f
->
assigned_timestamp
>>
8
;
f
->
cip_syt2
->
b
[
7
]
=
f
->
assigned_timestamp
&
0xFF
;
f
->
cip_syt2
->
b
[
7
]
=
f
->
assigned_timestamp
&
0xFF
;
}
}
...
@@ -706,10 +706,10 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -706,10 +706,10 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
{
{
/* check if DMA is really running */
/* check if DMA is really running */
int
i
=
0
;
int
i
=
0
;
while
(
i
<
20
)
{
while
(
i
<
20
)
{
mb
();
mb
();
mdelay
(
1
);
mdelay
(
1
);
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
(
1
<<
10
))
{
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
(
1
<<
10
))
{
printk
(
"DMA ACTIVE after %d msec
\n
"
,
i
);
printk
(
"DMA ACTIVE after %d msec
\n
"
,
i
);
break
;
break
;
}
}
...
@@ -721,7 +721,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
...
@@ -721,7 +721,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitCommandPtr
)
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitCommandPtr
)
);
);
if
(
!
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
(
1
<<
10
))
)
{
if
(
!
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
(
1
<<
10
))
)
{
printk
(
"DMA did NOT go active after 20ms, event = %x
\n
"
,
printk
(
"DMA did NOT go active after 20ms, event = %x
\n
"
,
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
0x1F
);
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
0x1F
);
}
else
}
else
...
@@ -821,14 +821,14 @@ static void start_dma_receive(struct video_card *video)
...
@@ -821,14 +821,14 @@ static void start_dma_receive(struct video_card *video)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
1000
;
++
i
)
{
for
(
i
=
0
;
i
<
1000
;
++
i
)
{
mdelay
(
1
);
mdelay
(
1
);
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
10
))
{
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
10
))
{
printk
(
"DMA ACTIVE after %d msec
\n
"
,
i
);
printk
(
"DMA ACTIVE after %d msec
\n
"
,
i
);
break
;
break
;
}
}
}
}
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
11
)
)
{
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
11
)
)
{
printk
(
"DEAD, event = %x
\n
"
,
printk
(
"DEAD, event = %x
\n
"
,
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
0x1F
);
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
0x1F
);
}
else
}
else
...
@@ -836,7 +836,7 @@ static void start_dma_receive(struct video_card *video)
...
@@ -836,7 +836,7 @@ static void start_dma_receive(struct video_card *video)
}
}
#endif
#endif
}
}
else
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
11
)
)
{
else
if
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
11
)
)
{
debug_printk
(
"DEAD, event = %x
\n
"
,
debug_printk
(
"DEAD, event = %x
\n
"
,
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
0x1F
);
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
0x1F
);
...
@@ -912,36 +912,36 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -912,36 +912,36 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
int
retval
=
-
EINVAL
;
int
retval
=
-
EINVAL
;
debug_printk
(
"dv1394: initialising %d
\n
"
,
video
->
id
);
debug_printk
(
"dv1394: initialising %d
\n
"
,
video
->
id
);
if
(
init
->
api_version
!=
DV1394_API_VERSION
)
if
(
init
->
api_version
!=
DV1394_API_VERSION
)
return
-
EINVAL
;
return
-
EINVAL
;
/* first sanitize all the parameters */
/* first sanitize all the parameters */
if
(
(
init
->
n_frames
<
2
)
||
(
init
->
n_frames
>
DV1394_MAX_FRAMES
)
)
if
(
(
init
->
n_frames
<
2
)
||
(
init
->
n_frames
>
DV1394_MAX_FRAMES
)
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
(
init
->
format
!=
DV1394_NTSC
)
&&
(
init
->
format
!=
DV1394_PAL
)
)
if
(
(
init
->
format
!=
DV1394_NTSC
)
&&
(
init
->
format
!=
DV1394_PAL
)
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
(
init
->
syt_offset
==
0
)
||
(
init
->
syt_offset
>
50
)
)
if
(
(
init
->
syt_offset
==
0
)
||
(
init
->
syt_offset
>
50
)
)
/* default SYT offset is 3 cycles */
/* default SYT offset is 3 cycles */
init
->
syt_offset
=
3
;
init
->
syt_offset
=
3
;
if
(
(
init
->
channel
>
63
)
||
(
init
->
channel
<
0
)
)
if
(
(
init
->
channel
>
63
)
||
(
init
->
channel
<
0
)
)
init
->
channel
=
63
;
init
->
channel
=
63
;
chan_mask
=
(
u64
)
1
<<
init
->
channel
;
chan_mask
=
(
u64
)
1
<<
init
->
channel
;
/* calculate what size DMA buffer is needed */
/* calculate what size DMA buffer is needed */
if
(
init
->
format
==
DV1394_NTSC
)
if
(
init
->
format
==
DV1394_NTSC
)
new_buf_size
=
DV1394_NTSC_FRAME_SIZE
*
init
->
n_frames
;
new_buf_size
=
DV1394_NTSC_FRAME_SIZE
*
init
->
n_frames
;
else
else
new_buf_size
=
DV1394_PAL_FRAME_SIZE
*
init
->
n_frames
;
new_buf_size
=
DV1394_PAL_FRAME_SIZE
*
init
->
n_frames
;
/* round up to PAGE_SIZE */
/* round up to PAGE_SIZE */
if
(
new_buf_size
%
PAGE_SIZE
)
new_buf_size
+=
PAGE_SIZE
-
(
new_buf_size
%
PAGE_SIZE
);
if
(
new_buf_size
%
PAGE_SIZE
)
new_buf_size
+=
PAGE_SIZE
-
(
new_buf_size
%
PAGE_SIZE
);
/* don't allow the user to allocate the DMA buffer more than once */
/* don't allow the user to allocate the DMA buffer more than once */
if
(
video
->
dv_buf
.
kvirt
&&
video
->
dv_buf_size
!=
new_buf_size
)
{
if
(
video
->
dv_buf
.
kvirt
&&
video
->
dv_buf_size
!=
new_buf_size
)
{
printk
(
"dv1394: re-sizing the DMA buffer is not allowed
\n
"
);
printk
(
"dv1394: re-sizing the DMA buffer is not allowed
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -953,7 +953,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -953,7 +953,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
/* try to claim the ISO channel */
/* try to claim the ISO channel */
spin_lock_irqsave
(
&
video
->
ohci
->
IR_channel_lock
,
flags
);
spin_lock_irqsave
(
&
video
->
ohci
->
IR_channel_lock
,
flags
);
if
(
video
->
ohci
->
ISO_channel_usage
&
chan_mask
)
{
if
(
video
->
ohci
->
ISO_channel_usage
&
chan_mask
)
{
spin_unlock_irqrestore
(
&
video
->
ohci
->
IR_channel_lock
,
flags
);
spin_unlock_irqrestore
(
&
video
->
ohci
->
IR_channel_lock
,
flags
);
retval
=
-
EBUSY
;
retval
=
-
EBUSY
;
goto
err
;
goto
err
;
...
@@ -981,7 +981,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -981,7 +981,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
video
->
current_packet
=
-
1
;
video
->
current_packet
=
-
1
;
video
->
first_frame
=
0
;
video
->
first_frame
=
0
;
if
(
video
->
pal_or_ntsc
==
DV1394_NTSC
)
{
if
(
video
->
pal_or_ntsc
==
DV1394_NTSC
)
{
video
->
cip_n
=
init
->
cip_n
!=
0
?
init
->
cip_n
:
CIP_N_NTSC
;
video
->
cip_n
=
init
->
cip_n
!=
0
?
init
->
cip_n
:
CIP_N_NTSC
;
video
->
cip_d
=
init
->
cip_d
!=
0
?
init
->
cip_d
:
CIP_D_NTSC
;
video
->
cip_d
=
init
->
cip_d
!=
0
?
init
->
cip_d
:
CIP_D_NTSC
;
video
->
frame_size
=
DV1394_NTSC_FRAME_SIZE
;
video
->
frame_size
=
DV1394_NTSC_FRAME_SIZE
;
...
@@ -995,7 +995,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -995,7 +995,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
/* find and claim DMA contexts on the OHCI card */
/* find and claim DMA contexts on the OHCI card */
if
(
video
->
ohci_it_ctx
==
-
1
)
{
if
(
video
->
ohci_it_ctx
==
-
1
)
{
ohci1394_init_iso_tasklet
(
&
video
->
it_tasklet
,
OHCI_ISO_TRANSMIT
,
ohci1394_init_iso_tasklet
(
&
video
->
it_tasklet
,
OHCI_ISO_TRANSMIT
,
it_tasklet_func
,
(
unsigned
long
)
video
);
it_tasklet_func
,
(
unsigned
long
)
video
);
...
@@ -1009,7 +1009,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -1009,7 +1009,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
debug_printk
(
"dv1394: claimed IT DMA context %d
\n
"
,
video
->
ohci_it_ctx
);
debug_printk
(
"dv1394: claimed IT DMA context %d
\n
"
,
video
->
ohci_it_ctx
);
}
}
if
(
video
->
ohci_ir_ctx
==
-
1
)
{
if
(
video
->
ohci_ir_ctx
==
-
1
)
{
ohci1394_init_iso_tasklet
(
&
video
->
ir_tasklet
,
OHCI_ISO_RECEIVE
,
ohci1394_init_iso_tasklet
(
&
video
->
ir_tasklet
,
OHCI_ISO_RECEIVE
,
ir_tasklet_func
,
(
unsigned
long
)
video
);
ir_tasklet_func
,
(
unsigned
long
)
video
);
...
@@ -1023,20 +1023,20 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -1023,20 +1023,20 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
}
}
/* allocate struct frames */
/* allocate struct frames */
for
(
i
=
0
;
i
<
init
->
n_frames
;
i
++
)
{
for
(
i
=
0
;
i
<
init
->
n_frames
;
i
++
)
{
video
->
frames
[
i
]
=
frame_new
(
i
,
video
);
video
->
frames
[
i
]
=
frame_new
(
i
,
video
);
if
(
!
video
->
frames
[
i
])
{
if
(
!
video
->
frames
[
i
])
{
printk
(
KERN_ERR
"dv1394: Cannot allocate frame structs
\n
"
);
printk
(
KERN_ERR
"dv1394: Cannot allocate frame structs
\n
"
);
retval
=
-
ENOMEM
;
retval
=
-
ENOMEM
;
goto
err
;
goto
err
;
}
}
}
}
if
(
!
video
->
dv_buf
.
kvirt
)
{
if
(
!
video
->
dv_buf
.
kvirt
)
{
/* allocate the ringbuffer */
/* allocate the ringbuffer */
retval
=
dma_region_alloc
(
&
video
->
dv_buf
,
new_buf_size
,
video
->
ohci
->
dev
,
PCI_DMA_TODEVICE
);
retval
=
dma_region_alloc
(
&
video
->
dv_buf
,
new_buf_size
,
video
->
ohci
->
dev
,
PCI_DMA_TODEVICE
);
if
(
retval
)
if
(
retval
)
goto
err
;
goto
err
;
video
->
dv_buf_size
=
new_buf_size
;
video
->
dv_buf_size
=
new_buf_size
;
...
@@ -1047,10 +1047,10 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -1047,10 +1047,10 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
}
}
/* set up the frame->data pointers */
/* set up the frame->data pointers */
for
(
i
=
0
;
i
<
video
->
n_frames
;
i
++
)
for
(
i
=
0
;
i
<
video
->
n_frames
;
i
++
)
video
->
frames
[
i
]
->
data
=
(
unsigned
long
)
video
->
dv_buf
.
kvirt
+
i
*
video
->
frame_size
;
video
->
frames
[
i
]
->
data
=
(
unsigned
long
)
video
->
dv_buf
.
kvirt
+
i
*
video
->
frame_size
;
if
(
!
video
->
packet_buf
.
kvirt
)
{
if
(
!
video
->
packet_buf
.
kvirt
)
{
/* allocate packet buffer */
/* allocate packet buffer */
video
->
packet_buf_size
=
sizeof
(
struct
packet
)
*
video
->
n_frames
*
MAX_PACKETS
;
video
->
packet_buf_size
=
sizeof
(
struct
packet
)
*
video
->
n_frames
*
MAX_PACKETS
;
if
(
video
->
packet_buf_size
%
PAGE_SIZE
)
if
(
video
->
packet_buf_size
%
PAGE_SIZE
)
...
@@ -1058,7 +1058,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
...
@@ -1058,7 +1058,7 @@ static int do_dv1394_init(struct video_card *video, struct dv1394_init *init)
retval
=
dma_region_alloc
(
&
video
->
packet_buf
,
video
->
packet_buf_size
,
retval
=
dma_region_alloc
(
&
video
->
packet_buf
,
video
->
packet_buf_size
,
video
->
ohci
->
dev
,
PCI_DMA_FROMDEVICE
);
video
->
ohci
->
dev
,
PCI_DMA_FROMDEVICE
);
if
(
retval
)
if
(
retval
)
goto
err
;
goto
err
;
debug_printk
(
"dv1394: Allocated %d packets in buffer, total %u pages (%u DMA pages), %lu bytes
\n
"
,
debug_printk
(
"dv1394: Allocated %d packets in buffer, total %u pages (%u DMA pages), %lu bytes
\n
"
,
...
@@ -1124,11 +1124,11 @@ static void stop_dma(struct video_card *video)
...
@@ -1124,11 +1124,11 @@ static void stop_dma(struct video_card *video)
video
->
dma_running
=
0
;
video
->
dma_running
=
0
;
if
(
(
video
->
ohci_it_ctx
==
-
1
)
&&
(
video
->
ohci_ir_ctx
==
-
1
)
)
if
(
(
video
->
ohci_it_ctx
==
-
1
)
&&
(
video
->
ohci_ir_ctx
==
-
1
)
)
goto
out
;
goto
out
;
/* stop DMA if in progress */
/* stop DMA if in progress */
if
(
(
video
->
active_frame
!=
-
1
)
||
if
(
(
video
->
active_frame
!=
-
1
)
||
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlClear
)
&
(
1
<<
10
))
||
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlClear
)
&
(
1
<<
10
))
||
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlClear
)
&
(
1
<<
10
))
)
{
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlClear
)
&
(
1
<<
10
))
)
{
...
@@ -1142,12 +1142,12 @@ static void stop_dma(struct video_card *video)
...
@@ -1142,12 +1142,12 @@ static void stop_dma(struct video_card *video)
/* wait until DMA really stops */
/* wait until DMA really stops */
i
=
0
;
i
=
0
;
while
(
i
<
1000
)
{
while
(
i
<
1000
)
{
/* wait 0.1 millisecond */
/* wait 0.1 millisecond */
udelay
(
100
);
udelay
(
100
);
if
(
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlClear
)
&
(
1
<<
10
))
||
if
(
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlClear
)
&
(
1
<<
10
))
||
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlClear
)
&
(
1
<<
10
))
)
{
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlClear
)
&
(
1
<<
10
))
)
{
/* still active */
/* still active */
debug_printk
(
"dv1394: stop_dma: DMA not stopped yet
\n
"
);
debug_printk
(
"dv1394: stop_dma: DMA not stopped yet
\n
"
);
...
@@ -1160,7 +1160,7 @@ static void stop_dma(struct video_card *video)
...
@@ -1160,7 +1160,7 @@ static void stop_dma(struct video_card *video)
i
++
;
i
++
;
}
}
if
(
i
==
1000
)
{
if
(
i
==
1000
)
{
printk
(
KERN_ERR
"dv1394: stop_dma: DMA still going after %d ms!
\n
"
,
i
/
10
);
printk
(
KERN_ERR
"dv1394: stop_dma: DMA still going after %d ms!
\n
"
,
i
/
10
);
}
}
}
}
...
@@ -1183,7 +1183,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
...
@@ -1183,7 +1183,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
stop_dma
(
video
);
stop_dma
(
video
);
/* release the DMA contexts */
/* release the DMA contexts */
if
(
video
->
ohci_it_ctx
!=
-
1
)
{
if
(
video
->
ohci_it_ctx
!=
-
1
)
{
video
->
ohci_IsoXmitContextControlSet
=
0
;
video
->
ohci_IsoXmitContextControlSet
=
0
;
video
->
ohci_IsoXmitContextControlClear
=
0
;
video
->
ohci_IsoXmitContextControlClear
=
0
;
video
->
ohci_IsoXmitCommandPtr
=
0
;
video
->
ohci_IsoXmitCommandPtr
=
0
;
...
@@ -1197,7 +1197,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
...
@@ -1197,7 +1197,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
video
->
ohci_it_ctx
=
-
1
;
video
->
ohci_it_ctx
=
-
1
;
}
}
if
(
video
->
ohci_ir_ctx
!=
-
1
)
{
if
(
video
->
ohci_ir_ctx
!=
-
1
)
{
video
->
ohci_IsoRcvContextControlSet
=
0
;
video
->
ohci_IsoRcvContextControlSet
=
0
;
video
->
ohci_IsoRcvContextControlClear
=
0
;
video
->
ohci_IsoRcvContextControlClear
=
0
;
video
->
ohci_IsoRcvCommandPtr
=
0
;
video
->
ohci_IsoRcvCommandPtr
=
0
;
...
@@ -1213,7 +1213,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
...
@@ -1213,7 +1213,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
}
}
/* release the ISO channel */
/* release the ISO channel */
if
(
video
->
channel
!=
-
1
)
{
if
(
video
->
channel
!=
-
1
)
{
u64
chan_mask
;
u64
chan_mask
;
unsigned
long
flags
;
unsigned
long
flags
;
...
@@ -1227,8 +1227,8 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
...
@@ -1227,8 +1227,8 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
}
}
/* free the frame structs */
/* free the frame structs */
for
(
i
=
0
;
i
<
DV1394_MAX_FRAMES
;
i
++
)
{
for
(
i
=
0
;
i
<
DV1394_MAX_FRAMES
;
i
++
)
{
if
(
video
->
frames
[
i
])
if
(
video
->
frames
[
i
])
frame_delete
(
video
->
frames
[
i
]);
frame_delete
(
video
->
frames
[
i
]);
video
->
frames
[
i
]
=
NULL
;
video
->
frames
[
i
]
=
NULL
;
}
}
...
@@ -1238,7 +1238,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
...
@@ -1238,7 +1238,7 @@ static void do_dv1394_shutdown(struct video_card *video, int free_dv_buf)
/* we can't free the DMA buffer unless it is guaranteed that
/* we can't free the DMA buffer unless it is guaranteed that
no more user-space mappings exist */
no more user-space mappings exist */
if
(
free_dv_buf
)
{
if
(
free_dv_buf
)
{
dma_region_free
(
&
video
->
dv_buf
);
dma_region_free
(
&
video
->
dv_buf
);
video
->
dv_buf_size
=
0
;
video
->
dv_buf_size
=
0
;
}
}
...
@@ -1282,9 +1282,9 @@ int dv1394_mmap(struct file *file, struct vm_area_struct *vma)
...
@@ -1282,9 +1282,9 @@ int dv1394_mmap(struct file *file, struct vm_area_struct *vma)
/* serialize mmap */
/* serialize mmap */
down
(
&
video
->
sem
);
down
(
&
video
->
sem
);
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
retval
=
do_dv1394_init_default
(
video
);
retval
=
do_dv1394_init_default
(
video
);
if
(
retval
)
if
(
retval
)
goto
out
;
goto
out
;
}
}
...
@@ -1306,14 +1306,14 @@ static unsigned int dv1394_poll(struct file *file, struct poll_table_struct *wai
...
@@ -1306,14 +1306,14 @@ static unsigned int dv1394_poll(struct file *file, struct poll_table_struct *wai
poll_wait
(
file
,
&
video
->
waitq
,
wait
);
poll_wait
(
file
,
&
video
->
waitq
,
wait
);
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
if
(
video
->
n_frames
==
0
)
{
if
(
video
->
n_frames
==
0
)
{
}
else
if
(
video
->
active_frame
==
-
1
)
{
}
else
if
(
video
->
active_frame
==
-
1
)
{
/* nothing going on */
/* nothing going on */
mask
|=
POLLOUT
;
mask
|=
POLLOUT
;
}
else
{
}
else
{
/* any clear/ready buffers? */
/* any clear/ready buffers? */
if
(
video
->
n_clear_frames
>
0
)
if
(
video
->
n_clear_frames
>
0
)
mask
|=
POLLOUT
|
POLLIN
;
mask
|=
POLLOUT
|
POLLIN
;
}
}
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
...
@@ -1345,17 +1345,17 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
...
@@ -1345,17 +1345,17 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
int
target_frame
;
int
target_frame
;
/* serialize this to prevent multi-threaded mayhem */
/* serialize this to prevent multi-threaded mayhem */
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
down_trylock
(
&
video
->
sem
))
if
(
down_trylock
(
&
video
->
sem
))
return
-
EAGAIN
;
return
-
EAGAIN
;
}
else
{
}
else
{
if
(
down_interruptible
(
&
video
->
sem
))
if
(
down_interruptible
(
&
video
->
sem
))
return
-
ERESTARTSYS
;
return
-
ERESTARTSYS
;
}
}
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
ret
=
do_dv1394_init_default
(
video
);
ret
=
do_dv1394_init_default
(
video
);
if
(
ret
)
{
if
(
ret
)
{
up
(
&
video
->
sem
);
up
(
&
video
->
sem
);
return
ret
;
return
ret
;
}
}
...
@@ -1364,7 +1364,7 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
...
@@ -1364,7 +1364,7 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
ret
=
0
;
ret
=
0
;
add_wait_queue
(
&
video
->
waitq
,
&
wait
);
add_wait_queue
(
&
video
->
waitq
,
&
wait
);
while
(
count
>
0
)
{
while
(
count
>
0
)
{
/* must set TASK_INTERRUPTIBLE *before* checking for free
/* must set TASK_INTERRUPTIBLE *before* checking for free
buffers; otherwise we could miss a wakeup if the interrupt
buffers; otherwise we could miss a wakeup if the interrupt
...
@@ -1378,7 +1378,7 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
...
@@ -1378,7 +1378,7 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
if
(
video
->
frames
[
target_frame
]
->
state
==
FRAME_CLEAR
)
{
if
(
video
->
frames
[
target_frame
]
->
state
==
FRAME_CLEAR
)
{
/* how much room is left in the target frame buffer */
/* how much room is left in the target frame buffer */
cnt
=
video
->
frame_size
-
(
video
->
write_off
-
target_frame
*
video
->
frame_size
);
cnt
=
video
->
frame_size
-
(
video
->
write_off
-
target_frame
*
video
->
frame_size
);
...
@@ -1388,12 +1388,12 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
...
@@ -1388,12 +1388,12 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
cnt
=
0
;
cnt
=
0
;
}
}
if
(
cnt
>
count
)
if
(
cnt
>
count
)
cnt
=
count
;
cnt
=
count
;
if
(
cnt
<=
0
)
{
if
(
cnt
<=
0
)
{
/* no room left, gotta wait */
/* no room left, gotta wait */
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
!
ret
)
if
(
!
ret
)
ret
=
-
EAGAIN
;
ret
=
-
EAGAIN
;
break
;
break
;
...
@@ -1409,8 +1409,8 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
...
@@ -1409,8 +1409,8 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
continue
;
/* start over from 'while(count > 0)...' */
continue
;
/* start over from 'while(count > 0)...' */
}
}
if
(
copy_from_user
(
video
->
dv_buf
.
kvirt
+
video
->
write_off
,
buffer
,
cnt
))
{
if
(
copy_from_user
(
video
->
dv_buf
.
kvirt
+
video
->
write_off
,
buffer
,
cnt
))
{
if
(
!
ret
)
if
(
!
ret
)
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
}
}
...
@@ -1421,7 +1421,7 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
...
@@ -1421,7 +1421,7 @@ static ssize_t dv1394_write(struct file *file, const char *buffer, size_t count,
buffer
+=
cnt
;
buffer
+=
cnt
;
ret
+=
cnt
;
ret
+=
cnt
;
if
(
video
->
write_off
==
video
->
frame_size
*
((
target_frame
+
1
)
%
video
->
n_frames
))
if
(
video
->
write_off
==
video
->
frame_size
*
((
target_frame
+
1
)
%
video
->
n_frames
))
frame_prepare
(
video
,
target_frame
);
frame_prepare
(
video
,
target_frame
);
}
}
...
@@ -1442,17 +1442,17 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
...
@@ -1442,17 +1442,17 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
int
target_frame
;
int
target_frame
;
/* serialize this to prevent multi-threaded mayhem */
/* serialize this to prevent multi-threaded mayhem */
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
down_trylock
(
&
video
->
sem
))
if
(
down_trylock
(
&
video
->
sem
))
return
-
EAGAIN
;
return
-
EAGAIN
;
}
else
{
}
else
{
if
(
down_interruptible
(
&
video
->
sem
))
if
(
down_interruptible
(
&
video
->
sem
))
return
-
ERESTARTSYS
;
return
-
ERESTARTSYS
;
}
}
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
ret
=
do_dv1394_init_default
(
video
);
ret
=
do_dv1394_init_default
(
video
);
if
(
ret
)
{
if
(
ret
)
{
up
(
&
video
->
sem
);
up
(
&
video
->
sem
);
return
ret
;
return
ret
;
}
}
...
@@ -1466,7 +1466,7 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
...
@@ -1466,7 +1466,7 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
ret
=
0
;
ret
=
0
;
add_wait_queue
(
&
video
->
waitq
,
&
wait
);
add_wait_queue
(
&
video
->
waitq
,
&
wait
);
while
(
count
>
0
)
{
while
(
count
>
0
)
{
/* must set TASK_INTERRUPTIBLE *before* checking for free
/* must set TASK_INTERRUPTIBLE *before* checking for free
buffers; otherwise we could miss a wakeup if the interrupt
buffers; otherwise we could miss a wakeup if the interrupt
...
@@ -1480,7 +1480,7 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
...
@@ -1480,7 +1480,7 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
if
(
target_frame
>=
0
&&
if
(
target_frame
>=
0
&&
video
->
n_clear_frames
>
0
&&
video
->
n_clear_frames
>
0
&&
video
->
frames
[
target_frame
]
->
state
==
FRAME_CLEAR
)
{
video
->
frames
[
target_frame
]
->
state
==
FRAME_CLEAR
)
{
...
@@ -1492,12 +1492,12 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
...
@@ -1492,12 +1492,12 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
cnt
=
0
;
cnt
=
0
;
}
}
if
(
cnt
>
count
)
if
(
cnt
>
count
)
cnt
=
count
;
cnt
=
count
;
if
(
cnt
<=
0
)
{
if
(
cnt
<=
0
)
{
/* no room left, gotta wait */
/* no room left, gotta wait */
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
!
ret
)
if
(
!
ret
)
ret
=
-
EAGAIN
;
ret
=
-
EAGAIN
;
break
;
break
;
...
@@ -1513,8 +1513,8 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
...
@@ -1513,8 +1513,8 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
continue
;
/* start over from 'while(count > 0)...' */
continue
;
/* start over from 'while(count > 0)...' */
}
}
if
(
copy_to_user
(
buffer
,
video
->
dv_buf
.
kvirt
+
video
->
write_off
,
cnt
))
{
if
(
copy_to_user
(
buffer
,
video
->
dv_buf
.
kvirt
+
video
->
write_off
,
cnt
))
{
if
(
!
ret
)
if
(
!
ret
)
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
}
}
...
@@ -1525,7 +1525,7 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
...
@@ -1525,7 +1525,7 @@ static ssize_t dv1394_read(struct file *file, char *buffer, size_t count, loff_
buffer
+=
cnt
;
buffer
+=
cnt
;
ret
+=
cnt
;
ret
+=
cnt
;
if
(
video
->
write_off
==
video
->
frame_size
*
((
target_frame
+
1
)
%
video
->
n_frames
))
{
if
(
video
->
write_off
==
video
->
frame_size
*
((
target_frame
+
1
)
%
video
->
n_frames
))
{
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
video
->
n_clear_frames
--
;
video
->
n_clear_frames
--
;
video
->
first_clear_frame
=
(
video
->
first_clear_frame
+
1
)
%
video
->
n_frames
;
video
->
first_clear_frame
=
(
video
->
first_clear_frame
+
1
)
%
video
->
n_frames
;
...
@@ -1555,11 +1555,11 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1555,11 +1555,11 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
DECLARE_WAITQUEUE
(
wait
,
current
);
DECLARE_WAITQUEUE
(
wait
,
current
);
/* serialize this to prevent multi-threaded mayhem */
/* serialize this to prevent multi-threaded mayhem */
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
file
->
f_flags
&
O_NONBLOCK
)
{
if
(
down_trylock
(
&
video
->
sem
))
if
(
down_trylock
(
&
video
->
sem
))
return
-
EAGAIN
;
return
-
EAGAIN
;
}
else
{
}
else
{
if
(
down_interruptible
(
&
video
->
sem
))
if
(
down_interruptible
(
&
video
->
sem
))
return
-
ERESTARTSYS
;
return
-
ERESTARTSYS
;
}
}
...
@@ -1568,20 +1568,20 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1568,20 +1568,20 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
case
DV1394_IOC_SUBMIT_FRAMES
:
{
case
DV1394_IOC_SUBMIT_FRAMES
:
{
unsigned
int
n_submit
;
unsigned
int
n_submit
;
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
ret
=
do_dv1394_init_default
(
video
);
ret
=
do_dv1394_init_default
(
video
);
if
(
ret
)
if
(
ret
)
goto
out
;
goto
out
;
}
}
n_submit
=
(
unsigned
int
)
arg
;
n_submit
=
(
unsigned
int
)
arg
;
if
(
n_submit
>
video
->
n_frames
)
{
if
(
n_submit
>
video
->
n_frames
)
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
}
}
while
(
n_submit
>
0
)
{
while
(
n_submit
>
0
)
{
add_wait_queue
(
&
video
->
waitq
,
&
wait
);
add_wait_queue
(
&
video
->
waitq
,
&
wait
);
set_current_state
(
TASK_INTERRUPTIBLE
);
set_current_state
(
TASK_INTERRUPTIBLE
);
...
@@ -1589,11 +1589,11 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1589,11 +1589,11 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
/* wait until video->first_clear_frame is really CLEAR */
/* wait until video->first_clear_frame is really CLEAR */
while
(
video
->
frames
[
video
->
first_clear_frame
]
->
state
!=
FRAME_CLEAR
)
{
while
(
video
->
frames
[
video
->
first_clear_frame
]
->
state
!=
FRAME_CLEAR
)
{
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
if
(
signal_pending
(
current
))
{
if
(
signal_pending
(
current
))
{
remove_wait_queue
(
&
video
->
waitq
,
&
wait
);
remove_wait_queue
(
&
video
->
waitq
,
&
wait
);
set_current_state
(
TASK_RUNNING
);
set_current_state
(
TASK_RUNNING
);
ret
=
-
EINTR
;
ret
=
-
EINTR
;
...
@@ -1622,7 +1622,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1622,7 +1622,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
case
DV1394_IOC_WAIT_FRAMES
:
{
case
DV1394_IOC_WAIT_FRAMES
:
{
unsigned
int
n_wait
;
unsigned
int
n_wait
;
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
}
}
...
@@ -1633,7 +1633,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1633,7 +1633,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
never actually have n_frames clear frames; at most only
never actually have n_frames clear frames; at most only
n_frames - 1 */
n_frames - 1 */
if
(
n_wait
>
(
video
->
n_frames
-
1
)
)
{
if
(
n_wait
>
(
video
->
n_frames
-
1
)
)
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
}
}
...
@@ -1643,11 +1643,11 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1643,11 +1643,11 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
while
(
video
->
n_clear_frames
<
n_wait
)
{
while
(
video
->
n_clear_frames
<
n_wait
)
{
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
if
(
signal_pending
(
current
))
{
if
(
signal_pending
(
current
))
{
remove_wait_queue
(
&
video
->
waitq
,
&
wait
);
remove_wait_queue
(
&
video
->
waitq
,
&
wait
);
set_current_state
(
TASK_RUNNING
);
set_current_state
(
TASK_RUNNING
);
ret
=
-
EINTR
;
ret
=
-
EINTR
;
...
@@ -1671,7 +1671,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1671,7 +1671,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
case
DV1394_IOC_RECEIVE_FRAMES
:
{
case
DV1394_IOC_RECEIVE_FRAMES
:
{
unsigned
int
n_recv
;
unsigned
int
n_recv
;
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
}
}
...
@@ -1679,7 +1679,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1679,7 +1679,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
n_recv
=
(
unsigned
int
)
arg
;
n_recv
=
(
unsigned
int
)
arg
;
/* at least one frame must be active */
/* at least one frame must be active */
if
(
n_recv
>
(
video
->
n_frames
-
1
)
)
{
if
(
n_recv
>
(
video
->
n_frames
-
1
)
)
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
}
}
...
@@ -1702,9 +1702,9 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1702,9 +1702,9 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
}
}
case
DV1394_IOC_START_RECEIVE
:
{
case
DV1394_IOC_START_RECEIVE
:
{
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
ret
=
do_dv1394_init_default
(
video
);
ret
=
do_dv1394_init_default
(
video
);
if
(
ret
)
if
(
ret
)
goto
out
;
goto
out
;
}
}
...
@@ -1720,10 +1720,10 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1720,10 +1720,10 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
case
DV1394_IOC_INIT
:
{
case
DV1394_IOC_INIT
:
{
struct
dv1394_init
init
;
struct
dv1394_init
init
;
if
(
arg
==
(
unsigned
long
)
NULL
)
{
if
(
arg
==
(
unsigned
long
)
NULL
)
{
ret
=
do_dv1394_init_default
(
video
);
ret
=
do_dv1394_init_default
(
video
);
}
else
{
}
else
{
if
(
copy_from_user
(
&
init
,
(
void
*
)
arg
,
sizeof
(
init
)))
{
if
(
copy_from_user
(
&
init
,
(
void
*
)
arg
,
sizeof
(
init
)))
{
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
goto
out
;
goto
out
;
}
}
...
@@ -1741,7 +1741,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1741,7 +1741,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
case
DV1394_IOC_GET_STATUS
:
{
case
DV1394_IOC_GET_STATUS
:
{
struct
dv1394_status
status
;
struct
dv1394_status
status
;
if
(
!
video_card_initialized
(
video
)
)
{
if
(
!
video_card_initialized
(
video
)
)
{
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
}
}
...
@@ -1769,7 +1769,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1769,7 +1769,7 @@ static int dv1394_ioctl(struct inode *inode, struct file *file,
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
spin_unlock_irqrestore
(
&
video
->
spinlock
,
flags
);
if
(
copy_to_user
((
void
*
)
arg
,
&
status
,
sizeof
(
status
)))
{
if
(
copy_to_user
((
void
*
)
arg
,
&
status
,
sizeof
(
status
)))
{
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
goto
out
;
goto
out
;
}
}
...
@@ -1797,7 +1797,7 @@ static int dv1394_open(struct inode *inode, struct file *file)
...
@@ -1797,7 +1797,7 @@ static int dv1394_open(struct inode *inode, struct file *file)
/* if the device was opened through devfs, then file->private_data
/* if the device was opened through devfs, then file->private_data
has already been set to video by devfs */
has already been set to video by devfs */
if
(
file
->
private_data
)
{
if
(
file
->
private_data
)
{
video
=
(
struct
video_card
*
)
file
->
private_data
;
video
=
(
struct
video_card
*
)
file
->
private_data
;
}
else
{
}
else
{
...
@@ -1807,11 +1807,11 @@ static int dv1394_open(struct inode *inode, struct file *file)
...
@@ -1807,11 +1807,11 @@ static int dv1394_open(struct inode *inode, struct file *file)
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
dv1394_cards_lock
,
flags
);
spin_lock_irqsave
(
&
dv1394_cards_lock
,
flags
);
if
(
!
list_empty
(
&
dv1394_cards
))
{
if
(
!
list_empty
(
&
dv1394_cards
))
{
struct
video_card
*
p
;
struct
video_card
*
p
;
list_for_each
(
lh
,
&
dv1394_cards
)
{
list_for_each
(
lh
,
&
dv1394_cards
)
{
p
=
list_entry
(
lh
,
struct
video_card
,
list
);
p
=
list_entry
(
lh
,
struct
video_card
,
list
);
if
((
p
->
id
)
==
ieee1394_file_to_instance
(
file
))
{
if
((
p
->
id
)
==
ieee1394_file_to_instance
(
file
))
{
video
=
p
;
video
=
p
;
break
;
break
;
}
}
...
@@ -1819,7 +1819,7 @@ static int dv1394_open(struct inode *inode, struct file *file)
...
@@ -1819,7 +1819,7 @@ static int dv1394_open(struct inode *inode, struct file *file)
}
}
spin_unlock_irqrestore
(
&
dv1394_cards_lock
,
flags
);
spin_unlock_irqrestore
(
&
dv1394_cards_lock
,
flags
);
if
(
!
video
)
{
if
(
!
video
)
{
debug_printk
(
"dv1394: OHCI card %d not found"
,
ieee1394_file_to_instance
(
file
));
debug_printk
(
"dv1394: OHCI card %d not found"
,
ieee1394_file_to_instance
(
file
));
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
@@ -1829,7 +1829,7 @@ static int dv1394_open(struct inode *inode, struct file *file)
...
@@ -1829,7 +1829,7 @@ static int dv1394_open(struct inode *inode, struct file *file)
#ifndef DV1394_ALLOW_MORE_THAN_ONE_OPEN
#ifndef DV1394_ALLOW_MORE_THAN_ONE_OPEN
if
(
test_and_set_bit
(
0
,
&
video
->
open
)
)
{
if
(
test_and_set_bit
(
0
,
&
video
->
open
)
)
{
/* video is already open by someone else */
/* video is already open by someone else */
return
-
EBUSY
;
return
-
EBUSY
;
}
}
...
@@ -1971,10 +1971,10 @@ dv1394_procfs_find( char *name)
...
@@ -1971,10 +1971,10 @@ dv1394_procfs_find( char *name)
struct
dv1394_procfs_entry
*
p
;
struct
dv1394_procfs_entry
*
p
;
spin_lock
(
&
dv1394_procfs_lock
);
spin_lock
(
&
dv1394_procfs_lock
);
if
(
!
list_empty
(
&
dv1394_procfs
))
{
if
(
!
list_empty
(
&
dv1394_procfs
))
{
list_for_each
(
lh
,
&
dv1394_procfs
)
{
list_for_each
(
lh
,
&
dv1394_procfs
)
{
p
=
list_entry
(
lh
,
struct
dv1394_procfs_entry
,
list
);
p
=
list_entry
(
lh
,
struct
dv1394_procfs_entry
,
list
);
if
(
!
strncmp
(
p
->
name
,
name
,
sizeof
(
p
->
name
)))
{
if
(
!
strncmp
(
p
->
name
,
name
,
sizeof
(
p
->
name
)))
{
spin_unlock
(
&
dv1394_procfs_lock
);
spin_unlock
(
&
dv1394_procfs_lock
);
return
p
;
return
p
;
}
}
...
@@ -1991,7 +1991,7 @@ static int dv1394_procfs_add_entry(struct video_card *video)
...
@@ -1991,7 +1991,7 @@ static int dv1394_procfs_add_entry(struct video_card *video)
struct
dv1394_procfs_entry
*
parent
;
struct
dv1394_procfs_entry
*
parent
;
p
=
kmalloc
(
sizeof
(
struct
dv1394_procfs_entry
),
GFP_KERNEL
);
p
=
kmalloc
(
sizeof
(
struct
dv1394_procfs_entry
),
GFP_KERNEL
);
if
(
!
p
)
{
if
(
!
p
)
{
printk
(
KERN_ERR
"dv1394: cannot allocate dv1394_procfs_entry
\n
"
);
printk
(
KERN_ERR
"dv1394: cannot allocate dv1394_procfs_entry
\n
"
);
goto
err
;
goto
err
;
}
}
...
@@ -2043,7 +2043,7 @@ dv1394_procfs_add_dir( char *name,
...
@@ -2043,7 +2043,7 @@ dv1394_procfs_add_dir( char *name,
struct
dv1394_procfs_entry
*
p
;
struct
dv1394_procfs_entry
*
p
;
p
=
kmalloc
(
sizeof
(
struct
dv1394_procfs_entry
),
GFP_KERNEL
);
p
=
kmalloc
(
sizeof
(
struct
dv1394_procfs_entry
),
GFP_KERNEL
);
if
(
!
p
)
{
if
(
!
p
)
{
printk
(
KERN_ERR
"dv1394: cannot allocate dv1394_procfs_entry
\n
"
);
printk
(
KERN_ERR
"dv1394: cannot allocate dv1394_procfs_entry
\n
"
);
goto
err
;
goto
err
;
}
}
...
@@ -2104,7 +2104,7 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2104,7 +2104,7 @@ static void it_tasklet_func(unsigned long data)
spin_lock
(
&
video
->
spinlock
);
spin_lock
(
&
video
->
spinlock
);
if
(
!
video
->
dma_running
)
if
(
!
video
->
dma_running
)
goto
out
;
goto
out
;
irq_printk
(
"ContextControl = %08x, CommandPtr = %08x
\n
"
,
irq_printk
(
"ContextControl = %08x, CommandPtr = %08x
\n
"
,
...
@@ -2113,24 +2113,24 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2113,24 +2113,24 @@ static void it_tasklet_func(unsigned long data)
);
);
if
(
(
video
->
ohci_it_ctx
!=
-
1
)
&&
if
(
(
video
->
ohci_it_ctx
!=
-
1
)
&&
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
(
1
<<
10
))
)
{
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
)
&
(
1
<<
10
))
)
{
struct
frame
*
f
;
struct
frame
*
f
;
unsigned
int
frame
,
i
;
unsigned
int
frame
,
i
;
if
(
video
->
active_frame
==
-
1
)
if
(
video
->
active_frame
==
-
1
)
frame
=
0
;
frame
=
0
;
else
else
frame
=
video
->
active_frame
;
frame
=
video
->
active_frame
;
/* check all the DMA-able frames */
/* check all the DMA-able frames */
for
(
i
=
0
;
i
<
video
->
n_frames
;
i
++
,
frame
=
(
frame
+
1
)
%
video
->
n_frames
)
{
for
(
i
=
0
;
i
<
video
->
n_frames
;
i
++
,
frame
=
(
frame
+
1
)
%
video
->
n_frames
)
{
irq_printk
(
"IRQ checking frame %d..."
,
frame
);
irq_printk
(
"IRQ checking frame %d..."
,
frame
);
f
=
video
->
frames
[
frame
];
f
=
video
->
frames
[
frame
];
if
(
f
->
state
!=
FRAME_READY
)
{
if
(
f
->
state
!=
FRAME_READY
)
{
irq_printk
(
"clear, skipping
\n
"
);
irq_printk
(
"clear, skipping
\n
"
);
/* we don't own this frame */
/* we don't own this frame */
continue
;
continue
;
...
@@ -2139,7 +2139,7 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2139,7 +2139,7 @@ static void it_tasklet_func(unsigned long data)
irq_printk
(
"DMA
\n
"
);
irq_printk
(
"DMA
\n
"
);
/* check the frame begin semaphore to see if we can free the previous frame */
/* check the frame begin semaphore to see if we can free the previous frame */
if
(
*
(
f
->
frame_begin_timestamp
)
)
{
if
(
*
(
f
->
frame_begin_timestamp
)
)
{
int
prev_frame
;
int
prev_frame
;
struct
frame
*
prev_f
;
struct
frame
*
prev_f
;
...
@@ -2149,13 +2149,13 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2149,13 +2149,13 @@ static void it_tasklet_func(unsigned long data)
irq_printk
(
" BEGIN
\n
"
);
irq_printk
(
" BEGIN
\n
"
);
prev_frame
=
frame
-
1
;
prev_frame
=
frame
-
1
;
if
(
prev_frame
==
-
1
)
if
(
prev_frame
==
-
1
)
prev_frame
+=
video
->
n_frames
;
prev_frame
+=
video
->
n_frames
;
prev_f
=
video
->
frames
[
prev_frame
];
prev_f
=
video
->
frames
[
prev_frame
];
/* make sure we can actually garbage collect
/* make sure we can actually garbage collect
this frame */
this frame */
if
(
(
prev_f
->
state
==
FRAME_READY
)
&&
if
(
(
prev_f
->
state
==
FRAME_READY
)
&&
prev_f
->
done
&&
(
!
f
->
done
)
)
prev_f
->
done
&&
(
!
f
->
done
)
)
{
{
frame_reset
(
prev_f
);
frame_reset
(
prev_f
);
...
@@ -2173,7 +2173,7 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2173,7 +2173,7 @@ static void it_tasklet_func(unsigned long data)
/* see if we need to set the timestamp for the next frame */
/* see if we need to set the timestamp for the next frame */
if
(
*
(
f
->
mid_frame_timestamp
)
)
{
if
(
*
(
f
->
mid_frame_timestamp
)
)
{
struct
frame
*
next_frame
;
struct
frame
*
next_frame
;
u32
begin_ts
,
ts_cyc
,
ts_off
;
u32
begin_ts
,
ts_cyc
,
ts_off
;
...
@@ -2188,7 +2188,7 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2188,7 +2188,7 @@ static void it_tasklet_func(unsigned long data)
/* prepare next frame and assign timestamp */
/* prepare next frame and assign timestamp */
next_frame
=
video
->
frames
[
(
frame
+
1
)
%
video
->
n_frames
];
next_frame
=
video
->
frames
[
(
frame
+
1
)
%
video
->
n_frames
];
if
(
next_frame
->
state
==
FRAME_READY
)
{
if
(
next_frame
->
state
==
FRAME_READY
)
{
irq_printk
(
" MIDDLE - next frame is ready, good
\n
"
);
irq_printk
(
" MIDDLE - next frame is ready, good
\n
"
);
}
else
{
}
else
{
debug_printk
(
"dv1394: Underflow! At least one frame has been dropped.
\n
"
);
debug_printk
(
"dv1394: Underflow! At least one frame has been dropped.
\n
"
);
...
@@ -2207,11 +2207,11 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2207,11 +2207,11 @@ static void it_tasklet_func(unsigned long data)
ts_off
%=
3072
;
ts_off
%=
3072
;
next_frame
->
assigned_timestamp
=
((
ts_cyc
&
0xF
)
<<
12
)
+
ts_off
;
next_frame
->
assigned_timestamp
=
((
ts_cyc
&
0xF
)
<<
12
)
+
ts_off
;
if
(
next_frame
->
cip_syt1
)
{
if
(
next_frame
->
cip_syt1
)
{
next_frame
->
cip_syt1
->
b
[
6
]
=
next_frame
->
assigned_timestamp
>>
8
;
next_frame
->
cip_syt1
->
b
[
6
]
=
next_frame
->
assigned_timestamp
>>
8
;
next_frame
->
cip_syt1
->
b
[
7
]
=
next_frame
->
assigned_timestamp
&
0xFF
;
next_frame
->
cip_syt1
->
b
[
7
]
=
next_frame
->
assigned_timestamp
&
0xFF
;
}
}
if
(
next_frame
->
cip_syt2
)
{
if
(
next_frame
->
cip_syt2
)
{
next_frame
->
cip_syt2
->
b
[
6
]
=
next_frame
->
assigned_timestamp
>>
8
;
next_frame
->
cip_syt2
->
b
[
6
]
=
next_frame
->
assigned_timestamp
>>
8
;
next_frame
->
cip_syt2
->
b
[
7
]
=
next_frame
->
assigned_timestamp
&
0xFF
;
next_frame
->
cip_syt2
->
b
[
7
]
=
next_frame
->
assigned_timestamp
&
0xFF
;
}
}
...
@@ -2219,7 +2219,7 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2219,7 +2219,7 @@ static void it_tasklet_func(unsigned long data)
}
}
/* see if the frame looped */
/* see if the frame looped */
if
(
*
(
f
->
frame_end_timestamp
)
)
{
if
(
*
(
f
->
frame_end_timestamp
)
)
{
*
(
f
->
frame_end_timestamp
)
=
0
;
*
(
f
->
frame_end_timestamp
)
=
0
;
...
@@ -2230,10 +2230,10 @@ static void it_tasklet_func(unsigned long data)
...
@@ -2230,10 +2230,10 @@ static void it_tasklet_func(unsigned long data)
}
/* for(each frame) */
}
/* for
(each frame) */
}
}
if
(
wake
)
{
if
(
wake
)
{
kill_fasync
(
&
video
->
fasync
,
SIGIO
,
POLL_OUT
);
kill_fasync
(
&
video
->
fasync
,
SIGIO
,
POLL_OUT
);
/* wake readers/writers/ioctl'ers */
/* wake readers/writers/ioctl'ers */
...
@@ -2251,10 +2251,10 @@ static void ir_tasklet_func(unsigned long data)
...
@@ -2251,10 +2251,10 @@ static void ir_tasklet_func(unsigned long data)
spin_lock
(
&
video
->
spinlock
);
spin_lock
(
&
video
->
spinlock
);
if
(
!
video
->
dma_running
)
if
(
!
video
->
dma_running
)
goto
out
;
goto
out
;
if
(
(
video
->
ohci_ir_ctx
!=
-
1
)
&&
if
(
(
video
->
ohci_ir_ctx
!=
-
1
)
&&
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
10
))
)
(
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
)
&
(
1
<<
10
))
)
{
{
...
@@ -2374,7 +2374,7 @@ static void ir_tasklet_func(unsigned long data)
...
@@ -2374,7 +2374,7 @@ static void ir_tasklet_func(unsigned long data)
prev_i
=
(
next_i
==
0
)
?
(
MAX_PACKETS
*
video
->
n_frames
-
1
)
:
(
next_i
-
1
);
prev_i
=
(
next_i
==
0
)
?
(
MAX_PACKETS
*
video
->
n_frames
-
1
)
:
(
next_i
-
1
);
f
=
video
->
frames
[
prev_i
/
MAX_PACKETS
];
f
=
video
->
frames
[
prev_i
/
MAX_PACKETS
];
prev
=
&
(
f
->
descriptor_pool
[
prev_i
%
MAX_PACKETS
]);
prev
=
&
(
f
->
descriptor_pool
[
prev_i
%
MAX_PACKETS
]);
if
(
prev_i
%
(
MAX_PACKETS
/
2
))
{
if
(
prev_i
%
(
MAX_PACKETS
/
2
))
{
prev
->
u
.
in
.
il
.
q
[
0
]
&=
~
(
3
<<
20
);
/* no interrupt */
prev
->
u
.
in
.
il
.
q
[
0
]
&=
~
(
3
<<
20
);
/* no interrupt */
}
else
{
}
else
{
prev
->
u
.
in
.
il
.
q
[
0
]
|=
3
<<
20
;
/* enable interrupt */
prev
->
u
.
in
.
il
.
q
[
0
]
|=
3
<<
20
;
/* enable interrupt */
...
@@ -2394,7 +2394,7 @@ static void ir_tasklet_func(unsigned long data)
...
@@ -2394,7 +2394,7 @@ static void ir_tasklet_func(unsigned long data)
}
/* receive interrupt */
}
/* receive interrupt */
if
(
wake
)
{
if
(
wake
)
{
kill_fasync
(
&
video
->
fasync
,
SIGIO
,
POLL_IN
);
kill_fasync
(
&
video
->
fasync
,
SIGIO
,
POLL_IN
);
/* wake readers/writers/ioctl'ers */
/* wake readers/writers/ioctl'ers */
...
@@ -2453,7 +2453,7 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes
...
@@ -2453,7 +2453,7 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes
int
i
;
int
i
;
video
=
kmalloc
(
sizeof
(
struct
video_card
),
GFP_KERNEL
);
video
=
kmalloc
(
sizeof
(
struct
video_card
),
GFP_KERNEL
);
if
(
!
video
)
{
if
(
!
video
)
{
printk
(
KERN_ERR
"dv1394: cannot allocate video_card
\n
"
);
printk
(
KERN_ERR
"dv1394: cannot allocate video_card
\n
"
);
goto
err
;
goto
err
;
}
}
...
@@ -2497,7 +2497,7 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes
...
@@ -2497,7 +2497,7 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes
goto
err_free
;
goto
err_free
;
#endif
#endif
for
(
i
=
0
;
i
<
DV1394_MAX_FRAMES
;
i
++
)
for
(
i
=
0
;
i
<
DV1394_MAX_FRAMES
;
i
++
)
video
->
frames
[
i
]
=
NULL
;
video
->
frames
[
i
]
=
NULL
;
dma_region_init
(
&
video
->
dv_buf
);
dma_region_init
(
&
video
->
dv_buf
);
...
@@ -2574,10 +2574,10 @@ static void dv1394_remove_host (struct hpsb_host *host)
...
@@ -2574,10 +2574,10 @@ static void dv1394_remove_host (struct hpsb_host *host)
/* find the corresponding video_cards */
/* find the corresponding video_cards */
spin_lock_irqsave
(
&
dv1394_cards_lock
,
flags
);
spin_lock_irqsave
(
&
dv1394_cards_lock
,
flags
);
if
(
!
list_empty
(
&
dv1394_cards
))
{
if
(
!
list_empty
(
&
dv1394_cards
))
{
list_for_each_safe
(
lh
,
templh
,
&
dv1394_cards
)
{
list_for_each_safe
(
lh
,
templh
,
&
dv1394_cards
)
{
video
=
list_entry
(
lh
,
struct
video_card
,
list
);
video
=
list_entry
(
lh
,
struct
video_card
,
list
);
if
((
video
->
id
>>
2
)
==
ohci
->
id
)
if
((
video
->
id
>>
2
)
==
ohci
->
id
)
dv1394_un_init
(
video
);
dv1394_un_init
(
video
);
}
}
}
}
...
@@ -2655,32 +2655,32 @@ static void dv1394_host_reset(struct hpsb_host *host)
...
@@ -2655,32 +2655,32 @@ static void dv1394_host_reset(struct hpsb_host *host)
/* find the corresponding video_cards */
/* find the corresponding video_cards */
spin_lock_irqsave
(
&
dv1394_cards_lock
,
flags
);
spin_lock_irqsave
(
&
dv1394_cards_lock
,
flags
);
if
(
!
list_empty
(
&
dv1394_cards
))
{
if
(
!
list_empty
(
&
dv1394_cards
))
{
list_for_each
(
lh
,
&
dv1394_cards
)
{
list_for_each
(
lh
,
&
dv1394_cards
)
{
video
=
list_entry
(
lh
,
struct
video_card
,
list
);
video
=
list_entry
(
lh
,
struct
video_card
,
list
);
if
((
video
->
id
>>
2
)
==
ohci
->
id
)
if
((
video
->
id
>>
2
)
==
ohci
->
id
)
break
;
break
;
}
}
}
}
spin_unlock_irqrestore
(
&
dv1394_cards_lock
,
flags
);
spin_unlock_irqrestore
(
&
dv1394_cards_lock
,
flags
);
if
(
!
video
)
if
(
!
video
)
return
;
return
;
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
video
->
spinlock
,
flags
);
if
(
!
video
->
dma_running
)
if
(
!
video
->
dma_running
)
goto
out
;
goto
out
;
/* check IT context */
/* check IT context */
if
(
video
->
ohci_it_ctx
!=
-
1
)
{
if
(
video
->
ohci_it_ctx
!=
-
1
)
{
u32
ctx
;
u32
ctx
;
ctx
=
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
);
ctx
=
reg_read
(
video
->
ohci
,
video
->
ohci_IsoXmitContextControlSet
);
/* if(RUN but not ACTIVE) */
/* if
(RUN but not ACTIVE) */
if
(
(
ctx
&
(
1
<<
15
))
&&
if
(
(
ctx
&
(
1
<<
15
))
&&
!
(
ctx
&
(
1
<<
10
))
)
{
!
(
ctx
&
(
1
<<
10
))
)
{
debug_printk
(
"dv1394: IT context stopped due to bus reset; waking it up
\n
"
);
debug_printk
(
"dv1394: IT context stopped due to bus reset; waking it up
\n
"
);
...
@@ -2710,13 +2710,13 @@ static void dv1394_host_reset(struct hpsb_host *host)
...
@@ -2710,13 +2710,13 @@ static void dv1394_host_reset(struct hpsb_host *host)
}
}
/* check IR context */
/* check IR context */
if
(
video
->
ohci_ir_ctx
!=
-
1
)
{
if
(
video
->
ohci_ir_ctx
!=
-
1
)
{
u32
ctx
;
u32
ctx
;
ctx
=
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
);
ctx
=
reg_read
(
video
->
ohci
,
video
->
ohci_IsoRcvContextControlSet
);
/* if(RUN but not ACTIVE) */
/* if
(RUN but not ACTIVE) */
if
(
(
ctx
&
(
1
<<
15
))
&&
if
(
(
ctx
&
(
1
<<
15
))
&&
!
(
ctx
&
(
1
<<
10
))
)
{
!
(
ctx
&
(
1
<<
10
))
)
{
debug_printk
(
"dv1394: IR context stopped due to bus reset; waking it up
\n
"
);
debug_printk
(
"dv1394: IR context stopped due to bus reset; waking it up
\n
"
);
...
...
drivers/ieee1394/dv1394.h
View file @
11092356
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
ioctl(fd, DV1394_INIT, &init);
ioctl(fd, DV1394_INIT, &init);
while(1) {
while
(1) {
read( <a raw DV file>, buf, DV1394_NTSC_FRAME_SIZE );
read( <a raw DV file>, buf, DV1394_NTSC_FRAME_SIZE );
write( <the dv1394 FD>, buf, DV1394_NTSC_FRAME_SIZE );
write( <the dv1394 FD>, buf, DV1394_NTSC_FRAME_SIZE );
}
}
...
@@ -145,7 +145,7 @@
...
@@ -145,7 +145,7 @@
(checks of system call return values omitted for brevity; always
(checks of system call return values omitted for brevity; always
check return values in your code!)
check return values in your code!)
while( frames left ) {
while
( frames left ) {
struct pollfd *pfd = ...;
struct pollfd *pfd = ...;
...
@@ -157,15 +157,15 @@
...
@@ -157,15 +157,15 @@
poll(pfd, 1, -1); (or select(); add a timeout if you want)
poll(pfd, 1, -1); (or select(); add a timeout if you want)
if(pfd->revents) {
if
(pfd->revents) {
struct dv1394_status status;
struct dv1394_status status;
ioctl(dv1394_fd, DV1394_GET_STATUS, &status);
ioctl(dv1394_fd, DV1394_GET_STATUS, &status);
if(status.dropped_frames > 0) {
if
(status.dropped_frames > 0) {
reset_dv1394();
reset_dv1394();
} else {
} else {
for(int i = 0; i < status.n_clear_frames; i++) {
for
(int i = 0; i < status.n_clear_frames; i++) {
copy_DV_frame();
copy_DV_frame();
}
}
}
}
...
...
drivers/ieee1394/eth1394.c
View file @
11092356
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
* TODO:
* TODO:
* RFC 2734 related:
* RFC 2734 related:
* - Add Config ROM entry
* - Add Config ROM entry
* - Add MCAP
and multicast
* - Add MCAP
. Limited Multicast exists only to 224.0.0.1 and 224.0.0.2.
*
*
* Non-RFC 2734 related:
* Non-RFC 2734 related:
* - Fix bug related to fragmented broadcast datagrams
* - Fix bug related to fragmented broadcast datagrams
...
@@ -59,9 +59,12 @@
...
@@ -59,9 +59,12 @@
#include <linux/if_arp.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_ether.h>
#include <linux/ip.h>
#include <linux/ip.h>
#include <linux/in.h>
#include <linux/tcp.h>
#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/bitops.h>
#include <linux/bitops.h>
#include <linux/ethtool.h>
#include <asm/uaccess.h>
#include <asm/delay.h>
#include <asm/delay.h>
#include <asm/semaphore.h>
#include <asm/semaphore.h>
#include <net/arp.h>
#include <net/arp.h>
...
@@ -76,17 +79,17 @@
...
@@ -76,17 +79,17 @@
#include "eth1394.h"
#include "eth1394.h"
#define ETH1394_PRINT_G(level, fmt, args...) \
#define ETH1394_PRINT_G(level, fmt, args...) \
printk(level
ETHER1394_DRIVER_NAME": "fmt
, ## args)
printk(level
"%s: " fmt, driver_name
, ## args)
#define ETH1394_PRINT(level, dev_name, fmt, args...) \
#define ETH1394_PRINT(level, dev_name, fmt, args...) \
printk(level
ETHER1394_DRIVER_NAME": %s: " fmt
, dev_name, ## args)
printk(level
"%s: %s: " fmt, driver_name
, dev_name, ## args)
#define DEBUG(fmt, args...) \
#define DEBUG(fmt, args...) \
printk(KERN_ERR "
eth1394:%s[%d]: "fmt"\n"
, __FUNCTION__, __LINE__, ## args)
printk(KERN_ERR "
%s:%s[%d]: " fmt "\n", driver_name
, __FUNCTION__, __LINE__, ## args)
#define TRACE() printk(KERN_ERR "
eth1394:%s[%d] ---- TRACE\n"
, __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: 9
5
1 $ Ben Collins <bcollins@debian.org>"
;
"$Rev: 9
7
1 $ Ben Collins <bcollins@debian.org>"
;
struct
fragment_info
{
struct
fragment_info
{
struct
list_head
list
;
struct
list_head
list
;
...
@@ -105,7 +108,7 @@ struct partial_datagram {
...
@@ -105,7 +108,7 @@ struct partial_datagram {
};
};
/* Our ieee1394 highlevel driver */
/* Our ieee1394 highlevel driver */
#define ETHER1394_DRIVER_NAME "ether1394"
static
const
char
driver_name
[]
=
"eth1394"
;
static
kmem_cache_t
*
packet_task_cache
;
static
kmem_cache_t
*
packet_task_cache
;
...
@@ -156,15 +159,26 @@ static inline void purge_partial_datagram(struct list_head *old);
...
@@ -156,15 +159,26 @@ static inline void purge_partial_datagram(struct list_head *old);
static
int
ether1394_tx
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
);
static
int
ether1394_tx
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
);
static
void
ether1394_iso
(
struct
hpsb_iso
*
iso
);
static
void
ether1394_iso
(
struct
hpsb_iso
*
iso
);
static
int
ether1394_do_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
ifr
,
int
cmd
);
static
int
ether1394_ethtool_ioctl
(
struct
net_device
*
dev
,
void
*
useraddr
);
static
void
eth1394_iso_shutdown
(
struct
eth1394_priv
*
priv
)
{
priv
->
bc_state
=
ETHER1394_BC_CLOSED
;
if
(
priv
->
iso
!=
NULL
)
{
hpsb_iso_shutdown
(
priv
->
iso
);
priv
->
iso
=
NULL
;
}
}
static
int
ether1394_init_bc
(
struct
net_device
*
dev
)
static
int
ether1394_init_bc
(
struct
net_device
*
dev
)
{
{
int
ret
=
0
;
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
/* First time sending? Need a broadcast channel for ARP and for
/* First time sending? Need a broadcast channel for ARP and for
* listening on */
* listening on */
if
(
priv
->
bc_state
==
ETHER1394_BC_CHECK
)
{
if
(
priv
->
bc_state
==
ETHER1394_BC_CHECK
)
{
quadlet_t
bc
;
quadlet_t
bc
;
/* Get the local copy of the broadcast channel and check its
/* Get the local copy of the broadcast channel and check its
...
@@ -172,30 +186,26 @@ static int ether1394_init_bc(struct net_device *dev)
...
@@ -172,30 +186,26 @@ static int ether1394_init_bc(struct net_device *dev)
bc
=
priv
->
host
->
csr
.
broadcast_channel
;
bc
=
priv
->
host
->
csr
.
broadcast_channel
;
if
((
bc
&
0xc0000000
)
!=
0xc0000000
)
{
if
((
bc
&
0xc0000000
)
!=
0xc0000000
)
{
/* broadcast channel not validated yet */
/* broadcast channel not validated yet */
ETH1394_PRINT
(
KERN_WARNING
,
dev
->
name
,
ETH1394_PRINT
(
KERN_WARNING
,
dev
->
name
,
"Error BROADCAST_CHANNEL register valid "
"Error BROADCAST_CHANNEL register valid "
"bit not set, can't send IP traffic
\n
"
);
"bit not set, can't send IP traffic
\n
"
);
if
(
!
in_interrupt
())
{
hpsb_iso_shutdown
(
priv
->
iso
);
if
(
!
in_interrupt
())
priv
->
bc_state
=
ETHER1394_BC_CLOSED
;
eth1394_iso_shutdown
(
priv
);
}
ret
=
-
EAGAIN
;
return
-
EAGAIN
;
goto
fail
;
}
}
if
(
priv
->
broadcast_channel
!=
(
bc
&
0x3f
))
{
if
(
priv
->
broadcast_channel
!=
(
bc
&
0x3f
))
{
/* This really shouldn't be possible, but just in case
/* This really shouldn't be possible, but just in case
* the IEEE 1394 spec changes regarding broadcast
* the IEEE 1394 spec changes regarding broadcast
* channels in the future. */
* channels in the future. */
if
(
in_interrupt
())
{
if
(
in_interrupt
())
ret
=
-
EAGAIN
;
return
-
EAGAIN
;
goto
fail
;
}
eth1394_iso_shutdown
(
priv
);
hpsb_iso_shutdown
(
priv
->
iso
);
priv
->
broadcast_channel
=
bc
&
0x3f
;
priv
->
broadcast_channel
=
bc
&
0x3f
;
ETH1394_PRINT
(
KERN_INFO
,
dev
->
name
,
ETH1394_PRINT
(
KERN_INFO
,
dev
->
name
,
...
@@ -205,29 +215,26 @@ static int ether1394_init_bc(struct net_device *dev)
...
@@ -205,29 +215,26 @@ 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
);
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 "
"channel
\n
"
);
"channel
\n
"
);
ret
=
-
EAGAIN
;
return
-
EAGAIN
;
goto
fail
;
}
}
}
}
if
(
hpsb_iso_recv_start
(
priv
->
iso
,
-
1
,
(
1
<<
3
),
-
1
)
<
0
)
{
if
(
hpsb_iso_recv_start
(
priv
->
iso
,
-
1
,
(
1
<<
3
),
-
1
)
<
0
)
{
ETH1394_PRINT
(
KERN_ERR
,
dev
->
name
,
ETH1394_PRINT
(
KERN_ERR
,
dev
->
name
,
"Could not start data stream reception
\n
"
);
"Could not start data stream reception
\n
"
);
if
(
!
in_interrupt
())
{
hpsb_iso_shutdown
(
priv
->
iso
);
if
(
!
in_interrupt
())
priv
->
bc_state
=
ETHER1394_BC_CLOSED
;
eth1394_iso_shutdown
(
priv
);
}
ret
=
-
EAGAIN
;
return
-
EAGAIN
;
goto
fail
;
}
}
priv
->
bc_state
=
ETHER1394_BC_OPENED
;
priv
->
bc_state
=
ETHER1394_BC_OPENED
;
}
}
fail:
return
0
;
return
ret
;
}
}
/* This is called after an "ifup" */
/* This is called after an "ifup" */
...
@@ -243,7 +250,7 @@ static int ether1394_open (struct net_device *dev)
...
@@ -243,7 +250,7 @@ static int ether1394_open (struct net_device *dev)
ret
=
ether1394_init_bc
(
dev
);
ret
=
ether1394_init_bc
(
dev
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
netif_start_queue
(
dev
);
netif_start_queue
(
dev
);
...
@@ -280,9 +287,9 @@ static int ether1394_change_mtu(struct net_device *dev, int new_mtu)
...
@@ -280,9 +287,9 @@ static int ether1394_change_mtu(struct net_device *dev, int new_mtu)
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
int
phy_id
=
NODEID_TO_NODE
(
priv
->
host
->
node_id
);
int
phy_id
=
NODEID_TO_NODE
(
priv
->
host
->
node_id
);
if
((
new_mtu
<
68
)
||
(
new_mtu
>
(
priv
->
maxpayload
[
phy_id
]
-
if
((
new_mtu
<
68
)
||
(
new_mtu
>
MIN
(
ETH_DATA_LEN
,
(
priv
->
maxpayload
[
phy_id
]
-
(
sizeof
(
union
eth1394_hdr
)
+
(
sizeof
(
union
eth1394_hdr
)
+
ETHER1394_GASP_OVERHEAD
))))
ETHER1394_GASP_OVERHEAD
))))
)
return
-
EINVAL
;
return
-
EINVAL
;
dev
->
mtu
=
new_mtu
;
dev
->
mtu
=
new_mtu
;
return
0
;
return
0
;
...
@@ -315,7 +322,8 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
...
@@ -315,7 +322,8 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
struct
hpsb_host
*
host
=
priv
->
host
;
struct
hpsb_host
*
host
=
priv
->
host
;
int
phy_id
=
NODEID_TO_NODE
(
host
->
node_id
);
int
phy_id
=
NODEID_TO_NODE
(
host
->
node_id
);
u64
guid
=
*
((
u64
*
)
&
(
host
->
csr
.
rom
[
3
]));
u64
guid
=
(
u64
)(((
u64
)
be32_to_cpu
(
host
->
csr
.
rom
[
3
])
<<
32
)
|
be32_to_cpu
(
host
->
csr
.
rom
[
4
]));
u16
maxpayload
=
1
<<
(((
be32_to_cpu
(
host
->
csr
.
rom
[
2
])
>>
12
)
&
0xf
)
+
1
);
u16
maxpayload
=
1
<<
(((
be32_to_cpu
(
host
->
csr
.
rom
[
2
])
>>
12
)
&
0xf
)
+
1
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
...
@@ -325,14 +333,14 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
...
@@ -325,14 +333,14 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
memset
(
priv
->
sspd
,
0
,
sizeof
(
priv
->
sspd
));
memset
(
priv
->
sspd
,
0
,
sizeof
(
priv
->
sspd
));
memset
(
priv
->
fifo
,
0
,
sizeof
(
priv
->
fifo
));
memset
(
priv
->
fifo
,
0
,
sizeof
(
priv
->
fifo
));
#if
0
#if
1
/* Compile this out to make testing of fragmented broadcast datagrams
/* Compile this out to make testing of fragmented broadcast datagrams
* easier. */
* easier. */
priv->sspd[ALL_NODES] = SPEED_MAX;
priv
->
sspd
[
ALL_NODES
]
=
IEEE1394_
SPEED_MAX
;
priv->maxpayload[ALL_NODES] = eth1394_speedto_maxpayload[SPEED_MAX];
priv
->
maxpayload
[
ALL_NODES
]
=
eth1394_speedto_maxpayload
[
IEEE1394_
SPEED_MAX
];
#else
#else
priv
->
sspd
[
ALL_NODES
]
=
SPEED_100
;
priv
->
sspd
[
ALL_NODES
]
=
IEEE1394_
SPEED_100
;
priv
->
maxpayload
[
ALL_NODES
]
=
eth1394_speedto_maxpayload
[
SPEED_100
];
priv
->
maxpayload
[
ALL_NODES
]
=
eth1394_speedto_maxpayload
[
IEEE1394_
SPEED_100
];
#endif
#endif
priv
->
bc_state
=
ETHER1394_BC_CHECK
;
priv
->
bc_state
=
ETHER1394_BC_CHECK
;
...
@@ -344,8 +352,9 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
...
@@ -344,8 +352,9 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
/* We'll use our maxpayload as the default mtu */
/* We'll use our maxpayload as the default mtu */
if
(
set_mtu
)
{
if
(
set_mtu
)
{
dev
->
mtu
=
priv
->
maxpayload
[
phy_id
]
-
(
sizeof
(
union
eth1394_hdr
)
+
dev
->
mtu
=
MIN
(
ETH_DATA_LEN
,
priv
->
maxpayload
[
phy_id
]
-
ETHER1394_GASP_OVERHEAD
);
(
sizeof
(
union
eth1394_hdr
)
+
ETHER1394_GASP_OVERHEAD
));
/* Set our hardware address while we're at it */
/* Set our hardware address while we're at it */
*
(
u64
*
)
dev
->
dev_addr
=
guid
;
*
(
u64
*
)
dev
->
dev_addr
=
guid
;
...
@@ -354,11 +363,11 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
...
@@ -354,11 +363,11 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
for
(
i
=
0
;
i
<
ALL_NODES
;
i
++
)
{
for
(
i
=
0
;
i
<
ALL_NODES
;
i
++
)
{
struct
list_head
*
lh
,
*
n
;
struct
list_head
*
lh
,
*
n
;
spin_lock_irqsave
(
&
priv
->
pdg
[
i
].
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
pdg
[
i
].
lock
,
flags
);
if
(
!
set_mtu
)
{
if
(
!
set_mtu
)
{
list_for_each_safe
(
lh
,
n
,
&
priv
->
pdg
[
i
].
list
)
{
list_for_each_safe
(
lh
,
n
,
&
priv
->
pdg
[
i
].
list
)
{
purge_partial_datagram
(
lh
);
purge_partial_datagram
(
lh
);
}
}
...
@@ -386,11 +395,14 @@ static int ether1394_init_dev (struct net_device *dev)
...
@@ -386,11 +395,14 @@ static int ether1394_init_dev (struct net_device *dev)
dev
->
header_cache_update
=
ether1394_header_cache_update
;
dev
->
header_cache_update
=
ether1394_header_cache_update
;
dev
->
hard_header_parse
=
ether1394_header_parse
;
dev
->
hard_header_parse
=
ether1394_header_parse
;
dev
->
set_mac_address
=
ether1394_mac_addr
;
dev
->
set_mac_address
=
ether1394_mac_addr
;
dev
->
do_ioctl
=
ether1394_do_ioctl
;
/* Some constants */
/* Some constants */
dev
->
watchdog_timeo
=
ETHER1394_TIMEOUT
;
dev
->
watchdog_timeo
=
ETHER1394_TIMEOUT
;
dev
->
flags
=
IFF_BROADCAST
;
/* | IFF_MULTICAST someday */
dev
->
flags
=
IFF_BROADCAST
|
IFF_MULTICAST
;
dev
->
features
=
NETIF_F_NO_CSUM
|
NETIF_F_SG
|
NETIF_F_HIGHDMA
|
NETIF_F_FRAGLIST
;
/* !! If data corruption or untrackable kernel panics occur, try
* removing NETIF_F_FRAGLIST !! */
dev
->
features
=
NETIF_F_HIGHDMA
|
NETIF_F_FRAGLIST
;
dev
->
addr_len
=
ETH1394_ALEN
;
dev
->
addr_len
=
ETH1394_ALEN
;
dev
->
hard_header_len
=
ETH1394_HLEN
;
dev
->
hard_header_len
=
ETH1394_HLEN
;
dev
->
type
=
ARPHRD_IEEE1394
;
dev
->
type
=
ARPHRD_IEEE1394
;
...
@@ -421,8 +433,12 @@ static void ether1394_add_host (struct hpsb_host *host)
...
@@ -421,8 +433,12 @@ static void ether1394_add_host (struct hpsb_host *host)
* it for ourselves. That way we'd be a real networking device. */
* it for ourselves. That way we'd be a real networking device. */
dev
=
alloc_etherdev
(
sizeof
(
struct
eth1394_priv
));
dev
=
alloc_etherdev
(
sizeof
(
struct
eth1394_priv
));
if
(
dev
==
NULL
)
if
(
dev
==
NULL
)
{
ETH1394_PRINT_G
(
KERN_ERR
,
"Out of memory trying to allocate "
"etherdevice for IEEE 1394 device %s-%d
\n
"
,
host
->
driver
->
name
,
host
->
id
);
goto
out
;
goto
out
;
}
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
...
@@ -433,7 +449,7 @@ static void ether1394_add_host (struct hpsb_host *host)
...
@@ -433,7 +449,7 @@ static void ether1394_add_host (struct hpsb_host *host)
priv
->
host
=
host
;
priv
->
host
=
host
;
spin_lock_init
(
&
priv
->
lock
);
spin_lock_init
(
&
priv
->
lock
);
for
(
i
=
0
;
i
<
ALL_NODES
;
i
++
)
{
for
(
i
=
0
;
i
<
ALL_NODES
;
i
++
)
{
spin_lock_init
(
&
priv
->
pdg
[
i
].
lock
);
spin_lock_init
(
&
priv
->
pdg
[
i
].
lock
);
INIT_LIST_HEAD
(
&
priv
->
pdg
[
i
].
list
);
INIT_LIST_HEAD
(
&
priv
->
pdg
[
i
].
list
);
priv
->
pdg
[
i
].
sz
=
0
;
priv
->
pdg
[
i
].
sz
=
0
;
...
@@ -441,8 +457,12 @@ static void ether1394_add_host (struct hpsb_host *host)
...
@@ -441,8 +457,12 @@ static void ether1394_add_host (struct hpsb_host *host)
hi
=
hpsb_create_hostinfo
(
&
eth1394_highlevel
,
host
,
sizeof
(
*
hi
));
hi
=
hpsb_create_hostinfo
(
&
eth1394_highlevel
,
host
,
sizeof
(
*
hi
));
if
(
hi
==
NULL
)
if
(
hi
==
NULL
)
{
ETH1394_PRINT_G
(
KERN_ERR
,
"Out of memory trying to create "
"hostinfo for IEEE 1394 device %s-%d
\n
"
,
host
->
driver
->
name
,
host
->
id
);
goto
out
;
goto
out
;
}
if
(
register_netdev
(
dev
))
{
if
(
register_netdev
(
dev
))
{
ETH1394_PRINT
(
KERN_ERR
,
dev
->
name
,
"Error registering network driver
\n
"
);
ETH1394_PRINT
(
KERN_ERR
,
dev
->
name
,
"Error registering network driver
\n
"
);
...
@@ -472,8 +492,6 @@ static void ether1394_add_host (struct hpsb_host *host)
...
@@ -472,8 +492,6 @@ static void ether1394_add_host (struct hpsb_host *host)
if
(
hi
)
if
(
hi
)
hpsb_destroy_hostinfo
(
&
eth1394_highlevel
,
host
);
hpsb_destroy_hostinfo
(
&
eth1394_highlevel
,
host
);
ETH1394_PRINT_G
(
KERN_ERR
,
"Out of memory
\n
"
);
return
;
return
;
}
}
...
@@ -486,11 +504,13 @@ static void ether1394_remove_host (struct hpsb_host *host)
...
@@ -486,11 +504,13 @@ static void ether1394_remove_host (struct hpsb_host *host)
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
hi
->
dev
->
priv
;
struct
eth1394_priv
*
priv
=
(
struct
eth1394_priv
*
)
hi
->
dev
->
priv
;
priv
->
bc_state
=
ETHER1394_BC_CLOSED
;
priv
->
bc_state
=
ETHER1394_BC_CLOSED
;
unregister_netdev
(
hi
->
dev
);
eth1394_iso_shutdown
(
priv
);
hpsb_iso_shutdown
(
priv
->
iso
);
if
(
hi
->
dev
)
{
unregister_netdev
(
hi
->
dev
);
kfree
(
hi
->
dev
);
kfree
(
hi
->
dev
);
}
}
}
return
;
return
;
}
}
...
@@ -536,7 +556,7 @@ static int ether1394_header(struct sk_buff *skb, struct net_device *dev,
...
@@ -536,7 +556,7 @@ static int ether1394_header(struct sk_buff *skb, struct net_device *dev,
return
(
dev
->
hard_header_len
);
return
(
dev
->
hard_header_len
);
}
}
if
(
daddr
)
if
(
daddr
)
{
{
memcpy
(
eth
->
h_dest
,
daddr
,
dev
->
addr_len
);
memcpy
(
eth
->
h_dest
,
daddr
,
dev
->
addr_len
);
return
dev
->
hard_header_len
;
return
dev
->
hard_header_len
;
...
@@ -579,7 +599,7 @@ static int ether1394_header_parse(struct sk_buff *skb, unsigned char *haddr)
...
@@ -579,7 +599,7 @@ static int ether1394_header_parse(struct sk_buff *skb, unsigned char *haddr)
{
{
struct
net_device
*
dev
=
skb
->
dev
;
struct
net_device
*
dev
=
skb
->
dev
;
memcpy
(
haddr
,
dev
->
dev_addr
,
ETH1394_ALEN
);
memcpy
(
haddr
,
dev
->
dev_addr
,
ETH1394_ALEN
);
return
ETH_ALEN
;
return
ETH
1394
_ALEN
;
}
}
...
@@ -635,15 +655,15 @@ static inline u16 ether1394_type_trans(struct sk_buff *skb,
...
@@ -635,15 +655,15 @@ static inline u16 ether1394_type_trans(struct sk_buff *skb,
skb_pull
(
skb
,
ETH1394_HLEN
);
skb_pull
(
skb
,
ETH1394_HLEN
);
eth
=
(
struct
eth1394hdr
*
)
skb
->
mac
.
raw
;
eth
=
(
struct
eth1394hdr
*
)
skb
->
mac
.
raw
;
if
(
*
eth
->
h_dest
&
1
)
{
if
(
*
eth
->
h_dest
&
1
)
{
if
(
memcmp
(
eth
->
h_dest
,
dev
->
broadcast
,
dev
->
addr_len
)
==
0
)
if
(
memcmp
(
eth
->
h_dest
,
dev
->
broadcast
,
dev
->
addr_len
)
==
0
)
skb
->
pkt_type
=
PACKET_BROADCAST
;
skb
->
pkt_type
=
PACKET_BROADCAST
;
#if 0
#if 0
else
else
skb->pkt_type = PACKET_MULTICAST;
skb->pkt_type = PACKET_MULTICAST;
#endif
#endif
}
else
{
}
else
{
if
(
memcmp
(
eth
->
h_dest
,
dev
->
dev_addr
,
dev
->
addr_len
))
if
(
memcmp
(
eth
->
h_dest
,
dev
->
dev_addr
,
dev
->
addr_len
))
skb
->
pkt_type
=
PACKET_OTHERHOST
;
skb
->
pkt_type
=
PACKET_OTHERHOST
;
}
}
...
@@ -671,7 +691,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
...
@@ -671,7 +691,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
/* Setup our hw addresses. We use these to build the
/* Setup our hw addresses. We use these to build the
* ethernet header. */
* ethernet header. */
if
(
destid
==
(
LOCAL_BUS
|
ALL_NODES
))
if
(
destid
==
(
LOCAL_BUS
|
ALL_NODES
))
dest_hw
=
~
0ULL
;
/* broadcast */
dest_hw
=
~
0ULL
;
/* broadcast */
else
else
dest_hw
=
priv
->
eui
[
NODEID_TO_NODE
(
destid
)];
dest_hw
=
priv
->
eui
[
NODEID_TO_NODE
(
destid
)];
...
@@ -716,7 +736,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
...
@@ -716,7 +736,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
*
(
u32
*
)
arp_ptr
=
arp1394
->
sip
;
/* move sender IP addr */
*
(
u32
*
)
arp_ptr
=
arp1394
->
sip
;
/* move sender IP addr */
arp_ptr
+=
arp
->
ar_pln
;
/* skip over sender IP addr */
arp_ptr
+=
arp
->
ar_pln
;
/* skip over sender IP addr */
if
(
arp
->
ar_op
==
1
)
if
(
arp
->
ar_op
==
1
)
/* just set ARP req target unique ID to 0 */
/* just set ARP req target unique ID to 0 */
memset
(
arp_ptr
,
0
,
ETH1394_ALEN
);
memset
(
arp_ptr
,
0
,
ETH1394_ALEN
);
else
else
...
@@ -739,7 +759,7 @@ static inline int fragment_overlap(struct list_head *frag_list, int offset, int
...
@@ -739,7 +759,7 @@ static inline int fragment_overlap(struct list_head *frag_list, int offset, int
list_for_each
(
lh
,
frag_list
)
{
list_for_each
(
lh
,
frag_list
)
{
fi
=
list_entry
(
lh
,
struct
fragment_info
,
list
);
fi
=
list_entry
(
lh
,
struct
fragment_info
,
list
);
if
(
!
((
offset
>
(
fi
->
offset
+
fi
->
len
-
1
))
||
if
(
!
((
offset
>
(
fi
->
offset
+
fi
->
len
-
1
))
||
((
offset
+
len
-
1
)
<
fi
->
offset
)))
((
offset
+
len
-
1
)
<
fi
->
offset
)))
return
1
;
return
1
;
}
}
...
@@ -753,7 +773,7 @@ static inline struct list_head *find_partial_datagram(struct list_head *pdgl, in
...
@@ -753,7 +773,7 @@ static inline struct list_head *find_partial_datagram(struct list_head *pdgl, in
list_for_each
(
lh
,
pdgl
)
{
list_for_each
(
lh
,
pdgl
)
{
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
if
(
pd
->
dgl
==
dgl
)
if
(
pd
->
dgl
==
dgl
)
return
lh
;
return
lh
;
}
}
return
NULL
;
return
NULL
;
...
@@ -767,32 +787,32 @@ static inline int new_fragment(struct list_head *frag_info, int offset, int len)
...
@@ -767,32 +787,32 @@ static inline int new_fragment(struct list_head *frag_info, int offset, int len)
list_for_each
(
lh
,
frag_info
)
{
list_for_each
(
lh
,
frag_info
)
{
fi
=
list_entry
(
lh
,
struct
fragment_info
,
list
);
fi
=
list_entry
(
lh
,
struct
fragment_info
,
list
);
if
((
fi
->
offset
+
fi
->
len
)
==
offset
)
{
if
((
fi
->
offset
+
fi
->
len
)
==
offset
)
{
/* The new fragment can be tacked on to the end */
/* The new fragment can be tacked on to the end */
fi
->
len
+=
len
;
fi
->
len
+=
len
;
/* Did the new fragment plug a hole? */
/* Did the new fragment plug a hole? */
fi2
=
list_entry
(
lh
->
next
,
struct
fragment_info
,
list
);
fi2
=
list_entry
(
lh
->
next
,
struct
fragment_info
,
list
);
if
((
fi
->
offset
+
fi
->
len
)
==
fi2
->
offset
)
{
if
((
fi
->
offset
+
fi
->
len
)
==
fi2
->
offset
)
{
/* glue fragments together */
/* glue fragments together */
fi
->
len
+=
fi2
->
len
;
fi
->
len
+=
fi2
->
len
;
list_del
(
lh
->
next
);
list_del
(
lh
->
next
);
kfree
(
fi2
);
kfree
(
fi2
);
}
}
return
0
;
return
0
;
}
else
if
((
offset
+
len
)
==
fi
->
offset
)
{
}
else
if
((
offset
+
len
)
==
fi
->
offset
)
{
/* The new fragment can be tacked on to the beginning */
/* The new fragment can be tacked on to the beginning */
fi
->
offset
=
offset
;
fi
->
offset
=
offset
;
fi
->
len
+=
len
;
fi
->
len
+=
len
;
/* Did the new fragment plug a hole? */
/* Did the new fragment plug a hole? */
fi2
=
list_entry
(
lh
->
prev
,
struct
fragment_info
,
list
);
fi2
=
list_entry
(
lh
->
prev
,
struct
fragment_info
,
list
);
if
((
fi2
->
offset
+
fi2
->
len
)
==
fi
->
offset
)
{
if
((
fi2
->
offset
+
fi2
->
len
)
==
fi
->
offset
)
{
/* glue fragments together */
/* glue fragments together */
fi2
->
len
+=
fi
->
len
;
fi2
->
len
+=
fi
->
len
;
list_del
(
lh
);
list_del
(
lh
);
kfree
(
fi
);
kfree
(
fi
);
}
}
return
0
;
return
0
;
}
else
if
(
offset
>
(
fi
->
offset
+
fi
->
len
))
{
}
else
if
(
offset
>
(
fi
->
offset
+
fi
->
len
))
{
break
;
break
;
}
else
if
((
offset
+
len
)
<
fi
->
offset
)
{
}
else
if
((
offset
+
len
)
<
fi
->
offset
)
{
lh
=
lh
->
prev
;
lh
=
lh
->
prev
;
...
@@ -801,7 +821,7 @@ static inline int new_fragment(struct list_head *frag_info, int offset, int len)
...
@@ -801,7 +821,7 @@ static inline int new_fragment(struct list_head *frag_info, int offset, int len)
}
}
new
=
kmalloc
(
sizeof
(
struct
fragment_info
),
GFP_ATOMIC
);
new
=
kmalloc
(
sizeof
(
struct
fragment_info
),
GFP_ATOMIC
);
if
(
!
new
)
if
(
!
new
)
return
-
ENOMEM
;
return
-
ENOMEM
;
new
->
offset
=
offset
;
new
->
offset
=
offset
;
...
@@ -820,12 +840,12 @@ static inline int new_partial_datagram(struct net_device *dev,
...
@@ -820,12 +840,12 @@ static inline int new_partial_datagram(struct net_device *dev,
struct
partial_datagram
*
new
;
struct
partial_datagram
*
new
;
new
=
kmalloc
(
sizeof
(
struct
partial_datagram
),
GFP_ATOMIC
);
new
=
kmalloc
(
sizeof
(
struct
partial_datagram
),
GFP_ATOMIC
);
if
(
!
new
)
if
(
!
new
)
return
-
ENOMEM
;
return
-
ENOMEM
;
INIT_LIST_HEAD
(
&
new
->
frag_info
);
INIT_LIST_HEAD
(
&
new
->
frag_info
);
if
(
new_fragment
(
&
new
->
frag_info
,
frag_off
,
frag_len
)
<
0
)
{
if
(
new_fragment
(
&
new
->
frag_info
,
frag_off
,
frag_len
)
<
0
)
{
kfree
(
new
);
kfree
(
new
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -834,7 +854,7 @@ static inline int new_partial_datagram(struct net_device *dev,
...
@@ -834,7 +854,7 @@ static inline int new_partial_datagram(struct net_device *dev,
new
->
dg_size
=
dg_size
;
new
->
dg_size
=
dg_size
;
new
->
skb
=
dev_alloc_skb
(
dg_size
+
dev
->
hard_header_len
+
15
);
new
->
skb
=
dev_alloc_skb
(
dg_size
+
dev
->
hard_header_len
+
15
);
if
(
!
new
->
skb
)
{
if
(
!
new
->
skb
)
{
struct
fragment_info
*
fi
=
list_entry
(
new
->
frag_info
.
next
,
struct
fragment_info
*
fi
=
list_entry
(
new
->
frag_info
.
next
,
struct
fragment_info
,
struct
fragment_info
,
list
);
list
);
...
@@ -857,7 +877,7 @@ static inline int update_partial_datagram(struct list_head *pdgl, struct list_he
...
@@ -857,7 +877,7 @@ static inline int update_partial_datagram(struct list_head *pdgl, struct list_he
{
{
struct
partial_datagram
*
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
struct
partial_datagram
*
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
if
(
new_fragment
(
&
pd
->
frag_info
,
frag_off
,
frag_len
)
<
0
)
{
if
(
new_fragment
(
&
pd
->
frag_info
,
frag_off
,
frag_len
)
<
0
)
{
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -915,7 +935,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -915,7 +935,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
hdr_len
=
hdr_type_len
[
hdr
->
common
.
lf
];
hdr_len
=
hdr_type_len
[
hdr
->
common
.
lf
];
if
(
hdr
->
common
.
lf
==
ETH1394_HDR_LF_UF
)
{
if
(
hdr
->
common
.
lf
==
ETH1394_HDR_LF_UF
)
{
/* An unfragmented datagram has been received by the ieee1394
/* An unfragmented datagram has been received by the ieee1394
* bus. Build an skbuff around it so we can pass it to the
* bus. Build an skbuff around it so we can pass it to the
* high level network layer. */
* high level network layer. */
...
@@ -945,15 +965,15 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -945,15 +965,15 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
hdr
->
words
.
word3
=
ntohs
(
hdr
->
words
.
word3
);
hdr
->
words
.
word3
=
ntohs
(
hdr
->
words
.
word3
);
/* The 4th header word is reserved so no need to do ntohs() */
/* The 4th header word is reserved so no need to do ntohs() */
if
(
hdr
->
common
.
lf
==
ETH1394_HDR_LF_FF
)
{
if
(
hdr
->
common
.
lf
==
ETH1394_HDR_LF_FF
)
{
ether_type
=
hdr
->
ff
.
ether_type
;
ether_type
=
hdr
->
ff
.
ether_type
;
dgl
=
hdr
->
ff
.
dgl
;
dgl
=
hdr
->
ff
.
dgl
;
dg_size
=
hdr
->
ff
.
dg_size
;
dg_size
=
hdr
->
ff
.
dg_size
+
1
;
fg_off
=
0
;
fg_off
=
0
;
}
else
{
}
else
{
hdr
->
words
.
word2
=
ntohs
(
hdr
->
words
.
word2
);
hdr
->
words
.
word2
=
ntohs
(
hdr
->
words
.
word2
);
dgl
=
hdr
->
sf
.
dgl
;
dgl
=
hdr
->
sf
.
dgl
;
dg_size
=
hdr
->
sf
.
dg_size
;
dg_size
=
hdr
->
sf
.
dg_size
+
1
;
fg_off
=
hdr
->
sf
.
fg_off
;
fg_off
=
hdr
->
sf
.
fg_off
;
}
}
spin_lock_irqsave
(
&
pdg
->
lock
,
flags
);
spin_lock_irqsave
(
&
pdg
->
lock
,
flags
);
...
@@ -961,8 +981,8 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -961,8 +981,8 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
pdgl
=
&
(
pdg
->
list
);
pdgl
=
&
(
pdg
->
list
);
lh
=
find_partial_datagram
(
pdgl
,
dgl
);
lh
=
find_partial_datagram
(
pdgl
,
dgl
);
if
(
lh
==
NULL
)
{
if
(
lh
==
NULL
)
{
if
(
pdg
->
sz
==
max_partial_datagrams
)
{
if
(
pdg
->
sz
==
max_partial_datagrams
)
{
/* remove the oldest */
/* remove the oldest */
purge_partial_datagram
(
pdgl
->
prev
);
purge_partial_datagram
(
pdgl
->
prev
);
pdg
->
sz
--
;
pdg
->
sz
--
;
...
@@ -971,7 +991,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -971,7 +991,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
retval
=
new_partial_datagram
(
dev
,
pdgl
,
dgl
,
dg_size
,
retval
=
new_partial_datagram
(
dev
,
pdgl
,
dgl
,
dg_size
,
buf
+
hdr_len
,
fg_off
,
buf
+
hdr_len
,
fg_off
,
fg_len
);
fg_len
);
if
(
retval
<
0
)
{
if
(
retval
<
0
)
{
spin_unlock_irqrestore
(
&
pdg
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
pdg
->
lock
,
flags
);
goto
bad_proto
;
goto
bad_proto
;
}
}
...
@@ -982,7 +1002,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -982,7 +1002,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
if
(
fragment_overlap
(
&
pd
->
frag_info
,
fg_off
,
fg_len
))
{
if
(
fragment_overlap
(
&
pd
->
frag_info
,
fg_off
,
fg_len
))
{
/* Overlapping fragments, obliterate old
/* Overlapping fragments, obliterate old
* datagram and start new one. */
* datagram and start new one. */
purge_partial_datagram
(
lh
);
purge_partial_datagram
(
lh
);
...
@@ -990,7 +1010,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -990,7 +1010,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
dg_size
,
dg_size
,
buf
+
hdr_len
,
buf
+
hdr_len
,
fg_off
,
fg_len
);
fg_off
,
fg_len
);
if
(
retval
<
0
)
{
if
(
retval
<
0
)
{
pdg
->
sz
--
;
pdg
->
sz
--
;
spin_unlock_irqrestore
(
&
pdg
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
pdg
->
lock
,
flags
);
goto
bad_proto
;
goto
bad_proto
;
...
@@ -999,7 +1019,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -999,7 +1019,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
retval
=
update_partial_datagram
(
pdgl
,
lh
,
retval
=
update_partial_datagram
(
pdgl
,
lh
,
buf
+
hdr_len
,
buf
+
hdr_len
,
fg_off
,
fg_len
);
fg_off
,
fg_len
);
if
(
retval
<
0
)
{
if
(
retval
<
0
)
{
/* Couldn't save off fragment anyway
/* Couldn't save off fragment anyway
* so might as well obliterate the
* so might as well obliterate the
* datagram now. */
* datagram now. */
...
@@ -1013,11 +1033,11 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -1013,11 +1033,11 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
pd
=
list_entry
(
lh
,
struct
partial_datagram
,
list
);
if
(
hdr
->
common
.
lf
==
ETH1394_HDR_LF_FF
)
{
if
(
hdr
->
common
.
lf
==
ETH1394_HDR_LF_FF
)
{
pd
->
ether_type
=
ether_type
;
pd
->
ether_type
=
ether_type
;
}
}
if
(
is_datagram_complete
(
lh
,
dg_size
))
{
if
(
is_datagram_complete
(
lh
,
dg_size
))
{
ether_type
=
pd
->
ether_type
;
ether_type
=
pd
->
ether_type
;
pdg
->
sz
--
;
pdg
->
sz
--
;
skb
=
skb_get
(
pd
->
skb
);
skb
=
skb_get
(
pd
->
skb
);
...
@@ -1044,14 +1064,14 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -1044,14 +1064,14 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
if
(
!
skb
->
protocol
)
{
if
(
!
skb
->
protocol
)
{
priv
->
stats
.
rx_errors
++
;
priv
->
stats
.
rx_errors
++
;
priv
->
stats
.
rx_dropped
++
;
priv
->
stats
.
rx_dropped
++
;
dev_kfree_skb_any
(
skb
);
dev_kfree_skb_any
(
skb
);
goto
bad_proto
;
goto
bad_proto
;
}
}
if
(
netif_rx
(
skb
)
==
NET_RX_DROP
)
{
if
(
netif_rx
(
skb
)
==
NET_RX_DROP
)
{
priv
->
stats
.
rx_errors
++
;
priv
->
stats
.
rx_errors
++
;
priv
->
stats
.
rx_dropped
++
;
priv
->
stats
.
rx_dropped
++
;
goto
bad_proto
;
goto
bad_proto
;
...
@@ -1062,7 +1082,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
...
@@ -1062,7 +1082,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
priv
->
stats
.
rx_bytes
+=
skb
->
len
;
priv
->
stats
.
rx_bytes
+=
skb
->
len
;
bad_proto:
bad_proto:
if
(
netif_queue_stopped
(
dev
))
if
(
netif_queue_stopped
(
dev
))
netif_wake_queue
(
dev
);
netif_wake_queue
(
dev
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
...
@@ -1076,13 +1096,13 @@ static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
...
@@ -1076,13 +1096,13 @@ static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
{
{
struct
host_info
*
hi
=
hpsb_get_hostinfo
(
&
eth1394_highlevel
,
host
);
struct
host_info
*
hi
=
hpsb_get_hostinfo
(
&
eth1394_highlevel
,
host
);
if
(
hi
==
NULL
)
{
if
(
hi
==
NULL
)
{
ETH1394_PRINT_G
(
KERN_ERR
,
"Could not find net device for host %s
\n
"
,
ETH1394_PRINT_G
(
KERN_ERR
,
"Could not find net device for host %s
\n
"
,
host
->
driver
->
name
);
host
->
driver
->
name
);
return
RCODE_ADDRESS_ERROR
;
return
RCODE_ADDRESS_ERROR
;
}
}
if
(
ether1394_data_handler
(
hi
->
dev
,
srcid
,
destid
,
(
char
*
)
data
,
len
))
if
(
ether1394_data_handler
(
hi
->
dev
,
srcid
,
destid
,
(
char
*
)
data
,
len
))
return
RCODE_ADDRESS_ERROR
;
return
RCODE_ADDRESS_ERROR
;
else
else
return
RCODE_COMPLETE
;
return
RCODE_COMPLETE
;
...
@@ -1101,7 +1121,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
...
@@ -1101,7 +1121,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
int
i
;
int
i
;
int
nready
;
int
nready
;
if
(
hi
==
NULL
)
{
if
(
hi
==
NULL
)
{
ETH1394_PRINT_G
(
KERN_ERR
,
"Could not find net device for host %s
\n
"
,
ETH1394_PRINT_G
(
KERN_ERR
,
"Could not find net device for host %s
\n
"
,
iso
->
host
->
driver
->
name
);
iso
->
host
->
driver
->
name
);
return
;
return
;
...
@@ -1110,7 +1130,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
...
@@ -1110,7 +1130,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
dev
=
hi
->
dev
;
dev
=
hi
->
dev
;
nready
=
hpsb_iso_n_ready
(
iso
);
nready
=
hpsb_iso_n_ready
(
iso
);
for
(
i
=
0
;
i
<
nready
;
i
++
)
{
for
(
i
=
0
;
i
<
nready
;
i
++
)
{
struct
hpsb_iso_packet_info
*
info
=
&
iso
->
infos
[
iso
->
first_packet
+
i
];
struct
hpsb_iso_packet_info
*
info
=
&
iso
->
infos
[
iso
->
first_packet
+
i
];
data
=
(
quadlet_t
*
)
(
iso
->
data_buf
.
kvirt
+
info
->
offset
);
data
=
(
quadlet_t
*
)
(
iso
->
data_buf
.
kvirt
+
info
->
offset
);
...
@@ -1124,7 +1144,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
...
@@ -1124,7 +1144,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
priv
=
(
struct
eth1394_priv
*
)
dev
->
priv
;
if
(
info
->
channel
!=
(
iso
->
host
->
csr
.
broadcast_channel
&
0x3f
)
||
if
(
info
->
channel
!=
(
iso
->
host
->
csr
.
broadcast_channel
&
0x3f
)
||
specifier_id
!=
ETHER1394_GASP_SPECIFIER_ID
)
{
specifier_id
!=
ETHER1394_GASP_SPECIFIER_ID
)
{
/* This packet is not for us */
/* This packet is not for us */
continue
;
continue
;
...
@@ -1185,13 +1205,13 @@ static inline unsigned int ether1394_encapsulate_prep(unsigned int max_payload,
...
@@ -1185,13 +1205,13 @@ static inline unsigned int ether1394_encapsulate_prep(unsigned int max_payload,
unsigned
int
adj_max_payload
=
max_payload
-
hdr_type_len
[
ETH1394_HDR_LF_UF
];
unsigned
int
adj_max_payload
=
max_payload
-
hdr_type_len
[
ETH1394_HDR_LF_UF
];
/* Does it all fit in one packet? */
/* Does it all fit in one packet? */
if
(
dg_size
<=
adj_max_payload
)
{
if
(
dg_size
<=
adj_max_payload
)
{
hdr
->
uf
.
lf
=
ETH1394_HDR_LF_UF
;
hdr
->
uf
.
lf
=
ETH1394_HDR_LF_UF
;
hdr
->
uf
.
ether_type
=
proto
;
hdr
->
uf
.
ether_type
=
proto
;
}
else
{
}
else
{
hdr
->
ff
.
lf
=
ETH1394_HDR_LF_FF
;
hdr
->
ff
.
lf
=
ETH1394_HDR_LF_FF
;
hdr
->
ff
.
ether_type
=
proto
;
hdr
->
ff
.
ether_type
=
proto
;
hdr
->
ff
.
dg_size
=
dg_size
;
hdr
->
ff
.
dg_size
=
dg_size
-
1
;
hdr
->
ff
.
dgl
=
dgl
;
hdr
->
ff
.
dgl
=
dgl
;
adj_max_payload
=
max_payload
-
hdr_type_len
[
ETH1394_HDR_LF_FF
];
adj_max_payload
=
max_payload
-
hdr_type_len
[
ETH1394_HDR_LF_FF
];
}
}
...
@@ -1229,7 +1249,7 @@ static inline unsigned int ether1394_encapsulate(struct sk_buff *skb,
...
@@ -1229,7 +1249,7 @@ static inline unsigned int ether1394_encapsulate(struct sk_buff *skb,
default:
default:
hdr
->
sf
.
fg_off
+=
adj_max_payload
;
hdr
->
sf
.
fg_off
+=
adj_max_payload
;
bufhdr
=
(
union
eth1394_hdr
*
)
skb_pull
(
skb
,
adj_max_payload
);
bufhdr
=
(
union
eth1394_hdr
*
)
skb_pull
(
skb
,
adj_max_payload
);
if
(
max_payload
>=
skb
->
len
)
if
(
max_payload
>=
skb
->
len
)
hdr
->
common
.
lf
=
ETH1394_HDR_LF_LF
;
hdr
->
common
.
lf
=
ETH1394_HDR_LF_LF
;
bufhdr
->
words
.
word1
=
htons
(
hdr
->
words
.
word1
);
bufhdr
->
words
.
word1
=
htons
(
hdr
->
words
.
word1
);
bufhdr
->
words
.
word2
=
htons
(
hdr
->
words
.
word2
);
bufhdr
->
words
.
word2
=
htons
(
hdr
->
words
.
word2
);
...
@@ -1245,7 +1265,7 @@ static inline struct hpsb_packet *ether1394_alloc_common_packet(struct hpsb_host
...
@@ -1245,7 +1265,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
=
alloc_hpsb_packet
(
0
);
if
(
p
)
{
if
(
p
)
{
p
->
host
=
host
;
p
->
host
=
host
;
p
->
data
=
NULL
;
p
->
data
=
NULL
;
p
->
generation
=
get_hpsb_generation
(
host
);
p
->
generation
=
get_hpsb_generation
(
host
);
...
@@ -1269,8 +1289,9 @@ static inline int ether1394_prep_write_packet(struct hpsb_packet *p,
...
@@ -1269,8 +1289,9 @@ static inline int ether1394_prep_write_packet(struct hpsb_packet *p,
p
->
header_size
=
16
;
p
->
header_size
=
16
;
p
->
expect_response
=
1
;
p
->
expect_response
=
1
;
if
(
hpsb_get_tlabel
(
p
,
!
in_interrupt
()))
{
if
(
hpsb_get_tlabel
(
p
,
!
in_interrupt
()))
{
ETH1394_PRINT_G
(
KERN_ERR
,
"No more tlabels left"
);
ETH1394_PRINT_G
(
KERN_ERR
,
"No more tlabels left while sending "
"to node "
NODE_BUS_FMT
"
\n
"
,
NODE_BUS_ARGS
(
node
));
return
-
1
;
return
-
1
;
}
}
p
->
header
[
0
]
=
(
p
->
node_id
<<
16
)
|
(
p
->
tlabel
<<
10
)
p
->
header
[
0
]
=
(
p
->
node_id
<<
16
)
|
(
p
->
tlabel
<<
10
)
...
@@ -1309,30 +1330,31 @@ static inline void ether1394_prep_gasp_packet(struct hpsb_packet *p,
...
@@ -1309,30 +1330,31 @@ static inline void ether1394_prep_gasp_packet(struct hpsb_packet *p,
static
inline
void
ether1394_free_packet
(
struct
hpsb_packet
*
packet
)
static
inline
void
ether1394_free_packet
(
struct
hpsb_packet
*
packet
)
{
{
if
(
packet
->
tcode
!=
TCODE_STREAM_DATA
)
hpsb_free_tlabel
(
packet
);
packet
->
data
=
NULL
;
packet
->
data
=
NULL
;
free_hpsb_packet
(
packet
);
free_hpsb_packet
(
packet
);
}
}
static
void
ether1394_complete_cb
(
void
*
__ptask
);
static
void
ether1394_complete_cb
(
void
*
__ptask
);
static
int
ether1394_send_packet
(
struct
packet_task
*
ptask
,
unsigned
int
tx_len
)
static
int
ether1394_send_packet
(
struct
packet_task
*
ptask
,
unsigned
int
tx_len
)
{
{
struct
eth1394_priv
*
priv
=
ptask
->
priv
;
struct
eth1394_priv
*
priv
=
ptask
->
priv
;
struct
hpsb_packet
*
packet
;
struct
hpsb_packet
*
packet
=
NULL
;
packet
=
ether1394_alloc_common_packet
(
priv
->
host
);
packet
=
ether1394_alloc_common_packet
(
priv
->
host
);
if
(
!
packet
)
if
(
!
packet
)
return
-
1
;
return
-
1
;
if
(
ptask
->
tx_type
==
ETH1394_GASP
)
{
if
(
ptask
->
tx_type
==
ETH1394_GASP
)
{
int
length
=
tx_len
+
(
2
*
sizeof
(
quadlet_t
));
int
length
=
tx_len
+
(
2
*
sizeof
(
quadlet_t
));
ether1394_prep_gasp_packet
(
packet
,
priv
,
ptask
->
skb
,
length
);
ether1394_prep_gasp_packet
(
packet
,
priv
,
ptask
->
skb
,
length
);
}
else
if
(
ether1394_prep_write_packet
(
packet
,
priv
->
host
,
}
else
{
if
(
ether1394_prep_write_packet
(
packet
,
priv
->
host
,
ptask
->
dest_node
,
ptask
->
dest_node
,
ptask
->
addr
,
ptask
->
skb
->
data
,
ptask
->
addr
,
ptask
->
skb
->
data
,
tx_len
))
tx_len
))
{
goto
fail
;
goto
fail
;
}
}
...
@@ -1340,10 +1362,13 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
...
@@ -1340,10 +1362,13 @@ 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
))
return
0
;
return
0
;
}
fail:
fail:
if
(
packet
)
ether1394_free_packet
(
packet
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1357,7 +1382,7 @@ static inline void ether1394_dg_complete(struct packet_task *ptask, int fail)
...
@@ -1357,7 +1382,7 @@ static inline void ether1394_dg_complete(struct packet_task *ptask, int fail)
unsigned
long
flags
;
unsigned
long
flags
;
/* Statistics */
/* Statistics */
if
(
fail
)
{
if
(
fail
)
{
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
priv
->
stats
.
tx_dropped
++
;
priv
->
stats
.
tx_dropped
++
;
priv
->
stats
.
tx_errors
++
;
priv
->
stats
.
tx_errors
++
;
...
@@ -1382,22 +1407,20 @@ static void ether1394_complete_cb(void *__ptask)
...
@@ -1382,22 +1407,20 @@ static void ether1394_complete_cb(void *__ptask)
struct
hpsb_packet
*
packet
=
ptask
->
packet
;
struct
hpsb_packet
*
packet
=
ptask
->
packet
;
int
fail
=
0
;
int
fail
=
0
;
if
(
packet
->
tcode
!=
TCODE_STREAM_DATA
)
{
if
(
packet
->
tcode
!=
TCODE_STREAM_DATA
)
fail
=
hpsb_packet_success
(
packet
);
fail
=
hpsb_packet_success
(
packet
);
hpsb_free_tlabel
(
packet
);
}
ether1394_free_packet
(
packet
);
ether1394_free_packet
(
packet
);
ptask
->
outstanding_pkts
--
;
ptask
->
outstanding_pkts
--
;
if
(
ptask
->
outstanding_pkts
>
0
&&
!
fail
)
if
(
ptask
->
outstanding_pkts
>
0
&&
!
fail
)
{
{
int
tx_len
;
int
tx_len
;
/* Add the encapsulation header to the fragment */
/* Add the encapsulation header to the fragment */
tx_len
=
ether1394_encapsulate
(
ptask
->
skb
,
ptask
->
max_payload
,
tx_len
=
ether1394_encapsulate
(
ptask
->
skb
,
ptask
->
max_payload
,
&
ptask
->
hdr
);
&
ptask
->
hdr
);
if
(
ether1394_send_packet
(
ptask
,
tx_len
))
if
(
ether1394_send_packet
(
ptask
,
tx_len
))
ether1394_dg_complete
(
ptask
,
1
);
ether1394_dg_complete
(
ptask
,
1
);
}
else
{
}
else
{
ether1394_dg_complete
(
ptask
,
fail
);
ether1394_dg_complete
(
ptask
,
fail
);
...
@@ -1424,14 +1447,8 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1424,14 +1447,8 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
struct
packet_task
*
ptask
;
struct
packet_task
*
ptask
;
struct
node_entry
*
ne
;
struct
node_entry
*
ne
;
if
(
skb_is_nonlinear
(
skb
))
{
ret
=
skb_linearize
(
skb
,
kmflags
);
if
(
ret
)
goto
fail
;
}
ptask
=
kmem_cache_alloc
(
packet_task_cache
,
kmflags
);
ptask
=
kmem_cache_alloc
(
packet_task_cache
,
kmflags
);
if
(
ptask
==
NULL
)
{
if
(
ptask
==
NULL
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
fail
;
goto
fail
;
}
}
...
@@ -1446,7 +1463,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1446,7 +1463,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
}
}
if
(
priv
->
bc_state
==
ETHER1394_BC_CHECK
)
{
if
(
priv
->
bc_state
==
ETHER1394_BC_CHECK
)
{
if
(
ether1394_init_bc
(
dev
))
{
if
(
ether1394_init_bc
(
dev
))
{
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
goto
fail
;
goto
fail
;
}
}
...
@@ -1464,7 +1481,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1464,7 +1481,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
skb_pull
(
skb
,
ETH1394_HLEN
);
skb_pull
(
skb
,
ETH1394_HLEN
);
ne
=
hpsb_guid_get_entry
(
be64_to_cpu
(
*
(
u64
*
)
eth
->
h_dest
));
ne
=
hpsb_guid_get_entry
(
be64_to_cpu
(
*
(
u64
*
)
eth
->
h_dest
));
if
(
!
ne
)
if
(
!
ne
)
dest_node
=
LOCAL_BUS
|
ALL_NODES
;
dest_node
=
LOCAL_BUS
|
ALL_NODES
;
else
else
dest_node
=
ne
->
nodeid
;
dest_node
=
ne
->
nodeid
;
...
@@ -1479,7 +1496,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1479,7 +1496,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
/* This check should be unnecessary, but we'll keep it for safety for
/* This check should be unnecessary, but we'll keep it for safety for
* a while longer. */
* a while longer. */
if
(
max_payload
<
512
)
{
if
(
max_payload
<
512
)
{
ETH1394_PRINT
(
KERN_WARNING
,
dev
->
name
,
ETH1394_PRINT
(
KERN_WARNING
,
dev
->
name
,
"max_payload too small: %d (setting to 512)
\n
"
,
"max_payload too small: %d (setting to 512)
\n
"
,
max_payload
);
max_payload
);
...
@@ -1487,13 +1504,11 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1487,13 +1504,11 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
}
}
/* Set the transmission type for the packet. ARP packets and IP
/* Set the transmission type for the packet. ARP packets and IP
* broadcast packets are sent via GASP, however, we cheat a little bit
* broadcast packets are sent via GASP. */
* when detecting IP broadcast packets. This will need to change when
if
(
memcmp
(
eth
->
h_dest
,
dev
->
broadcast
,
ETH1394_ALEN
)
==
0
||
* we switch from using node id for the hardware address to the EUI
proto
==
__constant_htons
(
ETH_P_ARP
)
||
* which we should be using instead. IP multicast is not yet
(
proto
==
__constant_htons
(
ETH_P_IP
)
&&
* supported. */
IN_MULTICAST
(
__constant_ntohl
(
skb
->
nh
.
iph
->
daddr
))))
{
if
((
memcmp
(
eth
->
h_dest
,
dev
->
broadcast
,
ETH1394_ALEN
)
==
0
)
||
(
proto
==
__constant_htons
(
ETH_P_ARP
)))
{
tx_type
=
ETH1394_GASP
;
tx_type
=
ETH1394_GASP
;
max_payload
-=
ETHER1394_GASP_OVERHEAD
;
max_payload
-=
ETHER1394_GASP_OVERHEAD
;
}
else
{
}
else
{
...
@@ -1504,7 +1519,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1504,7 +1519,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
dgl
=
priv
->
dgl
[
NODEID_TO_NODE
(
dest_node
)];
dgl
=
priv
->
dgl
[
NODEID_TO_NODE
(
dest_node
)];
if
(
max_payload
<
dg_size
+
hdr_type_len
[
ETH1394_HDR_LF_UF
])
if
(
max_payload
<
dg_size
+
hdr_type_len
[
ETH1394_HDR_LF_UF
])
priv
->
dgl
[
NODEID_TO_NODE
(
dest_node
)]
++
;
priv
->
dgl
[
NODEID_TO_NODE
(
dest_node
)]
++
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
...
@@ -1516,14 +1531,14 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1516,14 +1531,14 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
ptask
->
priv
=
priv
;
ptask
->
priv
=
priv
;
ptask
->
tx_type
=
tx_type
;
ptask
->
tx_type
=
tx_type
;
if
(
tx_type
!=
ETH1394_GASP
)
{
if
(
tx_type
!=
ETH1394_GASP
)
{
u64
addr
;
u64
addr
;
/* This test is just temporary until ConfigROM support has
/* This test is just temporary until ConfigROM support has
* been added to eth1394. Until then, we need an ARP packet
* been added to eth1394. Until then, we need an ARP packet
* after a bus reset from the current destination node so that
* after a bus reset from the current destination node so that
* we can get FIFO information. */
* we can get FIFO information. */
if
(
priv
->
fifo
[
NODEID_TO_NODE
(
dest_node
)]
==
0ULL
)
{
if
(
priv
->
fifo
[
NODEID_TO_NODE
(
dest_node
)]
==
0ULL
)
{
ret
=
-
EAGAIN
;
ret
=
-
EAGAIN
;
goto
fail
;
goto
fail
;
}
}
...
@@ -1545,19 +1560,17 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1545,19 +1560,17 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
/* Add the encapsulation header to the fragment */
/* Add the encapsulation header to the fragment */
tx_len
=
ether1394_encapsulate
(
skb
,
max_payload
,
&
ptask
->
hdr
);
tx_len
=
ether1394_encapsulate
(
skb
,
max_payload
,
&
ptask
->
hdr
);
dev
->
trans_start
=
jiffies
;
dev
->
trans_start
=
jiffies
;
if
(
ether1394_send_packet
(
ptask
,
tx_len
))
if
(
ether1394_send_packet
(
ptask
,
tx_len
))
goto
fail
;
goto
fail
;
netif_wake_queue
(
dev
);
netif_wake_queue
(
dev
);
return
0
;
return
0
;
fail:
fail:
if
(
ptask
->
packet
)
if
(
ptask
)
ether1394_free_packet
(
ptask
->
packet
);
if
(
ptask
)
kmem_cache_free
(
packet_task_cache
,
ptask
);
kmem_cache_free
(
packet_task_cache
,
ptask
);
if
(
skb
!=
NULL
)
{
if
(
skb
!=
NULL
)
dev_kfree_skb
(
skb
);
dev_kfree_skb
(
skb
);
}
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
priv
->
stats
.
tx_dropped
++
;
priv
->
stats
.
tx_dropped
++
;
...
@@ -1570,6 +1583,53 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
...
@@ -1570,6 +1583,53 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
return
0
;
/* returning non-zero causes serious problems */
return
0
;
/* returning non-zero causes serious problems */
}
}
static
int
ether1394_do_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
ifr
,
int
cmd
)
{
switch
(
cmd
)
{
case
SIOCETHTOOL
:
return
ether1394_ethtool_ioctl
(
dev
,
(
void
*
)
ifr
->
ifr_data
);
case
SIOCGMIIPHY
:
/* Get address of MII PHY in use. */
case
SIOCGMIIREG
:
/* Read MII PHY register. */
case
SIOCSMIIREG
:
/* Write MII PHY register. */
default:
return
-
EOPNOTSUPP
;
}
return
0
;
}
static
int
ether1394_ethtool_ioctl
(
struct
net_device
*
dev
,
void
*
useraddr
)
{
u32
ethcmd
;
if
(
get_user
(
ethcmd
,
(
u32
*
)
useraddr
))
return
-
EFAULT
;
switch
(
ethcmd
)
{
case
ETHTOOL_GDRVINFO
:
{
struct
ethtool_drvinfo
info
=
{
ETHTOOL_GDRVINFO
};
strcpy
(
info
.
driver
,
driver_name
);
strcpy
(
info
.
version
,
"$Rev: 971 $"
);
/* FIXME XXX provide sane businfo */
strcpy
(
info
.
bus_info
,
"ieee1394"
);
if
(
copy_to_user
(
useraddr
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
break
;
}
case
ETHTOOL_GSET
:
case
ETHTOOL_SSET
:
case
ETHTOOL_NWAY_RST
:
case
ETHTOOL_GLINK
:
case
ETHTOOL_GMSGLVL
:
case
ETHTOOL_SMSGLVL
:
default:
return
-
EOPNOTSUPP
;
}
return
0
;
}
/* Function for incoming 1394 packets */
/* Function for incoming 1394 packets */
static
struct
hpsb_address_ops
addr_ops
=
{
static
struct
hpsb_address_ops
addr_ops
=
{
.
write
=
ether1394_write
,
.
write
=
ether1394_write
,
...
@@ -1577,7 +1637,7 @@ static struct hpsb_address_ops addr_ops = {
...
@@ -1577,7 +1637,7 @@ static struct hpsb_address_ops addr_ops = {
/* Ieee1394 highlevel driver functions */
/* Ieee1394 highlevel driver functions */
static
struct
hpsb_highlevel
eth1394_highlevel
=
{
static
struct
hpsb_highlevel
eth1394_highlevel
=
{
.
name
=
ETHER1394_DRIVER_NAME
,
.
name
=
driver_name
,
.
add_host
=
ether1394_add_host
,
.
add_host
=
ether1394_add_host
,
.
remove_host
=
ether1394_remove_host
,
.
remove_host
=
ether1394_remove_host
,
.
host_reset
=
ether1394_host_reset
,
.
host_reset
=
ether1394_host_reset
,
...
...
drivers/ieee1394/ieee1394.h
View file @
11092356
...
@@ -46,14 +46,14 @@
...
@@ -46,14 +46,14 @@
#define ACKX_TIMEOUT (-4)
#define ACKX_TIMEOUT (-4)
#define SPEED_100 0x00
#define
IEEE1394_
SPEED_100 0x00
#define SPEED_200 0x01
#define
IEEE1394_
SPEED_200 0x01
#define SPEED_400 0x02
#define
IEEE1394_
SPEED_400 0x02
#define SPEED_800 0x03
#define
IEEE1394_
SPEED_800 0x03
#define SPEED_1600 0x04
#define
IEEE1394_
SPEED_1600 0x04
#define SPEED_3200 0x05
#define
IEEE1394_
SPEED_3200 0x05
/* The current highest tested speed supported by the subsystem */
/* The current highest tested speed supported by the subsystem */
#define
SPEED_MAX
SPEED_800
#define
IEEE1394_SPEED_MAX IEEE1394_
SPEED_800
/* Maps speed values above to a string representation */
/* Maps speed values above to a string representation */
extern
const
char
*
hpsb_speedto_str
[];
extern
const
char
*
hpsb_speedto_str
[];
...
...
drivers/ieee1394/ieee1394_core.c
View file @
11092356
...
@@ -289,7 +289,7 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
...
@@ -289,7 +289,7 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
for
(
i
=
0
;
i
<
(
nodecount
*
64
);
i
+=
64
)
{
for
(
i
=
0
;
i
<
(
nodecount
*
64
);
i
+=
64
)
{
for
(
j
=
0
;
j
<
nodecount
;
j
++
)
{
for
(
j
=
0
;
j
<
nodecount
;
j
++
)
{
map
[
i
+
j
]
=
SPEED_MAX
;
map
[
i
+
j
]
=
IEEE1394_
SPEED_MAX
;
}
}
}
}
...
@@ -458,7 +458,7 @@ int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
...
@@ -458,7 +458,7 @@ int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
struct
hpsb_packet
*
packet
;
struct
hpsb_packet
*
packet
;
int
retval
=
0
;
int
retval
=
0
;
if
(
rootid
>=
ALL_NODES
||
rootid
<
-
1
||
gapcnt
>
0x3f
||
gapcnt
<
-
1
||
if
(
rootid
>=
ALL_NODES
||
rootid
<
-
1
||
gapcnt
>
0x3f
||
gapcnt
<
-
1
||
(
rootid
==
-
1
&&
gapcnt
==
-
1
))
{
(
rootid
==
-
1
&&
gapcnt
==
-
1
))
{
HPSB_DEBUG
(
"Invalid Parameter: rootid = %d gapcnt = %d"
,
HPSB_DEBUG
(
"Invalid Parameter: rootid = %d gapcnt = %d"
,
rootid
,
gapcnt
);
rootid
,
gapcnt
);
...
@@ -470,22 +470,21 @@ int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
...
@@ -470,22 +470,21 @@ int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
return
-
ENOMEM
;
return
-
ENOMEM
;
packet
->
host
=
host
;
packet
->
host
=
host
;
packet
->
header_size
=
16
;
packet
->
header_size
=
8
;
packet
->
data_size
=
0
;
packet
->
data_size
=
0
;
packet
->
expect_response
=
0
;
packet
->
expect_response
=
0
;
packet
->
no_waiter
=
0
;
packet
->
no_waiter
=
0
;
packet
->
type
=
hpsb_raw
;
packet
->
type
=
hpsb_raw
;
packet
->
header
[
0
]
=
0
;
packet
->
header
[
0
]
=
0
;
if
(
rootid
!=
-
1
)
if
(
rootid
!=
-
1
)
packet
->
header
[
0
]
|=
rootid
<<
24
|
1
<<
23
;
packet
->
header
[
0
]
|=
rootid
<<
24
|
1
<<
23
;
if
(
gapcnt
!=
-
1
)
if
(
gapcnt
!=
-
1
)
packet
->
header
[
0
]
|=
gapcnt
<<
16
|
1
<<
22
;
packet
->
header
[
0
]
|=
gapcnt
<<
16
|
1
<<
22
;
packet
->
header
[
1
]
=
~
packet
->
header
[
0
];
packet
->
header
[
1
]
=
~
packet
->
header
[
0
];
packet
->
generation
=
get_hpsb_generation
(
host
);
packet
->
generation
=
get_hpsb_generation
(
host
);
HPSB_DEBUG
(
"Sending PHY configuration packet (I hope)..."
);
if
(
!
hpsb_send_packet
(
packet
))
{
if
(
!
hpsb_send_packet
(
packet
))
{
retval
=
-
EINVAL
;
retval
=
-
EINVAL
;
goto
fail
;
goto
fail
;
...
@@ -1030,12 +1029,12 @@ int ieee1394_register_chardev(int blocknum,
...
@@ -1030,12 +1029,12 @@ int ieee1394_register_chardev(int blocknum,
{
{
int
retval
;
int
retval
;
if
(
(
blocknum
<
0
)
||
(
blocknum
>
15
)
)
if
(
(
blocknum
<
0
)
||
(
blocknum
>
15
)
)
return
-
EINVAL
;
return
-
EINVAL
;
write_lock
(
&
ieee1394_chardevs_lock
);
write_lock
(
&
ieee1394_chardevs_lock
);
if
(
ieee1394_chardevs
[
blocknum
].
file_ops
==
NULL
)
{
if
(
ieee1394_chardevs
[
blocknum
].
file_ops
==
NULL
)
{
/* grab the minor block */
/* grab the minor block */
ieee1394_chardevs
[
blocknum
].
file_ops
=
file_ops
;
ieee1394_chardevs
[
blocknum
].
file_ops
=
file_ops
;
ieee1394_chardevs
[
blocknum
].
module
=
module
;
ieee1394_chardevs
[
blocknum
].
module
=
module
;
...
@@ -1054,12 +1053,12 @@ int ieee1394_register_chardev(int blocknum,
...
@@ -1054,12 +1053,12 @@ int ieee1394_register_chardev(int blocknum,
/* release a block of minor numbers */
/* release a block of minor numbers */
void
ieee1394_unregister_chardev
(
int
blocknum
)
void
ieee1394_unregister_chardev
(
int
blocknum
)
{
{
if
(
(
blocknum
<
0
)
||
(
blocknum
>
15
)
)
if
(
(
blocknum
<
0
)
||
(
blocknum
>
15
)
)
return
;
return
;
write_lock
(
&
ieee1394_chardevs_lock
);
write_lock
(
&
ieee1394_chardevs_lock
);
if
(
ieee1394_chardevs
[
blocknum
].
file_ops
)
{
if
(
ieee1394_chardevs
[
blocknum
].
file_ops
)
{
ieee1394_chardevs
[
blocknum
].
file_ops
=
NULL
;
ieee1394_chardevs
[
blocknum
].
file_ops
=
NULL
;
ieee1394_chardevs
[
blocknum
].
module
=
NULL
;
ieee1394_chardevs
[
blocknum
].
module
=
NULL
;
}
}
...
@@ -1139,7 +1138,7 @@ static int ieee1394_dispatch_open(struct inode *inode, struct file *file)
...
@@ -1139,7 +1138,7 @@ static int ieee1394_dispatch_open(struct inode *inode, struct file *file)
/* look up the driver */
/* look up the driver */
if
(
ieee1394_get_chardev
(
blocknum
,
&
module
,
&
file_ops
)
==
0
)
if
(
ieee1394_get_chardev
(
blocknum
,
&
module
,
&
file_ops
)
==
0
)
return
-
ENODEV
;
return
-
ENODEV
;
/* redirect all subsequent requests to the driver's
/* redirect all subsequent requests to the driver's
...
...
drivers/ieee1394/ieee1394_core.h
View file @
11092356
...
@@ -34,7 +34,7 @@ struct hpsb_packet {
...
@@ -34,7 +34,7 @@ struct hpsb_packet {
}
__attribute__
((
packed
))
state
;
}
__attribute__
((
packed
))
state
;
/* These are core internal. */
/* These are core internal. */
char
tlabel
;
signed
char
tlabel
;
char
ack_code
;
char
ack_code
;
char
tcode
;
char
tcode
;
...
...
drivers/ieee1394/ieee1394_transactions.c
View file @
11092356
...
@@ -95,7 +95,7 @@ static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data)
...
@@ -95,7 +95,7 @@ static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data)
packet
->
data_size
=
0
;
packet
->
data_size
=
0
;
packet
->
expect_response
=
0
;
packet
->
expect_response
=
0
;
packet
->
type
=
hpsb_raw
;
/* No CRC added */
packet
->
type
=
hpsb_raw
;
/* No CRC added */
packet
->
speed_code
=
SPEED_100
;
/* Force speed to be 100Mbps */
packet
->
speed_code
=
IEEE1394_
SPEED_100
;
/* Force speed to be 100Mbps */
}
}
static
void
fill_async_stream_packet
(
struct
hpsb_packet
*
packet
,
int
length
,
static
void
fill_async_stream_packet
(
struct
hpsb_packet
*
packet
,
int
length
,
...
@@ -147,7 +147,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet, int wait)
...
@@ -147,7 +147,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet, int wait)
spin_lock_irqsave
(
&
tp
->
lock
,
flags
);
spin_lock_irqsave
(
&
tp
->
lock
,
flags
);
packet
->
tlabel
=
find_next_zero_bit
(
tp
->
pool
,
64
,
tp
->
next
);
packet
->
tlabel
=
find_next_zero_bit
(
tp
->
pool
,
64
,
tp
->
next
);
if
(
packet
->
tlabel
>
63
)
if
(
packet
->
tlabel
>
63
)
packet
->
tlabel
=
find_first_zero_bit
(
tp
->
pool
,
64
);
packet
->
tlabel
=
find_first_zero_bit
(
tp
->
pool
,
64
);
tp
->
next
=
(
packet
->
tlabel
+
1
)
%
64
;
tp
->
next
=
(
packet
->
tlabel
+
1
)
%
64
;
/* Should _never_ happen */
/* Should _never_ happen */
...
...
drivers/ieee1394/ieee1394_types.h
View file @
11092356
...
@@ -40,7 +40,7 @@ do { \
...
@@ -40,7 +40,7 @@ do { \
(_tp)->next = 0; \
(_tp)->next = 0; \
(_tp)->allocations = 0; \
(_tp)->allocations = 0; \
sema_init(&(_tp)->count, 63); \
sema_init(&(_tp)->count, 63); \
} while(0)
} while
(0)
typedef
u32
quadlet_t
;
typedef
u32
quadlet_t
;
...
...
drivers/ieee1394/iso.c
View file @
11092356
...
@@ -25,7 +25,7 @@ void hpsb_iso_stop(struct hpsb_iso *iso)
...
@@ -25,7 +25,7 @@ void hpsb_iso_stop(struct hpsb_iso *iso)
void
hpsb_iso_shutdown
(
struct
hpsb_iso
*
iso
)
void
hpsb_iso_shutdown
(
struct
hpsb_iso
*
iso
)
{
{
if
(
iso
->
flags
&
HPSB_ISO_DRIVER_INIT
)
{
if
(
iso
->
flags
&
HPSB_ISO_DRIVER_INIT
)
{
hpsb_iso_stop
(
iso
);
hpsb_iso_stop
(
iso
);
iso
->
host
->
driver
->
isoctl
(
iso
,
iso
->
type
==
HPSB_ISO_XMIT
?
iso
->
host
->
driver
->
isoctl
(
iso
,
iso
->
type
==
HPSB_ISO_XMIT
?
XMIT_SHUTDOWN
:
RECV_SHUTDOWN
,
0
);
XMIT_SHUTDOWN
:
RECV_SHUTDOWN
,
0
);
...
@@ -47,7 +47,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
...
@@ -47,7 +47,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
int
dma_direction
;
int
dma_direction
;
/* make sure driver supports the ISO API */
/* make sure driver supports the ISO API */
if
(
!
host
->
driver
->
isoctl
)
{
if
(
!
host
->
driver
->
isoctl
)
{
printk
(
KERN_INFO
"ieee1394: host driver '%s' does not support the rawiso API
\n
"
,
printk
(
KERN_INFO
"ieee1394: host driver '%s' does not support the rawiso API
\n
"
,
host
->
driver
->
name
);
host
->
driver
->
name
);
return
NULL
;
return
NULL
;
...
@@ -55,23 +55,23 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
...
@@ -55,23 +55,23 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
/* sanitize parameters */
/* sanitize parameters */
if
(
buf_packets
<
2
)
if
(
buf_packets
<
2
)
buf_packets
=
2
;
buf_packets
=
2
;
if
(
irq_interval
<
1
||
irq_interval
>
buf_packets
/
2
)
if
(
irq_interval
<
1
||
irq_interval
>
buf_packets
/
2
)
irq_interval
=
buf_packets
/
2
;
irq_interval
=
buf_packets
/
2
;
if
(
channel
<
-
1
||
channel
>=
64
)
if
(
channel
<
-
1
||
channel
>=
64
)
return
NULL
;
return
NULL
;
/* channel = -1 is OK for multi-channel recv but not for xmit */
/* channel = -1 is OK for multi-channel recv but not for xmit */
if
(
type
==
HPSB_ISO_XMIT
&&
channel
<
0
)
if
(
type
==
HPSB_ISO_XMIT
&&
channel
<
0
)
return
NULL
;
return
NULL
;
/* allocate and write the struct hpsb_iso */
/* allocate and write the struct hpsb_iso */
iso
=
kmalloc
(
sizeof
(
*
iso
)
+
buf_packets
*
sizeof
(
struct
hpsb_iso_packet_info
),
GFP_KERNEL
);
iso
=
kmalloc
(
sizeof
(
*
iso
)
+
buf_packets
*
sizeof
(
struct
hpsb_iso_packet_info
),
GFP_KERNEL
);
if
(
!
iso
)
if
(
!
iso
)
return
NULL
;
return
NULL
;
iso
->
infos
=
(
struct
hpsb_iso_packet_info
*
)(
iso
+
1
);
iso
->
infos
=
(
struct
hpsb_iso_packet_info
*
)(
iso
+
1
);
...
@@ -90,7 +90,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
...
@@ -90,7 +90,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
iso
->
first_packet
=
0
;
iso
->
first_packet
=
0
;
spin_lock_init
(
&
iso
->
lock
);
spin_lock_init
(
&
iso
->
lock
);
if
(
iso
->
type
==
HPSB_ISO_XMIT
)
{
if
(
iso
->
type
==
HPSB_ISO_XMIT
)
{
iso
->
n_ready_packets
=
iso
->
buf_packets
;
iso
->
n_ready_packets
=
iso
->
buf_packets
;
dma_direction
=
PCI_DMA_TODEVICE
;
dma_direction
=
PCI_DMA_TODEVICE
;
}
else
{
}
else
{
...
@@ -103,7 +103,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
...
@@ -103,7 +103,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
iso
->
prebuffer
=
0
;
iso
->
prebuffer
=
0
;
/* allocate the packet buffer */
/* allocate the packet buffer */
if
(
dma_region_alloc
(
&
iso
->
data_buf
,
iso
->
buf_size
,
host
->
pdev
,
dma_direction
))
if
(
dma_region_alloc
(
&
iso
->
data_buf
,
iso
->
buf_size
,
host
->
pdev
,
dma_direction
))
goto
err
;
goto
err
;
return
iso
;
return
iso
;
...
@@ -137,13 +137,13 @@ struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host,
...
@@ -137,13 +137,13 @@ 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
,
irq_interval
,
callback
);
if
(
!
iso
)
if
(
!
iso
)
return
NULL
;
return
NULL
;
iso
->
speed
=
speed
;
iso
->
speed
=
speed
;
/* tell the driver to start working */
/* tell the driver to start working */
if
(
host
->
driver
->
isoctl
(
iso
,
XMIT_INIT
,
0
))
if
(
host
->
driver
->
isoctl
(
iso
,
XMIT_INIT
,
0
))
goto
err
;
goto
err
;
iso
->
flags
|=
HPSB_ISO_DRIVER_INIT
;
iso
->
flags
|=
HPSB_ISO_DRIVER_INIT
;
...
@@ -164,11 +164,11 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
...
@@ -164,11 +164,11 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
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
,
irq_interval
,
callback
);
if
(
!
iso
)
if
(
!
iso
)
return
NULL
;
return
NULL
;
/* tell the driver to start working */
/* tell the driver to start working */
if
(
host
->
driver
->
isoctl
(
iso
,
RECV_INIT
,
0
))
if
(
host
->
driver
->
isoctl
(
iso
,
RECV_INIT
,
0
))
goto
err
;
goto
err
;
iso
->
flags
|=
HPSB_ISO_DRIVER_INIT
;
iso
->
flags
|=
HPSB_ISO_DRIVER_INIT
;
...
@@ -181,21 +181,21 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
...
@@ -181,21 +181,21 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
int
hpsb_iso_recv_listen_channel
(
struct
hpsb_iso
*
iso
,
unsigned
char
channel
)
int
hpsb_iso_recv_listen_channel
(
struct
hpsb_iso
*
iso
,
unsigned
char
channel
)
{
{
if
(
iso
->
type
!=
HPSB_ISO_RECV
||
iso
->
channel
!=
-
1
||
channel
>=
64
)
if
(
iso
->
type
!=
HPSB_ISO_RECV
||
iso
->
channel
!=
-
1
||
channel
>=
64
)
return
-
EINVAL
;
return
-
EINVAL
;
return
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_LISTEN_CHANNEL
,
channel
);
return
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_LISTEN_CHANNEL
,
channel
);
}
}
int
hpsb_iso_recv_unlisten_channel
(
struct
hpsb_iso
*
iso
,
unsigned
char
channel
)
int
hpsb_iso_recv_unlisten_channel
(
struct
hpsb_iso
*
iso
,
unsigned
char
channel
)
{
{
if
(
iso
->
type
!=
HPSB_ISO_RECV
||
iso
->
channel
!=
-
1
||
channel
>=
64
)
if
(
iso
->
type
!=
HPSB_ISO_RECV
||
iso
->
channel
!=
-
1
||
channel
>=
64
)
return
-
EINVAL
;
return
-
EINVAL
;
return
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_UNLISTEN_CHANNEL
,
channel
);
return
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_UNLISTEN_CHANNEL
,
channel
);
}
}
int
hpsb_iso_recv_set_channel_mask
(
struct
hpsb_iso
*
iso
,
u64
mask
)
int
hpsb_iso_recv_set_channel_mask
(
struct
hpsb_iso
*
iso
,
u64
mask
)
{
{
if
(
iso
->
type
!=
HPSB_ISO_RECV
||
iso
->
channel
!=
-
1
)
if
(
iso
->
type
!=
HPSB_ISO_RECV
||
iso
->
channel
!=
-
1
)
return
-
EINVAL
;
return
-
EINVAL
;
return
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_SET_CHANNEL_MASK
,
(
unsigned
long
)
&
mask
);
return
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_SET_CHANNEL_MASK
,
(
unsigned
long
)
&
mask
);
}
}
...
@@ -203,7 +203,7 @@ int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)
...
@@ -203,7 +203,7 @@ int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)
static
int
do_iso_xmit_start
(
struct
hpsb_iso
*
iso
,
int
cycle
)
static
int
do_iso_xmit_start
(
struct
hpsb_iso
*
iso
,
int
cycle
)
{
{
int
retval
=
iso
->
host
->
driver
->
isoctl
(
iso
,
XMIT_START
,
cycle
);
int
retval
=
iso
->
host
->
driver
->
isoctl
(
iso
,
XMIT_START
,
cycle
);
if
(
retval
)
if
(
retval
)
return
retval
;
return
retval
;
iso
->
flags
|=
HPSB_ISO_DRIVER_STARTED
;
iso
->
flags
|=
HPSB_ISO_DRIVER_STARTED
;
...
@@ -212,25 +212,25 @@ static int do_iso_xmit_start(struct hpsb_iso *iso, int cycle)
...
@@ -212,25 +212,25 @@ static int do_iso_xmit_start(struct hpsb_iso *iso, int cycle)
int
hpsb_iso_xmit_start
(
struct
hpsb_iso
*
iso
,
int
cycle
,
int
prebuffer
)
int
hpsb_iso_xmit_start
(
struct
hpsb_iso
*
iso
,
int
cycle
,
int
prebuffer
)
{
{
if
(
iso
->
type
!=
HPSB_ISO_XMIT
)
if
(
iso
->
type
!=
HPSB_ISO_XMIT
)
return
-
1
;
return
-
1
;
if
(
iso
->
flags
&
HPSB_ISO_DRIVER_STARTED
)
if
(
iso
->
flags
&
HPSB_ISO_DRIVER_STARTED
)
return
0
;
return
0
;
if
(
cycle
<
-
1
)
if
(
cycle
<
-
1
)
cycle
=
-
1
;
cycle
=
-
1
;
else
if
(
cycle
>=
8000
)
else
if
(
cycle
>=
8000
)
cycle
%=
8000
;
cycle
%=
8000
;
iso
->
xmit_cycle
=
cycle
;
iso
->
xmit_cycle
=
cycle
;
if
(
prebuffer
<
0
)
if
(
prebuffer
<
0
)
prebuffer
=
iso
->
buf_packets
;
prebuffer
=
iso
->
buf_packets
;
else
if
(
prebuffer
==
0
)
else
if
(
prebuffer
==
0
)
prebuffer
=
1
;
prebuffer
=
1
;
if
(
prebuffer
>
iso
->
buf_packets
)
if
(
prebuffer
>
iso
->
buf_packets
)
prebuffer
=
iso
->
buf_packets
;
prebuffer
=
iso
->
buf_packets
;
iso
->
prebuffer
=
prebuffer
;
iso
->
prebuffer
=
prebuffer
;
...
@@ -247,20 +247,20 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
...
@@ -247,20 +247,20 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
int
retval
=
0
;
int
retval
=
0
;
int
isoctl_args
[
3
];
int
isoctl_args
[
3
];
if
(
iso
->
type
!=
HPSB_ISO_RECV
)
if
(
iso
->
type
!=
HPSB_ISO_RECV
)
return
-
1
;
return
-
1
;
if
(
iso
->
flags
&
HPSB_ISO_DRIVER_STARTED
)
if
(
iso
->
flags
&
HPSB_ISO_DRIVER_STARTED
)
return
0
;
return
0
;
if
(
cycle
<
-
1
)
if
(
cycle
<
-
1
)
cycle
=
-
1
;
cycle
=
-
1
;
else
if
(
cycle
>=
8000
)
else
if
(
cycle
>=
8000
)
cycle
%=
8000
;
cycle
%=
8000
;
isoctl_args
[
0
]
=
cycle
;
isoctl_args
[
0
]
=
cycle
;
if
(
tag_mask
<
0
)
if
(
tag_mask
<
0
)
/* match all tags */
/* match all tags */
tag_mask
=
0xF
;
tag_mask
=
0xF
;
isoctl_args
[
1
]
=
tag_mask
;
isoctl_args
[
1
]
=
tag_mask
;
...
@@ -268,7 +268,7 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
...
@@ -268,7 +268,7 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
isoctl_args
[
2
]
=
sync
;
isoctl_args
[
2
]
=
sync
;
retval
=
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_START
,
(
unsigned
long
)
&
isoctl_args
[
0
]);
retval
=
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_START
,
(
unsigned
long
)
&
isoctl_args
[
0
]);
if
(
retval
)
if
(
retval
)
return
retval
;
return
retval
;
iso
->
flags
|=
HPSB_ISO_DRIVER_STARTED
;
iso
->
flags
|=
HPSB_ISO_DRIVER_STARTED
;
...
@@ -282,15 +282,15 @@ static int hpsb_iso_check_offset_len(struct hpsb_iso *iso,
...
@@ -282,15 +282,15 @@ static int hpsb_iso_check_offset_len(struct hpsb_iso *iso,
unsigned
int
offset
,
unsigned
short
len
,
unsigned
int
offset
,
unsigned
short
len
,
unsigned
int
*
out_offset
,
unsigned
short
*
out_len
)
unsigned
int
*
out_offset
,
unsigned
short
*
out_len
)
{
{
if
(
offset
>=
iso
->
buf_size
)
if
(
offset
>=
iso
->
buf_size
)
return
-
EFAULT
;
return
-
EFAULT
;
/* make sure the packet does not go beyond the end of the buffer */
/* make sure the packet does not go beyond the end of the buffer */
if
(
offset
+
len
>
iso
->
buf_size
)
if
(
offset
+
len
>
iso
->
buf_size
)
return
-
EFAULT
;
return
-
EFAULT
;
/* check for wrap-around */
/* check for wrap-around */
if
(
offset
+
len
<
offset
)
if
(
offset
+
len
<
offset
)
return
-
EFAULT
;
return
-
EFAULT
;
/* now we can trust 'offset' and 'length' */
/* now we can trust 'offset' and 'length' */
...
@@ -307,18 +307,18 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
...
@@ -307,18 +307,18 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
unsigned
long
flags
;
unsigned
long
flags
;
int
rv
;
int
rv
;
if
(
iso
->
type
!=
HPSB_ISO_XMIT
)
if
(
iso
->
type
!=
HPSB_ISO_XMIT
)
return
-
EINVAL
;
return
-
EINVAL
;
/* is there space in the buffer? */
/* is there space in the buffer? */
if
(
iso
->
n_ready_packets
<=
0
)
{
if
(
iso
->
n_ready_packets
<=
0
)
{
return
-
EBUSY
;
return
-
EBUSY
;
}
}
info
=
&
iso
->
infos
[
iso
->
first_packet
];
info
=
&
iso
->
infos
[
iso
->
first_packet
];
/* check for bogus offset/length */
/* check for bogus offset/length */
if
(
hpsb_iso_check_offset_len
(
iso
,
offset
,
len
,
&
info
->
offset
,
&
info
->
len
))
if
(
hpsb_iso_check_offset_len
(
iso
,
offset
,
len
,
&
info
->
offset
,
&
info
->
len
))
return
-
EFAULT
;
return
-
EFAULT
;
info
->
tag
=
tag
;
info
->
tag
=
tag
;
...
@@ -327,7 +327,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
...
@@ -327,7 +327,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
spin_lock_irqsave
(
&
iso
->
lock
,
flags
);
spin_lock_irqsave
(
&
iso
->
lock
,
flags
);
rv
=
iso
->
host
->
driver
->
isoctl
(
iso
,
XMIT_QUEUE
,
(
unsigned
long
)
info
);
rv
=
iso
->
host
->
driver
->
isoctl
(
iso
,
XMIT_QUEUE
,
(
unsigned
long
)
info
);
if
(
rv
)
if
(
rv
)
goto
out
;
goto
out
;
/* increment cursors */
/* increment cursors */
...
@@ -335,9 +335,9 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
...
@@ -335,9 +335,9 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
iso
->
xmit_cycle
=
(
iso
->
xmit_cycle
+
1
)
%
8000
;
iso
->
xmit_cycle
=
(
iso
->
xmit_cycle
+
1
)
%
8000
;
iso
->
n_ready_packets
--
;
iso
->
n_ready_packets
--
;
if
(
iso
->
prebuffer
!=
0
)
{
if
(
iso
->
prebuffer
!=
0
)
{
iso
->
prebuffer
--
;
iso
->
prebuffer
--
;
if
(
iso
->
prebuffer
<=
0
)
{
if
(
iso
->
prebuffer
<=
0
)
{
iso
->
prebuffer
=
0
;
iso
->
prebuffer
=
0
;
rv
=
do_iso_xmit_start
(
iso
,
iso
->
start_cycle
);
rv
=
do_iso_xmit_start
(
iso
,
iso
->
start_cycle
);
}
}
...
@@ -350,7 +350,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
...
@@ -350,7 +350,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
int
hpsb_iso_xmit_sync
(
struct
hpsb_iso
*
iso
)
int
hpsb_iso_xmit_sync
(
struct
hpsb_iso
*
iso
)
{
{
if
(
iso
->
type
!=
HPSB_ISO_XMIT
)
if
(
iso
->
type
!=
HPSB_ISO_XMIT
)
return
-
EINVAL
;
return
-
EINVAL
;
return
wait_event_interruptible
(
iso
->
waitq
,
hpsb_iso_n_ready
(
iso
)
==
iso
->
buf_packets
);
return
wait_event_interruptible
(
iso
->
waitq
,
hpsb_iso_n_ready
(
iso
)
==
iso
->
buf_packets
);
...
@@ -371,7 +371,7 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error)
...
@@ -371,7 +371,7 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error)
iso
->
n_ready_packets
++
;
iso
->
n_ready_packets
++
;
iso
->
pkt_dma
=
(
iso
->
pkt_dma
+
1
)
%
iso
->
buf_packets
;
iso
->
pkt_dma
=
(
iso
->
pkt_dma
+
1
)
%
iso
->
buf_packets
;
if
(
iso
->
n_ready_packets
==
iso
->
buf_packets
||
error
!=
0
)
{
if
(
iso
->
n_ready_packets
==
iso
->
buf_packets
||
error
!=
0
)
{
/* the buffer has run empty! */
/* the buffer has run empty! */
atomic_inc
(
&
iso
->
overflows
);
atomic_inc
(
&
iso
->
overflows
);
}
}
...
@@ -385,7 +385,7 @@ void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
...
@@ -385,7 +385,7 @@ void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
iso
->
lock
,
flags
);
spin_lock_irqsave
(
&
iso
->
lock
,
flags
);
if
(
iso
->
n_ready_packets
==
iso
->
buf_packets
)
{
if
(
iso
->
n_ready_packets
==
iso
->
buf_packets
)
{
/* overflow! */
/* overflow! */
atomic_inc
(
&
iso
->
overflows
);
atomic_inc
(
&
iso
->
overflows
);
}
else
{
}
else
{
...
@@ -410,14 +410,14 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets)
...
@@ -410,14 +410,14 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets)
unsigned
int
i
;
unsigned
int
i
;
int
rv
=
0
;
int
rv
=
0
;
if
(
iso
->
type
!=
HPSB_ISO_RECV
)
if
(
iso
->
type
!=
HPSB_ISO_RECV
)
return
-
1
;
return
-
1
;
spin_lock_irqsave
(
&
iso
->
lock
,
flags
);
spin_lock_irqsave
(
&
iso
->
lock
,
flags
);
for
(
i
=
0
;
i
<
n_packets
;
i
++
)
{
for
(
i
=
0
;
i
<
n_packets
;
i
++
)
{
rv
=
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_RELEASE
,
rv
=
iso
->
host
->
driver
->
isoctl
(
iso
,
RECV_RELEASE
,
(
unsigned
long
)
&
iso
->
infos
[
iso
->
first_packet
]);
(
unsigned
long
)
&
iso
->
infos
[
iso
->
first_packet
]);
if
(
rv
)
if
(
rv
)
break
;
break
;
iso
->
first_packet
=
(
iso
->
first_packet
+
1
)
%
iso
->
buf_packets
;
iso
->
first_packet
=
(
iso
->
first_packet
+
1
)
%
iso
->
buf_packets
;
...
@@ -431,6 +431,6 @@ void hpsb_iso_wake(struct hpsb_iso *iso)
...
@@ -431,6 +431,6 @@ void hpsb_iso_wake(struct hpsb_iso *iso)
{
{
wake_up_interruptible
(
&
iso
->
waitq
);
wake_up_interruptible
(
&
iso
->
waitq
);
if
(
iso
->
callback
)
if
(
iso
->
callback
)
iso
->
callback
(
iso
);
iso
->
callback
(
iso
);
}
}
drivers/ieee1394/iso.h
View file @
11092356
...
@@ -66,7 +66,7 @@ struct hpsb_iso {
...
@@ -66,7 +66,7 @@ struct hpsb_iso {
/* wait for buffer space */
/* wait for buffer space */
wait_queue_head_t
waitq
;
wait_queue_head_t
waitq
;
int
speed
;
/* SPEED_100, 200, or 400 */
int
speed
;
/*
IEEE1394_
SPEED_100, 200, or 400 */
int
channel
;
/* -1 if multichannel */
int
channel
;
/* -1 if multichannel */
/* greatest # of packets between interrupts - controls
/* greatest # of packets between interrupts - controls
...
...
drivers/ieee1394/nodemgr.c
View file @
11092356
...
@@ -1167,7 +1167,7 @@ do { \
...
@@ -1167,7 +1167,7 @@ do { \
return -ENOMEM; \
return -ENOMEM; \
++length; \
++length; \
scratch = buffer + length; \
scratch = buffer + length; \
} while(0)
} while
(0)
PUT_ENVP
(
"VENDOR_ID=%06x"
,
ud
->
vendor_id
);
PUT_ENVP
(
"VENDOR_ID=%06x"
,
ud
->
vendor_id
);
PUT_ENVP
(
"MODEL_ID=%06x"
,
ud
->
model_id
);
PUT_ENVP
(
"MODEL_ID=%06x"
,
ud
->
model_id
);
...
@@ -1547,12 +1547,12 @@ static void nodemgr_do_irm_duties(struct hpsb_host *host)
...
@@ -1547,12 +1547,12 @@ static void nodemgr_do_irm_duties(struct hpsb_host *host)
/* If there is no bus manager then we should set the root node's
/* If there is no bus manager then we should set the root node's
* force_root bit to promote bus stability per the 1394
* force_root bit to promote bus stability per the 1394
* spec. (8.4.2.6) */
* spec. (8.4.2.6) */
if
(
host
->
busmgr_id
==
0x
3
f
&&
host
->
node_count
>
1
)
if
(
host
->
busmgr_id
==
0x
fff
f
&&
host
->
node_count
>
1
)
{
{
u16
root_node
=
host
->
node_count
-
1
;
u16
root_node
=
host
->
node_count
-
1
;
struct
node_entry
*
ne
=
hpsb_nodeid_get_entry
(
host
,
root_node
);
struct
node_entry
*
ne
=
find_entry_by_nodeid
(
host
,
root_node
|
LOCAL_BUS
);
if
(
ne
->
busopt
.
cmc
)
if
(
ne
&&
ne
->
busopt
.
cmc
)
hpsb_send_phy_config
(
host
,
root_node
,
-
1
);
hpsb_send_phy_config
(
host
,
root_node
,
-
1
);
else
{
else
{
HPSB_DEBUG
(
"The root node is not cycle master capable; "
HPSB_DEBUG
(
"The root node is not cycle master capable; "
...
...
drivers/ieee1394/ohci1394.c
View file @
11092356
...
@@ -164,7 +164,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
...
@@ -164,7 +164,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
printk(level "%s_%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
printk(level "%s_%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
static
char
version
[]
__devinitdata
=
static
char
version
[]
__devinitdata
=
"$Rev: 9
48
$ Ben Collins <bcollins@debian.org>"
;
"$Rev: 9
52
$ Ben Collins <bcollins@debian.org>"
;
/* Module Parameters */
/* Module Parameters */
static
int
phys_dma
=
1
;
static
int
phys_dma
=
1
;
...
@@ -428,7 +428,7 @@ static void initialize_dma_rcv_ctx(struct dma_rcv_ctx *d, int generate_irq)
...
@@ -428,7 +428,7 @@ static void initialize_dma_rcv_ctx(struct dma_rcv_ctx *d, int generate_irq)
d
->
buf_ind
=
0
;
d
->
buf_ind
=
0
;
d
->
buf_offset
=
0
;
d
->
buf_offset
=
0
;
if
(
d
->
type
==
DMA_CTX_ISO
)
{
if
(
d
->
type
==
DMA_CTX_ISO
)
{
/* Clear contextControl */
/* Clear contextControl */
reg_write
(
ohci
,
d
->
ctrlClear
,
0xffffffff
);
reg_write
(
ohci
,
d
->
ctrlClear
,
0xffffffff
);
...
@@ -470,7 +470,7 @@ static void initialize_dma_trm_ctx(struct dma_trm_ctx *d)
...
@@ -470,7 +470,7 @@ static void initialize_dma_trm_ctx(struct dma_trm_ctx *d)
INIT_LIST_HEAD
(
&
d
->
fifo_list
);
INIT_LIST_HEAD
(
&
d
->
fifo_list
);
INIT_LIST_HEAD
(
&
d
->
pending_list
);
INIT_LIST_HEAD
(
&
d
->
pending_list
);
if
(
d
->
type
==
DMA_CTX_ISO
)
{
if
(
d
->
type
==
DMA_CTX_ISO
)
{
/* enable interrupts */
/* enable interrupts */
reg_write
(
ohci
,
OHCI1394_IsoXmitIntMaskSet
,
1
<<
d
->
ctx
);
reg_write
(
ohci
,
OHCI1394_IsoXmitIntMaskSet
,
1
<<
d
->
ctx
);
}
}
...
@@ -490,8 +490,8 @@ static int get_nb_iso_ctx(struct ti_ohci *ohci, int reg)
...
@@ -490,8 +490,8 @@ static int get_nb_iso_ctx(struct ti_ohci *ohci, int reg)
DBGMSG
(
ohci
->
id
,
"Iso contexts reg: %08x implemented: %08x"
,
reg
,
tmp
);
DBGMSG
(
ohci
->
id
,
"Iso contexts reg: %08x implemented: %08x"
,
reg
,
tmp
);
/* Count the number of contexts */
/* Count the number of contexts */
for
(
i
=
0
;
i
<
32
;
i
++
)
{
for
(
i
=
0
;
i
<
32
;
i
++
)
{
if
(
tmp
&
1
)
ctx
++
;
if
(
tmp
&
1
)
ctx
++
;
tmp
>>=
1
;
tmp
>>=
1
;
}
}
return
ctx
;
return
ctx
;
...
@@ -856,8 +856,8 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
...
@@ -856,8 +856,8 @@ static int ohci_transmit(struct hpsb_host *host, struct hpsb_packet *packet)
* case. I don't see anyone sending ISO packets from
* case. I don't see anyone sending ISO packets from
* interrupt context anyway... */
* interrupt context anyway... */
if
(
ohci
->
it_legacy_context
.
ohci
==
NULL
)
{
if
(
ohci
->
it_legacy_context
.
ohci
==
NULL
)
{
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
0
;
...
@@ -1074,7 +1074,7 @@ static int ohci_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg)
...
@@ -1074,7 +1074,7 @@ static int ohci_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg)
spin_unlock_irqrestore
(
&
ohci
->
IR_channel_lock
,
flags
);
spin_unlock_irqrestore
(
&
ohci
->
IR_channel_lock
,
flags
);
DBGMSG
(
ohci
->
id
,
"Listening disabled on channel %d"
,
arg
);
DBGMSG
(
ohci
->
id
,
"Listening disabled on channel %d"
,
arg
);
if
(
ohci
->
ir_legacy_channels
==
0
)
{
if
(
ohci
->
ir_legacy_channels
==
0
)
{
free_dma_rcv_ctx
(
&
ohci
->
ir_legacy_context
);
free_dma_rcv_ctx
(
&
ohci
->
ir_legacy_context
);
DBGMSG
(
ohci
->
id
,
"ISO receive legacy context deactivated"
);
DBGMSG
(
ohci
->
id
,
"ISO receive legacy context deactivated"
);
}
}
...
@@ -1162,7 +1162,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1162,7 +1162,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
int
ret
=
-
ENOMEM
;
int
ret
=
-
ENOMEM
;
recv
=
kmalloc
(
sizeof
(
*
recv
),
SLAB_KERNEL
);
recv
=
kmalloc
(
sizeof
(
*
recv
),
SLAB_KERNEL
);
if
(
!
recv
)
if
(
!
recv
)
return
-
ENOMEM
;
return
-
ENOMEM
;
iso
->
hostdata
=
recv
;
iso
->
hostdata
=
recv
;
...
@@ -1174,7 +1174,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1174,7 +1174,7 @@ 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
->
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
;
...
@@ -1182,12 +1182,12 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1182,12 +1182,12 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
/* set nblocks, buf_stride, block_irq_interval */
/* set nblocks, buf_stride, block_irq_interval */
if
(
recv
->
dma_mode
==
BUFFER_FILL_MODE
)
{
if
(
recv
->
dma_mode
==
BUFFER_FILL_MODE
)
{
recv
->
buf_stride
=
PAGE_SIZE
;
recv
->
buf_stride
=
PAGE_SIZE
;
/* one block per page of data in the DMA buffer, minus the final guard page */
/* one block per page of data in the DMA buffer, minus the final guard page */
recv
->
nblocks
=
iso
->
buf_size
/
PAGE_SIZE
-
1
;
recv
->
nblocks
=
iso
->
buf_size
/
PAGE_SIZE
-
1
;
if
(
recv
->
nblocks
<
3
)
{
if
(
recv
->
nblocks
<
3
)
{
DBGMSG
(
ohci
->
id
,
"ohci_iso_recv_init: DMA buffer too small"
);
DBGMSG
(
ohci
->
id
,
"ohci_iso_recv_init: DMA buffer too small"
);
goto
err
;
goto
err
;
}
}
...
@@ -1195,9 +1195,9 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1195,9 +1195,9 @@ 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) */
/* (err, sort of... 1 is always the safest value) */
recv
->
block_irq_interval
=
iso
->
irq_interval
/
recv
->
nblocks
;
recv
->
block_irq_interval
=
iso
->
irq_interval
/
recv
->
nblocks
;
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
)
recv
->
block_irq_interval
=
1
;
recv
->
block_irq_interval
=
1
;
}
else
{
}
else
{
...
@@ -1211,10 +1211,10 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1211,10 +1211,10 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
max_packet_size
=
iso
->
buf_size
/
iso
->
buf_packets
;
max_packet_size
=
iso
->
buf_size
/
iso
->
buf_packets
;
for
(
recv
->
buf_stride
=
8
;
recv
->
buf_stride
<
max_packet_size
;
for
(
recv
->
buf_stride
=
8
;
recv
->
buf_stride
<
max_packet_size
;
recv
->
buf_stride
*=
2
);
recv
->
buf_stride
*=
2
);
if
(
recv
->
buf_stride
*
iso
->
buf_packets
>
iso
->
buf_size
||
if
(
recv
->
buf_stride
*
iso
->
buf_packets
>
iso
->
buf_size
||
recv
->
buf_stride
>
PAGE_SIZE
)
{
recv
->
buf_stride
>
PAGE_SIZE
)
{
/* this shouldn't happen, but anyway... */
/* this shouldn't happen, but anyway... */
DBGMSG
(
ohci
->
id
,
"ohci_iso_recv_init: problem choosing a buffer stride"
);
DBGMSG
(
ohci
->
id
,
"ohci_iso_recv_init: problem choosing a buffer stride"
);
...
@@ -1243,7 +1243,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1243,7 +1243,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
ohci_iso_recv_packetperbuf_task
,
ohci_iso_recv_packetperbuf_task
,
(
unsigned
long
)
iso
);
(
unsigned
long
)
iso
);
if
(
ohci1394_register_iso_tasklet
(
recv
->
ohci
,
&
recv
->
task
)
<
0
)
if
(
ohci1394_register_iso_tasklet
(
recv
->
ohci
,
&
recv
->
task
)
<
0
)
goto
err
;
goto
err
;
recv
->
task_active
=
1
;
recv
->
task_active
=
1
;
...
@@ -1255,7 +1255,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
...
@@ -1255,7 +1255,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso)
recv
->
CommandPtr
=
OHCI1394_IsoRcvCommandPtr
+
32
*
ctx
;
recv
->
CommandPtr
=
OHCI1394_IsoRcvCommandPtr
+
32
*
ctx
;
recv
->
ContextMatch
=
OHCI1394_IsoRcvContextMatch
+
32
*
ctx
;
recv
->
ContextMatch
=
OHCI1394_IsoRcvContextMatch
+
32
*
ctx
;
if
(
iso
->
channel
==
-
1
)
{
if
(
iso
->
channel
==
-
1
)
{
/* clear multi-channel selection mask */
/* clear multi-channel selection mask */
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskHiClear
,
0xFFFFFFFF
);
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskHiClear
,
0xFFFFFFFF
);
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskLoClear
,
0xFFFFFFFF
);
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskLoClear
,
0xFFFFFFFF
);
...
@@ -1293,7 +1293,7 @@ static void ohci_iso_recv_shutdown(struct hpsb_iso *iso)
...
@@ -1293,7 +1293,7 @@ static void ohci_iso_recv_shutdown(struct hpsb_iso *iso)
{
{
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
if
(
recv
->
task_active
)
{
if
(
recv
->
task_active
)
{
ohci_iso_recv_stop
(
iso
);
ohci_iso_recv_stop
(
iso
);
ohci1394_unregister_iso_tasklet
(
recv
->
ohci
,
&
recv
->
task
);
ohci1394_unregister_iso_tasklet
(
recv
->
ohci
,
&
recv
->
task
);
recv
->
task_active
=
0
;
recv
->
task_active
=
0
;
...
@@ -1363,7 +1363,7 @@ static void ohci_iso_recv_change_channel(struct hpsb_iso *iso, unsigned char cha
...
@@ -1363,7 +1363,7 @@ static void ohci_iso_recv_change_channel(struct hpsb_iso *iso, unsigned char cha
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
int
reg
,
i
;
int
reg
,
i
;
if
(
channel
<
32
)
{
if
(
channel
<
32
)
{
reg
=
listen
?
OHCI1394_IRMultiChanMaskLoSet
:
OHCI1394_IRMultiChanMaskLoClear
;
reg
=
listen
?
OHCI1394_IRMultiChanMaskLoSet
:
OHCI1394_IRMultiChanMaskLoClear
;
i
=
channel
;
i
=
channel
;
}
else
{
}
else
{
...
@@ -1383,14 +1383,14 @@ static void ohci_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)
...
@@ -1383,14 +1383,14 @@ static void ohci_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
64
;
i
++
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
if
(
mask
&
(
1ULL
<<
i
))
{
if
(
mask
&
(
1ULL
<<
i
))
{
if
(
i
<
32
)
if
(
i
<
32
)
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskLoSet
,
(
1
<<
i
));
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskLoSet
,
(
1
<<
i
));
else
else
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskHiSet
,
(
1
<<
(
i
-
32
)));
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskHiSet
,
(
1
<<
(
i
-
32
)));
}
else
{
}
else
{
if
(
i
<
32
)
if
(
i
<
32
)
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskLoClear
,
(
1
<<
i
));
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskLoClear
,
(
1
<<
i
));
else
else
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskHiClear
,
(
1
<<
(
i
-
32
)));
reg_write
(
recv
->
ohci
,
OHCI1394_IRMultiChanMaskHiClear
,
(
1
<<
(
i
-
32
)));
...
@@ -1413,7 +1413,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
...
@@ -1413,7 +1413,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
/* always keep ISO headers */
/* always keep ISO headers */
command
=
(
1
<<
30
);
command
=
(
1
<<
30
);
if
(
recv
->
dma_mode
==
BUFFER_FILL_MODE
)
if
(
recv
->
dma_mode
==
BUFFER_FILL_MODE
)
command
|=
(
1
<<
31
);
command
|=
(
1
<<
31
);
reg_write
(
recv
->
ohci
,
recv
->
ContextControlSet
,
command
);
reg_write
(
recv
->
ohci
,
recv
->
ContextControlSet
,
command
);
...
@@ -1421,7 +1421,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
...
@@ -1421,7 +1421,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
/* match on specified tags */
/* match on specified tags */
contextMatch
=
tag_mask
<<
28
;
contextMatch
=
tag_mask
<<
28
;
if
(
iso
->
channel
==
-
1
)
{
if
(
iso
->
channel
==
-
1
)
{
/* enable multichannel reception */
/* enable multichannel reception */
reg_write
(
recv
->
ohci
,
recv
->
ContextControlSet
,
(
1
<<
28
));
reg_write
(
recv
->
ohci
,
recv
->
ContextControlSet
,
(
1
<<
28
));
}
else
{
}
else
{
...
@@ -1429,7 +1429,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
...
@@ -1429,7 +1429,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
contextMatch
|=
iso
->
channel
;
contextMatch
|=
iso
->
channel
;
}
}
if
(
cycle
!=
-
1
)
{
if
(
cycle
!=
-
1
)
{
u32
seconds
;
u32
seconds
;
/* enable cycleMatch */
/* enable cycleMatch */
...
@@ -1450,7 +1450,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
...
@@ -1450,7 +1450,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
contextMatch
|=
cycle
<<
12
;
contextMatch
|=
cycle
<<
12
;
}
}
if
(
sync
!=
-
1
)
{
if
(
sync
!=
-
1
)
{
/* set sync flag on first DMA descriptor */
/* set sync flag on first DMA descriptor */
struct
dma_cmd
*
cmd
=
&
recv
->
block
[
recv
->
block_dma
];
struct
dma_cmd
*
cmd
=
&
recv
->
block
[
recv
->
block_dma
];
cmd
->
control
|=
DMA_CTL_WAIT
;
cmd
->
control
|=
DMA_CTL_WAIT
;
...
@@ -1482,7 +1482,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
...
@@ -1482,7 +1482,7 @@ static int ohci_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, in
reg_read
(
recv
->
ohci
,
OHCI1394_IsochronousCycleTimer
);
reg_read
(
recv
->
ohci
,
OHCI1394_IsochronousCycleTimer
);
/* check RUN */
/* check RUN */
if
(
!
(
reg_read
(
recv
->
ohci
,
recv
->
ContextControlSet
)
&
0x8000
))
{
if
(
!
(
reg_read
(
recv
->
ohci
,
recv
->
ContextControlSet
)
&
0x8000
))
{
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"Error starting IR DMA (ContextControl 0x%08x)
\n
"
,
"Error starting IR DMA (ContextControl 0x%08x)
\n
"
,
reg_read
(
recv
->
ohci
,
recv
->
ContextControlSet
));
reg_read
(
recv
->
ohci
,
recv
->
ContextControlSet
));
...
@@ -1515,7 +1515,7 @@ static void ohci_iso_recv_release_block(struct ohci_iso_recv *recv, int block)
...
@@ -1515,7 +1515,7 @@ static void ohci_iso_recv_release_block(struct ohci_iso_recv *recv, int block)
|
1
);
/* Z=1 */
|
1
);
/* Z=1 */
/* disable interrupt on previous DMA descriptor, except at intervals */
/* disable interrupt on previous DMA descriptor, except at intervals */
if
((
prev_i
%
recv
->
block_irq_interval
)
==
0
)
{
if
((
prev_i
%
recv
->
block_irq_interval
)
==
0
)
{
prev
->
control
|=
cpu_to_le32
(
3
<<
20
);
/* enable interrupt */
prev
->
control
|=
cpu_to_le32
(
3
<<
20
);
/* enable interrupt */
}
else
{
}
else
{
prev
->
control
&=
cpu_to_le32
(
~
(
3
<<
20
));
/* disable interrupt */
prev
->
control
&=
cpu_to_le32
(
~
(
3
<<
20
));
/* disable interrupt */
...
@@ -1535,7 +1535,7 @@ static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv,
...
@@ -1535,7 +1535,7 @@ static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv,
len
=
info
->
len
;
len
=
info
->
len
;
/* add the wasted space for padding to 4 bytes */
/* add the wasted space for padding to 4 bytes */
if
(
len
%
4
)
if
(
len
%
4
)
len
+=
4
-
(
len
%
4
);
len
+=
4
-
(
len
%
4
);
/* add 8 bytes for the OHCI DMA data format overhead */
/* add 8 bytes for the OHCI DMA data format overhead */
...
@@ -1544,7 +1544,7 @@ static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv,
...
@@ -1544,7 +1544,7 @@ static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv,
recv
->
released_bytes
+=
len
;
recv
->
released_bytes
+=
len
;
/* have we released enough memory for one block? */
/* have we released enough memory for one block? */
while
(
recv
->
released_bytes
>
recv
->
buf_stride
)
{
while
(
recv
->
released_bytes
>
recv
->
buf_stride
)
{
ohci_iso_recv_release_block
(
recv
,
recv
->
block_reader
);
ohci_iso_recv_release_block
(
recv
,
recv
->
block_reader
);
recv
->
block_reader
=
(
recv
->
block_reader
+
1
)
%
recv
->
nblocks
;
recv
->
block_reader
=
(
recv
->
block_reader
+
1
)
%
recv
->
nblocks
;
recv
->
released_bytes
-=
recv
->
buf_stride
;
recv
->
released_bytes
-=
recv
->
buf_stride
;
...
@@ -1554,7 +1554,7 @@ static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv,
...
@@ -1554,7 +1554,7 @@ static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv,
static
inline
void
ohci_iso_recv_release
(
struct
hpsb_iso
*
iso
,
struct
hpsb_iso_packet_info
*
info
)
static
inline
void
ohci_iso_recv_release
(
struct
hpsb_iso
*
iso
,
struct
hpsb_iso_packet_info
*
info
)
{
{
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
struct
ohci_iso_recv
*
recv
=
iso
->
hostdata
;
if
(
recv
->
dma_mode
==
BUFFER_FILL_MODE
)
{
if
(
recv
->
dma_mode
==
BUFFER_FILL_MODE
)
{
ohci_iso_recv_bufferfill_release
(
recv
,
info
);
ohci_iso_recv_bufferfill_release
(
recv
,
info
);
}
else
{
}
else
{
ohci_iso_recv_release_block
(
recv
,
info
-
iso
->
infos
);
ohci_iso_recv_release_block
(
recv
,
info
-
iso
->
infos
);
...
@@ -1567,7 +1567,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1567,7 +1567,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
int
wake
=
0
;
int
wake
=
0
;
int
runaway
=
0
;
int
runaway
=
0
;
while
(
1
)
{
while
(
1
)
{
/* we expect the next parsable packet to begin at recv->dma_offset */
/* we expect the next parsable packet to begin at recv->dma_offset */
/* note: packet layout is as shown in section 10.6.1.1 of the OHCI spec */
/* note: packet layout is as shown in section 10.6.1.1 of the OHCI spec */
...
@@ -1580,7 +1580,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1580,7 +1580,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
unsigned
int
this_block
=
recv
->
dma_offset
/
recv
->
buf_stride
;
unsigned
int
this_block
=
recv
->
dma_offset
/
recv
->
buf_stride
;
/* don't loop indefinitely */
/* don't loop indefinitely */
if
(
runaway
++
>
100000
)
{
if
(
runaway
++
>
100000
)
{
atomic_inc
(
&
iso
->
overflows
);
atomic_inc
(
&
iso
->
overflows
);
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"IR DMA error - Runaway during buffer parsing!
\n
"
);
"IR DMA error - Runaway during buffer parsing!
\n
"
);
...
@@ -1588,7 +1588,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1588,7 +1588,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
}
}
/* stop parsing once we arrive at block_dma (i.e. don't get ahead of DMA) */
/* stop parsing once we arrive at block_dma (i.e. don't get ahead of DMA) */
if
(
this_block
==
recv
->
block_dma
)
if
(
this_block
==
recv
->
block_dma
)
break
;
break
;
wake
=
1
;
wake
=
1
;
...
@@ -1600,7 +1600,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1600,7 +1600,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
len
=
p
[
recv
->
dma_offset
+
2
]
|
(
p
[
recv
->
dma_offset
+
3
]
<<
8
);
len
=
p
[
recv
->
dma_offset
+
2
]
|
(
p
[
recv
->
dma_offset
+
3
]
<<
8
);
if
(
len
>
4096
)
{
if
(
len
>
4096
)
{
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"IR DMA error - bogus 'len' value %u
\n
"
,
len
);
"IR DMA error - bogus 'len' value %u
\n
"
,
len
);
}
}
...
@@ -1613,7 +1613,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1613,7 +1613,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
recv
->
dma_offset
+=
4
;
recv
->
dma_offset
+=
4
;
/* check for wrap-around */
/* check for wrap-around */
if
(
recv
->
dma_offset
>=
recv
->
buf_stride
*
recv
->
nblocks
)
{
if
(
recv
->
dma_offset
>=
recv
->
buf_stride
*
recv
->
nblocks
)
{
recv
->
dma_offset
-=
recv
->
buf_stride
*
recv
->
nblocks
;
recv
->
dma_offset
-=
recv
->
buf_stride
*
recv
->
nblocks
;
}
}
...
@@ -1624,12 +1624,12 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1624,12 +1624,12 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
recv
->
dma_offset
+=
len
;
recv
->
dma_offset
+=
len
;
/* payload is padded to 4 bytes */
/* payload is padded to 4 bytes */
if
(
len
%
4
)
{
if
(
len
%
4
)
{
recv
->
dma_offset
+=
4
-
(
len
%
4
);
recv
->
dma_offset
+=
4
-
(
len
%
4
);
}
}
/* check for wrap-around */
/* check for wrap-around */
if
(
recv
->
dma_offset
>=
recv
->
buf_stride
*
recv
->
nblocks
)
{
if
(
recv
->
dma_offset
>=
recv
->
buf_stride
*
recv
->
nblocks
)
{
/* uh oh, the packet data wraps from the last
/* uh oh, the packet data wraps from the last
to the first DMA block - make the packet
to the first DMA block - make the packet
contiguous by copying its "tail" into the
contiguous by copying its "tail" into the
...
@@ -1638,7 +1638,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1638,7 +1638,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
int
guard_off
=
recv
->
buf_stride
*
recv
->
nblocks
;
int
guard_off
=
recv
->
buf_stride
*
recv
->
nblocks
;
int
tail_len
=
len
-
(
guard_off
-
offset
);
int
tail_len
=
len
-
(
guard_off
-
offset
);
if
(
tail_len
>
0
&&
tail_len
<
recv
->
buf_stride
)
{
if
(
tail_len
>
0
&&
tail_len
<
recv
->
buf_stride
)
{
memcpy
(
iso
->
data_buf
.
kvirt
+
guard_off
,
memcpy
(
iso
->
data_buf
.
kvirt
+
guard_off
,
iso
->
data_buf
.
kvirt
,
iso
->
data_buf
.
kvirt
,
tail_len
);
tail_len
);
...
@@ -1655,14 +1655,14 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
...
@@ -1655,14 +1655,14 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
recv
->
dma_offset
+=
4
;
recv
->
dma_offset
+=
4
;
/* check for wrap-around */
/* check for wrap-around */
if
(
recv
->
dma_offset
>=
recv
->
buf_stride
*
recv
->
nblocks
)
{
if
(
recv
->
dma_offset
>=
recv
->
buf_stride
*
recv
->
nblocks
)
{
recv
->
dma_offset
-=
recv
->
buf_stride
*
recv
->
nblocks
;
recv
->
dma_offset
-=
recv
->
buf_stride
*
recv
->
nblocks
;
}
}
hpsb_iso_packet_received
(
iso
,
offset
,
len
,
cycle
,
channel
,
tag
,
sy
);
hpsb_iso_packet_received
(
iso
,
offset
,
len
,
cycle
,
channel
,
tag
,
sy
);
}
}
if
(
wake
)
if
(
wake
)
hpsb_iso_wake
(
iso
);
hpsb_iso_wake
(
iso
);
}
}
...
@@ -1674,7 +1674,7 @@ static void ohci_iso_recv_bufferfill_task(unsigned long data)
...
@@ -1674,7 +1674,7 @@ static void ohci_iso_recv_bufferfill_task(unsigned long data)
int
loop
;
int
loop
;
/* loop over all blocks */
/* loop over all blocks */
for
(
loop
=
0
;
loop
<
recv
->
nblocks
;
loop
++
)
{
for
(
loop
=
0
;
loop
<
recv
->
nblocks
;
loop
++
)
{
/* check block_dma to see if it's done */
/* check block_dma to see if it's done */
...
@@ -1688,18 +1688,18 @@ static void ohci_iso_recv_bufferfill_task(unsigned long data)
...
@@ -1688,18 +1688,18 @@ static void ohci_iso_recv_bufferfill_task(unsigned long data)
unsigned
char
event
=
xferstatus
&
0x1F
;
unsigned
char
event
=
xferstatus
&
0x1F
;
if
(
!
event
)
{
if
(
!
event
)
{
/* nothing has happened to this block yet */
/* nothing has happened to this block yet */
break
;
break
;
}
}
if
(
event
!=
0x11
)
{
if
(
event
!=
0x11
)
{
atomic_inc
(
&
iso
->
overflows
);
atomic_inc
(
&
iso
->
overflows
);
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"IR DMA error - OHCI error code 0x%02x
\n
"
,
event
);
"IR DMA error - OHCI error code 0x%02x
\n
"
,
event
);
}
}
if
(
rescount
!=
0
)
{
if
(
rescount
!=
0
)
{
/* the card is still writing to this block;
/* the card is still writing to this block;
we can't touch it until it's done */
we can't touch it until it's done */
break
;
break
;
...
@@ -1716,7 +1716,7 @@ static void ohci_iso_recv_bufferfill_task(unsigned long data)
...
@@ -1716,7 +1716,7 @@ static void ohci_iso_recv_bufferfill_task(unsigned long data)
/* advance block_dma */
/* advance block_dma */
recv
->
block_dma
=
(
recv
->
block_dma
+
1
)
%
recv
->
nblocks
;
recv
->
block_dma
=
(
recv
->
block_dma
+
1
)
%
recv
->
nblocks
;
if
((
recv
->
block_dma
+
1
)
%
recv
->
nblocks
==
recv
->
block_reader
)
{
if
((
recv
->
block_dma
+
1
)
%
recv
->
nblocks
==
recv
->
block_reader
)
{
atomic_inc
(
&
iso
->
overflows
);
atomic_inc
(
&
iso
->
overflows
);
DBGMSG
(
recv
->
ohci
->
id
,
"ISO reception overflow - "
DBGMSG
(
recv
->
ohci
->
id
,
"ISO reception overflow - "
"ran out of DMA blocks"
);
"ran out of DMA blocks"
);
...
@@ -1735,7 +1735,7 @@ static void ohci_iso_recv_packetperbuf_task(unsigned long data)
...
@@ -1735,7 +1735,7 @@ static void ohci_iso_recv_packetperbuf_task(unsigned long data)
int
wake
=
0
;
int
wake
=
0
;
/* loop over the entire buffer */
/* loop over the entire buffer */
for
(
count
=
0
;
count
<
recv
->
nblocks
;
count
++
)
{
for
(
count
=
0
;
count
<
recv
->
nblocks
;
count
++
)
{
u32
packet_len
=
0
;
u32
packet_len
=
0
;
/* pointer to the DMA descriptor */
/* pointer to the DMA descriptor */
...
@@ -1747,21 +1747,21 @@ static void ohci_iso_recv_packetperbuf_task(unsigned long data)
...
@@ -1747,21 +1747,21 @@ static void ohci_iso_recv_packetperbuf_task(unsigned long data)
unsigned
char
event
=
xferstatus
&
0x1F
;
unsigned
char
event
=
xferstatus
&
0x1F
;
if
(
!
event
)
{
if
(
!
event
)
{
/* this packet hasn't come in yet; we are done for now */
/* this packet hasn't come in yet; we are done for now */
goto
out
;
goto
out
;
}
}
if
(
event
==
0x11
)
{
if
(
event
==
0x11
)
{
/* packet received successfully! */
/* packet received successfully! */
/* rescount is the number of bytes *remaining* in the packet buffer,
/* rescount is the number of bytes *remaining* in the packet buffer,
after the packet was written */
after the packet was written */
packet_len
=
recv
->
buf_stride
-
rescount
;
packet_len
=
recv
->
buf_stride
-
rescount
;
}
else
if
(
event
==
0x02
)
{
}
else
if
(
event
==
0x02
)
{
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"IR DMA error - packet too long for buffer
\n
"
);
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"IR DMA error - packet too long for buffer
\n
"
);
}
else
if
(
event
)
{
}
else
if
(
event
)
{
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"IR DMA error - OHCI error code 0x%02x
\n
"
,
event
);
PRINT
(
KERN_ERR
,
recv
->
ohci
->
id
,
"IR DMA error - OHCI error code 0x%02x
\n
"
,
event
);
}
}
...
@@ -1800,7 +1800,7 @@ static void ohci_iso_recv_packetperbuf_task(unsigned long data)
...
@@ -1800,7 +1800,7 @@ static void ohci_iso_recv_packetperbuf_task(unsigned long data)
}
}
out:
out:
if
(
wake
)
if
(
wake
)
hpsb_iso_wake
(
iso
);
hpsb_iso_wake
(
iso
);
}
}
...
@@ -1844,7 +1844,7 @@ static int ohci_iso_xmit_init(struct hpsb_iso *iso)
...
@@ -1844,7 +1844,7 @@ static int ohci_iso_xmit_init(struct hpsb_iso *iso)
int
ret
=
-
ENOMEM
;
int
ret
=
-
ENOMEM
;
xmit
=
kmalloc
(
sizeof
(
*
xmit
),
SLAB_KERNEL
);
xmit
=
kmalloc
(
sizeof
(
*
xmit
),
SLAB_KERNEL
);
if
(
!
xmit
)
if
(
!
xmit
)
return
-
ENOMEM
;
return
-
ENOMEM
;
iso
->
hostdata
=
xmit
;
iso
->
hostdata
=
xmit
;
...
@@ -1855,13 +1855,13 @@ static int ohci_iso_xmit_init(struct hpsb_iso *iso)
...
@@ -1855,13 +1855,13 @@ static int ohci_iso_xmit_init(struct hpsb_iso *iso)
prog_size
=
sizeof
(
struct
iso_xmit_cmd
)
*
iso
->
buf_packets
;
prog_size
=
sizeof
(
struct
iso_xmit_cmd
)
*
iso
->
buf_packets
;
if
(
dma_prog_region_alloc
(
&
xmit
->
prog
,
prog_size
,
xmit
->
ohci
->
dev
))
if
(
dma_prog_region_alloc
(
&
xmit
->
prog
,
prog_size
,
xmit
->
ohci
->
dev
))
goto
err
;
goto
err
;
ohci1394_init_iso_tasklet
(
&
xmit
->
task
,
OHCI_ISO_TRANSMIT
,
ohci1394_init_iso_tasklet
(
&
xmit
->
task
,
OHCI_ISO_TRANSMIT
,
ohci_iso_xmit_task
,
(
unsigned
long
)
iso
);
ohci_iso_xmit_task
,
(
unsigned
long
)
iso
);
if
(
ohci1394_register_iso_tasklet
(
xmit
->
ohci
,
&
xmit
->
task
)
<
0
)
if
(
ohci1394_register_iso_tasklet
(
xmit
->
ohci
,
&
xmit
->
task
)
<
0
)
goto
err
;
goto
err
;
xmit
->
task_active
=
1
;
xmit
->
task_active
=
1
;
...
@@ -1887,7 +1887,7 @@ static void ohci_iso_xmit_stop(struct hpsb_iso *iso)
...
@@ -1887,7 +1887,7 @@ static void ohci_iso_xmit_stop(struct hpsb_iso *iso)
reg_write
(
xmit
->
ohci
,
OHCI1394_IsoXmitIntMaskClear
,
1
<<
xmit
->
task
.
context
);
reg_write
(
xmit
->
ohci
,
OHCI1394_IsoXmitIntMaskClear
,
1
<<
xmit
->
task
.
context
);
/* halt DMA */
/* halt DMA */
if
(
ohci1394_stop_context
(
xmit
->
ohci
,
xmit
->
ContextControlClear
,
NULL
))
{
if
(
ohci1394_stop_context
(
xmit
->
ohci
,
xmit
->
ContextControlClear
,
NULL
))
{
/* XXX the DMA context will lock up if you try to send too much data! */
/* XXX the DMA context will lock up if you try to send too much data! */
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
"you probably exceeded the OHCI card's bandwidth limit - "
"you probably exceeded the OHCI card's bandwidth limit - "
...
@@ -1899,7 +1899,7 @@ static void ohci_iso_xmit_shutdown(struct hpsb_iso *iso)
...
@@ -1899,7 +1899,7 @@ static void ohci_iso_xmit_shutdown(struct hpsb_iso *iso)
{
{
struct
ohci_iso_xmit
*
xmit
=
iso
->
hostdata
;
struct
ohci_iso_xmit
*
xmit
=
iso
->
hostdata
;
if
(
xmit
->
task_active
)
{
if
(
xmit
->
task_active
)
{
ohci_iso_xmit_stop
(
iso
);
ohci_iso_xmit_stop
(
iso
);
ohci1394_unregister_iso_tasklet
(
xmit
->
ohci
,
&
xmit
->
task
);
ohci1394_unregister_iso_tasklet
(
xmit
->
ohci
,
&
xmit
->
task
);
xmit
->
task_active
=
0
;
xmit
->
task_active
=
0
;
...
@@ -1918,7 +1918,7 @@ static void ohci_iso_xmit_task(unsigned long data)
...
@@ -1918,7 +1918,7 @@ static void ohci_iso_xmit_task(unsigned long data)
int
count
;
int
count
;
/* check the whole buffer if necessary, starting at pkt_dma */
/* check the whole buffer if necessary, starting at pkt_dma */
for
(
count
=
0
;
count
<
iso
->
buf_packets
;
count
++
)
{
for
(
count
=
0
;
count
<
iso
->
buf_packets
;
count
++
)
{
int
cycle
;
int
cycle
;
/* DMA descriptor */
/* DMA descriptor */
...
@@ -1928,12 +1928,12 @@ static void ohci_iso_xmit_task(unsigned long data)
...
@@ -1928,12 +1928,12 @@ static void ohci_iso_xmit_task(unsigned long data)
u16
xferstatus
=
le32_to_cpu
(
cmd
->
output_last
.
status
)
>>
16
;
u16
xferstatus
=
le32_to_cpu
(
cmd
->
output_last
.
status
)
>>
16
;
u8
event
=
xferstatus
&
0x1F
;
u8
event
=
xferstatus
&
0x1F
;
if
(
!
event
)
{
if
(
!
event
)
{
/* packet hasn't been sent yet; we are done for now */
/* packet hasn't been sent yet; we are done for now */
break
;
break
;
}
}
if
(
event
!=
0x11
)
if
(
event
!=
0x11
)
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
"IT DMA error - OHCI error code 0x%02x
\n
"
,
event
);
"IT DMA error - OHCI error code 0x%02x
\n
"
,
event
);
...
@@ -1950,7 +1950,7 @@ static void ohci_iso_xmit_task(unsigned long data)
...
@@ -1950,7 +1950,7 @@ static void ohci_iso_xmit_task(unsigned long data)
cmd
->
output_last
.
status
=
0
;
cmd
->
output_last
.
status
=
0
;
}
}
if
(
wake
)
if
(
wake
)
hpsb_iso_wake
(
iso
);
hpsb_iso_wake
(
iso
);
}
}
...
@@ -1967,7 +1967,7 @@ static int ohci_iso_xmit_queue(struct hpsb_iso *iso, struct hpsb_iso_packet_info
...
@@ -1967,7 +1967,7 @@ static int ohci_iso_xmit_queue(struct hpsb_iso *iso, struct hpsb_iso_packet_info
/* check that the packet doesn't cross a page boundary
/* check that the packet doesn't cross a page boundary
(we could allow this if we added OUTPUT_MORE descriptor support) */
(we could allow this if we added OUTPUT_MORE descriptor support) */
if
(
cross_bound
(
info
->
offset
,
info
->
len
))
{
if
(
cross_bound
(
info
->
offset
,
info
->
len
))
{
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
"rawiso xmit: packet %u crosses a page boundary"
,
"rawiso xmit: packet %u crosses a page boundary"
,
iso
->
first_packet
);
iso
->
first_packet
);
...
@@ -2030,7 +2030,7 @@ static int ohci_iso_xmit_queue(struct hpsb_iso *iso, struct hpsb_iso_packet_info
...
@@ -2030,7 +2030,7 @@ static int ohci_iso_xmit_queue(struct hpsb_iso *iso, struct hpsb_iso_packet_info
dma_prog_region_offset_to_bus
(
&
xmit
->
prog
,
sizeof
(
struct
iso_xmit_cmd
)
*
next_i
)
|
3
);
dma_prog_region_offset_to_bus
(
&
xmit
->
prog
,
sizeof
(
struct
iso_xmit_cmd
)
*
next_i
)
|
3
);
/* disable interrupt, unless required by the IRQ interval */
/* disable interrupt, unless required by the IRQ interval */
if
(
prev_i
%
iso
->
irq_interval
)
{
if
(
prev_i
%
iso
->
irq_interval
)
{
prev
->
output_last
.
control
&=
cpu_to_le32
(
~
(
3
<<
20
));
/* no interrupt */
prev
->
output_last
.
control
&=
cpu_to_le32
(
~
(
3
<<
20
));
/* no interrupt */
}
else
{
}
else
{
prev
->
output_last
.
control
|=
cpu_to_le32
(
3
<<
20
);
/* enable interrupt */
prev
->
output_last
.
control
|=
cpu_to_le32
(
3
<<
20
);
/* enable interrupt */
...
@@ -2062,7 +2062,7 @@ static int ohci_iso_xmit_start(struct hpsb_iso *iso, int cycle)
...
@@ -2062,7 +2062,7 @@ static int ohci_iso_xmit_start(struct hpsb_iso *iso, int cycle)
dma_prog_region_offset_to_bus
(
&
xmit
->
prog
,
iso
->
pkt_dma
*
sizeof
(
struct
iso_xmit_cmd
))
|
3
);
dma_prog_region_offset_to_bus
(
&
xmit
->
prog
,
iso
->
pkt_dma
*
sizeof
(
struct
iso_xmit_cmd
))
|
3
);
/* cycle match */
/* cycle match */
if
(
cycle
!=
-
1
)
{
if
(
cycle
!=
-
1
)
{
u32
start
=
cycle
&
0x1FFF
;
u32
start
=
cycle
&
0x1FFF
;
/* 'cycle' is only mod 8000, but we also need two 'seconds' bits -
/* 'cycle' is only mod 8000, but we also need two 'seconds' bits -
...
@@ -2088,7 +2088,7 @@ static int ohci_iso_xmit_start(struct hpsb_iso *iso, int cycle)
...
@@ -2088,7 +2088,7 @@ static int ohci_iso_xmit_start(struct hpsb_iso *iso, int cycle)
udelay
(
100
);
udelay
(
100
);
/* check the RUN bit */
/* check the RUN bit */
if
(
!
(
reg_read
(
xmit
->
ohci
,
xmit
->
ContextControlSet
)
&
0x8000
))
{
if
(
!
(
reg_read
(
xmit
->
ohci
,
xmit
->
ContextControlSet
)
&
0x8000
))
{
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
"Error starting IT DMA (ContextControl 0x%08x)
\n
"
,
PRINT
(
KERN_ERR
,
xmit
->
ohci
->
id
,
"Error starting IT DMA (ContextControl 0x%08x)
\n
"
,
reg_read
(
xmit
->
ohci
,
xmit
->
ContextControlSet
));
reg_read
(
xmit
->
ohci
,
xmit
->
ContextControlSet
));
return
-
1
;
return
-
1
;
...
@@ -2694,7 +2694,7 @@ static void dma_trm_tasklet (unsigned long data)
...
@@ -2694,7 +2694,7 @@ static void dma_trm_tasklet (unsigned long data)
#ifdef OHCI1394_DEBUG
#ifdef OHCI1394_DEBUG
if
(
datasize
)
if
(
datasize
)
if
(((
le32_to_cpu
(
d
->
prg_cpu
[
d
->
sent_ind
]
->
data
[
0
])
>>
4
)
&
0xf
)
==
0xa
)
if
(((
le32_to_cpu
(
d
->
prg_cpu
[
d
->
sent_ind
]
->
data
[
0
])
>>
4
)
&
0xf
)
==
0xa
)
DBGMSG
(
ohci
->
id
,
DBGMSG
(
ohci
->
id
,
"Stream packet sent to channel %d tcode=0x%X "
"Stream packet sent to channel %d tcode=0x%X "
"ack=0x%X spd=%d dataLength=%d ctx=%d"
,
"ack=0x%X spd=%d dataLength=%d ctx=%d"
,
...
@@ -2807,7 +2807,7 @@ static void free_dma_rcv_ctx(struct dma_rcv_ctx *d)
...
@@ -2807,7 +2807,7 @@ static void free_dma_rcv_ctx(struct dma_rcv_ctx *d)
DBGMSG
(
d
->
ohci
->
id
,
"Freeing dma_rcv_ctx %d"
,
d
->
ctx
);
DBGMSG
(
d
->
ohci
->
id
,
"Freeing dma_rcv_ctx %d"
,
d
->
ctx
);
if
(
d
->
ctrlClear
)
{
if
(
d
->
ctrlClear
)
{
ohci1394_stop_context
(
d
->
ohci
,
d
->
ctrlClear
,
NULL
);
ohci1394_stop_context
(
d
->
ohci
,
d
->
ctrlClear
,
NULL
);
if
(
d
->
type
==
DMA_CTX_ISO
)
{
if
(
d
->
type
==
DMA_CTX_ISO
)
{
...
@@ -2969,7 +2969,7 @@ static void free_dma_trm_ctx(struct dma_trm_ctx *d)
...
@@ -2969,7 +2969,7 @@ static void free_dma_trm_ctx(struct dma_trm_ctx *d)
DBGMSG
(
d
->
ohci
->
id
,
"Freeing dma_trm_ctx %d"
,
d
->
ctx
);
DBGMSG
(
d
->
ohci
->
id
,
"Freeing dma_trm_ctx %d"
,
d
->
ctx
);
if
(
d
->
ctrlClear
)
{
if
(
d
->
ctrlClear
)
{
ohci1394_stop_context
(
d
->
ohci
,
d
->
ctrlClear
,
NULL
);
ohci1394_stop_context
(
d
->
ohci
,
d
->
ctrlClear
,
NULL
);
if
(
d
->
type
==
DMA_CTX_ISO
)
{
if
(
d
->
type
==
DMA_CTX_ISO
)
{
...
@@ -3261,7 +3261,7 @@ do { \
...
@@ -3261,7 +3261,7 @@ do { \
PRINT_G(KERN_ERR, fmt , ## args); \
PRINT_G(KERN_ERR, fmt , ## args); \
ohci1394_pci_remove(dev); \
ohci1394_pci_remove(dev); \
return err; \
return err; \
} while(0)
} while
(0)
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
)
...
@@ -3624,8 +3624,8 @@ int ohci1394_register_iso_tasklet(struct ti_ohci *ohci,
...
@@ -3624,8 +3624,8 @@ int ohci1394_register_iso_tasklet(struct ti_ohci *ohci,
usage
=
&
ohci
->
ir_ctx_usage
;
usage
=
&
ohci
->
ir_ctx_usage
;
/* only one receive context can be multichannel (OHCI sec 10.4.1) */
/* only one receive context can be multichannel (OHCI sec 10.4.1) */
if
(
tasklet
->
type
==
OHCI_ISO_MULTICHANNEL_RECEIVE
)
{
if
(
tasklet
->
type
==
OHCI_ISO_MULTICHANNEL_RECEIVE
)
{
if
(
test_and_set_bit
(
0
,
&
ohci
->
ir_multichannel_used
))
{
if
(
test_and_set_bit
(
0
,
&
ohci
->
ir_multichannel_used
))
{
return
r
;
return
r
;
}
}
}
}
...
@@ -3660,7 +3660,7 @@ void ohci1394_unregister_iso_tasklet(struct ti_ohci *ohci,
...
@@ -3660,7 +3660,7 @@ void ohci1394_unregister_iso_tasklet(struct ti_ohci *ohci,
else
{
else
{
clear_bit
(
tasklet
->
context
,
&
ohci
->
ir_ctx_usage
);
clear_bit
(
tasklet
->
context
,
&
ohci
->
ir_ctx_usage
);
if
(
tasklet
->
type
==
OHCI_ISO_MULTICHANNEL_RECEIVE
)
{
if
(
tasklet
->
type
==
OHCI_ISO_MULTICHANNEL_RECEIVE
)
{
clear_bit
(
0
,
&
ohci
->
ir_multichannel_used
);
clear_bit
(
0
,
&
ohci
->
ir_multichannel_used
);
}
}
}
}
...
...
drivers/ieee1394/raw1394.c
View file @
11092356
...
@@ -601,7 +601,7 @@ static void handle_iso_listen(struct file_info *fi, struct pending_request *req)
...
@@ -601,7 +601,7 @@ static void handle_iso_listen(struct file_info *fi, struct pending_request *req)
if
(
fi
->
listen_channels
&
(
1ULL
<<
channel
))
{
if
(
fi
->
listen_channels
&
(
1ULL
<<
channel
))
{
req
->
req
.
error
=
RAW1394_ERROR_ALREADY
;
req
->
req
.
error
=
RAW1394_ERROR_ALREADY
;
}
else
{
}
else
{
if
(
hpsb_listen_channel
(
&
raw1394_highlevel
,
fi
->
host
,
channel
))
{
if
(
hpsb_listen_channel
(
&
raw1394_highlevel
,
fi
->
host
,
channel
))
{
req
->
req
.
error
=
RAW1394_ERROR_ALREADY
;
req
->
req
.
error
=
RAW1394_ERROR_ALREADY
;
}
else
{
}
else
{
fi
->
listen_channels
|=
1ULL
<<
channel
;
fi
->
listen_channels
|=
1ULL
<<
channel
;
...
@@ -2008,7 +2008,7 @@ static inline int __rawiso_event_in_queue(struct file_info *fi)
...
@@ -2008,7 +2008,7 @@ static inline int __rawiso_event_in_queue(struct file_info *fi)
list_for_each
(
lh
,
&
fi
->
req_complete
)
{
list_for_each
(
lh
,
&
fi
->
req_complete
)
{
req
=
list_entry
(
lh
,
struct
pending_request
,
list
);
req
=
list_entry
(
lh
,
struct
pending_request
,
list
);
if
(
req
->
req
.
type
==
RAW1394_REQ_RAWISO_ACTIVITY
)
{
if
(
req
->
req
.
type
==
RAW1394_REQ_RAWISO_ACTIVITY
)
{
return
1
;
return
1
;
}
}
}
}
...
@@ -2024,17 +2024,17 @@ static void queue_rawiso_event(struct file_info *fi)
...
@@ -2024,17 +2024,17 @@ static void queue_rawiso_event(struct file_info *fi)
spin_lock_irqsave
(
&
fi
->
reqlists_lock
,
flags
);
spin_lock_irqsave
(
&
fi
->
reqlists_lock
,
flags
);
/* only one ISO activity event may be in the queue */
/* only one ISO activity event may be in the queue */
if
(
!
__rawiso_event_in_queue
(
fi
))
{
if
(
!
__rawiso_event_in_queue
(
fi
))
{
struct
pending_request
*
req
=
__alloc_pending_request
(
SLAB_ATOMIC
);
struct
pending_request
*
req
=
__alloc_pending_request
(
SLAB_ATOMIC
);
if
(
req
)
{
if
(
req
)
{
req
->
file_info
=
fi
;
req
->
file_info
=
fi
;
req
->
req
.
type
=
RAW1394_REQ_RAWISO_ACTIVITY
;
req
->
req
.
type
=
RAW1394_REQ_RAWISO_ACTIVITY
;
req
->
req
.
generation
=
get_hpsb_generation
(
fi
->
host
);
req
->
req
.
generation
=
get_hpsb_generation
(
fi
->
host
);
__queue_complete_req
(
req
);
__queue_complete_req
(
req
);
}
else
{
}
else
{
/* on allocation failure, signal an overflow */
/* on allocation failure, signal an overflow */
if
(
fi
->
iso_handle
)
{
if
(
fi
->
iso_handle
)
{
atomic_inc
(
&
fi
->
iso_handle
->
overflows
);
atomic_inc
(
&
fi
->
iso_handle
->
overflows
);
}
}
}
}
...
@@ -2054,7 +2054,7 @@ static void rawiso_activity_cb(struct hpsb_iso *iso)
...
@@ -2054,7 +2054,7 @@ static void rawiso_activity_cb(struct hpsb_iso *iso)
if
(
hi
!=
NULL
)
{
if
(
hi
!=
NULL
)
{
list_for_each
(
lh
,
&
hi
->
file_info_list
)
{
list_for_each
(
lh
,
&
hi
->
file_info_list
)
{
struct
file_info
*
fi
=
list_entry
(
lh
,
struct
file_info
,
list
);
struct
file_info
*
fi
=
list_entry
(
lh
,
struct
file_info
,
list
);
if
(
fi
->
iso_handle
==
iso
)
if
(
fi
->
iso_handle
==
iso
)
queue_rawiso_event
(
fi
);
queue_rawiso_event
(
fi
);
}
}
}
}
...
@@ -2079,7 +2079,7 @@ static int raw1394_iso_xmit_init(struct file_info *fi, void *uaddr)
...
@@ -2079,7 +2079,7 @@ static int raw1394_iso_xmit_init(struct file_info *fi, void *uaddr)
{
{
struct
raw1394_iso_status
stat
;
struct
raw1394_iso_status
stat
;
if
(
copy_from_user
(
&
stat
,
uaddr
,
sizeof
(
stat
)))
if
(
copy_from_user
(
&
stat
,
uaddr
,
sizeof
(
stat
)))
return
-
EFAULT
;
return
-
EFAULT
;
fi
->
iso_handle
=
hpsb_iso_xmit_init
(
fi
->
host
,
fi
->
iso_handle
=
hpsb_iso_xmit_init
(
fi
->
host
,
...
@@ -2089,13 +2089,13 @@ static int raw1394_iso_xmit_init(struct file_info *fi, void *uaddr)
...
@@ -2089,13 +2089,13 @@ static int raw1394_iso_xmit_init(struct file_info *fi, void *uaddr)
stat
.
config
.
speed
,
stat
.
config
.
speed
,
stat
.
config
.
irq_interval
,
stat
.
config
.
irq_interval
,
rawiso_activity_cb
);
rawiso_activity_cb
);
if
(
!
fi
->
iso_handle
)
if
(
!
fi
->
iso_handle
)
return
-
ENOMEM
;
return
-
ENOMEM
;
fi
->
iso_state
=
RAW1394_ISO_XMIT
;
fi
->
iso_state
=
RAW1394_ISO_XMIT
;
raw1394_iso_fill_status
(
fi
->
iso_handle
,
&
stat
);
raw1394_iso_fill_status
(
fi
->
iso_handle
,
&
stat
);
if
(
copy_to_user
(
uaddr
,
&
stat
,
sizeof
(
stat
)))
if
(
copy_to_user
(
uaddr
,
&
stat
,
sizeof
(
stat
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* queue an event to get things started */
/* queue an event to get things started */
...
@@ -2108,7 +2108,7 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
...
@@ -2108,7 +2108,7 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
{
{
struct
raw1394_iso_status
stat
;
struct
raw1394_iso_status
stat
;
if
(
copy_from_user
(
&
stat
,
uaddr
,
sizeof
(
stat
)))
if
(
copy_from_user
(
&
stat
,
uaddr
,
sizeof
(
stat
)))
return
-
EFAULT
;
return
-
EFAULT
;
fi
->
iso_handle
=
hpsb_iso_recv_init
(
fi
->
host
,
fi
->
iso_handle
=
hpsb_iso_recv_init
(
fi
->
host
,
...
@@ -2117,13 +2117,13 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
...
@@ -2117,13 +2117,13 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
stat
.
config
.
channel
,
stat
.
config
.
channel
,
stat
.
config
.
irq_interval
,
stat
.
config
.
irq_interval
,
rawiso_activity_cb
);
rawiso_activity_cb
);
if
(
!
fi
->
iso_handle
)
if
(
!
fi
->
iso_handle
)
return
-
ENOMEM
;
return
-
ENOMEM
;
fi
->
iso_state
=
RAW1394_ISO_RECV
;
fi
->
iso_state
=
RAW1394_ISO_RECV
;
raw1394_iso_fill_status
(
fi
->
iso_handle
,
&
stat
);
raw1394_iso_fill_status
(
fi
->
iso_handle
,
&
stat
);
if
(
copy_to_user
(
uaddr
,
&
stat
,
sizeof
(
stat
)))
if
(
copy_to_user
(
uaddr
,
&
stat
,
sizeof
(
stat
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -2134,7 +2134,7 @@ static int raw1394_iso_get_status(struct file_info *fi, void *uaddr)
...
@@ -2134,7 +2134,7 @@ static int raw1394_iso_get_status(struct file_info *fi, void *uaddr)
struct
hpsb_iso
*
iso
=
fi
->
iso_handle
;
struct
hpsb_iso
*
iso
=
fi
->
iso_handle
;
raw1394_iso_fill_status
(
fi
->
iso_handle
,
&
stat
);
raw1394_iso_fill_status
(
fi
->
iso_handle
,
&
stat
);
if
(
copy_to_user
(
uaddr
,
&
stat
,
sizeof
(
stat
)))
if
(
copy_to_user
(
uaddr
,
&
stat
,
sizeof
(
stat
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* reset overflow counter */
/* reset overflow counter */
...
@@ -2150,20 +2150,20 @@ static int raw1394_iso_recv_packets(struct file_info *fi, void *uaddr)
...
@@ -2150,20 +2150,20 @@ static int raw1394_iso_recv_packets(struct file_info *fi, void *uaddr)
unsigned
int
packet
=
fi
->
iso_handle
->
first_packet
;
unsigned
int
packet
=
fi
->
iso_handle
->
first_packet
;
int
i
;
int
i
;
if
(
copy_from_user
(
&
upackets
,
uaddr
,
sizeof
(
upackets
)))
if
(
copy_from_user
(
&
upackets
,
uaddr
,
sizeof
(
upackets
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
upackets
.
n_packets
>
hpsb_iso_n_ready
(
fi
->
iso_handle
))
if
(
upackets
.
n_packets
>
hpsb_iso_n_ready
(
fi
->
iso_handle
))
return
-
EINVAL
;
return
-
EINVAL
;
/* ensure user-supplied buffer is accessible and big enough */
/* ensure user-supplied buffer is accessible and big enough */
if
(
verify_area
(
VERIFY_WRITE
,
upackets
.
infos
,
if
(
verify_area
(
VERIFY_WRITE
,
upackets
.
infos
,
upackets
.
n_packets
*
sizeof
(
struct
raw1394_iso_packet_info
)))
upackets
.
n_packets
*
sizeof
(
struct
raw1394_iso_packet_info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* copy the packet_infos out */
/* copy the packet_infos out */
for
(
i
=
0
;
i
<
upackets
.
n_packets
;
i
++
)
{
for
(
i
=
0
;
i
<
upackets
.
n_packets
;
i
++
)
{
if
(
__copy_to_user
(
&
upackets
.
infos
[
i
],
if
(
__copy_to_user
(
&
upackets
.
infos
[
i
],
&
fi
->
iso_handle
->
infos
[
packet
],
&
fi
->
iso_handle
->
infos
[
packet
],
sizeof
(
struct
raw1394_iso_packet_info
)))
sizeof
(
struct
raw1394_iso_packet_info
)))
return
-
EFAULT
;
return
-
EFAULT
;
...
@@ -2180,28 +2180,28 @@ static int raw1394_iso_send_packets(struct file_info *fi, void *uaddr)
...
@@ -2180,28 +2180,28 @@ static int raw1394_iso_send_packets(struct file_info *fi, void *uaddr)
struct
raw1394_iso_packets
upackets
;
struct
raw1394_iso_packets
upackets
;
int
i
,
rv
;
int
i
,
rv
;
if
(
copy_from_user
(
&
upackets
,
uaddr
,
sizeof
(
upackets
)))
if
(
copy_from_user
(
&
upackets
,
uaddr
,
sizeof
(
upackets
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
upackets
.
n_packets
>
hpsb_iso_n_ready
(
fi
->
iso_handle
))
if
(
upackets
.
n_packets
>
hpsb_iso_n_ready
(
fi
->
iso_handle
))
return
-
EINVAL
;
return
-
EINVAL
;
/* ensure user-supplied buffer is accessible and big enough */
/* ensure user-supplied buffer is accessible and big enough */
if
(
verify_area
(
VERIFY_READ
,
upackets
.
infos
,
if
(
verify_area
(
VERIFY_READ
,
upackets
.
infos
,
upackets
.
n_packets
*
sizeof
(
struct
raw1394_iso_packet_info
)))
upackets
.
n_packets
*
sizeof
(
struct
raw1394_iso_packet_info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* copy the infos structs in and queue the packets */
/* copy the infos structs in and queue the packets */
for
(
i
=
0
;
i
<
upackets
.
n_packets
;
i
++
)
{
for
(
i
=
0
;
i
<
upackets
.
n_packets
;
i
++
)
{
struct
raw1394_iso_packet_info
info
;
struct
raw1394_iso_packet_info
info
;
if
(
__copy_from_user
(
&
info
,
&
upackets
.
infos
[
i
],
if
(
__copy_from_user
(
&
info
,
&
upackets
.
infos
[
i
],
sizeof
(
struct
raw1394_iso_packet_info
)))
sizeof
(
struct
raw1394_iso_packet_info
)))
return
-
EFAULT
;
return
-
EFAULT
;
rv
=
hpsb_iso_xmit_queue_packet
(
fi
->
iso_handle
,
info
.
offset
,
rv
=
hpsb_iso_xmit_queue_packet
(
fi
->
iso_handle
,
info
.
offset
,
info
.
len
,
info
.
tag
,
info
.
sy
);
info
.
len
,
info
.
tag
,
info
.
sy
);
if
(
rv
)
if
(
rv
)
return
rv
;
return
rv
;
}
}
...
@@ -2210,7 +2210,7 @@ static int raw1394_iso_send_packets(struct file_info *fi, void *uaddr)
...
@@ -2210,7 +2210,7 @@ static int raw1394_iso_send_packets(struct file_info *fi, void *uaddr)
static
void
raw1394_iso_shutdown
(
struct
file_info
*
fi
)
static
void
raw1394_iso_shutdown
(
struct
file_info
*
fi
)
{
{
if
(
fi
->
iso_handle
)
if
(
fi
->
iso_handle
)
hpsb_iso_shutdown
(
fi
->
iso_handle
);
hpsb_iso_shutdown
(
fi
->
iso_handle
);
fi
->
iso_handle
=
NULL
;
fi
->
iso_handle
=
NULL
;
...
@@ -2222,7 +2222,7 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
...
@@ -2222,7 +2222,7 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
{
{
struct
file_info
*
fi
=
file
->
private_data
;
struct
file_info
*
fi
=
file
->
private_data
;
if
(
fi
->
iso_state
==
RAW1394_ISO_INACTIVE
)
if
(
fi
->
iso_state
==
RAW1394_ISO_INACTIVE
)
return
-
EINVAL
;
return
-
EINVAL
;
return
dma_region_mmap
(
&
fi
->
iso_handle
->
data_buf
,
file
,
vma
);
return
dma_region_mmap
(
&
fi
->
iso_handle
->
data_buf
,
file
,
vma
);
...
@@ -2249,7 +2249,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
...
@@ -2249,7 +2249,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
case
RAW1394_IOC_ISO_RECV_START
:
{
case
RAW1394_IOC_ISO_RECV_START
:
{
/* copy args from user-space */
/* copy args from user-space */
int
args
[
3
];
int
args
[
3
];
if
(
copy_from_user
(
&
args
[
0
],
(
void
*
)
arg
,
sizeof
(
args
)))
if
(
copy_from_user
(
&
args
[
0
],
(
void
*
)
arg
,
sizeof
(
args
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
hpsb_iso_recv_start
(
fi
->
iso_handle
,
args
[
0
],
args
[
1
],
args
[
2
]);
return
hpsb_iso_recv_start
(
fi
->
iso_handle
,
args
[
0
],
args
[
1
],
args
[
2
]);
}
}
...
@@ -2263,7 +2263,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
...
@@ -2263,7 +2263,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
case
RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK
:
{
case
RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK
:
{
/* copy the u64 from user-space */
/* copy the u64 from user-space */
u64
mask
;
u64
mask
;
if
(
copy_from_user
(
&
mask
,
(
void
*
)
arg
,
sizeof
(
mask
)))
if
(
copy_from_user
(
&
mask
,
(
void
*
)
arg
,
sizeof
(
mask
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
hpsb_iso_recv_set_channel_mask
(
fi
->
iso_handle
,
mask
);
return
hpsb_iso_recv_set_channel_mask
(
fi
->
iso_handle
,
mask
);
}
}
...
@@ -2286,7 +2286,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
...
@@ -2286,7 +2286,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
case
RAW1394_IOC_ISO_XMIT_START
:
{
case
RAW1394_IOC_ISO_XMIT_START
:
{
/* copy two ints from user-space */
/* copy two ints from user-space */
int
args
[
2
];
int
args
[
2
];
if
(
copy_from_user
(
&
args
[
0
],
(
void
*
)
arg
,
sizeof
(
args
)))
if
(
copy_from_user
(
&
args
[
0
],
(
void
*
)
arg
,
sizeof
(
args
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
hpsb_iso_xmit_start
(
fi
->
iso_handle
,
args
[
0
],
args
[
1
]);
return
hpsb_iso_xmit_start
(
fi
->
iso_handle
,
args
[
0
],
args
[
1
]);
}
}
...
@@ -2374,7 +2374,7 @@ static int raw1394_release(struct inode *inode, struct file *file)
...
@@ -2374,7 +2374,7 @@ static int raw1394_release(struct inode *inode, struct file *file)
struct
arm_addr
*
arm_addr
=
NULL
;
struct
arm_addr
*
arm_addr
=
NULL
;
int
another_host
;
int
another_host
;
if
(
fi
->
iso_state
!=
RAW1394_ISO_INACTIVE
)
if
(
fi
->
iso_state
!=
RAW1394_ISO_INACTIVE
)
raw1394_iso_shutdown
(
fi
);
raw1394_iso_shutdown
(
fi
);
for
(
i
=
0
;
i
<
64
;
i
++
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
...
...
drivers/ieee1394/sbp2.c
View file @
11092356
...
@@ -79,7 +79,7 @@
...
@@ -79,7 +79,7 @@
#include "sbp2.h"
#include "sbp2.h"
static
char
version
[]
__devinitdata
=
static
char
version
[]
__devinitdata
=
"$Rev: 9
42
$ Ben Collins <bcollins@debian.org>"
;
"$Rev: 9
67
$ Ben Collins <bcollins@debian.org>"
;
/*
/*
* Module load parameter definitions
* Module load parameter definitions
...
@@ -93,7 +93,7 @@ static char version[] __devinitdata =
...
@@ -93,7 +93,7 @@ static char version[] __devinitdata =
* (probably due to PCI latency/throughput issues with the part). You can
* (probably due to PCI latency/throughput issues with the part). You can
* bump down the speed if you are running into problems.
* bump down the speed if you are running into problems.
*/
*/
static
int
max_speed
=
SPEED_MAX
;
static
int
max_speed
=
IEEE1394_
SPEED_MAX
;
module_param
(
max_speed
,
int
,
0644
);
module_param
(
max_speed
,
int
,
0644
);
MODULE_PARM_DESC
(
max_speed
,
"Force max speed (3 = 800mb, 2 = 400mb default, 1 = 200mb, 0 = 100mb)"
);
MODULE_PARM_DESC
(
max_speed
,
"Force max speed (3 = 800mb, 2 = 400mb default, 1 = 200mb, 0 = 100mb)"
);
...
@@ -780,8 +780,8 @@ static int sbp2_start_ud(struct sbp2scsi_host_info *hi, struct unit_directory *u
...
@@ -780,8 +780,8 @@ static int sbp2_start_ud(struct sbp2scsi_host_info *hi, struct unit_directory *u
scsi_id
->
ne
=
ud
->
ne
;
scsi_id
->
ne
=
ud
->
ne
;
scsi_id
->
hi
=
hi
;
scsi_id
->
hi
=
hi
;
scsi_id
->
speed_code
=
SPEED_100
;
scsi_id
->
speed_code
=
IEEE1394_
SPEED_100
;
scsi_id
->
max_payload_size
=
sbp2_speedto_max_payload
[
SPEED_100
];
scsi_id
->
max_payload_size
=
sbp2_speedto_max_payload
[
IEEE1394_
SPEED_100
];
atomic_set
(
&
scsi_id
->
sbp2_login_complete
,
0
);
atomic_set
(
&
scsi_id
->
sbp2_login_complete
,
0
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_inuse
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_inuse
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_completed
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_completed
);
...
...
drivers/ieee1394/video1394.c
View file @
11092356
...
@@ -589,7 +589,7 @@ static void initialize_dma_it_prg(struct dma_iso_ctx *d, int n, int sync_tag)
...
@@ -589,7 +589,7 @@ static void initialize_dma_it_prg(struct dma_iso_ctx *d, int n, int sync_tag)
it_prg
[
i
].
begin
.
status
=
0
;
it_prg
[
i
].
begin
.
status
=
0
;
it_prg
[
i
].
data
[
0
]
=
cpu_to_le32
(
it_prg
[
i
].
data
[
0
]
=
cpu_to_le32
(
(
SPEED_100
<<
16
)
(
IEEE1394_
SPEED_100
<<
16
)
|
(
/* tag */
1
<<
14
)
|
(
/* tag */
1
<<
14
)
|
(
d
->
channel
<<
8
)
|
(
d
->
channel
<<
8
)
|
(
TCODE_ISO_DATA
<<
4
));
|
(
TCODE_ISO_DATA
<<
4
));
...
@@ -705,7 +705,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -705,7 +705,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct
dma_iso_ctx
*
d
;
struct
dma_iso_ctx
*
d
;
int
i
;
int
i
;
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* if channel < 0, find lowest available one */
/* if channel < 0, find lowest available one */
...
@@ -802,7 +802,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -802,7 +802,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
v
.
channel
);
v
.
channel
);
}
}
if
(
copy_to_user
((
void
*
)
arg
,
&
v
,
sizeof
(
v
)))
if
(
copy_to_user
((
void
*
)
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -814,7 +814,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -814,7 +814,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
u64
mask
;
u64
mask
;
struct
dma_iso_ctx
*
d
;
struct
dma_iso_ctx
*
d
;
if
(
copy_from_user
(
&
channel
,
(
void
*
)
arg
,
sizeof
(
int
)))
if
(
copy_from_user
(
&
channel
,
(
void
*
)
arg
,
sizeof
(
int
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
channel
<
0
||
channel
>
(
ISO_CHANNELS
-
1
))
{
if
(
channel
<
0
||
channel
>
(
ISO_CHANNELS
-
1
))
{
...
@@ -849,7 +849,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -849,7 +849,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct
video1394_wait
v
;
struct
video1394_wait
v
;
struct
dma_iso_ctx
*
d
;
struct
dma_iso_ctx
*
d
;
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_RECEIVE
,
v
.
channel
);
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_RECEIVE
,
v
.
channel
);
...
@@ -911,7 +911,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -911,7 +911,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct
dma_iso_ctx
*
d
;
struct
dma_iso_ctx
*
d
;
int
i
;
int
i
;
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_RECEIVE
,
v
.
channel
);
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_RECEIVE
,
v
.
channel
);
...
@@ -939,12 +939,12 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -939,12 +939,12 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
}
}
#if 1
#if 1
while
(
d
->
buffer_status
[
v
.
buffer
]
!=
while
(
d
->
buffer_status
[
v
.
buffer
]
!=
VIDEO1394_BUFFER_READY
)
{
VIDEO1394_BUFFER_READY
)
{
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
interruptible_sleep_on
(
&
d
->
waitq
);
interruptible_sleep_on
(
&
d
->
waitq
);
spin_lock_irqsave
(
&
d
->
lock
,
flags
);
spin_lock_irqsave
(
&
d
->
lock
,
flags
);
if
(
signal_pending
(
current
))
{
if
(
signal_pending
(
current
))
{
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
return
-
EINTR
;
return
-
EINTR
;
}
}
...
@@ -981,7 +981,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -981,7 +981,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
d
->
lock
,
flags
);
v
.
buffer
=
i
;
v
.
buffer
=
i
;
if
(
copy_to_user
((
void
*
)
arg
,
&
v
,
sizeof
(
v
)))
if
(
copy_to_user
((
void
*
)
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -994,7 +994,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -994,7 +994,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
qv
.
packet_sizes
=
NULL
;
qv
.
packet_sizes
=
NULL
;
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_TRANSMIT
,
v
.
channel
);
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_TRANSMIT
,
v
.
channel
);
...
@@ -1097,7 +1097,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1097,7 +1097,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct
video1394_wait
v
;
struct
video1394_wait
v
;
struct
dma_iso_ctx
*
d
;
struct
dma_iso_ctx
*
d
;
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
if
(
copy_from_user
(
&
v
,
(
void
*
)
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_TRANSMIT
,
v
.
channel
);
d
=
find_ctx
(
&
ctx
->
context_list
,
OHCI_ISO_TRANSMIT
,
v
.
channel
);
...
@@ -1114,10 +1114,10 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
...
@@ -1114,10 +1114,10 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
return
0
;
return
0
;
case
VIDEO1394_BUFFER_QUEUED
:
case
VIDEO1394_BUFFER_QUEUED
:
#if 1
#if 1
while
(
d
->
buffer_status
[
v
.
buffer
]
!=
while
(
d
->
buffer_status
[
v
.
buffer
]
!=
VIDEO1394_BUFFER_READY
)
{
VIDEO1394_BUFFER_READY
)
{
interruptible_sleep_on
(
&
d
->
waitq
);
interruptible_sleep_on
(
&
d
->
waitq
);
if
(
signal_pending
(
current
))
return
-
EINTR
;
if
(
signal_pending
(
current
))
return
-
EINTR
;
}
}
#else
#else
if
(
wait_event_interruptible
(
d
->
waitq
,
if
(
wait_event_interruptible
(
d
->
waitq
,
...
...
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