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
903d1fe4
Commit
903d1fe4
authored
May 13, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/davem/net-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
fa72effd
40f911f6
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
368 additions
and
323 deletions
+368
-323
arch/i386/lib/usercopy.c
arch/i386/lib/usercopy.c
+15
-13
drivers/char/agp/Makefile
drivers/char/agp/Makefile
+1
-1
drivers/char/agp/agp.h
drivers/char/agp/agp.h
+16
-3
drivers/char/agp/amd-k8-agp.c
drivers/char/agp/amd-k8-agp.c
+30
-4
drivers/char/agp/generic.c
drivers/char/agp/generic.c
+132
-59
drivers/char/agp/isoch.c
drivers/char/agp/isoch.c
+78
-147
drivers/char/drm/Kconfig
drivers/char/drm/Kconfig
+2
-2
include/sound/seq_kernel.h
include/sound/seq_kernel.h
+1
-1
sound/core/seq/oss/seq_oss_device.h
sound/core/seq/oss/seq_oss_device.h
+2
-2
sound/core/seq/oss/seq_oss_ioctl.c
sound/core/seq/oss/seq_oss_ioctl.c
+1
-1
sound/core/seq/oss/seq_oss_rw.c
sound/core/seq/oss/seq_oss_rw.c
+2
-2
sound/core/seq/oss/seq_oss_synth.c
sound/core/seq/oss/seq_oss_synth.c
+1
-1
sound/core/seq/oss/seq_oss_timer.c
sound/core/seq/oss/seq_oss_timer.c
+5
-5
sound/core/seq/oss/seq_oss_timer.h
sound/core/seq/oss/seq_oss_timer.h
+1
-1
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_clientmgr.c
+81
-81
No files found.
arch/i386/lib/usercopy.c
View file @
903d1fe4
...
@@ -12,14 +12,16 @@
...
@@ -12,14 +12,16 @@
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/mmx.h>
#include <asm/mmx.h>
static
inline
int
movsl_is_ok
(
const
void
*
a1
,
const
void
*
a2
,
unsigned
long
n
)
static
inline
int
__movsl_is_ok
(
unsigned
long
a1
,
unsigned
long
a2
,
unsigned
long
n
)
{
{
#ifdef CONFIG_X86_INTEL_USERCOPY
#ifdef CONFIG_X86_INTEL_USERCOPY
if
(
n
>=
64
&&
((
(
const
long
)
a1
^
(
const
long
)
a2
)
&
movsl_mask
.
mask
))
if
(
n
>=
64
&&
((
a1
^
a2
)
&
movsl_mask
.
mask
))
return
0
;
return
0
;
#endif
#endif
return
1
;
return
1
;
}
}
#define movsl_is_ok(a1,a2,n) \
__movsl_is_ok((unsigned long)(a1),(unsigned long)(a2),(n))
/*
/*
* Copy a null terminated string from userspace.
* Copy a null terminated string from userspace.
...
@@ -74,7 +76,7 @@ do { \
...
@@ -74,7 +76,7 @@ do { \
* and returns @count.
* and returns @count.
*/
*/
long
long
__strncpy_from_user
(
char
*
dst
,
const
char
*
src
,
long
count
)
__strncpy_from_user
(
char
*
dst
,
const
char
__user
*
src
,
long
count
)
{
{
long
res
;
long
res
;
__do_strncpy_from_user
(
dst
,
src
,
count
,
res
);
__do_strncpy_from_user
(
dst
,
src
,
count
,
res
);
...
@@ -100,7 +102,7 @@ __strncpy_from_user(char *dst, const char *src, long count)
...
@@ -100,7 +102,7 @@ __strncpy_from_user(char *dst, const char *src, long count)
* and returns @count.
* and returns @count.
*/
*/
long
long
strncpy_from_user
(
char
*
dst
,
const
char
*
src
,
long
count
)
strncpy_from_user
(
char
*
dst
,
const
char
__user
*
src
,
long
count
)
{
{
long
res
=
-
EFAULT
;
long
res
=
-
EFAULT
;
if
(
access_ok
(
VERIFY_READ
,
src
,
1
))
if
(
access_ok
(
VERIFY_READ
,
src
,
1
))
...
@@ -145,7 +147,7 @@ do { \
...
@@ -145,7 +147,7 @@ do { \
* On success, this will be zero.
* On success, this will be zero.
*/
*/
unsigned
long
unsigned
long
clear_user
(
void
*
to
,
unsigned
long
n
)
clear_user
(
void
__user
*
to
,
unsigned
long
n
)
{
{
if
(
access_ok
(
VERIFY_WRITE
,
to
,
n
))
if
(
access_ok
(
VERIFY_WRITE
,
to
,
n
))
__do_clear_user
(
to
,
n
);
__do_clear_user
(
to
,
n
);
...
@@ -164,7 +166,7 @@ clear_user(void *to, unsigned long n)
...
@@ -164,7 +166,7 @@ clear_user(void *to, unsigned long n)
* On success, this will be zero.
* On success, this will be zero.
*/
*/
unsigned
long
unsigned
long
__clear_user
(
void
*
to
,
unsigned
long
n
)
__clear_user
(
void
__user
*
to
,
unsigned
long
n
)
{
{
__do_clear_user
(
to
,
n
);
__do_clear_user
(
to
,
n
);
return
n
;
return
n
;
...
@@ -181,7 +183,7 @@ __clear_user(void *to, unsigned long n)
...
@@ -181,7 +183,7 @@ __clear_user(void *to, unsigned long n)
* On exception, returns 0.
* On exception, returns 0.
* If the string is too long, returns a value greater than @n.
* If the string is too long, returns a value greater than @n.
*/
*/
long
strnlen_user
(
const
char
*
s
,
long
n
)
long
strnlen_user
(
const
char
__user
*
s
,
long
n
)
{
{
unsigned
long
mask
=
-
__addr_ok
(
s
);
unsigned
long
mask
=
-
__addr_ok
(
s
);
unsigned
long
res
,
tmp
;
unsigned
long
res
,
tmp
;
...
@@ -484,7 +486,7 @@ do { \
...
@@ -484,7 +486,7 @@ do { \
} while (0)
} while (0)
unsigned
long
__copy_to_user_ll
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
unsigned
long
__copy_to_user_ll
(
void
__user
*
to
,
const
void
*
from
,
unsigned
long
n
)
{
{
#ifndef CONFIG_X86_WP_WORKS_OK
#ifndef CONFIG_X86_WP_WORKS_OK
if
(
unlikely
(
boot_cpu_data
.
wp_works_ok
==
0
)
&&
if
(
unlikely
(
boot_cpu_data
.
wp_works_ok
==
0
)
&&
...
@@ -534,17 +536,17 @@ unsigned long __copy_to_user_ll(void *to, const void *from, unsigned long n)
...
@@ -534,17 +536,17 @@ unsigned long __copy_to_user_ll(void *to, const void *from, unsigned long n)
}
}
#endif
#endif
if
(
movsl_is_ok
(
to
,
from
,
n
))
if
(
movsl_is_ok
(
to
,
from
,
n
))
__copy_user
(
to
,
from
,
n
);
__copy_user
(
(
void
*
)
to
,
from
,
n
);
else
else
n
=
__copy_user_intel
(
to
,
from
,
n
);
n
=
__copy_user_intel
(
(
void
*
)
to
,
from
,
n
);
return
n
;
return
n
;
}
}
unsigned
long
__copy_from_user_ll
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
unsigned
long
__copy_from_user_ll
(
void
*
to
,
const
void
__user
*
from
,
unsigned
long
n
)
{
{
if
(
movsl_is_ok
(
to
,
from
,
n
))
if
(
movsl_is_ok
(
to
,
from
,
n
))
__copy_user_zeroing
(
to
,
from
,
n
);
__copy_user_zeroing
(
to
,
(
const
void
*
)
from
,
n
);
else
else
n
=
__copy_user_zeroing_intel
(
to
,
from
,
n
);
n
=
__copy_user_zeroing_intel
(
to
,
(
const
void
*
)
from
,
n
);
return
n
;
return
n
;
}
}
drivers/char/agp/Makefile
View file @
903d1fe4
agpgart-y
:=
backend.o frontend.o generic.o
generic-3.0
.o
agpgart-y
:=
backend.o frontend.o generic.o
isoch
.o
obj-$(CONFIG_AGP)
+=
agpgart.o
obj-$(CONFIG_AGP)
+=
agpgart.o
obj-$(CONFIG_AGP_ALI)
+=
ali-agp.o
obj-$(CONFIG_AGP_ALI)
+=
ali-agp.o
...
...
drivers/char/agp/agp.h
View file @
903d1fe4
...
@@ -139,6 +139,8 @@ struct agp_bridge_data {
...
@@ -139,6 +139,8 @@ struct agp_bridge_data {
int
max_memory_agp
;
/* in number of pages */
int
max_memory_agp
;
/* in number of pages */
int
aperture_size_idx
;
int
aperture_size_idx
;
int
capndx
;
int
capndx
;
char
major_version
;
char
minor_version
;
};
};
#define OUTREG64(mmap, addr, val) __raw_writeq((val), (mmap)+(addr))
#define OUTREG64(mmap, addr, val) __raw_writeq((val), (mmap)+(addr))
...
@@ -388,27 +390,38 @@ void agp_free_key(int key);
...
@@ -388,27 +390,38 @@ void agp_free_key(int key);
int
agp_num_entries
(
void
);
int
agp_num_entries
(
void
);
u32
agp_collect_device_status
(
u32
mode
,
u32
command
);
u32
agp_collect_device_status
(
u32
mode
,
u32
command
);
void
agp_device_command
(
u32
command
,
int
agp_v3
);
void
agp_device_command
(
u32
command
,
int
agp_v3
);
int
agp_3_0_node_enable
(
struct
agp_bridge_data
*
bridge
,
u32
mode
,
u32
minor
);
int
agp_3_0_enable
(
struct
agp_bridge_data
*
bridge
,
u32
mode
);
int
agp_3_5_enable
(
struct
agp_bridge_data
*
bridge
,
u32
mode
);
void
global_cache_flush
(
void
);
void
global_cache_flush
(
void
);
void
get_agp_version
(
struct
agp_bridge_data
*
bridge
);
/* Standard agp registers */
/* Standard agp registers */
#define AGPSTAT 0x4
#define AGPSTAT 0x4
#define AGPCMD 0x8
#define AGPCMD 0x8
#define AGPNISTAT 0xc
#define AGPNEPG 0x16
#define AGPNEPG 0x16
#define AGPNICMD 0x20
#define AGP_MAJOR_VERSION_SHIFT (20)
#define AGP_MAJOR_VERSION_SHIFT (20)
#define AGP_MINOR_VERSION_SHIFT (16)
#define AGP_MINOR_VERSION_SHIFT (16)
#define AGPSTAT_RQ_DEPTH (0xff000000)
#define AGPSTAT_RQ_DEPTH (0xff000000)
#define AGPSTAT_CAL_MASK (1<<12|1<<11|1<<10)
#define AGPSTAT_ARQSZ (1<<15|1<<14|1<<13)
#define AGPSTAT_ARQSZ_SHIFT 13
#define AGPSTAT_ARQSZ_SHIFT 13
#define AGPSTAT_AGP_ENABLE (1<<8)
#define AGPSTAT_SBA (1<<9)
#define AGPSTAT_SBA (1<<9)
#define AGPSTAT_AGP_ENABLE (1<<8)
#define AGPSTAT_FW (1<<4)
#define AGPSTAT_MODE_3_0 (1<<3)
#define AGPSTAT2_1X (1<<0)
#define AGPSTAT2_1X (1<<0)
#define AGPSTAT2_2X (1<<1)
#define AGPSTAT2_2X (1<<1)
#define AGPSTAT2_4X (1<<2)
#define AGPSTAT2_4X (1<<2)
#define AGPSTAT_FW (1<<4)
#define AGPSTAT3_RSVD (1<<2)
#define AGPSTAT3_8X (1<<1)
#define AGPSTAT3_4X (1)
#endif
/* _AGP_BACKEND_PRIV_H */
#endif
/* _AGP_BACKEND_PRIV_H */
drivers/char/agp/amd-k8-agp.c
View file @
903d1fe4
...
@@ -253,8 +253,10 @@ static int __init agp_amdk8_probe(struct pci_dev *pdev,
...
@@ -253,8 +253,10 @@ static int __init agp_amdk8_probe(struct pci_dev *pdev,
{
{
struct
agp_bridge_data
*
bridge
;
struct
agp_bridge_data
*
bridge
;
struct
pci_dev
*
loop_dev
;
struct
pci_dev
*
loop_dev
;
u8
rev_id
;
u8
cap_ptr
;
u8
cap_ptr
;
int
i
=
0
;
int
i
=
0
;
char
*
revstring
=
" "
;
cap_ptr
=
pci_find_capability
(
pdev
,
PCI_CAP_ID_AGP
);
cap_ptr
=
pci_find_capability
(
pdev
,
PCI_CAP_ID_AGP
);
if
(
!
cap_ptr
)
if
(
!
cap_ptr
)
...
@@ -266,14 +268,38 @@ static int __init agp_amdk8_probe(struct pci_dev *pdev,
...
@@ -266,14 +268,38 @@ static int __init agp_amdk8_probe(struct pci_dev *pdev,
if
(
!
bridge
)
if
(
!
bridge
)
return
-
ENOMEM
;
return
-
ENOMEM
;
/* Assume here we have an 8151. (Later this assumption will be fixed). */
pci_read_config_byte
(
pdev
,
PCI_REVISION_ID
,
&
rev_id
);
switch
(
rev_id
)
{
case
0x01
:
revstring
=
"A0"
;
break
;
case
0x02
:
revstring
=
"A1"
;
break
;
case
0x11
:
revstring
=
"B0"
;
break
;
case
0x12
:
revstring
=
"B1"
;
break
;
case
0x13
:
revstring
=
"B2"
;
break
;
default:
revstring
=
"??"
;
break
;
}
printk
(
"Detected AMD 8151 AGP Bridge rev %s"
,
revstring
);
/*
* Work around errata.
* Chips before B2 stepping incorrectly reporting v3.5
*/
if
(
rev_id
<
0x13
)
{
bridge
->
major_version
=
3
;
bridge
->
minor_version
=
0
;
}
bridge
->
driver
=
&
amd_8151_driver
;
bridge
->
driver
=
&
amd_8151_driver
;
bridge
->
dev
=
pdev
;
bridge
->
dev
=
pdev
;
bridge
->
capndx
=
cap_ptr
;
bridge
->
capndx
=
cap_ptr
;
/* Fill in the mode register */
/* Fill in the mode register */
pci_read_config_dword
(
pdev
,
pci_read_config_dword
(
pdev
,
bridge
->
capndx
+
PCI_AGP_STATUS
,
&
bridge
->
mode
);
bridge
->
capndx
+
PCI_AGP_STATUS
,
&
bridge
->
mode
);
/* cache pci_devs of northbridges. */
/* cache pci_devs of northbridges. */
pci_for_each_dev
(
loop_dev
)
{
pci_for_each_dev
(
loop_dev
)
{
...
@@ -290,7 +316,7 @@ static int __init agp_amdk8_probe(struct pci_dev *pdev,
...
@@ -290,7 +316,7 @@ static int __init agp_amdk8_probe(struct pci_dev *pdev,
pci_set_drvdata
(
pdev
,
bridge
);
pci_set_drvdata
(
pdev
,
bridge
);
return
agp_add_bridge
(
bridge
);
return
agp_add_bridge
(
bridge
);
out_free:
out_free:
agp_put_bridge
(
bridge
);
agp_put_bridge
(
bridge
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
...
drivers/char/agp/generic.c
View file @
903d1fe4
...
@@ -270,14 +270,16 @@ EXPORT_SYMBOL_GPL(agp_num_entries);
...
@@ -270,14 +270,16 @@ EXPORT_SYMBOL_GPL(agp_num_entries);
int
agp_copy_info
(
agp_kern_info
*
info
)
int
agp_copy_info
(
agp_kern_info
*
info
)
{
{
memset
(
info
,
0
,
sizeof
(
agp_kern_info
));
memset
(
info
,
0
,
sizeof
(
agp_kern_info
));
if
(
agp_bridge
->
type
==
NOT_SUPPORTED
)
{
if
(
!
agp_bridge
||
agp_bridge
->
type
==
NOT_SUPPORTED
||
info
->
chipset
=
agp_bridge
->
type
;
!
agp_bridge
->
version
)
{
info
->
chipset
=
NOT_SUPPORTED
;
return
-
EIO
;
return
-
EIO
;
}
}
info
->
version
.
major
=
agp_bridge
->
version
->
major
;
info
->
version
.
major
=
agp_bridge
->
version
->
major
;
info
->
version
.
minor
=
agp_bridge
->
version
->
minor
;
info
->
version
.
minor
=
agp_bridge
->
version
->
minor
;
info
->
device
=
agp_bridge
->
dev
;
info
->
chipset
=
agp_bridge
->
type
;
info
->
chipset
=
agp_bridge
->
type
;
info
->
device
=
agp_bridge
->
dev
;
info
->
mode
=
agp_bridge
->
mode
;
info
->
mode
=
agp_bridge
->
mode
;
info
->
aper_base
=
agp_bridge
->
gart_bus_addr
;
info
->
aper_base
=
agp_bridge
->
gart_bus_addr
;
info
->
aper_size
=
agp_return_size
();
info
->
aper_size
=
agp_return_size
();
...
@@ -366,60 +368,106 @@ EXPORT_SYMBOL(agp_unbind_memory);
...
@@ -366,60 +368,106 @@ EXPORT_SYMBOL(agp_unbind_memory);
/* Generic Agp routines - Start */
/* Generic Agp routines - Start */
static
void
agp_v2_parse_one
(
u32
*
mode
,
u32
*
cmd
,
u32
*
tmp
)
{
/* disable SBA if it's not supported */
if
(
!
((
*
cmd
&
AGPSTAT_SBA
)
&&
(
*
tmp
&
AGPSTAT_SBA
)
&&
(
*
mode
&
AGPSTAT_SBA
)))
*
cmd
&=
~
AGPSTAT_SBA
;
/* disable FW if it's not supported */
if
(
!
((
*
cmd
&
AGPSTAT_FW
)
&&
(
*
tmp
&
AGPSTAT_FW
)
&&
(
*
mode
&
AGPSTAT_FW
)))
*
cmd
&=
~
AGPSTAT_FW
;
/* Set speed */
if
(
!
((
*
cmd
&
AGPSTAT2_4X
)
&&
(
*
tmp
&
AGPSTAT2_4X
)
&&
(
*
mode
&
AGPSTAT2_4X
)))
*
cmd
&=
~
AGPSTAT2_4X
;
if
(
!
((
*
cmd
&
AGPSTAT2_2X
)
&&
(
*
tmp
&
AGPSTAT2_2X
)
&&
(
*
mode
&
AGPSTAT2_2X
)))
*
cmd
&=
~
AGPSTAT2_2X
;
if
(
!
((
*
cmd
&
AGPSTAT2_1X
)
&&
(
*
tmp
&
AGPSTAT2_1X
)
&&
(
*
mode
&
AGPSTAT2_1X
)))
*
cmd
&=
~
AGPSTAT2_1X
;
/* Now we know what mode it should be, clear out the unwanted bits. */
if
(
*
cmd
&
AGPSTAT2_4X
)
*
cmd
&=
~
(
AGPSTAT2_1X
|
AGPSTAT2_2X
);
/* 4X */
if
(
*
cmd
&
AGPSTAT2_2X
)
*
cmd
&=
~
(
AGPSTAT2_1X
|
AGPSTAT2_4X
);
/* 2X */
if
(
*
cmd
&
AGPSTAT2_1X
)
*
cmd
&=
~
(
AGPSTAT2_2X
|
AGPSTAT2_4X
);
/* 1Xf */
}
u32
agp_collect_device_status
(
u32
mode
,
u32
command
)
static
void
agp_v3_parse_one
(
u32
*
mode
,
u32
*
cmd
,
u32
*
tmp
)
{
/* ARQSZ - Set the value to the maximum one.
* Don't allow the mode register to override values. */
*
cmd
=
((
*
cmd
&
~
AGPSTAT_ARQSZ
)
|
max_t
(
u32
,(
*
cmd
&
AGPSTAT_ARQSZ
),(
*
tmp
&
AGPSTAT_ARQSZ
)));
/* Calibration cycle.
* Don't allow the mode register to override values. */
*
cmd
=
((
*
cmd
&
~
AGPSTAT_CAL_MASK
)
|
min_t
(
u32
,(
*
cmd
&
AGPSTAT_CAL_MASK
),(
*
tmp
&
AGPSTAT_CAL_MASK
)));
/* SBA *must* be supported for AGP v3 */
*
cmd
|=
AGPSTAT_SBA
;
/* disable FW if it's not supported */
if
(
!
((
*
cmd
&
AGPSTAT_FW
)
&&
(
*
tmp
&
AGPSTAT_FW
)
&&
(
*
mode
&
AGPSTAT_FW
)))
*
cmd
&=
~
AGPSTAT_FW
;
/* Set speed. */
if
(
!
((
*
cmd
&
AGPSTAT3_8X
)
&&
(
*
tmp
&
AGPSTAT3_8X
)
&&
(
*
mode
&
AGPSTAT3_8X
)))
*
cmd
&=
~
AGPSTAT3_8X
;
if
(
!
((
*
cmd
&
AGPSTAT3_4X
)
&&
(
*
tmp
&
AGPSTAT3_4X
)
&&
(
*
mode
&
AGPSTAT3_4X
)))
*
cmd
&=
~
AGPSTAT3_4X
;
/* Clear out unwanted bits. */
if
(
*
cmd
&
AGPSTAT3_8X
)
*
cmd
*=
~
(
AGPSTAT3_4X
|
AGPSTAT3_RSVD
);
if
(
*
cmd
&
AGPSTAT3_4X
)
*
cmd
*=
~
(
AGPSTAT3_8X
|
AGPSTAT3_RSVD
);
}
//FIXME: This doesn't smell right.
//We need a function we pass an agp_device to.
u32
agp_collect_device_status
(
u32
mode
,
u32
cmd
)
{
{
struct
pci_dev
*
device
;
struct
pci_dev
*
device
;
u8
agp
;
u8
cap_ptr
;
u32
scratch
;
u32
tmp
;
u32
agp3
;
pci_for_each_dev
(
device
)
{
pci_for_each_dev
(
device
)
{
agp
=
pci_find_capability
(
device
,
PCI_CAP_ID_AGP
);
cap_ptr
=
pci_find_capability
(
device
,
PCI_CAP_ID_AGP
);
if
(
!
agp
)
if
(
!
cap_ptr
)
continue
;
continue
;
/*
/*
* Ok, here we have a AGP device. Disable impossible
* Ok, here we have a AGP device. Disable impossible
* settings, and adjust the readqueue to the minimum.
* settings, and adjust the readqueue to the minimum.
*/
*/
pci_read_config_dword
(
device
,
agp
+
PCI_AGP_STATUS
,
&
scratch
);
pci_read_config_dword
(
device
,
cap_ptr
+
PCI_AGP_STATUS
,
&
tmp
);
/* adjust RQ depth */
/* adjust RQ depth */
c
ommand
=
((
comman
d
&
~
AGPSTAT_RQ_DEPTH
)
|
c
md
=
((
cm
d
&
~
AGPSTAT_RQ_DEPTH
)
|
min_t
(
u32
,
(
mode
&
AGPSTAT_RQ_DEPTH
),
min_t
(
u32
,
(
mode
&
AGPSTAT_RQ_DEPTH
),
min_t
(
u32
,
(
command
&
AGPSTAT_RQ_DEPTH
),
min_t
(
u32
,
(
cmd
&
AGPSTAT_RQ_DEPTH
),
(
tmp
&
AGPSTAT_RQ_DEPTH
))));
(
scratch
&
AGPSTAT_RQ_DEPTH
))));
/* disable SBA if it's not supported */
if
(
!
((
command
&
AGPSTAT_SBA
)
&&
(
scratch
&
AGPSTAT_SBA
)
&&
(
mode
&
AGPSTAT_SBA
)))
command
&=
~
AGPSTAT_SBA
;
/* disable FW if it's not supported */
if
(
!
((
command
&
AGPSTAT_FW
)
&&
(
scratch
&
AGPSTAT_FW
)
&&
(
mode
&
AGPSTAT_FW
)))
command
&=
~
AGPSTAT_FW
;
/* Set speed */
if
(
!
((
command
&
AGPSTAT2_4X
)
&&
(
scratch
&
AGPSTAT2_4X
)
&&
(
mode
&
AGPSTAT2_4X
)))
command
&=
~
AGPSTAT2_4X
;
if
(
!
((
command
&
AGPSTAT2_2X
)
&&
(
scratch
&
AGPSTAT2_2X
)
&&
(
mode
&
AGPSTAT2_2X
)))
pci_read_config_dword
(
device
,
cap_ptr
+
AGPSTAT
,
&
agp3
);
command
&=
~
AGPSTAT2_2X
;
if
(
!
((
command
&
AGPSTAT2_1X
)
&&
(
scratch
&
AGPSTAT2_1X
)
&&
(
mode
&
AGPSTAT2_1X
)))
/* Check to see if we are operating in 3.0 mode */
command
&=
~
AGPSTAT2_1X
;
if
(
agp3
&
AGPSTAT_MODE_3_0
)
{
agp_v3_parse_one
(
&
mode
,
&
cmd
,
&
tmp
);
}
else
{
agp_v2_parse_one
(
&
mode
,
&
cmd
,
&
tmp
);
}
}
}
/* Now we know what mode it should be, clear out the unwanted bits. */
return
cmd
;
if
(
command
&
AGPSTAT2_4X
)
command
&=
~
(
AGPSTAT2_1X
|
AGPSTAT2_2X
);
/* 4X */
if
(
command
&
AGPSTAT2_2X
)
command
&=
~
(
AGPSTAT2_1X
|
AGPSTAT2_4X
);
/* 2X */
if
(
command
&
AGPSTAT2_1X
)
command
&=
~
(
AGPSTAT2_2X
|
AGPSTAT2_4X
);
/* 1Xf */
return
command
;
}
}
EXPORT_SYMBOL
(
agp_collect_device_status
);
EXPORT_SYMBOL
(
agp_collect_device_status
);
...
@@ -446,29 +494,33 @@ void agp_device_command(u32 command, int agp_v3)
...
@@ -446,29 +494,33 @@ void agp_device_command(u32 command, int agp_v3)
EXPORT_SYMBOL
(
agp_device_command
);
EXPORT_SYMBOL
(
agp_device_command
);
void
agp_generic_enable
(
u32
mod
e
)
void
get_agp_version
(
struct
agp_bridge_data
*
bridg
e
)
{
{
u32
command
,
ncapid
,
major
,
minor
;
u32
ncapid
;
/* Exit early if already set by errata workarounds. */
if
(
agp_bridge
->
major_version
!=
0
)
return
;
pci_read_config_dword
(
agp_bridge
->
dev
,
agp_bridge
->
capndx
,
&
ncapid
);
pci_read_config_dword
(
agp_bridge
->
dev
,
agp_bridge
->
capndx
,
&
ncapid
);
major
=
(
ncapid
>>
20
)
&
0xf
;
agp_bridge
->
major_version
=
(
ncapid
>>
AGP_MAJOR_VERSION_SHIFT
)
&
0xf
;
minor
=
(
ncapid
>>
16
)
&
0xf
;
agp_bridge
->
minor_version
=
(
ncapid
>>
AGP_MINOR_VERSION_SHIFT
)
&
0xf
;
printk
(
KERN_INFO
PFX
"Found an AGP %d.%d compliant device.
\n
"
,
major
,
minor
);
}
EXPORT_SYMBOL
(
get_agp_version
);
if
(
major
>=
3
)
{
u32
agp_3_0
;
pci_read_config_dword
(
agp_bridge
->
dev
,
agp_bridge
->
capndx
+
0x4
,
&
agp_3_0
);
void
agp_generic_enable
(
u32
mode
)
/* Check to see if we are operating in 3.0 mode */
{
if
((
agp_3_0
>>
3
)
&
0x1
)
{
u32
command
;
agp_3_0_node_enable
(
agp_bridge
,
mode
,
minor
);
u32
agp3
;
return
;
}
else
{
get_agp_version
(
agp_bridge
);
printk
(
KERN_INFO
PFX
"not in AGP 3.0 mode, falling back to 2.x
\n
"
);
}
printk
(
KERN_INFO
PFX
"Found an AGP %d.%d compliant device at %s.
\n
"
,
}
agp_bridge
->
major_version
,
agp_bridge
->
minor_version
,
agp_bridge
->
dev
->
slot_name
);
/* AGP v<3 */
pci_read_config_dword
(
agp_bridge
->
dev
,
pci_read_config_dword
(
agp_bridge
->
dev
,
agp_bridge
->
capndx
+
PCI_AGP_STATUS
,
&
command
);
agp_bridge
->
capndx
+
PCI_AGP_STATUS
,
&
command
);
...
@@ -477,7 +529,27 @@ void agp_generic_enable(u32 mode)
...
@@ -477,7 +529,27 @@ void agp_generic_enable(u32 mode)
pci_write_config_dword
(
agp_bridge
->
dev
,
pci_write_config_dword
(
agp_bridge
->
dev
,
agp_bridge
->
capndx
+
PCI_AGP_COMMAND
,
command
);
agp_bridge
->
capndx
+
PCI_AGP_COMMAND
,
command
);
agp_device_command
(
command
,
0
);
/* Do AGP version specific frobbing. */
if
(
agp_bridge
->
major_version
>=
3
)
{
pci_read_config_dword
(
agp_bridge
->
dev
,
agp_bridge
->
capndx
+
AGPSTAT
,
&
agp3
);
/* Check to see if we are operating in 3.0 mode */
if
(
agp3
&
AGPSTAT_MODE_3_0
)
{
/* If we have 3.5, we can do the isoch stuff. */
if
(
agp_bridge
->
minor_version
>=
5
)
agp_3_5_enable
(
agp_bridge
,
mode
);
agp_device_command
(
command
,
TRUE
);
return
;
}
else
{
printk
(
KERN_INFO
PFX
"Device is in legacy mode,"
" falling back to 2.x
\n
"
);
}
}
/* AGP v<3 */
agp_device_command
(
command
,
FALSE
);
}
}
EXPORT_SYMBOL
(
agp_generic_enable
);
EXPORT_SYMBOL
(
agp_generic_enable
);
...
@@ -831,6 +903,7 @@ void agp_enable(u32 mode)
...
@@ -831,6 +903,7 @@ void agp_enable(u32 mode)
}
}
EXPORT_SYMBOL
(
agp_enable
);
EXPORT_SYMBOL
(
agp_enable
);
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
static
void
ipi_handler
(
void
*
null
)
static
void
ipi_handler
(
void
*
null
)
{
{
...
...
drivers/char/agp/
generic-3.0
.c
→
drivers/char/agp/
isoch
.c
View file @
903d1fe4
/*
/*
*
Generic routines for AGP 3.0
compliant bridges.
*
Setup routines for AGP 3.5
compliant bridges.
*/
*/
#include <linux/list.h>
#include <linux/list.h>
...
@@ -9,47 +9,47 @@
...
@@ -9,47 +9,47 @@
#include "agp.h"
#include "agp.h"
/* Generic AGP 3.
0
enabling routines */
/* Generic AGP 3.
5
enabling routines */
struct
agp_3_
0
_dev
{
struct
agp_3_
5
_dev
{
struct
list_head
list
;
struct
list_head
list
;
u8
capndx
;
u8
capndx
;
u32
maxbw
;
u32
maxbw
;
struct
pci_dev
*
dev
;
struct
pci_dev
*
dev
;
};
};
static
void
agp_3_
0
_dev_list_insert
(
struct
list_head
*
head
,
struct
list_head
*
new
)
static
void
agp_3_
5
_dev_list_insert
(
struct
list_head
*
head
,
struct
list_head
*
new
)
{
{
struct
agp_3_
0_dev
*
cur
,
*
n
=
list_entry
(
new
,
struct
agp_3_0
_dev
,
list
);
struct
agp_3_
5_dev
*
cur
,
*
n
=
list_entry
(
new
,
struct
agp_3_5
_dev
,
list
);
struct
list_head
*
pos
;
struct
list_head
*
pos
;
list_for_each
(
pos
,
head
)
{
list_for_each
(
pos
,
head
)
{
cur
=
list_entry
(
pos
,
struct
agp_3_
0
_dev
,
list
);
cur
=
list_entry
(
pos
,
struct
agp_3_
5
_dev
,
list
);
if
(
cur
->
maxbw
>
n
->
maxbw
)
if
(
cur
->
maxbw
>
n
->
maxbw
)
break
;
break
;
}
}
list_add_tail
(
new
,
pos
);
list_add_tail
(
new
,
pos
);
}
}
static
void
agp_3_
0_dev_list_sort
(
struct
agp_3_0
_dev
*
list
,
unsigned
int
ndevs
)
static
void
agp_3_
5_dev_list_sort
(
struct
agp_3_5
_dev
*
list
,
unsigned
int
ndevs
)
{
{
struct
agp_3_
0
_dev
*
cur
;
struct
agp_3_
5
_dev
*
cur
;
struct
pci_dev
*
dev
;
struct
pci_dev
*
dev
;
struct
list_head
*
pos
,
*
tmp
,
*
head
=
&
list
->
list
,
*
start
=
head
->
next
;
struct
list_head
*
pos
,
*
tmp
,
*
head
=
&
list
->
list
,
*
start
=
head
->
next
;
u32
nistat
;
u32
nistat
;
INIT_LIST_HEAD
(
head
);
INIT_LIST_HEAD
(
head
);
for
(
pos
=
start
;
pos
!=
head
;
)
{
for
(
pos
=
start
;
pos
!=
head
;
)
{
cur
=
list_entry
(
pos
,
struct
agp_3_
0
_dev
,
list
);
cur
=
list_entry
(
pos
,
struct
agp_3_
5
_dev
,
list
);
dev
=
cur
->
dev
;
dev
=
cur
->
dev
;
pci_read_config_dword
(
dev
,
cur
->
capndx
+
0x0c
,
&
nistat
);
pci_read_config_dword
(
dev
,
cur
->
capndx
+
AGPNISTAT
,
&
nistat
);
cur
->
maxbw
=
(
nistat
>>
16
)
&
0xff
;
cur
->
maxbw
=
(
nistat
>>
16
)
&
0xff
;
tmp
=
pos
;
tmp
=
pos
;
pos
=
pos
->
next
;
pos
=
pos
->
next
;
agp_3_
0
_dev_list_insert
(
head
,
tmp
);
agp_3_
5
_dev_list_insert
(
head
,
tmp
);
}
}
}
}
...
@@ -59,8 +59,8 @@ static void agp_3_0_dev_list_sort(struct agp_3_0_dev *list, unsigned int ndevs)
...
@@ -59,8 +59,8 @@ static void agp_3_0_dev_list_sort(struct agp_3_0_dev *list, unsigned int ndevs)
* lying behind it...)
* lying behind it...)
*/
*/
static
int
agp_3_
0
_isochronous_node_enable
(
struct
agp_bridge_data
*
bridge
,
static
int
agp_3_
5
_isochronous_node_enable
(
struct
agp_bridge_data
*
bridge
,
struct
agp_3_
0
_dev
*
dev_list
,
unsigned
int
ndevs
)
struct
agp_3_
5
_dev
*
dev_list
,
unsigned
int
ndevs
)
{
{
/*
/*
* Convenience structure to make the calculations clearer
* Convenience structure to make the calculations clearer
...
@@ -72,12 +72,12 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -72,12 +72,12 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
u32
y
;
u32
y
;
u32
l
;
u32
l
;
u32
rq
;
u32
rq
;
struct
agp_3_
0
_dev
*
dev
;
struct
agp_3_
5
_dev
*
dev
;
};
};
struct
pci_dev
*
td
=
bridge
->
dev
,
*
dev
;
struct
pci_dev
*
td
=
bridge
->
dev
,
*
dev
;
struct
list_head
*
head
=
&
dev_list
->
list
,
*
pos
;
struct
list_head
*
head
=
&
dev_list
->
list
,
*
pos
;
struct
agp_3_
0
_dev
*
cur
;
struct
agp_3_
5
_dev
*
cur
;
struct
isoch_data
*
master
,
target
;
struct
isoch_data
*
master
,
target
;
unsigned
int
cdev
=
0
;
unsigned
int
cdev
=
0
;
u32
mnistat
,
tnistat
,
tstatus
,
mcmd
;
u32
mnistat
,
tnistat
,
tstatus
,
mcmd
;
...
@@ -91,7 +91,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -91,7 +91,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
* We'll work with an array of isoch_data's (one for each
* We'll work with an array of isoch_data's (one for each
* device in dev_list) throughout this function.
* device in dev_list) throughout this function.
*/
*/
if
((
master
=
kmalloc
(
ndevs
*
sizeof
(
*
master
),
GFP_KERNEL
))
==
NULL
)
{
if
((
master
=
kmalloc
(
ndevs
*
sizeof
(
*
master
),
GFP_KERNEL
))
==
NULL
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
get_out
;
goto
get_out
;
}
}
...
@@ -112,9 +112,9 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -112,9 +112,9 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
* transfers are enabled and consequently whether maxbw will mean
* transfers are enabled and consequently whether maxbw will mean
* anything.
* anything.
*/
*/
agp_3_
0
_dev_list_sort
(
dev_list
,
ndevs
);
agp_3_
5
_dev_list_sort
(
dev_list
,
ndevs
);
pci_read_config_dword
(
td
,
bridge
->
capndx
+
0x0c
,
&
tnistat
);
pci_read_config_dword
(
td
,
bridge
->
capndx
+
AGPNISTAT
,
&
tnistat
);
pci_read_config_dword
(
td
,
bridge
->
capndx
+
AGPSTAT
,
&
tstatus
);
pci_read_config_dword
(
td
,
bridge
->
capndx
+
AGPSTAT
,
&
tstatus
);
/* Extract power-on defaults from the target */
/* Extract power-on defaults from the target */
...
@@ -132,12 +132,12 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -132,12 +132,12 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
* by these devices and the largest requested payload size.
* by these devices and the largest requested payload size.
*/
*/
list_for_each
(
pos
,
head
)
{
list_for_each
(
pos
,
head
)
{
cur
=
list_entry
(
pos
,
struct
agp_3_
0
_dev
,
list
);
cur
=
list_entry
(
pos
,
struct
agp_3_
5
_dev
,
list
);
dev
=
cur
->
dev
;
dev
=
cur
->
dev
;
mcapndx
=
cur
->
capndx
;
mcapndx
=
cur
->
capndx
;
pci_read_config_dword
(
dev
,
cur
->
capndx
+
0x0c
,
&
mnistat
);
pci_read_config_dword
(
dev
,
cur
->
capndx
+
AGPNISTAT
,
&
mnistat
);
master
[
cdev
].
maxbw
=
(
mnistat
>>
16
)
&
0xff
;
master
[
cdev
].
maxbw
=
(
mnistat
>>
16
)
&
0xff
;
master
[
cdev
].
n
=
(
mnistat
>>
8
)
&
0xff
;
master
[
cdev
].
n
=
(
mnistat
>>
8
)
&
0xff
;
...
@@ -151,7 +151,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -151,7 +151,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
}
}
/* Check if this configuration has any chance of working */
/* Check if this configuration has any chance of working */
if
(
tot_bw
>
target
.
maxbw
)
{
if
(
tot_bw
>
target
.
maxbw
)
{
printk
(
KERN_ERR
PFX
"isochronous bandwidth required "
printk
(
KERN_ERR
PFX
"isochronous bandwidth required "
"by AGP 3.0 devices exceeds that which is supported by "
"by AGP 3.0 devices exceeds that which is supported by "
"the AGP 3.0 bridge!
\n
"
);
"the AGP 3.0 bridge!
\n
"
);
...
@@ -167,17 +167,17 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -167,17 +167,17 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
* in the target's NISTAT register, so we need to do this now
* in the target's NISTAT register, so we need to do this now
* to get an accurate value for ISOCH_N later.
* to get an accurate value for ISOCH_N later.
*/
*/
pci_read_config_word
(
td
,
bridge
->
capndx
+
0x20
,
&
tnicmd
);
pci_read_config_word
(
td
,
bridge
->
capndx
+
AGPNICMD
,
&
tnicmd
);
tnicmd
&=
~
(
0x3
<<
6
);
tnicmd
&=
~
(
0x3
<<
6
);
tnicmd
|=
target
.
y
<<
6
;
tnicmd
|=
target
.
y
<<
6
;
pci_write_config_word
(
td
,
bridge
->
capndx
+
0x20
,
tnicmd
);
pci_write_config_word
(
td
,
bridge
->
capndx
+
AGPNICMD
,
tnicmd
);
/* Reread the target's ISOCH_N */
/* Reread the target's ISOCH_N */
pci_read_config_dword
(
td
,
bridge
->
capndx
+
0x0c
,
&
tnistat
);
pci_read_config_dword
(
td
,
bridge
->
capndx
+
AGPNISTAT
,
&
tnistat
);
target
.
n
=
(
tnistat
>>
8
)
&
0xff
;
target
.
n
=
(
tnistat
>>
8
)
&
0xff
;
/* Calculate the minimum ISOCH_N needed by each master */
/* Calculate the minimum ISOCH_N needed by each master */
for
(
cdev
=
0
;
cdev
<
ndevs
;
cdev
++
)
{
for
(
cdev
=
0
;
cdev
<
ndevs
;
cdev
++
)
{
master
[
cdev
].
y
=
target
.
y
;
master
[
cdev
].
y
=
target
.
y
;
master
[
cdev
].
n
=
master
[
cdev
].
maxbw
/
(
master
[
cdev
].
y
+
1
);
master
[
cdev
].
n
=
master
[
cdev
].
maxbw
/
(
master
[
cdev
].
y
+
1
);
...
@@ -186,7 +186,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -186,7 +186,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
/* Exit if the minimal ISOCH_N allocation among the masters is more
/* Exit if the minimal ISOCH_N allocation among the masters is more
* than the target can handle. */
* than the target can handle. */
if
(
tot_n
>
target
.
n
)
{
if
(
tot_n
>
target
.
n
)
{
printk
(
KERN_ERR
PFX
"number of isochronous "
printk
(
KERN_ERR
PFX
"number of isochronous "
"transactions per period required by AGP 3.0 devices "
"transactions per period required by AGP 3.0 devices "
"exceeds that which is supported by the AGP 3.0 "
"exceeds that which is supported by the AGP 3.0 "
...
@@ -204,7 +204,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -204,7 +204,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
* Along the way, distribute the extra ISOCH_N capability calculated
* Along the way, distribute the extra ISOCH_N capability calculated
* above.
* above.
*/
*/
for
(
cdev
=
0
;
cdev
<
ndevs
;
cdev
++
)
{
for
(
cdev
=
0
;
cdev
<
ndevs
;
cdev
++
)
{
/*
/*
* This is a little subtle. If ISOCH_Y > 64B, then ISOCH_Y
* This is a little subtle. If ISOCH_Y > 64B, then ISOCH_Y
* byte isochronous writes will be broken into 64B pieces.
* byte isochronous writes will be broken into 64B pieces.
...
@@ -213,13 +213,12 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -213,13 +213,12 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
* many writes on the AGP bus).
* many writes on the AGP bus).
*/
*/
master
[
cdev
].
rq
=
master
[
cdev
].
n
;
master
[
cdev
].
rq
=
master
[
cdev
].
n
;
if
(
master
[
cdev
].
y
>
0x1
)
{
if
(
master
[
cdev
].
y
>
0x1
)
master
[
cdev
].
rq
*=
(
1
<<
(
master
[
cdev
].
y
-
1
));
master
[
cdev
].
rq
*=
(
1
<<
(
master
[
cdev
].
y
-
1
));
}
tot_rq
+=
master
[
cdev
].
rq
;
tot_rq
+=
master
[
cdev
].
rq
;
if
(
cdev
==
ndevs
-
1
)
if
(
cdev
==
ndevs
-
1
)
master
[
cdev
].
n
+=
rem
;
master
[
cdev
].
n
+=
rem
;
}
}
...
@@ -230,7 +229,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -230,7 +229,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
/* Exit if the minimal RQ needs of the masters exceeds what the target
/* Exit if the minimal RQ needs of the masters exceeds what the target
* can provide. */
* can provide. */
if
(
tot_rq
>
rq_isoch
)
{
if
(
tot_rq
>
rq_isoch
)
{
printk
(
KERN_ERR
PFX
"number of request queue slots "
printk
(
KERN_ERR
PFX
"number of request queue slots "
"required by the isochronous bandwidth requested by "
"required by the isochronous bandwidth requested by "
"AGP 3.0 devices exceeds the number provided by the "
"AGP 3.0 devices exceeds the number provided by the "
...
@@ -247,7 +246,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -247,7 +246,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
/* Distribute the extra RQ slots calculated above and write our
/* Distribute the extra RQ slots calculated above and write our
* isochronous settings out to the actual devices. */
* isochronous settings out to the actual devices. */
for
(
cdev
=
0
;
cdev
<
ndevs
;
cdev
++
)
{
for
(
cdev
=
0
;
cdev
<
ndevs
;
cdev
++
)
{
cur
=
master
[
cdev
].
dev
;
cur
=
master
[
cdev
].
dev
;
dev
=
cur
->
dev
;
dev
=
cur
->
dev
;
...
@@ -256,7 +255,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -256,7 +255,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
master
[
cdev
].
rq
+=
(
cdev
==
ndevs
-
1
)
master
[
cdev
].
rq
+=
(
cdev
==
ndevs
-
1
)
?
(
rem_async
+
rem_isoch
)
:
step
;
?
(
rem_async
+
rem_isoch
)
:
step
;
pci_read_config_word
(
dev
,
cur
->
capndx
+
0x20
,
&
mnicmd
);
pci_read_config_word
(
dev
,
cur
->
capndx
+
AGPNICMD
,
&
mnicmd
);
pci_read_config_dword
(
dev
,
cur
->
capndx
+
AGPCMD
,
&
mcmd
);
pci_read_config_dword
(
dev
,
cur
->
capndx
+
AGPCMD
,
&
mcmd
);
mnicmd
&=
~
(
0xff
<<
8
);
mnicmd
&=
~
(
0xff
<<
8
);
...
@@ -268,7 +267,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -268,7 +267,7 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
mcmd
|=
master
[
cdev
].
rq
<<
24
;
mcmd
|=
master
[
cdev
].
rq
<<
24
;
pci_write_config_dword
(
dev
,
cur
->
capndx
+
AGPCMD
,
mcmd
);
pci_write_config_dword
(
dev
,
cur
->
capndx
+
AGPCMD
,
mcmd
);
pci_write_config_word
(
dev
,
cur
->
capndx
+
0x20
,
mnicmd
);
pci_write_config_word
(
dev
,
cur
->
capndx
+
AGPNICMD
,
mnicmd
);
}
}
free_and_exit:
free_and_exit:
...
@@ -285,24 +284,24 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -285,24 +284,24 @@ static int agp_3_0_isochronous_node_enable(struct agp_bridge_data *bridge,
* target by ndevs. Distribute this many slots to each AGP 3.0 device,
* target by ndevs. Distribute this many slots to each AGP 3.0 device,
* giving any left over slots to the last device in dev_list.
* giving any left over slots to the last device in dev_list.
*/
*/
static
void
agp_3_
0
_nonisochronous_node_enable
(
struct
agp_bridge_data
*
bridge
,
static
void
agp_3_
5
_nonisochronous_node_enable
(
struct
agp_bridge_data
*
bridge
,
struct
agp_3_
0
_dev
*
dev_list
,
unsigned
int
ndevs
)
struct
agp_3_
5
_dev
*
dev_list
,
unsigned
int
ndevs
)
{
{
struct
agp_3_
0
_dev
*
cur
;
struct
agp_3_
5
_dev
*
cur
;
struct
list_head
*
head
=
&
dev_list
->
list
,
*
pos
;
struct
list_head
*
head
=
&
dev_list
->
list
,
*
pos
;
u32
tstatus
,
mcmd
;
u32
tstatus
,
mcmd
;
u32
trq
,
mrq
,
rem
;
u32
trq
,
mrq
,
rem
;
unsigned
int
cdev
=
0
;
unsigned
int
cdev
=
0
;
pci_read_config_dword
(
bridge
->
dev
,
bridge
->
capndx
+
0x04
,
&
tstatus
);
pci_read_config_dword
(
bridge
->
dev
,
bridge
->
capndx
+
AGPSTAT
,
&
tstatus
);
trq
=
(
tstatus
>>
24
)
&
0xff
;
trq
=
(
tstatus
>>
24
)
&
0xff
;
mrq
=
trq
/
ndevs
;
mrq
=
trq
/
ndevs
;
rem
=
mrq
+
(
trq
%
ndevs
);
rem
=
mrq
+
(
trq
%
ndevs
);
for
(
pos
=
head
->
next
;
cdev
<
ndevs
;
cdev
++
,
pos
=
pos
->
next
)
{
for
(
pos
=
head
->
next
;
cdev
<
ndevs
;
cdev
++
,
pos
=
pos
->
next
)
{
cur
=
list_entry
(
pos
,
struct
agp_3_
0
_dev
,
list
);
cur
=
list_entry
(
pos
,
struct
agp_3_
5
_dev
,
list
);
pci_read_config_dword
(
cur
->
dev
,
cur
->
capndx
+
AGPCMD
,
&
mcmd
);
pci_read_config_dword
(
cur
->
dev
,
cur
->
capndx
+
AGPCMD
,
&
mcmd
);
mcmd
&=
~
(
0xff
<<
24
);
mcmd
&=
~
(
0xff
<<
24
);
...
@@ -315,24 +314,32 @@ static void agp_3_0_nonisochronous_node_enable(struct agp_bridge_data *bridge,
...
@@ -315,24 +314,32 @@ static void agp_3_0_nonisochronous_node_enable(struct agp_bridge_data *bridge,
* Fully configure and enable an AGP 3.0 host bridge and all the devices
* Fully configure and enable an AGP 3.0 host bridge and all the devices
* lying behind it.
* lying behind it.
*/
*/
int
agp_3_
0_node_enable
(
struct
agp_bridge_data
*
bridge
,
u32
mode
,
u32
minor
)
int
agp_3_
5_enable
(
struct
agp_bridge_data
*
bridge
,
u32
mode
)
{
{
struct
pci_dev
*
td
=
bridge
->
dev
,
*
dev
;
struct
pci_dev
*
td
=
bridge
->
dev
,
*
dev
;
u8
mcapndx
;
u8
mcapndx
;
u32
isoch
,
arqsz
,
cal_cycle
,
tmp
,
rate
;
u32
isoch
,
arqsz
;
u32
tstatus
,
tcmd
,
mcmd
,
mstatus
,
ncapid
;
u32
tstatus
,
mstatus
,
ncapid
;
u32
mmajor
,
mminor
;
u32
mmajor
;
u16
mpstat
;
u16
mpstat
;
struct
agp_3_
0
_dev
*
dev_list
,
*
cur
;
struct
agp_3_
5
_dev
*
dev_list
,
*
cur
;
struct
list_head
*
head
,
*
pos
;
struct
list_head
*
head
,
*
pos
;
unsigned
int
ndevs
=
0
;
unsigned
int
ndevs
=
0
;
int
ret
=
0
;
int
ret
=
0
;
/* Extract some power-on defaults from the target */
pci_read_config_dword
(
td
,
bridge
->
capndx
+
AGPSTAT
,
&
tstatus
);
isoch
=
(
tstatus
>>
17
)
&
0x1
;
if
(
isoch
==
0
)
/* isoch xfers not available, bail out. */
return
-
ENODEV
;
arqsz
=
(
tstatus
>>
13
)
&
0x7
;
/*
/*
* Allocate a head for our AGP 3.
0 device list (multiple AGP 3.0
* Allocate a head for our AGP 3.
5 device list
* devices are allowed behind a single bridge).
*
(multiple AGP v3
devices are allowed behind a single bridge).
*/
*/
if
((
dev_list
=
kmalloc
(
sizeof
(
*
dev_list
),
GFP_KERNEL
))
==
NULL
)
{
if
((
dev_list
=
kmalloc
(
sizeof
(
*
dev_list
),
GFP_KERNEL
))
==
NULL
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
get_out
;
goto
get_out
;
}
}
...
@@ -342,6 +349,9 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
...
@@ -342,6 +349,9 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
/* Find all AGP devices, and add them to dev_list. */
/* Find all AGP devices, and add them to dev_list. */
pci_for_each_dev
(
dev
)
{
pci_for_each_dev
(
dev
)
{
mcapndx
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
mcapndx
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
mcapndx
==
0
)
continue
;
switch
((
dev
->
class
>>
8
)
&
0xff00
)
{
switch
((
dev
->
class
>>
8
)
&
0xff00
)
{
case
0x0600
:
/* Bridge */
case
0x0600
:
/* Bridge */
/* Skip bridges. We should call this function for each one. */
/* Skip bridges. We should call this function for each one. */
...
@@ -357,9 +367,6 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
...
@@ -357,9 +367,6 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
case
0x0300
:
/* Display controller */
case
0x0300
:
/* Display controller */
case
0x0400
:
/* Multimedia controller */
case
0x0400
:
/* Multimedia controller */
if
(
mcapndx
==
0
)
continue
;
if
((
cur
=
kmalloc
(
sizeof
(
*
cur
),
GFP_KERNEL
))
==
NULL
)
{
if
((
cur
=
kmalloc
(
sizeof
(
*
cur
),
GFP_KERNEL
))
==
NULL
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
free_and_exit
;
goto
free_and_exit
;
...
@@ -376,51 +383,41 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
...
@@ -376,51 +383,41 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
}
}
}
}
/* Extract some power-on defaults from the target */
pci_read_config_dword
(
td
,
bridge
->
capndx
+
0x04
,
&
tstatus
);
isoch
=
(
tstatus
>>
17
)
&
0x1
;
arqsz
=
(
tstatus
>>
13
)
&
0x7
;
cal_cycle
=
(
tstatus
>>
10
)
&
0x7
;
rate
=
tstatus
&
0x7
;
/*
/*
* Take an initial pass through the devices lying behind our host
* Take an initial pass through the devices lying behind our host
* bridge. Make sure each one is actually an AGP 3.0 device, otherwise
* bridge. Make sure each one is actually an AGP 3.0 device, otherwise
* exit with an error message. Along the way store the AGP 3.0
* exit with an error message. Along the way store the AGP 3.0
* cap_ptr for each device, the minimum supported cal_cycle, and the
* cap_ptr for each device
* minimum supported data rate.
*/
*/
list_for_each
(
pos
,
head
)
{
list_for_each
(
pos
,
head
)
{
cur
=
list_entry
(
pos
,
struct
agp_3_
0
_dev
,
list
);
cur
=
list_entry
(
pos
,
struct
agp_3_
5
_dev
,
list
);
dev
=
cur
->
dev
;
dev
=
cur
->
dev
;
pci_read_config_word
(
dev
,
PCI_STATUS
,
&
mpstat
);
pci_read_config_word
(
dev
,
PCI_STATUS
,
&
mpstat
);
if
((
mpstat
&
PCI_STATUS_CAP_LIST
)
==
0
)
if
((
mpstat
&
PCI_STATUS_CAP_LIST
)
==
0
)
continue
;
continue
;
pci_read_config_byte
(
dev
,
PCI_CAPABILITY_LIST
,
&
mcapndx
);
pci_read_config_byte
(
dev
,
PCI_CAPABILITY_LIST
,
&
mcapndx
);
if
(
mcapndx
!=
0
x00
)
{
if
(
mcapndx
!=
0
)
{
do
{
do
{
pci_read_config_dword
(
dev
,
mcapndx
,
&
ncapid
);
pci_read_config_dword
(
dev
,
mcapndx
,
&
ncapid
);
if
((
ncapid
&
0xff
)
!=
0x0
2
)
if
((
ncapid
&
0xff
)
!=
2
)
mcapndx
=
(
ncapid
>>
8
)
&
0xff
;
mcapndx
=
(
ncapid
>>
8
)
&
0xff
;
}
}
while
(((
ncapid
&
0xff
)
!=
0x02
)
&&
(
mcapndx
!=
0x0
0
));
while
(((
ncapid
&
0xff
)
!=
2
)
&&
(
mcapndx
!=
0
));
}
}
if
(
mcapndx
==
0
)
{
if
(
mcapndx
==
0
)
{
printk
(
KERN_ERR
PFX
"woah! Non-AGP device "
printk
(
KERN_ERR
PFX
"woah! Non-AGP device "
"found on the secondary bus of an AGP 3.
0
bridge!
\n
"
);
"found on the secondary bus of an AGP 3.
5
bridge!
\n
"
);
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
free_and_exit
;
goto
free_and_exit
;
}
}
mmajor
=
(
ncapid
>>
AGP_MAJOR_VERSION_SHIFT
)
&
0xf
;
mmajor
=
(
ncapid
>>
AGP_MAJOR_VERSION_SHIFT
)
&
0xf
;
mminor
=
(
ncapid
>>
AGP_MINOR_VERSION_SHIFT
)
&
0xf
;
if
(
mmajor
<
3
)
{
if
(
mmajor
<
3
)
{
printk
(
KERN_ERR
PFX
"woah! AGP 2.0 device "
printk
(
KERN_ERR
PFX
"woah! AGP 2.0 device "
"found on the secondary bus of an AGP 3.
0
"
"found on the secondary bus of an AGP 3.
5
"
"bridge operating with AGP 3.0 electricals!
\n
"
);
"bridge operating with AGP 3.0 electricals!
\n
"
);
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
free_and_exit
;
goto
free_and_exit
;
...
@@ -428,40 +425,16 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
...
@@ -428,40 +425,16 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
cur
->
capndx
=
mcapndx
;
cur
->
capndx
=
mcapndx
;
pci_read_config_dword
(
dev
,
cur
->
capndx
+
0x04
,
&
mstatus
);
pci_read_config_dword
(
dev
,
cur
->
capndx
+
AGPSTAT
,
&
mstatus
);
if
(((
mstatus
>>
3
)
&
0x1
)
==
0
)
{
if
(((
mstatus
>>
3
)
&
0x1
)
==
0
)
{
printk
(
KERN_ERR
PFX
"woah! AGP 3.
0
device "
printk
(
KERN_ERR
PFX
"woah! AGP 3.
x
device "
"not operating in AGP 3.
0
mode found on the "
"not operating in AGP 3.
x
mode found on the "
"secondary bus of an AGP 3.
0
bridge operating "
"secondary bus of an AGP 3.
5
bridge operating "
"with AGP 3.0 electricals!
\n
"
);
"with AGP 3.0 electricals!
\n
"
);
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
free_and_exit
;
goto
free_and_exit
;
}
}
tmp
=
(
mstatus
>>
10
)
&
0x7
;
cal_cycle
=
min
(
cal_cycle
,
tmp
);
/* figure the lesser rate */
tmp
=
mstatus
&
0x7
;
if
(
tmp
<
rate
)
rate
=
tmp
;
}
/* Turn rate into something we can actually write out to AGPCMD */
switch
(
rate
)
{
case
0x1
:
case
0x2
:
break
;
case
0x3
:
rate
=
0x2
;
break
;
default:
printk
(
KERN_ERR
PFX
"woah! Bogus AGP rate (%d) "
"value found advertised behind an AGP 3.0 bridge!
\n
"
,
rate
);
ret
=
-
ENODEV
;
goto
free_and_exit
;
}
}
/*
/*
...
@@ -470,59 +443,19 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
...
@@ -470,59 +443,19 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
* whether isochronous transfers are supported.
* whether isochronous transfers are supported.
*/
*/
if
(
isoch
)
{
if
(
isoch
)
{
ret
=
agp_3_
0
_isochronous_node_enable
(
bridge
,
dev_list
,
ndevs
);
ret
=
agp_3_
5
_isochronous_node_enable
(
bridge
,
dev_list
,
ndevs
);
if
(
ret
)
{
if
(
ret
)
{
printk
(
KERN_INFO
PFX
"Something bad happened setting "
printk
(
KERN_INFO
PFX
"Something bad happened setting "
"up isochronous xfers. Falling back to "
"up isochronous xfers. Falling back to "
"non-isochronous xfer mode.
\n
"
);
"non-isochronous xfer mode.
\n
"
);
}
}
}
}
agp_3_0_nonisochronous_node_enable
(
bridge
,
dev_list
,
ndevs
);
agp_3_5_nonisochronous_node_enable
(
bridge
,
dev_list
,
ndevs
);
/*
* Set the calculated minimum supported cal_cycle and minimum
* supported transfer rate in the target's AGPCMD register.
* Also set the AGP_ENABLE bit, effectively 'turning on' the
* target (this has to be done _before_ turning on the masters).
*/
pci_read_config_dword
(
td
,
bridge
->
capndx
+
AGPCMD
,
&
tcmd
);
tcmd
&=
~
(
0x7
<<
10
);
tcmd
&=
~
0x7
;
tcmd
|=
cal_cycle
<<
10
;
tcmd
|=
0x1
<<
8
;
tcmd
|=
rate
;
pci_write_config_dword
(
td
,
bridge
->
capndx
+
AGPCMD
,
tcmd
);
/*
* Set the target's advertised arqsz value, the minimum supported
* transfer rate, and the AGP_ENABLE bit in each master's AGPCMD
* register.
*/
list_for_each
(
pos
,
head
)
{
cur
=
list_entry
(
pos
,
struct
agp_3_0_dev
,
list
);
dev
=
cur
->
dev
;
mcapndx
=
cur
->
capndx
;
pci_read_config_dword
(
dev
,
cur
->
capndx
+
AGPCMD
,
&
mcmd
);
mcmd
&=
~
(
0x7
<<
AGPSTAT_ARQSZ_SHIFT
);
mcmd
&=
~
0x7
;
mcmd
|=
arqsz
<<
13
;
mcmd
|=
AGPSTAT_AGP_ENABLE
;
mcmd
|=
rate
;
pci_write_config_dword
(
dev
,
cur
->
capndx
+
AGPCMD
,
mcmd
);
}
free_and_exit:
free_and_exit:
/* Be sure to free the dev_list */
/* Be sure to free the dev_list */
for
(
pos
=
head
->
next
;
pos
!=
head
;
)
{
for
(
pos
=
head
->
next
;
pos
!=
head
;
)
{
cur
=
list_entry
(
pos
,
struct
agp_3_
0
_dev
,
list
);
cur
=
list_entry
(
pos
,
struct
agp_3_
5
_dev
,
list
);
pos
=
pos
->
next
;
pos
=
pos
->
next
;
kfree
(
cur
);
kfree
(
cur
);
...
@@ -533,5 +466,3 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
...
@@ -533,5 +466,3 @@ int agp_3_0_node_enable(struct agp_bridge_data *bridge, u32 mode, u32 minor)
return
ret
;
return
ret
;
}
}
EXPORT_SYMBOL_GPL
(
agp_3_0_node_enable
);
drivers/char/drm/Kconfig
View file @
903d1fe4
...
@@ -49,7 +49,7 @@ config DRM_RADEON
...
@@ -49,7 +49,7 @@ config DRM_RADEON
config DRM_I810
config DRM_I810
tristate "Intel I810"
tristate "Intel I810"
depends on DRM && AGP
depends on DRM && AGP
&& AGP_INTEL
help
help
Choose this option if you have an Intel I810 graphics card. If M is
Choose this option if you have an Intel I810 graphics card. If M is
selected, the module will be called i810. AGP support is required
selected, the module will be called i810. AGP support is required
...
@@ -57,7 +57,7 @@ config DRM_I810
...
@@ -57,7 +57,7 @@ config DRM_I810
config DRM_I830
config DRM_I830
tristate "Intel 830M, 845G, 852GM, 855GM, 865G"
tristate "Intel 830M, 845G, 852GM, 855GM, 865G"
depends on DRM && AGP
depends on DRM && AGP
&& AGP_INTEL
help
help
Choose this option if you have a system that has Intel 830M, 845G,
Choose this option if you have a system that has Intel 830M, 845G,
852GM, 855GM or 865G integrated graphics. If M is selected, the
852GM, 855GM or 865G integrated graphics. If M is selected, the
...
...
include/sound/seq_kernel.h
View file @
903d1fe4
...
@@ -158,7 +158,7 @@ extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_
...
@@ -158,7 +158,7 @@ extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_
extern
int
snd_seq_delete_kernel_client
(
int
client
);
extern
int
snd_seq_delete_kernel_client
(
int
client
);
extern
int
snd_seq_kernel_client_enqueue
(
int
client
,
snd_seq_event_t
*
ev
,
int
atomic
,
int
hop
);
extern
int
snd_seq_kernel_client_enqueue
(
int
client
,
snd_seq_event_t
*
ev
,
int
atomic
,
int
hop
);
extern
int
snd_seq_kernel_client_dispatch
(
int
client
,
snd_seq_event_t
*
ev
,
int
atomic
,
int
hop
);
extern
int
snd_seq_kernel_client_dispatch
(
int
client
,
snd_seq_event_t
*
ev
,
int
atomic
,
int
hop
);
extern
int
snd_seq_kernel_client_ctl
(
int
client
,
unsigned
int
cmd
,
void
*
arg
);
extern
int
snd_seq_kernel_client_ctl
(
int
client
,
unsigned
int
cmd
,
void
__user
*
arg
);
#define SNDRV_SEQ_EXT_MASK 0xc0000000
#define SNDRV_SEQ_EXT_MASK 0xc0000000
#define SNDRV_SEQ_EXT_USRPTR 0x80000000
#define SNDRV_SEQ_EXT_USRPTR 0x80000000
...
...
sound/core/seq/oss/seq_oss_device.h
View file @
903d1fe4
...
@@ -135,8 +135,8 @@ int snd_seq_oss_delete_client(void);
...
@@ -135,8 +135,8 @@ int snd_seq_oss_delete_client(void);
int
snd_seq_oss_open
(
struct
file
*
file
,
int
level
);
int
snd_seq_oss_open
(
struct
file
*
file
,
int
level
);
void
snd_seq_oss_release
(
seq_oss_devinfo_t
*
dp
);
void
snd_seq_oss_release
(
seq_oss_devinfo_t
*
dp
);
int
snd_seq_oss_ioctl
(
seq_oss_devinfo_t
*
dp
,
unsigned
int
cmd
,
unsigned
long
arg
);
int
snd_seq_oss_ioctl
(
seq_oss_devinfo_t
*
dp
,
unsigned
int
cmd
,
unsigned
long
arg
);
int
snd_seq_oss_read
(
seq_oss_devinfo_t
*
dev
,
char
*
buf
,
int
count
);
int
snd_seq_oss_read
(
seq_oss_devinfo_t
*
dev
,
char
__user
*
buf
,
int
count
);
int
snd_seq_oss_write
(
seq_oss_devinfo_t
*
dp
,
const
char
*
buf
,
int
count
,
struct
file
*
opt
);
int
snd_seq_oss_write
(
seq_oss_devinfo_t
*
dp
,
const
char
__user
*
buf
,
int
count
,
struct
file
*
opt
);
unsigned
int
snd_seq_oss_poll
(
seq_oss_devinfo_t
*
dp
,
struct
file
*
file
,
poll_table
*
wait
);
unsigned
int
snd_seq_oss_poll
(
seq_oss_devinfo_t
*
dp
,
struct
file
*
file
,
poll_table
*
wait
);
void
snd_seq_oss_reset
(
seq_oss_devinfo_t
*
dp
);
void
snd_seq_oss_reset
(
seq_oss_devinfo_t
*
dp
);
...
...
sound/core/seq/oss/seq_oss_ioctl.c
View file @
903d1fe4
...
@@ -35,7 +35,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg)
...
@@ -35,7 +35,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg)
struct
synth_info
inf
;
struct
synth_info
inf
;
struct
midi_info
minf
;
struct
midi_info
minf
;
unsigned
char
ev
[
8
];
unsigned
char
ev
[
8
];
void
*
arg
=
(
void
*
)
carg
;
void
__user
*
arg
=
(
void
__user
*
)
carg
;
snd_seq_event_t
tmpev
;
snd_seq_event_t
tmpev
;
switch
(
cmd
)
{
switch
(
cmd
)
{
...
...
sound/core/seq/oss/seq_oss_rw.c
View file @
903d1fe4
...
@@ -41,7 +41,7 @@ static int insert_queue(seq_oss_devinfo_t *dp, evrec_t *rec, struct file *opt);
...
@@ -41,7 +41,7 @@ static int insert_queue(seq_oss_devinfo_t *dp, evrec_t *rec, struct file *opt);
*/
*/
int
int
snd_seq_oss_read
(
seq_oss_devinfo_t
*
dp
,
char
*
buf
,
int
count
)
snd_seq_oss_read
(
seq_oss_devinfo_t
*
dp
,
char
__user
*
buf
,
int
count
)
{
{
seq_oss_readq_t
*
readq
=
dp
->
readq
;
seq_oss_readq_t
*
readq
=
dp
->
readq
;
int
cnt
,
pos
;
int
cnt
,
pos
;
...
@@ -81,7 +81,7 @@ snd_seq_oss_read(seq_oss_devinfo_t *dp, char *buf, int count)
...
@@ -81,7 +81,7 @@ snd_seq_oss_read(seq_oss_devinfo_t *dp, char *buf, int count)
*/
*/
int
int
snd_seq_oss_write
(
seq_oss_devinfo_t
*
dp
,
const
char
*
buf
,
int
count
,
struct
file
*
opt
)
snd_seq_oss_write
(
seq_oss_devinfo_t
*
dp
,
const
char
__user
*
buf
,
int
count
,
struct
file
*
opt
)
{
{
int
rc
,
c
,
p
,
ev_size
;
int
rc
,
c
,
p
,
ev_size
;
evrec_t
rec
;
evrec_t
rec
;
...
...
sound/core/seq/oss/seq_oss_synth.c
View file @
903d1fe4
...
@@ -450,7 +450,7 @@ snd_seq_oss_synth_reset(seq_oss_devinfo_t *dp, int dev)
...
@@ -450,7 +450,7 @@ snd_seq_oss_synth_reset(seq_oss_devinfo_t *dp, int dev)
*/
*/
int
int
snd_seq_oss_synth_load_patch
(
seq_oss_devinfo_t
*
dp
,
int
dev
,
int
fmt
,
snd_seq_oss_synth_load_patch
(
seq_oss_devinfo_t
*
dp
,
int
dev
,
int
fmt
,
const
char
*
buf
,
int
p
,
int
c
)
const
char
__user
*
buf
,
int
p
,
int
c
)
{
{
seq_oss_synth_t
*
rec
;
seq_oss_synth_t
*
rec
;
int
rc
;
int
rc
;
...
...
sound/core/seq/oss/seq_oss_timer.c
View file @
903d1fe4
...
@@ -227,19 +227,19 @@ snd_seq_oss_timer_tempo(seq_oss_timer_t *timer, int value)
...
@@ -227,19 +227,19 @@ snd_seq_oss_timer_tempo(seq_oss_timer_t *timer, int value)
* ioctls
* ioctls
*/
*/
int
int
snd_seq_oss_timer_ioctl
(
seq_oss_timer_t
*
timer
,
unsigned
int
cmd
,
void
*
arg
)
snd_seq_oss_timer_ioctl
(
seq_oss_timer_t
*
timer
,
unsigned
int
cmd
,
int
__user
*
arg
)
{
{
int
value
;
int
value
;
if
(
cmd
==
SNDCTL_SEQ_CTRLRATE
)
{
if
(
cmd
==
SNDCTL_SEQ_CTRLRATE
)
{
debug_printk
((
"ctrl rate
\n
"
));
debug_printk
((
"ctrl rate
\n
"
));
/* if *arg == 0, just return the current rate */
/* if *arg == 0, just return the current rate */
if
(
get_user
(
value
,
(
int
*
)
arg
))
if
(
get_user
(
value
,
arg
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
value
)
if
(
value
)
return
-
EINVAL
;
return
-
EINVAL
;
value
=
((
timer
->
oss_tempo
*
timer
->
oss_timebase
)
+
30
)
/
60
;
value
=
((
timer
->
oss_tempo
*
timer
->
oss_timebase
)
+
30
)
/
60
;
return
put_user
(
value
,
(
int
*
)
arg
)
?
-
EFAULT
:
0
;
return
put_user
(
value
,
arg
)
?
-
EFAULT
:
0
;
}
}
if
(
timer
->
dp
->
seq_mode
==
SNDRV_SEQ_OSS_MODE_SYNTH
)
if
(
timer
->
dp
->
seq_mode
==
SNDRV_SEQ_OSS_MODE_SYNTH
)
...
@@ -257,12 +257,12 @@ snd_seq_oss_timer_ioctl(seq_oss_timer_t *timer, unsigned int cmd, void *arg)
...
@@ -257,12 +257,12 @@ snd_seq_oss_timer_ioctl(seq_oss_timer_t *timer, unsigned int cmd, void *arg)
return
snd_seq_oss_timer_continue
(
timer
);
return
snd_seq_oss_timer_continue
(
timer
);
case
SNDCTL_TMR_TEMPO
:
case
SNDCTL_TMR_TEMPO
:
debug_printk
((
"timer tempo
\n
"
));
debug_printk
((
"timer tempo
\n
"
));
if
(
get_user
(
value
,
(
int
*
)
arg
))
if
(
get_user
(
value
,
arg
))
return
-
EFAULT
;
return
-
EFAULT
;
return
snd_seq_oss_timer_tempo
(
timer
,
value
);
return
snd_seq_oss_timer_tempo
(
timer
,
value
);
case
SNDCTL_TMR_TIMEBASE
:
case
SNDCTL_TMR_TIMEBASE
:
debug_printk
((
"timer timebase
\n
"
));
debug_printk
((
"timer timebase
\n
"
));
if
(
get_user
(
value
,
(
int
*
)
arg
))
if
(
get_user
(
value
,
arg
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
value
<
MIN_OSS_TIMEBASE
)
if
(
value
<
MIN_OSS_TIMEBASE
)
value
=
MIN_OSS_TIMEBASE
;
value
=
MIN_OSS_TIMEBASE
;
...
...
sound/core/seq/oss/seq_oss_timer.h
View file @
903d1fe4
...
@@ -46,7 +46,7 @@ int snd_seq_oss_timer_continue(seq_oss_timer_t *timer);
...
@@ -46,7 +46,7 @@ int snd_seq_oss_timer_continue(seq_oss_timer_t *timer);
int
snd_seq_oss_timer_tempo
(
seq_oss_timer_t
*
timer
,
int
value
);
int
snd_seq_oss_timer_tempo
(
seq_oss_timer_t
*
timer
,
int
value
);
#define snd_seq_oss_timer_reset snd_seq_oss_timer_start
#define snd_seq_oss_timer_reset snd_seq_oss_timer_start
int
snd_seq_oss_timer_ioctl
(
seq_oss_timer_t
*
timer
,
unsigned
int
cmd
,
void
*
arg
);
int
snd_seq_oss_timer_ioctl
(
seq_oss_timer_t
*
timer
,
unsigned
int
cmd
,
int
__user
*
arg
);
/*
/*
* get current processed time
* get current processed time
...
...
sound/core/seq/seq_clientmgr.c
View file @
903d1fe4
...
@@ -365,7 +365,7 @@ static int snd_seq_release(struct inode *inode, struct file *file)
...
@@ -365,7 +365,7 @@ static int snd_seq_release(struct inode *inode, struct file *file)
* -EINVAL no enough user-space buffer to write the whole event
* -EINVAL no enough user-space buffer to write the whole event
* -EFAULT seg. fault during copy to user space
* -EFAULT seg. fault during copy to user space
*/
*/
static
ssize_t
snd_seq_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
offset
)
static
ssize_t
snd_seq_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
offset
)
{
{
client_t
*
client
=
(
client_t
*
)
file
->
private_data
;
client_t
*
client
=
(
client_t
*
)
file
->
private_data
;
fifo_t
*
fifo
;
fifo_t
*
fifo
;
...
@@ -959,7 +959,7 @@ static int check_event_type_and_length(snd_seq_event_t *ev)
...
@@ -959,7 +959,7 @@ static int check_event_type_and_length(snd_seq_event_t *ev)
* -EMLINK too many hops
* -EMLINK too many hops
* others depends on return value from driver callback
* others depends on return value from driver callback
*/
*/
static
ssize_t
snd_seq_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
offset
)
static
ssize_t
snd_seq_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
offset
)
{
{
client_t
*
client
=
(
client_t
*
)
file
->
private_data
;
client_t
*
client
=
(
client_t
*
)
file
->
private_data
;
int
written
=
0
,
len
;
int
written
=
0
,
len
;
...
@@ -1077,7 +1077,7 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
...
@@ -1077,7 +1077,7 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
/* SYSTEM_INFO ioctl() */
/* SYSTEM_INFO ioctl() */
static
int
snd_seq_ioctl_system_info
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_system_info
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_system_info_t
info
;
snd_seq_system_info_t
info
;
...
@@ -1090,20 +1090,20 @@ static int snd_seq_ioctl_system_info(client_t *client, unsigned long arg)
...
@@ -1090,20 +1090,20 @@ static int snd_seq_ioctl_system_info(client_t *client, unsigned long arg)
info
.
cur_clients
=
client_usage
.
cur
;
info
.
cur_clients
=
client_usage
.
cur
;
info
.
cur_queues
=
snd_seq_queue_get_cur_queues
();
info
.
cur_queues
=
snd_seq_queue_get_cur_queues
();
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* RUNNING_MODE ioctl() */
/* RUNNING_MODE ioctl() */
static
int
snd_seq_ioctl_running_mode
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_running_mode
(
client_t
*
client
,
void
__user
*
arg
)
{
{
struct
sndrv_seq_running_info
info
;
struct
sndrv_seq_running_info
info
;
client_t
*
cptr
;
client_t
*
cptr
;
int
err
=
0
;
int
err
=
0
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* requested client number */
/* requested client number */
...
@@ -1148,12 +1148,12 @@ static void get_client_info(client_t *cptr, snd_seq_client_info_t *info)
...
@@ -1148,12 +1148,12 @@ static void get_client_info(client_t *cptr, snd_seq_client_info_t *info)
memset
(
info
->
reserved
,
0
,
sizeof
(
info
->
reserved
));
memset
(
info
->
reserved
,
0
,
sizeof
(
info
->
reserved
));
}
}
static
int
snd_seq_ioctl_get_client_info
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_client_info
(
client_t
*
client
,
void
__user
*
arg
)
{
{
client_t
*
cptr
;
client_t
*
cptr
;
snd_seq_client_info_t
client_info
;
snd_seq_client_info_t
client_info
;
if
(
copy_from_user
(
&
client_info
,
(
void
*
)
arg
,
sizeof
(
client_info
)))
if
(
copy_from_user
(
&
client_info
,
arg
,
sizeof
(
client_info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* requested client number */
/* requested client number */
...
@@ -1164,18 +1164,18 @@ static int snd_seq_ioctl_get_client_info(client_t * client, unsigned long arg)
...
@@ -1164,18 +1164,18 @@ static int snd_seq_ioctl_get_client_info(client_t * client, unsigned long arg)
get_client_info
(
cptr
,
&
client_info
);
get_client_info
(
cptr
,
&
client_info
);
snd_seq_client_unlock
(
cptr
);
snd_seq_client_unlock
(
cptr
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
client_info
,
sizeof
(
client_info
)))
if
(
copy_to_user
(
arg
,
&
client_info
,
sizeof
(
client_info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* CLIENT_INFO ioctl() */
/* CLIENT_INFO ioctl() */
static
int
snd_seq_ioctl_set_client_info
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_set_client_info
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_client_info_t
client_info
;
snd_seq_client_info_t
client_info
;
if
(
copy_from_user
(
&
client_info
,
(
void
*
)
arg
,
sizeof
(
client_info
)))
if
(
copy_from_user
(
&
client_info
,
arg
,
sizeof
(
client_info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* it is not allowed to set the info fields for an another client */
/* it is not allowed to set the info fields for an another client */
...
@@ -1201,13 +1201,13 @@ static int snd_seq_ioctl_set_client_info(client_t * client, unsigned long arg)
...
@@ -1201,13 +1201,13 @@ static int snd_seq_ioctl_set_client_info(client_t * client, unsigned long arg)
/*
/*
* CREATE PORT ioctl()
* CREATE PORT ioctl()
*/
*/
static
int
snd_seq_ioctl_create_port
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_create_port
(
client_t
*
client
,
void
__user
*
arg
)
{
{
client_port_t
*
port
;
client_port_t
*
port
;
snd_seq_port_info_t
info
;
snd_seq_port_info_t
info
;
snd_seq_port_callback_t
*
callback
;
snd_seq_port_callback_t
*
callback
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* it is not allowed to create the port for an another client */
/* it is not allowed to create the port for an another client */
...
@@ -1242,7 +1242,7 @@ static int snd_seq_ioctl_create_port(client_t * client, unsigned long arg)
...
@@ -1242,7 +1242,7 @@ static int snd_seq_ioctl_create_port(client_t * client, unsigned long arg)
snd_seq_set_port_info
(
port
,
&
info
);
snd_seq_set_port_info
(
port
,
&
info
);
snd_seq_system_client_ev_port_start
(
port
->
addr
.
client
,
port
->
addr
.
port
);
snd_seq_system_client_ev_port_start
(
port
->
addr
.
client
,
port
->
addr
.
port
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -1251,13 +1251,13 @@ static int snd_seq_ioctl_create_port(client_t * client, unsigned long arg)
...
@@ -1251,13 +1251,13 @@ static int snd_seq_ioctl_create_port(client_t * client, unsigned long arg)
/*
/*
* DELETE PORT ioctl()
* DELETE PORT ioctl()
*/
*/
static
int
snd_seq_ioctl_delete_port
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_delete_port
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_port_info_t
info
;
snd_seq_port_info_t
info
;
int
err
;
int
err
;
/* set passed parameters */
/* set passed parameters */
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* it is not allowed to remove the port for an another client */
/* it is not allowed to remove the port for an another client */
...
@@ -1274,13 +1274,13 @@ static int snd_seq_ioctl_delete_port(client_t * client, unsigned long arg)
...
@@ -1274,13 +1274,13 @@ static int snd_seq_ioctl_delete_port(client_t * client, unsigned long arg)
/*
/*
* GET_PORT_INFO ioctl() (on any client)
* GET_PORT_INFO ioctl() (on any client)
*/
*/
static
int
snd_seq_ioctl_get_port_info
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_port_info
(
client_t
*
client
,
void
__user
*
arg
)
{
{
client_t
*
cptr
;
client_t
*
cptr
;
client_port_t
*
port
;
client_port_t
*
port
;
snd_seq_port_info_t
info
;
snd_seq_port_info_t
info
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
cptr
=
snd_seq_client_use_ptr
(
info
.
addr
.
client
);
cptr
=
snd_seq_client_use_ptr
(
info
.
addr
.
client
);
if
(
cptr
==
NULL
)
if
(
cptr
==
NULL
)
...
@@ -1297,7 +1297,7 @@ static int snd_seq_ioctl_get_port_info(client_t *client, unsigned long arg)
...
@@ -1297,7 +1297,7 @@ static int snd_seq_ioctl_get_port_info(client_t *client, unsigned long arg)
snd_seq_port_unlock
(
port
);
snd_seq_port_unlock
(
port
);
snd_seq_client_unlock
(
cptr
);
snd_seq_client_unlock
(
cptr
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -1306,12 +1306,12 @@ static int snd_seq_ioctl_get_port_info(client_t *client, unsigned long arg)
...
@@ -1306,12 +1306,12 @@ static int snd_seq_ioctl_get_port_info(client_t *client, unsigned long arg)
/*
/*
* SET_PORT_INFO ioctl() (only ports on this/own client)
* SET_PORT_INFO ioctl() (only ports on this/own client)
*/
*/
static
int
snd_seq_ioctl_set_port_info
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_set_port_info
(
client_t
*
client
,
void
__user
*
arg
)
{
{
client_port_t
*
port
;
client_port_t
*
port
;
snd_seq_port_info_t
info
;
snd_seq_port_info_t
info
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
info
.
addr
.
client
!=
client
->
number
)
/* only set our own ports ! */
if
(
info
.
addr
.
client
!=
client
->
number
)
/* only set our own ports ! */
...
@@ -1381,14 +1381,14 @@ int snd_seq_client_notify_subscription(int client, int port,
...
@@ -1381,14 +1381,14 @@ int snd_seq_client_notify_subscription(int client, int port,
/*
/*
* add to port's subscription list IOCTL interface
* add to port's subscription list IOCTL interface
*/
*/
static
int
snd_seq_ioctl_subscribe_port
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_subscribe_port
(
client_t
*
client
,
void
__user
*
arg
)
{
{
int
result
=
-
EINVAL
;
int
result
=
-
EINVAL
;
client_t
*
receiver
=
NULL
,
*
sender
=
NULL
;
client_t
*
receiver
=
NULL
,
*
sender
=
NULL
;
client_port_t
*
sport
=
NULL
,
*
dport
=
NULL
;
client_port_t
*
sport
=
NULL
,
*
dport
=
NULL
;
snd_seq_port_subscribe_t
subs
;
snd_seq_port_subscribe_t
subs
;
if
(
copy_from_user
(
&
subs
,
(
void
*
)
arg
,
sizeof
(
subs
)))
if
(
copy_from_user
(
&
subs
,
arg
,
sizeof
(
subs
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
((
receiver
=
snd_seq_client_use_ptr
(
subs
.
dest
.
client
))
==
NULL
)
if
((
receiver
=
snd_seq_client_use_ptr
(
subs
.
dest
.
client
))
==
NULL
)
...
@@ -1425,14 +1425,14 @@ static int snd_seq_ioctl_subscribe_port(client_t * client, unsigned long arg)
...
@@ -1425,14 +1425,14 @@ static int snd_seq_ioctl_subscribe_port(client_t * client, unsigned long arg)
/*
/*
* remove from port's subscription list
* remove from port's subscription list
*/
*/
static
int
snd_seq_ioctl_unsubscribe_port
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_unsubscribe_port
(
client_t
*
client
,
void
__user
*
arg
)
{
{
int
result
=
-
ENXIO
;
int
result
=
-
ENXIO
;
client_t
*
receiver
=
NULL
,
*
sender
=
NULL
;
client_t
*
receiver
=
NULL
,
*
sender
=
NULL
;
client_port_t
*
sport
=
NULL
,
*
dport
=
NULL
;
client_port_t
*
sport
=
NULL
,
*
dport
=
NULL
;
snd_seq_port_subscribe_t
subs
;
snd_seq_port_subscribe_t
subs
;
if
(
copy_from_user
(
&
subs
,
(
void
*
)
arg
,
sizeof
(
subs
)))
if
(
copy_from_user
(
&
subs
,
arg
,
sizeof
(
subs
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
((
receiver
=
snd_seq_client_use_ptr
(
subs
.
dest
.
client
))
==
NULL
)
if
((
receiver
=
snd_seq_client_use_ptr
(
subs
.
dest
.
client
))
==
NULL
)
...
@@ -1466,13 +1466,13 @@ static int snd_seq_ioctl_unsubscribe_port(client_t * client, unsigned long arg)
...
@@ -1466,13 +1466,13 @@ static int snd_seq_ioctl_unsubscribe_port(client_t * client, unsigned long arg)
/* CREATE_QUEUE ioctl() */
/* CREATE_QUEUE ioctl() */
static
int
snd_seq_ioctl_create_queue
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_create_queue
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_info_t
info
;
snd_seq_queue_info_t
info
;
int
result
;
int
result
;
queue_t
*
q
;
queue_t
*
q
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
result
=
snd_seq_queue_alloc
(
client
->
number
,
info
.
locked
,
info
.
flags
);
result
=
snd_seq_queue_alloc
(
client
->
number
,
info
.
locked
,
info
.
flags
);
...
@@ -1494,30 +1494,30 @@ static int snd_seq_ioctl_create_queue(client_t *client, unsigned long arg)
...
@@ -1494,30 +1494,30 @@ static int snd_seq_ioctl_create_queue(client_t *client, unsigned long arg)
q
->
name
[
sizeof
(
q
->
name
)
-
1
]
=
0
;
q
->
name
[
sizeof
(
q
->
name
)
-
1
]
=
0
;
queuefree
(
q
);
queuefree
(
q
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* DELETE_QUEUE ioctl() */
/* DELETE_QUEUE ioctl() */
static
int
snd_seq_ioctl_delete_queue
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_delete_queue
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_info_t
info
;
snd_seq_queue_info_t
info
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
snd_seq_queue_delete
(
client
->
number
,
info
.
queue
);
return
snd_seq_queue_delete
(
client
->
number
,
info
.
queue
);
}
}
/* GET_QUEUE_INFO ioctl() */
/* GET_QUEUE_INFO ioctl() */
static
int
snd_seq_ioctl_get_queue_info
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_queue_info
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_info_t
info
;
snd_seq_queue_info_t
info
;
queue_t
*
q
;
queue_t
*
q
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
q
=
queueptr
(
info
.
queue
);
q
=
queueptr
(
info
.
queue
);
...
@@ -1532,19 +1532,19 @@ static int snd_seq_ioctl_get_queue_info(client_t *client, unsigned long arg)
...
@@ -1532,19 +1532,19 @@ static int snd_seq_ioctl_get_queue_info(client_t *client, unsigned long arg)
info
.
name
[
sizeof
(
info
.
name
)
-
1
]
=
0
;
info
.
name
[
sizeof
(
info
.
name
)
-
1
]
=
0
;
queuefree
(
q
);
queuefree
(
q
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* SET_QUEUE_INFO ioctl() */
/* SET_QUEUE_INFO ioctl() */
static
int
snd_seq_ioctl_set_queue_info
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_set_queue_info
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_info_t
info
;
snd_seq_queue_info_t
info
;
queue_t
*
q
;
queue_t
*
q
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
info
.
owner
!=
client
->
number
)
if
(
info
.
owner
!=
client
->
number
)
...
@@ -1575,12 +1575,12 @@ static int snd_seq_ioctl_set_queue_info(client_t *client, unsigned long arg)
...
@@ -1575,12 +1575,12 @@ static int snd_seq_ioctl_set_queue_info(client_t *client, unsigned long arg)
}
}
/* GET_NAMED_QUEUE ioctl() */
/* GET_NAMED_QUEUE ioctl() */
static
int
snd_seq_ioctl_get_named_queue
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_named_queue
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_info_t
info
;
snd_seq_queue_info_t
info
;
queue_t
*
q
;
queue_t
*
q
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
q
=
snd_seq_queue_find_name
(
info
.
name
);
q
=
snd_seq_queue_find_name
(
info
.
name
);
...
@@ -1591,20 +1591,20 @@ static int snd_seq_ioctl_get_named_queue(client_t *client, unsigned long arg)
...
@@ -1591,20 +1591,20 @@ static int snd_seq_ioctl_get_named_queue(client_t *client, unsigned long arg)
info
.
locked
=
q
->
locked
;
info
.
locked
=
q
->
locked
;
queuefree
(
q
);
queuefree
(
q
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* GET_QUEUE_STATUS ioctl() */
/* GET_QUEUE_STATUS ioctl() */
static
int
snd_seq_ioctl_get_queue_status
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_queue_status
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_status_t
status
;
snd_seq_queue_status_t
status
;
queue_t
*
queue
;
queue_t
*
queue
;
seq_timer_t
*
tmr
;
seq_timer_t
*
tmr
;
if
(
copy_from_user
(
&
status
,
(
void
*
)
arg
,
sizeof
(
status
)))
if
(
copy_from_user
(
&
status
,
arg
,
sizeof
(
status
)))
return
-
EFAULT
;
return
-
EFAULT
;
queue
=
queueptr
(
status
.
queue
);
queue
=
queueptr
(
status
.
queue
);
...
@@ -1624,20 +1624,20 @@ static int snd_seq_ioctl_get_queue_status(client_t * client, unsigned long arg)
...
@@ -1624,20 +1624,20 @@ static int snd_seq_ioctl_get_queue_status(client_t * client, unsigned long arg)
status
.
flags
=
queue
->
flags
;
status
.
flags
=
queue
->
flags
;
queuefree
(
queue
);
queuefree
(
queue
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
status
,
sizeof
(
status
)))
if
(
copy_to_user
(
arg
,
&
status
,
sizeof
(
status
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* GET_QUEUE_TEMPO ioctl() */
/* GET_QUEUE_TEMPO ioctl() */
static
int
snd_seq_ioctl_get_queue_tempo
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_queue_tempo
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_tempo_t
tempo
;
snd_seq_queue_tempo_t
tempo
;
queue_t
*
queue
;
queue_t
*
queue
;
seq_timer_t
*
tmr
;
seq_timer_t
*
tmr
;
if
(
copy_from_user
(
&
tempo
,
(
void
*
)
arg
,
sizeof
(
tempo
)))
if
(
copy_from_user
(
&
tempo
,
arg
,
sizeof
(
tempo
)))
return
-
EFAULT
;
return
-
EFAULT
;
queue
=
queueptr
(
tempo
.
queue
);
queue
=
queueptr
(
tempo
.
queue
);
...
@@ -1654,19 +1654,19 @@ static int snd_seq_ioctl_get_queue_tempo(client_t * client, unsigned long arg)
...
@@ -1654,19 +1654,19 @@ static int snd_seq_ioctl_get_queue_tempo(client_t * client, unsigned long arg)
tempo
.
skew_base
=
tmr
->
skew_base
;
tempo
.
skew_base
=
tmr
->
skew_base
;
queuefree
(
queue
);
queuefree
(
queue
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
tempo
,
sizeof
(
tempo
)))
if
(
copy_to_user
(
arg
,
&
tempo
,
sizeof
(
tempo
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* SET_QUEUE_TEMPO ioctl() */
/* SET_QUEUE_TEMPO ioctl() */
static
int
snd_seq_ioctl_set_queue_tempo
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_set_queue_tempo
(
client_t
*
client
,
void
__user
*
arg
)
{
{
int
result
;
int
result
;
snd_seq_queue_tempo_t
tempo
;
snd_seq_queue_tempo_t
tempo
;
if
(
copy_from_user
(
&
tempo
,
(
void
*
)
arg
,
sizeof
(
tempo
)))
if
(
copy_from_user
(
&
tempo
,
arg
,
sizeof
(
tempo
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
snd_seq_queue_check_access
(
tempo
.
queue
,
client
->
number
))
{
if
(
snd_seq_queue_check_access
(
tempo
.
queue
,
client
->
number
))
{
...
@@ -1682,13 +1682,13 @@ static int snd_seq_ioctl_set_queue_tempo(client_t * client, unsigned long arg)
...
@@ -1682,13 +1682,13 @@ static int snd_seq_ioctl_set_queue_tempo(client_t * client, unsigned long arg)
/* GET_QUEUE_TIMER ioctl() */
/* GET_QUEUE_TIMER ioctl() */
static
int
snd_seq_ioctl_get_queue_timer
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_queue_timer
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_timer_t
timer
;
snd_seq_queue_timer_t
timer
;
queue_t
*
queue
;
queue_t
*
queue
;
seq_timer_t
*
tmr
;
seq_timer_t
*
tmr
;
if
(
copy_from_user
(
&
timer
,
(
void
*
)
arg
,
sizeof
(
timer
)))
if
(
copy_from_user
(
&
timer
,
arg
,
sizeof
(
timer
)))
return
-
EFAULT
;
return
-
EFAULT
;
queue
=
queueptr
(
timer
.
queue
);
queue
=
queueptr
(
timer
.
queue
);
...
@@ -1711,19 +1711,19 @@ static int snd_seq_ioctl_get_queue_timer(client_t * client, unsigned long arg)
...
@@ -1711,19 +1711,19 @@ static int snd_seq_ioctl_get_queue_timer(client_t * client, unsigned long arg)
up
(
&
queue
->
timer_mutex
);
up
(
&
queue
->
timer_mutex
);
queuefree
(
queue
);
queuefree
(
queue
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
timer
,
sizeof
(
timer
)))
if
(
copy_to_user
(
arg
,
&
timer
,
sizeof
(
timer
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* SET_QUEUE_TIMER ioctl() */
/* SET_QUEUE_TIMER ioctl() */
static
int
snd_seq_ioctl_set_queue_timer
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_set_queue_timer
(
client_t
*
client
,
void
__user
*
arg
)
{
{
int
result
=
0
;
int
result
=
0
;
snd_seq_queue_timer_t
timer
;
snd_seq_queue_timer_t
timer
;
if
(
copy_from_user
(
&
timer
,
(
void
*
)
arg
,
sizeof
(
timer
)))
if
(
copy_from_user
(
&
timer
,
arg
,
sizeof
(
timer
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
timer
.
type
!=
SNDRV_SEQ_TIMER_ALSA
)
if
(
timer
.
type
!=
SNDRV_SEQ_TIMER_ALSA
)
...
@@ -1759,12 +1759,12 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, unsigned long arg)
...
@@ -1759,12 +1759,12 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, unsigned long arg)
/* GET_QUEUE_CLIENT ioctl() */
/* GET_QUEUE_CLIENT ioctl() */
static
int
snd_seq_ioctl_get_queue_client
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_queue_client
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_queue_client_t
info
;
snd_seq_queue_client_t
info
;
int
used
;
int
used
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
used
=
snd_seq_queue_is_used
(
info
.
queue
,
client
->
number
);
used
=
snd_seq_queue_is_used
(
info
.
queue
,
client
->
number
);
...
@@ -1773,19 +1773,19 @@ static int snd_seq_ioctl_get_queue_client(client_t * client, unsigned long arg)
...
@@ -1773,19 +1773,19 @@ static int snd_seq_ioctl_get_queue_client(client_t * client, unsigned long arg)
info
.
used
=
used
;
info
.
used
=
used
;
info
.
client
=
client
->
number
;
info
.
client
=
client
->
number
;
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* SET_QUEUE_CLIENT ioctl() */
/* SET_QUEUE_CLIENT ioctl() */
static
int
snd_seq_ioctl_set_queue_client
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_set_queue_client
(
client_t
*
client
,
void
__user
*
arg
)
{
{
int
err
;
int
err
;
snd_seq_queue_client_t
info
;
snd_seq_queue_client_t
info
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
info
.
used
>=
0
)
{
if
(
info
.
used
>=
0
)
{
...
@@ -1799,12 +1799,12 @@ static int snd_seq_ioctl_set_queue_client(client_t * client, unsigned long arg)
...
@@ -1799,12 +1799,12 @@ static int snd_seq_ioctl_set_queue_client(client_t * client, unsigned long arg)
/* GET_CLIENT_POOL ioctl() */
/* GET_CLIENT_POOL ioctl() */
static
int
snd_seq_ioctl_get_client_pool
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_client_pool
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_client_pool_t
info
;
snd_seq_client_pool_t
info
;
client_t
*
cptr
;
client_t
*
cptr
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
cptr
=
snd_seq_client_use_ptr
(
info
.
client
);
cptr
=
snd_seq_client_use_ptr
(
info
.
client
);
...
@@ -1827,18 +1827,18 @@ static int snd_seq_ioctl_get_client_pool(client_t * client, unsigned long arg)
...
@@ -1827,18 +1827,18 @@ static int snd_seq_ioctl_get_client_pool(client_t * client, unsigned long arg)
}
}
snd_seq_client_unlock
(
cptr
);
snd_seq_client_unlock
(
cptr
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
/* SET_CLIENT_POOL ioctl() */
/* SET_CLIENT_POOL ioctl() */
static
int
snd_seq_ioctl_set_client_pool
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_set_client_pool
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_client_pool_t
info
;
snd_seq_client_pool_t
info
;
int
rc
;
int
rc
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
client
->
number
!=
info
.
client
)
if
(
client
->
number
!=
info
.
client
)
...
@@ -1877,11 +1877,11 @@ static int snd_seq_ioctl_set_client_pool(client_t * client, unsigned long arg)
...
@@ -1877,11 +1877,11 @@ static int snd_seq_ioctl_set_client_pool(client_t * client, unsigned long arg)
/* REMOVE_EVENTS ioctl() */
/* REMOVE_EVENTS ioctl() */
static
int
snd_seq_ioctl_remove_events
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_remove_events
(
client_t
*
client
,
void
__user
*
arg
)
{
{
snd_seq_remove_events_t
info
;
snd_seq_remove_events_t
info
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/*
/*
...
@@ -1906,7 +1906,7 @@ static int snd_seq_ioctl_remove_events(client_t * client, unsigned long arg)
...
@@ -1906,7 +1906,7 @@ static int snd_seq_ioctl_remove_events(client_t * client, unsigned long arg)
/*
/*
* get subscription info
* get subscription info
*/
*/
static
int
snd_seq_ioctl_get_subscription
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_get_subscription
(
client_t
*
client
,
void
__user
*
arg
)
{
{
int
result
;
int
result
;
client_t
*
sender
=
NULL
;
client_t
*
sender
=
NULL
;
...
@@ -1914,7 +1914,7 @@ static int snd_seq_ioctl_get_subscription(client_t *client, unsigned long arg)
...
@@ -1914,7 +1914,7 @@ static int snd_seq_ioctl_get_subscription(client_t *client, unsigned long arg)
snd_seq_port_subscribe_t
subs
;
snd_seq_port_subscribe_t
subs
;
subscribers_t
*
p
;
subscribers_t
*
p
;
if
(
copy_from_user
(
&
subs
,
(
void
*
)
arg
,
sizeof
(
subs
)))
if
(
copy_from_user
(
&
subs
,
arg
,
sizeof
(
subs
)))
return
-
EFAULT
;
return
-
EFAULT
;
result
=
-
EINVAL
;
result
=
-
EINVAL
;
...
@@ -1935,7 +1935,7 @@ static int snd_seq_ioctl_get_subscription(client_t *client, unsigned long arg)
...
@@ -1935,7 +1935,7 @@ static int snd_seq_ioctl_get_subscription(client_t *client, unsigned long arg)
if
(
sender
)
if
(
sender
)
snd_seq_client_unlock
(
sender
);
snd_seq_client_unlock
(
sender
);
if
(
result
>=
0
)
{
if
(
result
>=
0
)
{
if
(
copy_to_user
(
(
void
*
)
arg
,
&
subs
,
sizeof
(
subs
)))
if
(
copy_to_user
(
arg
,
&
subs
,
sizeof
(
subs
)))
return
-
EFAULT
;
return
-
EFAULT
;
}
}
return
result
;
return
result
;
...
@@ -1945,7 +1945,7 @@ static int snd_seq_ioctl_get_subscription(client_t *client, unsigned long arg)
...
@@ -1945,7 +1945,7 @@ static int snd_seq_ioctl_get_subscription(client_t *client, unsigned long arg)
/*
/*
* get subscription info - check only its presence
* get subscription info - check only its presence
*/
*/
static
int
snd_seq_ioctl_query_subs
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_query_subs
(
client_t
*
client
,
void
__user
*
arg
)
{
{
int
result
=
-
ENXIO
;
int
result
=
-
ENXIO
;
client_t
*
cptr
=
NULL
;
client_t
*
cptr
=
NULL
;
...
@@ -1955,7 +1955,7 @@ static int snd_seq_ioctl_query_subs(client_t *client, unsigned long arg)
...
@@ -1955,7 +1955,7 @@ static int snd_seq_ioctl_query_subs(client_t *client, unsigned long arg)
struct
list_head
*
p
;
struct
list_head
*
p
;
int
i
;
int
i
;
if
(
copy_from_user
(
&
subs
,
(
void
*
)
arg
,
sizeof
(
subs
)))
if
(
copy_from_user
(
&
subs
,
arg
,
sizeof
(
subs
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
((
cptr
=
snd_seq_client_use_ptr
(
subs
.
root
.
client
))
==
NULL
)
if
((
cptr
=
snd_seq_client_use_ptr
(
subs
.
root
.
client
))
==
NULL
)
...
@@ -2004,7 +2004,7 @@ static int snd_seq_ioctl_query_subs(client_t *client, unsigned long arg)
...
@@ -2004,7 +2004,7 @@ static int snd_seq_ioctl_query_subs(client_t *client, unsigned long arg)
if
(
cptr
)
if
(
cptr
)
snd_seq_client_unlock
(
cptr
);
snd_seq_client_unlock
(
cptr
);
if
(
result
>=
0
)
{
if
(
result
>=
0
)
{
if
(
copy_to_user
(
(
void
*
)
arg
,
&
subs
,
sizeof
(
subs
)))
if
(
copy_to_user
(
arg
,
&
subs
,
sizeof
(
subs
)))
return
-
EFAULT
;
return
-
EFAULT
;
}
}
return
result
;
return
result
;
...
@@ -2014,12 +2014,12 @@ static int snd_seq_ioctl_query_subs(client_t *client, unsigned long arg)
...
@@ -2014,12 +2014,12 @@ static int snd_seq_ioctl_query_subs(client_t *client, unsigned long arg)
/*
/*
* query next client
* query next client
*/
*/
static
int
snd_seq_ioctl_query_next_client
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_query_next_client
(
client_t
*
client
,
void
__user
*
arg
)
{
{
client_t
*
cptr
=
NULL
;
client_t
*
cptr
=
NULL
;
snd_seq_client_info_t
info
;
snd_seq_client_info_t
info
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* search for next client */
/* search for next client */
...
@@ -2037,7 +2037,7 @@ static int snd_seq_ioctl_query_next_client(client_t *client, unsigned long arg)
...
@@ -2037,7 +2037,7 @@ static int snd_seq_ioctl_query_next_client(client_t *client, unsigned long arg)
get_client_info
(
cptr
,
&
info
);
get_client_info
(
cptr
,
&
info
);
snd_seq_client_unlock
(
cptr
);
snd_seq_client_unlock
(
cptr
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -2045,13 +2045,13 @@ static int snd_seq_ioctl_query_next_client(client_t *client, unsigned long arg)
...
@@ -2045,13 +2045,13 @@ static int snd_seq_ioctl_query_next_client(client_t *client, unsigned long arg)
/*
/*
* query next port
* query next port
*/
*/
static
int
snd_seq_ioctl_query_next_port
(
client_t
*
client
,
unsigned
long
arg
)
static
int
snd_seq_ioctl_query_next_port
(
client_t
*
client
,
void
__user
*
arg
)
{
{
client_t
*
cptr
;
client_t
*
cptr
;
client_port_t
*
port
=
NULL
;
client_port_t
*
port
=
NULL
;
snd_seq_port_info_t
info
;
snd_seq_port_info_t
info
;
if
(
copy_from_user
(
&
info
,
(
void
*
)
arg
,
sizeof
(
info
)))
if
(
copy_from_user
(
&
info
,
arg
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
cptr
=
snd_seq_client_use_ptr
(
info
.
addr
.
client
);
cptr
=
snd_seq_client_use_ptr
(
info
.
addr
.
client
);
if
(
cptr
==
NULL
)
if
(
cptr
==
NULL
)
...
@@ -2071,7 +2071,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, unsigned long arg)
...
@@ -2071,7 +2071,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, unsigned long arg)
snd_seq_port_unlock
(
port
);
snd_seq_port_unlock
(
port
);
snd_seq_client_unlock
(
cptr
);
snd_seq_client_unlock
(
cptr
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
arg
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -2080,7 +2080,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, unsigned long arg)
...
@@ -2080,7 +2080,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, unsigned long arg)
static
struct
seq_ioctl_table
{
static
struct
seq_ioctl_table
{
unsigned
int
cmd
;
unsigned
int
cmd
;
int
(
*
func
)(
client_t
*
client
,
unsigned
long
arg
);
int
(
*
func
)(
client_t
*
client
,
void
__user
*
arg
);
}
ioctl_tables
[]
=
{
}
ioctl_tables
[]
=
{
{
SNDRV_SEQ_IOCTL_SYSTEM_INFO
,
snd_seq_ioctl_system_info
},
{
SNDRV_SEQ_IOCTL_SYSTEM_INFO
,
snd_seq_ioctl_system_info
},
{
SNDRV_SEQ_IOCTL_RUNNING_MODE
,
snd_seq_ioctl_running_mode
},
{
SNDRV_SEQ_IOCTL_RUNNING_MODE
,
snd_seq_ioctl_running_mode
},
...
@@ -2114,7 +2114,7 @@ static struct seq_ioctl_table {
...
@@ -2114,7 +2114,7 @@ static struct seq_ioctl_table {
{
0
,
NULL
},
{
0
,
NULL
},
};
};
static
int
snd_seq_do_ioctl
(
client_t
*
client
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
snd_seq_do_ioctl
(
client_t
*
client
,
unsigned
int
cmd
,
void
__user
*
arg
)
{
{
struct
seq_ioctl_table
*
p
;
struct
seq_ioctl_table
*
p
;
...
@@ -2131,7 +2131,7 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, unsigned long ar
...
@@ -2131,7 +2131,7 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, unsigned long ar
return
-
EFAULT
;
return
-
EFAULT
;
for
(
p
=
ioctl_tables
;
p
->
cmd
;
p
++
)
{
for
(
p
=
ioctl_tables
;
p
->
cmd
;
p
++
)
{
if
(
p
->
cmd
==
cmd
)
if
(
p
->
cmd
==
cmd
)
return
p
->
func
(
client
,
arg
);
return
p
->
func
(
client
,
(
void
__user
*
)
arg
);
}
}
snd_printd
(
"seq unknown ioctl() 0x%x (type='%c', number=0x%2x)
\n
"
,
snd_printd
(
"seq unknown ioctl() 0x%x (type='%c', number=0x%2x)
\n
"
,
cmd
,
_IOC_TYPE
(
cmd
),
_IOC_NR
(
cmd
));
cmd
,
_IOC_TYPE
(
cmd
),
_IOC_NR
(
cmd
));
...
@@ -2146,7 +2146,7 @@ static int snd_seq_ioctl(struct inode *inode, struct file *file,
...
@@ -2146,7 +2146,7 @@ static int snd_seq_ioctl(struct inode *inode, struct file *file,
snd_assert
(
client
!=
NULL
,
return
-
ENXIO
);
snd_assert
(
client
!=
NULL
,
return
-
ENXIO
);
return
snd_seq_do_ioctl
(
client
,
cmd
,
arg
);
return
snd_seq_do_ioctl
(
client
,
cmd
,
(
void
__user
*
)
arg
);
}
}
...
@@ -2315,7 +2315,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev,
...
@@ -2315,7 +2315,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev,
* exported, called by kernel clients to perform same functions as with
* exported, called by kernel clients to perform same functions as with
* userland ioctl()
* userland ioctl()
*/
*/
int
snd_seq_kernel_client_ctl
(
int
clientid
,
unsigned
int
cmd
,
void
*
arg
)
int
snd_seq_kernel_client_ctl
(
int
clientid
,
unsigned
int
cmd
,
void
__user
*
arg
)
{
{
client_t
*
client
;
client_t
*
client
;
mm_segment_t
fs
;
mm_segment_t
fs
;
...
@@ -2325,7 +2325,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
...
@@ -2325,7 +2325,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
if
(
client
==
NULL
)
if
(
client
==
NULL
)
return
-
ENXIO
;
return
-
ENXIO
;
fs
=
snd_enter_user
();
fs
=
snd_enter_user
();
result
=
snd_seq_do_ioctl
(
client
,
cmd
,
(
unsigned
long
)
arg
);
result
=
snd_seq_do_ioctl
(
client
,
cmd
,
arg
);
snd_leave_user
(
fs
);
snd_leave_user
(
fs
);
return
result
;
return
result
;
}
}
...
...
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