linux1394-cvslog Mailing List for IEEE 1394 for Linux (Page 4)
Brought to you by:
aeb,
bencollins
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(10) |
Jul
(12) |
Aug
(8) |
Sep
(9) |
Oct
(4) |
Nov
(5) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(7) |
Feb
(3) |
Mar
(15) |
Apr
(12) |
May
(5) |
Jun
(9) |
Jul
(32) |
Aug
(39) |
Sep
(42) |
Oct
(22) |
Nov
(28) |
Dec
(8) |
2002 |
Jan
(37) |
Feb
(47) |
Mar
(6) |
Apr
(29) |
May
(33) |
Jun
(9) |
Jul
(28) |
Aug
(30) |
Sep
(15) |
Oct
(75) |
Nov
(37) |
Dec
(31) |
2003 |
Jan
|
Feb
(89) |
Mar
(41) |
Apr
(13) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: SVN U. <ben...@li...> - 2003-02-14 01:15:36
|
Author: bencollins Date: 2003-02-13 20:14:59 -0500 (Thu, 13 Feb 2003) New Revision: 786 Modified: trunk/dv1394.c trunk/video1394.c Log: Add sanity check to make sure we only get compat ioctl's that are our own. Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-13 20:15:00.000000000 -0500 @@ -1365,6 +1365,9 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != video1394_ioctl) + return -EFAULT; + if (copy_from_user(&wait32, (void *)arg, sizeof(wait32))) return -EFAULT; @@ -1376,9 +1379,13 @@ old_fs = get_fs(); set_fs(KERNEL_DS); if (cmd == VIDEO1394_IOC32_LISTEN_WAIT_BUFFER) - ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_WAIT_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_LISTEN_WAIT_BUFFER, + (unsigned long) &wait); else - ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_POLL_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_LISTEN_POLL_BUFFER, + (unsigned long) &wait); set_fs(old_fs); if (!ret) { @@ -1402,6 +1409,9 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != video1394_ioctl) + return -EFAULT; + if (copy_from_user(&wait32, (void *)arg, sizeof(wait32))) return -EFAULT; @@ -1413,9 +1423,13 @@ old_fs = get_fs(); set_fs(KERNEL_DS); if (cmd == VIDEO1394_IOC32_LISTEN_QUEUE_BUFFER) - ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_QUEUE_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_LISTEN_QUEUE_BUFFER, + (unsigned long) &wait); else - ret = sys_ioctl(fd, VIDEO1394_IOC_TALK_WAIT_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_TALK_WAIT_BUFFER, + (unsigned long) &wait); set_fs(old_fs); return ret; @@ -1424,7 +1438,13 @@ static int video1394_queue_buf32(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) { + if (file->f_op->ioctl != video1394_ioctl) + return -EFAULT; + return -EFAULT; + + return video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_TALK_QUEUE_BUFFER, arg); } #endif /* CONFIG_COMPAT */ Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c 2003-02-13 20:15:00.000000000 -0500 @@ -2940,6 +2940,9 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != dv1394_ioctl) + return -EFAULT; + if (copy_from_user(&dv32, (void *)arg, sizeof(dv32))) return -EFAULT; @@ -2953,7 +2956,8 @@ old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_ioctl(fd, DV1394_IOC_INIT, (unsigned long) &dv); + ret = dv1394_ioctl(file->f_dentry->d_inode, file, + DV1394_IOC_INIT, (unsigned long)&dv); set_fs(old_fs); return ret; @@ -2967,9 +2971,13 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != dv1394_ioctl) + return -EFAULT; + old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_ioctl(fd, DV1394_IOC_GET_STATUS, (unsigned long) &dv); + ret = dv1394_ioctl(file->f_dentry->d_inode, file, + DV1394_IOC_GET_STATUS, (unsigned long)&dv); set_fs(old_fs); if (!ret) { |
From: SVN U. <ben...@li...> - 2003-02-14 00:55:23
|
Author: bencollins Date: 2003-02-13 19:54:50 -0500 (Thu, 13 Feb 2003) New Revision: 785 Modified: trunk/video1394.c Log: Fix register of ioctl32 translations Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-13 19:54:51.000000000 -0500 @@ -1357,7 +1357,8 @@ struct compat_timeval filltime; }; -static int video1394_wr_wait32(unsigned int fd, unsigned int cmd, unsigned long arg) +static int video1394_wr_wait32(unsigned int fd, unsigned int cmd, unsigned long arg, + struct file *file) { struct video1394_wait32 wait32; struct video1394_wait wait; @@ -1393,7 +1394,8 @@ return ret; } -static int video1394_w_wait32(unsigned int fd, unsigned int cmd, unsigned long arg) +static int video1394_w_wait32(unsigned int fd, unsigned int cmd, unsigned long arg, + struct file *file) { struct video1394_wait32 wait32; struct video1394_wait wait; @@ -1419,7 +1421,8 @@ return ret; } -static int video1394_queue_buf32(unsigned int fd, unsigned int cmd, unsigned long arg) +static int video1394_queue_buf32(unsigned int fd, unsigned int cmd, unsigned long arg, + struct file *file) { return -EFAULT; } |
From: SVN U. <ben...@li...> - 2003-02-14 00:54:32
|
Author: bencollins Date: 2003-02-13 19:53:59 -0500 (Thu, 13 Feb 2003) New Revision: 784 Modified: trunk/dv1394.c Log: Add ioctl32 translations. Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c 2003-02-13 19:54:00.000000000 -0500 @@ -111,6 +111,8 @@ #include <linux/wrapper.h> #include <linux/vmalloc.h> #include <linux/string.h> +#include <linux/ioctl32.h> +#include <linux/compat.h> #include "ieee1394.h" #include "ieee1394_types.h" @@ -2907,6 +2909,90 @@ .host_reset = dv1394_host_reset, }; +#ifdef CONFIG_COMPAT + +#define DV1394_IOC32_INIT _IOW('#', 0x06, struct dv1394_init32) +#define DV1394_IOC32_GET_STATUS _IOR('#', 0x0c, struct dv1394_status32) + +struct dv1394_init32 { + u32 api_version; + u32 channel; + u32 n_frames; + u32 format; + u32 cip_n; + u32 cip_d; + u32 syt_offset; +}; + +struct dv1394_status32 { + struct dv1394_init32 init; + s32 active_frame; + u32 first_clear_frame; + u32 n_clear_frames; + u32 dropped_frames; +}; + +static int handle_dv1394_init(unsigned int fd, unsigned int cmd, unsigned long arg, + struct file *file) +{ + struct dv1394_init32 dv32; + struct dv1394_init dv; + mm_segment_t old_fs; + int ret; + + if (copy_from_user(&dv32, (void *)arg, sizeof(dv32))) + return -EFAULT; + + dv.api_version = dv32.api_version; + dv.channel = dv32.channel; + dv.n_frames = dv32.n_frames; + dv.format = dv32.format; + dv.cip_n = (unsigned long)dv32.cip_n; + dv.cip_d = (unsigned long)dv32.cip_d; + dv.syt_offset = dv32.syt_offset; + + old_fs = get_fs(); + set_fs(KERNEL_DS); + ret = sys_ioctl(fd, DV1394_IOC_INIT, (unsigned long) &dv); + set_fs(old_fs); + + return ret; +} + +static int handle_dv1394_get_status(unsigned int fd, unsigned int cmd, unsigned long arg, + struct file *file) +{ + struct dv1394_status32 dv32; + struct dv1394_status dv; + mm_segment_t old_fs; + int ret; + + old_fs = get_fs(); + set_fs(KERNEL_DS); + ret = sys_ioctl(fd, DV1394_IOC_GET_STATUS, (unsigned long) &dv); + set_fs(old_fs); + + if (!ret) { + dv32.init.api_version = dv.init.api_version; + dv32.init.channel = dv.init.channel; + dv32.init.n_frames = dv.init.n_frames; + dv32.init.format = dv.init.format; + dv32.init.cip_n = (u32)dv.init.cip_n; + dv32.init.cip_d = (u32)dv.init.cip_d; + dv32.init.syt_offset = dv.init.syt_offset; + dv32.active_frame = dv.active_frame; + dv32.first_clear_frame = dv.first_clear_frame; + dv32.n_clear_frames = dv.n_clear_frames; + dv32.dropped_frames = dv.dropped_frames; + + if (copy_to_user((struct dv1394_status32 *)arg, &dv32, sizeof(dv32))) + ret = -EFAULT; + } + + return ret; +} +#endif /* CONFIG_COMPAT */ + /*** KERNEL MODULE HANDLERS ************************************************/ @@ -2917,6 +3003,16 @@ static void __exit dv1394_exit_module(void) { +#ifdef CONFIG_COMPAT + unregister_ioctl32_conversion(DV1394_IOC_SHUTDOWN); + unregister_ioctl32_conversion(DV1394_IOC_SUBMIT_FRAMES); + unregister_ioctl32_conversion(DV1394_IOC_WAIT_FRAMES); + unregister_ioctl32_conversion(DV1394_IOC_RECEIVE_FRAMES); + unregister_ioctl32_conversion(DV1394_IOC_START_RECEIVE); + unregister_ioctl32_conversion(DV1394_IOC32_INIT); + unregister_ioctl32_conversion(DV1394_IOC32_GET_STATUS); +#endif + hpsb_unregister_highlevel (hl_handle); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); #ifdef CONFIG_DEVFS_FS @@ -2967,9 +3063,21 @@ return -ENOMEM; } +#ifdef CONFIG_COMPAT + /* First compatible ones */ + register_ioctl32_conversion(DV1394_IOC_SHUTDOWN, NULL); + register_ioctl32_conversion(DV1394_IOC_SUBMIT_FRAMES, NULL); + register_ioctl32_conversion(DV1394_IOC_WAIT_FRAMES, NULL); + register_ioctl32_conversion(DV1394_IOC_RECEIVE_FRAMES, NULL); + register_ioctl32_conversion(DV1394_IOC_START_RECEIVE, NULL); + + /* These need to be handled by translation */ + register_ioctl32_conversion(DV1394_IOC32_INIT, handle_dv1394_init); + register_ioctl32_conversion(DV1394_IOC32_GET_STATUS, handle_dv1394_get_status); +#endif + return 0; } module_init(dv1394_init_module); module_exit(dv1394_exit_module); - |
From: SVN U. <ben...@li...> - 2003-02-14 00:41:36
|
Author: bencollins Date: 2003-02-13 19:41:03 -0500 (Thu, 13 Feb 2003) New Revision: 783 Modified: trunk/amdtp.c Log: Register ioctl's as compatible. Modified: trunk/amdtp.c ============================================================================== --- trunk/amdtp.c (original) +++ trunk/amdtp.c 2003-02-13 19:41:04.000000000 -0500 @@ -74,6 +74,8 @@ #include <linux/pci.h> #include <linux/interrupt.h> #include <linux/poll.h> +#include <linux/ioctl32.h> +#include <linux/compat.h> #include <asm/uaccess.h> #include <asm/atomic.h> @@ -1276,6 +1278,13 @@ return -EIO; } +#ifdef CONFIG_COMPAT + register_ioctl32_conversion(AMDTP_IOC_CHANNEL, NULL); + register_ioctl32_conversion(AMDTP_IOC_PLUG, NULL); + register_ioctl32_conversion(AMDTP_IOC_PING, NULL); + register_ioctl32_conversion(AMDTP_IOC_ZAP, NULL); +#endif + HPSB_INFO("Loaded AMDTP driver"); return 0; @@ -1283,6 +1292,13 @@ static void __exit amdtp_exit_module (void) { +#ifdef CONFIG_COMPAT + unregister_ioctl32_conversion(AMDTP_IOC_CHANNEL); + unregister_ioctl32_conversion(AMDTP_IOC_PLUG); + unregister_ioctl32_conversion(AMDTP_IOC_PING); + unregister_ioctl32_conversion(AMDTP_IOC_ZAP); +#endif + hpsb_unregister_highlevel(amdtp_highlevel); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_AMDTP); |
From: SVN U. <ben...@li...> - 2003-02-14 00:28:46
|
Author: bencollins Date: 2003-02-13 19:28:00 -0500 (Thu, 13 Feb 2003) New Revision: 782 Modified: trunk/video1394.c Log: Add ioctl32 reg/unreg calls and provide some translations where needed. One function stil nee Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-13 19:28:00.000000000 -0500 @@ -43,6 +43,8 @@ #include <linux/vmalloc.h> #include <linux/timex.h> #include <linux/mm.h> +#include <linux/ioctl32.h> +#include <linux/compat.h> #include "ieee1394.h" #include "ieee1394_types.h" @@ -1338,13 +1340,111 @@ MODULE_SUPPORTED_DEVICE(VIDEO1394_DRIVER_NAME); MODULE_LICENSE("GPL"); +#ifdef CONFIG_COMPAT + +#define VIDEO1394_IOC32_LISTEN_QUEUE_BUFFER \ + _IOW ('#', 0x12, struct video1394_wait32) +#define VIDEO1394_IOC32_LISTEN_WAIT_BUFFER \ + _IOWR('#', 0x13, struct video1394_wait32) +#define VIDEO1394_IOC32_TALK_WAIT_BUFFER \ + _IOW ('#', 0x17, struct video1394_wait32) +#define VIDEO1394_IOC32_LISTEN_POLL_BUFFER \ + _IOWR('#', 0x18, struct video1394_wait32) + +struct video1394_wait32 { + u32 channel; + u32 buffer; + struct compat_timeval filltime; +}; + +static int video1394_wr_wait32(unsigned int fd, unsigned int cmd, unsigned long arg) +{ + struct video1394_wait32 wait32; + struct video1394_wait wait; + mm_segment_t old_fs; + int ret; + + if (copy_from_user(&wait32, (void *)arg, sizeof(wait32))) + return -EFAULT; + + wait.channel = wait32.channel; + wait.buffer = wait32.buffer; + wait.filltime.tv_sec = (time_t)wait32.filltime.tv_sec; + wait.filltime.tv_usec = (suseconds_t)wait32.filltime.tv_usec; + + old_fs = get_fs(); + set_fs(KERNEL_DS); + if (cmd == VIDEO1394_IOC32_LISTEN_WAIT_BUFFER) + ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_WAIT_BUFFER, (unsigned long) &wait); + else + ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_POLL_BUFFER, (unsigned long) &wait); + set_fs(old_fs); + + if (!ret) { + wait32.channel = wait.channel; + wait32.buffer = wait.buffer; + wait32.filltime.tv_sec = (int)wait.filltime.tv_sec; + wait32.filltime.tv_usec = (int)wait.filltime.tv_usec; + + if (copy_to_user((struct video1394_wait32 *)arg, &wait32, sizeof(wait32))) + ret = -EFAULT; + } + + return ret; +} + +static int video1394_w_wait32(unsigned int fd, unsigned int cmd, unsigned long arg) +{ + struct video1394_wait32 wait32; + struct video1394_wait wait; + mm_segment_t old_fs; + int ret; + + if (copy_from_user(&wait32, (void *)arg, sizeof(wait32))) + return -EFAULT; + + wait.channel = wait32.channel; + wait.buffer = wait32.buffer; + wait.filltime.tv_sec = (time_t)wait32.filltime.tv_sec; + wait.filltime.tv_usec = (suseconds_t)wait32.filltime.tv_usec; + + old_fs = get_fs(); + set_fs(KERNEL_DS); + if (cmd == VIDEO1394_IOC32_LISTEN_QUEUE_BUFFER) + ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_QUEUE_BUFFER, (unsigned long) &wait); + else + ret = sys_ioctl(fd, VIDEO1394_IOC_TALK_WAIT_BUFFER, (unsigned long) &wait); + set_fs(old_fs); + + return ret; +} + +static int video1394_queue_buf32(unsigned int fd, unsigned int cmd, unsigned long arg) +{ + return -EFAULT; +} + +#endif /* CONFIG_COMPAT */ + static void __exit video1394_exit_module (void) { +#ifdef CONFIG_COMPAT + unregister_ioctl32_conversion(VIDEO1394_IOC_LISTEN_CHANNEL); + unregister_ioctl32_conversion(VIDEO1394_IOC_UNLISTEN_CHANNEL); + unregister_ioctl32_conversion(VIDEO1394_IOC_TALK_CHANNEL); + unregister_ioctl32_conversion(VIDEO1394_IOC_UNTALK_CHANNEL); + unregister_ioctl32_conversion(VIDEO1394_IOC32_LISTEN_QUEUE_BUFFER); + unregister_ioctl32_conversion(VIDEO1394_IOC32_LISTEN_WAIT_BUFFER); + unregister_ioctl32_conversion(VIDEO1394_IOC_TALK_QUEUE_BUFFER); + unregister_ioctl32_conversion(VIDEO1394_IOC32_TALK_WAIT_BUFFER); + unregister_ioctl32_conversion(VIDEO1394_IOC32_LISTEN_POLL_BUFFER); +#endif + hpsb_unregister_highlevel (hl_handle); devfs_unregister(devfs_handle); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_VIDEO1394); - + PRINT_G(KERN_INFO, "Removed " VIDEO1394_DRIVER_NAME " module"); } @@ -1353,9 +1453,9 @@ if (ieee1394_register_chardev(IEEE1394_MINOR_BLOCK_VIDEO1394, THIS_MODULE, &video1394_fops)) { PRINT_G(KERN_ERR, "video1394: unable to get minor device block"); - return -EIO; - } - + return -EIO; + } + devfs_handle = devfs_mk_dir(NULL, VIDEO1394_DRIVER_NAME, NULL); hl_handle = hpsb_register_highlevel (VIDEO1394_DRIVER_NAME, &hl_ops); @@ -1366,9 +1466,30 @@ return -ENOMEM; } +#ifdef CONFIG_COMPAT + /* First the compatible ones */ + register_ioctl32_conversion(VIDEO1394_IOC_LISTEN_CHANNEL, NULL); + register_ioctl32_conversion(VIDEO1394_IOC_UNLISTEN_CHANNEL, NULL); + register_ioctl32_conversion(VIDEO1394_IOC_TALK_CHANNEL, NULL); + register_ioctl32_conversion(VIDEO1394_IOC_UNTALK_CHANNEL, NULL); + + /* These need translation */ + register_ioctl32_conversion(VIDEO1394_IOC32_LISTEN_QUEUE_BUFFER, + video1394_w_wait32); + register_ioctl32_conversion(VIDEO1394_IOC32_LISTEN_WAIT_BUFFER, + video1394_wr_wait32); + register_ioctl32_conversion(VIDEO1394_IOC_TALK_QUEUE_BUFFER, + video1394_queue_buf32); + register_ioctl32_conversion(VIDEO1394_IOC32_TALK_WAIT_BUFFER, + video1394_w_wait32); + register_ioctl32_conversion(VIDEO1394_IOC32_LISTEN_POLL_BUFFER, + video1394_wr_wait32); +#endif + PRINT_G(KERN_INFO, "Installed " VIDEO1394_DRIVER_NAME " module"); return 0; } + module_init(video1394_init_module); module_exit(video1394_exit_module); |
From: SVN U. <ben...@li...> - 2003-02-11 18:58:07
|
Author: bencollins Date: 2003-02-11 13:57:27 -0500 (Tue, 11 Feb 2003) New Revision: 781 Added: trunk/ieee1394-ioctl.h Modified: trunk/amdtp.h trunk/dv1394.c trunk/dv1394.h trunk/raw1394.c trunk/raw1394.h trunk/video1394.c trunk/video1394.h Log: ioctl conversion Modified: trunk/dv1394.h ============================================================================== --- trunk/dv1394.h (original) +++ trunk/dv1394.h 2003-02-11 13:57:29.000000000 -0500 @@ -200,48 +200,7 @@ /* ioctl() commands */ - -enum { - /* I don't like using 0 as a valid ioctl() */ - DV1394_INVALID = 0, - - - /* get the driver ready to transmit video. - pass a struct dv1394_init* as the parameter (see below), - or NULL to get default parameters */ - DV1394_INIT, - - - /* stop transmitting video and free the ringbuffer */ - DV1394_SHUTDOWN, - - - /* submit N new frames to be transmitted, where - the index of the first new frame is first_clear_buffer, - and the index of the last new frame is - (first_clear_buffer + N) % n_frames */ - DV1394_SUBMIT_FRAMES, - - - /* block until N buffers are clear (pass N as the parameter) - Because we re-transmit the last frame on underrun, there - will at most be n_frames - 1 clear frames at any time */ - DV1394_WAIT_FRAMES, - - /* capture new frames that have been received, where - the index of the first new frame is first_clear_buffer, - and the index of the last new frame is - (first_clear_buffer + N) % n_frames */ - DV1394_RECEIVE_FRAMES, - - - DV1394_START_RECEIVE, - - - /* pass a struct dv1394_status* as the parameter (see below) */ - DV1394_GET_STATUS, -}; - +#include "ieee1394-ioctl.h" enum pal_or_ntsc { Added: trunk/ieee1394-ioctl.h ============================================================================== --- trunk/ieee1394-ioctl.h (original) +++ trunk/ieee1394-ioctl.h 2003-02-11 13:57:29.000000000 -0500 @@ -0,0 +1,105 @@ +/* Base file for all ieee1394 ioctl's. Linux-1394 has allocated base '#' + * with a range of 0x00-0x3f. */ + +#ifndef __IEEE1394_IOCTL_H +#define __IEEE1394_IOCTL_H + +#include <asm/ioctl.h> +#include <asm/types.h> + + +/* AMDTP Gets 6 */ +#define AMDTP_IOC_CHANNEL _IOW('#', 0x00, struct amdtp_ioctl) +#define AMDTP_IOC_PLUG _IOW('#', 0x01, struct amdtp_ioctl) +#define AMDTP_IOC_PING _IOW('#', 0x02, struct amdtp_ioctl) +#define AMDTP_IOC_ZAP _IO ('#', 0x03) + + +/* DV1394 Gets 10 */ + +/* Get the driver ready to transmit video. pass a struct dv1394_init* as + * the parameter (see below), or NULL to get default parameters */ +#define DV1394_IOC_INIT _IOW('#', 0x06, struct dv1394_init) + +/* Stop transmitting video and free the ringbuffer */ +#define DV1394_IOC_SHUTDOWN _IO ('#', 0x07) + +/* Submit N new frames to be transmitted, where the index of the first new + * frame is first_clear_buffer, and the index of the last new frame is + * (first_clear_buffer + N) % n_frames */ +#define DV1394_IOC_SUBMIT_FRAMES _IO ('#', 0x08) + +/* Block until N buffers are clear (pass N as the parameter) Because we + * re-transmit the last frame on underrun, there will at most be n_frames + * - 1 clear frames at any time */ +#define DV1394_IOC_WAIT_FRAMES _IO ('#', 0x09) + +/* Capture new frames that have been received, where the index of the + * first new frame is first_clear_buffer, and the index of the last new + * frame is (first_clear_buffer + N) % n_frames */ +#define DV1394_IOC_RECEIVE_FRAMES _IO ('#', 0x0a) + +/* Tell card to start receiving DMA */ +#define DV1394_IOC_START_RECEIVE _IO ('#', 0x0b) + +/* Pass a struct dv1394_status* as the parameter */ +#define DV1394_IOC_GET_STATUS _IOR('#', 0x0c, struct dv1394_status) + + +/* Video1394 Gets 10 */ + +#define VIDEO1394_IOC_LISTEN_CHANNEL \ + _IOWR('#', 0x10, struct video1394_mmap) +#define VIDEO1394_IOC_UNLISTEN_CHANNEL \ + _IOW ('#', 0x11, int) +#define VIDEO1394_IOC_LISTEN_QUEUE_BUFFER \ + _IOW ('#', 0x12, struct video1394_wait) +#define VIDEO1394_IOC_LISTEN_WAIT_BUFFER \ + _IOWR('#', 0x13, struct video1394_wait) +#define VIDEO1394_IOC_TALK_CHANNEL \ + _IOWR('#', 0x14, struct video1394_mmap) +#define VIDEO1394_IOC_UNTALK_CHANNEL \ + _IOW ('#', 0x15, int) +#define VIDEO1394_IOC_TALK_QUEUE_BUFFER \ + _IOW ('#', 0x16, sizeof (struct video1394_wait) + \ + sizeof (struct video1394_queue_variable)) +#define VIDEO1394_IOC_TALK_WAIT_BUFFER \ + _IOW ('#', 0x17, struct video1394_wait) +#define VIDEO1394_IOC_LISTEN_POLL_BUFFER \ + _IOWR('#', 0x18, struct video1394_wait) + + +/* Raw1394's ISO interface */ +#define RAW1394_IOC_ISO_XMIT_INIT \ + _IOW ('#', 0x1a, struct raw1394_iso_status) +#define RAW1394_IOC_ISO_RECV_INIT \ + _IOWR('#', 0x1b, struct raw1394_iso_status) +#define RAW1394_IOC_ISO_RECV_START \ + _IOC (_IOC_WRITE, '#', 0x1c, sizeof(int) * 3) +#define RAW1394_IOC_ISO_XMIT_START \ + _IOC (_IOC_WRITE, '#', 0x1d, sizeof(int) * 2) +#define RAW1394_IOC_ISO_XMIT_RECV_STOP \ + _IO ('#', 0x1e) +#define RAW1394_IOC_ISO_GET_STATUS \ + _IOR ('#', 0x1f, struct raw1394_iso_status) +#define RAW1394_IOC_ISO_SHUTDOWN \ + _IO ('#', 0x20) +#define RAW1394_IOC_ISO_QUEUE_ACTIVITY \ + _IO ('#', 0x21) +#define RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL \ + _IOW ('#', 0x22, unsigned char) +#define RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL \ + _IOW ('#', 0x23, unsigned char) +#define RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK \ + _IOW ('#', 0x24, u64) +#define RAW1394_IOC_ISO_RECV_PACKETS \ + _IOW ('#', 0x25, struct raw1394_iso_packets) +#define RAW1394_IOC_ISO_RECV_RELEASE_PACKETS \ + _IOW ('#', 0x26, unsigned int) +#define RAW1394_IOC_ISO_XMIT_PACKETS \ + _IOW ('#', 0x27, struct raw1394_iso_packets) +#define RAW1394_IOC_ISO_XMIT_SYNC \ + _IO ('#', 0x28) + + +#endif /* __IEEE1394_IOCTL_H */ Modified: trunk/amdtp.h ============================================================================== --- trunk/amdtp.h (original) +++ trunk/amdtp.h 2003-02-11 13:57:29.000000000 -0500 @@ -3,8 +3,8 @@ #ifndef __AMDTP_H #define __AMDTP_H -#include <asm/ioctl.h> #include <asm/types.h> +#include "ieee1394-ioctl.h" /* The userspace interface for the Audio & Music Data Transmission * Protocol driver is really simple. First, open /dev/amdtp, use the @@ -57,13 +57,6 @@ * */ -/* We use '#' for our ioctl magic number because it's cool. */ - -#define AMDTP_IOC_CHANNEL _IOW('#', 0, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PLUG _IOW('#', 1, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PING _IOW('#', 2, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_ZAP _IO('#', 3) - enum { AMDTP_FORMAT_RAW, AMDTP_FORMAT_IEC958_PCM, Modified: trunk/raw1394.c ============================================================================== --- trunk/raw1394.c (original) +++ trunk/raw1394.c 2003-02-11 13:57:29.000000000 -0500 @@ -2238,9 +2238,9 @@ switch(fi->iso_state) { case RAW1394_ISO_INACTIVE: switch(cmd) { - case RAW1394_ISO_XMIT_INIT: + case RAW1394_IOC_ISO_XMIT_INIT: return raw1394_iso_xmit_init(fi, (void*) arg); - case RAW1394_ISO_RECV_INIT: + case RAW1394_IOC_ISO_RECV_INIT: return raw1394_iso_recv_init(fi, (void*) arg); default: break; @@ -2248,63 +2248,63 @@ break; case RAW1394_ISO_RECV: switch(cmd) { - case RAW1394_ISO_RECV_START: { + case RAW1394_IOC_ISO_RECV_START: { /* copy args from user-space */ int args[3]; if(copy_from_user(&args[0], (void*) arg, sizeof(args))) return -EFAULT; return hpsb_iso_recv_start(fi->iso_handle, args[0], args[1], args[2]); } - case RAW1394_ISO_XMIT_RECV_STOP: + case RAW1394_IOC_ISO_XMIT_RECV_STOP: hpsb_iso_stop(fi->iso_handle); return 0; - case RAW1394_ISO_RECV_LISTEN_CHANNEL: + case RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL: return hpsb_iso_recv_listen_channel(fi->iso_handle, arg); - case RAW1394_ISO_RECV_UNLISTEN_CHANNEL: + case RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL: return hpsb_iso_recv_unlisten_channel(fi->iso_handle, arg); - case RAW1394_ISO_RECV_SET_CHANNEL_MASK: { + case RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK: { /* copy the u64 from user-space */ u64 mask; if(copy_from_user(&mask, (void*) arg, sizeof(mask))) return -EFAULT; return hpsb_iso_recv_set_channel_mask(fi->iso_handle, mask); } - case RAW1394_ISO_GET_STATUS: + case RAW1394_IOC_ISO_GET_STATUS: return raw1394_iso_get_status(fi, (void*) arg); - case RAW1394_ISO_RECV_PACKETS: + case RAW1394_IOC_ISO_RECV_PACKETS: return raw1394_iso_recv_packets(fi, (void*) arg); - case RAW1394_ISO_RECV_RELEASE_PACKETS: + case RAW1394_IOC_ISO_RECV_RELEASE_PACKETS: return hpsb_iso_recv_release_packets(fi->iso_handle, arg); - case RAW1394_ISO_SHUTDOWN: + case RAW1394_IOC_ISO_SHUTDOWN: raw1394_iso_shutdown(fi); return 0; - case RAW1394_ISO_QUEUE_ACTIVITY: + case RAW1394_IOC_ISO_QUEUE_ACTIVITY: queue_rawiso_event(fi); return 0; } break; case RAW1394_ISO_XMIT: switch(cmd) { - case RAW1394_ISO_XMIT_START: { + case RAW1394_IOC_ISO_XMIT_START: { /* copy two ints from user-space */ int args[2]; if(copy_from_user(&args[0], (void*) arg, sizeof(args))) return -EFAULT; return hpsb_iso_xmit_start(fi->iso_handle, args[0], args[1]); } - case RAW1394_ISO_XMIT_SYNC: + case RAW1394_IOC_ISO_XMIT_SYNC: return hpsb_iso_xmit_sync(fi->iso_handle); - case RAW1394_ISO_XMIT_RECV_STOP: + case RAW1394_IOC_ISO_XMIT_RECV_STOP: hpsb_iso_stop(fi->iso_handle); return 0; - case RAW1394_ISO_GET_STATUS: + case RAW1394_IOC_ISO_GET_STATUS: return raw1394_iso_get_status(fi, (void*) arg); - case RAW1394_ISO_XMIT_PACKETS: + case RAW1394_IOC_ISO_XMIT_PACKETS: return raw1394_iso_send_packets(fi, (void*) arg); - case RAW1394_ISO_SHUTDOWN: + case RAW1394_IOC_ISO_SHUTDOWN: raw1394_iso_shutdown(fi); return 0; - case RAW1394_ISO_QUEUE_ACTIVITY: + case RAW1394_IOC_ISO_QUEUE_ACTIVITY: queue_rawiso_event(fi); return 0; } Modified: trunk/raw1394.h ============================================================================== --- trunk/raw1394.h (original) +++ trunk/raw1394.h 2003-02-11 13:57:29.000000000 -0500 @@ -116,24 +116,7 @@ } *arm_request_response_t; /* rawiso API */ - -/* ioctls */ -#define RAW1394_ISO_XMIT_INIT 1 /* arg: raw1394_iso_status* */ -#define RAW1394_ISO_RECV_INIT 2 /* arg: raw1394_iso_status* */ -#define RAW1394_ISO_RECV_START 3 /* arg: int[3], { starting cycle, tag, sync } */ -#define RAW1394_ISO_XMIT_START 8 /* arg: int[2], { starting cycle, prebuffer } */ -#define RAW1394_ISO_XMIT_RECV_STOP 4 -#define RAW1394_ISO_GET_STATUS 5 /* arg: raw1394_iso_status* */ -#define RAW1394_ISO_PRODUCE_CONSUME 6 /* no longer used */ -#define RAW1394_ISO_SHUTDOWN 7 -#define RAW1394_ISO_QUEUE_ACTIVITY 9 -#define RAW1394_ISO_RECV_LISTEN_CHANNEL 10 /* arg: channel number */ -#define RAW1394_ISO_RECV_UNLISTEN_CHANNEL 11 /* arg: channel number */ -#define RAW1394_ISO_RECV_SET_CHANNEL_MASK 12 /* arg: pointer to 64-bit mask */ -#define RAW1394_ISO_RECV_PACKETS 13 /* arg: struct raw1394_iso_packets* */ -#define RAW1394_ISO_RECV_RELEASE_PACKETS 14 /* arg: int n_packets */ -#define RAW1394_ISO_XMIT_PACKETS 15 /* arg: struct raw1394_iso_packets* */ -#define RAW1394_ISO_XMIT_SYNC 16 +#include "ieee1394-ioctl.h" /* per-packet metadata embedded in the ringbuffer */ /* must be identical to hpsb_iso_packet_info in iso.h! */ Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-11 13:57:29.000000000 -0500 @@ -719,8 +719,8 @@ switch(cmd) { - case VIDEO1394_LISTEN_CHANNEL: - case VIDEO1394_TALK_CHANNEL: + case VIDEO1394_IOC_LISTEN_CHANNEL: + case VIDEO1394_IOC_TALK_CHANNEL: { struct video1394_mmap v; u64 mask; @@ -779,7 +779,7 @@ return -EFAULT; } - if (cmd == VIDEO1394_LISTEN_CHANNEL) { + if (cmd == VIDEO1394_IOC_LISTEN_CHANNEL) { d = alloc_dma_iso_ctx(ohci, OHCI_ISO_RECEIVE, v.nb_buffers, v.buf_size, v.channel, 0); @@ -829,8 +829,8 @@ return 0; } - case VIDEO1394_UNLISTEN_CHANNEL: - case VIDEO1394_UNTALK_CHANNEL: + case VIDEO1394_IOC_UNLISTEN_CHANNEL: + case VIDEO1394_IOC_UNTALK_CHANNEL: { int channel; u64 mask; @@ -854,7 +854,7 @@ /* Mark this channel as unused */ ohci->ISO_channel_usage &= ~mask; - if (cmd == VIDEO1394_UNLISTEN_CHANNEL) + if (cmd == VIDEO1394_IOC_UNLISTEN_CHANNEL) d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, channel); else d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, channel); @@ -866,7 +866,7 @@ return 0; } - case VIDEO1394_LISTEN_QUEUE_BUFFER: + case VIDEO1394_IOC_LISTEN_QUEUE_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -926,8 +926,8 @@ return 0; } - case VIDEO1394_LISTEN_WAIT_BUFFER: - case VIDEO1394_LISTEN_POLL_BUFFER: + case VIDEO1394_IOC_LISTEN_WAIT_BUFFER: + case VIDEO1394_IOC_LISTEN_POLL_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -954,7 +954,7 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE; break; case VIDEO1394_BUFFER_QUEUED: - if (cmd == VIDEO1394_LISTEN_POLL_BUFFER) { + if (cmd == VIDEO1394_IOC_LISTEN_POLL_BUFFER) { /* for polling, return error code EINTR */ spin_unlock_irqrestore(&d->lock, flags); return -EINTR; @@ -1008,7 +1008,7 @@ return 0; } - case VIDEO1394_TALK_QUEUE_BUFFER: + case VIDEO1394_IOC_TALK_QUEUE_BUFFER: { struct video1394_wait v; struct video1394_queue_variable qv; @@ -1096,7 +1096,7 @@ return 0; } - case VIDEO1394_TALK_WAIT_BUFFER: + case VIDEO1394_IOC_TALK_WAIT_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c 2003-02-11 13:57:29.000000000 -0500 @@ -1608,7 +1608,7 @@ switch(cmd) { - case DV1394_SUBMIT_FRAMES: { + case DV1394_IOC_SUBMIT_FRAMES: { unsigned int n_submit; if( !video_card_initialized(video) ) { @@ -1662,7 +1662,7 @@ break; } - case DV1394_WAIT_FRAMES: { + case DV1394_IOC_WAIT_FRAMES: { unsigned int n_wait; if( !video_card_initialized(video) ) { @@ -1711,7 +1711,7 @@ break; } - case DV1394_RECEIVE_FRAMES: { + case DV1394_IOC_RECEIVE_FRAMES: { unsigned int n_recv; if( !video_card_initialized(video) ) { @@ -1744,7 +1744,7 @@ break; } - case DV1394_START_RECEIVE: { + case DV1394_IOC_START_RECEIVE: { if( !video_card_initialized(video) ) { ret = do_dv1394_init_default(video); if(ret) @@ -1761,7 +1761,7 @@ break; } - case DV1394_INIT: { + case DV1394_IOC_INIT: { struct dv1394_init init; if(arg == (unsigned long) NULL) { ret = do_dv1394_init_default(video); @@ -1775,12 +1775,12 @@ break; } - case DV1394_SHUTDOWN: + case DV1394_IOC_SHUTDOWN: ret = do_dv1394_shutdown(video, 0); break; - case DV1394_GET_STATUS: { + case DV1394_IOC_GET_STATUS: { struct dv1394_status status; if( !video_card_initialized(video) ) { Modified: trunk/video1394.h ============================================================================== --- trunk/video1394.h (original) +++ trunk/video1394.h 2003-02-11 13:57:29.000000000 -0500 @@ -21,6 +21,8 @@ #ifndef _VIDEO_1394_H #define _VIDEO_1394_H +#include "ieee1394-ioctl.h" + #define VIDEO1394_DRIVER_NAME "video1394" #define VIDEO1394_MAX_SIZE 0x4000000 @@ -31,18 +33,6 @@ VIDEO1394_BUFFER_READY }; -enum { - VIDEO1394_LISTEN_CHANNEL = 0, - VIDEO1394_UNLISTEN_CHANNEL, - VIDEO1394_LISTEN_QUEUE_BUFFER, - VIDEO1394_LISTEN_WAIT_BUFFER, // wait until buffer is ready - VIDEO1394_TALK_CHANNEL, - VIDEO1394_UNTALK_CHANNEL, - VIDEO1394_TALK_QUEUE_BUFFER, - VIDEO1394_TALK_WAIT_BUFFER, - VIDEO1394_LISTEN_POLL_BUFFER // return immediately with -EINTR if not ready -}; - #define VIDEO1394_SYNC_FRAMES 0x00000001 #define VIDEO1394_INCLUDE_ISO_HEADERS 0x00000002 #define VIDEO1394_VARIABLE_PACKET_SIZE 0x00000004 |
From: SVN U. <ben...@li...> - 2003-02-11 18:03:42
|
Author: bencollins Date: 2003-02-11 13:03:06 -0500 (Tue, 11 Feb 2003) New Revision: 780 Added: branches/linux-2.4/ieee1394-ioctl.h Modified: branches/linux-2.4/amdtp.h branches/linux-2.4/dv1394.c branches/linux-2.4/dv1394.h branches/linux-2.4/video1394.c branches/linux-2.4/video1394.h Log: Part 1: Conversion of video1349 to dma routines. Backported from trunk. Part 2: Conversion of ioctl's to a portable base. Modified: branches/linux-2.4/dv1394.h ============================================================================== --- branches/linux-2.4/dv1394.h (original) +++ branches/linux-2.4/dv1394.h 2003-02-11 13:03:07.000000000 -0500 @@ -242,6 +242,7 @@ DV1394_GET_STATUS, }; +#include "ieee1394-ioctl.h" enum pal_or_ntsc { Added: branches/linux-2.4/ieee1394-ioctl.h ============================================================================== --- branches/linux-2.4/ieee1394-ioctl.h (original) +++ branches/linux-2.4/ieee1394-ioctl.h 2003-02-11 13:03:07.000000000 -0500 @@ -0,0 +1,71 @@ +/* Base file for all ieee1394 ioctl's. Linux-1394 has allocated base '#' + * with a range of 0x00-0x3f. */ + +#ifndef __IEEE1394_IOCTL_H +#define __IEEE1394_IOCTL_H + +#include <asm/ioctl.h> +#include <asm/types.h> + + +/* AMDTP Gets 6 */ +#define AMDTP_IOC_CHANNEL _IOW('#', 0x00, struct amdtp_ioctl) +#define AMDTP_IOC_PLUG _IOW('#', 0x01, struct amdtp_ioctl) +#define AMDTP_IOC_PING _IOW('#', 0x02, struct amdtp_ioctl) +#define AMDTP_IOC_ZAP _IO ('#', 0x03) + + +/* DV1394 Gets 10 */ + +/* Get the driver ready to transmit video. pass a struct dv1394_init* as + * the parameter (see below), or NULL to get default parameters */ +#define DV1394_IOC_INIT _IOW('#', 0x06, struct dv1394_init) + +/* Stop transmitting video and free the ringbuffer */ +#define DV1394_IOC_SHUTDOWN _IO ('#', 0x07) + +/* Submit N new frames to be transmitted, where the index of the first new + * frame is first_clear_buffer, and the index of the last new frame is + * (first_clear_buffer + N) % n_frames */ +#define DV1394_IOC_SUBMIT_FRAMES _IO ('#', 0x08) + +/* Block until N buffers are clear (pass N as the parameter) Because we + * re-transmit the last frame on underrun, there will at most be n_frames + * - 1 clear frames at any time */ +#define DV1394_IOC_WAIT_FRAMES _IO ('#', 0x09) + +/* Capture new frames that have been received, where the index of the + * first new frame is first_clear_buffer, and the index of the last new + * frame is (first_clear_buffer + N) % n_frames */ +#define DV1394_IOC_RECEIVE_FRAMES _IO ('#', 0x0a) + +/* Tell card to start receiving DMA */ +#define DV1394_IOC_START_RECEIVE _IO ('#', 0x0b) + +/* Pass a struct dv1394_status* as the parameter */ +#define DV1394_IOC_GET_STATUS _IOR('#', 0x0c, struct dv1394_status) + + +/* Video1394 Gets 10 */ + +#define VIDEO1394_IOC_LISTEN_CHANNEL \ + _IOWR('#', 0x10, struct video1394_mmap) +#define VIDEO1394_IOC_UNLISTEN_CHANNEL \ + _IOW ('#', 0x11, int) +#define VIDEO1394_IOC_LISTEN_QUEUE_BUFFER \ + _IOW ('#', 0x12, struct video1394_wait) +#define VIDEO1394_IOC_LISTEN_WAIT_BUFFER \ + _IOWR('#', 0x13, struct video1394_wait) +#define VIDEO1394_IOC_TALK_CHANNEL \ + _IOWR('#', 0x14, struct video1394_mmap) +#define VIDEO1394_IOC_UNTALK_CHANNEL \ + _IOW ('#', 0x15, int) +#define VIDEO1394_IOC_TALK_QUEUE_BUFFER \ + _IOW ('#', 0x16, sizeof (struct video1394_wait) + \ + sizeof (struct video1394_queue_variable)) +#define VIDEO1394_IOC_TALK_WAIT_BUFFER \ + _IOW ('#', 0x17, struct video1394_wait) +#define VIDEO1394_IOC_LISTEN_POLL_BUFFER \ + _IOWR('#', 0x18, struct video1394_wait) + +#endif /* __IEEE1394_IOCTL_H */ Modified: branches/linux-2.4/amdtp.h ============================================================================== --- branches/linux-2.4/amdtp.h (original) +++ branches/linux-2.4/amdtp.h 2003-02-11 13:03:07.000000000 -0500 @@ -3,8 +3,8 @@ #ifndef __AMDTP_H #define __AMDTP_H -#include <asm/ioctl.h> #include <asm/types.h> +#include "ieee1394-ioctl.h" /* The userspace interface for the Audio & Music Data Transmission * Protocol driver is really simple. First, open /dev/amdtp, use the @@ -57,13 +57,6 @@ * */ -/* We use '#' for our ioctl magic number because it's cool. */ - -#define AMDTP_IOC_CHANNEL _IOW('#', 0, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PLUG _IOW('#', 1, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PING _IOW('#', 2, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_ZAP _IO('#', 3) - enum { AMDTP_FORMAT_RAW, AMDTP_FORMAT_IEC958_PCM, Modified: branches/linux-2.4/video1394.c ============================================================================== --- branches/linux-2.4/video1394.c (original) +++ branches/linux-2.4/video1394.c 2003-02-11 13:03:07.000000000 -0500 @@ -51,6 +51,7 @@ #include "ieee1394_core.h" #include "highlevel.h" #include "video1394.h" +#include "dma.h" #include "ohci1394.h" @@ -90,9 +91,14 @@ unsigned int packet_size; unsigned int left_size; unsigned int nb_cmd; - unsigned char *buf; + + struct dma_region dma; + + struct dma_prog_region *prg_reg; + struct dma_cmd **ir_prg; struct it_dma_prg **it_prg; + unsigned int *buffer_status; struct timeval *buffer_time; /* time when the buffer was received */ unsigned int *last_used_cmd; /* For ISO Transmit with @@ -155,74 +161,6 @@ static devfs_handle_t devfs_handle; static struct hpsb_highlevel *hl_handle = NULL; -/* Code taken from bttv.c */ - -/*******************************/ -/* Memory management functions */ -/*******************************/ - -static inline unsigned long kvirt_to_bus(unsigned long adr) -{ - unsigned long kva, ret; - - kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); - kva |= adr & (PAGE_SIZE-1); /* restore the offset */ - ret = virt_to_bus((void *)kva); - return ret; -} - -/* Here we want the physical address of the memory. - * This is used when initializing the contents of the area. - */ -static inline unsigned long kvirt_to_pa(unsigned long adr) -{ - unsigned long kva, ret; - - kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); - kva |= adr & (PAGE_SIZE-1); /* restore the offset */ - ret = __pa(kva); - return ret; -} - -static void * rvmalloc(unsigned long size) -{ - void * mem; - unsigned long adr; - - size=PAGE_ALIGN(size); - mem=vmalloc_32(size); - if (mem) - { - memset(mem, 0, size); /* Clear the ram out, - no junk to the user */ - adr=(unsigned long) mem; - while (size > 0) - { - mem_map_reserve(vmalloc_to_page((void *)adr)); - adr+=PAGE_SIZE; - size-=PAGE_SIZE; - } - } - return mem; -} - -static void rvfree(void * mem, unsigned long size) -{ - unsigned long adr; - - if (mem) - { - adr=(unsigned long) mem; - while ((long) size > 0) - { - mem_map_unreserve(vmalloc_to_page((void *)adr)); - adr+=PAGE_SIZE; - size-=PAGE_SIZE; - } - vfree(mem); - } -} -/* End of code taken from bttv.c */ static int free_dma_iso_ctx(struct dma_iso_ctx *d) { @@ -234,20 +172,19 @@ if (d->iso_tasklet.link.next != NULL) ohci1394_unregister_iso_tasklet(d->ohci, &d->iso_tasklet); - if (d->buf) - rvfree((void *)d->buf, d->num_desc * d->buf_size); + dma_region_free(&d->dma); - if (d->ir_prg) { - for (i=0;i<d->num_desc;i++) - if (d->ir_prg[i]) kfree(d->ir_prg[i]); - kfree(d->ir_prg); + if (d->prg_reg) { + for (i = 0; i < d->num_desc; i++) + dma_prog_region_free(&d->prg_reg[i]); + kfree(d->prg_reg); } - if (d->it_prg) { - for (i=0;i<d->num_desc;i++) - if (d->it_prg[i]) kfree(d->it_prg[i]); + if (d->ir_prg) + kfree(d->ir_prg); + + if (d->it_prg) kfree(d->it_prg); - } if (d->buffer_status) kfree(d->buffer_status); @@ -287,18 +224,17 @@ d->frame_size = buf_size; d->buf_size = PAGE_ALIGN(buf_size); d->last_buffer = -1; - d->buf = NULL; - d->ir_prg = NULL; init_waitqueue_head(&d->waitq); - d->buf = rvmalloc(d->num_desc * d->buf_size); + /* Init the regions for easy cleanup */ + dma_region_init(&d->dma); - if (d->buf == NULL) { + if (dma_region_alloc(&d->dma, d->num_desc * d->buf_size, ohci->dev, + PCI_DMA_BIDIRECTIONAL)) { PRINT(KERN_ERR, ohci->id, "Failed to allocate dma buffer"); free_dma_iso_ctx(d); return NULL; } - memset(d->buf, 0, d->num_desc * d->buf_size); if (type == OHCI_ISO_RECEIVE) ohci1394_init_iso_tasklet(&d->iso_tasklet, type, @@ -317,6 +253,17 @@ } d->ctx = d->iso_tasklet.context; + d->prg_reg = kmalloc(d->num_desc * sizeof(struct dma_prog_region), + GFP_KERNEL); + if (d->prg_reg == NULL) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate ir prg regs"); + free_dma_iso_ctx(d); + return NULL; + } + /* Makes for easier cleanup */ + for (i = 0; i < d->num_desc; i++) + dma_prog_region_init(&d->prg_reg[i]); + if (type == OHCI_ISO_RECEIVE) { d->ctrlSet = OHCI1394_IsoRcvContextControlSet+32*d->ctx; d->ctrlClear = OHCI1394_IsoRcvContextControlClear+32*d->ctx; @@ -327,31 +274,27 @@ GFP_KERNEL); if (d->ir_prg == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma ir prg"); + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma ir prg"); free_dma_iso_ctx(d); return NULL; } memset(d->ir_prg, 0, d->num_desc * sizeof(struct dma_cmd *)); - + d->nb_cmd = d->buf_size / PAGE_SIZE + 1; d->left_size = (d->frame_size % PAGE_SIZE) ? d->frame_size % PAGE_SIZE : PAGE_SIZE; - for (i=0;i<d->num_desc;i++) { - d->ir_prg[i] = kmalloc(d->nb_cmd * - sizeof(struct dma_cmd), - GFP_KERNEL); - if (d->ir_prg[i] == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma ir prg"); + for (i = 0;i < d->num_desc; i++) { + if (dma_prog_region_alloc(&d->prg_reg[i], d->nb_cmd * + sizeof(struct dma_cmd), ohci->dev)) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma ir prg"); free_dma_iso_ctx(d); return NULL; } + d->ir_prg[i] = (struct dma_cmd *)d->prg_reg[i].kvirt; } - } - else { /* OHCI_ISO_TRANSMIT */ + } else { /* OHCI_ISO_TRANSMIT */ d->ctrlSet = OHCI1394_IsoXmitContextControlSet+16*d->ctx; d->ctrlClear = OHCI1394_IsoXmitContextControlClear+16*d->ctx; d->cmdPtr = OHCI1394_IsoXmitCommandPtr+16*d->ctx; @@ -382,20 +325,17 @@ if (d->frame_size % d->packet_size) { d->nb_cmd++; d->left_size = d->frame_size % d->packet_size; - } - else + } else d->left_size = d->packet_size; - for (i=0;i<d->num_desc;i++) { - d->it_prg[i] = kmalloc(d->nb_cmd * - sizeof(struct it_dma_prg), - GFP_KERNEL); - if (d->it_prg[i] == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma it prg"); + for (i = 0; i < d->num_desc; i++) { + if (dma_prog_region_alloc(&d->prg_reg[i], d->nb_cmd * + sizeof(struct it_dma_prg), ohci->dev)) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma it prg"); free_dma_iso_ctx(d); return NULL; } + d->it_prg[i] = (struct it_dma_prg *)d->prg_reg[i].kvirt; } } @@ -448,7 +388,7 @@ int i; d->ir_prg[n][0].status = cpu_to_le32(4); d->ir_prg[n][1].status = cpu_to_le32(PAGE_SIZE-4); - for (i=2;i<d->nb_cmd-1;i++) + for (i = 2; i < d->nb_cmd - 1; i++) d->ir_prg[n][i].status = cpu_to_le32(PAGE_SIZE); d->ir_prg[n][i].status = cpu_to_le32(d->left_size); } @@ -456,7 +396,8 @@ static void initialize_dma_ir_prg(struct dma_iso_ctx *d, int n, int flags) { struct dma_cmd *ir_prg = d->ir_prg[n]; - unsigned long buf = (unsigned long)d->buf+n*d->buf_size; + struct dma_prog_region *ir_reg = &d->prg_reg[n]; + unsigned long buf = (unsigned long)d->dma.kvirt + n * d->buf_size; int i; /* the first descriptor will read only 4 bytes */ @@ -467,31 +408,37 @@ if (flags & VIDEO1394_SYNC_FRAMES) ir_prg[0].control |= cpu_to_le32(DMA_CTL_WAIT); - ir_prg[0].address = cpu_to_le32(kvirt_to_bus(buf)); - ir_prg[0].branchAddress = cpu_to_le32((virt_to_bus(&(ir_prg[1].control)) - & 0xfffffff0) | 0x1); + ir_prg[0].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, buf - + (unsigned long)d->dma.kvirt)); + ir_prg[0].branchAddress = cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + 1 * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); /* the second descriptor will read PAGE_SIZE-4 bytes */ ir_prg[1].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_BRANCH | (PAGE_SIZE-4)); - ir_prg[1].address = cpu_to_le32(kvirt_to_bus(buf+4)); - ir_prg[1].branchAddress = cpu_to_le32((virt_to_bus(&(ir_prg[2].control)) - & 0xfffffff0) | 0x1); + ir_prg[1].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, (buf + 4) - + (unsigned long)d->dma.kvirt)); + ir_prg[1].branchAddress = cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + 2 * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); for (i=2;i<d->nb_cmd-1;i++) { ir_prg[i].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_BRANCH | PAGE_SIZE); - ir_prg[i].address = cpu_to_le32(kvirt_to_bus(buf+(i-1)*PAGE_SIZE)); - - ir_prg[i].branchAddress = - cpu_to_le32((virt_to_bus(&(ir_prg[i+1].control)) - & 0xfffffff0) | 0x1); + ir_prg[i].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, + (buf+(i-1)*PAGE_SIZE) - + (unsigned long)d->dma.kvirt)); + + ir_prg[i].branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + (i + 1) * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); } /* the last descriptor will generate an interrupt */ ir_prg[i].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_IRQ | DMA_CTL_BRANCH | d->left_size); - ir_prg[i].address = cpu_to_le32(kvirt_to_bus(buf+(i-1)*PAGE_SIZE)); + ir_prg[i].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, + (buf+(i-1)*PAGE_SIZE) - + (unsigned long)d->dma.kvirt)); } static void initialize_dma_ir_ctx(struct dma_iso_ctx *d, int tag, int flags) @@ -566,7 +513,7 @@ static inline void put_timestamp(struct ti_ohci *ohci, struct dma_iso_ctx * d, int n) { - unsigned char* buf = d->buf + n * d->buf_size; + unsigned char* buf = d->dma.kvirt + n * d->buf_size; u32 cycleTimer; u32 timeStamp; @@ -595,7 +542,7 @@ if (n == -1) { return; } - buf = d->buf + n * d->buf_size; + buf = d->dma.kvirt + n * d->buf_size; timeStamp += (d->last_used_cmd[n] << 12) & 0xffff; @@ -642,7 +589,8 @@ static void initialize_dma_it_prg(struct dma_iso_ctx *d, int n, int sync_tag) { struct it_dma_prg *it_prg = d->it_prg[n]; - unsigned long buf = (unsigned long)d->buf+n*d->buf_size; + struct dma_prog_region *it_reg = &d->prg_reg[n]; + unsigned long buf = (unsigned long)d->dma.kvirt + n * d->buf_size; int i; d->last_used_cmd[n] = d->nb_cmd - 1; for (i=0;i<d->nb_cmd;i++) { @@ -666,18 +614,18 @@ it_prg[i].end.control = cpu_to_le32(DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH); it_prg[i].end.address = - cpu_to_le32(kvirt_to_bus(buf+i*d->packet_size)); + cpu_to_le32(dma_region_offset_to_bus(&d->dma, (buf+i*d->packet_size) - + (unsigned long)d->dma.kvirt)); if (i<d->nb_cmd-1) { it_prg[i].end.control |= cpu_to_le32(d->packet_size); it_prg[i].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); it_prg[i].end.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); - } - else { + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); + } else { /* the last prg generates an interrupt */ it_prg[i].end.control |= cpu_to_le32(DMA_CTL_UPDATE | DMA_CTL_IRQ | d->left_size); @@ -686,15 +634,6 @@ it_prg[i].end.branchAddress = 0; } it_prg[i].end.status = 0; - -#if 0 - printk("%d:%d: %08x-%08x ctrl %08x brch %08x d0 %08x d1 %08x\n",n,i, - virt_to_bus(&(it_prg[i].begin.control)), - virt_to_bus(&(it_prg[i].end.control)), - it_prg[i].end.control, - it_prg[i].end.branchAddress, - it_prg[i].data[0], it_prg[i].data[1]); -#endif } } @@ -703,6 +642,7 @@ struct ti_ohci *ohci) { struct it_dma_prg *it_prg = d->it_prg[n]; + struct dma_prog_region *it_reg = &d->prg_reg[n]; int i; #if 0 @@ -724,12 +664,12 @@ if (i < d->nb_cmd-1 && packet_sizes[i+1] != 0) { it_prg[i].end.control |= cpu_to_le32(size); - it_prg[i].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); - it_prg[i].end.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); + it_prg[i].begin.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); + it_prg[i].end.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); } else { /* the last prg generates an interrupt */ it_prg[i].end.control |= cpu_to_le32(DMA_CTL_UPDATE | @@ -761,37 +701,6 @@ reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1<<d->ctx); } -static int do_iso_mmap(struct ti_ohci *ohci, struct dma_iso_ctx *d, - struct vm_area_struct *vma) -{ - unsigned long start = vma->vm_start; - unsigned long size = vma->vm_end - vma->vm_start; - unsigned long page, pos; - - if (size > d->num_desc * d->buf_size) { - PRINT(KERN_ERR, ohci->id, - "iso context %d buf size is different from mmap size", - d->ctx); - return -EINVAL; - } - if (!d->buf) { - PRINT(KERN_ERR, ohci->id, - "iso context %d is not allocated", d->ctx); - return -EINVAL; - } - - pos = (unsigned long) d->buf; - while (size > 0) { - page = kvirt_to_pa(pos); - if (remap_page_range_1394(vma, start, page, PAGE_SIZE, PAGE_SHARED)) - return -EAGAIN; - start += PAGE_SIZE; - pos += PAGE_SIZE; - size -= PAGE_SIZE; - } - return 0; -} - static int video1394_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { @@ -804,6 +713,8 @@ { case VIDEO1394_LISTEN_CHANNEL: case VIDEO1394_TALK_CHANNEL: + case VIDEO1394_IOC_LISTEN_CHANNEL: + case VIDEO1394_IOC_TALK_CHANNEL: { struct video1394_mmap v; u64 mask; @@ -862,7 +773,7 @@ return -EFAULT; } - if (cmd == VIDEO1394_LISTEN_CHANNEL) { + if (cmd == VIDEO1394_IOC_LISTEN_CHANNEL || cmd == VIDEO1394_LISTEN_CHANNEL) { d = alloc_dma_iso_ctx(ohci, OHCI_ISO_RECEIVE, v.nb_buffers, v.buf_size, v.channel, 0); @@ -912,8 +823,10 @@ return 0; } - case VIDEO1394_UNLISTEN_CHANNEL: + case VIDEO1394_UNLISTEN_CHANNEL: case VIDEO1394_UNTALK_CHANNEL: + case VIDEO1394_IOC_UNLISTEN_CHANNEL: + case VIDEO1394_IOC_UNTALK_CHANNEL: { int channel; u64 mask; @@ -937,7 +850,7 @@ /* Mark this channel as unused */ ohci->ISO_channel_usage &= ~mask; - if (cmd == VIDEO1394_UNLISTEN_CHANNEL) + if (cmd == VIDEO1394_IOC_UNLISTEN_CHANNEL || cmd == VIDEO1394_UNLISTEN_CHANNEL) d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, channel); else d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, channel); @@ -950,6 +863,7 @@ return 0; } case VIDEO1394_LISTEN_QUEUE_BUFFER: + case VIDEO1394_IOC_LISTEN_QUEUE_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -976,10 +890,10 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_QUEUED; - if (d->last_buffer>=0) - d->ir_prg[d->last_buffer][d->nb_cmd-1].branchAddress = - cpu_to_le32((virt_to_bus(&(d->ir_prg[v.buffer][0].control)) - & 0xfffffff0) | 0x1); + if (d->last_buffer>=0) + d->ir_prg[d->last_buffer][d->nb_cmd-1].branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) + & 0xfffffff0) | 0x1); d->last_buffer = v.buffer; @@ -992,9 +906,9 @@ DBGMSG(ohci->id, "Starting iso DMA ctx=%d",d->ctx); /* Tell the controller where the first program is */ - reg_write(ohci, d->cmdPtr, - virt_to_bus(&(d->ir_prg[v.buffer][0]))|0x1); - + reg_write(ohci, d->cmdPtr, + dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) | 0x1); + /* Run IR context */ reg_write(ohci, d->ctrlSet, 0x8000); } @@ -1011,6 +925,8 @@ } case VIDEO1394_LISTEN_WAIT_BUFFER: case VIDEO1394_LISTEN_POLL_BUFFER: + case VIDEO1394_IOC_LISTEN_WAIT_BUFFER: + case VIDEO1394_IOC_LISTEN_POLL_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -1037,7 +953,8 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE; break; case VIDEO1394_BUFFER_QUEUED: - if (cmd == VIDEO1394_LISTEN_POLL_BUFFER) { + if (cmd == VIDEO1394_IOC_LISTEN_POLL_BUFFER || + cmd == VIDEO1394_LISTEN_POLL_BUFFER) { /* for polling, return error code EINTR */ spin_unlock_irqrestore(&d->lock, flags); return -EINTR; @@ -1092,6 +1009,7 @@ return 0; } case VIDEO1394_TALK_QUEUE_BUFFER: + case VIDEO1394_IOC_TALK_QUEUE_BUFFER: { struct video1394_wait v; struct video1394_queue_variable qv; @@ -1134,18 +1052,16 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_QUEUED; - if (d->last_buffer>=0) { + if (d->last_buffer >= 0) { d->it_prg[d->last_buffer] - [ d->last_used_cmd[d->last_buffer] - ].end.branchAddress = - cpu_to_le32((virt_to_bus(&(d->it_prg[v.buffer][0].begin.control)) - & 0xfffffff0) | 0x3); + [ d->last_used_cmd[d->last_buffer] ].end.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], + 0) & 0xfffffff0) | 0x3); d->it_prg[d->last_buffer] - [d->last_used_cmd[d->last_buffer] - ].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(d->it_prg[v.buffer][0].begin.control)) - & 0xfffffff0) | 0x3); + [ d->last_used_cmd[d->last_buffer] ].begin.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], + 0) & 0xfffffff0) | 0x3); d->next_buffer[d->last_buffer] = v.buffer; } d->last_buffer = v.buffer; @@ -1162,9 +1078,9 @@ put_timestamp(ohci, d, d->last_buffer); /* Tell the controller where the first program is */ - reg_write(ohci, d->cmdPtr, - virt_to_bus(&(d->it_prg[v.buffer][0]))|0x3); - + reg_write(ohci, d->cmdPtr, + dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) | 0x3); + /* Run IT context */ reg_write(ohci, d->ctrlSet, 0x8000); } @@ -1182,6 +1098,7 @@ } case VIDEO1394_TALK_WAIT_BUFFER: + case VIDEO1394_IOC_TALK_WAIT_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -1250,7 +1167,7 @@ if (ctx->current_ctx == NULL) { PRINT(KERN_ERR, ohci->id, "Current iso context not set"); } else - res = do_iso_mmap(ohci, ctx->current_ctx, vma); + res = dma_region_mmap(&ctx->current_ctx->dma, file, vma); unlock_kernel(); return res; } Modified: branches/linux-2.4/dv1394.c ============================================================================== --- branches/linux-2.4/dv1394.c (original) +++ branches/linux-2.4/dv1394.c 2003-02-11 13:03:07.000000000 -0500 @@ -1608,7 +1608,8 @@ switch(cmd) { - case DV1394_SUBMIT_FRAMES: { + case DV1394_SUBMIT_FRAMES: + case DV1394_IOC_SUBMIT_FRAMES: { unsigned int n_submit; if( !video_card_initialized(video) ) { @@ -1661,8 +1662,8 @@ ret = 0; break; } - - case DV1394_WAIT_FRAMES: { + case DV1394_WAIT_FRAMES: + case DV1394_IOC_WAIT_FRAMES: { unsigned int n_wait; if( !video_card_initialized(video) ) { @@ -1710,8 +1711,8 @@ ret = 0; break; } - - case DV1394_RECEIVE_FRAMES: { + case DV1394_RECEIVE_FRAMES: + case DV1394_IOC_RECEIVE_FRAMES: { unsigned int n_recv; if( !video_card_initialized(video) ) { @@ -1743,8 +1744,8 @@ ret = 0; break; } - - case DV1394_START_RECEIVE: { + case DV1394_START_RECEIVE: + case DV1394_IOC_START_RECEIVE: { if( !video_card_initialized(video) ) { ret = do_dv1394_init_default(video); if(ret) @@ -1760,8 +1761,8 @@ ret = 0; break; } - - case DV1394_INIT: { + case DV1394_INIT: + case DV1394_IOC_INIT: { struct dv1394_init init; if(arg == (unsigned long) NULL) { ret = do_dv1394_init_default(video); @@ -1774,13 +1775,13 @@ } break; } - case DV1394_SHUTDOWN: + case DV1394_IOC_SHUTDOWN: ret = do_dv1394_shutdown(video, 0); break; - - case DV1394_GET_STATUS: { + case DV1394_GET_STATUS: + case DV1394_IOC_GET_STATUS: { struct dv1394_status status; if( !video_card_initialized(video) ) { Modified: branches/linux-2.4/video1394.h ============================================================================== --- branches/linux-2.4/video1394.h (original) +++ branches/linux-2.4/video1394.h 2003-02-11 13:03:07.000000000 -0500 @@ -21,6 +21,8 @@ #ifndef _VIDEO_1394_H #define _VIDEO_1394_H +#include "ieee1394-ioctl.h" + #define VIDEO1394_DRIVER_NAME "video1394" #define VIDEO1394_MAX_SIZE 0x4000000 |
From: SVN U. <ben...@li...> - 2003-02-10 23:39:49
|
Author: bencollins Date: 2003-02-10 18:39:12 -0500 (Mon, 10 Feb 2003) New Revision: 779 Modified: trunk/sbp2.c Log: Fix typo in last commit. Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c 2003-02-10 18:39:13.000000000 -0500 @@ -2888,7 +2888,7 @@ */ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt) { - struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->device->hostdata[0]; + struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->device->host->hostdata[0]; struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->device->id]; struct sbp2_command_info *command; unsigned long flags; @@ -2938,7 +2938,7 @@ */ static int sbp2scsi_reset (Scsi_Cmnd *SCpnt) { - struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->device->hostdata[0]; + struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->device->host->hostdata[0]; struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->device->id]; SBP2_ERR("reset requested"); |
From: SVN U. <ben...@li...> - 2003-02-10 23:06:51
|
Author: bencollins Date: 2003-02-10 18:06:18 -0500 (Mon, 10 Feb 2003) New Revision: 778 Modified: trunk/sbp2.c Log: Merge from 2.5.60. Updates to scsi layer. Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c 2003-02-10 18:06:19.000000000 -0500 @@ -822,7 +822,7 @@ { struct sbp2scsi_host_info *hi; - hi = (struct sbp2scsi_host_info *) command->Current_SCpnt->host->hostdata[0]; + hi = (struct sbp2scsi_host_info *) command->Current_SCpnt->device->host->hostdata[0]; if (hi == NULL) { printk(KERN_ERR "%s: hi == NULL\n", __FUNCTION__); @@ -2661,7 +2661,7 @@ /* * Pull our host info and scsi id instance data from the scsi command */ - hi = (struct sbp2scsi_host_info *) SCpnt->host->hostdata[0]; + hi = (struct sbp2scsi_host_info *) SCpnt->device->host->hostdata[0]; if (!hi) { SBP2_ERR("sbp2scsi_host_info is NULL - this is bad!"); @@ -2670,7 +2670,7 @@ return(0); } - scsi_id = hi->scsi_id[SCpnt->target]; + scsi_id = hi->scsi_id[SCpnt->device->id]; /* * If scsi_id is null, it means there is no device in this slot, @@ -2686,7 +2686,7 @@ * Until we handle multiple luns, just return selection time-out * to any IO directed at non-zero LUNs */ - if (SCpnt->lun) { + if (SCpnt->device->lun) { SCpnt->result = DID_NO_CONNECT << 16; done (SCpnt); return(0); @@ -2888,8 +2888,8 @@ */ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt) { - struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->hostdata[0]; - struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->target]; + struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->device->hostdata[0]; + struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->device->id]; struct sbp2_command_info *command; unsigned long flags; @@ -2938,8 +2938,8 @@ */ static int sbp2scsi_reset (Scsi_Cmnd *SCpnt) { - struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->hostdata[0]; - struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->target]; + struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->device->hostdata[0]; + struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->device->id]; SBP2_ERR("reset requested"); |
From: SVN U. <ben...@li...> - 2003-02-10 23:06:20
|
Author: bencollins Date: 2003-02-10 18:05:47 -0500 (Mon, 10 Feb 2003) New Revision: 777 Modified: trunk/Kconfig Log: Merge change from 2.5.60. Removes the .o from module names. Modified: trunk/Kconfig ============================================================================== --- trunk/Kconfig (original) +++ trunk/Kconfig 2003-02-10 18:05:48.000000000 -0500 @@ -18,7 +18,7 @@ If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module - will be called ieee1394.o. + will be called ieee1394. comment "Subsystem Options" depends on IEEE1394 @@ -67,7 +67,7 @@ If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module - will be called pcilynx.o. + will be called pcilynx. # Non-maintained pcilynx options # if [ "$CONFIG_IEEE1394_PCILYNX" != "n" ]; then @@ -87,7 +87,7 @@ If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module - will be called ohci1394.o. + will be called ohci1394. comment "Protocol Drivers" depends on IEEE1394 @@ -131,7 +131,7 @@ If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module - will be called dv1394.o. + will be called dv1394. config IEEE1394_RAWIO tristate "Raw IEEE1394 I/O support" @@ -145,7 +145,7 @@ If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module - will be called raw1394.o. + will be called raw1394. config IEEE1394_CMP tristate "IEC61883-1 Plug support" @@ -157,7 +157,7 @@ If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module - will be called amdtp.o. + will be called amdtp. config IEEE1394_AMDTP tristate "IEC61883-6 (Audio transmission) support" @@ -172,6 +172,6 @@ If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module - will be called amdtp.o. + will be called amdtp. endmenu |
From: SVN U. <ben...@li...> - 2003-02-10 23:05:59
|
Author: bencollins Date: 2003-02-10 18:05:14 -0500 (Mon, 10 Feb 2003) New Revision: 776 Modified: trunk/Makefile Log: Remove export-objs. Merged from 2.5.60 Modified: trunk/Makefile ============================================================================== --- trunk/Makefile (original) +++ trunk/Makefile 2003-02-10 18:05:14.000000000 -0500 @@ -2,8 +2,6 @@ # Makefile for the Linux IEEE 1394 implementation # -export-objs := ieee1394_core.o ohci1394.o cmp.o - ieee1394-objs := ieee1394_core.o ieee1394_transactions.o hosts.o \ highlevel.o csr.o nodemgr.o oui.o dma.o iso.o |
From: SVN U. <ben...@li...> - 2003-02-08 17:38:25
|
Author: bencollins Date: 2003-02-08 12:37:47 -0500 (Sat, 08 Feb 2003) New Revision: 775 Modified: trunk/video1394.c Log: Pass correct size to dma_region_alloc Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-08 12:37:47.000000000 -0500 @@ -233,7 +233,8 @@ /* Init the regions for easy cleanup */ dma_region_init(&d->dma); - if (dma_region_alloc(&d->dma, d->buf_size, ohci->dev, PCI_DMA_BIDIRECTIONAL)) { + if (dma_region_alloc(&d->dma, d->num_desc * d->buf_size, ohci->dev, + PCI_DMA_BIDIRECTIONAL)) { PRINT(KERN_ERR, ohci->id, "Failed to allocate dma buffer"); free_dma_iso_ctx(d); return NULL; |
From: SVN U. <ben...@li...> - 2003-02-08 16:37:54
|
Author: bencollins Date: 2003-02-08 11:37:14 -0500 (Sat, 08 Feb 2003) New Revision: 774 Modified: trunk/video1394.c Log: Typo in new dma reg usage. Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-08 11:37:15.000000000 -0500 @@ -258,7 +258,7 @@ d->prg_reg = kmalloc(d->num_desc * sizeof(struct dma_prog_region), GFP_KERNEL); - if (d->ir_prg == NULL) { + if (d->prg_reg == NULL) { PRINT(KERN_ERR, ohci->id, "Failed to allocate ir prg regs"); free_dma_iso_ctx(d); return NULL; |
From: SVN U. <ben...@li...> - 2003-02-06 17:16:48
|
Author: bencollins Date: 2003-02-06 12:16:11 -0500 (Thu, 06 Feb 2003) New Revision: 773 Modified: branches/linux-2.4/sbp2.c Log: Patch from Sancho Dauskard removing sbp2 spinlock wrappers Modified: branches/linux-2.4/sbp2.c ============================================================================== --- branches/linux-2.4/sbp2.c (original) +++ branches/linux-2.4/sbp2.c 2003-02-06 12:16:12.000000000 -0500 @@ -516,22 +516,10 @@ #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) /* - * Spinlock debugging stuff. + * Globals */ -#define SBP2_USE_REAL_SPINLOCKS -#ifdef SBP2_USE_REAL_SPINLOCKS -#define sbp2_spin_lock(lock, flags) spin_lock_irqsave(lock, flags) -#define sbp2_spin_unlock(lock, flags) spin_unlock_irqrestore(lock, flags); static spinlock_t sbp2_host_info_lock = SPIN_LOCK_UNLOCKED; -#else -#define sbp2_spin_lock(lock, flags) do {save_flags(flags); cli();} while (0) -#define sbp2_spin_unlock(lock, flags) do {restore_flags(flags);} while (0) -#endif - -/* - * Globals - */ static Scsi_Host_Template scsi_driver_template; @@ -727,7 +715,7 @@ /* * Go through free list releasing packets */ - sbp2_spin_lock(&hi->sbp2_request_packet_lock, flags); + spin_lock_irqsave(&hi->sbp2_request_packet_lock, flags); while (!list_empty(&hi->sbp2_req_free)) { lh = hi->sbp2_req_free.next; @@ -744,7 +732,7 @@ } kfree(hi->request_packet); - sbp2_spin_unlock(&hi->sbp2_request_packet_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_request_packet_lock, flags); return; } @@ -766,7 +754,7 @@ struct hpsb_packet *packet; unsigned long flags; - sbp2_spin_lock(&hi->sbp2_request_packet_lock, flags); + spin_lock_irqsave(&hi->sbp2_request_packet_lock, flags); if (!list_empty(&hi->sbp2_req_free)) { /* @@ -817,7 +805,7 @@ } else { SBP2_ERR("sbp2util_allocate_request_packet - no packets available!"); } - sbp2_spin_unlock(&hi->sbp2_request_packet_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_request_packet_lock, flags); return(request_packet); } @@ -834,12 +822,12 @@ /* * Free the tlabel, and return the packet to the free pool. */ - sbp2_spin_lock(&hi->sbp2_request_packet_lock, flags); + spin_lock_irqsave(&hi->sbp2_request_packet_lock, flags); free_tlabel(hi->host, LOCAL_BUS | request_packet->packet->node_id, request_packet->packet->tlabel); list_del(&request_packet->list); list_add_tail(&request_packet->list, &hi->sbp2_req_free); - sbp2_spin_unlock(&hi->sbp2_request_packet_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_request_packet_lock, flags); return; } @@ -855,12 +843,12 @@ unsigned long flags; struct sbp2_command_info *command; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); for (i = 0; i < scsi_id->sbp2_total_command_orbs; i++) { command = (struct sbp2_command_info *) kmalloc(sizeof(struct sbp2_command_info), GFP_KERNEL); if (!command) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return(-ENOMEM); } memset(command, '\0', sizeof(struct sbp2_command_info)); @@ -877,7 +865,7 @@ INIT_LIST_HEAD(&command->list); list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return 0; } @@ -891,7 +879,7 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { list_for_each_safe(lh, next, &scsi_id->sbp2_command_orb_completed) { command = list_entry(lh, struct sbp2_command_info, list); @@ -909,7 +897,7 @@ kfree(command); } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return; } @@ -924,17 +912,17 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { command = list_entry(lh, struct sbp2_command_info, list); if (command->command_orb_dma == orb) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb); @@ -951,17 +939,17 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { command = list_entry(lh, struct sbp2_command_info, list); if (command->Current_SCpnt == SCpnt) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return(NULL); } @@ -978,7 +966,7 @@ struct sbp2_command_info *command = NULL; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { lh = scsi_id->sbp2_command_orb_completed.next; list_del(lh); @@ -989,7 +977,7 @@ } else { SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } @@ -1034,11 +1022,11 @@ { unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); list_del(&command->list); sbp2util_free_command_dma(command); list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); } @@ -1161,9 +1149,9 @@ /* Complete any pending commands with busy (so they get * retried) and remove them from our queue */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); sbp2scsi_complete_all_commands(hi, scsi_id, DID_BUS_BUSY); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); } /* @@ -1202,9 +1190,9 @@ return; } - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); list_add_tail(&hi->list, &sbp2_host_info_list); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); /* Register our host with the SCSI stack. */ hi->scsi_host = scsi_register (&scsi_driver_template, sizeof(void *)); @@ -1263,7 +1251,7 @@ SBP2_DEBUG("sbp2_remove_host"); - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); hi = sbp2_find_host_info(host); if (hi != NULL) { @@ -1274,7 +1262,7 @@ else SBP2_ERR("attempt to remove unknown host %p", host); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); } /* @@ -2714,16 +2702,16 @@ return(RCODE_ADDRESS_ERROR); } - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); hi = sbp2_find_host_info(host); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); if (!hi) { SBP2_ERR("host info is NULL - this is bad!"); return(RCODE_ADDRESS_ERROR); } - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); /* * Find our scsi_id structure by looking at the status fifo address written to by @@ -2734,7 +2722,7 @@ if (!scsi_id) { SBP2_ERR("scsi_id is NULL - device is gone?"); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); return(RCODE_ADDRESS_ERROR); } @@ -2821,7 +2809,7 @@ } } - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); if (SCpnt) { @@ -2917,12 +2905,12 @@ /* * Try and send our SCSI command */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); if (sbp2_send_command(hi, scsi_id, SCpnt, done)) { SBP2_ERR("Error sending SCSI command"); sbp2scsi_complete_command(hi, scsi_id, SBP2_SCSI_STATUS_SELECTION_TIMEOUT, SCpnt, done); } - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); return(0); } @@ -3096,7 +3084,7 @@ * Right now, just return any matching command structures * to the free pool. */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt); if (command) { SBP2_DEBUG("Found command to abort"); @@ -3121,7 +3109,7 @@ */ sbp2_agent_reset(hi, scsi_id, SBP2_SEND_NO_WAIT); sbp2scsi_complete_all_commands(hi, scsi_id, DID_BUS_BUSY); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); } return(SUCCESS); |
From: SVN U. <ben...@li...> - 2003-02-06 17:04:04
|
Author: bencollins Date: 2003-02-06 12:03:31 -0500 (Thu, 06 Feb 2003) New Revision: 772 Modified: trunk/sbp2.c Log: Patch from Sancho Dauskard removing sbp2 spinlock wrappers Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c 2003-02-06 12:03:32.000000000 -0500 @@ -298,6 +298,7 @@ * 06/09/02 - Don't force 36-bute SCSI inquiry, but leave in a define for badly behaved devices. (JSG) * 02/04/03 - Fixed a SMP deadlock (don't hold sbp2_command_lock while calling sbp2scsi_complete_command). * Also save/restore irq flags in sbp2scsi_complete_command - Sancho Dauskardt <sd...@bd...> + * 02/06/03 - Removed spinlock debugging; use kernel stuff instead (sda) * */ @@ -491,19 +492,6 @@ #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) -/* - * Spinlock debugging stuff. - */ -#define SBP2_USE_REAL_SPINLOCKS - -#ifdef SBP2_USE_REAL_SPINLOCKS -#define sbp2_spin_lock(lock, flags) spin_lock_irqsave(lock, flags) -#define sbp2_spin_unlock(lock, flags) spin_unlock_irqrestore(lock, flags); -static spinlock_t sbp2_host_info_lock = SPIN_LOCK_UNLOCKED; -#else -#define sbp2_spin_lock(lock, flags) do {save_flags(flags); cli();} while (0) -#define sbp2_spin_unlock(lock, flags) do {restore_flags(flags);} while (0) -#endif /* * Globals @@ -515,6 +503,8 @@ static LIST_HEAD(sbp2_host_info_list); +static spinlock_t sbp2_host_info_lock = SPIN_LOCK_UNLOCKED; + static struct hpsb_highlevel *sbp2_hl_handle = NULL; static struct hpsb_highlevel_ops sbp2_hl_ops = { @@ -689,12 +679,12 @@ orbs = sbp2_serialize_io ? 2 : SBP2_MAX_COMMAND_ORBS; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); for (i = 0; i < orbs; i++) { command = (struct sbp2_command_info *) kmalloc(sizeof(struct sbp2_command_info), GFP_KERNEL); if (!command) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return(-ENOMEM); } memset(command, '\0', sizeof(struct sbp2_command_info)); @@ -711,7 +701,7 @@ INIT_LIST_HEAD(&command->list); list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return 0; } @@ -725,7 +715,7 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { list_for_each_safe(lh, next, &scsi_id->sbp2_command_orb_completed) { command = list_entry(lh, struct sbp2_command_info, list); @@ -743,7 +733,7 @@ kfree(command); } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return; } @@ -758,17 +748,17 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { command = list_entry(lh, struct sbp2_command_info, list); if (command->command_orb_dma == orb) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb); @@ -785,17 +775,17 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { command = list_entry(lh, struct sbp2_command_info, list); if (command->Current_SCpnt == SCpnt) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return(NULL); } @@ -812,7 +802,7 @@ struct sbp2_command_info *command = NULL; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { lh = scsi_id->sbp2_command_orb_completed.next; list_del(lh); @@ -823,7 +813,7 @@ } else { SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } @@ -868,11 +858,11 @@ { unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); list_del(&command->list); sbp2util_free_command_dma(command); list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); } @@ -995,9 +985,9 @@ /* Complete any pending commands with busy (so they get * retried) and remove them from our queue */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); sbp2scsi_complete_all_commands(hi, scsi_id, DID_BUS_BUSY); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); } /* @@ -1027,9 +1017,9 @@ hi->host = host; hi->sbp2_command_lock = SPIN_LOCK_UNLOCKED; - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); list_add_tail(&hi->list, &sbp2_host_info_list); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); /* Register our host with the SCSI stack. */ hi->scsi_host = scsi_register (&scsi_driver_template, sizeof(void *)); @@ -1088,7 +1078,7 @@ SBP2_DEBUG("sbp2_remove_host"); - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); hi = sbp2_find_host_info(host); if (hi != NULL) { @@ -1098,7 +1088,7 @@ else SBP2_ERR("attempt to remove unknown host %p", host); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); } /* @@ -2524,16 +2514,16 @@ return(RCODE_ADDRESS_ERROR); } - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); hi = sbp2_find_host_info(host); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); if (!hi) { SBP2_ERR("host info is NULL - this is bad!"); return(RCODE_ADDRESS_ERROR); } - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); /* * Find our scsi_id structure by looking at the status fifo address written to by @@ -2544,7 +2534,7 @@ if (!scsi_id) { SBP2_ERR("scsi_id is NULL - device is gone?"); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); return(RCODE_ADDRESS_ERROR); } @@ -2631,7 +2621,7 @@ } } - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); if (SCpnt) { @@ -2727,12 +2717,12 @@ /* * Try and send our SCSI command */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); if (sbp2_send_command(hi, scsi_id, SCpnt, done)) { SBP2_ERR("Error sending SCSI command"); sbp2scsi_complete_command(hi, scsi_id, SBP2_SCSI_STATUS_SELECTION_TIMEOUT, SCpnt, done); } - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); return(0); } @@ -2912,7 +2902,7 @@ * Right now, just return any matching command structures * to the free pool. */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt); if (command) { SBP2_DEBUG("Found command to abort"); @@ -2937,7 +2927,7 @@ */ sbp2_agent_reset(hi, scsi_id, 0); sbp2scsi_complete_all_commands(hi, scsi_id, DID_BUS_BUSY); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); } return(SUCCESS); |
From: SVN U. <ben...@li...> - 2003-02-05 20:51:52
|
Author: bencollins Date: 2003-02-05 15:51:19 -0500 (Wed, 05 Feb 2003) New Revision: 771 Modified: branches/linux-2.4/eth1394.c Log: Patch as a result of the Stanford Checker. Fixes possible memleak. Modified: branches/linux-2.4/eth1394.c ============================================================================== --- branches/linux-2.4/eth1394.c (original) +++ branches/linux-2.4/eth1394.c 2003-02-05 15:51:20.000000000 -0500 @@ -368,6 +368,7 @@ if (register_netdev (dev)) { ETH1394_PRINT (KERN_ERR, dev->name, "Error registering network driver\n"); kfree (dev); + kfree (hi); return; } |
From: SVN U. <ben...@li...> - 2003-02-05 20:51:41
|
Author: bencollins Date: 2003-02-05 15:50:49 -0500 (Wed, 05 Feb 2003) New Revision: 770 Modified: trunk/eth1394.c Log: Patch as a result of the Stanford Checker. Fixes possible memleak. Modified: trunk/eth1394.c ============================================================================== --- trunk/eth1394.c (original) +++ trunk/eth1394.c 2003-02-05 15:50:49.000000000 -0500 @@ -368,6 +368,7 @@ if (register_netdev (dev)) { ETH1394_PRINT (KERN_ERR, dev->name, "Error registering network driver\n"); kfree (dev); + kfree (hi); return; } |
From: SVN U. <ben...@li...> - 2003-02-05 04:43:30
|
Author: bencollins Date: 2003-02-04 23:42:57 -0500 (Tue, 04 Feb 2003) New Revision: 769 Modified: branches/linux-2.4/sbp2.c Log: Backport fix for sbp2 SMP lockups. Modified: branches/linux-2.4/sbp2.c ============================================================================== --- branches/linux-2.4/sbp2.c (original) +++ branches/linux-2.4/sbp2.c 2003-02-04 23:42:58.000000000 -0500 @@ -298,6 +298,9 @@ * returns the dead bit in status. Thanks to Chandan (ch...@to...) for this one. * 04/27/02 - Fix sbp2 login problem on SMP systems, enable real spinlocks by default. (JSG) * 06/09/02 - Don't force 36-bute SCSI inquiry, but leave in a define for badly behaved devices. (JSG) + * 02/04/03 - Fixed a SMP deadlock (don't hold sbp2_command_lock while calling sbp2scsi_complete_command). + * Also save/restore irq flags in sbp2scsi_complete_command - Sancho Dauskardt <sd...@bd...> + * */ @@ -2795,13 +2798,6 @@ } SBP2_ORB_DEBUG("completing command orb %p", &command->command_orb); - - /* - * Complete the SCSI command - */ - SBP2_DEBUG("Completing SCSI command"); - sbp2scsi_complete_command(hi, scsi_id, scsi_status, SCpnt, command->Current_done); - SBP2_ORB_DEBUG("command orb completed"); } /* @@ -2826,6 +2822,22 @@ } sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + + + if (SCpnt) { + + /* + * Complete the SCSI command. + * + * Only do it after we've released the sbp2_command_lock, + * as it might otherwise deadlock with the + * io_request_lock (in sbp2scsi_queuecommand). + */ + SBP2_DEBUG("Completing SCSI command"); + sbp2scsi_complete_command(hi, scsi_id, scsi_status, SCpnt, command->Current_done); + SBP2_ORB_DEBUG("command orb completed"); + } + return(RCODE_COMPLETE); } @@ -2951,10 +2963,14 @@ /* * This function is called in order to complete a regular SBP-2 command. + * + * This can be called in interrupt context. */ static void sbp2scsi_complete_command(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, u32 scsi_status, Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) { + unsigned long flags; + SBP2_DEBUG("sbp2scsi_complete_command"); /* @@ -3053,9 +3069,9 @@ /* * Tell scsi stack that we're done with this command */ - spin_lock_irq(&io_request_lock); + spin_lock_irqsave(&io_request_lock, flags); done (SCpnt); - spin_unlock_irq(&io_request_lock); + spin_unlock_irqrestore(&io_request_lock, flags); return; } |
From: SVN U. <ben...@li...> - 2003-02-05 04:41:53
|
Author: bencollins Date: 2003-02-04 23:41:18 -0500 (Tue, 04 Feb 2003) New Revision: 768 Modified: trunk/sbp2.c Log: Patch from Sancho Dauskard fixing sbp2 SMP lockups. Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c 2003-02-04 23:41:19.000000000 -0500 @@ -296,6 +296,9 @@ * returns the dead bit in status. Thanks to Chandan (ch...@to...) for this one. * 04/27/02 - Fix sbp2 login problem on SMP systems, enable real spinlocks by default. (JSG) * 06/09/02 - Don't force 36-bute SCSI inquiry, but leave in a define for badly behaved devices. (JSG) + * 02/04/03 - Fixed a SMP deadlock (don't hold sbp2_command_lock while calling sbp2scsi_complete_command). + * Also save/restore irq flags in sbp2scsi_complete_command - Sancho Dauskardt <sd...@bd...> + * */ @@ -2605,13 +2608,6 @@ } SBP2_ORB_DEBUG("completing command orb %p", &command->command_orb); - - /* - * Complete the SCSI command - */ - SBP2_DEBUG("Completing SCSI command"); - sbp2scsi_complete_command(hi, scsi_id, scsi_status, SCpnt, command->Current_done); - SBP2_ORB_DEBUG("command orb completed"); } /* @@ -2636,6 +2632,22 @@ } sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + + + if (SCpnt) { + + /* + * Complete the SCSI command. + * + * Only do it after we've released the sbp2_command_lock, + * as it might otherwise deadlock with the + * io_request_lock (in sbp2scsi_queuecommand). + */ + SBP2_DEBUG("Completing SCSI command"); + sbp2scsi_complete_command(hi, scsi_id, scsi_status, SCpnt, command->Current_done); + SBP2_ORB_DEBUG("command orb completed"); + } + return(RCODE_COMPLETE); } @@ -2761,10 +2773,14 @@ /* * This function is called in order to complete a regular SBP-2 command. + * + * This can be called in interrupt context. */ static void sbp2scsi_complete_command(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, u32 scsi_status, Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) { + unsigned long flags; + SBP2_DEBUG("sbp2scsi_complete_command"); /* @@ -2864,13 +2880,13 @@ * Tell scsi stack that we're done with this command */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - spin_lock_irq(&io_request_lock); + spin_lock_irqsave(&io_request_lock,flags); done (SCpnt); - spin_unlock_irq(&io_request_lock); + spin_unlock_irqrestore(&io_request_lock,flags); #else - spin_lock_irq(hi->scsi_host->host_lock); + spin_lock_irqsave(hi->scsi_host->host_lock,flags); done (SCpnt); - spin_unlock_irq(hi->scsi_host->host_lock); + spin_unlock_irqrestore(hi->scsi_host->host_lock,flags); #endif return; |
From: SVN U. <ben...@li...> - 2003-02-04 08:01:04
|
Author: bencollins Date: 2003-02-04 03:00:31 -0500 (Tue, 04 Feb 2003) New Revision: 767 Modified: branches/linux-2.4/pcilynx.c Log: Merge patch from Alan Cox sent to 2.4 BK tree. Modified: branches/linux-2.4/pcilynx.c ============================================================================== --- branches/linux-2.4/pcilynx.c (original) +++ branches/linux-2.4/pcilynx.c 2003-02-04 03:00:32.000000000 -0500 @@ -974,21 +974,13 @@ ssize_t retval; void *membase; - if (*offset != off) /* Check for EOF before we trust wrap */ - return 0; - - /* FIXME: Signed wrap is undefined in C - wants fixing up */ - if (off + count > off) - return 0; - - if ((off + count) > PCILYNX_MAX_MEMORY + 1) { - count = PCILYNX_MAX_MEMORY + 1 - off; + if ((off + count) > PCILYNX_MAX_MEMORY+1) { + count = PCILYNX_MAX_MEMORY+1 - off; } - if (count == 0) { - return 0; + if (count == 0 || off > PCILYNX_MAX_MEMORY) { + return -ENOSPC; } - switch (md->type) { case rom: membase = md->lynx->local_rom; |
From: SVN U. <ben...@li...> - 2003-02-04 07:59:51
|
Author: bencollins Date: 2003-02-04 02:59:10 -0500 (Tue, 04 Feb 2003) New Revision: 766 Modified: trunk/pcilynx.c Log: Merge patch from Alan Cox. Modified: trunk/pcilynx.c ============================================================================== --- trunk/pcilynx.c (original) +++ trunk/pcilynx.c 2003-02-04 02:59:11.000000000 -0500 @@ -1065,21 +1065,13 @@ ssize_t retval; void *membase; - if (*offset != off) /* Check for EOF before we trust wrap */ - return 0; - - /* FIXME: Signed wrap is undefined in C - wants fixing up */ - if (off + count > off) - return 0; - - if ((off + count) > PCILYNX_MAX_MEMORY + 1) { - count = PCILYNX_MAX_MEMORY + 1 - off; + if ((off + count) > PCILYNX_MAX_MEMORY+1) { + count = PCILYNX_MAX_MEMORY+1 - off; } - if (count == 0) { - return 0; + if (count == 0 || off > PCILYNX_MAX_MEMORY) { + return -ENOSPC; } - switch (md->type) { case rom: membase = md->lynx->local_rom; |
From: SVN U. <ben...@li...> - 2003-02-02 07:06:44
|
Author: bencollins Date: 2003-02-02 02:06:11 -0500 (Sun, 02 Feb 2003) New Revision: 765 Modified: trunk/video1394.c Log: 2nd and final phase of video1394 conversion to dma routines. Unfortunately, the ioctl usage makes it impossible to use video1394 on sparc64 with 32bit programs. Video1394 uses generic cmd numbers so they aren't unique. I can't test this yet. Some one test this please, especially on 1gig+ machines and non-i386 machines. Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-02 02:06:12.000000000 -0500 @@ -98,8 +98,11 @@ struct dma_region dma; + struct dma_prog_region *prg_reg; + struct dma_cmd **ir_prg; struct it_dma_prg **it_prg; + unsigned int *buffer_status; struct timeval *buffer_time; /* time when the buffer was received */ unsigned int *last_used_cmd; /* For ISO Transmit with @@ -175,19 +178,17 @@ dma_region_free(&d->dma); - if (d->ir_prg) { - for (i = 0; i < d->num_desc; i++) - if (d->ir_prg[i]) - kfree(d->ir_prg[i]); - kfree(d->ir_prg); + if (d->prg_reg) { + for (i = 0; i < d->num_desc; i++) + dma_prog_region_free(&d->prg_reg[i]); + kfree(d->prg_reg); } - if (d->it_prg) { - for (i = 0; i < d->num_desc; i++) - if (d->it_prg[i]) - kfree(d->it_prg[i]); + if (d->ir_prg) + kfree(d->ir_prg); + + if (d->it_prg) kfree(d->it_prg); - } if (d->buffer_status) kfree(d->buffer_status); @@ -227,9 +228,11 @@ d->frame_size = buf_size; d->buf_size = PAGE_ALIGN(buf_size); d->last_buffer = -1; - dma_region_init(&d->dma); init_waitqueue_head(&d->waitq); + /* Init the regions for easy cleanup */ + dma_region_init(&d->dma); + if (dma_region_alloc(&d->dma, d->buf_size, ohci->dev, PCI_DMA_BIDIRECTIONAL)) { PRINT(KERN_ERR, ohci->id, "Failed to allocate dma buffer"); free_dma_iso_ctx(d); @@ -253,6 +256,17 @@ } d->ctx = d->iso_tasklet.context; + d->prg_reg = kmalloc(d->num_desc * sizeof(struct dma_prog_region), + GFP_KERNEL); + if (d->ir_prg == NULL) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate ir prg regs"); + free_dma_iso_ctx(d); + return NULL; + } + /* Makes for easier cleanup */ + for (i = 0; i < d->num_desc; i++) + dma_prog_region_init(&d->prg_reg[i]); + if (type == OHCI_ISO_RECEIVE) { d->ctrlSet = OHCI1394_IsoRcvContextControlSet+32*d->ctx; d->ctrlClear = OHCI1394_IsoRcvContextControlClear+32*d->ctx; @@ -263,27 +277,24 @@ GFP_KERNEL); if (d->ir_prg == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma ir prg"); + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma ir prg"); free_dma_iso_ctx(d); return NULL; } memset(d->ir_prg, 0, d->num_desc * sizeof(struct dma_cmd *)); - + d->nb_cmd = d->buf_size / PAGE_SIZE + 1; d->left_size = (d->frame_size % PAGE_SIZE) ? d->frame_size % PAGE_SIZE : PAGE_SIZE; - for (i=0;i<d->num_desc;i++) { - d->ir_prg[i] = kmalloc(d->nb_cmd * - sizeof(struct dma_cmd), - GFP_KERNEL); - if (d->ir_prg[i] == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma ir prg"); + for (i = 0;i < d->num_desc; i++) { + if (dma_prog_region_alloc(&d->prg_reg[i], d->nb_cmd * + sizeof(struct dma_cmd), ohci->dev)) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma ir prg"); free_dma_iso_ctx(d); return NULL; } + d->ir_prg[i] = (struct dma_cmd *)d->prg_reg[i].kvirt; } } else { /* OHCI_ISO_TRANSMIT */ @@ -317,20 +328,17 @@ if (d->frame_size % d->packet_size) { d->nb_cmd++; d->left_size = d->frame_size % d->packet_size; - } - else + } else d->left_size = d->packet_size; - for (i=0;i<d->num_desc;i++) { - d->it_prg[i] = kmalloc(d->nb_cmd * - sizeof(struct it_dma_prg), - GFP_KERNEL); - if (d->it_prg[i] == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma it prg"); + for (i = 0; i < d->num_desc; i++) { + if (dma_prog_region_alloc(&d->prg_reg[i], d->nb_cmd * + sizeof(struct it_dma_prg), ohci->dev)) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma it prg"); free_dma_iso_ctx(d); return NULL; } + d->it_prg[i] = (struct it_dma_prg *)d->prg_reg[i].kvirt; } } @@ -383,7 +391,7 @@ int i; d->ir_prg[n][0].status = cpu_to_le32(4); d->ir_prg[n][1].status = cpu_to_le32(PAGE_SIZE-4); - for (i=2;i<d->nb_cmd-1;i++) + for (i = 2; i < d->nb_cmd - 1; i++) d->ir_prg[n][i].status = cpu_to_le32(PAGE_SIZE); d->ir_prg[n][i].status = cpu_to_le32(d->left_size); } @@ -391,6 +399,7 @@ static void initialize_dma_ir_prg(struct dma_iso_ctx *d, int n, int flags) { struct dma_cmd *ir_prg = d->ir_prg[n]; + struct dma_prog_region *ir_reg = &d->prg_reg[n]; unsigned long buf = (unsigned long)d->dma.kvirt + n * d->buf_size; int i; @@ -404,16 +413,16 @@ ir_prg[0].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, buf - (unsigned long)d->dma.kvirt)); - ir_prg[0].branchAddress = cpu_to_le32((virt_to_bus(&(ir_prg[1].control)) - & 0xfffffff0) | 0x1); + ir_prg[0].branchAddress = cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + 1 * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); /* the second descriptor will read PAGE_SIZE-4 bytes */ ir_prg[1].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_BRANCH | (PAGE_SIZE-4)); ir_prg[1].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, (buf + 4) - (unsigned long)d->dma.kvirt)); - ir_prg[1].branchAddress = cpu_to_le32((virt_to_bus(&(ir_prg[2].control)) - & 0xfffffff0) | 0x1); + ir_prg[1].branchAddress = cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + 2 * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); for (i=2;i<d->nb_cmd-1;i++) { ir_prg[i].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | @@ -422,9 +431,9 @@ (buf+(i-1)*PAGE_SIZE) - (unsigned long)d->dma.kvirt)); - ir_prg[i].branchAddress = - cpu_to_le32((virt_to_bus(&(ir_prg[i+1].control)) - & 0xfffffff0) | 0x1); + ir_prg[i].branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + (i + 1) * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); } /* the last descriptor will generate an interrupt */ @@ -587,6 +596,7 @@ static void initialize_dma_it_prg(struct dma_iso_ctx *d, int n, int sync_tag) { struct it_dma_prg *it_prg = d->it_prg[n]; + struct dma_prog_region *it_reg = &d->prg_reg[n]; unsigned long buf = (unsigned long)d->dma.kvirt + n * d->buf_size; int i; d->last_used_cmd[n] = d->nb_cmd - 1; @@ -617,13 +627,12 @@ if (i<d->nb_cmd-1) { it_prg[i].end.control |= cpu_to_le32(d->packet_size); it_prg[i].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); it_prg[i].end.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); - } - else { + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); + } else { /* the last prg generates an interrupt */ it_prg[i].end.control |= cpu_to_le32(DMA_CTL_UPDATE | DMA_CTL_IRQ | d->left_size); @@ -640,6 +649,7 @@ struct ti_ohci *ohci) { struct it_dma_prg *it_prg = d->it_prg[n]; + struct dma_prog_region *it_reg = &d->prg_reg[n]; int i; #if 0 @@ -661,12 +671,12 @@ if (i < d->nb_cmd-1 && packet_sizes[i+1] != 0) { it_prg[i].end.control |= cpu_to_le32(size); - it_prg[i].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); - it_prg[i].end.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); + it_prg[i].begin.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); + it_prg[i].end.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); } else { /* the last prg generates an interrupt */ it_prg[i].end.control |= cpu_to_le32(DMA_CTL_UPDATE | @@ -882,10 +892,10 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_QUEUED; - if (d->last_buffer>=0) - d->ir_prg[d->last_buffer][d->nb_cmd-1].branchAddress = - cpu_to_le32((virt_to_bus(&(d->ir_prg[v.buffer][0].control)) - & 0xfffffff0) | 0x1); + if (d->last_buffer>=0) + d->ir_prg[d->last_buffer][d->nb_cmd-1].branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) + & 0xfffffff0) | 0x1); d->last_buffer = v.buffer; @@ -898,9 +908,9 @@ DBGMSG(ohci->id, "Starting iso DMA ctx=%d",d->ctx); /* Tell the controller where the first program is */ - reg_write(ohci, d->cmdPtr, - virt_to_bus(&(d->ir_prg[v.buffer][0]))|0x1); - + reg_write(ohci, d->cmdPtr, + dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) | 0x1); + /* Run IR context */ reg_write(ohci, d->ctrlSet, 0x8000); } @@ -1040,18 +1050,16 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_QUEUED; - if (d->last_buffer>=0) { + if (d->last_buffer >= 0) { d->it_prg[d->last_buffer] - [ d->last_used_cmd[d->last_buffer] - ].end.branchAddress = - cpu_to_le32((virt_to_bus(&(d->it_prg[v.buffer][0].begin.control)) - & 0xfffffff0) | 0x3); + [ d->last_used_cmd[d->last_buffer] ].end.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], + 0) & 0xfffffff0) | 0x3); d->it_prg[d->last_buffer] - [d->last_used_cmd[d->last_buffer] - ].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(d->it_prg[v.buffer][0].begin.control)) - & 0xfffffff0) | 0x3); + [ d->last_used_cmd[d->last_buffer] ].begin.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], + 0) & 0xfffffff0) | 0x3); d->next_buffer[d->last_buffer] = v.buffer; } d->last_buffer = v.buffer; @@ -1068,9 +1076,9 @@ put_timestamp(ohci, d, d->last_buffer); /* Tell the controller where the first program is */ - reg_write(ohci, d->cmdPtr, - virt_to_bus(&(d->it_prg[v.buffer][0]))|0x3); - + reg_write(ohci, d->cmdPtr, + dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) | 0x3); + /* Run IT context */ reg_write(ohci, d->ctrlSet, 0x8000); } |
From: SVN U. <ben...@li...> - 2003-02-02 07:04:12
|
Author: bencollins Date: 2003-02-02 02:03:39 -0500 (Sun, 02 Feb 2003) New Revision: 764 Modified: trunk/hosts.c Log: Check return of devctl in hpsb_ref_host and use it for error/successful return value Modified: trunk/hosts.c ============================================================================== --- trunk/hosts.c (original) +++ trunk/hosts.c 2003-02-02 02:03:40.000000000 -0500 @@ -69,9 +69,11 @@ spin_lock_irqsave(&hosts_lock, flags); list_for_each(lh, &hosts) { if (host == list_entry(lh, struct hpsb_host, host_list)) { - host->driver->devctl(host, MODIFY_USAGE, 1); - host->refcount++; - retval = 1; + if (host->driver->devctl(host, MODIFY_USAGE, 1)) { + host->driver->devctl(host, MODIFY_USAGE, 1); + host->refcount++; + retval = 1; + } break; } } |
From: SVN U. <ben...@li...> - 2003-02-02 07:03:14
|
Author: bencollins Date: 2003-02-02 02:02:41 -0500 (Sun, 02 Feb 2003) New Revision: 763 Modified: trunk/raw1394.c Log: Make note of need to check return of hpsb_ref_host Modified: trunk/raw1394.c ============================================================================== --- trunk/raw1394.c (original) +++ trunk/raw1394.c 2003-02-02 02:02:42.000000000 -0500 @@ -558,7 +558,7 @@ lh = lh->next; } hi = list_entry(lh, struct host_info, list); - hpsb_ref_host(hi->host); + hpsb_ref_host(hi->host); // XXX Need to handle failure case list_add_tail(&fi->list, &hi->file_info_list); fi->host = hi->host; fi->state = connected; |
From: SVN U. <ben...@li...> - 2003-02-02 07:02:00
|
Author: bencollins Date: 2003-02-02 02:01:26 -0500 (Sun, 02 Feb 2003) New Revision: 762 Modified: trunk/ohci1394.c trunk/pcilynx.c Log: Use newer module inc/dec interfaces to get rid of error messages about deprecated functions. Check failure of try_module_get. Modified: trunk/ohci1394.c ============================================================================== --- trunk/ohci1394.c (original) +++ trunk/ohci1394.c 2003-02-02 02:01:27.000000000 -0500 @@ -967,12 +967,13 @@ break; case MODIFY_USAGE: - if (arg) { - MOD_INC_USE_COUNT; - } else { - MOD_DEC_USE_COUNT; - } - retval = 1; + if (arg) { + if (try_module_get(THIS_MODULE)) + retval = 1; + } else { + module_put(THIS_MODULE); + retval = 1; + } break; case ISO_LISTEN_CHANNEL: @@ -1218,7 +1219,7 @@ recv->dma_offset = 0; /* size of DMA program = one descriptor per block */ - if(dma_prog_region_alloc(&recv->prog, + if (dma_prog_region_alloc(&recv->prog, sizeof(struct dma_cmd) * recv->nblocks, recv->ohci->dev)) goto err; @@ -1303,7 +1304,7 @@ /* address of 'branch' field in previous DMA descriptor */ u32 *prev_branch = NULL; - for(blk = 0; blk < recv->nblocks; blk++) { + for (blk = 0; blk < recv->nblocks; blk++) { /* the DMA descriptor */ struct dma_cmd *cmd = &recv->block[blk]; @@ -1313,7 +1314,7 @@ /* offset of this packet's data within the DMA buffer */ unsigned long buf_offset = blk * recv->buf_stride; - if(recv->dma_mode == BUFFER_FILL_MODE) { + if (recv->dma_mode == BUFFER_FILL_MODE) { cmd->control = 2 << 28; /* INPUT_MORE */ } else { cmd->control = 3 << 28; /* INPUT_LAST */ @@ -1322,7 +1323,7 @@ cmd->control |= 8 << 24; /* s = 1, update xferStatus and resCount */ /* interrupt on last block, and at intervals */ - if(blk == recv->nblocks-1 || (blk % recv->block_irq_interval) == 0) { + if (blk == recv->nblocks-1 || (blk % recv->block_irq_interval) == 0) { cmd->control |= 3 << 20; /* want interrupt */ } @@ -1334,7 +1335,7 @@ cmd->status = recv->buf_stride; /* link the previous descriptor to this one */ - if(prev_branch) { + if (prev_branch) { *prev_branch = dma_prog_region_offset_to_bus(&recv->prog, prog_offset); *prev_branch |= 1; /* set Z=1 */ } Modified: trunk/pcilynx.c ============================================================================== --- trunk/pcilynx.c (original) +++ trunk/pcilynx.c 2003-02-02 02:01:27.000000000 -0500 @@ -802,13 +802,14 @@ break; case MODIFY_USAGE: - if (arg) { - MOD_INC_USE_COUNT; - } else { - MOD_DEC_USE_COUNT; - } + if (arg) { + if (try_module_get(THIS_MODULE)) + retval = 1; + } else { + module_put(THIS_MODULE); + retval = 1; + } - retval = 1; break; case ISO_LISTEN_CHANNEL: |