~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to hw/sh4/sh_pci.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "qemu/bswap.h"
29
29
#include "exec/address-spaces.h"
30
30
 
 
31
#define TYPE_SH_PCI_HOST_BRIDGE "sh_pci"
 
32
 
 
33
#define SH_PCI_HOST_BRIDGE(obj) \
 
34
    OBJECT_CHECK(SHPCIState, (obj), TYPE_SH_PCI_HOST_BRIDGE)
 
35
 
31
36
typedef struct SHPCIState {
32
 
    SysBusDevice busdev;
33
 
    PCIBus *bus;
 
37
    PCIHostState parent_obj;
 
38
 
34
39
    PCIDevice *dev;
35
40
    qemu_irq irq[4];
36
41
    MemoryRegion memconfig_p4;
45
50
                              unsigned size)
46
51
{
47
52
    SHPCIState *pcic = p;
 
53
    PCIHostState *phb = PCI_HOST_BRIDGE(pcic);
 
54
 
48
55
    switch(addr) {
49
56
    case 0 ... 0xfc:
50
57
        cpu_to_le32w((uint32_t*)(pcic->dev->config + addr), val);
64
71
        }
65
72
        break;
66
73
    case 0x220:
67
 
        pci_data_write(pcic->bus, pcic->par, val, 4);
 
74
        pci_data_write(phb->bus, pcic->par, val, 4);
68
75
        break;
69
76
    }
70
77
}
73
80
                                 unsigned size)
74
81
{
75
82
    SHPCIState *pcic = p;
 
83
    PCIHostState *phb = PCI_HOST_BRIDGE(pcic);
 
84
 
76
85
    switch(addr) {
77
86
    case 0 ... 0xfc:
78
87
        return le32_to_cpup((uint32_t*)(pcic->dev->config + addr));
83
92
    case 0x1c8:
84
93
        return pcic->iobr;
85
94
    case 0x220:
86
 
        return pci_data_read(pcic->bus, pcic->par, 4);
 
95
        return pci_data_read(phb->bus, pcic->par, 4);
87
96
    }
88
97
    return 0;
89
98
}
112
121
 
113
122
static int sh_pci_device_init(SysBusDevice *dev)
114
123
{
 
124
    PCIHostState *phb;
115
125
    SHPCIState *s;
116
126
    int i;
117
127
 
118
 
    s = FROM_SYSBUS(SHPCIState, dev);
 
128
    s = SH_PCI_HOST_BRIDGE(dev);
 
129
    phb = PCI_HOST_BRIDGE(s);
119
130
    for (i = 0; i < 4; i++) {
120
131
        sysbus_init_irq(dev, &s->irq[i]);
121
132
    }
122
 
    s->bus = pci_register_bus(&s->busdev.qdev, "pci",
123
 
                              sh_pci_set_irq, sh_pci_map_irq,
124
 
                              s->irq,
125
 
                              get_system_memory(),
126
 
                              get_system_io(),
127
 
                              PCI_DEVFN(0, 0), 4, TYPE_PCI_BUS);
128
 
    memory_region_init_io(&s->memconfig_p4, &sh_pci_reg_ops, s,
 
133
    phb->bus = pci_register_bus(DEVICE(dev), "pci",
 
134
                                sh_pci_set_irq, sh_pci_map_irq,
 
135
                                s->irq,
 
136
                                get_system_memory(),
 
137
                                get_system_io(),
 
138
                                PCI_DEVFN(0, 0), 4, TYPE_PCI_BUS);
 
139
    memory_region_init_io(&s->memconfig_p4, OBJECT(s), &sh_pci_reg_ops, s,
129
140
                          "sh_pci", 0x224);
130
 
    memory_region_init_alias(&s->memconfig_a7, "sh_pci.2", &s->memconfig_p4,
131
 
                             0, 0x224);
132
 
    isa_mmio_setup(&s->isa, 0x40000);
 
141
    memory_region_init_alias(&s->memconfig_a7, OBJECT(s), "sh_pci.2",
 
142
                             &s->memconfig_p4, 0, 0x224);
 
143
    memory_region_init_alias(&s->isa, OBJECT(s), "sh_pci.isa",
 
144
                             get_system_io(), 0, 0x40000);
133
145
    sysbus_init_mmio(dev, &s->memconfig_p4);
134
146
    sysbus_init_mmio(dev, &s->memconfig_a7);
135
147
    s->iobr = 0xfe240000;
136
148
    memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
137
149
 
138
 
    s->dev = pci_create_simple(s->bus, PCI_DEVFN(0, 0), "sh_pci_host");
 
150
    s->dev = pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host");
139
151
    return 0;
140
152
}
141
153
 
171
183
}
172
184
 
173
185
static const TypeInfo sh_pci_device_info = {
174
 
    .name          = "sh_pci",
175
 
    .parent        = TYPE_SYS_BUS_DEVICE,
 
186
    .name          = TYPE_SH_PCI_HOST_BRIDGE,
 
187
    .parent        = TYPE_PCI_HOST_BRIDGE,
176
188
    .instance_size = sizeof(SHPCIState),
177
189
    .class_init    = sh_pci_device_class_init,
178
190
};