]>
Commit | Line | Data |
---|---|---|
3cbee15b JM |
1 | /* |
2 | * PowerMac descriptor-based DMA emulation | |
3 | * | |
4 | * Copyright (c) 2005-2007 Fabrice Bellard | |
5 | * Copyright (c) 2007 Jocelyn Mayer | |
6 | * | |
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
8 | * of this software and associated documentation files (the "Software"), to deal | |
9 | * in the Software without restriction, including without limitation the rights | |
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
11 | * copies of the Software, and to permit persons to whom the Software is | |
12 | * furnished to do so, subject to the following conditions: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
23 | * THE SOFTWARE. | |
24 | */ | |
87ecb68b | 25 | #include "hw.h" |
3cbee15b JM |
26 | #include "ppc_mac.h" |
27 | ||
ea026b2f BS |
28 | /* debug DBDMA */ |
29 | //#define DEBUG_DBDMA | |
30 | ||
31 | #ifdef DEBUG_DBDMA | |
32 | #define DBDMA_DPRINTF(fmt, args...) \ | |
33 | do { printf("DBDMA: " fmt , ##args); } while (0) | |
34 | #else | |
35 | #define DBDMA_DPRINTF(fmt, args...) | |
36 | #endif | |
37 | ||
3cbee15b JM |
38 | /* DBDMA: currently no op - should suffice right now */ |
39 | ||
40 | static void dbdma_writeb (void *opaque, | |
41 | target_phys_addr_t addr, uint32_t value) | |
42 | { | |
ea026b2f | 43 | DBDMA_DPRINTF("writeb 0x" TARGET_FMT_plx " <= 0x%08x\n", addr, value); |
3cbee15b JM |
44 | } |
45 | ||
46 | static void dbdma_writew (void *opaque, | |
47 | target_phys_addr_t addr, uint32_t value) | |
48 | { | |
ea026b2f | 49 | DBDMA_DPRINTF("writew 0x" TARGET_FMT_plx " <= 0x%08x\n", addr, value); |
3cbee15b JM |
50 | } |
51 | ||
52 | static void dbdma_writel (void *opaque, | |
53 | target_phys_addr_t addr, uint32_t value) | |
54 | { | |
ea026b2f | 55 | DBDMA_DPRINTF("writel 0x" TARGET_FMT_plx " <= 0x%08x\n", addr, value); |
3cbee15b JM |
56 | } |
57 | ||
58 | static uint32_t dbdma_readb (void *opaque, target_phys_addr_t addr) | |
59 | { | |
ea026b2f | 60 | DBDMA_DPRINTF("readb 0x" TARGET_FMT_plx " => 0\n", addr); |
3cbee15b JM |
61 | |
62 | return 0; | |
63 | } | |
64 | ||
65 | static uint32_t dbdma_readw (void *opaque, target_phys_addr_t addr) | |
66 | { | |
ea026b2f BS |
67 | DBDMA_DPRINTF("readw 0x" TARGET_FMT_plx " => 0\n", addr); |
68 | ||
3cbee15b JM |
69 | return 0; |
70 | } | |
71 | ||
72 | static uint32_t dbdma_readl (void *opaque, target_phys_addr_t addr) | |
73 | { | |
ea026b2f BS |
74 | DBDMA_DPRINTF("readl 0x" TARGET_FMT_plx " => 0\n", addr); |
75 | ||
3cbee15b JM |
76 | return 0; |
77 | } | |
78 | ||
79 | static CPUWriteMemoryFunc *dbdma_write[] = { | |
80 | &dbdma_writeb, | |
81 | &dbdma_writew, | |
82 | &dbdma_writel, | |
83 | }; | |
84 | ||
85 | static CPUReadMemoryFunc *dbdma_read[] = { | |
86 | &dbdma_readb, | |
87 | &dbdma_readw, | |
88 | &dbdma_readl, | |
89 | }; | |
90 | ||
9b64997f BS |
91 | static void dbdma_save(QEMUFile *f, void *opaque) |
92 | { | |
93 | } | |
94 | ||
95 | static int dbdma_load(QEMUFile *f, void *opaque, int version_id) | |
96 | { | |
97 | if (version_id != 1) | |
98 | return -EINVAL; | |
99 | ||
100 | return 0; | |
101 | } | |
102 | ||
6e6b7363 BS |
103 | static void dbdma_reset(void *opaque) |
104 | { | |
105 | } | |
106 | ||
3cbee15b JM |
107 | void dbdma_init (int *dbdma_mem_index) |
108 | { | |
109 | *dbdma_mem_index = cpu_register_io_memory(0, dbdma_read, dbdma_write, NULL); | |
9b64997f | 110 | register_savevm("dbdma", -1, 1, dbdma_save, dbdma_load, NULL); |
6e6b7363 BS |
111 | qemu_register_reset(dbdma_reset, NULL); |
112 | dbdma_reset(NULL); | |
3cbee15b | 113 | } |