2 * QEMU PowerPC 4xx embedded processors shared devices emulation
4 * Copyright (c) 2007 Jocelyn Mayer
6 * Copyright 2008 IBM Corp.
7 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
38 //#define DEBUG_UNASSIGNED
41 /*****************************************************************************/
42 /* Generic PowerPC 4xx processor instanciation */
43 CPUState
*ppc4xx_init (const unsigned char *cpu_model
,
44 clk_setup_t
*cpu_clk
, clk_setup_t
*tb_clk
,
50 env
= cpu_init(cpu_model
);
52 fprintf(stderr
, "Unable to find PowerPC %s CPU definition\n",
56 cpu_clk
->cb
= NULL
; /* We don't care about CPU clock frequency changes */
57 cpu_clk
->opaque
= env
;
58 /* Set time-base frequency to sysclk */
59 tb_clk
->cb
= ppc_emb_timers_init(env
, sysclk
);
61 ppc_dcr_init(env
, NULL
, NULL
);
62 /* Register qemu callbacks */
63 qemu_register_reset(&cpu_ppc_reset
, env
);
68 /*****************************************************************************/
69 /* Fake device used to map multiple devices in a single memory page */
70 #define MMIO_AREA_BITS 8
71 #define MMIO_AREA_LEN (1 << MMIO_AREA_BITS)
72 #define MMIO_AREA_NB (1 << (TARGET_PAGE_BITS - MMIO_AREA_BITS))
73 #define MMIO_IDX(addr) (((addr) >> MMIO_AREA_BITS) & (MMIO_AREA_NB - 1))
74 struct ppc4xx_mmio_t
{
75 target_phys_addr_t base
;
76 CPUReadMemoryFunc
**mem_read
[MMIO_AREA_NB
];
77 CPUWriteMemoryFunc
**mem_write
[MMIO_AREA_NB
];
78 void *opaque
[MMIO_AREA_NB
];
81 static uint32_t unassigned_mmio_readb (void *opaque
, target_phys_addr_t addr
)
83 #ifdef DEBUG_UNASSIGNED
87 printf("Unassigned mmio read 0x" PADDRX
" base " PADDRX
"\n",
94 static void unassigned_mmio_writeb (void *opaque
,
95 target_phys_addr_t addr
, uint32_t val
)
97 #ifdef DEBUG_UNASSIGNED
101 printf("Unassigned mmio write 0x" PADDRX
" = 0x%x base " PADDRX
"\n",
102 addr
, val
, mmio
->base
);
106 static CPUReadMemoryFunc
*unassigned_mmio_read
[3] = {
107 unassigned_mmio_readb
,
108 unassigned_mmio_readb
,
109 unassigned_mmio_readb
,
112 static CPUWriteMemoryFunc
*unassigned_mmio_write
[3] = {
113 unassigned_mmio_writeb
,
114 unassigned_mmio_writeb
,
115 unassigned_mmio_writeb
,
118 static uint32_t mmio_readlen (ppc4xx_mmio_t
*mmio
,
119 target_phys_addr_t addr
, int len
)
121 CPUReadMemoryFunc
**mem_read
;
125 idx
= MMIO_IDX(addr
- mmio
->base
);
126 #if defined(DEBUG_MMIO)
127 printf("%s: mmio %p len %d addr " PADDRX
" idx %d\n", __func__
,
128 mmio
, len
, addr
, idx
);
130 mem_read
= mmio
->mem_read
[idx
];
131 ret
= (*mem_read
[len
])(mmio
->opaque
[idx
], addr
- mmio
->base
);
136 static void mmio_writelen (ppc4xx_mmio_t
*mmio
,
137 target_phys_addr_t addr
, uint32_t value
, int len
)
139 CPUWriteMemoryFunc
**mem_write
;
142 idx
= MMIO_IDX(addr
- mmio
->base
);
143 #if defined(DEBUG_MMIO)
144 printf("%s: mmio %p len %d addr " PADDRX
" idx %d value %08" PRIx32
"\n",
145 __func__
, mmio
, len
, addr
, idx
, value
);
147 mem_write
= mmio
->mem_write
[idx
];
148 (*mem_write
[len
])(mmio
->opaque
[idx
], addr
- mmio
->base
, value
);
151 static uint32_t mmio_readb (void *opaque
, target_phys_addr_t addr
)
153 #if defined(DEBUG_MMIO)
154 printf("%s: addr " PADDRX
"\n", __func__
, addr
);
157 return mmio_readlen(opaque
, addr
, 0);
160 static void mmio_writeb (void *opaque
,
161 target_phys_addr_t addr
, uint32_t value
)
163 #if defined(DEBUG_MMIO)
164 printf("%s: addr " PADDRX
" val %08" PRIx32
"\n", __func__
, addr
, value
);
166 mmio_writelen(opaque
, addr
, value
, 0);
169 static uint32_t mmio_readw (void *opaque
, target_phys_addr_t addr
)
171 #if defined(DEBUG_MMIO)
172 printf("%s: addr " PADDRX
"\n", __func__
, addr
);
175 return mmio_readlen(opaque
, addr
, 1);
178 static void mmio_writew (void *opaque
,
179 target_phys_addr_t addr
, uint32_t value
)
181 #if defined(DEBUG_MMIO)
182 printf("%s: addr " PADDRX
" val %08" PRIx32
"\n", __func__
, addr
, value
);
184 mmio_writelen(opaque
, addr
, value
, 1);
187 static uint32_t mmio_readl (void *opaque
, target_phys_addr_t addr
)
189 #if defined(DEBUG_MMIO)
190 printf("%s: addr " PADDRX
"\n", __func__
, addr
);
193 return mmio_readlen(opaque
, addr
, 2);
196 static void mmio_writel (void *opaque
,
197 target_phys_addr_t addr
, uint32_t value
)
199 #if defined(DEBUG_MMIO)
200 printf("%s: addr " PADDRX
" val %08" PRIx32
"\n", __func__
, addr
, value
);
202 mmio_writelen(opaque
, addr
, value
, 2);
205 static CPUReadMemoryFunc
*mmio_read
[] = {
211 static CPUWriteMemoryFunc
*mmio_write
[] = {
217 int ppc4xx_mmio_register (CPUState
*env
, ppc4xx_mmio_t
*mmio
,
218 target_phys_addr_t offset
, uint32_t len
,
219 CPUReadMemoryFunc
**mem_read
,
220 CPUWriteMemoryFunc
**mem_write
, void *opaque
)
222 target_phys_addr_t end
;
225 if ((offset
+ len
) > TARGET_PAGE_SIZE
)
227 idx
= MMIO_IDX(offset
);
228 end
= offset
+ len
- 1;
229 eidx
= MMIO_IDX(end
);
230 #if defined(DEBUG_MMIO)
231 printf("%s: offset " PADDRX
" len %08" PRIx32
" " PADDRX
" %d %d\n",
232 __func__
, offset
, len
, end
, idx
, eidx
);
234 for (; idx
<= eidx
; idx
++) {
235 mmio
->mem_read
[idx
] = mem_read
;
236 mmio
->mem_write
[idx
] = mem_write
;
237 mmio
->opaque
[idx
] = opaque
;
243 ppc4xx_mmio_t
*ppc4xx_mmio_init (CPUState
*env
, target_phys_addr_t base
)
248 mmio
= qemu_mallocz(sizeof(ppc4xx_mmio_t
));
251 mmio_memory
= cpu_register_io_memory(0, mmio_read
, mmio_write
, mmio
);
252 #if defined(DEBUG_MMIO)
253 printf("%s: base " PADDRX
" len %08x %d\n", __func__
,
254 base
, TARGET_PAGE_SIZE
, mmio_memory
);
256 cpu_register_physical_memory(base
, TARGET_PAGE_SIZE
, mmio_memory
);
257 ppc4xx_mmio_register(env
, mmio
, 0, TARGET_PAGE_SIZE
,
258 unassigned_mmio_read
, unassigned_mmio_write
,
265 /*****************************************************************************/
266 /* "Universal" Interrupt controller */
280 #define UIC_MAX_IRQ 32
281 typedef struct ppcuic_t ppcuic_t
;
285 uint32_t level
; /* Remembers the state of level-triggered interrupts. */
286 uint32_t uicsr
; /* Status register */
287 uint32_t uicer
; /* Enable register */
288 uint32_t uiccr
; /* Critical register */
289 uint32_t uicpr
; /* Polarity register */
290 uint32_t uictr
; /* Triggering register */
291 uint32_t uicvcr
; /* Vector configuration register */
296 static void ppcuic_trigger_irq (ppcuic_t
*uic
)
299 int start
, end
, inc
, i
;
301 /* Trigger interrupt if any is pending */
302 ir
= uic
->uicsr
& uic
->uicer
& (~uic
->uiccr
);
303 cr
= uic
->uicsr
& uic
->uicer
& uic
->uiccr
;
305 if (loglevel
& CPU_LOG_INT
) {
306 fprintf(logfile
, "%s: uicsr %08" PRIx32
" uicer %08" PRIx32
307 " uiccr %08" PRIx32
"\n"
308 " %08" PRIx32
" ir %08" PRIx32
" cr %08" PRIx32
"\n",
309 __func__
, uic
->uicsr
, uic
->uicer
, uic
->uiccr
,
310 uic
->uicsr
& uic
->uicer
, ir
, cr
);
313 if (ir
!= 0x0000000) {
315 if (loglevel
& CPU_LOG_INT
) {
316 fprintf(logfile
, "Raise UIC interrupt\n");
319 qemu_irq_raise(uic
->irqs
[PPCUIC_OUTPUT_INT
]);
322 if (loglevel
& CPU_LOG_INT
) {
323 fprintf(logfile
, "Lower UIC interrupt\n");
326 qemu_irq_lower(uic
->irqs
[PPCUIC_OUTPUT_INT
]);
328 /* Trigger critical interrupt if any is pending and update vector */
329 if (cr
!= 0x0000000) {
330 qemu_irq_raise(uic
->irqs
[PPCUIC_OUTPUT_CINT
]);
331 if (uic
->use_vectors
) {
332 /* Compute critical IRQ vector */
333 if (uic
->uicvcr
& 1) {
342 uic
->uicvr
= uic
->uicvcr
& 0xFFFFFFFC;
343 for (i
= start
; i
<= end
; i
+= inc
) {
345 uic
->uicvr
+= (i
- start
) * 512 * inc
;
351 if (loglevel
& CPU_LOG_INT
) {
352 fprintf(logfile
, "Raise UIC critical interrupt - "
353 "vector %08" PRIx32
"\n", uic
->uicvr
);
358 if (loglevel
& CPU_LOG_INT
) {
359 fprintf(logfile
, "Lower UIC critical interrupt\n");
362 qemu_irq_lower(uic
->irqs
[PPCUIC_OUTPUT_CINT
]);
363 uic
->uicvr
= 0x00000000;
367 static void ppcuic_set_irq (void *opaque
, int irq_num
, int level
)
373 mask
= 1 << (31-irq_num
);
375 if (loglevel
& CPU_LOG_INT
) {
376 fprintf(logfile
, "%s: irq %d level %d uicsr %08" PRIx32
377 " mask %08" PRIx32
" => %08" PRIx32
" %08" PRIx32
"\n",
378 __func__
, irq_num
, level
,
379 uic
->uicsr
, mask
, uic
->uicsr
& mask
, level
<< irq_num
);
382 if (irq_num
< 0 || irq_num
> 31)
386 /* Update status register */
387 if (uic
->uictr
& mask
) {
388 /* Edge sensitive interrupt */
392 /* Level sensitive interrupt */
402 if (loglevel
& CPU_LOG_INT
) {
403 fprintf(logfile
, "%s: irq %d level %d sr %" PRIx32
" => "
404 "%08" PRIx32
"\n", __func__
, irq_num
, level
, uic
->uicsr
, sr
);
407 if (sr
!= uic
->uicsr
)
408 ppcuic_trigger_irq(uic
);
411 static target_ulong
dcr_read_uic (void *opaque
, int dcrn
)
417 dcrn
-= uic
->dcr_base
;
436 ret
= uic
->uicsr
& uic
->uicer
;
439 if (!uic
->use_vectors
)
444 if (!uic
->use_vectors
)
457 static void dcr_write_uic (void *opaque
, int dcrn
, target_ulong val
)
462 dcrn
-= uic
->dcr_base
;
464 if (loglevel
& CPU_LOG_INT
) {
465 fprintf(logfile
, "%s: dcr %d val " ADDRX
"\n", __func__
, dcrn
, val
);
471 uic
->uicsr
|= uic
->level
;
472 ppcuic_trigger_irq(uic
);
476 ppcuic_trigger_irq(uic
);
480 ppcuic_trigger_irq(uic
);
484 ppcuic_trigger_irq(uic
);
491 ppcuic_trigger_irq(uic
);
498 uic
->uicvcr
= val
& 0xFFFFFFFD;
499 ppcuic_trigger_irq(uic
);
504 static void ppcuic_reset (void *opaque
)
509 uic
->uiccr
= 0x00000000;
510 uic
->uicer
= 0x00000000;
511 uic
->uicpr
= 0x00000000;
512 uic
->uicsr
= 0x00000000;
513 uic
->uictr
= 0x00000000;
514 if (uic
->use_vectors
) {
515 uic
->uicvcr
= 0x00000000;
516 uic
->uicvr
= 0x0000000;
520 qemu_irq
*ppcuic_init (CPUState
*env
, qemu_irq
*irqs
,
521 uint32_t dcr_base
, int has_ssr
, int has_vr
)
526 uic
= qemu_mallocz(sizeof(ppcuic_t
));
528 uic
->dcr_base
= dcr_base
;
531 uic
->use_vectors
= 1;
532 for (i
= 0; i
< DCR_UICMAX
; i
++) {
533 ppc_dcr_register(env
, dcr_base
+ i
, uic
,
534 &dcr_read_uic
, &dcr_write_uic
);
536 qemu_register_reset(ppcuic_reset
, uic
);
540 return qemu_allocate_irqs(&ppcuic_set_irq
, uic
, UIC_MAX_IRQ
);
546 #define PCIC0_CFGADDR 0x0
547 #define PCIC0_CFGDATA 0x4
549 #define PCIL0_PMM0LA 0x0
550 #define PCIL0_PMM0MA 0x4
551 #define PCIL0_PMM0PCILA 0x8
552 #define PCIL0_PMM0PCIHA 0xc
553 #define PCIL0_PMM1LA 0x10
554 #define PCIL0_PMM1MA 0x14
555 #define PCIL0_PMM1PCILA 0x18
556 #define PCIL0_PMM1PCIHA 0x1c
557 #define PCIL0_PMM2LA 0x20
558 #define PCIL0_PMM2MA 0x24
559 #define PCIL0_PMM2PCILA 0x28
560 #define PCIL0_PMM2PCIHA 0x2c
561 #define PCIL0_PTM1MS 0x30
562 #define PCIL0_PTM1LA 0x34
563 #define PCIL0_PTM2MS 0x38
564 #define PCIL0_PTM2LA 0x3c
565 #define PCI_REG_SIZE 0x40
567 #define PPC44x_PCI_MA_MASK 0xfffff000
568 #define PPC44x_PCI_MA_ENABLE 0x1
571 static uint32_t pci4xx_cfgaddr_read4(void *opaque
, target_phys_addr_t addr
)
573 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
574 return cpu_to_le32(ppc4xx_pci
->pcic0_cfgaddr
);
577 static CPUReadMemoryFunc
*pci4xx_cfgaddr_read
[] = {
578 &pci4xx_cfgaddr_read4
,
579 &pci4xx_cfgaddr_read4
,
580 &pci4xx_cfgaddr_read4
,
583 static void pci4xx_cfgaddr_write4(void *opaque
, target_phys_addr_t addr
,
586 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
588 value
= le32_to_cpu(value
);
590 ppc4xx_pci
->pcic0_cfgaddr
= value
& ~0x3;
593 static CPUWriteMemoryFunc
*pci4xx_cfgaddr_write
[] = {
594 &pci4xx_cfgaddr_write4
,
595 &pci4xx_cfgaddr_write4
,
596 &pci4xx_cfgaddr_write4
,
599 static uint32_t pci4xx_cfgdata_read1(void *opaque
, target_phys_addr_t addr
)
601 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
602 int offset
= addr
& 0x3;
603 uint32_t cfgaddr
= ppc4xx_pci
->pcic0_cfgaddr
;
606 if (!(cfgaddr
& (1<<31)))
609 value
= pci_data_read(ppc4xx_pci
->bus
, cfgaddr
| offset
, 1);
614 static uint32_t pci4xx_cfgdata_read2(void *opaque
, target_phys_addr_t addr
)
616 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
617 int offset
= addr
& 0x3;
618 uint32_t cfgaddr
= ppc4xx_pci
->pcic0_cfgaddr
;
621 if (!(cfgaddr
& (1<<31)))
624 value
= pci_data_read(ppc4xx_pci
->bus
, cfgaddr
| offset
, 2);
626 return cpu_to_le16(value
);
629 static uint32_t pci4xx_cfgdata_read4(void *opaque
, target_phys_addr_t addr
)
631 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
632 int offset
= addr
& 0x3;
633 uint32_t cfgaddr
= ppc4xx_pci
->pcic0_cfgaddr
;
636 if (!(cfgaddr
& (1<<31)))
639 value
= pci_data_read(ppc4xx_pci
->bus
, cfgaddr
| offset
, 4);
641 return cpu_to_le32(value
);
644 static CPUReadMemoryFunc
*pci4xx_cfgdata_read
[] = {
645 &pci4xx_cfgdata_read1
,
646 &pci4xx_cfgdata_read2
,
647 &pci4xx_cfgdata_read4
,
650 static void pci4xx_cfgdata_write1(void *opaque
, target_phys_addr_t addr
,
653 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
654 int offset
= addr
& 0x3;
656 pci_data_write(ppc4xx_pci
->bus
, ppc4xx_pci
->pcic0_cfgaddr
| offset
,
660 static void pci4xx_cfgdata_write2(void *opaque
, target_phys_addr_t addr
,
663 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
664 int offset
= addr
& 0x3;
666 value
= le16_to_cpu(value
);
668 pci_data_write(ppc4xx_pci
->bus
, ppc4xx_pci
->pcic0_cfgaddr
| offset
,
672 static void pci4xx_cfgdata_write4(void *opaque
, target_phys_addr_t addr
,
675 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
676 int offset
= addr
& 0x3;
678 value
= le32_to_cpu(value
);
680 pci_data_write(ppc4xx_pci
->bus
, ppc4xx_pci
->pcic0_cfgaddr
| offset
,
684 static CPUWriteMemoryFunc
*pci4xx_cfgdata_write
[] = {
685 &pci4xx_cfgdata_write1
,
686 &pci4xx_cfgdata_write2
,
687 &pci4xx_cfgdata_write4
,
690 static void pci_reg_write4(void *opaque
, target_phys_addr_t addr
,
693 struct ppc4xx_pci_t
*pci
= opaque
;
694 unsigned long offset
= addr
- pci
->registers
;
696 value
= le32_to_cpu(value
);
700 pci
->pmm
[0].la
= value
;
703 pci
->pmm
[0].la
= value
;
706 pci
->pmm
[0].la
= value
;
709 //printf(" unhandled PCI internal register 0x%lx\n", offset);
714 static uint32_t pci_reg_read4(void *opaque
, target_phys_addr_t addr
)
716 struct ppc4xx_pci_t
*pci
= opaque
;
717 unsigned long offset
= addr
- pci
->registers
;
722 value
= pci
->pmm
[0].la
;
725 value
= pci
->pmm
[0].ma
;
727 case PCIL0_PMM0PCIHA
:
728 value
= pci
->pmm
[0].pciha
;
730 case PCIL0_PMM0PCILA
:
731 value
= pci
->pmm
[0].pcila
;
735 value
= pci
->pmm
[1].la
;
738 value
= pci
->pmm
[1].ma
;
740 case PCIL0_PMM1PCIHA
:
741 value
= pci
->pmm
[1].pciha
;
743 case PCIL0_PMM1PCILA
:
744 value
= pci
->pmm
[1].pcila
;
748 value
= pci
->pmm
[2].la
;
751 value
= pci
->pmm
[2].ma
;
753 case PCIL0_PMM2PCIHA
:
754 value
= pci
->pmm
[2].pciha
;
756 case PCIL0_PMM2PCILA
:
757 value
= pci
->pmm
[2].pcila
;
761 value
= pci
->ptm
[0].ms
;
764 value
= pci
->ptm
[0].la
;
767 value
= pci
->ptm
[1].ms
;
770 value
= pci
->ptm
[1].la
;
774 //printf(" read from invalid PCI internal register 0x%lx\n", offset);
778 value
= cpu_to_le32(value
);
783 static CPUReadMemoryFunc
*pci_reg_read
[] = {
789 static CPUWriteMemoryFunc
*pci_reg_write
[] = {
795 static uint32_t pci_int_ack_read4(void *opaque
, target_phys_addr_t addr
)
797 printf("%s\n", __func__
);
801 static CPUReadMemoryFunc
*pci_int_ack_read
[] = {
807 static void pci_special_write4(void *opaque
, target_phys_addr_t addr
,
810 printf("%s\n", __func__
);
813 static CPUWriteMemoryFunc
*pci_special_write
[] = {
819 static int bamboo_pci_map_irq(PCIDevice
*pci_dev
, int irq_num
)
821 int slot
= pci_dev
->devfn
>> 3;
824 printf("### %s: devfn %x irq %d -> %d\n", __func__
,
825 pci_dev
->devfn
, irq_num
, slot
+1);
828 /* All pins from each slot are tied to a single board IRQ (2-5) */
832 static void bamboo_pci_set_irq(qemu_irq
*pic
, int irq_num
, int level
)
835 printf("### %s: PCI irq %d, UIC irq %d\n", __func__
, irq_num
, 30 - irq_num
);
838 /* Board IRQs 2-5 are connected to UIC IRQs 28-25 */
839 qemu_set_irq(pic
[30-irq_num
], level
);
842 /* XXX Needs some abstracting for boards other than Bamboo. */
843 ppc4xx_pci_t
*ppc4xx_pci_init(CPUState
*env
, qemu_irq
*pic
,
844 target_phys_addr_t config_space
,
845 target_phys_addr_t int_ack
,
846 target_phys_addr_t special_cycle
,
847 target_phys_addr_t registers
)
853 pci
= qemu_mallocz(sizeof(ppc4xx_pci_t
));
857 pci
->config_space
= config_space
;
858 pci
->registers
= registers
;
861 pci
->bus
= pci_register_bus(bamboo_pci_set_irq
, bamboo_pci_map_irq
,
863 d
= pci_register_device(pci
->bus
, "host bridge", sizeof(PCIDevice
),
865 d
->config
[0x00] = 0x14; // vendor_id
866 d
->config
[0x01] = 0x10;
867 d
->config
[0x02] = 0x7f; // device_id
868 d
->config
[0x03] = 0x02;
869 d
->config
[0x0a] = 0x80; // class_sub = other bridge type
870 d
->config
[0x0b] = 0x06; // class_base = PCI_bridge
873 index
= cpu_register_io_memory(0, pci4xx_cfgaddr_read
,
874 pci4xx_cfgaddr_write
, pci
);
877 cpu_register_physical_memory(config_space
, 4, index
);
880 index
= cpu_register_io_memory(0, pci4xx_cfgdata_read
,
881 pci4xx_cfgdata_write
, pci
);
884 cpu_register_physical_memory(config_space
+ 4, 4, index
);
886 /* "Special cycle" and interrupt acknowledge */
887 index
= cpu_register_io_memory(0, pci_int_ack_read
,
888 pci_special_write
, pci
);
891 cpu_register_physical_memory(int_ack
, 4, index
);
893 /* Internal registers */
894 index
= cpu_register_io_memory(0, pci_reg_read
, pci_reg_write
, pci
);
897 cpu_register_physical_memory(registers
, PCI_REG_SIZE
, index
);
899 /* XXX register_savevm() */
904 printf("%s error\n", __func__
);