45 #include <linux/pci.h>
48 #include <linux/export.h>
49 #include <asm/uaccess.h>
55 static int diag_set_link;
57 static int ipath_diag_open(
struct inode *
in,
struct file *
fp);
58 static int ipath_diag_release(
struct inode *
in,
struct file *
fp);
60 size_t count, loff_t *off);
62 size_t count, loff_t *off);
66 .write = ipath_diag_write,
67 .read = ipath_diag_read,
68 .open = ipath_diag_open,
69 .release = ipath_diag_release,
74 const char __user *
data,
75 size_t count, loff_t *off);
79 .write = ipath_diagpkt_write,
84 static struct cdev *diagpkt_cdev;
85 static struct device *diagpkt_dev;
94 "ipath_diagpkt", &diagpkt_file_ops,
95 &diagpkt_cdev, &diagpkt_dev);
142 const u64 __iomem *reg_end = reg_addr + (count /
sizeof(
u64));
179 const u64 __iomem *reg_end = reg_addr + (count /
sizeof(
u64));
217 const u32 __iomem *reg_end = reg_addr + (count /
sizeof(
u32));
257 const u32 __iomem *reg_end = reg_addr + (count /
sizeof(
u32));
281 static int ipath_diag_open(
struct inode *
in,
struct file *
fp)
324 static ssize_t ipath_diagpkt_write(
struct file *fp,
325 const char __user *data,
326 size_t count, loff_t *off)
336 u32 l_state, lt_state;
338 if (count <
sizeof(odp)) {
343 if (count ==
sizeof(
dp)) {
366 if (
dp.unit >= 20 &&
dp.data < 512) {
427 plen =
sizeof(
u32) +
dp.len;
430 ipath_dbg(
"Pkt len 0x%x > ibmaxlen %x\n",
444 (
const void __user *) (
unsigned long)
dp.data,
491 static int ipath_diag_release(
struct inode *in,
struct file *fp)
500 static ssize_t ipath_diag_read(
struct file *fp,
char __user *data,
501 size_t count, loff_t *off)
511 else if ((count % 4) || (*off % 4))
516 else if ((count % 8) || (*off % 8))
518 ret = ipath_read_umem32(dd, data, kreg_base + *off, count);
520 ret = ipath_read_umem64(dd, data, kreg_base + *off, count);
532 static ssize_t ipath_diag_write(
struct file *fp,
const char __user *data,
533 size_t count, loff_t *off)
543 else if ((count % 4) || (*off % 4))
549 else if ((count % 8) || (*off % 8))
551 ret = ipath_write_umem32(dd, kreg_base + *off, data, count);
553 ret = ipath_write_umem64(dd, kreg_base + *off, data, count);