5 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7 #include <linux/module.h>
11 static unsigned long mmio_address;
14 "(or 8 MB if read_far is non-zero).");
16 static unsigned long read_far = 0x400100;
19 "(default: 0x400100).");
21 static unsigned v16(
unsigned i)
26 static unsigned v32(
unsigned i)
28 return i * 212371 + 13;
31 static void do_write_test(
void __iomem *
p)
37 for (i = 0; i < 256; i++)
40 for (i = 1024; i < (5 * 1024); i += 2)
43 for (i = (5 * 1024); i < (16 * 1024); i += 4)
47 static void do_read_test(
void __iomem *p)
50 unsigned errs[3] = { 0 };
54 for (i = 0; i < 256; i++)
58 for (i = 1024; i < (5 * 1024); i += 2)
62 for (i = (5 * 1024); i < (16 * 1024); i += 4)
67 errs[0], errs[1], errs[2]);
70 static void do_read_far_test(
void __iomem *p)
78 static void do_test(
unsigned long size)
82 pr_err(
"could not ioremap, aborting.\n");
88 if (read_far && read_far < size - 4)
99 static void do_test_bulk_ioremapping(
void)
104 for (i = 0; i < 10; ++
i) {
116 unsigned long size = (read_far) ? (8 << 20) : (16 << 10);
118 if (mmio_address == 0) {
119 pr_err(
"you have to use the module argument mmio_address.\n");
120 pr_err(
"DO NOT LOAD THIS MODULE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!\n");
124 pr_warning(
"WARNING: mapping %lu kB @ 0x%08lx in PCI address space, "
125 "and writing 16 kB of rubbish in there.\n",
126 size >> 10, mmio_address);
128 do_test_bulk_ioremapping();
133 static void __exit cleanup(
void)