diff options
author | Chris Zankel <chris@zankel.net> | 2007-08-04 17:31:04 -0400 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2007-08-27 16:53:22 -0400 |
commit | 787a22d1d284b21ad810fd0bedbdefb329f31cd2 (patch) | |
tree | 3474f2b514ce0b7a9ca9c9ece412556bf6f0b191 /arch/xtensa/kernel | |
parent | 73089cbfdf0c69e061a4fa90d614679e630c6727 (diff) |
[XTENSA] Move string-io functions to io.c from pci.c
The string-io functions (outs{bwl}, ins{bwl}) are independent from
the PCI option and should be in a separate file.
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/kernel')
-rw-r--r-- | arch/xtensa/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/xtensa/kernel/io.c | 75 | ||||
-rw-r--r-- | arch/xtensa/kernel/pci.c | 69 |
3 files changed, 76 insertions, 70 deletions
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile index 0e3ac686c175..f582d6a24ec2 100644 --- a/arch/xtensa/kernel/Makefile +++ b/arch/xtensa/kernel/Makefile | |||
@@ -7,7 +7,7 @@ extra-y := head.o vmlinux.lds | |||
7 | 7 | ||
8 | obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o semaphore.o \ | 8 | obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o semaphore.o \ |
9 | setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \ | 9 | setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \ |
10 | pci-dma.o init_task.o | 10 | pci-dma.o init_task.o io.o |
11 | 11 | ||
12 | ## windowspill.o | 12 | ## windowspill.o |
13 | 13 | ||
diff --git a/arch/xtensa/kernel/io.c b/arch/xtensa/kernel/io.c new file mode 100644 index 000000000000..5b65269b1d2f --- /dev/null +++ b/arch/xtensa/kernel/io.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * arch/xtensa/io.c | ||
3 | * | ||
4 | * IO primitives | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | * Copied from sparc. | ||
12 | * | ||
13 | * Chris Zankel <chris@zankel.net> | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <asm/io.h> | ||
18 | #include <asm/byteorder.h> | ||
19 | |||
20 | void outsb(unsigned long addr, const void *src, unsigned long count) { | ||
21 | while (count) { | ||
22 | count -= 1; | ||
23 | writeb(*(const char *)src, addr); | ||
24 | src += 1; | ||
25 | addr += 1; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | void outsw(unsigned long addr, const void *src, unsigned long count) { | ||
30 | while (count) { | ||
31 | count -= 2; | ||
32 | writew(*(const short *)src, addr); | ||
33 | src += 2; | ||
34 | addr += 2; | ||
35 | } | ||
36 | } | ||
37 | |||
38 | void outsl(unsigned long addr, const void *src, unsigned long count) { | ||
39 | while (count) { | ||
40 | count -= 4; | ||
41 | writel(*(const long *)src, addr); | ||
42 | src += 4; | ||
43 | addr += 4; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | void insb(unsigned long addr, void *dst, unsigned long count) { | ||
48 | while (count) { | ||
49 | count -= 1; | ||
50 | *(unsigned char *)dst = readb(addr); | ||
51 | dst += 1; | ||
52 | addr += 1; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | void insw(unsigned long addr, void *dst, unsigned long count) { | ||
57 | while (count) { | ||
58 | count -= 2; | ||
59 | *(unsigned short *)dst = readw(addr); | ||
60 | dst += 2; | ||
61 | addr += 2; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | void insl(unsigned long addr, void *dst, unsigned long count) { | ||
66 | while (count) { | ||
67 | count -= 4; | ||
68 | /* | ||
69 | * XXX I am sure we are in for an unaligned trap here. | ||
70 | */ | ||
71 | *(unsigned long *)dst = readl(addr); | ||
72 | dst += 4; | ||
73 | addr += 4; | ||
74 | } | ||
75 | } | ||
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c index 77deae5290f0..b7c073484e01 100644 --- a/arch/xtensa/kernel/pci.c +++ b/arch/xtensa/kernel/pci.c | |||
@@ -394,72 +394,3 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
394 | 394 | ||
395 | return ret; | 395 | return ret; |
396 | } | 396 | } |
397 | |||
398 | /* | ||
399 | * This probably belongs here rather than ioport.c because | ||
400 | * we do not want this crud linked into SBus kernels. | ||
401 | * Also, think for a moment about likes of floppy.c that | ||
402 | * include architecture specific parts. They may want to redefine ins/outs. | ||
403 | * | ||
404 | * We do not use horrible macros here because we want to | ||
405 | * advance pointer by sizeof(size). | ||
406 | */ | ||
407 | void outsb(unsigned long addr, const void *src, unsigned long count) { | ||
408 | while (count) { | ||
409 | count -= 1; | ||
410 | writeb(*(const char *)src, addr); | ||
411 | src += 1; | ||
412 | addr += 1; | ||
413 | } | ||
414 | } | ||
415 | |||
416 | void outsw(unsigned long addr, const void *src, unsigned long count) { | ||
417 | while (count) { | ||
418 | count -= 2; | ||
419 | writew(*(const short *)src, addr); | ||
420 | src += 2; | ||
421 | addr += 2; | ||
422 | } | ||
423 | } | ||
424 | |||
425 | void outsl(unsigned long addr, const void *src, unsigned long count) { | ||
426 | while (count) { | ||
427 | count -= 4; | ||
428 | writel(*(const long *)src, addr); | ||
429 | src += 4; | ||
430 | addr += 4; | ||
431 | } | ||
432 | } | ||
433 | |||
434 | void insb(unsigned long addr, void *dst, unsigned long count) { | ||
435 | while (count) { | ||
436 | count -= 1; | ||
437 | *(unsigned char *)dst = readb(addr); | ||
438 | dst += 1; | ||
439 | addr += 1; | ||
440 | } | ||
441 | } | ||
442 | |||
443 | void insw(unsigned long addr, void *dst, unsigned long count) { | ||
444 | while (count) { | ||
445 | count -= 2; | ||
446 | *(unsigned short *)dst = readw(addr); | ||
447 | dst += 2; | ||
448 | addr += 2; | ||
449 | } | ||
450 | } | ||
451 | |||
452 | void insl(unsigned long addr, void *dst, unsigned long count) { | ||
453 | while (count) { | ||
454 | count -= 4; | ||
455 | /* | ||
456 | * XXX I am sure we are in for an unaligned trap here. | ||
457 | */ | ||
458 | *(unsigned long *)dst = readl(addr); | ||
459 | dst += 4; | ||
460 | addr += 4; | ||
461 | } | ||
462 | } | ||
463 | |||
464 | |||
465 | |||