~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to hw/prep_pci.c

  • Committer: ths
  • Date: 2007-05-05 19:24:38 UTC
  • Revision ID: git-v1:608e8ce280cee231b3de0e7922060efd23447a54
Linker scripts for MIPS hosts.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2772 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * QEMU PREP PCI host
3
3
 *
4
4
 * Copyright (c) 2006 Fabrice Bellard
5
 
 *
 
5
 * 
6
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
 * of this software and associated documentation files (the "Software"), to deal
8
8
 * in the Software without restriction, including without limitation the rights
22
22
 * THE SOFTWARE.
23
23
 */
24
24
 
25
 
#include "hw.h"
26
 
#include "pci.h"
27
 
 
 
25
#include "vl.h"
28
26
typedef uint32_t pci_addr_t;
29
27
#include "pci_host.h"
30
28
 
119
117
    &PPC_PCIIO_readl,
120
118
};
121
119
 
 
120
/* Don't know if this matches real hardware, but it agrees with OHW.  */
122
121
static int prep_map_irq(PCIDevice *pci_dev, int irq_num)
123
122
{
124
123
    return (irq_num + (pci_dev->devfn >> 3)) & 1;
126
125
 
127
126
static void prep_set_irq(qemu_irq *pic, int irq_num, int level)
128
127
{
129
 
    qemu_set_irq(pic[(irq_num & 1) ? 11 : 9] , level);
 
128
    qemu_set_irq(pic[irq_num ? 11 : 9], level);
130
129
}
131
130
 
132
131
PCIBus *pci_prep_init(qemu_irq *pic)
136
135
    int PPC_io_memory;
137
136
 
138
137
    s = qemu_mallocz(sizeof(PREPPCIState));
139
 
    s->bus = pci_register_bus(prep_set_irq, prep_map_irq, pic, 0, 4);
 
138
    s->bus = pci_register_bus(prep_set_irq, prep_map_irq, pic, 0, 2);
140
139
 
141
140
    register_ioport_write(0xcf8, 4, 4, pci_prep_addr_writel, s);
142
141
    register_ioport_read(0xcf8, 4, 4, pci_prep_addr_readl, s);
148
147
    register_ioport_read(0xcfc, 4, 2, pci_host_data_readw, s);
149
148
    register_ioport_read(0xcfc, 4, 4, pci_host_data_readl, s);
150
149
 
151
 
    PPC_io_memory = cpu_register_io_memory(0, PPC_PCIIO_read,
 
150
    PPC_io_memory = cpu_register_io_memory(0, PPC_PCIIO_read, 
152
151
                                           PPC_PCIIO_write, s);
153
152
    cpu_register_physical_memory(0x80800000, 0x00400000, PPC_io_memory);
154
153
 
155
 
    /* PCI host bridge */
156
 
    d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven",
 
154
    /* PCI host bridge */ 
 
155
    d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven", 
157
156
                            sizeof(PCIDevice), 0, NULL, NULL);
158
157
    d->config[0x00] = 0x57; // vendor_id : Motorola
159
158
    d->config[0x01] = 0x10;