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
);
64 register_savevm("cpu", 0, 3, cpu_save
, cpu_load
, env
);
69 /*****************************************************************************/
70 /* Fake device used to map multiple devices in a single memory page */
71 #define MMIO_AREA_BITS 8
72 #define MMIO_AREA_LEN (1 << MMIO_AREA_BITS)
73 #define MMIO_AREA_NB (1 << (TARGET_PAGE_BITS - MMIO_AREA_BITS))
74 #define MMIO_IDX(addr) (((addr) >> MMIO_AREA_BITS) & (MMIO_AREA_NB - 1))
75 struct ppc4xx_mmio_t
{
76 target_phys_addr_t base
;
77 CPUReadMemoryFunc
**mem_read
[MMIO_AREA_NB
];
78 CPUWriteMemoryFunc
**mem_write
[MMIO_AREA_NB
];
79 void *opaque
[MMIO_AREA_NB
];
82 static uint32_t unassigned_mmio_readb (void *opaque
, target_phys_addr_t addr
)
84 #ifdef DEBUG_UNASSIGNED
88 printf("Unassigned mmio read 0x" PADDRX
" base " PADDRX
"\n",
95 static void unassigned_mmio_writeb (void *opaque
,
96 target_phys_addr_t addr
, uint32_t val
)
98 #ifdef DEBUG_UNASSIGNED
102 printf("Unassigned mmio write 0x" PADDRX
" = 0x%x base " PADDRX
"\n",
103 addr
, val
, mmio
->base
);
107 static CPUReadMemoryFunc
*unassigned_mmio_read
[3] = {
108 unassigned_mmio_readb
,
109 unassigned_mmio_readb
,
110 unassigned_mmio_readb
,
113 static CPUWriteMemoryFunc
*unassigned_mmio_write
[3] = {
114 unassigned_mmio_writeb
,
115 unassigned_mmio_writeb
,
116 unassigned_mmio_writeb
,
119 static uint32_t mmio_readlen (ppc4xx_mmio_t
*mmio
,
120 target_phys_addr_t addr
, int len
)
122 CPUReadMemoryFunc
**mem_read
;
126 idx
= MMIO_IDX(addr
- mmio
->base
);
127 #if defined(DEBUG_MMIO)
128 printf("%s: mmio %p len %d addr " PADDRX
" idx %d\n", __func__
,
129 mmio
, len
, addr
, idx
);
131 mem_read
= mmio
->mem_read
[idx
];
132 ret
= (*mem_read
[len
])(mmio
->opaque
[idx
], addr
- mmio
->base
);
137 static void mmio_writelen (ppc4xx_mmio_t
*mmio
,
138 target_phys_addr_t addr
, uint32_t value
, int len
)
140 CPUWriteMemoryFunc
**mem_write
;
143 idx
= MMIO_IDX(addr
- mmio
->base
);
144 #if defined(DEBUG_MMIO)
145 printf("%s: mmio %p len %d addr " PADDRX
" idx %d value %08" PRIx32
"\n",
146 __func__
, mmio
, len
, addr
, idx
, value
);
148 mem_write
= mmio
->mem_write
[idx
];
149 (*mem_write
[len
])(mmio
->opaque
[idx
], addr
- mmio
->base
, value
);
152 static uint32_t mmio_readb (void *opaque
, target_phys_addr_t addr
)
154 #if defined(DEBUG_MMIO)
155 printf("%s: addr " PADDRX
"\n", __func__
, addr
);
158 return mmio_readlen(opaque
, addr
, 0);
161 static void mmio_writeb (void *opaque
,
162 target_phys_addr_t addr
, uint32_t value
)
164 #if defined(DEBUG_MMIO)
165 printf("%s: addr " PADDRX
" val %08" PRIx32
"\n", __func__
, addr
, value
);
167 mmio_writelen(opaque
, addr
, value
, 0);
170 static uint32_t mmio_readw (void *opaque
, target_phys_addr_t addr
)
172 #if defined(DEBUG_MMIO)
173 printf("%s: addr " PADDRX
"\n", __func__
, addr
);
176 return mmio_readlen(opaque
, addr
, 1);
179 static void mmio_writew (void *opaque
,
180 target_phys_addr_t addr
, uint32_t value
)
182 #if defined(DEBUG_MMIO)
183 printf("%s: addr " PADDRX
" val %08" PRIx32
"\n", __func__
, addr
, value
);
185 mmio_writelen(opaque
, addr
, value
, 1);
188 static uint32_t mmio_readl (void *opaque
, target_phys_addr_t addr
)
190 #if defined(DEBUG_MMIO)
191 printf("%s: addr " PADDRX
"\n", __func__
, addr
);
194 return mmio_readlen(opaque
, addr
, 2);
197 static void mmio_writel (void *opaque
,
198 target_phys_addr_t addr
, uint32_t value
)
200 #if defined(DEBUG_MMIO)
201 printf("%s: addr " PADDRX
" val %08" PRIx32
"\n", __func__
, addr
, value
);
203 mmio_writelen(opaque
, addr
, value
, 2);
206 static CPUReadMemoryFunc
*mmio_read
[] = {
212 static CPUWriteMemoryFunc
*mmio_write
[] = {
218 int ppc4xx_mmio_register (CPUState
*env
, ppc4xx_mmio_t
*mmio
,
219 target_phys_addr_t offset
, uint32_t len
,
220 CPUReadMemoryFunc
**mem_read
,
221 CPUWriteMemoryFunc
**mem_write
, void *opaque
)
223 target_phys_addr_t end
;
226 if ((offset
+ len
) > TARGET_PAGE_SIZE
)
228 idx
= MMIO_IDX(offset
);
229 end
= offset
+ len
- 1;
230 eidx
= MMIO_IDX(end
);
231 #if defined(DEBUG_MMIO)
232 printf("%s: offset " PADDRX
" len %08" PRIx32
" " PADDRX
" %d %d\n",
233 __func__
, offset
, len
, end
, idx
, eidx
);
235 for (; idx
<= eidx
; idx
++) {
236 mmio
->mem_read
[idx
] = mem_read
;
237 mmio
->mem_write
[idx
] = mem_write
;
238 mmio
->opaque
[idx
] = opaque
;
244 ppc4xx_mmio_t
*ppc4xx_mmio_init (CPUState
*env
, target_phys_addr_t base
)
249 mmio
= qemu_mallocz(sizeof(ppc4xx_mmio_t
));
252 mmio_memory
= cpu_register_io_memory(0, mmio_read
, mmio_write
, mmio
);
253 #if defined(DEBUG_MMIO)
254 printf("%s: base " PADDRX
" len %08x %d\n", __func__
,
255 base
, TARGET_PAGE_SIZE
, mmio_memory
);
257 cpu_register_physical_memory(base
, TARGET_PAGE_SIZE
, mmio_memory
);
258 ppc4xx_mmio_register(env
, mmio
, 0, TARGET_PAGE_SIZE
,
259 unassigned_mmio_read
, unassigned_mmio_write
,
266 /*****************************************************************************/
267 /* "Universal" Interrupt controller */
281 #define UIC_MAX_IRQ 32
282 typedef struct ppcuic_t ppcuic_t
;
286 uint32_t level
; /* Remembers the state of level-triggered interrupts. */
287 uint32_t uicsr
; /* Status register */
288 uint32_t uicer
; /* Enable register */
289 uint32_t uiccr
; /* Critical register */
290 uint32_t uicpr
; /* Polarity register */
291 uint32_t uictr
; /* Triggering register */
292 uint32_t uicvcr
; /* Vector configuration register */
297 static void ppcuic_trigger_irq (ppcuic_t
*uic
)
300 int start
, end
, inc
, i
;
302 /* Trigger interrupt if any is pending */
303 ir
= uic
->uicsr
& uic
->uicer
& (~uic
->uiccr
);
304 cr
= uic
->uicsr
& uic
->uicer
& uic
->uiccr
;
306 if (loglevel
& CPU_LOG_INT
) {
307 fprintf(logfile
, "%s: uicsr %08" PRIx32
" uicer %08" PRIx32
308 " uiccr %08" PRIx32
"\n"
309 " %08" PRIx32
" ir %08" PRIx32
" cr %08" PRIx32
"\n",
310 __func__
, uic
->uicsr
, uic
->uicer
, uic
->uiccr
,
311 uic
->uicsr
& uic
->uicer
, ir
, cr
);
314 if (ir
!= 0x0000000) {
316 if (loglevel
& CPU_LOG_INT
) {
317 fprintf(logfile
, "Raise UIC interrupt\n");
320 qemu_irq_raise(uic
->irqs
[PPCUIC_OUTPUT_INT
]);
323 if (loglevel
& CPU_LOG_INT
) {
324 fprintf(logfile
, "Lower UIC interrupt\n");
327 qemu_irq_lower(uic
->irqs
[PPCUIC_OUTPUT_INT
]);
329 /* Trigger critical interrupt if any is pending and update vector */
330 if (cr
!= 0x0000000) {
331 qemu_irq_raise(uic
->irqs
[PPCUIC_OUTPUT_CINT
]);
332 if (uic
->use_vectors
) {
333 /* Compute critical IRQ vector */
334 if (uic
->uicvcr
& 1) {
343 uic
->uicvr
= uic
->uicvcr
& 0xFFFFFFFC;
344 for (i
= start
; i
<= end
; i
+= inc
) {
346 uic
->uicvr
+= (i
- start
) * 512 * inc
;
352 if (loglevel
& CPU_LOG_INT
) {
353 fprintf(logfile
, "Raise UIC critical interrupt - "
354 "vector %08" PRIx32
"\n", uic
->uicvr
);
359 if (loglevel
& CPU_LOG_INT
) {
360 fprintf(logfile
, "Lower UIC critical interrupt\n");
363 qemu_irq_lower(uic
->irqs
[PPCUIC_OUTPUT_CINT
]);
364 uic
->uicvr
= 0x00000000;
368 static void ppcuic_set_irq (void *opaque
, int irq_num
, int level
)
374 mask
= 1 << (31-irq_num
);
376 if (loglevel
& CPU_LOG_INT
) {
377 fprintf(logfile
, "%s: irq %d level %d uicsr %08" PRIx32
378 " mask %08" PRIx32
" => %08" PRIx32
" %08" PRIx32
"\n",
379 __func__
, irq_num
, level
,
380 uic
->uicsr
, mask
, uic
->uicsr
& mask
, level
<< irq_num
);
383 if (irq_num
< 0 || irq_num
> 31)
387 /* Update status register */
388 if (uic
->uictr
& mask
) {
389 /* Edge sensitive interrupt */
393 /* Level sensitive interrupt */
403 if (loglevel
& CPU_LOG_INT
) {
404 fprintf(logfile
, "%s: irq %d level %d sr %" PRIx32
" => "
405 "%08" PRIx32
"\n", __func__
, irq_num
, level
, uic
->uicsr
, sr
);
408 if (sr
!= uic
->uicsr
)
409 ppcuic_trigger_irq(uic
);
412 static target_ulong
dcr_read_uic (void *opaque
, int dcrn
)
418 dcrn
-= uic
->dcr_base
;
437 ret
= uic
->uicsr
& uic
->uicer
;
440 if (!uic
->use_vectors
)
445 if (!uic
->use_vectors
)
458 static void dcr_write_uic (void *opaque
, int dcrn
, target_ulong val
)
463 dcrn
-= uic
->dcr_base
;
465 if (loglevel
& CPU_LOG_INT
) {
466 fprintf(logfile
, "%s: dcr %d val " ADDRX
"\n", __func__
, dcrn
, val
);
472 uic
->uicsr
|= uic
->level
;
473 ppcuic_trigger_irq(uic
);
477 ppcuic_trigger_irq(uic
);
481 ppcuic_trigger_irq(uic
);
485 ppcuic_trigger_irq(uic
);
492 ppcuic_trigger_irq(uic
);
499 uic
->uicvcr
= val
& 0xFFFFFFFD;
500 ppcuic_trigger_irq(uic
);
505 static void ppcuic_reset (void *opaque
)
510 uic
->uiccr
= 0x00000000;
511 uic
->uicer
= 0x00000000;
512 uic
->uicpr
= 0x00000000;
513 uic
->uicsr
= 0x00000000;
514 uic
->uictr
= 0x00000000;
515 if (uic
->use_vectors
) {
516 uic
->uicvcr
= 0x00000000;
517 uic
->uicvr
= 0x0000000;
521 qemu_irq
*ppcuic_init (CPUState
*env
, qemu_irq
*irqs
,
522 uint32_t dcr_base
, int has_ssr
, int has_vr
)
527 uic
= qemu_mallocz(sizeof(ppcuic_t
));
529 uic
->dcr_base
= dcr_base
;
532 uic
->use_vectors
= 1;
533 for (i
= 0; i
< DCR_UICMAX
; i
++) {
534 ppc_dcr_register(env
, dcr_base
+ i
, uic
,
535 &dcr_read_uic
, &dcr_write_uic
);
537 qemu_register_reset(ppcuic_reset
, uic
);
541 return qemu_allocate_irqs(&ppcuic_set_irq
, uic
, UIC_MAX_IRQ
);
547 #define PCIC0_CFGADDR 0x0
548 #define PCIC0_CFGDATA 0x4
550 #define PCIL0_PMM0LA 0x0
551 #define PCIL0_PMM0MA 0x4
552 #define PCIL0_PMM0PCILA 0x8
553 #define PCIL0_PMM0PCIHA 0xc
554 #define PCIL0_PMM1LA 0x10
555 #define PCIL0_PMM1MA 0x14
556 #define PCIL0_PMM1PCILA 0x18
557 #define PCIL0_PMM1PCIHA 0x1c
558 #define PCIL0_PMM2LA 0x20
559 #define PCIL0_PMM2MA 0x24
560 #define PCIL0_PMM2PCILA 0x28
561 #define PCIL0_PMM2PCIHA 0x2c
562 #define PCIL0_PTM1MS 0x30
563 #define PCIL0_PTM1LA 0x34
564 #define PCIL0_PTM2MS 0x38
565 #define PCIL0_PTM2LA 0x3c
566 #define PCI_REG_SIZE 0x40
568 #define PPC44x_PCI_MA_MASK 0xfffff000
569 #define PPC44x_PCI_MA_ENABLE 0x1
572 static uint32_t pci4xx_cfgaddr_read4(void *opaque
, target_phys_addr_t addr
)
574 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
575 return cpu_to_le32(ppc4xx_pci
->pcic0_cfgaddr
);
578 static CPUReadMemoryFunc
*pci4xx_cfgaddr_read
[] = {
579 &pci4xx_cfgaddr_read4
,
580 &pci4xx_cfgaddr_read4
,
581 &pci4xx_cfgaddr_read4
,
584 static void pci4xx_cfgaddr_write4(void *opaque
, target_phys_addr_t addr
,
587 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
589 value
= le32_to_cpu(value
);
591 ppc4xx_pci
->pcic0_cfgaddr
= value
& ~0x3;
594 static CPUWriteMemoryFunc
*pci4xx_cfgaddr_write
[] = {
595 &pci4xx_cfgaddr_write4
,
596 &pci4xx_cfgaddr_write4
,
597 &pci4xx_cfgaddr_write4
,
600 static uint32_t pci4xx_cfgdata_read1(void *opaque
, target_phys_addr_t addr
)
602 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
603 int offset
= addr
& 0x3;
604 uint32_t cfgaddr
= ppc4xx_pci
->pcic0_cfgaddr
;
607 if (!(cfgaddr
& (1<<31)))
610 value
= pci_data_read(ppc4xx_pci
->bus
, cfgaddr
| offset
, 1);
615 static uint32_t pci4xx_cfgdata_read2(void *opaque
, target_phys_addr_t addr
)
617 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
618 int offset
= addr
& 0x3;
619 uint32_t cfgaddr
= ppc4xx_pci
->pcic0_cfgaddr
;
622 if (!(cfgaddr
& (1<<31)))
625 value
= pci_data_read(ppc4xx_pci
->bus
, cfgaddr
| offset
, 2);
627 return cpu_to_le16(value
);
630 static uint32_t pci4xx_cfgdata_read4(void *opaque
, target_phys_addr_t addr
)
632 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
633 int offset
= addr
& 0x3;
634 uint32_t cfgaddr
= ppc4xx_pci
->pcic0_cfgaddr
;
637 if (!(cfgaddr
& (1<<31)))
640 value
= pci_data_read(ppc4xx_pci
->bus
, cfgaddr
| offset
, 4);
642 return cpu_to_le32(value
);
645 static CPUReadMemoryFunc
*pci4xx_cfgdata_read
[] = {
646 &pci4xx_cfgdata_read1
,
647 &pci4xx_cfgdata_read2
,
648 &pci4xx_cfgdata_read4
,
651 static void pci4xx_cfgdata_write1(void *opaque
, target_phys_addr_t addr
,
654 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
655 int offset
= addr
& 0x3;
657 pci_data_write(ppc4xx_pci
->bus
, ppc4xx_pci
->pcic0_cfgaddr
| offset
,
661 static void pci4xx_cfgdata_write2(void *opaque
, target_phys_addr_t addr
,
664 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
665 int offset
= addr
& 0x3;
667 value
= le16_to_cpu(value
);
669 pci_data_write(ppc4xx_pci
->bus
, ppc4xx_pci
->pcic0_cfgaddr
| offset
,
673 static void pci4xx_cfgdata_write4(void *opaque
, target_phys_addr_t addr
,
676 ppc4xx_pci_t
*ppc4xx_pci
= opaque
;
677 int offset
= addr
& 0x3;
679 value
= le32_to_cpu(value
);
681 pci_data_write(ppc4xx_pci
->bus
, ppc4xx_pci
->pcic0_cfgaddr
| offset
,
685 static CPUWriteMemoryFunc
*pci4xx_cfgdata_write
[] = {
686 &pci4xx_cfgdata_write1
,
687 &pci4xx_cfgdata_write2
,
688 &pci4xx_cfgdata_write4
,
691 static void pci_reg_write4(void *opaque
, target_phys_addr_t addr
,
694 struct ppc4xx_pci_t
*pci
= opaque
;
695 unsigned long offset
= addr
- pci
->registers
;
697 value
= le32_to_cpu(value
);
701 pci
->pmm
[0].la
= value
;
704 pci
->pmm
[0].la
= value
;
707 pci
->pmm
[0].la
= value
;
710 //printf(" unhandled PCI internal register 0x%lx\n", offset);
715 static uint32_t pci_reg_read4(void *opaque
, target_phys_addr_t addr
)
717 struct ppc4xx_pci_t
*pci
= opaque
;
718 unsigned long offset
= addr
- pci
->registers
;
723 value
= pci
->pmm
[0].la
;
726 value
= pci
->pmm
[0].ma
;
728 case PCIL0_PMM0PCIHA
:
729 value
= pci
->pmm
[0].pciha
;
731 case PCIL0_PMM0PCILA
:
732 value
= pci
->pmm
[0].pcila
;
736 value
= pci
->pmm
[1].la
;
739 value
= pci
->pmm
[1].ma
;
741 case PCIL0_PMM1PCIHA
:
742 value
= pci
->pmm
[1].pciha
;
744 case PCIL0_PMM1PCILA
:
745 value
= pci
->pmm
[1].pcila
;
749 value
= pci
->pmm
[2].la
;
752 value
= pci
->pmm
[2].ma
;
754 case PCIL0_PMM2PCIHA
:
755 value
= pci
->pmm
[2].pciha
;
757 case PCIL0_PMM2PCILA
:
758 value
= pci
->pmm
[2].pcila
;
762 value
= pci
->ptm
[0].ms
;
765 value
= pci
->ptm
[0].la
;
768 value
= pci
->ptm
[1].ms
;
771 value
= pci
->ptm
[1].la
;
775 //printf(" read from invalid PCI internal register 0x%lx\n", offset);
779 value
= cpu_to_le32(value
);
784 static CPUReadMemoryFunc
*pci_reg_read
[] = {
790 static CPUWriteMemoryFunc
*pci_reg_write
[] = {
796 static uint32_t pci_int_ack_read4(void *opaque
, target_phys_addr_t addr
)
798 printf("%s\n", __func__
);
802 static CPUReadMemoryFunc
*pci_int_ack_read
[] = {
808 static void pci_special_write4(void *opaque
, target_phys_addr_t addr
,
811 printf("%s\n", __func__
);
814 static CPUWriteMemoryFunc
*pci_special_write
[] = {
820 static int bamboo_pci_map_irq(PCIDevice
*pci_dev
, int irq_num
)
822 int slot
= pci_dev
->devfn
>> 3;
825 printf("### %s: devfn %x irq %d -> %d\n", __func__
,
826 pci_dev
->devfn
, irq_num
, slot
+1);
829 /* All pins from each slot are tied to a single board IRQ (2-5) */
833 static void bamboo_pci_set_irq(qemu_irq
*pic
, int irq_num
, int level
)
836 printf("### %s: PCI irq %d, UIC irq %d\n", __func__
, irq_num
, 30 - irq_num
);
839 /* Board IRQs 2-5 are connected to UIC IRQs 28-25 */
840 qemu_set_irq(pic
[30-irq_num
], level
);
843 /* XXX Needs some abstracting for boards other than Bamboo. */
844 ppc4xx_pci_t
*ppc4xx_pci_init(CPUState
*env
, qemu_irq
*pic
,
845 target_phys_addr_t config_space
,
846 target_phys_addr_t int_ack
,
847 target_phys_addr_t special_cycle
,
848 target_phys_addr_t registers
)
854 pci
= qemu_mallocz(sizeof(ppc4xx_pci_t
));
858 pci
->config_space
= config_space
;
859 pci
->registers
= registers
;
862 pci
->bus
= pci_register_bus(bamboo_pci_set_irq
, bamboo_pci_map_irq
,
864 d
= pci_register_device(pci
->bus
, "host bridge", sizeof(PCIDevice
),
866 d
->config
[0x00] = 0x14; // vendor_id
867 d
->config
[0x01] = 0x10;
868 d
->config
[0x02] = 0x7f; // device_id
869 d
->config
[0x03] = 0x02;
870 d
->config
[0x0a] = 0x80; // class_sub = other bridge type
871 d
->config
[0x0b] = 0x06; // class_base = PCI_bridge
874 index
= cpu_register_io_memory(0, pci4xx_cfgaddr_read
,
875 pci4xx_cfgaddr_write
, pci
);
878 cpu_register_physical_memory(config_space
, 4, index
);
881 index
= cpu_register_io_memory(0, pci4xx_cfgdata_read
,
882 pci4xx_cfgdata_write
, pci
);
885 cpu_register_physical_memory(config_space
+ 4, 4, index
);
887 /* "Special cycle" and interrupt acknowledge */
888 index
= cpu_register_io_memory(0, pci_int_ack_read
,
889 pci_special_write
, pci
);
892 cpu_register_physical_memory(int_ack
, 4, index
);
894 /* Internal registers */
895 index
= cpu_register_io_memory(0, pci_reg_read
, pci_reg_write
, pci
);
898 cpu_register_physical_memory(registers
, PCI_REG_SIZE
, index
);
900 /* XXX register_savevm() */
905 printf("%s error\n", __func__
);