mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
Compare commits
339
Commits
stable-0.12
...
staging
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95e74c70c4 | ||
|
|
52001445c9 | ||
|
|
ee0216275b | ||
|
|
d0652aa8ac | ||
|
|
810f49b56a | ||
|
|
95a2f9bc58 | ||
|
|
ceb696159d | ||
|
|
c9f398e53f | ||
|
|
012f087923 | ||
|
|
076d247142 | ||
|
|
e726fe7d60 | ||
|
|
95372a393d | ||
|
|
0e8c9214ba | ||
|
|
18cb1d8557 | ||
|
|
561ef251e7 | ||
|
|
123810851e | ||
|
|
41ea49b328 | ||
|
|
f49188043b | ||
|
|
17ccbc27de | ||
|
|
d50f71dc17 | ||
|
|
38ec7b5357 | ||
|
|
fd10a04ef1 | ||
|
|
04afa4a88c | ||
|
|
77047bb7c2 | ||
|
|
44e4c0ba86 | ||
|
|
821b19fe92 | ||
|
|
ea3fdd5d8c | ||
|
|
dffbe21746 | ||
|
|
87f6d3f630 | ||
|
|
995963852c | ||
|
|
3e372cf87f | ||
|
|
b430a22562 | ||
|
|
302698e882 | ||
|
|
3caf2562c2 | ||
|
|
19e65b47f6 | ||
|
|
60f67a9c95 | ||
|
|
f6b6f1bc80 | ||
|
|
cf61680217 | ||
|
|
6bb4ca57a1 | ||
|
|
ff44c2f3c8 | ||
|
|
ecbe1576b3 | ||
|
|
114cdfa908 | ||
|
|
00ccf932a0 | ||
|
|
5fdb3aa16a | ||
|
|
f0d98b0517 | ||
|
|
5a41ecc5f2 | ||
|
|
34ba360fda | ||
|
|
c71b5b4a9c | ||
|
|
2e01c8cf4b | ||
|
|
2fe0ee97f9 | ||
|
|
f6dc18df5c | ||
|
|
545557d4ab | ||
|
|
ad674e53b5 | ||
|
|
c84bd4f104 | ||
|
|
f21a59c224 | ||
|
|
e405a2ba91 | ||
|
|
502e64fe23 | ||
|
|
f7001a3b9e | ||
|
|
58e3e40027 | ||
|
|
22ff51ee64 | ||
|
|
2758aa520d | ||
|
|
6474bd6909 | ||
|
|
2bff4b6fbe | ||
|
|
1cd9656f27 | ||
|
|
56594fe3dc | ||
|
|
4da5fcd391 | ||
|
|
f2c688bb42 | ||
|
|
98a3cb024b | ||
|
|
a40e3411d1 | ||
|
|
e0fe020441 | ||
|
|
fb58a897fd | ||
|
|
cb67beb136 | ||
|
|
3d09c490e5 | ||
|
|
b8ba4176aa | ||
|
|
b81ebc6990 | ||
|
|
d74dbb9476 | ||
|
|
db579e9e73 | ||
|
|
4468fb6343 | ||
|
|
fcce95e2ee | ||
|
|
d3e2f1353e | ||
|
|
5d89715b00 | ||
|
|
5845f0e5e8 | ||
|
|
3fa0f9552b | ||
|
|
409570a735 | ||
|
|
1e68f8c4a6 | ||
|
|
508cc6b466 | ||
|
|
d577679e57 | ||
|
|
97526229da | ||
|
|
0b5b3547cd | ||
|
|
e6c4cfd503 | ||
|
|
a9cbacb0d6 | ||
|
|
a7b15a5cc6 | ||
|
|
59d1c1c2d7 | ||
|
|
2edd07ef03 | ||
|
|
56f4927e34 | ||
|
|
a212ea7553 | ||
|
|
431722077a | ||
|
|
4a09aa895e | ||
|
|
21a8894168 | ||
|
|
209bf9658a | ||
|
|
73b01960b4 | ||
|
|
b711de9565 | ||
|
|
e3ea652962 | ||
|
|
c4b3be3966 | ||
|
|
a3b3912ad0 | ||
|
|
4f7836b7eb | ||
|
|
46214a2785 | ||
|
|
9706c06d9c | ||
|
|
935effc2bb | ||
|
|
7631c97ec9 | ||
|
|
7a93cc55e9 | ||
|
|
51e526063d | ||
|
|
e2f3e741b4 | ||
|
|
d049e626ad | ||
|
|
21e807fadb | ||
|
|
dd0a365144 | ||
|
|
49995e1748 | ||
|
|
f9e69bd9cf | ||
|
|
66393fb9dd | ||
|
|
d032d1b4b4 | ||
|
|
f76cfe56d9 | ||
|
|
58faa1a6db | ||
|
|
299060a06e | ||
|
|
060fbfe1d6 | ||
|
|
b4b784fe98 | ||
|
|
d14ed2548c | ||
|
|
0aced4e219 | ||
|
|
4303f6d800 | ||
|
|
13232b8f45 | ||
|
|
c749374978 | ||
|
|
3b0bd6ec5b | ||
|
|
b6e098d79f | ||
|
|
940489824e | ||
|
|
052f1b9be5 | ||
|
|
3661d51e8d | ||
|
|
0abc657914 | ||
|
|
43e713ce93 | ||
|
|
82c09f2f0d | ||
|
|
384dce1ede | ||
|
|
109ac32fb5 | ||
|
|
659139d780 | ||
|
|
c6703b4761 | ||
|
|
9a0c6a3373 | ||
|
|
099fe236d5 | ||
|
|
1e8b27ca85 | ||
|
|
2dc3f77c86 | ||
|
|
632cf034b4 | ||
|
|
379526a40e | ||
|
|
abe147e0ce | ||
|
|
c2b5bda43a | ||
|
|
8c52c8f320 | ||
|
|
c2039bd0ff | ||
|
|
ec7efac4a9 | ||
|
|
47f5ba7248 | ||
|
|
aef30c3c6a | ||
|
|
c62313bbdc | ||
|
|
acb6685fea | ||
|
|
8095cb3ed2 | ||
|
|
b5cc6e32ba | ||
|
|
a6109ff1b5 | ||
|
|
ee3e41a9a0 | ||
|
|
f0138a63a4 | ||
|
|
f351d050dc | ||
|
|
9ef5c4bf81 | ||
|
|
69fd02eea6 | ||
|
|
eba6fe8732 | ||
|
|
42be86ce95 | ||
|
|
15ff770544 | ||
|
|
d8bcbabf26 | ||
|
|
ac33f8fad1 | ||
|
|
2daa119126 | ||
|
|
183e6e5257 | ||
|
|
cfdf2c4057 | ||
|
|
78d714e08f | ||
|
|
29ec3156ee | ||
|
|
18dd19a7d9 | ||
|
|
2dd650e58a | ||
|
|
092493be3c | ||
|
|
75f1247539 | ||
|
|
40a0d7c395 | ||
|
|
36ecd7c016 | ||
|
|
d46272c774 | ||
|
|
31827373f0 | ||
|
|
02c2b87fff | ||
|
|
d587e07871 | ||
|
|
e249651ca9 | ||
|
|
86f3dba651 | ||
|
|
38536da1e3 | ||
|
|
a1e4b07f04 | ||
|
|
d7963c43b9 | ||
|
|
3a03bfa5a2 | ||
|
|
c1bb0dcef2 | ||
|
|
d0af544555 | ||
|
|
68bd052ee1 | ||
|
|
06445248d2 | ||
|
|
dbb30fe6ef | ||
|
|
fe57ca82b0 | ||
|
|
ab3aee26c4 | ||
|
|
212df02975 | ||
|
|
5a2b3fc5aa | ||
|
|
73642f5bdb | ||
|
|
4c24aa0a69 | ||
|
|
17c52a43b4 | ||
|
|
591d6f1dfd | ||
|
|
d9a50a366f | ||
|
|
a06d48d91f | ||
|
|
50eb6e5c04 | ||
|
|
ffec44f14f | ||
|
|
14ab163429 | ||
|
|
248c42f393 | ||
|
|
ab471ade02 | ||
|
|
73651cce62 | ||
|
|
377a43b6fb | ||
|
|
87d98f9551 | ||
|
|
806991da3a | ||
|
|
13e4df99ce | ||
|
|
91a7593526 | ||
|
|
f1e00a9cf3 | ||
|
|
ba0e276db4 | ||
|
|
990b3e1901 | ||
|
|
a964acc6bf | ||
|
|
19188121b4 | ||
|
|
da1f14021e | ||
|
|
8a57a6c740 | ||
|
|
d19954f46d | ||
|
|
9da53be7ea | ||
|
|
ff1d1977ff | ||
|
|
364d48314a | ||
|
|
6ea219d019 | ||
|
|
c960206137 | ||
|
|
662d748516 | ||
|
|
7dca4ad050 | ||
|
|
ea63e2c358 | ||
|
|
32188a03da | ||
|
|
79ef2c4cdb | ||
|
|
90228ee395 | ||
|
|
cf708987d7 | ||
|
|
0435d39360 | ||
|
|
b32bb95264 | ||
|
|
be45f06826 | ||
|
|
ee7139c33b | ||
|
|
82407d1a40 | ||
|
|
c5de386ac9 | ||
|
|
ad3cea4248 | ||
|
|
f062a3c793 | ||
|
|
9d2dcce9a3 | ||
|
|
1a03675db1 | ||
|
|
d96fd29cca | ||
|
|
7a344f7ac7 | ||
|
|
588b383201 | ||
|
|
218a536a7a | ||
|
|
d15e546567 | ||
|
|
c86a668390 | ||
|
|
e78c48ec4e | ||
|
|
9603ceba2e | ||
|
|
14f0720df9 | ||
|
|
e05486cba6 | ||
|
|
2af5ba712b | ||
|
|
c0e8520ed5 | ||
|
|
45e914cfe0 | ||
|
|
55483ad657 | ||
|
|
1a728677d4 | ||
|
|
7f1796713e | ||
|
|
f2e1750803 | ||
|
|
cd4dde36ae | ||
|
|
2a01000f7d | ||
|
|
2471dd00ef | ||
|
|
4a93fe1708 | ||
|
|
d318ff9900 | ||
|
|
11f4d7f483 | ||
|
|
09e3acc6cf | ||
|
|
53e0d8affe | ||
|
|
986c5f7854 | ||
|
|
aee1b935c5 | ||
|
|
6ca5582d4f | ||
|
|
22a0e04b9b | ||
|
|
8858934370 | ||
|
|
33521634bf | ||
|
|
aa40fc9c96 | ||
|
|
cb4522ccf6 | ||
|
|
d8c208dd8a | ||
|
|
64465297cd | ||
|
|
e1c09175bc | ||
|
|
abdeed06b4 | ||
|
|
6a5e8b0e31 | ||
|
|
998bbd74b9 | ||
|
|
735ba58849 | ||
|
|
51bfa4d316 | ||
|
|
014100bb73 | ||
|
|
4e307fc883 | ||
|
|
1a688d3bbc | ||
|
|
07a8de3566 | ||
|
|
d0fef6fbea | ||
|
|
458fb6792d | ||
|
|
4d6e3ac5d4 | ||
|
|
bd9d30640c | ||
|
|
556cd09885 | ||
|
|
063846984c | ||
|
|
0fe6d12e0b | ||
|
|
ba32edab7f | ||
|
|
6d74ca5aa8 | ||
|
|
b3c3f123f7 | ||
|
|
20ff6c8066 | ||
|
|
725b8a6983 | ||
|
|
7029a83bd6 | ||
|
|
be5e834986 | ||
|
|
b4d34d5e9b | ||
|
|
6287462ef5 | ||
|
|
7dbbbb0c9e | ||
|
|
77e595e7c6 | ||
|
|
7cdfcfe18f | ||
|
|
a488be27e5 | ||
|
|
7a046f5f14 | ||
|
|
41471a2338 | ||
|
|
063c1a0918 | ||
|
|
c7c338c497 | ||
|
|
ec3b82afaa | ||
|
|
a6906e31a8 | ||
|
|
7a84cb23c0 | ||
|
|
17901e7532 | ||
|
|
2c2a6bb860 | ||
|
|
5cfe026475 | ||
|
|
b086838090 | ||
|
|
e16a181222 | ||
|
|
2895e075c6 | ||
|
|
94171e119c | ||
|
|
0df37c411c | ||
|
|
ad382a1257 | ||
|
|
a3a55a2edb | ||
|
|
f6d855c50d | ||
|
|
b6981cb57b | ||
|
|
f9bf77dd1f | ||
|
|
d036bb215e | ||
|
|
5b5cb08683 | ||
|
|
2760952ba9 | ||
|
|
6d9fef1a02 | ||
|
|
6fb6d24554 | ||
|
|
5d7ff5bbde | ||
|
|
ee4660f925 |
No files matched your search
@@ -46,6 +46,7 @@ qemu-monitor.texi
|
||||
patches
|
||||
pc-bios/bios-pq/status
|
||||
pc-bios/vgabios-pq/status
|
||||
pc-bios/optionrom/linuxboot.bin
|
||||
pc-bios/optionrom/multiboot.bin
|
||||
pc-bios/optionrom/multiboot.raw
|
||||
.stgit-*
|
||||
@@ -1,3 +1,73 @@
|
||||
version 0.12.0:
|
||||
|
||||
- Update to SeaBIOS 0.5.0
|
||||
- e1000: fix device link status in Linux (Anthony Liguori)
|
||||
- monitor: fix QMP for balloon command (Luiz Capitulino)
|
||||
- QMP: Return an empty dict by default (Luiz Capitulino)
|
||||
- QMP: Only handle converted commands (Luiz Capitulino)
|
||||
- pci: support PCI based option rom loading (Gerd Hoffman/Anthony Liguori)
|
||||
- Fix backcompat for hotplug of SCSI controllers (Daniel P. Berrange)
|
||||
- fdc: fix migration from 0.11 (Juan Quintela)
|
||||
- vmware-vga: fix segv on cursor resize. (Dave Airlie)
|
||||
- vmware-vga: various fixes (Dave Airlie/Anthony Liguori)
|
||||
- qdev: improve property error reporting. (Gerd Hoffmann)
|
||||
- fix vga names in default_list (Gerd Hoffmann)
|
||||
- usb-host: check mon before using it. (Gerd Hoffmann)
|
||||
- usb-net: use qdev for -usbdevice (Gerd Hoffmann)
|
||||
- monitor: Catch printing to non-existent monitor (Luiz Capitulino)
|
||||
- Avoid permanently disabled QEMU monitor when UNIX migration fails (Daniel P. Berrange)
|
||||
- Fix loading of ELF multiboot kernels (Kevin Wolf)
|
||||
- qemu-io: Fix memory leak (Kevin Wolf)
|
||||
- Fix thinko in linuxboot.S (Paolo Bonzini)
|
||||
- target-i386: Fix evaluation of DR7 register (Jan Kiszka)
|
||||
- vnc: hextile: do not generate ForegroundSpecified and SubrectsColoured tiles (Anthony Liguori)
|
||||
- S390: Bail out without KVM (Alexander Graf)
|
||||
- S390: Don't tell guest we're updating config space (Alexander Graf)
|
||||
- target-s390: Fail on unknown instructions (Alexander Graf)
|
||||
- osdep: Fix runtime failure on older Linux kernels (Andre Przywara)
|
||||
- Fix a make -j race (Juergen Lock)
|
||||
- target-alpha: Fix generic ctz64. (Richard Henderson)
|
||||
- s390: Fix buggy assignment (Stefan Weil)
|
||||
- target-mips: fix user-mode emulation startup (Nathan Froyd)
|
||||
- target-i386: Update CPUID feature set for TCG (Andre Przywara)
|
||||
- s390: fix build on 32 bit host (Michael S. Tsirkin)
|
||||
|
||||
version 0.12.0-rc2:
|
||||
|
||||
- v2: properly save kvm system time msr registers (Glauber Costa)
|
||||
- convert more monitor commands to qmp (Luiz Capitulino)
|
||||
- vnc: fix capslock tracking logic. (Gerd Hoffmann)
|
||||
- QemuOpts: allow larger option values. (Gerd Hoffmann)
|
||||
- scsi: fix drive hotplug. (Gerd Hoffmann)
|
||||
- pci: don't hw_error() when no slot is available. (Gerd Hoffmann)
|
||||
- pci: don't abort() when trying to hotplug with acpi off. (Gerd Hoffmann)
|
||||
- allow default devices to be implemented in config file (Gerd Hoffman)
|
||||
- vc: colorize chardev title line with blue background. (Gerd Hoffmann)
|
||||
- chardev: make chardevs specified in config file work. (Gerd Hoffmann)
|
||||
- qdev: also match bus name for global properties (Gerd Hoffmann)
|
||||
- qdev: add command line option to set global defaults for properties. (Gerd Hoffmann)
|
||||
- kvm: x86: Save/restore exception_index (Jan Kiszka)
|
||||
- qdev: Replace device names containing whitespace (Markus Armbruster)
|
||||
- fix rtc-td-hack on host without high-res timers (Gleb Natapov)
|
||||
- virtio: verify features on load (Michael S. Tsirkin)
|
||||
- vmware_vga: add rom file so that it boots. (Dave Airlie)
|
||||
- Do not abort on qemu_malloc(0) in production builds (Anthony Liguori)
|
||||
- Fix ARM userspace strex implementation. (Paul Brook)
|
||||
- qemu: delete rule target on error (Michael S. Tsirkin)
|
||||
- QMP: add human-readable description to error response (Markus Armbruster)
|
||||
- convert more monitor commands to QError (Markus Armbruster)
|
||||
- monitor: Fix double-prompt after "change vnc passwd BLA" (Markus Armbruster)
|
||||
- monitor: do_cont(): Don't ask for passwords (Luiz Capitulino)
|
||||
- monitor: Introduce 'block_passwd' command (Luiz Capitulino)
|
||||
- pci: interrupt disable bit support (Michael S. Tsirkin)
|
||||
- pci: interrupt status bit implementation (Michael S. Tsirkin)
|
||||
- pci: prepare irq code for interrupt state (Michael S. Tsirkin)
|
||||
- msix: function mask support (Michael S. Tsirkin)
|
||||
- msix: macro rename for function mask support (Michael S. Tsirkin)
|
||||
- cpuid: Fix multicore setup on Intel (Andre Przywara)
|
||||
- kvm: x86: Fix initial kvm_has_msr_star (Jan Kiszka)
|
||||
- Update OpenBIOS images to r640 (Aurelien Jarno)
|
||||
|
||||
version 0.10.2:
|
||||
|
||||
- fix savevm/loadvm (Anthony Liguori)
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ Main loop Fabrice Bellard (new maintainer needed)
|
||||
TCG Fabrice Bellard
|
||||
IDE device ?
|
||||
SCSI device Paul Brook
|
||||
PCI layer ?
|
||||
PCI layer Michael S. Tsirkin
|
||||
USB layer ?
|
||||
Block layer ?
|
||||
Graphic layer ?
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# Makefile for QEMU.
|
||||
|
||||
# This needs to be defined before rules.mak
|
||||
GENERATED_HEADERS = config-host.h
|
||||
|
||||
ifneq ($(wildcard config-host.mak),)
|
||||
@@ -8,7 +7,7 @@ ifneq ($(wildcard config-host.mak),)
|
||||
all: build-all
|
||||
include config-host.mak
|
||||
include $(SRC_PATH)/rules.mak
|
||||
config-host.mak: configure
|
||||
config-host.mak: $(SRC_PATH)/configure
|
||||
@echo $@ is out-of-date, running configure
|
||||
@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
|
||||
else
|
||||
@@ -25,7 +24,7 @@ configure: ;
|
||||
.PHONY: all clean cscope distclean dvi html info install install-doc \
|
||||
recurse-all speed tar tarbin test build-all
|
||||
|
||||
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
|
||||
$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
|
||||
|
||||
LIBS+=-lz $(LIBS_TOOLS)
|
||||
|
||||
@@ -43,12 +42,22 @@ config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
|
||||
|
||||
%/config-devices.mak: default-configs/%.mak
|
||||
$(call quiet-command,cat $< > $@.tmp, " GEN $@")
|
||||
@if test -f $@ ; then \
|
||||
echo "WARNING: $@ out of date." ;\
|
||||
echo "Run \"make defconfig\" to regenerate." ; \
|
||||
rm $@.tmp ; \
|
||||
@if test -f $@; then \
|
||||
if cmp -s $@.old $@ || cmp -s $@ $@.tmp; then \
|
||||
mv $@.tmp $@; \
|
||||
cp -p $@ $@.old; \
|
||||
else \
|
||||
if test -f $@.old; then \
|
||||
echo "WARNING: $@ (user modified) out of date.";\
|
||||
else \
|
||||
echo "WARNING: $@ out of date.";\
|
||||
fi; \
|
||||
echo "Run \"make defconfig\" to regenerate."; \
|
||||
rm $@.tmp; \
|
||||
fi; \
|
||||
else \
|
||||
mv $@.tmp $@ ; \
|
||||
mv $@.tmp $@; \
|
||||
cp -p $@ $@.old; \
|
||||
fi
|
||||
|
||||
defconfig:
|
||||
@@ -66,11 +75,14 @@ SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
|
||||
subdir-%: $(GENERATED_HEADERS)
|
||||
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
|
||||
|
||||
$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
|
||||
include $(SRC_PATH)/Makefile.objs
|
||||
|
||||
$(common-obj-y): $(GENERATED_HEADERS)
|
||||
$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y)
|
||||
|
||||
$(filter %-user,$(SUBDIR_RULES)): libuser.a
|
||||
|
||||
libuser.a:
|
||||
libuser.a: $(GENERATED_HEADERS)
|
||||
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libuser V="$(V)" TARGET_DIR="libuser/" all,)
|
||||
|
||||
ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
|
||||
@@ -81,119 +93,8 @@ ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
|
||||
|
||||
recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
|
||||
|
||||
#######################################################################
|
||||
# block-obj-y is code used by both qemu system emulation and qemu-img
|
||||
|
||||
block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
|
||||
block-obj-y += nbd.o block.o aio.o aes.o osdep.o
|
||||
block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
|
||||
block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
|
||||
|
||||
block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
|
||||
block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
|
||||
block-nested-y += parallels.o nbd.o
|
||||
block-nested-$(CONFIG_WIN32) += raw-win32.o
|
||||
block-nested-$(CONFIG_POSIX) += raw-posix.o
|
||||
block-nested-$(CONFIG_CURL) += curl.o
|
||||
|
||||
block-obj-y += $(addprefix block/, $(block-nested-y))
|
||||
|
||||
net-obj-y = net.o
|
||||
net-nested-y = queue.o checksum.o util.o
|
||||
net-nested-y += socket.o
|
||||
net-nested-y += dump.o
|
||||
net-nested-$(CONFIG_POSIX) += tap.o
|
||||
net-nested-$(CONFIG_LINUX) += tap-linux.o
|
||||
net-nested-$(CONFIG_WIN32) += tap-win32.o
|
||||
net-nested-$(CONFIG_BSD) += tap-bsd.o
|
||||
net-nested-$(CONFIG_SOLARIS) += tap-solaris.o
|
||||
net-nested-$(CONFIG_AIX) += tap-aix.o
|
||||
net-nested-$(CONFIG_SLIRP) += slirp.o
|
||||
net-nested-$(CONFIG_VDE) += vde.o
|
||||
net-obj-y += $(addprefix net/, $(net-nested-y))
|
||||
|
||||
######################################################################
|
||||
# libqemu_common.a: Target independent part of system emulation. The
|
||||
# long term path is to suppress *all* target specific code in case of
|
||||
# system emulation, i.e. a single QEMU executable should support all
|
||||
# CPUs and machines.
|
||||
|
||||
obj-y = $(block-obj-y)
|
||||
obj-y += $(net-obj-y)
|
||||
obj-y += readline.o console.o
|
||||
|
||||
obj-y += tcg-runtime.o host-utils.o
|
||||
obj-y += irq.o ioport.o
|
||||
obj-$(CONFIG_PTIMER) += ptimer.o
|
||||
obj-$(CONFIG_MAX7310) += max7310.o
|
||||
obj-$(CONFIG_WM8750) += wm8750.o
|
||||
obj-$(CONFIG_TWL92230) += twl92230.o
|
||||
obj-$(CONFIG_TSC2005) += tsc2005.o
|
||||
obj-$(CONFIG_LM832X) += lm832x.o
|
||||
obj-$(CONFIG_TMP105) += tmp105.o
|
||||
obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o
|
||||
obj-$(CONFIG_SSD0303) += ssd0303.o
|
||||
obj-$(CONFIG_SSD0323) += ssd0323.o
|
||||
obj-$(CONFIG_ADS7846) += ads7846.o
|
||||
obj-$(CONFIG_MAX111X) += max111x.o
|
||||
obj-$(CONFIG_DS1338) += ds1338.o
|
||||
obj-y += i2c.o smbus.o smbus_eeprom.o
|
||||
obj-y += eeprom93xx.o
|
||||
obj-y += scsi-disk.o cdrom.o
|
||||
obj-y += scsi-generic.o scsi-bus.o
|
||||
obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
|
||||
obj-y += usb-serial.o usb-net.o usb-bus.o
|
||||
obj-$(CONFIG_SSI) += ssi.o
|
||||
obj-$(CONFIG_SSI_SD) += ssi-sd.o
|
||||
obj-$(CONFIG_SD) += sd.o
|
||||
obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
|
||||
obj-y += bt-hci-csr.o
|
||||
obj-y += buffered_file.o migration.o migration-tcp.o qemu-sockets.o
|
||||
obj-y += qemu-char.o aio.o savevm.o
|
||||
obj-y += msmouse.o ps2.o
|
||||
obj-y += qdev.o qdev-properties.o
|
||||
obj-y += qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o json-lexer.o
|
||||
obj-y += json-streamer.o json-parser.o qjson.o qerror.o
|
||||
obj-y += qemu-config.o block-migration.o
|
||||
|
||||
obj-$(CONFIG_BRLAPI) += baum.o
|
||||
obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
|
||||
|
||||
audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
|
||||
|
||||
audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
|
||||
audio-obj-$(CONFIG_SDL) += sdlaudio.o
|
||||
audio-obj-$(CONFIG_OSS) += ossaudio.o
|
||||
audio-obj-$(CONFIG_COREAUDIO) += coreaudio.o
|
||||
audio-obj-$(CONFIG_ALSA) += alsaaudio.o
|
||||
audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o
|
||||
audio-obj-$(CONFIG_FMOD) += fmodaudio.o
|
||||
audio-obj-$(CONFIG_ESD) += esdaudio.o
|
||||
audio-obj-$(CONFIG_PA) += paaudio.o
|
||||
audio-obj-$(CONFIG_WINWAVE) += winwaveaudio.o
|
||||
audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
|
||||
audio-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
|
||||
audio-obj-y += wavcapture.o
|
||||
obj-y += $(addprefix audio/, $(audio-obj-y))
|
||||
|
||||
obj-y += keymaps.o
|
||||
obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
|
||||
obj-$(CONFIG_CURSES) += curses.o
|
||||
obj-y += vnc.o acl.o d3des.o
|
||||
obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o
|
||||
obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
|
||||
obj-$(CONFIG_COCOA) += cocoa.o
|
||||
obj-$(CONFIG_IOTHREAD) += qemu-thread.o
|
||||
|
||||
slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
|
||||
slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o
|
||||
slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o
|
||||
obj-$(CONFIG_SLIRP) += $(addprefix slirp/, $(slirp-obj-y))
|
||||
|
||||
# xen backend driver support
|
||||
obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
|
||||
obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
|
||||
|
||||
QEMU_CFLAGS+=$(CURL_CFLAGS)
|
||||
|
||||
cocoa.o: cocoa.m
|
||||
@@ -224,24 +125,30 @@ curses.o: curses.c keymaps.h curses_keys.h
|
||||
|
||||
bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
|
||||
|
||||
libqemu_common.a: $(obj-y)
|
||||
|
||||
######################################################################
|
||||
|
||||
qemu-img.o: qemu-img-cmds.h
|
||||
|
||||
qemu-img$(EXESUF): qemu-img.o qemu-tool.o $(block-obj-y)
|
||||
obj-y = qemu-img.o qemu-tool.o $(block-obj-y) $(qobject-obj-y)
|
||||
|
||||
qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o $(block-obj-y)
|
||||
qemu-img$(EXESUF): $(obj-y)
|
||||
|
||||
qemu-io$(EXESUF): qemu-io.o qemu-tool.o cmd.o $(block-obj-y)
|
||||
obj-y = qemu-nbd.o qemu-tool.o $(block-obj-y) $(qobject-obj-y)
|
||||
$(obj-y): $(GENERATED_HEADERS)
|
||||
|
||||
qemu-nbd$(EXESUF): $(obj-y)
|
||||
|
||||
obj-y = qemu-io.o qemu-tool.o cmd.o $(block-obj-y) $(qobject-obj-y)
|
||||
$(obj-y): $(GENERATED_HEADERS)
|
||||
|
||||
qemu-io$(EXESUF): $(obj-y)
|
||||
|
||||
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
|
||||
$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
|
||||
|
||||
check-qint: check-qint.o qint.o qemu-malloc.o
|
||||
check-qstring: check-qstring.o qstring.o qemu-malloc.o
|
||||
check-qdict: check-qdict.o qdict.o qint.o qstring.o qemu-malloc.o
|
||||
check-qdict: check-qdict.o qdict.o qint.o qstring.o qbool.o qemu-malloc.o qlist.o
|
||||
check-qlist: check-qlist.o qlist.o qint.o qemu-malloc.o
|
||||
check-qfloat: check-qfloat.o qfloat.o qemu-malloc.o
|
||||
check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o qemu-malloc.o
|
||||
|
||||
+3
-32
@@ -7,45 +7,16 @@ include $(SRC_PATH)/rules.mak
|
||||
|
||||
.PHONY: all
|
||||
|
||||
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
|
||||
$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
|
||||
|
||||
QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
|
||||
|
||||
obj-y =
|
||||
obj-y += loader.o
|
||||
obj-y += virtio.o
|
||||
obj-y += fw_cfg.o
|
||||
obj-y += watchdog.o
|
||||
obj-$(CONFIG_ECC) += ecc.o
|
||||
obj-$(CONFIG_NAND) += nand.o
|
||||
include $(SRC_PATH)/Makefile.objs
|
||||
|
||||
obj-$(CONFIG_M48T59) += m48t59.o
|
||||
obj-$(CONFIG_ESCC) += escc.o
|
||||
|
||||
# PCI watchdog devices
|
||||
obj-y += wdt_i6300esb.o
|
||||
|
||||
obj-y += msix.o
|
||||
|
||||
# PCI network cards
|
||||
obj-y += ne2000.o
|
||||
|
||||
obj-$(CONFIG_SMC91C111) += smc91c111.o
|
||||
obj-$(CONFIG_LAN9118) += lan9118.o
|
||||
|
||||
# SCSI layer
|
||||
obj-y += lsi53c895a.o
|
||||
obj-$(CONFIG_ESP) += esp.o
|
||||
|
||||
obj-y += dma-helpers.o sysbus.o isa-bus.o
|
||||
obj-$(CONFIG_QDEV_ADDR) += qdev-addr.o
|
||||
|
||||
all: $(HWLIB)
|
||||
all: $(hw-obj-y)
|
||||
# Dummy command so that make thinks it has done something
|
||||
@true
|
||||
|
||||
$(HWLIB): $(obj-y)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d *.a *~
|
||||
|
||||
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#######################################################################
|
||||
# QObject
|
||||
qobject-obj-y = qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o
|
||||
qobject-obj-y += qjson.o json-lexer.o json-streamer.o json-parser.o
|
||||
qobject-obj-y += qerror.o
|
||||
|
||||
#######################################################################
|
||||
# block-obj-y is code used by both qemu system emulation and qemu-img
|
||||
|
||||
block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
|
||||
block-obj-y += nbd.o block.o aio.o aes.o osdep.o
|
||||
block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
|
||||
block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
|
||||
|
||||
block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
|
||||
block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
|
||||
block-nested-y += parallels.o nbd.o
|
||||
block-nested-$(CONFIG_WIN32) += raw-win32.o
|
||||
block-nested-$(CONFIG_POSIX) += raw-posix.o
|
||||
block-nested-$(CONFIG_CURL) += curl.o
|
||||
|
||||
block-obj-y += $(addprefix block/, $(block-nested-y))
|
||||
|
||||
net-obj-y = net.o
|
||||
net-nested-y = queue.o checksum.o util.o
|
||||
net-nested-y += socket.o
|
||||
net-nested-y += dump.o
|
||||
net-nested-$(CONFIG_POSIX) += tap.o
|
||||
net-nested-$(CONFIG_LINUX) += tap-linux.o
|
||||
net-nested-$(CONFIG_WIN32) += tap-win32.o
|
||||
net-nested-$(CONFIG_BSD) += tap-bsd.o
|
||||
net-nested-$(CONFIG_SOLARIS) += tap-solaris.o
|
||||
net-nested-$(CONFIG_AIX) += tap-aix.o
|
||||
net-nested-$(CONFIG_SLIRP) += slirp.o
|
||||
net-nested-$(CONFIG_VDE) += vde.o
|
||||
net-obj-y += $(addprefix net/, $(net-nested-y))
|
||||
|
||||
######################################################################
|
||||
# libqemu_common.a: Target independent part of system emulation. The
|
||||
# long term path is to suppress *all* target specific code in case of
|
||||
# system emulation, i.e. a single QEMU executable should support all
|
||||
# CPUs and machines.
|
||||
|
||||
common-obj-y = $(block-obj-y)
|
||||
common-obj-y += $(net-obj-y)
|
||||
common-obj-y += $(qobject-obj-y)
|
||||
common-obj-y += readline.o console.o
|
||||
|
||||
common-obj-y += tcg-runtime.o host-utils.o
|
||||
common-obj-y += irq.o ioport.o
|
||||
common-obj-$(CONFIG_PTIMER) += ptimer.o
|
||||
common-obj-$(CONFIG_MAX7310) += max7310.o
|
||||
common-obj-$(CONFIG_WM8750) += wm8750.o
|
||||
common-obj-$(CONFIG_TWL92230) += twl92230.o
|
||||
common-obj-$(CONFIG_TSC2005) += tsc2005.o
|
||||
common-obj-$(CONFIG_LM832X) += lm832x.o
|
||||
common-obj-$(CONFIG_TMP105) += tmp105.o
|
||||
common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o
|
||||
common-obj-$(CONFIG_SSD0303) += ssd0303.o
|
||||
common-obj-$(CONFIG_SSD0323) += ssd0323.o
|
||||
common-obj-$(CONFIG_ADS7846) += ads7846.o
|
||||
common-obj-$(CONFIG_MAX111X) += max111x.o
|
||||
common-obj-$(CONFIG_DS1338) += ds1338.o
|
||||
common-obj-y += i2c.o smbus.o smbus_eeprom.o
|
||||
common-obj-y += eeprom93xx.o
|
||||
common-obj-y += scsi-disk.o cdrom.o
|
||||
common-obj-y += scsi-generic.o scsi-bus.o
|
||||
common-obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
|
||||
common-obj-y += usb-serial.o usb-net.o usb-bus.o
|
||||
common-obj-$(CONFIG_SSI) += ssi.o
|
||||
common-obj-$(CONFIG_SSI_SD) += ssi-sd.o
|
||||
common-obj-$(CONFIG_SD) += sd.o
|
||||
common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
|
||||
common-obj-y += bt-hci-csr.o
|
||||
common-obj-y += buffered_file.o migration.o migration-tcp.o qemu-sockets.o
|
||||
common-obj-y += qemu-char.o savevm.o #aio.o
|
||||
common-obj-y += msmouse.o ps2.o
|
||||
common-obj-y += qdev.o qdev-properties.o
|
||||
common-obj-y += qemu-config.o block-migration.o
|
||||
|
||||
common-obj-$(CONFIG_BRLAPI) += baum.o
|
||||
common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
|
||||
|
||||
audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
|
||||
audio-obj-$(CONFIG_SDL) += sdlaudio.o
|
||||
audio-obj-$(CONFIG_OSS) += ossaudio.o
|
||||
audio-obj-$(CONFIG_COREAUDIO) += coreaudio.o
|
||||
audio-obj-$(CONFIG_ALSA) += alsaaudio.o
|
||||
audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o
|
||||
audio-obj-$(CONFIG_FMOD) += fmodaudio.o
|
||||
audio-obj-$(CONFIG_ESD) += esdaudio.o
|
||||
audio-obj-$(CONFIG_PA) += paaudio.o
|
||||
audio-obj-$(CONFIG_WINWAVE) += winwaveaudio.o
|
||||
audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
|
||||
audio-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
|
||||
audio-obj-y += wavcapture.o
|
||||
common-obj-y += $(addprefix audio/, $(audio-obj-y))
|
||||
|
||||
common-obj-y += keymaps.o
|
||||
common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
|
||||
common-obj-$(CONFIG_CURSES) += curses.o
|
||||
common-obj-y += vnc.o acl.o d3des.o
|
||||
common-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o
|
||||
common-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
|
||||
common-obj-$(CONFIG_COCOA) += cocoa.o
|
||||
common-obj-$(CONFIG_IOTHREAD) += qemu-thread.o
|
||||
|
||||
slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
|
||||
slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o
|
||||
slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o
|
||||
common-obj-$(CONFIG_SLIRP) += $(addprefix slirp/, $(slirp-obj-y))
|
||||
|
||||
# xen backend driver support
|
||||
common-obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
|
||||
common-obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
|
||||
|
||||
######################################################################
|
||||
# libuser
|
||||
|
||||
user-obj-y =
|
||||
user-obj-y += envlist.o path.o
|
||||
user-obj-y += tcg-runtime.o host-utils.o
|
||||
user-obj-y += cutils.o cache-utils.o
|
||||
|
||||
######################################################################
|
||||
# libhw
|
||||
|
||||
hw-obj-y =
|
||||
hw-obj-y += loader.o
|
||||
hw-obj-y += virtio.o
|
||||
hw-obj-y += fw_cfg.o
|
||||
hw-obj-y += watchdog.o
|
||||
hw-obj-$(CONFIG_ECC) += ecc.o
|
||||
hw-obj-$(CONFIG_NAND) += nand.o
|
||||
|
||||
hw-obj-$(CONFIG_M48T59) += m48t59.o
|
||||
hw-obj-$(CONFIG_ESCC) += escc.o
|
||||
|
||||
# PCI watchdog devices
|
||||
hw-obj-y += wdt_i6300esb.o
|
||||
|
||||
hw-obj-y += msix.o
|
||||
|
||||
# PCI network cards
|
||||
hw-obj-y += ne2000.o
|
||||
|
||||
hw-obj-$(CONFIG_SMC91C111) += smc91c111.o
|
||||
hw-obj-$(CONFIG_LAN9118) += lan9118.o
|
||||
|
||||
# SCSI layer
|
||||
hw-obj-y += lsi53c895a.o
|
||||
hw-obj-$(CONFIG_ESP) += esp.o
|
||||
|
||||
hw-obj-y += dma-helpers.o sysbus.o isa-bus.o
|
||||
hw-obj-$(CONFIG_QDEV_ADDR) += qdev-addr.o
|
||||
+34
-14
@@ -1,17 +1,21 @@
|
||||
# -*- Mode: makefile -*-
|
||||
|
||||
# This needs to be defined before rules.mak
|
||||
GENERATED_HEADERS = config-target.h
|
||||
|
||||
include ../config-host.mak
|
||||
include config-devices.mak
|
||||
include config-target.mak
|
||||
include $(SRC_PATH)/rules.mak
|
||||
ifneq ($(HWDIR),)
|
||||
include $(HWDIR)/config.mak
|
||||
endif
|
||||
|
||||
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
|
||||
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
|
||||
$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
|
||||
QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
|
||||
|
||||
include $(SRC_PATH)/Makefile.objs
|
||||
|
||||
ifdef CONFIG_USER_ONLY
|
||||
# user emulator name
|
||||
QEMU_PROG=qemu-$(TARGET_ARCH2)
|
||||
@@ -64,9 +68,9 @@ libobj-$(CONFIG_S390_DIS) += s390-dis.o
|
||||
libobj-$(CONFIG_SH4_DIS) += sh4-dis.o
|
||||
libobj-$(CONFIG_SPARC_DIS) += sparc-dis.o
|
||||
|
||||
# libqemu
|
||||
$(libobj-y): $(GENERATED_HEADERS)
|
||||
|
||||
libqemu.a: $(libobj-y)
|
||||
# libqemu
|
||||
|
||||
translate.o: translate.c cpu.h
|
||||
|
||||
@@ -87,7 +91,8 @@ signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
|
||||
|
||||
ifdef CONFIG_LINUX_USER
|
||||
|
||||
VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
|
||||
$(call set-vpath, $(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR))
|
||||
|
||||
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
|
||||
obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \
|
||||
elfload.o linuxload.o uaccess.o gdbstub.o
|
||||
@@ -106,7 +111,10 @@ obj-arm-y += arm-semi.o
|
||||
|
||||
obj-m68k-y += m68k-sim.o m68k-semi.o
|
||||
|
||||
ARLIBS=../libuser/libuser.a libqemu.a
|
||||
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
|
||||
|
||||
obj-y += $(addprefix ../libuser/, $(user-obj-y))
|
||||
obj-y += $(libobj-y)
|
||||
|
||||
endif #CONFIG_LINUX_USER
|
||||
|
||||
@@ -115,7 +123,8 @@ endif #CONFIG_LINUX_USER
|
||||
|
||||
ifdef CONFIG_DARWIN_USER
|
||||
|
||||
VPATH+=:$(SRC_PATH)/darwin-user
|
||||
$(call set-vpath, $(SRC_PATH)/darwin-user)
|
||||
|
||||
QEMU_CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
|
||||
|
||||
# Leave some space for the regular program loading zone
|
||||
@@ -128,7 +137,10 @@ obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
|
||||
|
||||
obj-i386-y += ioport-user.o
|
||||
|
||||
ARLIBS=../libuser/libuser.a libqemu.a
|
||||
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
|
||||
|
||||
obj-y += $(addprefix ../libuser/, $(user-obj-y))
|
||||
obj-y += $(libobj-y)
|
||||
|
||||
endif #CONFIG_DARWIN_USER
|
||||
|
||||
@@ -137,7 +149,8 @@ endif #CONFIG_DARWIN_USER
|
||||
|
||||
ifdef CONFIG_BSD_USER
|
||||
|
||||
VPATH+=:$(SRC_PATH)/bsd-user
|
||||
$(call set-vpath, $(SRC_PATH)/bsd-user)
|
||||
|
||||
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
|
||||
|
||||
obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
|
||||
@@ -145,7 +158,10 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
|
||||
|
||||
obj-i386-y += ioport-user.o
|
||||
|
||||
ARLIBS=../libuser/libuser.a libqemu.a
|
||||
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
|
||||
|
||||
obj-y += $(addprefix ../libuser/, $(user-obj-y))
|
||||
obj-y += $(libobj-y)
|
||||
|
||||
endif #CONFIG_BSD_USER
|
||||
|
||||
@@ -194,7 +210,7 @@ obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
|
||||
obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
|
||||
obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
|
||||
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
|
||||
obj-i386-y += ne2000-isa.o
|
||||
obj-i386-y += ne2000-isa.o debugcon.o multiboot.o
|
||||
|
||||
# shared objects
|
||||
obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
|
||||
@@ -303,17 +319,21 @@ vl.o: qemu-options.h
|
||||
|
||||
monitor.o: qemu-monitor.h
|
||||
|
||||
ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
|
||||
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
|
||||
|
||||
obj-y += $(addprefix ../, $(common-obj-y))
|
||||
obj-y += $(libobj-y)
|
||||
obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
|
||||
|
||||
endif # CONFIG_SOFTMMU
|
||||
|
||||
obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
|
||||
|
||||
$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
|
||||
$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
|
||||
$(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
|
||||
|
||||
|
||||
gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
|
||||
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
|
||||
$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
|
||||
|
||||
qemu-options.h: $(SRC_PATH)/qemu-options.hx
|
||||
|
||||
+4
-8
@@ -2,24 +2,20 @@
|
||||
|
||||
include ../config-host.mak
|
||||
include $(SRC_PATH)/rules.mak
|
||||
-include config.mak
|
||||
|
||||
.PHONY: all
|
||||
|
||||
VPATH=$(SRC_PATH)
|
||||
$(call set-vpath, $(SRC_PATH))
|
||||
|
||||
QEMU_CFLAGS+=-I..
|
||||
|
||||
obj-y =
|
||||
obj-y += envlist.o path.o
|
||||
obj-y += tcg-runtime.o host-utils.o
|
||||
obj-y += cutils.o cache-utils.o
|
||||
include $(SRC_PATH)/Makefile.objs
|
||||
|
||||
all: libuser.a
|
||||
all: $(user-obj-y)
|
||||
# Dummy command so that make thinks it has done something
|
||||
@true
|
||||
|
||||
libuser.a: $(obj-y)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d *.a *~
|
||||
|
||||
|
||||
+23
-11
@@ -4,45 +4,57 @@
|
||||
Introduction
|
||||
-------------
|
||||
|
||||
The QEMU Monitor Protocol (QMP) is a JSON[1] based protocol for QEMU.
|
||||
The QEMU Monitor Protocol (QMP) allows applications to communicate with
|
||||
QEMU's Monitor.
|
||||
|
||||
By using it applications can control QEMU in reliable and "parseable" way,
|
||||
QMP also provides asynchronous events support.
|
||||
QMP is JSON[1] based and has the following features:
|
||||
|
||||
- Lightweight, text-based, easy to parse data format
|
||||
- Asynchronous events support
|
||||
- Stability
|
||||
|
||||
For more information, please, refer to the following files:
|
||||
|
||||
o qmp-spec.txt QEMU Monitor Protocol current draft specification
|
||||
o qmp-spec.txt QEMU Monitor Protocol current specification
|
||||
o qmp-events.txt List of available asynchronous events
|
||||
|
||||
There are also two simple Python scripts available:
|
||||
|
||||
o qmp-shell A shell
|
||||
o vm-info Show some informations about the Virtal Machine
|
||||
o vm-info Show some information about the Virtual Machine
|
||||
|
||||
[1] http://www.json.org
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
To enable QMP, QEMU has to be started in "control mode". This is done
|
||||
by passing the flag "control" to the "-monitor" command-line option.
|
||||
To enable QMP, QEMU has to be started in "control mode". There are
|
||||
two ways of doing this, the simplest one is using the the '-qmp'
|
||||
command-line option.
|
||||
|
||||
For example:
|
||||
|
||||
$ qemu [...] -monitor control,tcp:localhost:4444,server
|
||||
$ qemu [...] -qmp tcp:localhost:4444,server
|
||||
|
||||
Will start QEMU in control mode, waiting for a client TCP connection
|
||||
on localhost port 4444.
|
||||
|
||||
To manually test it you can connect with telnet and issue commands:
|
||||
It is also possible to use the '-mon' command-line option to have
|
||||
more complex combinations. Please, refer to the QEMU's manpage for
|
||||
more information.
|
||||
|
||||
Simple Testing
|
||||
--------------
|
||||
|
||||
To manually test QMP one can connect with telnet and issue commands:
|
||||
|
||||
$ telnet localhost 4444
|
||||
Trying ::1...
|
||||
Trying 127.0.0.1...
|
||||
Connected to localhost.
|
||||
Escape character is '^]'.
|
||||
{"QMP": {"capabilities": []}}
|
||||
{ "execute": "query-version" }
|
||||
{"return": "0.11.50"}
|
||||
{"return": {"qemu": "0.11.50", "package": ""}}
|
||||
|
||||
Contact
|
||||
-------
|
||||
|
||||
+36
-25
@@ -1,4 +1,4 @@
|
||||
QEMU Monitor Protocol Draft Specification - Version 0.1
|
||||
QEMU Monitor Protocol Specification - Version 0.1
|
||||
|
||||
1. Introduction
|
||||
===============
|
||||
@@ -27,9 +27,9 @@ the JSON standard:
|
||||
|
||||
http://www.ietf.org/rfc/rfc4627.txt
|
||||
|
||||
For convenience, json-objects mentioned in this document will have its members
|
||||
in a certain order. However, in real protocol usage json-objects members can
|
||||
be in ANY order, thus no particular order should be assumed.
|
||||
For convenience, json-object members and json-array elements mentioned in
|
||||
this document will be in a certain order. However, in real protocol usage
|
||||
they can be in ANY order, thus no particular order should be assumed.
|
||||
|
||||
2.1 General Definitions
|
||||
-----------------------
|
||||
@@ -85,12 +85,13 @@ without errors.
|
||||
|
||||
The format is:
|
||||
|
||||
{ "return": json-value, "id": json-value }
|
||||
{ "return": json-object, "id": json-value }
|
||||
|
||||
Where,
|
||||
|
||||
- The "return" member contains the command returned data, which is defined
|
||||
in a per-command basis or "OK" if the command does not return data
|
||||
in a per-command basis or an empty json-object if the command does not
|
||||
return data
|
||||
- The "id" member contains the transaction identification associated
|
||||
with the command execution (if issued by the Client)
|
||||
|
||||
@@ -102,13 +103,16 @@ completed because of an error condition.
|
||||
|
||||
The format is:
|
||||
|
||||
{ "error": { "class": json-string, "data": json-value }, "id": json-value }
|
||||
{ "error": { "class": json-string, "data": json-object, "desc": json-string },
|
||||
"id": json-value }
|
||||
|
||||
Where,
|
||||
|
||||
- The "class" member contains the error class name (eg. "ServiceUnavailable")
|
||||
- The "data" member contains specific error data and is defined in a
|
||||
per-command basis, it will be an empty json-object if the error has no data
|
||||
- The "desc" member is a human-readable error message. Clients should
|
||||
not attempt to parse this message.
|
||||
- The "id" member contains the transaction identification associated with
|
||||
the command execution (if issued by the Client)
|
||||
|
||||
@@ -124,7 +128,7 @@ to the Client at any time. They are called 'asynchronous events'.
|
||||
|
||||
The format is:
|
||||
|
||||
{ "event": json-string, "data": json-value,
|
||||
{ "event": json-string, "data": json-object,
|
||||
"timestamp": { "seconds": json-number, "microseconds": json-number } }
|
||||
|
||||
Where,
|
||||
@@ -132,7 +136,7 @@ The format is:
|
||||
- The "event" member contains the event's name
|
||||
- The "data" member contains event specific data, which is defined in a
|
||||
per-event basis, it is optional
|
||||
- The "timestamp" member contains the exact time of when the event ocurred
|
||||
- The "timestamp" member contains the exact time of when the event occurred
|
||||
in the Server. It is a fixed json-object with time in seconds and
|
||||
microseconds
|
||||
|
||||
@@ -154,19 +158,20 @@ S: {"QMP": {"capabilities": []}}
|
||||
---------------------------
|
||||
|
||||
C: { "execute": "stop" }
|
||||
S: {"return": "OK"}
|
||||
S: {"return": {}}
|
||||
|
||||
3.3 KVM information
|
||||
-------------------
|
||||
|
||||
C: {"execute": "query-kvm", "id": "example"}
|
||||
S: {"return": "enabled", "id": "example"}
|
||||
C: { "execute": "query-kvm", "id": "example" }
|
||||
S: {"return": {"enabled": true, "present": true}, "id": "example"}
|
||||
|
||||
3.4 Parsing error
|
||||
------------------
|
||||
|
||||
C: { "execute": }
|
||||
S: {"error": {"class": "JSONParsing", "data": {}}}
|
||||
S: {"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data":
|
||||
{}}}
|
||||
|
||||
3.5 Powerdown event
|
||||
-------------------
|
||||
@@ -174,19 +179,25 @@ S: {"error": {"class": "JSONParsing", "data": {}}}
|
||||
S: {"timestamp": {"seconds": 1258551470, "microseconds": 802384}, "event":
|
||||
"POWERDOWN"}
|
||||
|
||||
4. Notes to Client implementors
|
||||
-------------------------------
|
||||
4. Compatibility Considerations
|
||||
--------------------------------
|
||||
|
||||
4.1 It is recommended to always start the Server in pause mode, thus the
|
||||
Client is able to perform any setup procedure without the risk of
|
||||
race conditions and related problems
|
||||
In order to achieve maximum compatibility between versions, Clients must not
|
||||
assume any particular:
|
||||
|
||||
4.2 It is recommended to always check the capabilities json-array, issued
|
||||
with the greeting message, at connection time
|
||||
- Size of json-objects or length of json-arrays
|
||||
- Order of json-object members or json-array elements
|
||||
- Amount of errors generated by a command, that is, new errors can be added
|
||||
to any existing command in newer versions of the Server
|
||||
|
||||
4.3 Json-objects or json-arrays mentioned in this document are not fixed
|
||||
and no particular size or number of members/elements should be assumed.
|
||||
New members/elements can be added at any time.
|
||||
Additionally, Clients should always:
|
||||
|
||||
4.4 No particular order of json-objects members should be assumed, they
|
||||
can change at any time
|
||||
- Check the capabilities json-array at connection time
|
||||
- Check the availability of commands with 'query-commands' before issuing them
|
||||
|
||||
5. Recommendations to Client implementors
|
||||
-----------------------------------------
|
||||
|
||||
5.1 The Server should be always started in pause mode, thus the Client is
|
||||
able to perform any setup procedure without the risk of race conditions
|
||||
and related problems
|
||||
+12
-1
@@ -240,7 +240,9 @@ static int oss_open (int in, struct oss_params *req,
|
||||
struct oss_params *obt, int *pfd)
|
||||
{
|
||||
int fd;
|
||||
#ifdef OSS_GETVERSION
|
||||
int version;
|
||||
#endif
|
||||
int oflags = conf.exclusive ? O_EXCL : 0;
|
||||
audio_buf_info abinfo;
|
||||
int fmt, freq, nchannels;
|
||||
@@ -281,6 +283,7 @@ static int oss_open (int in, struct oss_params *req,
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef OSS_GETVERSION
|
||||
if (ioctl (fd, OSS_GETVERSION, &version)) {
|
||||
oss_logerr2 (errno, typ, "Failed to get OSS version\n");
|
||||
version = 0;
|
||||
@@ -289,9 +292,17 @@ static int oss_open (int in, struct oss_params *req,
|
||||
if (conf.debug) {
|
||||
dolog ("OSS version = %#x\n", version);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SNDCTL_DSP_POLICY
|
||||
if (conf.policy >= 0 && version >= 0x040000) {
|
||||
if (conf.policy >= 0
|
||||
#ifdef OSS_GETVERSION
|
||||
&& version >= 0x040000
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
)
|
||||
{
|
||||
int policy = conf.policy;
|
||||
if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
|
||||
oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "monitor.h"
|
||||
#include "block_int.h"
|
||||
#include "module.h"
|
||||
#include "qemu-objects.h"
|
||||
|
||||
#ifdef CONFIG_BSD
|
||||
#include <sys/types.h>
|
||||
@@ -395,8 +396,8 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
|
||||
if (is_protocol)
|
||||
snprintf(backing_filename, sizeof(backing_filename),
|
||||
"%s", filename);
|
||||
else
|
||||
realpath(filename, backing_filename);
|
||||
else if (!realpath(filename, backing_filename))
|
||||
return -errno;
|
||||
|
||||
bdrv_qcow2 = bdrv_find_format("qcow2");
|
||||
options = parse_option_parameters("", bdrv_qcow2->create_options, NULL);
|
||||
@@ -1139,61 +1140,203 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
|
||||
return bs->drv->bdrv_is_allocated(bs, sector_num, nb_sectors, pnum);
|
||||
}
|
||||
|
||||
void bdrv_info(Monitor *mon)
|
||||
static void bdrv_print_dict(QObject *obj, void *opaque)
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
QDict *bs_dict;
|
||||
Monitor *mon = opaque;
|
||||
|
||||
for (bs = bdrv_first; bs != NULL; bs = bs->next) {
|
||||
monitor_printf(mon, "%s:", bs->device_name);
|
||||
monitor_printf(mon, " type=");
|
||||
switch(bs->type) {
|
||||
case BDRV_TYPE_HD:
|
||||
monitor_printf(mon, "hd");
|
||||
break;
|
||||
case BDRV_TYPE_CDROM:
|
||||
monitor_printf(mon, "cdrom");
|
||||
break;
|
||||
case BDRV_TYPE_FLOPPY:
|
||||
monitor_printf(mon, "floppy");
|
||||
break;
|
||||
}
|
||||
monitor_printf(mon, " removable=%d", bs->removable);
|
||||
if (bs->removable) {
|
||||
monitor_printf(mon, " locked=%d", bs->locked);
|
||||
}
|
||||
if (bs->drv) {
|
||||
monitor_printf(mon, " file=");
|
||||
monitor_print_filename(mon, bs->filename);
|
||||
if (bs->backing_file[0] != '\0') {
|
||||
monitor_printf(mon, " backing_file=");
|
||||
monitor_print_filename(mon, bs->backing_file);
|
||||
}
|
||||
monitor_printf(mon, " ro=%d", bs->read_only);
|
||||
monitor_printf(mon, " drv=%s", bs->drv->format_name);
|
||||
monitor_printf(mon, " encrypted=%d", bdrv_is_encrypted(bs));
|
||||
} else {
|
||||
monitor_printf(mon, " [not inserted]");
|
||||
}
|
||||
monitor_printf(mon, "\n");
|
||||
bs_dict = qobject_to_qdict(obj);
|
||||
|
||||
monitor_printf(mon, "%s: type=%s removable=%d",
|
||||
qdict_get_str(bs_dict, "device"),
|
||||
qdict_get_str(bs_dict, "type"),
|
||||
qdict_get_bool(bs_dict, "removable"));
|
||||
|
||||
if (qdict_get_bool(bs_dict, "removable")) {
|
||||
monitor_printf(mon, " locked=%d", qdict_get_bool(bs_dict, "locked"));
|
||||
}
|
||||
|
||||
if (qdict_haskey(bs_dict, "inserted")) {
|
||||
QDict *qdict = qobject_to_qdict(qdict_get(bs_dict, "inserted"));
|
||||
|
||||
monitor_printf(mon, " file=");
|
||||
monitor_print_filename(mon, qdict_get_str(qdict, "file"));
|
||||
if (qdict_haskey(qdict, "backing_file")) {
|
||||
monitor_printf(mon, " backing_file=");
|
||||
monitor_print_filename(mon, qdict_get_str(qdict, "backing_file"));
|
||||
}
|
||||
monitor_printf(mon, " ro=%d drv=%s encrypted=%d",
|
||||
qdict_get_bool(qdict, "ro"),
|
||||
qdict_get_str(qdict, "drv"),
|
||||
qdict_get_bool(qdict, "encrypted"));
|
||||
} else {
|
||||
monitor_printf(mon, " [not inserted]");
|
||||
}
|
||||
|
||||
monitor_printf(mon, "\n");
|
||||
}
|
||||
|
||||
/* The "info blockstats" command. */
|
||||
void bdrv_info_stats(Monitor *mon)
|
||||
void bdrv_info_print(Monitor *mon, const QObject *data)
|
||||
{
|
||||
qlist_iter(qobject_to_qlist(data), bdrv_print_dict, mon);
|
||||
}
|
||||
|
||||
/**
|
||||
* bdrv_info(): Block devices information
|
||||
*
|
||||
* Each block device information is stored in a QDict and the
|
||||
* returned QObject is a QList of all devices.
|
||||
*
|
||||
* The QDict contains the following:
|
||||
*
|
||||
* - "device": device name
|
||||
* - "type": device type
|
||||
* - "removable": true if the device is removable, false otherwise
|
||||
* - "locked": true if the device is locked, false otherwise
|
||||
* - "inserted": only present if the device is inserted, it is a QDict
|
||||
* containing the following:
|
||||
* - "file": device file name
|
||||
* - "ro": true if read-only, false otherwise
|
||||
* - "drv": driver format name
|
||||
* - "backing_file": backing file name if one is used
|
||||
* - "encrypted": true if encrypted, false otherwise
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* [ { "device": "ide0-hd0", "type": "hd", "removable": false, "locked": false,
|
||||
* "inserted": { "file": "/tmp/foobar", "ro": false, "drv": "qcow2" } },
|
||||
* { "device": "floppy0", "type": "floppy", "removable": true,
|
||||
* "locked": false } ]
|
||||
*/
|
||||
void bdrv_info(Monitor *mon, QObject **ret_data)
|
||||
{
|
||||
QList *bs_list;
|
||||
BlockDriverState *bs;
|
||||
|
||||
bs_list = qlist_new();
|
||||
|
||||
for (bs = bdrv_first; bs != NULL; bs = bs->next) {
|
||||
monitor_printf(mon, "%s:"
|
||||
" rd_bytes=%" PRIu64
|
||||
" wr_bytes=%" PRIu64
|
||||
" rd_operations=%" PRIu64
|
||||
" wr_operations=%" PRIu64
|
||||
"\n",
|
||||
bs->device_name,
|
||||
bs->rd_bytes, bs->wr_bytes,
|
||||
bs->rd_ops, bs->wr_ops);
|
||||
QObject *bs_obj;
|
||||
const char *type = "unknown";
|
||||
|
||||
switch(bs->type) {
|
||||
case BDRV_TYPE_HD:
|
||||
type = "hd";
|
||||
break;
|
||||
case BDRV_TYPE_CDROM:
|
||||
type = "cdrom";
|
||||
break;
|
||||
case BDRV_TYPE_FLOPPY:
|
||||
type = "floppy";
|
||||
break;
|
||||
}
|
||||
|
||||
bs_obj = qobject_from_jsonf("{ 'device': %s, 'type': %s, "
|
||||
"'removable': %i, 'locked': %i }",
|
||||
bs->device_name, type, bs->removable,
|
||||
bs->locked);
|
||||
assert(bs_obj != NULL);
|
||||
|
||||
if (bs->drv) {
|
||||
QObject *obj;
|
||||
QDict *bs_dict = qobject_to_qdict(bs_obj);
|
||||
|
||||
obj = qobject_from_jsonf("{ 'file': %s, 'ro': %i, 'drv': %s, "
|
||||
"'encrypted': %i }",
|
||||
bs->filename, bs->read_only,
|
||||
bs->drv->format_name,
|
||||
bdrv_is_encrypted(bs));
|
||||
assert(obj != NULL);
|
||||
if (bs->backing_file[0] != '\0') {
|
||||
QDict *qdict = qobject_to_qdict(obj);
|
||||
qdict_put(qdict, "backing_file",
|
||||
qstring_from_str(bs->backing_file));
|
||||
}
|
||||
|
||||
qdict_put_obj(bs_dict, "inserted", obj);
|
||||
}
|
||||
qlist_append_obj(bs_list, bs_obj);
|
||||
}
|
||||
|
||||
*ret_data = QOBJECT(bs_list);
|
||||
}
|
||||
|
||||
static void bdrv_stats_iter(QObject *data, void *opaque)
|
||||
{
|
||||
QDict *qdict;
|
||||
Monitor *mon = opaque;
|
||||
|
||||
qdict = qobject_to_qdict(data);
|
||||
monitor_printf(mon, "%s:", qdict_get_str(qdict, "device"));
|
||||
|
||||
qdict = qobject_to_qdict(qdict_get(qdict, "stats"));
|
||||
monitor_printf(mon, " rd_bytes=%" PRId64
|
||||
" wr_bytes=%" PRId64
|
||||
" rd_operations=%" PRId64
|
||||
" wr_operations=%" PRId64
|
||||
"\n",
|
||||
qdict_get_int(qdict, "rd_bytes"),
|
||||
qdict_get_int(qdict, "wr_bytes"),
|
||||
qdict_get_int(qdict, "rd_operations"),
|
||||
qdict_get_int(qdict, "wr_operations"));
|
||||
}
|
||||
|
||||
void bdrv_stats_print(Monitor *mon, const QObject *data)
|
||||
{
|
||||
qlist_iter(qobject_to_qlist(data), bdrv_stats_iter, mon);
|
||||
}
|
||||
|
||||
/**
|
||||
* bdrv_info_stats(): show block device statistics
|
||||
*
|
||||
* Each device statistic information is stored in a QDict and
|
||||
* the returned QObject is a QList of all devices.
|
||||
*
|
||||
* The QDict contains the following:
|
||||
*
|
||||
* - "device": device name
|
||||
* - "stats": A QDict with the statistics information, it contains:
|
||||
* - "rd_bytes": bytes read
|
||||
* - "wr_bytes": bytes written
|
||||
* - "rd_operations": read operations
|
||||
* - "wr_operations": write operations
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* [ { "device": "ide0-hd0",
|
||||
* "stats": { "rd_bytes": 512,
|
||||
* "wr_bytes": 0,
|
||||
* "rd_operations": 1,
|
||||
* "wr_operations": 0 } },
|
||||
* { "device": "ide1-cd0",
|
||||
* "stats": { "rd_bytes": 0,
|
||||
* "wr_bytes": 0,
|
||||
* "rd_operations": 0,
|
||||
* "wr_operations": 0 } } ]
|
||||
*/
|
||||
void bdrv_info_stats(Monitor *mon, QObject **ret_data)
|
||||
{
|
||||
QObject *obj;
|
||||
QList *devices;
|
||||
BlockDriverState *bs;
|
||||
|
||||
devices = qlist_new();
|
||||
|
||||
for (bs = bdrv_first; bs != NULL; bs = bs->next) {
|
||||
obj = qobject_from_jsonf("{ 'device': %s, 'stats': {"
|
||||
"'rd_bytes': %" PRId64 ","
|
||||
"'wr_bytes': %" PRId64 ","
|
||||
"'rd_operations': %" PRId64 ","
|
||||
"'wr_operations': %" PRId64
|
||||
"} }",
|
||||
bs->device_name,
|
||||
bs->rd_bytes, bs->wr_bytes,
|
||||
bs->rd_ops, bs->wr_ops);
|
||||
assert(obj != NULL);
|
||||
qlist_append_obj(devices, obj);
|
||||
}
|
||||
|
||||
*ret_data = QOBJECT(devices);
|
||||
}
|
||||
|
||||
const char *bdrv_get_encrypted_filename(BlockDriverState *bs)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "qemu-aio.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-option.h"
|
||||
#include "qobject.h"
|
||||
|
||||
/* block.c */
|
||||
typedef struct BlockDriver BlockDriver;
|
||||
@@ -45,8 +46,10 @@ typedef struct QEMUSnapshotInfo {
|
||||
#define BDRV_SECTOR_SIZE (1 << BDRV_SECTOR_BITS)
|
||||
#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1);
|
||||
|
||||
void bdrv_info(Monitor *mon);
|
||||
void bdrv_info_stats(Monitor *mon);
|
||||
void bdrv_info_print(Monitor *mon, const QObject *data);
|
||||
void bdrv_info(Monitor *mon, QObject **ret_data);
|
||||
void bdrv_stats_print(Monitor *mon, const QObject *data);
|
||||
void bdrv_info_stats(Monitor *mon, QObject **ret_data);
|
||||
|
||||
void bdrv_init(void);
|
||||
void bdrv_init_with_whitelist(void);
|
||||
|
||||
+12
-4
@@ -146,7 +146,9 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags)
|
||||
bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512;
|
||||
}
|
||||
|
||||
lseek(s->fd, le32_to_cpu(bochs.header), SEEK_SET);
|
||||
if (lseek(s->fd, le32_to_cpu(bochs.header), SEEK_SET) == (off_t)-1) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog);
|
||||
s->catalog_bitmap = qemu_malloc(s->catalog_size * 4);
|
||||
@@ -197,9 +199,13 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
|
||||
// bitmap_offset, block_offset);
|
||||
|
||||
// read in bitmap for current extent
|
||||
lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET);
|
||||
if (lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET) ==
|
||||
(off_t)-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
read(s->fd, &bitmap_entry, 1);
|
||||
if (read(s->fd, &bitmap_entry, 1) != 1)
|
||||
return -1;
|
||||
|
||||
if (!((bitmap_entry >> (extent_offset % 8)) & 1))
|
||||
{
|
||||
@@ -208,7 +214,9 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
|
||||
return -1; // not allocated
|
||||
}
|
||||
|
||||
lseek(s->fd, block_offset, SEEK_SET);
|
||||
if (lseek(s->fd, block_offset, SEEK_SET) == (off_t)-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-2
@@ -411,14 +411,17 @@ static int vdi_open(BlockDriverState *bs, const char *filename, int flags)
|
||||
/* We only support data blocks which start on a sector boundary. */
|
||||
logout("unsupported data offset 0x%x B\n", header.offset_data);
|
||||
goto fail;
|
||||
} else if (header.disk_size % SECTOR_SIZE != 0) {
|
||||
logout("unsupported disk size %" PRIu64 " B\n", header.disk_size);
|
||||
goto fail;
|
||||
} else if (header.sector_size != SECTOR_SIZE) {
|
||||
logout("unsupported sector size %u B\n", header.sector_size);
|
||||
goto fail;
|
||||
} else if (header.block_size != 1 * MiB) {
|
||||
logout("unsupported block size %u B\n", header.block_size);
|
||||
goto fail;
|
||||
} else if (header.disk_size !=
|
||||
(uint64_t)header.blocks_in_image * header.block_size) {
|
||||
} else if ((header.disk_size + header.block_size - 1) / header.block_size !=
|
||||
(uint64_t)header.blocks_in_image) {
|
||||
logout("unexpected block number %u B\n", header.blocks_in_image);
|
||||
goto fail;
|
||||
} else if (!uuid_is_null(header.uuid_link)) {
|
||||
|
||||
@@ -205,6 +205,8 @@ START_TEST(qdict_put_exists_test)
|
||||
|
||||
value = qdict_get_int(tests_dict, key);
|
||||
fail_unless(value == 2);
|
||||
|
||||
fail_unless(qdict_size(tests_dict) == 1);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
#include "console.h"
|
||||
#include "sysemu.h"
|
||||
|
||||
#ifndef MAC_OS_X_VERSION_10_4
|
||||
#define MAC_OS_X_VERSION_10_4 1040
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_5
|
||||
#define MAC_OS_X_VERSION_10_5 1050
|
||||
#endif
|
||||
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
@@ -229,7 +236,7 @@ int keymap[] =
|
||||
*/
|
||||
};
|
||||
|
||||
int cocoa_keycode_to_qemu(int keycode)
|
||||
static int cocoa_keycode_to_qemu(int keycode)
|
||||
{
|
||||
if((sizeof(keymap)/sizeof(int)) <= keycode)
|
||||
{
|
||||
@@ -298,6 +305,11 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL) isOpaque
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) drawRect:(NSRect) rect
|
||||
{
|
||||
COCOA_DEBUG("QemuCocoaView: drawRect\n");
|
||||
@@ -315,7 +327,7 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
screen.bitsPerComponent, //bitsPerComponent
|
||||
screen.bitsPerPixel, //bitsPerPixel
|
||||
(screen.width * (screen.bitsPerComponent/2)), //bytesPerRow
|
||||
#if __LITTLE_ENDIAN__
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), //colorspace for OS X >= 10.4
|
||||
kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
|
||||
#else
|
||||
@@ -327,7 +339,7 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
0, //interpolate
|
||||
kCGRenderingIntentDefault //intent
|
||||
);
|
||||
// test if host support "CGImageCreateWithImageInRect" at compiletime
|
||||
// test if host supports "CGImageCreateWithImageInRect" at compile time
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is supported on host at runtime
|
||||
#endif
|
||||
@@ -337,7 +349,11 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
} else {
|
||||
// selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
|
||||
const NSRect *rectList;
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
NSInteger rectCount;
|
||||
#else
|
||||
int rectCount;
|
||||
#endif
|
||||
int i;
|
||||
CGImageRef clipImageRef;
|
||||
CGRect clipRect;
|
||||
@@ -403,7 +419,7 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
} else {
|
||||
if (qemu_name)
|
||||
[normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
|
||||
[normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:YES animate:YES];
|
||||
[normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:YES animate:NO];
|
||||
}
|
||||
screen.width = w;
|
||||
screen.height = h;
|
||||
@@ -420,8 +436,8 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
isFullscreen = FALSE;
|
||||
[self ungrabMouse];
|
||||
[self setContentDimensions];
|
||||
// test if host support "enterFullScreenMode:withOptions" at compiletime
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
// test if host supports "exitFullScreenModeWithOptions" at compile time
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if ([NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime
|
||||
[self exitFullScreenModeWithOptions:nil];
|
||||
} else {
|
||||
@@ -430,15 +446,15 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
[normalWindow setContentView: self];
|
||||
[normalWindow makeKeyAndOrderFront: self];
|
||||
[NSMenu setMenuBarVisible:YES];
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
}
|
||||
#endif
|
||||
} else { // switch from desktop to fullscreen
|
||||
isFullscreen = TRUE;
|
||||
[self grabMouse];
|
||||
[self setContentDimensions];
|
||||
// test if host support "enterFullScreenMode:withOptions" at compiletime
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
// test if host supports "enterFullScreenMode:withOptions" at compile time
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if ([NSView respondsToSelector:@selector(enterFullScreenMode:withOptions:)]) { // test if "enterFullScreenMode:withOptions" is supported on host at runtime
|
||||
[self enterFullScreenMode:[NSScreen mainScreen] withOptions:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool:NO], NSFullScreenModeAllScreens,
|
||||
@@ -454,7 +470,7 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
[fullScreenWindow setHasShadow:NO];
|
||||
[fullScreenWindow setContentView:self];
|
||||
[fullScreenWindow makeKeyAndOrderFront:self];
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -724,6 +740,7 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
[normalWindow setAcceptsMouseMovedEvents:YES];
|
||||
[normalWindow setTitle:[NSString stringWithFormat:@"QEMU"]];
|
||||
[normalWindow setContentView:cocoaView];
|
||||
[normalWindow useOptimizedDrawing:YES];
|
||||
[normalWindow makeKeyAndOrderFront:self];
|
||||
[normalWindow center];
|
||||
|
||||
@@ -767,6 +784,11 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)startEmulationWithArgc:(int)argc argv:(char**)argv
|
||||
{
|
||||
COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc\n");
|
||||
@@ -783,7 +805,7 @@ int cocoa_keycode_to_qemu(int keycode)
|
||||
if(returnCode == NSCancelButton) {
|
||||
exit(0);
|
||||
} else if(returnCode == NSOKButton) {
|
||||
char *bin = "qemu";
|
||||
const char *bin = "qemu";
|
||||
char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
|
||||
|
||||
char **argv = (char**)malloc( sizeof(char*)*3 );
|
||||
@@ -839,6 +861,16 @@ int main (int argc, const char * argv[]) {
|
||||
gArgc = argc;
|
||||
gArgv = (char **)argv;
|
||||
CPSProcessSerNum PSN;
|
||||
int i;
|
||||
|
||||
/* In case we don't need to display a window, let's not do that */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-vnc") ||
|
||||
!strcmp(argv[i], "-nographic") ||
|
||||
!strcmp(argv[i], "-curses")) {
|
||||
return qemu_main(gArgc, gArgv);
|
||||
}
|
||||
}
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
[NSApplication sharedApplication];
|
||||
@@ -922,7 +954,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
|
||||
w * [cocoaView cdx],
|
||||
h * [cocoaView cdy]);
|
||||
}
|
||||
[cocoaView displayRect:rect];
|
||||
[cocoaView setNeedsDisplayInRect:rect];
|
||||
}
|
||||
|
||||
static void cocoa_resize(DisplayState *ds)
|
||||
|
||||
@@ -256,6 +256,7 @@ blobs="yes"
|
||||
pkgversion=""
|
||||
check_utests="no"
|
||||
user_pie="no"
|
||||
zero_malloc=""
|
||||
|
||||
# OS specific
|
||||
if check_define __linux__ ; then
|
||||
@@ -1706,37 +1707,6 @@ elif compile_prog "" "-lrt" ; then
|
||||
LIBS="-lrt $LIBS"
|
||||
fi
|
||||
|
||||
# Determine what linker flags to use to force archive inclusion
|
||||
check_linker_flags()
|
||||
{
|
||||
w2=
|
||||
if test "$2" ; then
|
||||
w2=-Wl,$2
|
||||
fi
|
||||
compile_prog "" "-Wl,$1 ${w2}"
|
||||
}
|
||||
|
||||
cat > $TMPC << EOF
|
||||
int main(void) { }
|
||||
EOF
|
||||
if check_linker_flags --whole-archive --no-whole-archive ; then
|
||||
# GNU ld
|
||||
arlibs_begin="-Wl,--whole-archive"
|
||||
arlibs_end="-Wl,--no-whole-archive"
|
||||
elif check_linker_flags -z,allextract -z,defaultextract ; then
|
||||
# Solaris ld
|
||||
arlibs_begin="-Wl,-z,allextract"
|
||||
arlibs_end="-Wl,-z,defaultextract"
|
||||
elif check_linker_flags -all_load ; then
|
||||
# Mac OS X
|
||||
arlibs_begin="-all_load"
|
||||
arlibs_end=""
|
||||
else
|
||||
echo "Error: your linker does not support --whole-archive or -z."
|
||||
echo "Please report to [email protected]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
|
||||
"$aix" != "yes" ; then
|
||||
libs_softmmu="-lutil $libs_softmmu"
|
||||
@@ -1792,8 +1762,9 @@ fi
|
||||
|
||||
# Consult white-list to determine whether to enable werror
|
||||
# by default. Only enable by default for git builds
|
||||
z_version=`cut -f3 -d. $source_path/VERSION`
|
||||
|
||||
if test -z "$werror" ; then
|
||||
z_version=`cut -f3 -d. $source_path/VERSION`
|
||||
if test "$z_version" = "50" -a \
|
||||
"$linux" = "yes" ; then
|
||||
werror="yes"
|
||||
@@ -1802,6 +1773,16 @@ if test -z "$werror" ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Disable zero malloc errors for official releases unless explicitly told to
|
||||
# enable/disable
|
||||
if test -z "$zero_malloc" ; then
|
||||
if test "$z_version" = "50" ; then
|
||||
zero_malloc="no"
|
||||
else
|
||||
zero_malloc="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$werror" = "yes" ; then
|
||||
QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
|
||||
fi
|
||||
@@ -2010,9 +1991,6 @@ qemu_version=`head $source_path/VERSION`
|
||||
echo "VERSION=$qemu_version" >>$config_host_mak
|
||||
echo "PKGVERSION=$pkgversion" >>$config_host_mak
|
||||
echo "SRC_PATH=$source_path" >> $config_host_mak
|
||||
if [ "$source_path_used" = "yes" ]; then
|
||||
echo "VPATH=$source_path" >> $config_host_mak
|
||||
fi
|
||||
echo "TARGET_DIRS=$target_list" >> $config_host_mak
|
||||
if [ "$docs" = "yes" ] ; then
|
||||
echo "BUILD_DOCS=yes" >> $config_host_mak
|
||||
@@ -2109,6 +2087,10 @@ fi
|
||||
|
||||
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
|
||||
|
||||
if test "$zero_malloc" = "yes" ; then
|
||||
echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
# USB host support
|
||||
case "$usb" in
|
||||
linux)
|
||||
@@ -2125,7 +2107,7 @@ esac
|
||||
tools=
|
||||
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
|
||||
tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
|
||||
if [ "$linux" = "yes" ] ; then
|
||||
if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
|
||||
tools="qemu-nbd\$(EXESUF) $tools"
|
||||
if [ "$check_utests" = "yes" ]; then
|
||||
tools="check-qint check-qstring check-qdict check-qlist $tools"
|
||||
@@ -2411,7 +2393,7 @@ fi
|
||||
if test "$target_softmmu" = "yes" ; then
|
||||
echo "CONFIG_SOFTMMU=y" >> $config_target_mak
|
||||
echo "LIBS+=$libs_softmmu" >> $config_target_mak
|
||||
echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_target_mak
|
||||
echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
|
||||
echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
|
||||
fi
|
||||
if test "$target_user_only" = "yes" ; then
|
||||
@@ -2432,7 +2414,7 @@ if test ! -z "$gdb_xml_files" ; then
|
||||
fi
|
||||
|
||||
case "$target_arch2" in
|
||||
arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
|
||||
alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
|
||||
echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
|
||||
;;
|
||||
*)
|
||||
@@ -2628,7 +2610,6 @@ for hwlib in 32 64; do
|
||||
mkdir -p $d
|
||||
rm -f $d/Makefile
|
||||
ln -s $source_path/Makefile.hw $d/Makefile
|
||||
echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
|
||||
echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
|
||||
done
|
||||
|
||||
@@ -2636,3 +2617,6 @@ d=libuser
|
||||
mkdir -p $d
|
||||
rm -f $d/Makefile
|
||||
ln -s $source_path/Makefile.user $d/Makefile
|
||||
if test "$static" = "no" -a "$user_pie" = "yes" ; then
|
||||
echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
|
||||
fi
|
||||
@@ -1384,6 +1384,16 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, QemuOpt
|
||||
s->t_attrib = s->t_attrib_default;
|
||||
text_console_resize(s);
|
||||
|
||||
if (chr->label) {
|
||||
char msg[128];
|
||||
int len;
|
||||
|
||||
s->t_attrib.bgcol = COLOR_BLUE;
|
||||
len = snprintf(msg, sizeof(msg), "%s console\r\n", chr->label);
|
||||
console_puts(chr, (uint8_t*)msg, len);
|
||||
s->t_attrib = s->t_attrib_default;
|
||||
}
|
||||
|
||||
qemu_chr_generic_open(chr);
|
||||
if (chr->init)
|
||||
chr->init(chr);
|
||||
|
||||
@@ -44,7 +44,8 @@ struct MouseTransformInfo {
|
||||
int a[7];
|
||||
};
|
||||
|
||||
void do_info_mice(Monitor *mon);
|
||||
void do_info_mice_print(Monitor *mon, const QObject *data);
|
||||
void do_info_mice(Monitor *mon, QObject **ret_data);
|
||||
void do_mouse_set(Monitor *mon, const QDict *qdict);
|
||||
|
||||
/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
|
||||
@@ -322,7 +323,8 @@ void vnc_display_init(DisplayState *ds);
|
||||
void vnc_display_close(DisplayState *ds);
|
||||
int vnc_display_open(DisplayState *ds, const char *display);
|
||||
int vnc_display_password(DisplayState *ds, const char *password);
|
||||
void do_info_vnc(Monitor *mon);
|
||||
void do_info_vnc_print(Monitor *mon, const QObject *data);
|
||||
void do_info_vnc(Monitor *mon, QObject **ret_data);
|
||||
char *vnc_display_local_addr(DisplayState *ds);
|
||||
|
||||
/* curses.c */
|
||||
|
||||
@@ -1017,7 +1017,8 @@ static inline int64_t cpu_get_real_ticks (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif (defined(__mips_isa_rev) && __mips_isa_rev >= 2) || defined(__linux__)
|
||||
#elif defined(__mips__) && \
|
||||
((defined(__mips_isa_rev) && __mips_isa_rev >= 2) || defined(__linux__))
|
||||
/*
|
||||
* binutils wants to use rdhwr only on mips32r2
|
||||
* but as linux kernel emulate it, it's fine
|
||||
|
||||
+6
-6
@@ -82,9 +82,9 @@ static inline uint64_t cpu_ppc_get_tb (CPUState *env)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t cpu_ppc_load_tbl (CPUState *env)
|
||||
uint64_t cpu_ppc_load_tbl (CPUState *env)
|
||||
{
|
||||
return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
|
||||
return cpu_ppc_get_tb(env);
|
||||
}
|
||||
|
||||
uint32_t cpu_ppc_load_tbu (CPUState *env)
|
||||
@@ -92,9 +92,9 @@ uint32_t cpu_ppc_load_tbu (CPUState *env)
|
||||
return cpu_ppc_get_tb(env) >> 32;
|
||||
}
|
||||
|
||||
uint32_t cpu_ppc_load_atbl (CPUState *env)
|
||||
uint64_t cpu_ppc_load_atbl (CPUState *env)
|
||||
{
|
||||
return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
|
||||
return cpu_ppc_get_tb(env);
|
||||
}
|
||||
|
||||
uint32_t cpu_ppc_load_atbu (CPUState *env)
|
||||
@@ -113,12 +113,12 @@ uint32_t cpu_ppc601_load_rtcl (CPUState *env)
|
||||
}
|
||||
|
||||
/* XXX: to be fixed */
|
||||
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp)
|
||||
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val)
|
||||
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,11 @@ static int io_mem_watch;
|
||||
#endif
|
||||
|
||||
/* log support */
|
||||
#ifdef WIN32
|
||||
static const char *logfilename = "qemu.log";
|
||||
#else
|
||||
static const char *logfilename = "/tmp/qemu.log";
|
||||
#endif
|
||||
FILE *logfile;
|
||||
int loglevel;
|
||||
static int log_append = 0;
|
||||
@@ -1526,24 +1530,22 @@ void cpu_set_log_filename(const char *filename)
|
||||
|
||||
static void cpu_unlink_tb(CPUState *env)
|
||||
{
|
||||
#if defined(CONFIG_USE_NPTL)
|
||||
/* FIXME: TB unchaining isn't SMP safe. For now just ignore the
|
||||
problem and hope the cpu will stop of its own accord. For userspace
|
||||
emulation this often isn't actually as bad as it sounds. Often
|
||||
signals are used primarily to interrupt blocking syscalls. */
|
||||
#else
|
||||
TranslationBlock *tb;
|
||||
static spinlock_t interrupt_lock = SPIN_LOCK_UNLOCKED;
|
||||
|
||||
tb = env->current_tb;
|
||||
/* if the cpu is currently executing code, we must unlink it and
|
||||
all the potentially executing TB */
|
||||
if (tb && !testandset(&interrupt_lock)) {
|
||||
if (tb) {
|
||||
spin_lock(&interrupt_lock);
|
||||
env->current_tb = NULL;
|
||||
tb_reset_jump_recursive(tb);
|
||||
resetlock(&interrupt_lock);
|
||||
spin_unlock(&interrupt_lock);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* mask must never be zero, except for A20 change call */
|
||||
@@ -2915,7 +2917,7 @@ static int get_free_io_mem_idx(void)
|
||||
io_mem_used[i] = 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
fprintf(stderr, "RAN out out io_mem_idx, max %d !\n", IO_MEM_NB_ENTRIES);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
#if defined(CONFIG_SOLARIS) && \
|
||||
((CONFIG_SOLARIS_VERSION <= 9 ) || \
|
||||
((CONFIG_SOLARIS_VERSION >= 10) && (__GNUC__ < 4))) \
|
||||
((CONFIG_SOLARIS_VERSION == 10) && (__GNUC__ < 4))) \
|
||||
|| (defined(__OpenBSD__) && (OpenBSD < 200811))
|
||||
/*
|
||||
* C99 7.12.3 classification macros
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef struct {
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined(TARGET_SPARC)
|
||||
#define float32_default_nan make_float32(0x7FFFFFFF)
|
||||
#elif defined(TARGET_POWERPC) || defined(TARGET_ARM)
|
||||
#elif defined(TARGET_POWERPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA)
|
||||
#define float32_default_nan make_float32(0x7FC00000)
|
||||
#elif defined(TARGET_HPPA)
|
||||
#define float32_default_nan make_float32(0x7FA00000)
|
||||
@@ -189,7 +189,7 @@ static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM)
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined(TARGET_SPARC)
|
||||
#define float64_default_nan make_float64(LIT64( 0x7FFFFFFFFFFFFFFF ))
|
||||
#elif defined(TARGET_POWERPC) || defined(TARGET_ARM)
|
||||
#elif defined(TARGET_POWERPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA)
|
||||
#define float64_default_nan make_float64(LIT64( 0x7FF8000000000000 ))
|
||||
#elif defined(TARGET_HPPA)
|
||||
#define float64_default_nan make_float64(LIT64( 0x7FF4000000000000 ))
|
||||
|
||||
@@ -187,6 +187,7 @@ typedef struct float_status {
|
||||
signed char float_detect_tininess;
|
||||
signed char float_rounding_mode;
|
||||
signed char float_exception_flags;
|
||||
signed char float_exception_mask;
|
||||
#ifdef FLOATX80
|
||||
signed char floatx80_rounding_precision;
|
||||
#endif
|
||||
|
||||
@@ -1053,7 +1053,7 @@ static int cpu_gdb_read_register(CPUState *env, uint8_t *mem_buf, int n)
|
||||
case 34: GET_REGL(env->active_tc.HI[0]);
|
||||
case 35: GET_REGL(env->CP0_BadVAddr);
|
||||
case 36: GET_REGL((int32_t)env->CP0_Cause);
|
||||
case 37: GET_REGL(env->active_tc.PC);
|
||||
case 37: GET_REGL(env->active_tc.PC | !!(env->hflags & MIPS_HFLAG_M16));
|
||||
case 72: GET_REGL(0); /* fp */
|
||||
case 89: GET_REGL((int32_t)env->CP0_PRid);
|
||||
}
|
||||
@@ -1114,7 +1114,14 @@ static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n)
|
||||
case 34: env->active_tc.HI[0] = tmp; break;
|
||||
case 35: env->CP0_BadVAddr = tmp; break;
|
||||
case 36: env->CP0_Cause = tmp; break;
|
||||
case 37: env->active_tc.PC = tmp; break;
|
||||
case 37:
|
||||
env->active_tc.PC = tmp & ~(target_ulong)1;
|
||||
if (tmp & 1) {
|
||||
env->hflags |= MIPS_HFLAG_M16;
|
||||
} else {
|
||||
env->hflags &= ~(MIPS_HFLAG_M16);
|
||||
}
|
||||
break;
|
||||
case 72: /* fp, ignored */ break;
|
||||
default:
|
||||
if (n > 89)
|
||||
@@ -1658,7 +1665,12 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc)
|
||||
#elif defined (TARGET_SH4)
|
||||
s->c_cpu->pc = pc;
|
||||
#elif defined (TARGET_MIPS)
|
||||
s->c_cpu->active_tc.PC = pc;
|
||||
s->c_cpu->active_tc.PC = pc & ~(target_ulong)1;
|
||||
if (pc & 1) {
|
||||
s->c_cpu->hflags |= MIPS_HFLAG_M16;
|
||||
} else {
|
||||
s->c_cpu->hflags &= ~(MIPS_HFLAG_M16);
|
||||
}
|
||||
#elif defined (TARGET_MICROBLAZE)
|
||||
s->c_cpu->sregs[SR_PC] = pc;
|
||||
#elif defined (TARGET_CRIS)
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ static inline int ctz64(uint64_t val)
|
||||
{
|
||||
#if QEMU_GNUC_PREREQ(3, 4)
|
||||
if (val)
|
||||
return __builtin_ctz(val);
|
||||
return __builtin_ctzll(val);
|
||||
else
|
||||
return 64;
|
||||
#else
|
||||
|
||||
@@ -1284,37 +1284,42 @@ static int ac97_initfn (PCIDevice *dev)
|
||||
pci_config_set_vendor_id (c, PCI_VENDOR_ID_INTEL); /* ro */
|
||||
pci_config_set_device_id (c, PCI_DEVICE_ID_INTEL_82801AA_5); /* ro */
|
||||
|
||||
c[0x04] = 0x00; /* pcicmd pci command rw, ro */
|
||||
c[0x05] = 0x00;
|
||||
/* TODO: no need to override */
|
||||
c[PCI_COMMAND] = 0x00; /* pcicmd pci command rw, ro */
|
||||
c[PCI_COMMAND + 1] = 0x00;
|
||||
|
||||
c[0x06] = 0x80; /* pcists pci status rwc, ro */
|
||||
c[0x07] = 0x02;
|
||||
/* TODO: */
|
||||
c[PCI_STATUS] = PCI_STATUS_FAST_BACK; /* pcists pci status rwc, ro */
|
||||
c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;
|
||||
|
||||
c[0x08] = 0x01; /* rid revision ro */
|
||||
c[0x09] = 0x00; /* pi programming interface ro */
|
||||
c[PCI_REVISION_ID] = 0x01; /* rid revision ro */
|
||||
c[PCI_CLASS_PROG] = 0x00; /* pi programming interface ro */
|
||||
pci_config_set_class (c, PCI_CLASS_MULTIMEDIA_AUDIO); /* ro */
|
||||
c[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; /* headtyp header type ro */
|
||||
|
||||
c[0x10] = 0x01; /* nabmar native audio mixer base
|
||||
address rw */
|
||||
c[0x11] = 0x00;
|
||||
c[0x12] = 0x00;
|
||||
c[0x13] = 0x00;
|
||||
/* TODO set when bar is registered. no need to override. */
|
||||
/* nabmar native audio mixer base address rw */
|
||||
c[PCI_BASE_ADDRESS_0] = PCI_BASE_ADDRESS_SPACE_IO;
|
||||
c[PCI_BASE_ADDRESS_0 + 1] = 0x00;
|
||||
c[PCI_BASE_ADDRESS_0 + 2] = 0x00;
|
||||
c[PCI_BASE_ADDRESS_0 + 3] = 0x00;
|
||||
|
||||
c[0x14] = 0x01; /* nabmbar native audio bus mastering
|
||||
base address rw */
|
||||
c[0x15] = 0x00;
|
||||
c[0x16] = 0x00;
|
||||
c[0x17] = 0x00;
|
||||
/* TODO set when bar is registered. no need to override. */
|
||||
/* nabmbar native audio bus mastering base address rw */
|
||||
c[PCI_BASE_ADDRESS_0 + 4] = PCI_BASE_ADDRESS_SPACE_IO;
|
||||
c[PCI_BASE_ADDRESS_0 + 5] = 0x00;
|
||||
c[PCI_BASE_ADDRESS_0 + 6] = 0x00;
|
||||
c[PCI_BASE_ADDRESS_0 + 7] = 0x00;
|
||||
|
||||
c[0x2c] = 0x86; /* svid subsystem vendor id rwo */
|
||||
c[0x2d] = 0x80;
|
||||
c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86; /* svid subsystem vendor id rwo */
|
||||
c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80;
|
||||
|
||||
c[0x2e] = 0x00; /* sid subsystem id rwo */
|
||||
c[0x2f] = 0x00;
|
||||
c[PCI_SUBSYSTEM_ID] = 0x00; /* sid subsystem id rwo */
|
||||
c[PCI_SUBSYSTEM_ID + 1] = 0x00;
|
||||
|
||||
c[0x3c] = 0x00; /* intr_ln interrupt line rw */
|
||||
c[0x3d] = 0x01; /* intr_pn interrupt pin ro */
|
||||
c[PCI_INTERRUPT_LINE] = 0x00; /* intr_ln interrupt line rw */
|
||||
/* TODO: RST# value should be 0. */
|
||||
c[PCI_INTERRUPT_PIN] = 0x01; /* intr_pn interrupt pin ro */
|
||||
|
||||
pci_register_bar (&s->dev, 0, 256 * 4, PCI_BASE_ADDRESS_SPACE_IO,
|
||||
ac97_map);
|
||||
|
||||
@@ -437,7 +437,7 @@ static void pm_write_config(PCIDevice *d,
|
||||
uint32_t address, uint32_t val, int len)
|
||||
{
|
||||
pci_default_write_config(d, address, val, len);
|
||||
if (address == 0x80)
|
||||
if (range_covers_byte(address, len, 0x80))
|
||||
pm_io_space_update((PIIX4PMState *)d);
|
||||
}
|
||||
|
||||
|
||||
+35
-8
@@ -1060,8 +1060,17 @@ void call_pal (CPUState *env, int palcode)
|
||||
{
|
||||
target_long ret;
|
||||
|
||||
qemu_log("%s: palcode %02x\n", __func__, palcode);
|
||||
switch (palcode) {
|
||||
case 0x80:
|
||||
/* BPT */
|
||||
qemu_log("BPT\n");
|
||||
/* FIXME: Sends SIGTRAP, si_code=TRAP_BRKPT. */
|
||||
exit(1);
|
||||
case 0x81:
|
||||
/* BUGCHK */
|
||||
qemu_log("BUGCHK\n");
|
||||
/* FIXME: Sends SIGTRAP, si_code=SI_FAULT. */
|
||||
exit(1);
|
||||
case 0x83:
|
||||
/* CALLSYS */
|
||||
qemu_log("CALLSYS n " TARGET_FMT_ld "\n", env->ir[0]);
|
||||
@@ -1076,19 +1085,37 @@ void call_pal (CPUState *env, int palcode)
|
||||
env->ir[IR_V0] = -ret;
|
||||
}
|
||||
break;
|
||||
case 0x86:
|
||||
/* IMB */
|
||||
qemu_log("IMB\n");
|
||||
/* ??? We can probably elide the code using page_unprotect that is
|
||||
checking for self-modifying code. Instead we could simply call
|
||||
tb_flush here. Until we work out the changes required to turn
|
||||
off the extra write protection, this can be a no-op. */
|
||||
break;
|
||||
case 0x9E:
|
||||
/* RDUNIQUE */
|
||||
env->ir[IR_V0] = env->unique;
|
||||
qemu_log("RDUNIQUE: " TARGET_FMT_lx "\n", env->unique);
|
||||
break;
|
||||
/* Handled in the translator for usermode. */
|
||||
abort();
|
||||
case 0x9F:
|
||||
/* WRUNIQUE */
|
||||
env->unique = env->ir[IR_A0];
|
||||
qemu_log("WRUNIQUE: " TARGET_FMT_lx "\n", env->unique);
|
||||
break;
|
||||
qemu_log("WRUNIQUE: " TARGET_FMT_lx "\n", env->ir[IR_A0]);
|
||||
/* Handled in the translator for usermode. */
|
||||
abort();
|
||||
case 0xAA:
|
||||
/* GENTRAP */
|
||||
qemu_log("GENTRAP: " TARGET_FMT_lx "\n", env->ir[IR_A0]);
|
||||
/* FIXME: This is supposed to send a signal:
|
||||
SIGFPE:
|
||||
GEN_INTOVF, GEN_INTDIV, GEN_FLTOVF, GEN_FLTDIV,
|
||||
GEN_FLTUND, GEN_FLTINV, GEN_FLTINE, GEN_ROPRAND
|
||||
SIGTRAP:
|
||||
others
|
||||
with various settings of si_code. */
|
||||
exit(1);
|
||||
default:
|
||||
qemu_log("%s: unhandled palcode %02x\n",
|
||||
__func__, palcode);
|
||||
qemu_log("%s: unhandled palcode %02x\n", __func__, palcode);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,8 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
|
||||
d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
|
||||
pci_apb_set_irq, pci_pbm_map_irq, pic,
|
||||
0, 32);
|
||||
pci_bus_set_mem_base(d->host_state.bus, mem_base);
|
||||
|
||||
pci_create_simple(d->host_state.bus, 0, "pbm");
|
||||
/* APB secondary busses */
|
||||
*bus2 = pci_bridge_init(d->host_state.bus, PCI_DEVFN(1, 0),
|
||||
|
||||
+8
-1
@@ -19,8 +19,15 @@ typedef struct QEMUMachine {
|
||||
QEMUMachineInitFunc *init;
|
||||
int use_scsi;
|
||||
int max_cpus;
|
||||
unsigned int no_serial:1,
|
||||
no_parallel:1,
|
||||
use_virtcon:1,
|
||||
no_vga:1,
|
||||
no_floppy:1,
|
||||
no_cdrom:1,
|
||||
no_sdcard:1;
|
||||
int is_default;
|
||||
CompatProperty *compat_props;
|
||||
GlobalProperty *compat_props;
|
||||
struct QEMUMachine *next;
|
||||
} QEMUMachine;
|
||||
|
||||
|
||||
+2
-2
@@ -552,7 +552,7 @@ static struct bt_device_s *bt_hid_init(struct bt_scatternet_s *net,
|
||||
BT_HID_MTU, bt_hid_new_interrupt_ch);
|
||||
|
||||
s->usbdev = dev;
|
||||
s->btdev.device.lmp_name = s->usbdev->devname;
|
||||
s->btdev.device.lmp_name = s->usbdev->product_desc;
|
||||
usb_hid_datain_cb(s->usbdev, s, bt_hid_datain);
|
||||
|
||||
s->btdev.device.handle_destroy = bt_hid_destroy;
|
||||
@@ -566,6 +566,6 @@ static struct bt_device_s *bt_hid_init(struct bt_scatternet_s *net,
|
||||
|
||||
struct bt_device_s *bt_keyboard_init(struct bt_scatternet_s *net)
|
||||
{
|
||||
USBDevice *dev = usb_create_simple(NULL /* FIXME */, "QEMU USB Keyboard");
|
||||
USBDevice *dev = usb_create_simple(NULL /* FIXME */, "usb-kbd");
|
||||
return bt_hid_init(net, dev, class_keyboard);
|
||||
}
|
||||
+4
-5
@@ -3209,22 +3209,21 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
|
||||
pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY, cirrus_pci_mmio_map);
|
||||
}
|
||||
|
||||
/* ROM BIOS */
|
||||
rom_add_vga(VGABIOS_CIRRUS_FILENAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pci_cirrus_vga_init(PCIBus *bus)
|
||||
{
|
||||
pci_create_simple(bus, -1, "Cirrus VGA");
|
||||
pci_create_simple(bus, -1, "cirrus-vga");
|
||||
}
|
||||
|
||||
static PCIDeviceInfo cirrus_vga_info = {
|
||||
.qdev.name = "Cirrus VGA",
|
||||
.qdev.name = "cirrus-vga",
|
||||
.qdev.desc = "Cirrus CLGD 54xx VGA",
|
||||
.qdev.size = sizeof(PCICirrusVGAState),
|
||||
.qdev.vmsd = &vmstate_pci_cirrus_vga,
|
||||
.init = pci_cirrus_vga_initfn,
|
||||
.romfile = VGABIOS_CIRRUS_FILENAME,
|
||||
.config_write = pci_cirrus_write_config,
|
||||
};
|
||||
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* QEMU Bochs-style debug console ("port E9") emulation
|
||||
*
|
||||
* Copyright (c) 2003-2004 Fabrice Bellard
|
||||
* Copyright (c) 2008 Citrix Systems, Inc.
|
||||
* Copyright (c) Intel Corporation; author: H. Peter Anvin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hw.h"
|
||||
#include "qemu-char.h"
|
||||
#include "isa.h"
|
||||
#include "pc.h"
|
||||
|
||||
//#define DEBUG_DEBUGCON
|
||||
|
||||
typedef struct DebugconState {
|
||||
CharDriverState *chr;
|
||||
uint32_t readback;
|
||||
} DebugconState;
|
||||
|
||||
typedef struct ISADebugconState {
|
||||
ISADevice dev;
|
||||
uint32_t iobase;
|
||||
DebugconState state;
|
||||
} ISADebugconState;
|
||||
|
||||
static void debugcon_ioport_write(void *opaque, uint32_t addr, uint32_t val)
|
||||
{
|
||||
DebugconState *s = opaque;
|
||||
unsigned char ch = val;
|
||||
|
||||
#ifdef DEBUG_DEBUGCON
|
||||
printf("debugcon: write addr=0x%04x val=0x%02x\n", addr, val);
|
||||
#endif
|
||||
|
||||
qemu_chr_write(s->chr, &ch, 1);
|
||||
}
|
||||
|
||||
|
||||
static uint32_t debugcon_ioport_read(void *opaque, uint32_t addr)
|
||||
{
|
||||
DebugconState *s = opaque;
|
||||
|
||||
#ifdef DEBUG_DEBUGCON
|
||||
printf("debugcon: read addr=0x%04x\n", addr, val);
|
||||
#endif
|
||||
|
||||
return s->readback;
|
||||
}
|
||||
|
||||
static void debugcon_init_core(DebugconState *s)
|
||||
{
|
||||
if (!s->chr) {
|
||||
fprintf(stderr, "Can't create debugcon device, empty char device\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, s);
|
||||
}
|
||||
|
||||
static int debugcon_isa_initfn(ISADevice *dev)
|
||||
{
|
||||
ISADebugconState *isa = DO_UPCAST(ISADebugconState, dev, dev);
|
||||
DebugconState *s = &isa->state;
|
||||
|
||||
debugcon_init_core(s);
|
||||
register_ioport_write(isa->iobase, 1, 1, debugcon_ioport_write, s);
|
||||
register_ioport_read(isa->iobase, 1, 1, debugcon_ioport_read, s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ISADeviceInfo debugcon_isa_info = {
|
||||
.qdev.name = "isa-debugcon",
|
||||
.qdev.size = sizeof(ISADebugconState),
|
||||
.init = debugcon_isa_initfn,
|
||||
.qdev.props = (Property[]) {
|
||||
DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase, 0xe9),
|
||||
DEFINE_PROP_CHR("chardev", ISADebugconState, state.chr),
|
||||
DEFINE_PROP_HEX32("readback", ISADebugconState, state.readback, 0xe9),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
},
|
||||
};
|
||||
|
||||
static void debugcon_register_devices(void)
|
||||
{
|
||||
isa_qdev_register(&debugcon_isa_info);
|
||||
}
|
||||
|
||||
device_init(debugcon_register_devices)
|
||||
+11
-13
@@ -1,6 +1,9 @@
|
||||
/*
|
||||
* QEMU e1000 emulation
|
||||
*
|
||||
* Software developer's manual:
|
||||
* http://download.intel.com/design/network/manuals/8254x_GBe_SDM.pdf
|
||||
*
|
||||
* Nir Peleg, Tutis Systems Ltd. for Qumranet Inc.
|
||||
* Copyright (c) 2008 Qumranet
|
||||
* Based on work done by:
|
||||
@@ -1089,13 +1092,15 @@ static int pci_e1000_init(PCIDevice *pci_dev)
|
||||
|
||||
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
|
||||
pci_config_set_device_id(pci_conf, E1000_DEVID);
|
||||
*(uint16_t *)(pci_conf+0x04) = cpu_to_le16(0x0407);
|
||||
*(uint16_t *)(pci_conf+0x06) = cpu_to_le16(0x0010);
|
||||
pci_conf[0x08] = 0x03;
|
||||
/* TODO: we have no capabilities, so why is this bit set? */
|
||||
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST);
|
||||
pci_conf[PCI_REVISION_ID] = 0x03;
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
|
||||
pci_conf[0x0c] = 0x10;
|
||||
/* TODO: RST# value should be 0, PCI spec 6.2.4 */
|
||||
pci_conf[PCI_CACHE_LINE_SIZE] = 0x10;
|
||||
|
||||
pci_conf[0x3d] = 1; // interrupt pin 0
|
||||
/* TODO: RST# value should be 0 if programmable, PCI spec 6.2.4 */
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0
|
||||
|
||||
d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
|
||||
e1000_mmio_write, d);
|
||||
@@ -1121,14 +1126,6 @@ static int pci_e1000_init(PCIDevice *pci_dev)
|
||||
d->dev.qdev.info->name, d->dev.qdev.id, d);
|
||||
|
||||
qemu_format_nic_info_str(&d->nic->nc, macaddr);
|
||||
|
||||
if (!pci_dev->qdev.hotplugged) {
|
||||
static int loaded = 0;
|
||||
if (!loaded) {
|
||||
rom_add_option("pxe-e1000.bin");
|
||||
loaded = 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1146,6 +1143,7 @@ static PCIDeviceInfo e1000_info = {
|
||||
.qdev.vmsd = &vmstate_e1000,
|
||||
.init = pci_e1000_init,
|
||||
.exit = pci_e1000_uninit,
|
||||
.romfile = "pxe-e1000.bin",
|
||||
.qdev.props = (Property[]) {
|
||||
DEFINE_NIC_PROPERTIES(E1000State, conf),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
|
||||
+32
-17
@@ -412,19 +412,24 @@ static void pci_reset(EEPRO100State * s)
|
||||
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
|
||||
/* PCI Device ID depends on device and is set below. */
|
||||
/* PCI Command */
|
||||
/* TODO: this is the default, do not override. */
|
||||
PCI_CONFIG_16(PCI_COMMAND, 0x0000);
|
||||
/* PCI Status */
|
||||
PCI_CONFIG_16(PCI_STATUS, 0x2800);
|
||||
/* TODO: this seems to make no sense. */
|
||||
/* TODO: Value at RST# should be 0. */
|
||||
PCI_CONFIG_16(PCI_STATUS,
|
||||
PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_SIG_TARGET_ABORT);
|
||||
/* PCI Revision ID */
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x08);
|
||||
/* TODO: this is the default, do not override. */
|
||||
/* PCI Class Code */
|
||||
PCI_CONFIG_8(0x09, 0x00);
|
||||
PCI_CONFIG_8(PCI_CLASS_PROG, 0x00);
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
|
||||
/* PCI Cache Line Size */
|
||||
/* check cache line size!!! */
|
||||
//~ PCI_CONFIG_8(0x0c, 0x00);
|
||||
/* PCI Latency Timer */
|
||||
PCI_CONFIG_8(0x0d, 0x20); // latency timer = 32 clocks
|
||||
PCI_CONFIG_8(PCI_LATENCY_TIMER, 0x20); // latency timer = 32 clocks
|
||||
/* PCI Header Type */
|
||||
/* BIST (built-in self test) */
|
||||
#if defined(TARGET_I386)
|
||||
@@ -446,16 +451,20 @@ static void pci_reset(EEPRO100State * s)
|
||||
#endif
|
||||
#endif
|
||||
/* Expansion ROM Base Address (depends on boot disable!!!) */
|
||||
PCI_CONFIG_32(0x30, 0x00000000);
|
||||
/* TODO: not needed, set when BAR is registered */
|
||||
PCI_CONFIG_32(PCI_ROM_ADDRESS, PCI_BASE_ADDRESS_SPACE_MEMORY);
|
||||
/* Capability Pointer */
|
||||
PCI_CONFIG_8(0x34, 0xdc);
|
||||
/* TODO: revisions with power_management 1 use this but
|
||||
* do not set new capability list bit in status register. */
|
||||
PCI_CONFIG_8(PCI_CAPABILITY_LIST, 0xdc);
|
||||
/* Interrupt Line */
|
||||
/* Interrupt Pin */
|
||||
PCI_CONFIG_8(0x3d, 1); // interrupt pin 0
|
||||
/* TODO: RST# value should be 0 */
|
||||
PCI_CONFIG_8(PCI_INTERRUPT_PIN, 1); // interrupt pin 0
|
||||
/* Minimum Grant */
|
||||
PCI_CONFIG_8(0x3e, 0x08);
|
||||
PCI_CONFIG_8(PCI_MIN_GNT, 0x08);
|
||||
/* Maximum Latency */
|
||||
PCI_CONFIG_8(0x3f, 0x18);
|
||||
PCI_CONFIG_8(PCI_MAX_LAT, 0x18);
|
||||
|
||||
switch (device) {
|
||||
case i82550:
|
||||
@@ -479,52 +488,57 @@ static void pci_reset(EEPRO100State * s)
|
||||
case i82557A:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x01);
|
||||
PCI_CONFIG_8(0x34, 0x00);
|
||||
PCI_CONFIG_8(PCI_CAPABILITY_LIST, 0x00);
|
||||
power_management = 0;
|
||||
break;
|
||||
case i82557B:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x02);
|
||||
PCI_CONFIG_8(0x34, 0x00);
|
||||
PCI_CONFIG_8(PCI_CAPABILITY_LIST, 0x00);
|
||||
power_management = 0;
|
||||
break;
|
||||
case i82557C:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x03);
|
||||
PCI_CONFIG_8(0x34, 0x00);
|
||||
PCI_CONFIG_8(PCI_CAPABILITY_LIST, 0x00);
|
||||
power_management = 0;
|
||||
break;
|
||||
case i82558A:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_16(PCI_STATUS, 0x0290);
|
||||
PCI_CONFIG_16(PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
|
||||
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x04);
|
||||
s->stats_size = 76;
|
||||
s->has_extended_tcb_support = 1;
|
||||
break;
|
||||
case i82558B:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_16(PCI_STATUS, 0x0290);
|
||||
PCI_CONFIG_16(PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
|
||||
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x05);
|
||||
s->stats_size = 76;
|
||||
s->has_extended_tcb_support = 1;
|
||||
break;
|
||||
case i82559A:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_16(PCI_STATUS, 0x0290);
|
||||
PCI_CONFIG_16(PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
|
||||
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x06);
|
||||
s->stats_size = 80;
|
||||
s->has_extended_tcb_support = 1;
|
||||
break;
|
||||
case i82559B:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_16(PCI_STATUS, 0x0290);
|
||||
PCI_CONFIG_16(PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
|
||||
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x07);
|
||||
s->stats_size = 80;
|
||||
s->has_extended_tcb_support = 1;
|
||||
break;
|
||||
case i82559C:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
|
||||
PCI_CONFIG_16(PCI_STATUS, 0x0290);
|
||||
PCI_CONFIG_16(PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
|
||||
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x08);
|
||||
// TODO: Windows wants revision id 0x0c.
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x0c);
|
||||
@@ -537,7 +551,8 @@ static void pci_reset(EEPRO100State * s)
|
||||
break;
|
||||
case i82559ER:
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT);
|
||||
PCI_CONFIG_16(PCI_STATUS, 0x0290);
|
||||
PCI_CONFIG_16(PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
|
||||
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
|
||||
PCI_CONFIG_8(PCI_REVISION_ID, 0x09);
|
||||
s->stats_size = 80;
|
||||
s->has_extended_tcb_support = 1;
|
||||
|
||||
+7
-2
@@ -149,9 +149,14 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab,
|
||||
}
|
||||
i++;
|
||||
}
|
||||
syms = qemu_realloc(syms, nsyms * sizeof(*syms));
|
||||
if (nsyms) {
|
||||
syms = qemu_realloc(syms, nsyms * sizeof(*syms));
|
||||
|
||||
qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
|
||||
qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
|
||||
} else {
|
||||
qemu_free(syms);
|
||||
syms = NULL;
|
||||
}
|
||||
|
||||
/* String table */
|
||||
if (symtab->sh_link >= ehdr->e_shnum)
|
||||
|
||||
+15
-14
@@ -1000,27 +1000,28 @@ static int es1370_initfn (PCIDevice *dev)
|
||||
|
||||
pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ);
|
||||
pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370);
|
||||
c[0x07] = 2 << 1;
|
||||
c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_SLOW >> 8;
|
||||
pci_config_set_class (c, PCI_CLASS_MULTIMEDIA_AUDIO);
|
||||
|
||||
#if 1
|
||||
c[0x2c] = 0x42;
|
||||
c[0x2d] = 0x49;
|
||||
c[0x2e] = 0x4c;
|
||||
c[0x2f] = 0x4c;
|
||||
c[PCI_SUBSYSTEM_VENDOR_ID] = 0x42;
|
||||
c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x49;
|
||||
c[PCI_SUBSYSTEM_ID] = 0x4c;
|
||||
c[PCI_SUBSYSTEM_ID + 1] = 0x4c;
|
||||
#else
|
||||
c[0x2c] = 0x74;
|
||||
c[0x2d] = 0x12;
|
||||
c[0x2e] = 0x71;
|
||||
c[0x2f] = 0x13;
|
||||
c[0x34] = 0xdc;
|
||||
c[0x3c] = 10;
|
||||
c[PCI_SUBSYSTEM_VENDOR_ID] = 0x74;
|
||||
c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x12;
|
||||
c[PCI_SUBSYSTEM_ID] = 0x71;
|
||||
c[PCI_SUBSYSTEM_ID + 1] = 0x13;
|
||||
c[PCI_CAPABILITY_LIST] = 0xdc;
|
||||
c[PCI_INTERRUPT_LINE] = 10;
|
||||
c[0xdc] = 0x00;
|
||||
#endif
|
||||
|
||||
c[0x3d] = 1;
|
||||
c[0x3e] = 0x0c;
|
||||
c[0x3f] = 0x80;
|
||||
/* TODO: RST# value should be 0. */
|
||||
c[PCI_INTERRUPT_PIN] = 1;
|
||||
c[PCI_MIN_GNT] = 0x0c;
|
||||
c[PCI_MAX_LAT] = 0x80;
|
||||
|
||||
pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, es1370_map);
|
||||
qemu_register_reset (es1370_on_reset, s);
|
||||
|
||||
@@ -661,7 +661,7 @@ static int fdc_post_load(void *opaque, int version_id)
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_fdc = {
|
||||
.name = "fdctrl",
|
||||
.name = "fdc",
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 2,
|
||||
.minimum_version_id_old = 2,
|
||||
@@ -699,31 +699,6 @@ static const VMStateDescription vmstate_fdc = {
|
||||
}
|
||||
};
|
||||
|
||||
static const VMStateDescription vmstate_fdc_isa = {
|
||||
.name = "fdc",
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 2,
|
||||
.minimum_version_id_old = 2,
|
||||
.fields = (VMStateField []) {
|
||||
/* Controller State */
|
||||
VMSTATE_STRUCT(state, fdctrl_isabus_t, 0, vmstate_fdc, fdctrl_t),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static const VMStateDescription vmstate_fdc_sysbus = {
|
||||
.name = "fdc",
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 2,
|
||||
.minimum_version_id_old = 2,
|
||||
.fields = (VMStateField []) {
|
||||
/* Controller State */
|
||||
VMSTATE_STRUCT(state, fdctrl_sysbus_t, 0, vmstate_fdc, fdctrl_t),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static void fdctrl_external_reset_sysbus(DeviceState *d)
|
||||
{
|
||||
fdctrl_sysbus_t *sys = container_of(d, fdctrl_sysbus_t, busdev.qdev);
|
||||
@@ -960,6 +935,12 @@ static uint32_t fdctrl_read_main_status (fdctrl_t *fdctrl)
|
||||
fdctrl->dsr &= ~FD_DSR_PWRDOWN;
|
||||
fdctrl->dor |= FD_DOR_nRESET;
|
||||
|
||||
/* Sparc mutation */
|
||||
if (fdctrl->sun4m) {
|
||||
retval |= FD_MSR_DIO;
|
||||
fdctrl_reset_irq(fdctrl);
|
||||
};
|
||||
|
||||
FLOPPY_DPRINTF("main status register: 0x%02x\n", retval);
|
||||
|
||||
return retval;
|
||||
@@ -1926,7 +1907,7 @@ fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
|
||||
return fdctrl;
|
||||
}
|
||||
|
||||
static int fdctrl_init_common(fdctrl_t *fdctrl)
|
||||
static int fdctrl_init_common(fdctrl_t *fdctrl, target_phys_addr_t io_base)
|
||||
{
|
||||
int i, j;
|
||||
static int command_tables_inited = 0;
|
||||
@@ -1957,6 +1938,7 @@ static int fdctrl_init_common(fdctrl_t *fdctrl)
|
||||
DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl);
|
||||
fdctrl_connect_drives(fdctrl);
|
||||
|
||||
vmstate_register(io_base, &vmstate_fdc, fdctrl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1980,7 +1962,7 @@ static int isabus_fdc_init1(ISADevice *dev)
|
||||
isa_init_irq(&isa->busdev, &fdctrl->irq, isairq);
|
||||
fdctrl->dma_chann = dma_chann;
|
||||
|
||||
ret = fdctrl_init_common(fdctrl);
|
||||
ret = fdctrl_init_common(fdctrl, iobase);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1998,7 +1980,7 @@ static int sysbus_fdc_init1(SysBusDevice *dev)
|
||||
qdev_init_gpio_in(&dev->qdev, fdctrl_handle_tc, 1);
|
||||
fdctrl->dma_chann = -1;
|
||||
|
||||
ret = fdctrl_init_common(fdctrl);
|
||||
ret = fdctrl_init_common(fdctrl, io);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -2015,7 +1997,7 @@ static int sun4m_fdc_init1(SysBusDevice *dev)
|
||||
qdev_init_gpio_in(&dev->qdev, fdctrl_handle_tc, 1);
|
||||
|
||||
fdctrl->sun4m = 1;
|
||||
return fdctrl_init_common(fdctrl);
|
||||
return fdctrl_init_common(fdctrl, io);
|
||||
}
|
||||
|
||||
static ISADeviceInfo isa_fdc_info = {
|
||||
@@ -2023,7 +2005,6 @@ static ISADeviceInfo isa_fdc_info = {
|
||||
.qdev.name = "isa-fdc",
|
||||
.qdev.size = sizeof(fdctrl_isabus_t),
|
||||
.qdev.no_user = 1,
|
||||
.qdev.vmsd = &vmstate_fdc_isa,
|
||||
.qdev.reset = fdctrl_external_reset_isa,
|
||||
.qdev.props = (Property[]) {
|
||||
DEFINE_PROP_DRIVE("driveA", fdctrl_isabus_t, state.drives[0].dinfo),
|
||||
@@ -2036,7 +2017,6 @@ static SysBusDeviceInfo sysbus_fdc_info = {
|
||||
.init = sysbus_fdc_init1,
|
||||
.qdev.name = "sysbus-fdc",
|
||||
.qdev.size = sizeof(fdctrl_sysbus_t),
|
||||
.qdev.vmsd = &vmstate_fdc_sysbus,
|
||||
.qdev.reset = fdctrl_external_reset_sysbus,
|
||||
.qdev.props = (Property[]) {
|
||||
DEFINE_PROP_DRIVE("driveA", fdctrl_sysbus_t, state.drives[0].dinfo),
|
||||
@@ -2049,7 +2029,6 @@ static SysBusDeviceInfo sun4m_fdc_info = {
|
||||
.init = sun4m_fdc_init1,
|
||||
.qdev.name = "SUNW,fdtwo",
|
||||
.qdev.size = sizeof(fdctrl_sysbus_t),
|
||||
.qdev.vmsd = &vmstate_fdc_sysbus,
|
||||
.qdev.reset = fdctrl_external_reset_sysbus,
|
||||
.qdev.props = (Property[]) {
|
||||
DEFINE_PROP_DRIVE("drive", fdctrl_sysbus_t, state.drives[0].dinfo),
|
||||
|
||||
+55
-14
@@ -45,11 +45,12 @@ typedef struct _FWCfgEntry {
|
||||
FWCfgCallback callback;
|
||||
} FWCfgEntry;
|
||||
|
||||
typedef struct _FWCfgState {
|
||||
struct _FWCfgState {
|
||||
FWCfgEntry entries[2][FW_CFG_MAX_ENTRY];
|
||||
FWCfgFiles *files;
|
||||
uint16_t cur_entry;
|
||||
uint32_t cur_offset;
|
||||
} FWCfgState;
|
||||
};
|
||||
|
||||
static void fw_cfg_write(FWCfgState *s, uint8_t value)
|
||||
{
|
||||
@@ -210,9 +211,8 @@ static const VMStateDescription vmstate_fw_cfg = {
|
||||
}
|
||||
};
|
||||
|
||||
int fw_cfg_add_bytes(void *opaque, uint16_t key, uint8_t *data, uint32_t len)
|
||||
int fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len)
|
||||
{
|
||||
FWCfgState *s = opaque;
|
||||
int arch = !!(key & FW_CFG_ARCH_LOCAL);
|
||||
|
||||
key &= FW_CFG_ENTRY_MASK;
|
||||
@@ -226,37 +226,36 @@ int fw_cfg_add_bytes(void *opaque, uint16_t key, uint8_t *data, uint32_t len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int fw_cfg_add_i16(void *opaque, uint16_t key, uint16_t value)
|
||||
int fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value)
|
||||
{
|
||||
uint16_t *copy;
|
||||
|
||||
copy = qemu_malloc(sizeof(value));
|
||||
*copy = cpu_to_le16(value);
|
||||
return fw_cfg_add_bytes(opaque, key, (uint8_t *)copy, sizeof(value));
|
||||
return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));
|
||||
}
|
||||
|
||||
int fw_cfg_add_i32(void *opaque, uint16_t key, uint32_t value)
|
||||
int fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value)
|
||||
{
|
||||
uint32_t *copy;
|
||||
|
||||
copy = qemu_malloc(sizeof(value));
|
||||
*copy = cpu_to_le32(value);
|
||||
return fw_cfg_add_bytes(opaque, key, (uint8_t *)copy, sizeof(value));
|
||||
return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));
|
||||
}
|
||||
|
||||
int fw_cfg_add_i64(void *opaque, uint16_t key, uint64_t value)
|
||||
int fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value)
|
||||
{
|
||||
uint64_t *copy;
|
||||
|
||||
copy = qemu_malloc(sizeof(value));
|
||||
*copy = cpu_to_le64(value);
|
||||
return fw_cfg_add_bytes(opaque, key, (uint8_t *)copy, sizeof(value));
|
||||
return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));
|
||||
}
|
||||
|
||||
int fw_cfg_add_callback(void *opaque, uint16_t key, FWCfgCallback callback,
|
||||
int fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
|
||||
void *callback_opaque, uint8_t *data, size_t len)
|
||||
{
|
||||
FWCfgState *s = opaque;
|
||||
int arch = !!(key & FW_CFG_ARCH_LOCAL);
|
||||
|
||||
if (!(key & FW_CFG_WRITE_CHANNEL))
|
||||
@@ -275,8 +274,50 @@ int fw_cfg_add_callback(void *opaque, uint16_t key, FWCfgCallback callback,
|
||||
return 1;
|
||||
}
|
||||
|
||||
void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
||||
target_phys_addr_t ctl_addr, target_phys_addr_t data_addr)
|
||||
int fw_cfg_add_file(FWCfgState *s, const char *dir, const char *filename,
|
||||
uint8_t *data, uint32_t len)
|
||||
{
|
||||
const char *basename;
|
||||
int index;
|
||||
|
||||
if (!s->files) {
|
||||
int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS;
|
||||
s->files = qemu_mallocz(dsize);
|
||||
fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize);
|
||||
}
|
||||
|
||||
index = be32_to_cpu(s->files->count);
|
||||
if (index == FW_CFG_FILE_SLOTS) {
|
||||
fprintf(stderr, "fw_cfg: out of file slots\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fw_cfg_add_bytes(s, FW_CFG_FILE_FIRST + index, data, len);
|
||||
|
||||
basename = strrchr(filename, '/');
|
||||
if (basename) {
|
||||
basename++;
|
||||
} else {
|
||||
basename = filename;
|
||||
}
|
||||
if (dir) {
|
||||
snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
|
||||
"%s/%s", dir, basename);
|
||||
} else {
|
||||
snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
|
||||
"%s", basename);
|
||||
}
|
||||
s->files->f[index].size = cpu_to_be32(len);
|
||||
s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index);
|
||||
FW_CFG_DPRINTF("%s: #%d: %s (%d bytes)\n", __FUNCTION__,
|
||||
index, s->files->f[index].name, len);
|
||||
|
||||
s->files->count = cpu_to_be32(index+1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
||||
target_phys_addr_t ctl_addr, target_phys_addr_t data_addr)
|
||||
{
|
||||
FWCfgState *s;
|
||||
int io_ctl_memory, io_data_memory;
|
||||
|
||||
+27
-8
@@ -26,7 +26,11 @@
|
||||
#define FW_CFG_SETUP_ADDR 0x16
|
||||
#define FW_CFG_SETUP_SIZE 0x17
|
||||
#define FW_CFG_SETUP_DATA 0x18
|
||||
#define FW_CFG_MAX_ENTRY 0x19
|
||||
#define FW_CFG_FILE_DIR 0x19
|
||||
|
||||
#define FW_CFG_FILE_FIRST 0x20
|
||||
#define FW_CFG_FILE_SLOTS 0x10
|
||||
#define FW_CFG_MAX_ENTRY (FW_CFG_FILE_FIRST+FW_CFG_FILE_SLOTS)
|
||||
|
||||
#define FW_CFG_WRITE_CHANNEL 0x4000
|
||||
#define FW_CFG_ARCH_LOCAL 0x8000
|
||||
@@ -35,16 +39,31 @@
|
||||
#define FW_CFG_INVALID 0xffff
|
||||
|
||||
#ifndef NO_QEMU_PROTOS
|
||||
typedef struct FWCfgFile {
|
||||
uint32_t size; /* file size */
|
||||
uint16_t select; /* write this to 0x510 to read it */
|
||||
uint16_t reserved;
|
||||
char name[56];
|
||||
} FWCfgFile;
|
||||
|
||||
typedef struct FWCfgFiles {
|
||||
uint32_t count;
|
||||
FWCfgFile f[];
|
||||
} FWCfgFiles;
|
||||
|
||||
typedef void (*FWCfgCallback)(void *opaque, uint8_t *data);
|
||||
|
||||
int fw_cfg_add_bytes(void *opaque, uint16_t key, uint8_t *data, uint32_t len);
|
||||
int fw_cfg_add_i16(void *opaque, uint16_t key, uint16_t value);
|
||||
int fw_cfg_add_i32(void *opaque, uint16_t key, uint32_t value);
|
||||
int fw_cfg_add_i64(void *opaque, uint16_t key, uint64_t value);
|
||||
int fw_cfg_add_callback(void *opaque, uint16_t key, FWCfgCallback callback,
|
||||
typedef struct _FWCfgState FWCfgState;
|
||||
int fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len);
|
||||
int fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value);
|
||||
int fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value);
|
||||
int fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value);
|
||||
int fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
|
||||
void *callback_opaque, uint8_t *data, size_t len);
|
||||
void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
||||
target_phys_addr_t crl_addr, target_phys_addr_t data_addr);
|
||||
int fw_cfg_add_file(FWCfgState *s, const char *dir, const char *filename,
|
||||
uint8_t *data, uint32_t len);
|
||||
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
||||
target_phys_addr_t crl_addr, target_phys_addr_t data_addr);
|
||||
|
||||
#endif /* NO_QEMU_PROTOS */
|
||||
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ static PCIDeviceInfo grackle_pci_host_info = {
|
||||
};
|
||||
|
||||
static PCIDeviceInfo dec_21154_pci_host_info = {
|
||||
.qdev.name = "DEC 21154",
|
||||
.qdev.name = "dec-21154",
|
||||
.qdev.size = sizeof(PCIDevice),
|
||||
.init = dec_21154_pci_host_init,
|
||||
};
|
||||
@@ -188,7 +188,7 @@ static void grackle_register_devices(void)
|
||||
sysbus_register_dev("grackle", sizeof(GrackleState),
|
||||
pci_grackle_init_device);
|
||||
pci_qdev_register(&grackle_pci_host_info);
|
||||
sysbus_register_dev("DEC 21154", sizeof(GrackleState),
|
||||
sysbus_register_dev("dec-21154", sizeof(GrackleState),
|
||||
pci_dec_21154_init_device);
|
||||
pci_qdev_register(&dec_21154_pci_host_info);
|
||||
}
|
||||
|
||||
+1
-12
@@ -1082,17 +1082,6 @@ static void gt64120_reset(void *opaque)
|
||||
gt64120_pci_mapping(s);
|
||||
}
|
||||
|
||||
static uint32_t gt64120_read_config(PCIDevice *d, uint32_t address, int len)
|
||||
{
|
||||
return pci_default_read_config(d, address, len);
|
||||
}
|
||||
|
||||
static void gt64120_write_config(PCIDevice *d, uint32_t address, uint32_t val,
|
||||
int len)
|
||||
{
|
||||
pci_default_write_config(d, address, val, len);
|
||||
}
|
||||
|
||||
static void gt64120_save(QEMUFile* f, void *opaque)
|
||||
{
|
||||
PCIDevice *d = opaque;
|
||||
@@ -1125,7 +1114,7 @@ PCIBus *pci_gt64120_init(qemu_irq *pic)
|
||||
pic, 144, 4);
|
||||
s->ISD_handle = cpu_register_io_memory(gt64120_read, gt64120_write, s);
|
||||
d = pci_register_device(s->pci->bus, "GT64120 PCI Bus", sizeof(PCIDevice),
|
||||
0, gt64120_read_config, gt64120_write_config);
|
||||
0, NULL, NULL);
|
||||
|
||||
/* FIXME: Malta specific hw assumptions ahead */
|
||||
|
||||
|
||||
+8
-10
@@ -70,11 +70,7 @@ static void ide_map(PCIDevice *pci_dev, int region_num,
|
||||
|
||||
static PCIIDEState *pci_from_bm(BMDMAState *bm)
|
||||
{
|
||||
if (bm->unit == 0) {
|
||||
return container_of(bm, PCIIDEState, bmdma[0]);
|
||||
} else {
|
||||
return container_of(bm, PCIIDEState, bmdma[1]);
|
||||
}
|
||||
return bm->pci_dev;
|
||||
}
|
||||
|
||||
static uint32_t bmdma_readb(void *opaque, uint32_t addr)
|
||||
@@ -145,6 +141,7 @@ static void bmdma_map(PCIDevice *pci_dev, int region_num,
|
||||
BMDMAState *bm = &d->bmdma[i];
|
||||
d->bus[i].bmdma = bm;
|
||||
bm->bus = d->bus+i;
|
||||
bm->pci_dev = d;
|
||||
qemu_add_vm_change_state_handler(ide_dma_restart_cb, bm);
|
||||
|
||||
register_ioport_write(addr, 1, 1, bmdma_cmd_writeb, bm);
|
||||
@@ -209,8 +206,8 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
|
||||
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD);
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646);
|
||||
|
||||
pci_conf[0x08] = 0x07; // IDE controller revision
|
||||
pci_conf[0x09] = 0x8f;
|
||||
pci_conf[PCI_REVISION_ID] = 0x07; // IDE controller revision
|
||||
pci_conf[PCI_CLASS_PROG] = 0x8f;
|
||||
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
|
||||
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
|
||||
@@ -227,7 +224,8 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
|
||||
pci_register_bar(dev, 3, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map);
|
||||
pci_register_bar(dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, bmdma_map);
|
||||
|
||||
pci_conf[0x3d] = 0x01; // interrupt on pin 1
|
||||
/* TODO: RST# value should be 0 */
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1
|
||||
|
||||
irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);
|
||||
ide_bus_new(&d->bus[0], &d->dev.qdev);
|
||||
@@ -245,7 +243,7 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
|
||||
{
|
||||
PCIDevice *dev;
|
||||
|
||||
dev = pci_create(bus, -1, "CMD646 IDE");
|
||||
dev = pci_create(bus, -1, "cmd646-ide");
|
||||
qdev_prop_set_uint32(&dev->qdev, "secondary", secondary_ide_enabled);
|
||||
qdev_init_nofail(&dev->qdev);
|
||||
|
||||
@@ -254,7 +252,7 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
|
||||
|
||||
static PCIDeviceInfo cmd646_ide_info[] = {
|
||||
{
|
||||
.qdev.name = "CMD646 IDE",
|
||||
.qdev.name = "cmd646-ide",
|
||||
.qdev.size = sizeof(PCIIDEState),
|
||||
.init = pci_cmd646_ide_initfn,
|
||||
.qdev.props = (Property[]) {
|
||||
|
||||
@@ -474,6 +474,7 @@ struct BMDMAState {
|
||||
uint8_t status;
|
||||
uint32_t addr;
|
||||
|
||||
struct PCIIDEState *pci_dev;
|
||||
IDEBus *bus;
|
||||
/* current transfer state */
|
||||
uint32_t cur_addr;
|
||||
|
||||
+13
-9
@@ -78,6 +78,7 @@ static void bmdma_map(PCIDevice *pci_dev, int region_num,
|
||||
BMDMAState *bm = &d->bmdma[i];
|
||||
d->bus[i].bmdma = bm;
|
||||
bm->bus = d->bus+i;
|
||||
bm->pci_dev = d;
|
||||
qemu_add_vm_change_state_handler(ide_dma_restart_cb, bm);
|
||||
|
||||
register_ioport_write(addr, 1, 1, bmdma_cmd_writeb, bm);
|
||||
@@ -106,10 +107,13 @@ static void piix3_reset(void *opaque)
|
||||
ide_dma_reset(&d->bmdma[i]);
|
||||
}
|
||||
|
||||
pci_conf[0x04] = 0x00;
|
||||
pci_conf[0x05] = 0x00;
|
||||
pci_conf[0x06] = 0x80; /* FBC */
|
||||
pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
|
||||
/* TODO: this is the default. do not override. */
|
||||
pci_conf[PCI_COMMAND] = 0x00;
|
||||
/* TODO: this is the default. do not override. */
|
||||
pci_conf[PCI_COMMAND + 1] = 0x00;
|
||||
/* TODO: use pci_set_word */
|
||||
pci_conf[PCI_STATUS] = PCI_STATUS_FAST_BACK;
|
||||
pci_conf[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;
|
||||
pci_conf[0x20] = 0x01; /* BMIBA: 20-23h */
|
||||
}
|
||||
|
||||
@@ -117,7 +121,7 @@ static int pci_piix_ide_initfn(PCIIDEState *d)
|
||||
{
|
||||
uint8_t *pci_conf = d->dev.config;
|
||||
|
||||
pci_conf[0x09] = 0x80; // legacy ATA mode
|
||||
pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
|
||||
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
|
||||
|
||||
@@ -161,7 +165,7 @@ void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
|
||||
{
|
||||
PCIDevice *dev;
|
||||
|
||||
dev = pci_create_simple(bus, devfn, "PIIX3 IDE");
|
||||
dev = pci_create_simple(bus, devfn, "piix3-ide");
|
||||
pci_ide_create_devs(dev, hd_table);
|
||||
}
|
||||
|
||||
@@ -171,18 +175,18 @@ void pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
|
||||
{
|
||||
PCIDevice *dev;
|
||||
|
||||
dev = pci_create_simple(bus, devfn, "PIIX4 IDE");
|
||||
dev = pci_create_simple(bus, devfn, "piix4-ide");
|
||||
pci_ide_create_devs(dev, hd_table);
|
||||
}
|
||||
|
||||
static PCIDeviceInfo piix_ide_info[] = {
|
||||
{
|
||||
.qdev.name = "PIIX3 IDE",
|
||||
.qdev.name = "piix3-ide",
|
||||
.qdev.size = sizeof(PCIIDEState),
|
||||
.qdev.no_user = 1,
|
||||
.init = pci_piix3_ide_initfn,
|
||||
},{
|
||||
.qdev.name = "PIIX4 IDE",
|
||||
.qdev.name = "piix4-ide",
|
||||
.qdev.size = sizeof(PCIIDEState),
|
||||
.qdev.no_user = 1,
|
||||
.init = pci_piix4_ide_initfn,
|
||||
|
||||
+89
-5
@@ -40,8 +40,8 @@ do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
|
||||
#define CSR_TX_FIFO_INF 0x80
|
||||
#define CSR_PMT_CTRL 0x84
|
||||
#define CSR_GPIO_CFG 0x88
|
||||
#define CSR_GPT_CFG 0x8c /* TODO */
|
||||
#define CSR_GPT_CNT 0x90 /* TODO */
|
||||
#define CSR_GPT_CFG 0x8c
|
||||
#define CSR_GPT_CNT 0x90
|
||||
#define CSR_WORD_SWAP 0x98
|
||||
#define CSR_FREE_RUN 0x9c
|
||||
#define CSR_RX_DROP 0xa0
|
||||
@@ -52,6 +52,7 @@ do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
|
||||
#define CSR_E2P_DATA 0xb4
|
||||
|
||||
/* IRQ_CFG */
|
||||
#define IRQ_INT 0x00001000
|
||||
#define IRQ_EN 0x00000100
|
||||
#define IRQ_POL 0x00000010
|
||||
#define IRQ_TYPE 0x00000001
|
||||
@@ -117,6 +118,16 @@ do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
|
||||
#define MAC_CR_RXEN 0x00000004
|
||||
#define MAC_CR_RESERVED 0x7f404213
|
||||
|
||||
#define PHY_INT_ENERGYON 0x80
|
||||
#define PHY_INT_AUTONEG_COMPLETE 0x40
|
||||
#define PHY_INT_FAULT 0x20
|
||||
#define PHY_INT_DOWN 0x10
|
||||
#define PHY_INT_AUTONEG_LP 0x08
|
||||
#define PHY_INT_PARFAULT 0x04
|
||||
#define PHY_INT_AUTONEG_PAGE 0x02
|
||||
|
||||
#define GPT_TIMER_EN 0x20000000
|
||||
|
||||
enum tx_state {
|
||||
TX_IDLE,
|
||||
TX_B,
|
||||
@@ -141,6 +152,7 @@ typedef struct {
|
||||
NICConf conf;
|
||||
qemu_irq irq;
|
||||
int mmio_index;
|
||||
ptimer_state *timer;
|
||||
|
||||
uint32_t irq_cfg;
|
||||
uint32_t int_sts;
|
||||
@@ -151,6 +163,7 @@ typedef struct {
|
||||
uint32_t hw_cfg;
|
||||
uint32_t pmt_ctrl;
|
||||
uint32_t gpio_cfg;
|
||||
uint32_t gpt_cfg;
|
||||
uint32_t word_swap;
|
||||
uint32_t free_timer_start;
|
||||
uint32_t mac_cmd;
|
||||
@@ -169,6 +182,8 @@ typedef struct {
|
||||
uint32_t phy_status;
|
||||
uint32_t phy_control;
|
||||
uint32_t phy_advertise;
|
||||
uint32_t phy_int;
|
||||
uint32_t phy_int_mask;
|
||||
|
||||
int eeprom_writable;
|
||||
uint8_t eeprom[8];
|
||||
@@ -204,6 +219,11 @@ static void lan9118_update(lan9118_state *s)
|
||||
|
||||
/* TODO: Implement FIFO level IRQs. */
|
||||
level = (s->int_sts & s->int_en) != 0;
|
||||
if (level) {
|
||||
s->irq_cfg |= IRQ_INT;
|
||||
} else {
|
||||
s->irq_cfg &= ~IRQ_INT;
|
||||
}
|
||||
if ((s->irq_cfg & IRQ_EN) == 0) {
|
||||
level = 0;
|
||||
}
|
||||
@@ -231,14 +251,28 @@ static void lan9118_reload_eeprom(lan9118_state *s)
|
||||
lan9118_mac_changed(s);
|
||||
}
|
||||
|
||||
static void phy_update_irq(lan9118_state *s)
|
||||
{
|
||||
if (s->phy_int & s->phy_int_mask) {
|
||||
s->int_sts |= PHY_INT;
|
||||
} else {
|
||||
s->int_sts &= ~PHY_INT;
|
||||
}
|
||||
lan9118_update(s);
|
||||
}
|
||||
|
||||
static void phy_update_link(lan9118_state *s)
|
||||
{
|
||||
/* Autonegotiation status mirrors link status. */
|
||||
if (s->nic->nc.link_down) {
|
||||
s->phy_status &= ~0x0024;
|
||||
s->phy_int |= PHY_INT_DOWN;
|
||||
} else {
|
||||
s->phy_status |= 0x0024;
|
||||
s->phy_int |= PHY_INT_ENERGYON;
|
||||
s->phy_int |= PHY_INT_AUTONEG_COMPLETE;
|
||||
}
|
||||
phy_update_irq(s);
|
||||
}
|
||||
|
||||
static void lan9118_set_link(VLANClientState *nc)
|
||||
@@ -248,9 +282,11 @@ static void lan9118_set_link(VLANClientState *nc)
|
||||
|
||||
static void phy_reset(lan9118_state *s)
|
||||
{
|
||||
s->phy_status = 0x7805;
|
||||
s->phy_status = 0x7809;
|
||||
s->phy_control = 0x3000;
|
||||
s->phy_advertise = 0x01e1;
|
||||
s->phy_int_mask = 0;
|
||||
s->phy_int = 0;
|
||||
phy_update_link(s);
|
||||
}
|
||||
|
||||
@@ -292,6 +328,10 @@ static void lan9118_reset(DeviceState *d)
|
||||
s->e2p_data = 0;
|
||||
s->free_timer_start = qemu_get_clock(vm_clock) / 40;
|
||||
|
||||
ptimer_stop(s->timer);
|
||||
ptimer_set_count(s->timer, 0xffff);
|
||||
s->gpt_cfg = 0xffff;
|
||||
|
||||
s->mac_cr = MAC_CR_PRMS;
|
||||
s->mac_hashh = 0;
|
||||
s->mac_hashl = 0;
|
||||
@@ -640,6 +680,8 @@ static void tx_fifo_push(lan9118_state *s, uint32_t val)
|
||||
|
||||
static uint32_t do_phy_read(lan9118_state *s, int reg)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
switch (reg) {
|
||||
case 0: /* Basic Control */
|
||||
return s->phy_control;
|
||||
@@ -656,6 +698,13 @@ static uint32_t do_phy_read(lan9118_state *s, int reg)
|
||||
case 6: /* Auto-neg Expansion */
|
||||
return 1;
|
||||
/* TODO 17, 18, 27, 29, 30, 31 */
|
||||
case 29: /* Interrupt source. */
|
||||
val = s->phy_int;
|
||||
s->phy_int = 0;
|
||||
phy_update_irq(s);
|
||||
return val;
|
||||
case 30: /* Interrupt mask */
|
||||
return s->phy_int_mask;
|
||||
default:
|
||||
BADF("PHY read reg %d\n", reg);
|
||||
return 0;
|
||||
@@ -679,7 +728,11 @@ static void do_phy_write(lan9118_state *s, int reg, uint32_t val)
|
||||
case 4: /* Auto-neg advertisment */
|
||||
s->phy_advertise = (val & 0x2d7f) | 0x80;
|
||||
break;
|
||||
/* TODO 17, 18, 27, 29, 30, 31 */
|
||||
/* TODO 17, 18, 27, 31 */
|
||||
case 30: /* Interrupt mask */
|
||||
s->phy_int_mask = val & 0xff;
|
||||
phy_update_irq(s);
|
||||
break;
|
||||
default:
|
||||
BADF("PHY write reg %d = 0x%04x\n", reg, val);
|
||||
}
|
||||
@@ -820,6 +873,15 @@ static void lan9118_eeprom_cmd(lan9118_state *s, int cmd, int addr)
|
||||
}
|
||||
}
|
||||
|
||||
static void lan9118_tick(void *opaque)
|
||||
{
|
||||
lan9118_state *s = (lan9118_state *)opaque;
|
||||
if (s->int_en & GPT_INT) {
|
||||
s->int_sts |= GPT_INT;
|
||||
}
|
||||
lan9118_update(s);
|
||||
}
|
||||
|
||||
static void lan9118_writel(void *opaque, target_phys_addr_t offset,
|
||||
uint32_t val)
|
||||
{
|
||||
@@ -835,7 +897,7 @@ static void lan9118_writel(void *opaque, target_phys_addr_t offset,
|
||||
switch (offset) {
|
||||
case CSR_IRQ_CFG:
|
||||
/* TODO: Implement interrupt deassertion intervals. */
|
||||
s->irq_cfg = (val & IRQ_EN);
|
||||
s->irq_cfg = (s->irq_cfg & IRQ_INT) | (val & IRQ_EN);
|
||||
break;
|
||||
case CSR_INT_STS:
|
||||
s->int_sts &= ~val;
|
||||
@@ -905,6 +967,18 @@ static void lan9118_writel(void *opaque, target_phys_addr_t offset,
|
||||
/* Probably just enabling LEDs. */
|
||||
s->gpio_cfg = val & 0x7777071f;
|
||||
break;
|
||||
case CSR_GPT_CFG:
|
||||
if ((s->gpt_cfg ^ val) & GPT_TIMER_EN) {
|
||||
if (val & GPT_TIMER_EN) {
|
||||
ptimer_set_count(s->timer, val & 0xffff);
|
||||
ptimer_run(s->timer, 0);
|
||||
} else {
|
||||
ptimer_stop(s->timer);
|
||||
ptimer_set_count(s->timer, 0xffff);
|
||||
}
|
||||
}
|
||||
s->gpt_cfg = val & (GPT_TIMER_EN | 0xffff);
|
||||
break;
|
||||
case CSR_WORD_SWAP:
|
||||
/* Ignored because we're in 32-bit mode. */
|
||||
s->word_swap = val;
|
||||
@@ -988,6 +1062,10 @@ static uint32_t lan9118_readl(void *opaque, target_phys_addr_t offset)
|
||||
return s->pmt_ctrl;
|
||||
case CSR_GPIO_CFG:
|
||||
return s->gpio_cfg;
|
||||
case CSR_GPT_CFG:
|
||||
return s->gpt_cfg;
|
||||
case CSR_GPT_CNT:
|
||||
return ptimer_get_count(s->timer);
|
||||
case CSR_WORD_SWAP:
|
||||
return s->word_swap;
|
||||
case CSR_FREE_RUN:
|
||||
@@ -1041,6 +1119,7 @@ static NetClientInfo net_lan9118_info = {
|
||||
static int lan9118_init1(SysBusDevice *dev)
|
||||
{
|
||||
lan9118_state *s = FROM_SYSBUS(lan9118_state, dev);
|
||||
QEMUBH *bh;
|
||||
int i;
|
||||
|
||||
s->mmio_index = cpu_register_io_memory(lan9118_readfn,
|
||||
@@ -1059,6 +1138,11 @@ static int lan9118_init1(SysBusDevice *dev)
|
||||
s->pmt_ctrl = 1;
|
||||
s->txp = &s->tx_packet;
|
||||
|
||||
bh = qemu_bh_new(lan9118_tick, s);
|
||||
s->timer = ptimer_init(bh);
|
||||
ptimer_set_freq(s->timer, 10000);
|
||||
ptimer_set_limit(s->timer, 0xffff, 1);
|
||||
|
||||
/* ??? Save/restore. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
+71
-58
@@ -48,6 +48,7 @@
|
||||
#include "sysemu.h"
|
||||
#include "uboot_image.h"
|
||||
#include "loader.h"
|
||||
#include "fw_cfg.h"
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
@@ -526,11 +527,10 @@ struct Rom {
|
||||
char *path;
|
||||
size_t romsize;
|
||||
uint8_t *data;
|
||||
int align;
|
||||
int isrom;
|
||||
char *fw_dir;
|
||||
char *fw_file;
|
||||
|
||||
target_phys_addr_t min;
|
||||
target_phys_addr_t max;
|
||||
target_phys_addr_t addr;
|
||||
QTAILQ_ENTRY(Rom) next;
|
||||
};
|
||||
@@ -548,7 +548,7 @@ static void rom_insert(Rom *rom)
|
||||
|
||||
/* list is ordered by load address */
|
||||
QTAILQ_FOREACH(item, &roms, next) {
|
||||
if (rom->min >= item->min)
|
||||
if (rom->addr >= item->addr)
|
||||
continue;
|
||||
QTAILQ_INSERT_BEFORE(item, rom, next);
|
||||
return;
|
||||
@@ -556,8 +556,8 @@ static void rom_insert(Rom *rom)
|
||||
QTAILQ_INSERT_TAIL(&roms, rom, next);
|
||||
}
|
||||
|
||||
int rom_add_file(const char *file,
|
||||
target_phys_addr_t min, target_phys_addr_t max, int align)
|
||||
int rom_add_file(const char *file, const char *fw_dir, const char *fw_file,
|
||||
target_phys_addr_t addr)
|
||||
{
|
||||
Rom *rom;
|
||||
int rc, fd = -1;
|
||||
@@ -576,9 +576,9 @@ int rom_add_file(const char *file,
|
||||
goto err;
|
||||
}
|
||||
|
||||
rom->align = align;
|
||||
rom->min = min;
|
||||
rom->max = max;
|
||||
rom->fw_dir = fw_dir ? qemu_strdup(fw_dir) : NULL;
|
||||
rom->fw_file = fw_file ? qemu_strdup(fw_file) : NULL;
|
||||
rom->addr = addr;
|
||||
rom->romsize = lseek(fd, 0, SEEK_END);
|
||||
rom->data = qemu_mallocz(rom->romsize);
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
@@ -603,15 +603,13 @@ err:
|
||||
}
|
||||
|
||||
int rom_add_blob(const char *name, const void *blob, size_t len,
|
||||
target_phys_addr_t min, target_phys_addr_t max, int align)
|
||||
target_phys_addr_t addr)
|
||||
{
|
||||
Rom *rom;
|
||||
|
||||
rom = qemu_mallocz(sizeof(*rom));
|
||||
rom->name = qemu_strdup(name);
|
||||
rom->align = align;
|
||||
rom->min = min;
|
||||
rom->max = max;
|
||||
rom->addr = addr;
|
||||
rom->romsize = len;
|
||||
rom->data = qemu_mallocz(rom->romsize);
|
||||
memcpy(rom->data, blob, len);
|
||||
@@ -623,14 +621,14 @@ int rom_add_vga(const char *file)
|
||||
{
|
||||
if (!rom_enable_driver_roms)
|
||||
return 0;
|
||||
return rom_add_file(file, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN);
|
||||
return rom_add_file(file, "vgaroms", file, 0);
|
||||
}
|
||||
|
||||
int rom_add_option(const char *file)
|
||||
{
|
||||
if (!rom_enable_driver_roms)
|
||||
return 0;
|
||||
return rom_add_file(file, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN);
|
||||
return rom_add_file(file, "genroms", file, 0);
|
||||
}
|
||||
|
||||
static void rom_reset(void *unused)
|
||||
@@ -638,6 +636,9 @@ static void rom_reset(void *unused)
|
||||
Rom *rom;
|
||||
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
if (rom->fw_file) {
|
||||
continue;
|
||||
}
|
||||
if (rom->data == NULL)
|
||||
continue;
|
||||
cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize);
|
||||
@@ -656,32 +657,17 @@ int rom_load_all(void)
|
||||
Rom *rom;
|
||||
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
if (addr < rom->min)
|
||||
addr = rom->min;
|
||||
if (rom->max) {
|
||||
/* load address range */
|
||||
if (rom->align) {
|
||||
addr += (rom->align-1);
|
||||
addr &= ~(rom->align-1);
|
||||
}
|
||||
if (addr + rom->romsize > rom->max) {
|
||||
fprintf(stderr, "rom: out of memory (rom %s, "
|
||||
"addr 0x" TARGET_FMT_plx
|
||||
", size 0x%zx, max 0x" TARGET_FMT_plx ")\n",
|
||||
rom->name, addr, rom->romsize, rom->max);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
/* fixed address requested */
|
||||
if (addr != rom->min) {
|
||||
fprintf(stderr, "rom: requested regions overlap "
|
||||
"(rom %s. free=0x" TARGET_FMT_plx
|
||||
", addr=0x" TARGET_FMT_plx ")\n",
|
||||
rom->name, addr, rom->min);
|
||||
return -1;
|
||||
}
|
||||
if (rom->fw_file) {
|
||||
continue;
|
||||
}
|
||||
rom->addr = addr;
|
||||
if (addr > rom->addr) {
|
||||
fprintf(stderr, "rom: requested regions overlap "
|
||||
"(rom %s. free=0x" TARGET_FMT_plx
|
||||
", addr=0x" TARGET_FMT_plx ")\n",
|
||||
rom->name, addr, rom->addr);
|
||||
return -1;
|
||||
}
|
||||
addr = rom->addr;
|
||||
addr += rom->romsize;
|
||||
memtype = cpu_get_physical_page_desc(rom->addr) & (3 << IO_MEM_SHIFT);
|
||||
if (memtype == IO_MEM_ROM)
|
||||
@@ -692,22 +678,40 @@ int rom_load_all(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rom_load_fw(void *fw_cfg)
|
||||
{
|
||||
Rom *rom;
|
||||
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
if (!rom->fw_file)
|
||||
continue;
|
||||
fw_cfg_add_file(fw_cfg, rom->fw_dir, rom->fw_file, rom->data, rom->romsize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Rom *find_rom(target_phys_addr_t addr)
|
||||
{
|
||||
Rom *rom;
|
||||
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
if (rom->max)
|
||||
if (rom->fw_file) {
|
||||
continue;
|
||||
if (rom->min > addr)
|
||||
}
|
||||
if (rom->addr > addr)
|
||||
continue;
|
||||
if (rom->min + rom->romsize < addr)
|
||||
if (rom->addr + rom->romsize < addr)
|
||||
continue;
|
||||
return rom;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copies memory from registered ROMs to dest. Any memory that is contained in
|
||||
* a ROM between addr and addr + size is copied. Note that this can involve
|
||||
* multiple ROMs, which need not start at addr and need not end at addr + size.
|
||||
*/
|
||||
int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)
|
||||
{
|
||||
target_phys_addr_t end = addr + size;
|
||||
@@ -716,25 +720,24 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)
|
||||
Rom *rom;
|
||||
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
if (rom->max)
|
||||
if (rom->fw_file) {
|
||||
continue;
|
||||
if (rom->min > addr)
|
||||
}
|
||||
if (rom->addr + rom->romsize < addr)
|
||||
continue;
|
||||
if (rom->min + rom->romsize < addr)
|
||||
continue;
|
||||
if (rom->min > end)
|
||||
if (rom->addr > end)
|
||||
break;
|
||||
if (!rom->data)
|
||||
continue;
|
||||
|
||||
d = dest + (rom->min - addr);
|
||||
d = dest + (rom->addr - addr);
|
||||
s = rom->data;
|
||||
l = rom->romsize;
|
||||
|
||||
if (rom->min < addr) {
|
||||
if (rom->addr < addr) {
|
||||
d = dest;
|
||||
s += (addr - rom->min);
|
||||
l -= (addr - rom->min);
|
||||
s += (addr - rom->addr);
|
||||
l -= (addr - rom->addr);
|
||||
}
|
||||
if ((d + l) > (dest + size)) {
|
||||
l = dest - d;
|
||||
@@ -753,7 +756,7 @@ void *rom_ptr(target_phys_addr_t addr)
|
||||
rom = find_rom(addr);
|
||||
if (!rom || !rom->data)
|
||||
return NULL;
|
||||
return rom->data + (addr - rom->min);
|
||||
return rom->data + (addr - rom->addr);
|
||||
}
|
||||
|
||||
void do_info_roms(Monitor *mon)
|
||||
@@ -761,10 +764,20 @@ void do_info_roms(Monitor *mon)
|
||||
Rom *rom;
|
||||
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
monitor_printf(mon, "addr=" TARGET_FMT_plx
|
||||
" size=0x%06zx mem=%s name=\"%s\" \n",
|
||||
rom->addr, rom->romsize,
|
||||
rom->isrom ? "rom" : "ram",
|
||||
rom->name);
|
||||
if (!rom->fw_file) {
|
||||
monitor_printf(mon, "addr=" TARGET_FMT_plx
|
||||
" size=0x%06zx mem=%s name=\"%s\" \n",
|
||||
rom->addr, rom->romsize,
|
||||
rom->isrom ? "rom" : "ram",
|
||||
rom->name);
|
||||
} else {
|
||||
monitor_printf(mon, "fw=%s%s%s"
|
||||
" size=0x%06zx name=\"%s\" \n",
|
||||
rom->fw_dir ? rom->fw_dir : "",
|
||||
rom->fw_dir ? "/" : "",
|
||||
rom->fw_file,
|
||||
rom->romsize,
|
||||
rom->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -19,19 +19,20 @@ void pstrcpy_targphys(const char *name,
|
||||
target_phys_addr_t dest, int buf_size,
|
||||
const char *source);
|
||||
|
||||
int rom_add_file(const char *file,
|
||||
target_phys_addr_t min, target_phys_addr_t max, int align);
|
||||
int rom_add_file(const char *file, const char *fw_dir, const char *fw_file,
|
||||
target_phys_addr_t addr);
|
||||
int rom_add_blob(const char *name, const void *blob, size_t len,
|
||||
target_phys_addr_t min, target_phys_addr_t max, int align);
|
||||
target_phys_addr_t addr);
|
||||
int rom_load_all(void);
|
||||
int rom_load_fw(void *fw_cfg);
|
||||
int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size);
|
||||
void *rom_ptr(target_phys_addr_t addr);
|
||||
void do_info_roms(Monitor *mon);
|
||||
|
||||
#define rom_add_file_fixed(_f, _a) \
|
||||
rom_add_file(_f, _a, 0, 0)
|
||||
rom_add_file(_f, NULL, NULL, _a)
|
||||
#define rom_add_blob_fixed(_f, _b, _l, _a) \
|
||||
rom_add_blob(_f, _b, _l, _a, 0, 0)
|
||||
rom_add_blob(_f, _b, _l, _a)
|
||||
|
||||
#define PC_ROM_MIN_VGA 0xc0000
|
||||
#define PC_ROM_MIN_OPTION 0xc8000
|
||||
|
||||
+7
-5
@@ -607,7 +607,7 @@ static void lsi_reselect(LSIState *s, uint32_t tag)
|
||||
id = (tag >> 8) & 0xf;
|
||||
s->ssid = id | 0x80;
|
||||
/* LSI53C700 Family Compatibility, see LSI53C895A 4-73 */
|
||||
if (!s->dcntl & LSI_DCNTL_COM) {
|
||||
if (!(s->dcntl & LSI_DCNTL_COM)) {
|
||||
s->sfbr = 1 << (id & 0x7);
|
||||
}
|
||||
DPRINTF("Reselected target %d\n", id);
|
||||
@@ -2120,18 +2120,20 @@ static int lsi_scsi_init(PCIDevice *dev)
|
||||
/* PCI base class code */
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI);
|
||||
/* PCI subsystem ID */
|
||||
pci_conf[0x2e] = 0x00;
|
||||
pci_conf[0x2f] = 0x10;
|
||||
pci_conf[PCI_SUBSYSTEM_ID] = 0x00;
|
||||
pci_conf[PCI_SUBSYSTEM_ID + 1] = 0x10;
|
||||
/* PCI latency timer = 255 */
|
||||
pci_conf[0x0d] = 0xff;
|
||||
pci_conf[PCI_LATENCY_TIMER] = 0xff;
|
||||
/* TODO: RST# value should be 0 */
|
||||
/* Interrupt pin 1 */
|
||||
pci_conf[0x3d] = 0x01;
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 0x01;
|
||||
|
||||
s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn,
|
||||
lsi_mmio_writefn, s);
|
||||
s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn,
|
||||
lsi_ram_writefn, s);
|
||||
|
||||
/* TODO: use dev and get rid of cast below */
|
||||
pci_register_bar((struct PCIDevice *)s, 0, 256,
|
||||
PCI_BASE_ADDRESS_SPACE_IO, lsi_io_mapfunc);
|
||||
pci_register_bar((struct PCIDevice *)s, 1, 0x400,
|
||||
|
||||
+46
-39
@@ -184,19 +184,19 @@ static void dump_dbdma_cmd(dbdma_cmd *cmd)
|
||||
static void dbdma_cmdptr_load(DBDMA_channel *ch)
|
||||
{
|
||||
DBDMA_DPRINTF("dbdma_cmdptr_load 0x%08x\n",
|
||||
be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]));
|
||||
cpu_physical_memory_read(be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]),
|
||||
ch->regs[DBDMA_CMDPTR_LO]);
|
||||
cpu_physical_memory_read(ch->regs[DBDMA_CMDPTR_LO],
|
||||
(uint8_t*)&ch->current, sizeof(dbdma_cmd));
|
||||
}
|
||||
|
||||
static void dbdma_cmdptr_save(DBDMA_channel *ch)
|
||||
{
|
||||
DBDMA_DPRINTF("dbdma_cmdptr_save 0x%08x\n",
|
||||
be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]));
|
||||
ch->regs[DBDMA_CMDPTR_LO]);
|
||||
DBDMA_DPRINTF("xfer_status 0x%08x res_count 0x%04x\n",
|
||||
le16_to_cpu(ch->current.xfer_status),
|
||||
le16_to_cpu(ch->current.res_count));
|
||||
cpu_physical_memory_write(be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]),
|
||||
cpu_physical_memory_write(ch->regs[DBDMA_CMDPTR_LO],
|
||||
(uint8_t*)&ch->current, sizeof(dbdma_cmd));
|
||||
}
|
||||
|
||||
@@ -204,8 +204,8 @@ static void kill_channel(DBDMA_channel *ch)
|
||||
{
|
||||
DBDMA_DPRINTF("kill_channel\n");
|
||||
|
||||
ch->regs[DBDMA_STATUS] |= cpu_to_be32(DEAD);
|
||||
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~ACTIVE);
|
||||
ch->regs[DBDMA_STATUS] |= DEAD;
|
||||
ch->regs[DBDMA_STATUS] &= ~ACTIVE;
|
||||
|
||||
qemu_irq_raise(ch->irq);
|
||||
}
|
||||
@@ -230,10 +230,10 @@ static void conditional_interrupt(DBDMA_channel *ch)
|
||||
return;
|
||||
}
|
||||
|
||||
status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;
|
||||
status = ch->regs[DBDMA_STATUS] & DEVSTAT;
|
||||
|
||||
sel_mask = (be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f;
|
||||
sel_value = be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) & 0x0f;
|
||||
sel_mask = (ch->regs[DBDMA_INTR_SEL] >> 16) & 0x0f;
|
||||
sel_value = ch->regs[DBDMA_INTR_SEL] & 0x0f;
|
||||
|
||||
cond = (status & sel_mask) == (sel_value & sel_mask);
|
||||
|
||||
@@ -268,10 +268,10 @@ static int conditional_wait(DBDMA_channel *ch)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;
|
||||
status = ch->regs[DBDMA_STATUS] & DEVSTAT;
|
||||
|
||||
sel_mask = (be32_to_cpu(ch->regs[DBDMA_WAIT_SEL]) >> 16) & 0x0f;
|
||||
sel_value = be32_to_cpu(ch->regs[DBDMA_WAIT_SEL]) & 0x0f;
|
||||
sel_mask = (ch->regs[DBDMA_WAIT_SEL] >> 16) & 0x0f;
|
||||
sel_value = ch->regs[DBDMA_WAIT_SEL] & 0x0f;
|
||||
|
||||
cond = (status & sel_mask) == (sel_value & sel_mask);
|
||||
|
||||
@@ -292,10 +292,10 @@ static void next(DBDMA_channel *ch)
|
||||
{
|
||||
uint32_t cp;
|
||||
|
||||
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~BT);
|
||||
ch->regs[DBDMA_STATUS] &= ~BT;
|
||||
|
||||
cp = be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]);
|
||||
ch->regs[DBDMA_CMDPTR_LO] = cpu_to_be32(cp + sizeof(dbdma_cmd));
|
||||
cp = ch->regs[DBDMA_CMDPTR_LO];
|
||||
ch->regs[DBDMA_CMDPTR_LO] = cp + sizeof(dbdma_cmd);
|
||||
dbdma_cmdptr_load(ch);
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ static void branch(DBDMA_channel *ch)
|
||||
dbdma_cmd *current = &ch->current;
|
||||
|
||||
ch->regs[DBDMA_CMDPTR_LO] = current->cmd_dep;
|
||||
ch->regs[DBDMA_STATUS] |= cpu_to_be32(BT);
|
||||
ch->regs[DBDMA_STATUS] |= BT;
|
||||
dbdma_cmdptr_load(ch);
|
||||
}
|
||||
|
||||
@@ -331,10 +331,10 @@ static void conditional_branch(DBDMA_channel *ch)
|
||||
return;
|
||||
}
|
||||
|
||||
status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;
|
||||
status = ch->regs[DBDMA_STATUS] & DEVSTAT;
|
||||
|
||||
sel_mask = (be32_to_cpu(ch->regs[DBDMA_BRANCH_SEL]) >> 16) & 0x0f;
|
||||
sel_value = be32_to_cpu(ch->regs[DBDMA_BRANCH_SEL]) & 0x0f;
|
||||
sel_mask = (ch->regs[DBDMA_BRANCH_SEL] >> 16) & 0x0f;
|
||||
sel_value = ch->regs[DBDMA_BRANCH_SEL] & 0x0f;
|
||||
|
||||
cond = (status & sel_mask) == (sel_value & sel_mask);
|
||||
|
||||
@@ -365,19 +365,19 @@ static void dbdma_end(DBDMA_io *io)
|
||||
if (conditional_wait(ch))
|
||||
goto wait;
|
||||
|
||||
current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));
|
||||
current->res_count = cpu_to_le16(be32_to_cpu(io->len));
|
||||
current->xfer_status = cpu_to_le16(ch->regs[DBDMA_STATUS]);
|
||||
current->res_count = cpu_to_le16(io->len);
|
||||
dbdma_cmdptr_save(ch);
|
||||
if (io->is_last)
|
||||
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH);
|
||||
ch->regs[DBDMA_STATUS] &= ~FLUSH;
|
||||
|
||||
conditional_interrupt(ch);
|
||||
conditional_branch(ch);
|
||||
|
||||
wait:
|
||||
ch->processing = 0;
|
||||
if ((ch->regs[DBDMA_STATUS] & cpu_to_be32(RUN)) &&
|
||||
(ch->regs[DBDMA_STATUS] & cpu_to_be32(ACTIVE)))
|
||||
if ((ch->regs[DBDMA_STATUS] & RUN) &&
|
||||
(ch->regs[DBDMA_STATUS] & ACTIVE))
|
||||
channel_run(ch);
|
||||
}
|
||||
|
||||
@@ -456,9 +456,9 @@ static void load_word(DBDMA_channel *ch, int key, uint32_t addr,
|
||||
if (conditional_wait(ch))
|
||||
goto wait;
|
||||
|
||||
current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));
|
||||
current->xfer_status = cpu_to_le16(ch->regs[DBDMA_STATUS]);
|
||||
dbdma_cmdptr_save(ch);
|
||||
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH);
|
||||
ch->regs[DBDMA_STATUS] &= ~FLUSH;
|
||||
|
||||
conditional_interrupt(ch);
|
||||
next(ch);
|
||||
@@ -494,9 +494,9 @@ static void store_word(DBDMA_channel *ch, int key, uint32_t addr,
|
||||
if (conditional_wait(ch))
|
||||
goto wait;
|
||||
|
||||
current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));
|
||||
current->xfer_status = cpu_to_le16(ch->regs[DBDMA_STATUS]);
|
||||
dbdma_cmdptr_save(ch);
|
||||
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH);
|
||||
ch->regs[DBDMA_STATUS] &= ~FLUSH;
|
||||
|
||||
conditional_interrupt(ch);
|
||||
next(ch);
|
||||
@@ -512,7 +512,7 @@ static void nop(DBDMA_channel *ch)
|
||||
if (conditional_wait(ch))
|
||||
goto wait;
|
||||
|
||||
current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));
|
||||
current->xfer_status = cpu_to_le16(ch->regs[DBDMA_STATUS]);
|
||||
dbdma_cmdptr_save(ch);
|
||||
|
||||
conditional_interrupt(ch);
|
||||
@@ -524,7 +524,7 @@ wait:
|
||||
|
||||
static void stop(DBDMA_channel *ch)
|
||||
{
|
||||
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~(ACTIVE|DEAD|FLUSH));
|
||||
ch->regs[DBDMA_STATUS] &= ~(ACTIVE|DEAD|FLUSH);
|
||||
|
||||
/* the stop command does not increment command pointer */
|
||||
}
|
||||
@@ -541,7 +541,7 @@ static void channel_run(DBDMA_channel *ch)
|
||||
|
||||
/* clear WAKE flag at command fetch */
|
||||
|
||||
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~WAKE);
|
||||
ch->regs[DBDMA_STATUS] &= ~WAKE;
|
||||
|
||||
cmd = le16_to_cpu(current->command) & COMMAND_MASK;
|
||||
|
||||
@@ -618,7 +618,7 @@ static void DBDMA_run (DBDMA_channel *ch)
|
||||
int channel;
|
||||
|
||||
for (channel = 0; channel < DBDMA_CHANNELS; channel++, ch++) {
|
||||
uint32_t status = be32_to_cpu(ch->regs[DBDMA_STATUS]);
|
||||
uint32_t status = ch->regs[DBDMA_STATUS];
|
||||
if (!ch->processing && (status & RUN) && (status & ACTIVE))
|
||||
channel_run(ch);
|
||||
}
|
||||
@@ -660,12 +660,12 @@ dbdma_control_write(DBDMA_channel *ch)
|
||||
uint16_t mask, value;
|
||||
uint32_t status;
|
||||
|
||||
mask = (be32_to_cpu(ch->regs[DBDMA_CONTROL]) >> 16) & 0xffff;
|
||||
value = be32_to_cpu(ch->regs[DBDMA_CONTROL]) & 0xffff;
|
||||
mask = (ch->regs[DBDMA_CONTROL] >> 16) & 0xffff;
|
||||
value = ch->regs[DBDMA_CONTROL] & 0xffff;
|
||||
|
||||
value &= (RUN | PAUSE | FLUSH | WAKE | DEVSTAT);
|
||||
|
||||
status = be32_to_cpu(ch->regs[DBDMA_STATUS]);
|
||||
status = ch->regs[DBDMA_STATUS];
|
||||
|
||||
status = (value & mask) | (status & ~mask);
|
||||
|
||||
@@ -677,14 +677,14 @@ dbdma_control_write(DBDMA_channel *ch)
|
||||
}
|
||||
if (status & PAUSE)
|
||||
status &= ~ACTIVE;
|
||||
if ((be32_to_cpu(ch->regs[DBDMA_STATUS]) & RUN) && !(status & RUN)) {
|
||||
if ((ch->regs[DBDMA_STATUS] & RUN) && !(status & RUN)) {
|
||||
/* RUN is cleared */
|
||||
status &= ~(ACTIVE|DEAD);
|
||||
}
|
||||
|
||||
DBDMA_DPRINTF(" status 0x%08x\n", status);
|
||||
|
||||
ch->regs[DBDMA_STATUS] = cpu_to_be32(status);
|
||||
ch->regs[DBDMA_STATUS] = status;
|
||||
|
||||
if (status & ACTIVE)
|
||||
qemu_bh_schedule(dbdma_bh);
|
||||
@@ -703,10 +703,14 @@ static void dbdma_writel (void *opaque,
|
||||
DBDMA_DPRINTF("channel 0x%x reg 0x%x\n",
|
||||
(uint32_t)addr >> DBDMA_CHANNEL_SHIFT, reg);
|
||||
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
value = bswap32(value);
|
||||
#endif
|
||||
|
||||
/* cmdptr cannot be modified if channel is RUN or ACTIVE */
|
||||
|
||||
if (reg == DBDMA_CMDPTR_LO &&
|
||||
(ch->regs[DBDMA_STATUS] & cpu_to_be32(RUN | ACTIVE)))
|
||||
(ch->regs[DBDMA_STATUS] & (RUN | ACTIVE)))
|
||||
return;
|
||||
|
||||
ch->regs[reg] = value;
|
||||
@@ -717,7 +721,7 @@ static void dbdma_writel (void *opaque,
|
||||
break;
|
||||
case DBDMA_CMDPTR_LO:
|
||||
/* 16-byte aligned */
|
||||
ch->regs[DBDMA_CMDPTR_LO] &= cpu_to_be32(~0xf);
|
||||
ch->regs[DBDMA_CMDPTR_LO] &= ~0xf;
|
||||
dbdma_cmdptr_load(ch);
|
||||
break;
|
||||
case DBDMA_STATUS:
|
||||
@@ -782,6 +786,9 @@ static uint32_t dbdma_readl (void *opaque, target_phys_addr_t addr)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
value = bswap32(value);
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
//#define DEBUG_CMOS
|
||||
|
||||
#define RTC_REINJECT_ON_ACK_COUNT 1000
|
||||
|
||||
#define RTC_SECONDS 0
|
||||
#define RTC_SECONDS_ALARM 1
|
||||
#define RTC_MINUTES 2
|
||||
@@ -76,6 +78,7 @@ struct RTCState {
|
||||
int64_t next_periodic_time;
|
||||
/* second update */
|
||||
int64_t next_second_time;
|
||||
uint16_t irq_reinject_on_ack_count;
|
||||
uint32_t irq_coalesced;
|
||||
uint32_t period;
|
||||
QEMUTimer *coalesced_timer;
|
||||
@@ -180,6 +183,8 @@ static void rtc_periodic_timer(void *opaque)
|
||||
s->cmos_data[RTC_REG_C] |= 0xc0;
|
||||
#ifdef TARGET_I386
|
||||
if(rtc_td_hack) {
|
||||
if (s->irq_reinject_on_ack_count >= RTC_REINJECT_ON_ACK_COUNT)
|
||||
s->irq_reinject_on_ack_count = 0;
|
||||
apic_reset_irq_delivered();
|
||||
rtc_irq_raise(s->irq);
|
||||
if (!apic_get_irq_delivered()) {
|
||||
@@ -458,6 +463,18 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
|
||||
case RTC_REG_C:
|
||||
ret = s->cmos_data[s->cmos_index];
|
||||
qemu_irq_lower(s->irq);
|
||||
#ifdef TARGET_I386
|
||||
if(s->irq_coalesced &&
|
||||
s->irq_reinject_on_ack_count < RTC_REINJECT_ON_ACK_COUNT) {
|
||||
s->irq_reinject_on_ack_count++;
|
||||
apic_reset_irq_delivered();
|
||||
qemu_irq_raise(s->irq);
|
||||
if (apic_get_irq_delivered())
|
||||
s->irq_coalesced--;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
s->cmos_data[RTC_REG_C] = 0x00;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#define PCI_MSIX_FLAGS 2 /* Table at lower 11 bits */
|
||||
#define PCI_MSIX_FLAGS_QSIZE 0x7FF
|
||||
#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
|
||||
#define PCI_MSIX_FLAGS_MASKALL (1 << 14)
|
||||
#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
|
||||
|
||||
/* MSI-X capability structure */
|
||||
@@ -27,9 +28,10 @@
|
||||
#define MSIX_PBA_OFFSET 8
|
||||
#define MSIX_CAP_LENGTH 12
|
||||
|
||||
/* MSI enable bit is in byte 1 in FLAGS register */
|
||||
#define MSIX_ENABLE_OFFSET (PCI_MSIX_FLAGS + 1)
|
||||
/* MSI enable bit and maskall bit are in byte 1 in FLAGS register */
|
||||
#define MSIX_CONTROL_OFFSET (PCI_MSIX_FLAGS + 1)
|
||||
#define MSIX_ENABLE_MASK (PCI_MSIX_FLAGS_ENABLE >> 8)
|
||||
#define MSIX_MASKALL_MASK (PCI_MSIX_FLAGS_MASKALL >> 8)
|
||||
|
||||
/* MSI-X table format */
|
||||
#define MSIX_MSG_ADDR 0
|
||||
@@ -101,22 +103,11 @@ static int msix_add_config(struct PCIDevice *pdev, unsigned short nentries,
|
||||
bar_nr);
|
||||
pdev->msix_cap = config_offset;
|
||||
/* Make flags bit writeable. */
|
||||
pdev->wmask[config_offset + MSIX_ENABLE_OFFSET] |= MSIX_ENABLE_MASK;
|
||||
pdev->wmask[config_offset + MSIX_CONTROL_OFFSET] |= MSIX_ENABLE_MASK |
|
||||
MSIX_MASKALL_MASK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Handle MSI-X capability config write. */
|
||||
void msix_write_config(PCIDevice *dev, uint32_t addr,
|
||||
uint32_t val, int len)
|
||||
{
|
||||
unsigned enable_pos = dev->msix_cap + MSIX_ENABLE_OFFSET;
|
||||
if (addr + len <= enable_pos || addr > enable_pos)
|
||||
return;
|
||||
|
||||
if (msix_enabled(dev))
|
||||
qemu_set_irq(dev->irq[0], 0);
|
||||
}
|
||||
|
||||
static uint32_t msix_mmio_readl(void *opaque, target_phys_addr_t addr)
|
||||
{
|
||||
PCIDevice *dev = opaque;
|
||||
@@ -157,10 +148,50 @@ static void msix_clr_pending(PCIDevice *dev, int vector)
|
||||
*msix_pending_byte(dev, vector) &= ~msix_pending_mask(vector);
|
||||
}
|
||||
|
||||
static int msix_function_masked(PCIDevice *dev)
|
||||
{
|
||||
return dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] & MSIX_MASKALL_MASK;
|
||||
}
|
||||
|
||||
static int msix_is_masked(PCIDevice *dev, int vector)
|
||||
{
|
||||
unsigned offset = vector * MSIX_ENTRY_SIZE + MSIX_VECTOR_CTRL;
|
||||
return dev->msix_table_page[offset] & MSIX_VECTOR_MASK;
|
||||
return msix_function_masked(dev) ||
|
||||
dev->msix_table_page[offset] & MSIX_VECTOR_MASK;
|
||||
}
|
||||
|
||||
static void msix_handle_mask_update(PCIDevice *dev, int vector)
|
||||
{
|
||||
if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) {
|
||||
msix_clr_pending(dev, vector);
|
||||
msix_notify(dev, vector);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle MSI-X capability config write. */
|
||||
void msix_write_config(PCIDevice *dev, uint32_t addr,
|
||||
uint32_t val, int len)
|
||||
{
|
||||
unsigned enable_pos = dev->msix_cap + MSIX_CONTROL_OFFSET;
|
||||
int vector;
|
||||
|
||||
if (!range_covers_byte(addr, len, enable_pos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!msix_enabled(dev)) {
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_set_irq(dev->irq[0], 0);
|
||||
|
||||
if (msix_function_masked(dev)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
|
||||
msix_handle_mask_update(dev, vector);
|
||||
}
|
||||
}
|
||||
|
||||
static void msix_mmio_writel(void *opaque, target_phys_addr_t addr,
|
||||
@@ -170,10 +201,7 @@ static void msix_mmio_writel(void *opaque, target_phys_addr_t addr,
|
||||
unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3;
|
||||
int vector = offset / MSIX_ENTRY_SIZE;
|
||||
pci_set_long(dev->msix_table_page + offset, val);
|
||||
if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) {
|
||||
msix_clr_pending(dev, vector);
|
||||
msix_notify(dev, vector);
|
||||
}
|
||||
msix_handle_mask_update(dev, vector);
|
||||
}
|
||||
|
||||
static void msix_mmio_write_unallowed(void *opaque, target_phys_addr_t addr,
|
||||
@@ -327,7 +355,7 @@ int msix_present(PCIDevice *dev)
|
||||
int msix_enabled(PCIDevice *dev)
|
||||
{
|
||||
return (dev->cap_present & QEMU_PCI_CAP_MSIX) &&
|
||||
(dev->config[dev->msix_cap + MSIX_ENABLE_OFFSET] &
|
||||
(dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &
|
||||
MSIX_ENABLE_MASK);
|
||||
}
|
||||
|
||||
@@ -363,8 +391,8 @@ void msix_reset(PCIDevice *dev)
|
||||
if (!(dev->cap_present & QEMU_PCI_CAP_MSIX))
|
||||
return;
|
||||
msix_free_irq_entries(dev);
|
||||
dev->config[dev->msix_cap + MSIX_ENABLE_OFFSET] &=
|
||||
~dev->wmask[dev->msix_cap + MSIX_ENABLE_OFFSET];
|
||||
dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
|
||||
~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
|
||||
memset(dev->msix_table_page, 0, MSIX_PAGE_SIZE);
|
||||
msix_mask_all(dev, dev->msix_entries_nr);
|
||||
}
|
||||
|
||||
+331
@@ -0,0 +1,331 @@
|
||||
/*
|
||||
* QEMU PC System Emulator
|
||||
*
|
||||
* Copyright (c) 2003-2004 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hw.h"
|
||||
#include "fw_cfg.h"
|
||||
#include "multiboot.h"
|
||||
#include "loader.h"
|
||||
#include "elf.h"
|
||||
#include "sysemu.h"
|
||||
|
||||
/* Show multiboot debug output */
|
||||
//#define DEBUG_MULTIBOOT
|
||||
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
#define mb_debug(a...) fprintf(stderr, ## a)
|
||||
#else
|
||||
#define mb_debug(a...)
|
||||
#endif
|
||||
|
||||
#define MULTIBOOT_STRUCT_ADDR 0x9000
|
||||
|
||||
#if MULTIBOOT_STRUCT_ADDR > 0xf0000
|
||||
#error multiboot struct needs to fit in 16 bit real mode
|
||||
#endif
|
||||
|
||||
enum {
|
||||
/* Multiboot info */
|
||||
MBI_FLAGS = 0,
|
||||
MBI_MEM_LOWER = 4,
|
||||
MBI_MEM_UPPER = 8,
|
||||
MBI_BOOT_DEVICE = 12,
|
||||
MBI_CMDLINE = 16,
|
||||
MBI_MODS_COUNT = 20,
|
||||
MBI_MODS_ADDR = 24,
|
||||
MBI_MMAP_ADDR = 48,
|
||||
|
||||
MBI_SIZE = 88,
|
||||
|
||||
/* Multiboot modules */
|
||||
MB_MOD_START = 0,
|
||||
MB_MOD_END = 4,
|
||||
MB_MOD_CMDLINE = 8,
|
||||
|
||||
MB_MOD_SIZE = 16,
|
||||
|
||||
/* Region offsets */
|
||||
ADDR_E820_MAP = MULTIBOOT_STRUCT_ADDR + 0,
|
||||
ADDR_MBI = ADDR_E820_MAP + 0x500,
|
||||
|
||||
/* Multiboot flags */
|
||||
MULTIBOOT_FLAGS_MEMORY = 1 << 0,
|
||||
MULTIBOOT_FLAGS_BOOT_DEVICE = 1 << 1,
|
||||
MULTIBOOT_FLAGS_CMDLINE = 1 << 2,
|
||||
MULTIBOOT_FLAGS_MODULES = 1 << 3,
|
||||
MULTIBOOT_FLAGS_MMAP = 1 << 6,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/* buffer holding kernel, cmdlines and mb_infos */
|
||||
void *mb_buf;
|
||||
/* address in target */
|
||||
target_phys_addr_t mb_buf_phys;
|
||||
/* size of mb_buf in bytes */
|
||||
unsigned mb_buf_size;
|
||||
/* offset of mb-info's in bytes */
|
||||
target_phys_addr_t offset_mbinfo;
|
||||
/* offset in buffer for cmdlines in bytes */
|
||||
target_phys_addr_t offset_cmdlines;
|
||||
/* offset of modules in bytes */
|
||||
target_phys_addr_t offset_mods;
|
||||
/* available slots for mb modules infos */
|
||||
int mb_mods_avail;
|
||||
/* currently used slots of mb modules */
|
||||
int mb_mods_count;
|
||||
} MultibootState;
|
||||
|
||||
static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
|
||||
{
|
||||
int len = strlen(cmdline) + 1;
|
||||
target_phys_addr_t p = s->offset_cmdlines;
|
||||
|
||||
pstrcpy((char *)s->mb_buf + p, len, cmdline);
|
||||
s->offset_cmdlines += len;
|
||||
return s->mb_buf_phys + p;
|
||||
}
|
||||
|
||||
static void mb_add_mod(MultibootState *s,
|
||||
target_phys_addr_t start, target_phys_addr_t end,
|
||||
target_phys_addr_t cmdline_phys)
|
||||
{
|
||||
char *p;
|
||||
assert(s->mb_mods_count < s->mb_mods_avail);
|
||||
|
||||
p = (char *)s->mb_buf + s->offset_mbinfo + MB_MOD_SIZE * s->mb_mods_count;
|
||||
|
||||
stl_p(p + MB_MOD_START, start);
|
||||
stl_p(p + MB_MOD_END, end);
|
||||
stl_p(p + MB_MOD_CMDLINE, cmdline_phys);
|
||||
|
||||
mb_debug("mod%02d: %08x - %08x\n", s->mb_mods_count, start, end);
|
||||
|
||||
s->mb_mods_count++;
|
||||
}
|
||||
|
||||
int load_multiboot(void *fw_cfg,
|
||||
FILE *f,
|
||||
const char *kernel_filename,
|
||||
const char *initrd_filename,
|
||||
const char *kernel_cmdline,
|
||||
int kernel_file_size,
|
||||
uint8_t *header)
|
||||
{
|
||||
int i, is_multiboot = 0;
|
||||
uint32_t flags = 0;
|
||||
uint32_t mh_entry_addr;
|
||||
uint32_t mh_load_addr;
|
||||
uint32_t mb_kernel_size;
|
||||
MultibootState mbs;
|
||||
uint8_t bootinfo[MBI_SIZE];
|
||||
uint8_t *mb_bootinfo_data;
|
||||
|
||||
/* Ok, let's see if it is a multiboot image.
|
||||
The header is 12x32bit long, so the latest entry may be 8192 - 48. */
|
||||
for (i = 0; i < (8192 - 48); i += 4) {
|
||||
if (ldl_p(header+i) == 0x1BADB002) {
|
||||
uint32_t checksum = ldl_p(header+i+8);
|
||||
flags = ldl_p(header+i+4);
|
||||
checksum += flags;
|
||||
checksum += (uint32_t)0x1BADB002;
|
||||
if (!checksum) {
|
||||
is_multiboot = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_multiboot)
|
||||
return 0; /* no multiboot */
|
||||
|
||||
mb_debug("qemu: I believe we found a multiboot image!\n");
|
||||
memset(bootinfo, 0, sizeof(bootinfo));
|
||||
memset(&mbs, 0, sizeof(mbs));
|
||||
|
||||
if (flags & 0x00000004) { /* MULTIBOOT_HEADER_HAS_VBE */
|
||||
fprintf(stderr, "qemu: multiboot knows VBE. we don't.\n");
|
||||
}
|
||||
if (!(flags & 0x00010000)) { /* MULTIBOOT_HEADER_HAS_ADDR */
|
||||
uint64_t elf_entry;
|
||||
uint64_t elf_low, elf_high;
|
||||
int kernel_size;
|
||||
fclose(f);
|
||||
kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_low, &elf_high,
|
||||
0, ELF_MACHINE, 0);
|
||||
if (kernel_size < 0) {
|
||||
fprintf(stderr, "Error while loading elf kernel\n");
|
||||
exit(1);
|
||||
}
|
||||
mh_load_addr = elf_low;
|
||||
mb_kernel_size = elf_high - elf_low;
|
||||
mh_entry_addr = elf_entry;
|
||||
|
||||
mbs.mb_buf = qemu_malloc(mb_kernel_size);
|
||||
if (rom_copy(mbs.mb_buf, mh_load_addr, mb_kernel_size) != mb_kernel_size) {
|
||||
fprintf(stderr, "Error while fetching elf kernel from rom\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
mb_debug("qemu: loading multiboot-elf kernel (%#x bytes) with entry %#zx\n",
|
||||
mb_kernel_size, (size_t)mh_entry_addr);
|
||||
} else {
|
||||
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
|
||||
uint32_t mh_header_addr = ldl_p(header+i+12);
|
||||
mh_load_addr = ldl_p(header+i+16);
|
||||
uint32_t mb_kernel_text_offset = i - (mh_header_addr - mh_load_addr);
|
||||
|
||||
mh_entry_addr = ldl_p(header+i+28);
|
||||
mb_kernel_size = kernel_file_size - mb_kernel_text_offset;
|
||||
|
||||
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE.
|
||||
uint32_t mh_mode_type = ldl_p(header+i+32);
|
||||
uint32_t mh_width = ldl_p(header+i+36);
|
||||
uint32_t mh_height = ldl_p(header+i+40);
|
||||
uint32_t mh_depth = ldl_p(header+i+44); */
|
||||
|
||||
mb_debug("multiboot: mh_header_addr = %#x\n", mh_header_addr);
|
||||
mb_debug("multiboot: mh_load_addr = %#x\n", mh_load_addr);
|
||||
mb_debug("multiboot: mh_load_end_addr = %#x\n", ldl_p(header+i+20));
|
||||
mb_debug("multiboot: mh_bss_end_addr = %#x\n", ldl_p(header+i+24));
|
||||
mb_debug("qemu: loading multiboot kernel (%#x bytes) at %#x\n",
|
||||
mb_kernel_size, mh_load_addr);
|
||||
|
||||
mbs.mb_buf = qemu_malloc(mb_kernel_size);
|
||||
fseek(f, mb_kernel_text_offset, SEEK_SET);
|
||||
if (fread(mbs.mb_buf, 1, mb_kernel_size, f) != mb_kernel_size) {
|
||||
fprintf(stderr, "fread() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
mbs.mb_buf_phys = mh_load_addr;
|
||||
|
||||
mbs.mb_buf_size = TARGET_PAGE_ALIGN(mb_kernel_size);
|
||||
mbs.offset_mbinfo = mbs.mb_buf_size;
|
||||
|
||||
/* Calculate space for cmdlines and mb_mods */
|
||||
mbs.mb_buf_size += strlen(kernel_filename) + 1;
|
||||
mbs.mb_buf_size += strlen(kernel_cmdline) + 1;
|
||||
if (initrd_filename) {
|
||||
const char *r = initrd_filename;
|
||||
mbs.mb_buf_size += strlen(r) + 1;
|
||||
mbs.mb_mods_avail = 1;
|
||||
while ((r = strchr(r, ','))) {
|
||||
mbs.mb_mods_avail++;
|
||||
r++;
|
||||
}
|
||||
mbs.mb_buf_size += MB_MOD_SIZE * mbs.mb_mods_avail;
|
||||
}
|
||||
|
||||
mbs.mb_buf_size = TARGET_PAGE_ALIGN(mbs.mb_buf_size);
|
||||
|
||||
/* enlarge mb_buf to hold cmdlines and mb-info structs */
|
||||
mbs.mb_buf = qemu_realloc(mbs.mb_buf, mbs.mb_buf_size);
|
||||
mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
|
||||
|
||||
if (initrd_filename) {
|
||||
char *next_initrd;
|
||||
|
||||
mbs.offset_mods = mbs.mb_buf_size;
|
||||
|
||||
do {
|
||||
char *next_space;
|
||||
uint32_t mb_mod_length;
|
||||
uint32_t offs = mbs.mb_buf_size;
|
||||
|
||||
next_initrd = strchr(initrd_filename, ',');
|
||||
if (next_initrd)
|
||||
*next_initrd = '\0';
|
||||
/* if a space comes after the module filename, treat everything
|
||||
after that as parameters */
|
||||
target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
|
||||
if ((next_space = strchr(initrd_filename, ' ')))
|
||||
*next_space = '\0';
|
||||
mb_debug("multiboot loading module: %s\n", initrd_filename);
|
||||
mb_mod_length = get_image_size(initrd_filename);
|
||||
if (mb_mod_length < 0) {
|
||||
fprintf(stderr, "failed to get %s image size\n", initrd_filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
mbs.mb_buf_size = TARGET_PAGE_ALIGN(mb_mod_length + mbs.mb_buf_size);
|
||||
mbs.mb_buf = qemu_realloc(mbs.mb_buf, mbs.mb_buf_size);
|
||||
|
||||
load_image(initrd_filename, (unsigned char *)mbs.mb_buf + offs);
|
||||
mb_add_mod(&mbs, mbs.mb_buf_phys + offs,
|
||||
mbs.mb_buf_phys + offs + mb_mod_length, c);
|
||||
|
||||
mb_debug("mod_start: %p\nmod_end: %p\n cmdline: %#x\n",
|
||||
(char *)mbs.mb_buf + offs,
|
||||
(char *)mbs.mb_buf + offs + mb_mod_length, c);
|
||||
initrd_filename = next_initrd+1;
|
||||
} while (next_initrd);
|
||||
}
|
||||
|
||||
/* Commandline support */
|
||||
char kcmdline[strlen(kernel_filename) + strlen(kernel_cmdline) + 2];
|
||||
snprintf(kcmdline, sizeof(kcmdline), "%s %s",
|
||||
kernel_filename, kernel_cmdline);
|
||||
stl_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline));
|
||||
|
||||
stl_p(bootinfo + MBI_MODS_ADDR, mbs.mb_buf_phys + mbs.offset_mbinfo);
|
||||
stl_p(bootinfo + MBI_MODS_COUNT, mbs.mb_mods_count); /* mods_count */
|
||||
|
||||
/* the kernel is where we want it to be now */
|
||||
stl_p(bootinfo + MBI_FLAGS, MULTIBOOT_FLAGS_MEMORY
|
||||
| MULTIBOOT_FLAGS_BOOT_DEVICE
|
||||
| MULTIBOOT_FLAGS_CMDLINE
|
||||
| MULTIBOOT_FLAGS_MODULES
|
||||
| MULTIBOOT_FLAGS_MMAP);
|
||||
stl_p(bootinfo + MBI_MEM_LOWER, 640);
|
||||
stl_p(bootinfo + MBI_MEM_UPPER, ram_size / 1024);
|
||||
stl_p(bootinfo + MBI_BOOT_DEVICE, 0x8001ffff); /* XXX: use the -boot switch? */
|
||||
stl_p(bootinfo + MBI_MMAP_ADDR, ADDR_E820_MAP);
|
||||
|
||||
mb_debug("multiboot: mh_entry_addr = %#x\n", mh_entry_addr);
|
||||
mb_debug(" mb_buf_phys = %x\n", mbs.mb_buf_phys);
|
||||
mb_debug(" mod_start = %x\n", mbs.mb_buf_phys + mbs.offset_mods);
|
||||
mb_debug(" mb_mods_count = %d\n", mbs.mb_mods_count);
|
||||
|
||||
/* save bootinfo off the stack */
|
||||
mb_bootinfo_data = qemu_malloc(sizeof(bootinfo));
|
||||
memcpy(mb_bootinfo_data, bootinfo, sizeof(bootinfo));
|
||||
|
||||
/* Pass variables to option rom */
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ENTRY, mh_entry_addr);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, mh_load_addr);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, mbs.mb_buf_size);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_KERNEL_DATA,
|
||||
mbs.mb_buf, mbs.mb_buf_size);
|
||||
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, ADDR_MBI);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, sizeof(bootinfo));
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
|
||||
sizeof(bootinfo));
|
||||
|
||||
option_rom[nb_option_roms] = "multiboot.bin";
|
||||
nb_option_roms++;
|
||||
|
||||
return 1; /* yes, we are multiboot */
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef QEMU_MULTIBOOT_H
|
||||
#define QEMU_MULTIBOOT_H
|
||||
|
||||
int load_multiboot(void *fw_cfg,
|
||||
FILE *f,
|
||||
const char *kernel_filename,
|
||||
const char *initrd_filename,
|
||||
const char *kernel_cmdline,
|
||||
int kernel_file_size,
|
||||
uint8_t *header);
|
||||
|
||||
#endif
|
||||
+2
-1
@@ -724,7 +724,8 @@ static int pci_ne2000_init(PCIDevice *pci_dev)
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029);
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
|
||||
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
|
||||
pci_conf[0x3d] = 1; // interrupt pin 0
|
||||
/* TODO: RST# value should be 0. PCI spec 6.2.4 */
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0
|
||||
|
||||
pci_register_bar(&d->dev, 0, 0x100,
|
||||
PCI_BASE_ADDRESS_SPACE_IO, ne2000_map);
|
||||
|
||||
+133
-131
@@ -219,20 +219,20 @@ typedef struct openpic_t {
|
||||
int nb_cpus;
|
||||
/* Timer registers */
|
||||
struct {
|
||||
uint32_t ticc; /* Global timer current count register */
|
||||
uint32_t tibc; /* Global timer base count register */
|
||||
uint32_t ticc; /* Global timer current count register */
|
||||
uint32_t tibc; /* Global timer base count register */
|
||||
} timers[MAX_TMR];
|
||||
#if MAX_DBL > 0
|
||||
/* Doorbell registers */
|
||||
uint32_t dar; /* Doorbell activate register */
|
||||
struct {
|
||||
uint32_t dmr; /* Doorbell messaging register */
|
||||
uint32_t dmr; /* Doorbell messaging register */
|
||||
} doorbells[MAX_DBL];
|
||||
#endif
|
||||
#if MAX_MBX > 0
|
||||
/* Mailbox registers */
|
||||
struct {
|
||||
uint32_t mbr; /* Mailbox register */
|
||||
uint32_t mbr; /* Mailbox register */
|
||||
} mailboxes[MAX_MAILBOXES];
|
||||
#endif
|
||||
/* IRQ out is used when in bypass mode (not implemented) */
|
||||
@@ -276,14 +276,14 @@ static void IRQ_check (openpic_t *opp, IRQ_queue_t *q)
|
||||
next = -1;
|
||||
priority = -1;
|
||||
for (i = 0; i < opp->max_irq; i++) {
|
||||
if (IRQ_testbit(q, i)) {
|
||||
if (IRQ_testbit(q, i)) {
|
||||
DPRINTF("IRQ_check: irq %d set ipvp_pr=%d pr=%d\n",
|
||||
i, IPVP_PRIORITY(opp->src[i].ipvp), priority);
|
||||
if (IPVP_PRIORITY(opp->src[i].ipvp) > priority) {
|
||||
next = i;
|
||||
priority = IPVP_PRIORITY(opp->src[i].ipvp);
|
||||
}
|
||||
}
|
||||
if (IPVP_PRIORITY(opp->src[i].ipvp) > priority) {
|
||||
next = i;
|
||||
priority = IPVP_PRIORITY(opp->src[i].ipvp);
|
||||
}
|
||||
}
|
||||
}
|
||||
q->next = next;
|
||||
q->priority = priority;
|
||||
@@ -293,7 +293,7 @@ static int IRQ_get_next (openpic_t *opp, IRQ_queue_t *q)
|
||||
{
|
||||
if (q->next == -1) {
|
||||
/* XXX: optimize */
|
||||
IRQ_check(opp, q);
|
||||
IRQ_check(opp, q);
|
||||
}
|
||||
|
||||
return q->next;
|
||||
@@ -309,16 +309,16 @@ static void IRQ_local_pipe (openpic_t *opp, int n_CPU, int n_IRQ)
|
||||
src = &opp->src[n_IRQ];
|
||||
priority = IPVP_PRIORITY(src->ipvp);
|
||||
if (priority <= dst->pctp) {
|
||||
/* Too low priority */
|
||||
/* Too low priority */
|
||||
DPRINTF("%s: IRQ %d has too low priority on CPU %d\n",
|
||||
__func__, n_IRQ, n_CPU);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (IRQ_testbit(&dst->raised, n_IRQ)) {
|
||||
/* Interrupt miss */
|
||||
/* Interrupt miss */
|
||||
DPRINTF("%s: IRQ %d was missed on CPU %d\n",
|
||||
__func__, n_IRQ, n_CPU);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
set_bit(&src->ipvp, IPVP_ACTIVITY);
|
||||
IRQ_setbit(&dst->raised, n_IRQ);
|
||||
@@ -354,14 +354,14 @@ static void openpic_update_irq(openpic_t *opp, int n_IRQ)
|
||||
return;
|
||||
}
|
||||
if (test_bit(&src->ipvp, IPVP_MASK)) {
|
||||
/* Interrupt source is disabled */
|
||||
/* Interrupt source is disabled */
|
||||
DPRINTF("%s: IRQ %d is disabled\n", __func__, n_IRQ);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (IPVP_PRIORITY(src->ipvp) == 0) {
|
||||
/* Priority set to zero */
|
||||
/* Priority set to zero */
|
||||
DPRINTF("%s: IRQ %d has 0 priority\n", __func__, n_IRQ);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (test_bit(&src->ipvp, IPVP_ACTIVITY)) {
|
||||
/* IRQ already active */
|
||||
@@ -369,9 +369,9 @@ static void openpic_update_irq(openpic_t *opp, int n_IRQ)
|
||||
return;
|
||||
}
|
||||
if (src->ide == 0x00000000) {
|
||||
/* No target */
|
||||
/* No target */
|
||||
DPRINTF("%s: IRQ %d has no target\n", __func__, n_IRQ);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if (src->ide == (1 << src->last_cpu)) {
|
||||
@@ -434,32 +434,34 @@ static void openpic_reset (void *opaque)
|
||||
opp->micr = 0x00000000;
|
||||
/* Initialise IRQ sources */
|
||||
for (i = 0; i < opp->max_irq; i++) {
|
||||
opp->src[i].ipvp = 0xA0000000;
|
||||
opp->src[i].ide = 0x00000000;
|
||||
opp->src[i].ipvp = 0xA0000000;
|
||||
opp->src[i].ide = 0x00000000;
|
||||
}
|
||||
/* Initialise IRQ destinations */
|
||||
for (i = 0; i < MAX_CPU; i++) {
|
||||
opp->dst[i].pctp = 0x0000000F;
|
||||
opp->dst[i].pcsr = 0x00000000;
|
||||
memset(&opp->dst[i].raised, 0, sizeof(IRQ_queue_t));
|
||||
memset(&opp->dst[i].servicing, 0, sizeof(IRQ_queue_t));
|
||||
opp->dst[i].pctp = 0x0000000F;
|
||||
opp->dst[i].pcsr = 0x00000000;
|
||||
memset(&opp->dst[i].raised, 0, sizeof(IRQ_queue_t));
|
||||
opp->dst[i].raised.next = -1;
|
||||
memset(&opp->dst[i].servicing, 0, sizeof(IRQ_queue_t));
|
||||
opp->dst[i].servicing.next = -1;
|
||||
}
|
||||
/* Initialise timers */
|
||||
for (i = 0; i < MAX_TMR; i++) {
|
||||
opp->timers[i].ticc = 0x00000000;
|
||||
opp->timers[i].tibc = 0x80000000;
|
||||
opp->timers[i].ticc = 0x00000000;
|
||||
opp->timers[i].tibc = 0x80000000;
|
||||
}
|
||||
/* Initialise doorbells */
|
||||
#if MAX_DBL > 0
|
||||
opp->dar = 0x00000000;
|
||||
for (i = 0; i < MAX_DBL; i++) {
|
||||
opp->doorbells[i].dmr = 0x00000000;
|
||||
opp->doorbells[i].dmr = 0x00000000;
|
||||
}
|
||||
#endif
|
||||
/* Initialise mailboxes */
|
||||
#if MAX_MBX > 0
|
||||
for (i = 0; i < MAX_MBX; i++) { /* ? */
|
||||
opp->mailboxes[i].mbr = 0x00000000;
|
||||
opp->mailboxes[i].mbr = 0x00000000;
|
||||
}
|
||||
#endif
|
||||
/* Go out of RESET state */
|
||||
@@ -472,11 +474,11 @@ static inline uint32_t read_IRQreg (openpic_t *opp, int n_IRQ, uint32_t reg)
|
||||
|
||||
switch (reg) {
|
||||
case IRQ_IPVP:
|
||||
retval = opp->src[n_IRQ].ipvp;
|
||||
break;
|
||||
retval = opp->src[n_IRQ].ipvp;
|
||||
break;
|
||||
case IRQ_IDE:
|
||||
retval = opp->src[n_IRQ].ide;
|
||||
break;
|
||||
retval = opp->src[n_IRQ].ide;
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -492,95 +494,95 @@ static inline void write_IRQreg (openpic_t *opp, int n_IRQ,
|
||||
/* NOTE: not fully accurate for special IRQs, but simple and
|
||||
sufficient */
|
||||
/* ACTIVITY bit is read-only */
|
||||
opp->src[n_IRQ].ipvp =
|
||||
opp->src[n_IRQ].ipvp =
|
||||
(opp->src[n_IRQ].ipvp & 0x40000000) |
|
||||
(val & 0x800F00FF);
|
||||
openpic_update_irq(opp, n_IRQ);
|
||||
DPRINTF("Set IPVP %d to 0x%08x -> 0x%08x\n",
|
||||
n_IRQ, val, opp->src[n_IRQ].ipvp);
|
||||
break;
|
||||
break;
|
||||
case IRQ_IDE:
|
||||
tmp = val & 0xC0000000;
|
||||
tmp = val & 0xC0000000;
|
||||
tmp |= val & ((1 << MAX_CPU) - 1);
|
||||
opp->src[n_IRQ].ide = tmp;
|
||||
opp->src[n_IRQ].ide = tmp;
|
||||
DPRINTF("Set IDE %d to 0x%08x\n", n_IRQ, opp->src[n_IRQ].ide);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // Code provision for Intel model
|
||||
#if MAX_DBL > 0
|
||||
static uint32_t read_doorbell_register (openpic_t *opp,
|
||||
int n_dbl, uint32_t offset)
|
||||
int n_dbl, uint32_t offset)
|
||||
{
|
||||
uint32_t retval;
|
||||
|
||||
switch (offset) {
|
||||
case DBL_IPVP_OFFSET:
|
||||
retval = read_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IPVP);
|
||||
break;
|
||||
retval = read_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IPVP);
|
||||
break;
|
||||
case DBL_IDE_OFFSET:
|
||||
retval = read_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IDE);
|
||||
break;
|
||||
retval = read_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IDE);
|
||||
break;
|
||||
case DBL_DMR_OFFSET:
|
||||
retval = opp->doorbells[n_dbl].dmr;
|
||||
break;
|
||||
retval = opp->doorbells[n_dbl].dmr;
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void write_doorbell_register (penpic_t *opp, int n_dbl,
|
||||
uint32_t offset, uint32_t value)
|
||||
uint32_t offset, uint32_t value)
|
||||
{
|
||||
switch (offset) {
|
||||
case DBL_IVPR_OFFSET:
|
||||
write_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IPVP, value);
|
||||
break;
|
||||
write_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IPVP, value);
|
||||
break;
|
||||
case DBL_IDE_OFFSET:
|
||||
write_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IDE, value);
|
||||
break;
|
||||
write_IRQreg(opp, IRQ_DBL0 + n_dbl, IRQ_IDE, value);
|
||||
break;
|
||||
case DBL_DMR_OFFSET:
|
||||
opp->doorbells[n_dbl].dmr = value;
|
||||
break;
|
||||
opp->doorbells[n_dbl].dmr = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MAX_MBX > 0
|
||||
static uint32_t read_mailbox_register (openpic_t *opp,
|
||||
int n_mbx, uint32_t offset)
|
||||
int n_mbx, uint32_t offset)
|
||||
{
|
||||
uint32_t retval;
|
||||
|
||||
switch (offset) {
|
||||
case MBX_MBR_OFFSET:
|
||||
retval = opp->mailboxes[n_mbx].mbr;
|
||||
break;
|
||||
retval = opp->mailboxes[n_mbx].mbr;
|
||||
break;
|
||||
case MBX_IVPR_OFFSET:
|
||||
retval = read_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IPVP);
|
||||
break;
|
||||
retval = read_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IPVP);
|
||||
break;
|
||||
case MBX_DMR_OFFSET:
|
||||
retval = read_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IDE);
|
||||
break;
|
||||
retval = read_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IDE);
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void write_mailbox_register (openpic_t *opp, int n_mbx,
|
||||
uint32_t address, uint32_t value)
|
||||
uint32_t address, uint32_t value)
|
||||
{
|
||||
switch (offset) {
|
||||
case MBX_MBR_OFFSET:
|
||||
opp->mailboxes[n_mbx].mbr = value;
|
||||
break;
|
||||
opp->mailboxes[n_mbx].mbr = value;
|
||||
break;
|
||||
case MBX_IVPR_OFFSET:
|
||||
write_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IPVP, value);
|
||||
break;
|
||||
write_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IPVP, value);
|
||||
break;
|
||||
case MBX_DMR_OFFSET:
|
||||
write_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IDE, value);
|
||||
break;
|
||||
write_IRQreg(opp, IRQ_MBX0 + n_mbx, IRQ_IDE, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -606,9 +608,9 @@ static void openpic_gbl_write (void *opaque, target_phys_addr_t addr, uint32_t v
|
||||
if (val & 0x80000000 && opp->reset)
|
||||
opp->reset(opp);
|
||||
opp->glbc = val & ~0x80000000;
|
||||
break;
|
||||
break;
|
||||
case 0x80: /* VENI */
|
||||
break;
|
||||
break;
|
||||
case 0x90: /* PINT */
|
||||
for (idx = 0; idx < opp->nb_cpus; idx++) {
|
||||
if ((val & (1 << idx)) && !(opp->pint & (1 << idx))) {
|
||||
@@ -622,7 +624,7 @@ static void openpic_gbl_write (void *opaque, target_phys_addr_t addr, uint32_t v
|
||||
}
|
||||
}
|
||||
opp->pint = val;
|
||||
break;
|
||||
break;
|
||||
#if MAX_IPI > 0
|
||||
case 0xA0: /* IPI_IPVP */
|
||||
case 0xB0:
|
||||
@@ -640,7 +642,7 @@ static void openpic_gbl_write (void *opaque, target_phys_addr_t addr, uint32_t v
|
||||
break;
|
||||
case 0xF0: /* TIFR */
|
||||
opp->tifr = val;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -662,13 +664,13 @@ static uint32_t openpic_gbl_read (void *opaque, target_phys_addr_t addr)
|
||||
break;
|
||||
case 0x20: /* GLBC */
|
||||
retval = opp->glbc;
|
||||
break;
|
||||
break;
|
||||
case 0x80: /* VENI */
|
||||
retval = opp->veni;
|
||||
break;
|
||||
break;
|
||||
case 0x90: /* PINT */
|
||||
retval = 0x00000000;
|
||||
break;
|
||||
break;
|
||||
#if MAX_IPI > 0
|
||||
case 0xA0: /* IPI_IPVP */
|
||||
case 0xB0:
|
||||
@@ -679,14 +681,14 @@ static uint32_t openpic_gbl_read (void *opaque, target_phys_addr_t addr)
|
||||
idx = (addr - 0xA0) >> 4;
|
||||
retval = read_IRQreg(opp, opp->irq_ipi0 + idx, IRQ_IPVP);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
#endif
|
||||
case 0xE0: /* SPVE */
|
||||
retval = opp->spve;
|
||||
break;
|
||||
case 0xF0: /* TIFR */
|
||||
retval = opp->tifr;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -717,18 +719,18 @@ static void openpic_timer_write (void *opaque, uint32_t addr, uint32_t val)
|
||||
case 0x00: /* TICC */
|
||||
break;
|
||||
case 0x10: /* TIBC */
|
||||
if ((opp->timers[idx].ticc & 0x80000000) != 0 &&
|
||||
(val & 0x80000000) == 0 &&
|
||||
if ((opp->timers[idx].ticc & 0x80000000) != 0 &&
|
||||
(val & 0x80000000) == 0 &&
|
||||
(opp->timers[idx].tibc & 0x80000000) != 0)
|
||||
opp->timers[idx].ticc &= ~0x80000000;
|
||||
opp->timers[idx].tibc = val;
|
||||
break;
|
||||
opp->timers[idx].ticc &= ~0x80000000;
|
||||
opp->timers[idx].tibc = val;
|
||||
break;
|
||||
case 0x20: /* TIVP */
|
||||
write_IRQreg(opp, opp->irq_tim0 + idx, IRQ_IPVP, val);
|
||||
break;
|
||||
break;
|
||||
case 0x30: /* TIDE */
|
||||
write_IRQreg(opp, opp->irq_tim0 + idx, IRQ_IDE, val);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,17 +750,17 @@ static uint32_t openpic_timer_read (void *opaque, uint32_t addr)
|
||||
addr = addr & 0x30;
|
||||
switch (addr) {
|
||||
case 0x00: /* TICC */
|
||||
retval = opp->timers[idx].ticc;
|
||||
retval = opp->timers[idx].ticc;
|
||||
break;
|
||||
case 0x10: /* TIBC */
|
||||
retval = opp->timers[idx].tibc;
|
||||
break;
|
||||
retval = opp->timers[idx].tibc;
|
||||
break;
|
||||
case 0x20: /* TIPV */
|
||||
retval = read_IRQreg(opp, opp->irq_tim0 + idx, IRQ_IPVP);
|
||||
break;
|
||||
break;
|
||||
case 0x30: /* TIDE */
|
||||
retval = read_IRQreg(opp, opp->irq_tim0 + idx, IRQ_IDE);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
DPRINTF("%s: => %08x\n", __func__, retval);
|
||||
#if defined TARGET_WORDS_BIGENDIAN
|
||||
@@ -847,21 +849,21 @@ static void openpic_cpu_write (void *opaque, target_phys_addr_t addr, uint32_t v
|
||||
break;
|
||||
#endif
|
||||
case 0x80: /* PCTP */
|
||||
dst->pctp = val & 0x0000000F;
|
||||
break;
|
||||
dst->pctp = val & 0x0000000F;
|
||||
break;
|
||||
case 0x90: /* WHOAMI */
|
||||
/* Read-only register */
|
||||
break;
|
||||
/* Read-only register */
|
||||
break;
|
||||
case 0xA0: /* PIAC */
|
||||
/* Read-only register */
|
||||
break;
|
||||
/* Read-only register */
|
||||
break;
|
||||
case 0xB0: /* PEOI */
|
||||
DPRINTF("PEOI\n");
|
||||
s_IRQ = IRQ_get_next(opp, &dst->servicing);
|
||||
IRQ_resetbit(&dst->servicing, s_IRQ);
|
||||
dst->servicing.next = -1;
|
||||
/* Set up next servicing IRQ */
|
||||
s_IRQ = IRQ_get_next(opp, &dst->servicing);
|
||||
s_IRQ = IRQ_get_next(opp, &dst->servicing);
|
||||
IRQ_resetbit(&dst->servicing, s_IRQ);
|
||||
dst->servicing.next = -1;
|
||||
/* Set up next servicing IRQ */
|
||||
s_IRQ = IRQ_get_next(opp, &dst->servicing);
|
||||
/* Check queued interrupts. */
|
||||
n_IRQ = IRQ_get_next(opp, &dst->raised);
|
||||
src = &opp->src[n_IRQ];
|
||||
@@ -872,7 +874,7 @@ static void openpic_cpu_write (void *opaque, target_phys_addr_t addr, uint32_t v
|
||||
idx, n_IRQ);
|
||||
opp->irq_raise(opp, idx, src);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -896,46 +898,46 @@ static uint32_t openpic_cpu_read (void *opaque, target_phys_addr_t addr)
|
||||
addr &= 0xFF0;
|
||||
switch (addr) {
|
||||
case 0x80: /* PCTP */
|
||||
retval = dst->pctp;
|
||||
break;
|
||||
retval = dst->pctp;
|
||||
break;
|
||||
case 0x90: /* WHOAMI */
|
||||
retval = idx;
|
||||
break;
|
||||
retval = idx;
|
||||
break;
|
||||
case 0xA0: /* PIAC */
|
||||
DPRINTF("Lower OpenPIC INT output\n");
|
||||
qemu_irq_lower(dst->irqs[OPENPIC_OUTPUT_INT]);
|
||||
n_IRQ = IRQ_get_next(opp, &dst->raised);
|
||||
n_IRQ = IRQ_get_next(opp, &dst->raised);
|
||||
DPRINTF("PIAC: irq=%d\n", n_IRQ);
|
||||
if (n_IRQ == -1) {
|
||||
/* No more interrupt pending */
|
||||
if (n_IRQ == -1) {
|
||||
/* No more interrupt pending */
|
||||
retval = IPVP_VECTOR(opp->spve);
|
||||
} else {
|
||||
src = &opp->src[n_IRQ];
|
||||
if (!test_bit(&src->ipvp, IPVP_ACTIVITY) ||
|
||||
!(IPVP_PRIORITY(src->ipvp) > dst->pctp)) {
|
||||
/* - Spurious level-sensitive IRQ
|
||||
* - Priorities has been changed
|
||||
* and the pending IRQ isn't allowed anymore
|
||||
*/
|
||||
reset_bit(&src->ipvp, IPVP_ACTIVITY);
|
||||
retval = IPVP_VECTOR(opp->spve);
|
||||
} else {
|
||||
/* IRQ enter servicing state */
|
||||
IRQ_setbit(&dst->servicing, n_IRQ);
|
||||
retval = IPVP_VECTOR(src->ipvp);
|
||||
}
|
||||
IRQ_resetbit(&dst->raised, n_IRQ);
|
||||
dst->raised.next = -1;
|
||||
if (!test_bit(&src->ipvp, IPVP_SENSE)) {
|
||||
} else {
|
||||
src = &opp->src[n_IRQ];
|
||||
if (!test_bit(&src->ipvp, IPVP_ACTIVITY) ||
|
||||
!(IPVP_PRIORITY(src->ipvp) > dst->pctp)) {
|
||||
/* - Spurious level-sensitive IRQ
|
||||
* - Priorities has been changed
|
||||
* and the pending IRQ isn't allowed anymore
|
||||
*/
|
||||
reset_bit(&src->ipvp, IPVP_ACTIVITY);
|
||||
retval = IPVP_VECTOR(opp->spve);
|
||||
} else {
|
||||
/* IRQ enter servicing state */
|
||||
IRQ_setbit(&dst->servicing, n_IRQ);
|
||||
retval = IPVP_VECTOR(src->ipvp);
|
||||
}
|
||||
IRQ_resetbit(&dst->raised, n_IRQ);
|
||||
dst->raised.next = -1;
|
||||
if (!test_bit(&src->ipvp, IPVP_SENSE)) {
|
||||
/* edge-sensitive IRQ */
|
||||
reset_bit(&src->ipvp, IPVP_ACTIVITY);
|
||||
reset_bit(&src->ipvp, IPVP_ACTIVITY);
|
||||
src->pending = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0xB0: /* PEOI */
|
||||
retval = 0;
|
||||
break;
|
||||
retval = 0;
|
||||
break;
|
||||
#if MAX_IPI > 0
|
||||
case 0x40: /* IDE */
|
||||
case 0x50:
|
||||
|
||||
@@ -44,13 +44,11 @@
|
||||
#include "ide.h"
|
||||
#include "loader.h"
|
||||
#include "elf.h"
|
||||
#include "multiboot.h"
|
||||
|
||||
/* output Bochs bios info messages */
|
||||
//#define DEBUG_BIOS
|
||||
|
||||
/* Show multiboot debug output */
|
||||
//#define DEBUG_MULTIBOOT
|
||||
|
||||
#define BIOS_FILENAME "bios.bin"
|
||||
|
||||
#define PC_MAX_BIOS_SIZE (4 * 1024 * 1024)
|
||||
@@ -506,232 +504,6 @@ static long get_file_size(FILE *f)
|
||||
return size;
|
||||
}
|
||||
|
||||
#define MULTIBOOT_STRUCT_ADDR 0x9000
|
||||
|
||||
#if MULTIBOOT_STRUCT_ADDR > 0xf0000
|
||||
#error multiboot struct needs to fit in 16 bit real mode
|
||||
#endif
|
||||
|
||||
static int load_multiboot(void *fw_cfg,
|
||||
FILE *f,
|
||||
const char *kernel_filename,
|
||||
const char *initrd_filename,
|
||||
const char *kernel_cmdline,
|
||||
uint8_t *header)
|
||||
{
|
||||
int i, is_multiboot = 0;
|
||||
uint32_t flags = 0;
|
||||
uint32_t mh_entry_addr;
|
||||
uint32_t mh_load_addr;
|
||||
uint32_t mb_kernel_size;
|
||||
uint32_t mmap_addr = MULTIBOOT_STRUCT_ADDR;
|
||||
uint32_t mb_bootinfo = MULTIBOOT_STRUCT_ADDR + 0x500;
|
||||
uint32_t mb_mod_end;
|
||||
uint8_t bootinfo[0x500];
|
||||
uint32_t cmdline = 0x200;
|
||||
uint8_t *mb_kernel_data;
|
||||
uint8_t *mb_bootinfo_data;
|
||||
|
||||
/* Ok, let's see if it is a multiboot image.
|
||||
The header is 12x32bit long, so the latest entry may be 8192 - 48. */
|
||||
for (i = 0; i < (8192 - 48); i += 4) {
|
||||
if (ldl_p(header+i) == 0x1BADB002) {
|
||||
uint32_t checksum = ldl_p(header+i+8);
|
||||
flags = ldl_p(header+i+4);
|
||||
checksum += flags;
|
||||
checksum += (uint32_t)0x1BADB002;
|
||||
if (!checksum) {
|
||||
is_multiboot = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_multiboot)
|
||||
return 0; /* no multiboot */
|
||||
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
fprintf(stderr, "qemu: I believe we found a multiboot image!\n");
|
||||
#endif
|
||||
memset(bootinfo, 0, sizeof(bootinfo));
|
||||
|
||||
if (flags & 0x00000004) { /* MULTIBOOT_HEADER_HAS_VBE */
|
||||
fprintf(stderr, "qemu: multiboot knows VBE. we don't.\n");
|
||||
}
|
||||
if (!(flags & 0x00010000)) { /* MULTIBOOT_HEADER_HAS_ADDR */
|
||||
uint64_t elf_entry;
|
||||
int kernel_size;
|
||||
fclose(f);
|
||||
kernel_size = load_elf(kernel_filename, 0, &elf_entry, NULL, NULL,
|
||||
0, ELF_MACHINE, 0);
|
||||
if (kernel_size < 0) {
|
||||
fprintf(stderr, "Error while loading elf kernel\n");
|
||||
exit(1);
|
||||
}
|
||||
mh_load_addr = mh_entry_addr = elf_entry;
|
||||
mb_kernel_size = kernel_size;
|
||||
|
||||
mb_kernel_data = qemu_malloc(mb_kernel_size);
|
||||
if (rom_copy(mb_kernel_data, elf_entry, kernel_size) != kernel_size) {
|
||||
fprintf(stderr, "Error while fetching elf kernel from rom\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
fprintf(stderr, "qemu: loading multiboot-elf kernel (%#x bytes) with entry %#zx\n",
|
||||
mb_kernel_size, (size_t)mh_entry_addr);
|
||||
#endif
|
||||
} else {
|
||||
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
|
||||
uint32_t mh_header_addr = ldl_p(header+i+12);
|
||||
mh_load_addr = ldl_p(header+i+16);
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
uint32_t mh_load_end_addr = ldl_p(header+i+20);
|
||||
uint32_t mh_bss_end_addr = ldl_p(header+i+24);
|
||||
#endif
|
||||
uint32_t mb_kernel_text_offset = i - (mh_header_addr - mh_load_addr);
|
||||
|
||||
mh_entry_addr = ldl_p(header+i+28);
|
||||
mb_kernel_size = get_file_size(f) - mb_kernel_text_offset;
|
||||
|
||||
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE.
|
||||
uint32_t mh_mode_type = ldl_p(header+i+32);
|
||||
uint32_t mh_width = ldl_p(header+i+36);
|
||||
uint32_t mh_height = ldl_p(header+i+40);
|
||||
uint32_t mh_depth = ldl_p(header+i+44); */
|
||||
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
fprintf(stderr, "multiboot: mh_header_addr = %#x\n", mh_header_addr);
|
||||
fprintf(stderr, "multiboot: mh_load_addr = %#x\n", mh_load_addr);
|
||||
fprintf(stderr, "multiboot: mh_load_end_addr = %#x\n", mh_load_end_addr);
|
||||
fprintf(stderr, "multiboot: mh_bss_end_addr = %#x\n", mh_bss_end_addr);
|
||||
fprintf(stderr, "qemu: loading multiboot kernel (%#x bytes) at %#x\n",
|
||||
mb_kernel_size, mh_load_addr);
|
||||
#endif
|
||||
|
||||
mb_kernel_data = qemu_malloc(mb_kernel_size);
|
||||
fseek(f, mb_kernel_text_offset, SEEK_SET);
|
||||
fread(mb_kernel_data, 1, mb_kernel_size, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
/* blob size is only the kernel for now */
|
||||
mb_mod_end = mh_load_addr + mb_kernel_size;
|
||||
|
||||
/* load modules */
|
||||
stl_p(bootinfo + 20, 0x0); /* mods_count */
|
||||
if (initrd_filename) {
|
||||
uint32_t mb_mod_info = 0x100;
|
||||
uint32_t mb_mod_cmdline = 0x300;
|
||||
uint32_t mb_mod_start = mh_load_addr;
|
||||
uint32_t mb_mod_length = mb_kernel_size;
|
||||
char *next_initrd;
|
||||
char *next_space;
|
||||
int mb_mod_count = 0;
|
||||
|
||||
do {
|
||||
if (mb_mod_info + 16 > mb_mod_cmdline) {
|
||||
printf("WARNING: Too many modules loaded, aborting.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
next_initrd = strchr(initrd_filename, ',');
|
||||
if (next_initrd)
|
||||
*next_initrd = '\0';
|
||||
/* if a space comes after the module filename, treat everything
|
||||
after that as parameters */
|
||||
pstrcpy((char*)bootinfo + mb_mod_cmdline,
|
||||
sizeof(bootinfo) - mb_mod_cmdline,
|
||||
initrd_filename);
|
||||
stl_p(bootinfo + mb_mod_info + 8, mb_bootinfo + mb_mod_cmdline); /* string */
|
||||
mb_mod_cmdline += strlen(initrd_filename) + 1;
|
||||
if (mb_mod_cmdline > sizeof(bootinfo)) {
|
||||
mb_mod_cmdline = sizeof(bootinfo);
|
||||
printf("WARNING: Too many module cmdlines loaded, aborting.\n");
|
||||
break;
|
||||
}
|
||||
if ((next_space = strchr(initrd_filename, ' ')))
|
||||
*next_space = '\0';
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
printf("multiboot loading module: %s\n", initrd_filename);
|
||||
#endif
|
||||
mb_mod_start = (mb_mod_start + mb_mod_length + (TARGET_PAGE_SIZE - 1))
|
||||
& (TARGET_PAGE_MASK);
|
||||
mb_mod_length = get_image_size(initrd_filename);
|
||||
if (mb_mod_length < 0) {
|
||||
fprintf(stderr, "failed to get %s image size\n", initrd_filename);
|
||||
exit(1);
|
||||
}
|
||||
mb_mod_end = mb_mod_start + mb_mod_length;
|
||||
mb_mod_count++;
|
||||
|
||||
/* append module data at the end of last module */
|
||||
mb_kernel_data = qemu_realloc(mb_kernel_data,
|
||||
mb_mod_end - mh_load_addr);
|
||||
load_image(initrd_filename,
|
||||
mb_kernel_data + mb_mod_start - mh_load_addr);
|
||||
|
||||
stl_p(bootinfo + mb_mod_info + 0, mb_mod_start);
|
||||
stl_p(bootinfo + mb_mod_info + 4, mb_mod_start + mb_mod_length);
|
||||
stl_p(bootinfo + mb_mod_info + 12, 0x0); /* reserved */
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
printf("mod_start: %#x\nmod_end: %#x\n", mb_mod_start,
|
||||
mb_mod_start + mb_mod_length);
|
||||
#endif
|
||||
initrd_filename = next_initrd+1;
|
||||
mb_mod_info += 16;
|
||||
} while (next_initrd);
|
||||
stl_p(bootinfo + 20, mb_mod_count); /* mods_count */
|
||||
stl_p(bootinfo + 24, mb_bootinfo + 0x100); /* mods_addr */
|
||||
}
|
||||
|
||||
/* Commandline support */
|
||||
stl_p(bootinfo + 16, mb_bootinfo + cmdline);
|
||||
snprintf((char*)bootinfo + cmdline, 0x100, "%s %s",
|
||||
kernel_filename, kernel_cmdline);
|
||||
|
||||
/* the kernel is where we want it to be now */
|
||||
#define MULTIBOOT_FLAGS_MEMORY (1 << 0)
|
||||
#define MULTIBOOT_FLAGS_BOOT_DEVICE (1 << 1)
|
||||
#define MULTIBOOT_FLAGS_CMDLINE (1 << 2)
|
||||
#define MULTIBOOT_FLAGS_MODULES (1 << 3)
|
||||
#define MULTIBOOT_FLAGS_MMAP (1 << 6)
|
||||
stl_p(bootinfo, MULTIBOOT_FLAGS_MEMORY
|
||||
| MULTIBOOT_FLAGS_BOOT_DEVICE
|
||||
| MULTIBOOT_FLAGS_CMDLINE
|
||||
| MULTIBOOT_FLAGS_MODULES
|
||||
| MULTIBOOT_FLAGS_MMAP);
|
||||
stl_p(bootinfo + 4, 640); /* mem_lower */
|
||||
stl_p(bootinfo + 8, ram_size / 1024); /* mem_upper */
|
||||
stl_p(bootinfo + 12, 0x8001ffff); /* XXX: use the -boot switch? */
|
||||
stl_p(bootinfo + 48, mmap_addr); /* mmap_addr */
|
||||
|
||||
#ifdef DEBUG_MULTIBOOT
|
||||
fprintf(stderr, "multiboot: mh_entry_addr = %#x\n", mh_entry_addr);
|
||||
#endif
|
||||
|
||||
/* save bootinfo off the stack */
|
||||
mb_bootinfo_data = qemu_malloc(sizeof(bootinfo));
|
||||
memcpy(mb_bootinfo_data, bootinfo, sizeof(bootinfo));
|
||||
|
||||
/* Pass variables to option rom */
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ENTRY, mh_entry_addr);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, mh_load_addr);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, mb_mod_end - mh_load_addr);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_KERNEL_DATA, mb_kernel_data,
|
||||
mb_mod_end - mh_load_addr);
|
||||
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, mb_bootinfo);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, sizeof(bootinfo));
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
|
||||
sizeof(bootinfo));
|
||||
|
||||
option_rom[nb_option_roms] = "multiboot.bin";
|
||||
nb_option_roms++;
|
||||
|
||||
return 1; /* yes, we are multiboot */
|
||||
}
|
||||
|
||||
static void load_linux(void *fw_cfg,
|
||||
const char *kernel_filename,
|
||||
const char *initrd_filename,
|
||||
@@ -768,8 +540,8 @@ static void load_linux(void *fw_cfg,
|
||||
else {
|
||||
/* This looks like a multiboot kernel. If it is, let's stop
|
||||
treating it like a Linux kernel. */
|
||||
if (load_multiboot(fw_cfg, f, kernel_filename,
|
||||
initrd_filename, kernel_cmdline, header))
|
||||
if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename,
|
||||
kernel_cmdline, kernel_size, header))
|
||||
return;
|
||||
protocol = 0;
|
||||
}
|
||||
@@ -885,8 +657,14 @@ static void load_linux(void *fw_cfg,
|
||||
setup = qemu_malloc(setup_size);
|
||||
kernel = qemu_malloc(kernel_size);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
fread(setup, 1, setup_size, f);
|
||||
fread(kernel, 1, kernel_size, f);
|
||||
if (fread(setup, 1, setup_size, f) != setup_size) {
|
||||
fprintf(stderr, "fread() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
if (fread(kernel, 1, kernel_size, f) != kernel_size) {
|
||||
fprintf(stderr, "fread() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
fclose(f);
|
||||
memcpy(setup, header, MIN(sizeof(header), setup_size));
|
||||
|
||||
@@ -1248,6 +1026,8 @@ static void pc_init1(ram_addr_t ram_size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rom_load_fw(fw_cfg);
|
||||
}
|
||||
|
||||
static void pc_init_pci(ram_addr_t ram_size,
|
||||
@@ -1298,7 +1078,7 @@ static QEMUMachine pc_machine_v0_10 = {
|
||||
.desc = "Standard PC, qemu 0.10",
|
||||
.init = pc_init_pci,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (CompatProperty[]) {
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
{
|
||||
.driver = "virtio-blk-pci",
|
||||
.property = "class",
|
||||
|
||||
+54
-10
@@ -33,6 +33,7 @@
|
||||
#include "scsi.h"
|
||||
#include "virtio-blk.h"
|
||||
#include "qemu-config.h"
|
||||
#include "qemu-objects.h"
|
||||
|
||||
#if defined(TARGET_I386)
|
||||
static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
|
||||
@@ -40,7 +41,18 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
|
||||
const char *opts_str)
|
||||
{
|
||||
QemuOpts *opts;
|
||||
int ret;
|
||||
PCIBus *bus;
|
||||
int ret, devfn;
|
||||
|
||||
bus = pci_get_bus_devfn(&devfn, devaddr);
|
||||
if (!bus) {
|
||||
monitor_printf(mon, "Invalid PCI device address %s\n", devaddr);
|
||||
return NULL;
|
||||
}
|
||||
if (!((BusState*)bus)->allow_hotplug) {
|
||||
monitor_printf(mon, "PCI bus doesn't support hotplug\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
opts = qemu_opts_parse(&qemu_net_opts, opts_str ? opts_str : "", NULL);
|
||||
if (!opts) {
|
||||
@@ -82,6 +94,7 @@ static int scsi_hot_add(DeviceState *adapter, DriveInfo *dinfo, int printinfo)
|
||||
*/
|
||||
dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1);
|
||||
scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo, dinfo->unit);
|
||||
dinfo->unit = scsidev->id;
|
||||
|
||||
if (printinfo)
|
||||
qemu_error("OK bus %d, unit %d\n", scsibus->busnr, scsidev->id);
|
||||
@@ -179,17 +192,17 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
|
||||
monitor_printf(mon, "Invalid PCI device address %s\n", devaddr);
|
||||
return NULL;
|
||||
}
|
||||
if (!((BusState*)bus)->allow_hotplug) {
|
||||
monitor_printf(mon, "PCI bus doesn't support hotplug\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case IF_SCSI:
|
||||
if (!dinfo) {
|
||||
monitor_printf(mon, "scsi requires a backing file/device.\n");
|
||||
return NULL;
|
||||
}
|
||||
dev = pci_create(bus, devfn, "lsi53c895a");
|
||||
if (qdev_init(&dev->qdev) < 0)
|
||||
dev = NULL;
|
||||
if (dev) {
|
||||
if (dev && dinfo) {
|
||||
if (scsi_hot_add(&dev->qdev, dinfo, 0) != 0) {
|
||||
qdev_unplug(&dev->qdev);
|
||||
dev = NULL;
|
||||
@@ -212,7 +225,36 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
|
||||
return dev;
|
||||
}
|
||||
|
||||
void pci_device_hot_add(Monitor *mon, const QDict *qdict)
|
||||
void pci_device_hot_add_print(Monitor *mon, const QObject *data)
|
||||
{
|
||||
QDict *qdict;
|
||||
|
||||
assert(qobject_type(data) == QTYPE_QDICT);
|
||||
qdict = qobject_to_qdict(data);
|
||||
|
||||
monitor_printf(mon, "OK domain %d, bus %d, slot %d, function %d\n",
|
||||
(int) qdict_get_int(qdict, "domain"),
|
||||
(int) qdict_get_int(qdict, "bus"),
|
||||
(int) qdict_get_int(qdict, "slot"),
|
||||
(int) qdict_get_int(qdict, "function"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* pci_device_hot_add(): Hot add a PCI device
|
||||
*
|
||||
* Return a QDict with the following device information:
|
||||
*
|
||||
* - "domain": domain number
|
||||
* - "bus": bus number
|
||||
* - "slot": slot number
|
||||
* - "function": function number
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* { "domain": 0, "bus": 0, "slot": 5, "function": 0 }
|
||||
*/
|
||||
void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
{
|
||||
PCIDevice *dev = NULL;
|
||||
const char *pci_addr = qdict_get_str(qdict, "pci_addr");
|
||||
@@ -239,9 +281,11 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict)
|
||||
monitor_printf(mon, "invalid type: %s\n", type);
|
||||
|
||||
if (dev) {
|
||||
monitor_printf(mon, "OK domain %d, bus %d, slot %d, function %d\n",
|
||||
0, pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),
|
||||
PCI_FUNC(dev->devfn));
|
||||
*ret_data =
|
||||
qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, "
|
||||
"'function': %d }", pci_bus_num(dev->bus),
|
||||
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
|
||||
assert(*ret_data != NULL);
|
||||
} else
|
||||
monitor_printf(mon, "failed to add %s\n", opts);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "monitor.h"
|
||||
#include "net.h"
|
||||
#include "sysemu.h"
|
||||
#include "loader.h"
|
||||
|
||||
//#define DEBUG_PCI
|
||||
#ifdef DEBUG_PCI
|
||||
@@ -40,10 +41,10 @@ struct PCIBus {
|
||||
pci_set_irq_fn set_irq;
|
||||
pci_map_irq_fn map_irq;
|
||||
pci_hotplug_fn hotplug;
|
||||
uint32_t config_reg; /* XXX: suppress */
|
||||
void *irq_opaque;
|
||||
PCIDevice *devices[256];
|
||||
PCIDevice *parent_dev;
|
||||
target_phys_addr_t mem_base;
|
||||
|
||||
QLIST_HEAD(, PCIBus) child; /* this will be replaced by qdev later */
|
||||
QLIST_ENTRY(PCIBus) sibling;/* this will be replaced by qdev later */
|
||||
@@ -62,14 +63,15 @@ static struct BusInfo pci_bus_info = {
|
||||
.print_dev = pcibus_dev_print,
|
||||
.props = (Property[]) {
|
||||
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
|
||||
DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static void pci_update_mappings(PCIDevice *d);
|
||||
static void pci_set_irq(void *opaque, int irq_num, int level);
|
||||
static int pci_add_option_rom(PCIDevice *pdev);
|
||||
|
||||
target_phys_addr_t pci_mem_base;
|
||||
static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET;
|
||||
static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU;
|
||||
|
||||
@@ -103,11 +105,48 @@ static int pci_bar(PCIDevice *d, int reg)
|
||||
return type == PCI_HEADER_TYPE_BRIDGE ? PCI_ROM_ADDRESS1 : PCI_ROM_ADDRESS;
|
||||
}
|
||||
|
||||
static inline int pci_irq_state(PCIDevice *d, int irq_num)
|
||||
{
|
||||
return (d->irq_state >> irq_num) & 0x1;
|
||||
}
|
||||
|
||||
static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level)
|
||||
{
|
||||
d->irq_state &= ~(0x1 << irq_num);
|
||||
d->irq_state |= level << irq_num;
|
||||
}
|
||||
|
||||
static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change)
|
||||
{
|
||||
PCIBus *bus;
|
||||
for (;;) {
|
||||
bus = pci_dev->bus;
|
||||
irq_num = bus->map_irq(pci_dev, irq_num);
|
||||
if (bus->set_irq)
|
||||
break;
|
||||
pci_dev = bus->parent_dev;
|
||||
}
|
||||
bus->irq_count[irq_num] += change;
|
||||
bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0);
|
||||
}
|
||||
|
||||
/* Update interrupt status bit in config space on interrupt
|
||||
* state change. */
|
||||
static void pci_update_irq_status(PCIDevice *dev)
|
||||
{
|
||||
if (dev->irq_state) {
|
||||
dev->config[PCI_STATUS] |= PCI_STATUS_INTERRUPT;
|
||||
} else {
|
||||
dev->config[PCI_STATUS] &= ~PCI_STATUS_INTERRUPT;
|
||||
}
|
||||
}
|
||||
|
||||
static void pci_device_reset(PCIDevice *dev)
|
||||
{
|
||||
int r;
|
||||
|
||||
memset(dev->irq_state, 0, sizeof dev->irq_state);
|
||||
dev->irq_state = 0;
|
||||
pci_update_irq_status(dev);
|
||||
dev->config[PCI_COMMAND] &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_MASTER);
|
||||
dev->config[PCI_CACHE_LINE_SIZE] = 0x0;
|
||||
@@ -198,6 +237,11 @@ void pci_bus_hotplug(PCIBus *bus, pci_hotplug_fn hotplug)
|
||||
bus->hotplug = hotplug;
|
||||
}
|
||||
|
||||
void pci_bus_set_mem_base(PCIBus *bus, target_phys_addr_t base)
|
||||
{
|
||||
bus->mem_base = base;
|
||||
}
|
||||
|
||||
PCIBus *pci_register_bus(DeviceState *parent, const char *name,
|
||||
pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
|
||||
void *irq_opaque, int devfn_min, int nirq)
|
||||
@@ -274,6 +318,43 @@ static VMStateInfo vmstate_info_pci_config = {
|
||||
.put = put_pci_config_device,
|
||||
};
|
||||
|
||||
static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
|
||||
{
|
||||
PCIDevice *s = container_of(pv, PCIDevice, config);
|
||||
uint32_t irq_state[PCI_NUM_PINS];
|
||||
int i;
|
||||
for (i = 0; i < PCI_NUM_PINS; ++i) {
|
||||
irq_state[i] = qemu_get_be32(f);
|
||||
if (irq_state[i] != 0x1 && irq_state[i] != 0) {
|
||||
fprintf(stderr, "irq state %d: must be 0 or 1.\n",
|
||||
irq_state[i]);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < PCI_NUM_PINS; ++i) {
|
||||
pci_set_irq_state(s, i, irq_state[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)
|
||||
{
|
||||
int i;
|
||||
PCIDevice *s = container_of(pv, PCIDevice, config);
|
||||
|
||||
for (i = 0; i < PCI_NUM_PINS; ++i) {
|
||||
qemu_put_be32(f, pci_irq_state(s, i));
|
||||
}
|
||||
}
|
||||
|
||||
static VMStateInfo vmstate_info_pci_irq_state = {
|
||||
.name = "pci irq state",
|
||||
.get = get_pci_irq_state,
|
||||
.put = put_pci_irq_state,
|
||||
};
|
||||
|
||||
const VMStateDescription vmstate_pci_device = {
|
||||
.name = "PCIDevice",
|
||||
.version_id = 2,
|
||||
@@ -284,7 +365,9 @@ const VMStateDescription vmstate_pci_device = {
|
||||
VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
|
||||
vmstate_info_pci_config,
|
||||
PCI_CONFIG_SPACE_SIZE),
|
||||
VMSTATE_INT32_ARRAY_V(irq_state, PCIDevice, PCI_NUM_PINS, 2),
|
||||
VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2,
|
||||
vmstate_info_pci_irq_state,
|
||||
PCI_NUM_PINS * sizeof(int32_t)),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -299,7 +382,9 @@ const VMStateDescription vmstate_pcie_device = {
|
||||
VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
|
||||
vmstate_info_pci_config,
|
||||
PCIE_CONFIG_SPACE_SIZE),
|
||||
VMSTATE_INT32_ARRAY_V(irq_state, PCIDevice, PCI_NUM_PINS, 2),
|
||||
VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2,
|
||||
vmstate_info_pci_irq_state,
|
||||
PCI_NUM_PINS * sizeof(int32_t)),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -311,19 +396,30 @@ static inline const VMStateDescription *pci_get_vmstate(PCIDevice *s)
|
||||
|
||||
void pci_device_save(PCIDevice *s, QEMUFile *f)
|
||||
{
|
||||
/* Clear interrupt status bit: it is implicit
|
||||
* in irq_state which we are saving.
|
||||
* This makes us compatible with old devices
|
||||
* which never set or clear this bit. */
|
||||
s->config[PCI_STATUS] &= ~PCI_STATUS_INTERRUPT;
|
||||
vmstate_save_state(f, pci_get_vmstate(s), s);
|
||||
/* Restore the interrupt status bit. */
|
||||
pci_update_irq_status(s);
|
||||
}
|
||||
|
||||
int pci_device_load(PCIDevice *s, QEMUFile *f)
|
||||
{
|
||||
return vmstate_load_state(f, pci_get_vmstate(s), s, s->version_id);
|
||||
int ret;
|
||||
ret = vmstate_load_state(f, pci_get_vmstate(s), s, s->version_id);
|
||||
/* Restore the interrupt status bit. */
|
||||
pci_update_irq_status(s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pci_set_default_subsystem_id(PCIDevice *pci_dev)
|
||||
{
|
||||
uint16_t *id;
|
||||
|
||||
id = (void*)(&pci_dev->config[PCI_SUBVENDOR_ID]);
|
||||
id = (void*)(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID]);
|
||||
id[0] = cpu_to_le16(pci_default_sub_vendor_id);
|
||||
id[1] = cpu_to_le16(pci_default_sub_device_id);
|
||||
return 0;
|
||||
@@ -429,7 +525,8 @@ static void pci_init_wmask(PCIDevice *dev)
|
||||
dev->wmask[PCI_CACHE_LINE_SIZE] = 0xff;
|
||||
dev->wmask[PCI_INTERRUPT_LINE] = 0xff;
|
||||
pci_set_word(dev->wmask + PCI_COMMAND,
|
||||
PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
|
||||
PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
|
||||
PCI_COMMAND_INTX_DISABLE);
|
||||
|
||||
memset(dev->wmask + PCI_CONFIG_HEADER_SIZE, 0xff,
|
||||
config_size - PCI_CONFIG_HEADER_SIZE);
|
||||
@@ -490,16 +587,18 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
||||
if (!bus->devices[devfn])
|
||||
goto found;
|
||||
}
|
||||
hw_error("PCI: no devfn available for %s, all in use\n", name);
|
||||
qemu_error("PCI: no devfn available for %s, all in use\n", name);
|
||||
return NULL;
|
||||
found: ;
|
||||
} else if (bus->devices[devfn]) {
|
||||
hw_error("PCI: devfn %d not available for %s, in use by %s\n", devfn,
|
||||
qemu_error("PCI: devfn %d not available for %s, in use by %s\n", devfn,
|
||||
name, bus->devices[devfn]->name);
|
||||
return NULL;
|
||||
}
|
||||
pci_dev->bus = bus;
|
||||
pci_dev->devfn = devfn;
|
||||
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
|
||||
memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state));
|
||||
pci_dev->irq_state = 0;
|
||||
pci_config_alloc(pci_dev);
|
||||
|
||||
header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
|
||||
@@ -535,11 +634,16 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
|
||||
pci_dev = do_pci_register_device(pci_dev, bus, name, devfn,
|
||||
config_read, config_write,
|
||||
PCI_HEADER_TYPE_NORMAL);
|
||||
if (pci_dev == NULL) {
|
||||
hw_error("PCI: can't register device\n");
|
||||
}
|
||||
return pci_dev;
|
||||
}
|
||||
static target_phys_addr_t pci_to_cpu_addr(target_phys_addr_t addr)
|
||||
|
||||
static target_phys_addr_t pci_to_cpu_addr(PCIBus *bus,
|
||||
target_phys_addr_t addr)
|
||||
{
|
||||
return addr + pci_mem_base;
|
||||
return addr + bus->mem_base;
|
||||
}
|
||||
|
||||
static void pci_unregister_io_regions(PCIDevice *pci_dev)
|
||||
@@ -554,9 +658,10 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev)
|
||||
if (r->type == PCI_BASE_ADDRESS_SPACE_IO) {
|
||||
isa_unassign_ioport(r->addr, r->filtered_size);
|
||||
} else {
|
||||
cpu_register_physical_memory(pci_to_cpu_addr(r->addr),
|
||||
r->filtered_size,
|
||||
IO_MEM_UNASSIGNED);
|
||||
cpu_register_physical_memory(pci_to_cpu_addr(pci_dev->bus,
|
||||
r->addr),
|
||||
r->filtered_size,
|
||||
IO_MEM_UNASSIGNED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -828,7 +933,7 @@ static void pci_update_mappings(PCIDevice *d)
|
||||
isa_unassign_ioport(r->addr, r->filtered_size);
|
||||
}
|
||||
} else {
|
||||
cpu_register_physical_memory(pci_to_cpu_addr(r->addr),
|
||||
cpu_register_physical_memory(pci_to_cpu_addr(d->bus, r->addr),
|
||||
r->filtered_size,
|
||||
IO_MEM_UNASSIGNED);
|
||||
qemu_unregister_coalesced_mmio(r->addr, r->filtered_size);
|
||||
@@ -844,11 +949,35 @@ static void pci_update_mappings(PCIDevice *d)
|
||||
* Teach them such cases, such that filtered_size < size and
|
||||
* addr & (size - 1) != 0.
|
||||
*/
|
||||
r->map_func(d, i, r->addr, r->filtered_size, r->type);
|
||||
if (r->type & PCI_BASE_ADDRESS_SPACE_IO) {
|
||||
r->map_func(d, i, r->addr, r->filtered_size, r->type);
|
||||
} else {
|
||||
r->map_func(d, i, pci_to_cpu_addr(d->bus, r->addr),
|
||||
r->filtered_size, r->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline int pci_irq_disabled(PCIDevice *d)
|
||||
{
|
||||
return pci_get_word(d->config + PCI_COMMAND) & PCI_COMMAND_INTX_DISABLE;
|
||||
}
|
||||
|
||||
/* Called after interrupt disabled field update in config space,
|
||||
* assert/deassert interrupts if necessary.
|
||||
* Gets original interrupt disable bit value (before update). */
|
||||
static void pci_update_irq_disabled(PCIDevice *d, int was_irq_disabled)
|
||||
{
|
||||
int i, disabled = pci_irq_disabled(d);
|
||||
if (disabled == was_irq_disabled)
|
||||
return;
|
||||
for (i = 0; i < PCI_NUM_PINS; ++i) {
|
||||
int state = pci_irq_state(d, i);
|
||||
pci_change_irq_level(d, i, disabled ? -state : state);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t pci_default_read_config(PCIDevice *d,
|
||||
uint32_t address, int len)
|
||||
{
|
||||
@@ -861,7 +990,7 @@ uint32_t pci_default_read_config(PCIDevice *d,
|
||||
|
||||
void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
|
||||
{
|
||||
int i;
|
||||
int i, was_irq_disabled = pci_irq_disabled(d);
|
||||
uint32_t config_size = pci_config_size(d);
|
||||
|
||||
for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) {
|
||||
@@ -873,6 +1002,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
|
||||
ranges_overlap(addr, l, PCI_ROM_ADDRESS1, 4) ||
|
||||
range_covers_byte(addr, l, PCI_COMMAND))
|
||||
pci_update_mappings(d);
|
||||
|
||||
if (range_covers_byte(addr, l, PCI_COMMAND))
|
||||
pci_update_irq_disabled(d, was_irq_disabled);
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
@@ -882,23 +1014,17 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
|
||||
static void pci_set_irq(void *opaque, int irq_num, int level)
|
||||
{
|
||||
PCIDevice *pci_dev = opaque;
|
||||
PCIBus *bus;
|
||||
int change;
|
||||
|
||||
change = level - pci_dev->irq_state[irq_num];
|
||||
change = level - pci_irq_state(pci_dev, irq_num);
|
||||
if (!change)
|
||||
return;
|
||||
|
||||
pci_dev->irq_state[irq_num] = level;
|
||||
for (;;) {
|
||||
bus = pci_dev->bus;
|
||||
irq_num = bus->map_irq(pci_dev, irq_num);
|
||||
if (bus->set_irq)
|
||||
break;
|
||||
pci_dev = bus->parent_dev;
|
||||
}
|
||||
bus->irq_count[irq_num] += change;
|
||||
bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0);
|
||||
pci_set_irq_state(pci_dev, irq_num, level);
|
||||
pci_update_irq_status(pci_dev);
|
||||
if (pci_irq_disabled(pci_dev))
|
||||
return;
|
||||
pci_change_irq_level(pci_dev, irq_num, change);
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
@@ -1270,9 +1396,17 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
||||
pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,
|
||||
info->config_read, info->config_write,
|
||||
info->header_type);
|
||||
if (pci_dev == NULL)
|
||||
return -1;
|
||||
rc = info->init(pci_dev);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
|
||||
/* rom loading */
|
||||
if (pci_dev->romfile == NULL && info->romfile != NULL)
|
||||
pci_dev->romfile = qemu_strdup(info->romfile);
|
||||
pci_add_option_rom(pci_dev);
|
||||
|
||||
if (qdev->hotplugged)
|
||||
bus->hotplug(pci_dev, 1);
|
||||
return 0;
|
||||
@@ -1350,6 +1484,50 @@ static uint8_t pci_find_capability_list(PCIDevice *pdev, uint8_t cap_id,
|
||||
return next;
|
||||
}
|
||||
|
||||
static void pci_map_option_rom(PCIDevice *pdev, int region_num, pcibus_t addr, pcibus_t size, int type)
|
||||
{
|
||||
cpu_register_physical_memory(addr, size, pdev->rom_offset);
|
||||
}
|
||||
|
||||
/* Add an option rom for the device */
|
||||
static int pci_add_option_rom(PCIDevice *pdev)
|
||||
{
|
||||
int size;
|
||||
char *path;
|
||||
void *ptr;
|
||||
|
||||
if (!pdev->romfile)
|
||||
return 0;
|
||||
if (strlen(pdev->romfile) == 0)
|
||||
return 0;
|
||||
|
||||
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile);
|
||||
if (path == NULL) {
|
||||
path = qemu_strdup(pdev->romfile);
|
||||
}
|
||||
|
||||
size = get_image_size(path);
|
||||
if (size < 0) {
|
||||
qemu_error("%s: failed to find romfile \"%s\"\n", __FUNCTION__,
|
||||
pdev->romfile);
|
||||
return -1;
|
||||
}
|
||||
if (size & (size - 1)) {
|
||||
size = 1 << qemu_fls(size);
|
||||
}
|
||||
|
||||
pdev->rom_offset = qemu_ram_alloc(size);
|
||||
|
||||
ptr = qemu_get_ram_ptr(pdev->rom_offset);
|
||||
load_image(path, ptr);
|
||||
qemu_free(path);
|
||||
|
||||
pci_register_bar(pdev, PCI_ROM_SLOT, size,
|
||||
0, pci_map_option_rom);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reserve space and add capability to the linked list in pci config space */
|
||||
int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size)
|
||||
{
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
/* PCI bus */
|
||||
|
||||
extern target_phys_addr_t pci_mem_base;
|
||||
|
||||
#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
|
||||
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
|
||||
#define PCI_FUNC(devfn) ((devfn) & 0x07)
|
||||
@@ -94,76 +92,10 @@ typedef struct PCIIORegion {
|
||||
#define PCI_ROM_SLOT 6
|
||||
#define PCI_NUM_REGIONS 7
|
||||
|
||||
/* Declarations from linux/pci_regs.h */
|
||||
#define PCI_VENDOR_ID 0x00 /* 16 bits */
|
||||
#define PCI_DEVICE_ID 0x02 /* 16 bits */
|
||||
#define PCI_COMMAND 0x04 /* 16 bits */
|
||||
#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
|
||||
#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
|
||||
#define PCI_COMMAND_MASTER 0x4 /* Enable bus master */
|
||||
#define PCI_STATUS 0x06 /* 16 bits */
|
||||
#define PCI_REVISION_ID 0x08 /* 8 bits */
|
||||
#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */
|
||||
#define PCI_CLASS_DEVICE 0x0a /* Device class */
|
||||
#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */
|
||||
#define PCI_LATENCY_TIMER 0x0d /* 8 bits */
|
||||
#define PCI_HEADER_TYPE 0x0e /* 8 bits */
|
||||
#define PCI_HEADER_TYPE_NORMAL 0
|
||||
#define PCI_HEADER_TYPE_BRIDGE 1
|
||||
#define PCI_HEADER_TYPE_CARDBUS 2
|
||||
#include "pci_regs.h"
|
||||
|
||||
/* PCI HEADER_TYPE */
|
||||
#define PCI_HEADER_TYPE_MULTI_FUNCTION 0x80
|
||||
#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_SPACE_IO 0x01
|
||||
#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
|
||||
#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */
|
||||
#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */
|
||||
#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */
|
||||
#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */
|
||||
#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */
|
||||
#define PCI_IO_LIMIT 0x1d
|
||||
#define PCI_IO_RANGE_TYPE_32 0x01
|
||||
#define PCI_IO_RANGE_MASK (~0x0fUL)
|
||||
#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */
|
||||
#define PCI_MEMORY_BASE 0x20 /* Memory range behind */
|
||||
#define PCI_MEMORY_LIMIT 0x22
|
||||
#define PCI_MEMORY_RANGE_MASK (~0x0fUL)
|
||||
#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */
|
||||
#define PCI_PREF_MEMORY_LIMIT 0x26
|
||||
#define PCI_PREF_RANGE_MASK (~0x0fUL)
|
||||
#define PCI_PREF_RANGE_TYPE_64 0x01
|
||||
#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */
|
||||
#define PCI_PREF_LIMIT_UPPER32 0x2c
|
||||
#define PCI_SUBSYSTEM_VENDOR_ID 0x2c /* 16 bits */
|
||||
#define PCI_SUBSYSTEM_ID 0x2e /* 16 bits */
|
||||
#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */
|
||||
#define PCI_ROM_ADDRESS_ENABLE 0x01
|
||||
#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */
|
||||
#define PCI_IO_LIMIT_UPPER16 0x32
|
||||
#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
|
||||
#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
|
||||
#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
|
||||
#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */
|
||||
#define PCI_MIN_GNT 0x3e /* 8 bits */
|
||||
#define PCI_BRIDGE_CONTROL 0x3e
|
||||
#define PCI_MAX_LAT 0x3f /* 8 bits */
|
||||
|
||||
/* Capability lists */
|
||||
#define PCI_CAP_LIST_ID 0 /* Capability ID */
|
||||
#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
|
||||
|
||||
#define PCI_REVISION 0x08 /* obsolete, use PCI_REVISION_ID */
|
||||
#define PCI_SUBVENDOR_ID 0x2c /* obsolete, use PCI_SUBSYSTEM_VENDOR_ID */
|
||||
#define PCI_SUBDEVICE_ID 0x2e /* obsolete, use PCI_SUBSYSTEM_ID */
|
||||
|
||||
/* Bits in the PCI Status Register (PCI 2.3 spec) */
|
||||
#define PCI_STATUS_RESERVED1 0x007
|
||||
#define PCI_STATUS_INT_STATUS 0x008
|
||||
#define PCI_STATUS_CAP_LIST 0x010
|
||||
#define PCI_STATUS_66MHZ 0x020
|
||||
#define PCI_STATUS_RESERVED2 0x040
|
||||
#define PCI_STATUS_FAST_BACK 0x080
|
||||
#define PCI_STATUS_DEVSEL 0x600
|
||||
|
||||
#define PCI_STATUS_RESERVED_MASK_LO (PCI_STATUS_RESERVED1 | \
|
||||
PCI_STATUS_INT_STATUS | PCI_STATUS_CAPABILITIES | \
|
||||
@@ -220,7 +152,7 @@ struct PCIDevice {
|
||||
qemu_irq *irq;
|
||||
|
||||
/* Current IRQ levels. Used internally by the generic PCI code. */
|
||||
int irq_state[PCI_NUM_PINS];
|
||||
uint8_t irq_state;
|
||||
|
||||
/* Capability bits */
|
||||
uint32_t cap_present;
|
||||
@@ -241,6 +173,10 @@ struct PCIDevice {
|
||||
uint32_t msix_bar_size;
|
||||
/* Version id needed for VMState */
|
||||
int32_t version_id;
|
||||
|
||||
/* Location of option rom */
|
||||
char *romfile;
|
||||
ram_addr_t rom_offset;
|
||||
};
|
||||
|
||||
PCIDevice *pci_register_device(PCIBus *bus, const char *name,
|
||||
@@ -281,6 +217,8 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name,
|
||||
pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
|
||||
void *irq_opaque, int devfn_min, int nirq);
|
||||
|
||||
void pci_bus_set_mem_base(PCIBus *bus, target_phys_addr_t base);
|
||||
|
||||
PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
|
||||
const char *default_devaddr);
|
||||
PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
|
||||
@@ -379,6 +317,9 @@ typedef struct {
|
||||
|
||||
/* pcie stuff */
|
||||
int is_express; /* is this device pci express? */
|
||||
|
||||
/* rom bar */
|
||||
const char *romfile;
|
||||
} PCIDeviceInfo;
|
||||
|
||||
void pci_qdev_register(PCIDeviceInfo *info);
|
||||
|
||||
+665
@@ -0,0 +1,665 @@
|
||||
/*
|
||||
* pci_regs.h
|
||||
*
|
||||
* PCI standard defines
|
||||
* Copyright 1994, Drew Eckhardt
|
||||
* Copyright 1997--1999 Martin Mares <mj@ucw.cz>
|
||||
*
|
||||
* For more information, please consult the following manuals (look at
|
||||
* http://www.pcisig.com/ for how to get them):
|
||||
*
|
||||
* PCI BIOS Specification
|
||||
* PCI Local Bus Specification
|
||||
* PCI to PCI Bridge Specification
|
||||
* PCI System Design Guide
|
||||
*
|
||||
* For hypertransport information, please consult the following manuals
|
||||
* from http://www.hypertransport.org
|
||||
*
|
||||
* The Hypertransport I/O Link Specification
|
||||
*/
|
||||
|
||||
#ifndef LINUX_PCI_REGS_H
|
||||
#define LINUX_PCI_REGS_H
|
||||
|
||||
/*
|
||||
* Under PCI, each device has 256 bytes of configuration address space,
|
||||
* of which the first 64 bytes are standardized as follows:
|
||||
*/
|
||||
#define PCI_VENDOR_ID 0x00 /* 16 bits */
|
||||
#define PCI_DEVICE_ID 0x02 /* 16 bits */
|
||||
#define PCI_COMMAND 0x04 /* 16 bits */
|
||||
#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
|
||||
#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
|
||||
#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
|
||||
#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */
|
||||
#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
|
||||
#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
|
||||
#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
|
||||
#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
|
||||
#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
|
||||
#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
|
||||
#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
|
||||
|
||||
#define PCI_STATUS 0x06 /* 16 bits */
|
||||
#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */
|
||||
#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
|
||||
#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
|
||||
#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
|
||||
#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
|
||||
#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
|
||||
#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
|
||||
#define PCI_STATUS_DEVSEL_FAST 0x000
|
||||
#define PCI_STATUS_DEVSEL_MEDIUM 0x200
|
||||
#define PCI_STATUS_DEVSEL_SLOW 0x400
|
||||
#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
|
||||
#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
|
||||
#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
|
||||
#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
|
||||
#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
|
||||
|
||||
#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */
|
||||
#define PCI_REVISION_ID 0x08 /* Revision ID */
|
||||
#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */
|
||||
#define PCI_CLASS_DEVICE 0x0a /* Device class */
|
||||
|
||||
#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */
|
||||
#define PCI_LATENCY_TIMER 0x0d /* 8 bits */
|
||||
#define PCI_HEADER_TYPE 0x0e /* 8 bits */
|
||||
#define PCI_HEADER_TYPE_NORMAL 0
|
||||
#define PCI_HEADER_TYPE_BRIDGE 1
|
||||
#define PCI_HEADER_TYPE_CARDBUS 2
|
||||
|
||||
#define PCI_BIST 0x0f /* 8 bits */
|
||||
#define PCI_BIST_CODE_MASK 0x0f /* Return result */
|
||||
#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */
|
||||
#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */
|
||||
|
||||
/*
|
||||
* Base addresses specify locations in memory or I/O space.
|
||||
* Decoded size can be determined by writing a value of
|
||||
* 0xffffffff to the register, and reading it back. Only
|
||||
* 1 bits are decoded.
|
||||
*/
|
||||
#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */
|
||||
#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */
|
||||
#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */
|
||||
#define PCI_BASE_ADDRESS_SPACE_IO 0x01
|
||||
#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
|
||||
#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */
|
||||
#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL)
|
||||
#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL)
|
||||
/* bit 1 is reserved if address_space = 1 */
|
||||
|
||||
/* Header type 0 (normal devices) */
|
||||
#define PCI_CARDBUS_CIS 0x28
|
||||
#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
|
||||
#define PCI_SUBSYSTEM_ID 0x2e
|
||||
#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */
|
||||
#define PCI_ROM_ADDRESS_ENABLE 0x01
|
||||
#define PCI_ROM_ADDRESS_MASK (~0x7ffUL)
|
||||
|
||||
#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
|
||||
|
||||
/* 0x35-0x3b are reserved */
|
||||
#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
|
||||
#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */
|
||||
#define PCI_MIN_GNT 0x3e /* 8 bits */
|
||||
#define PCI_MAX_LAT 0x3f /* 8 bits */
|
||||
|
||||
/* Header type 1 (PCI-to-PCI bridges) */
|
||||
#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */
|
||||
#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */
|
||||
#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */
|
||||
#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */
|
||||
#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */
|
||||
#define PCI_IO_LIMIT 0x1d
|
||||
#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */
|
||||
#define PCI_IO_RANGE_TYPE_16 0x00
|
||||
#define PCI_IO_RANGE_TYPE_32 0x01
|
||||
#define PCI_IO_RANGE_MASK (~0x0fUL)
|
||||
#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */
|
||||
#define PCI_MEMORY_BASE 0x20 /* Memory range behind */
|
||||
#define PCI_MEMORY_LIMIT 0x22
|
||||
#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL
|
||||
#define PCI_MEMORY_RANGE_MASK (~0x0fUL)
|
||||
#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */
|
||||
#define PCI_PREF_MEMORY_LIMIT 0x26
|
||||
#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL
|
||||
#define PCI_PREF_RANGE_TYPE_32 0x00
|
||||
#define PCI_PREF_RANGE_TYPE_64 0x01
|
||||
#define PCI_PREF_RANGE_MASK (~0x0fUL)
|
||||
#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */
|
||||
#define PCI_PREF_LIMIT_UPPER32 0x2c
|
||||
#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */
|
||||
#define PCI_IO_LIMIT_UPPER16 0x32
|
||||
/* 0x34 same as for htype 0 */
|
||||
/* 0x35-0x3b is reserved */
|
||||
#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
|
||||
/* 0x3c-0x3d are same as for htype 0 */
|
||||
#define PCI_BRIDGE_CONTROL 0x3e
|
||||
#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */
|
||||
#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */
|
||||
#define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */
|
||||
#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */
|
||||
#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */
|
||||
#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */
|
||||
#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */
|
||||
|
||||
/* Header type 2 (CardBus bridges) */
|
||||
#define PCI_CB_CAPABILITY_LIST 0x14
|
||||
/* 0x15 reserved */
|
||||
#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */
|
||||
#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */
|
||||
#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */
|
||||
#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */
|
||||
#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */
|
||||
#define PCI_CB_MEMORY_BASE_0 0x1c
|
||||
#define PCI_CB_MEMORY_LIMIT_0 0x20
|
||||
#define PCI_CB_MEMORY_BASE_1 0x24
|
||||
#define PCI_CB_MEMORY_LIMIT_1 0x28
|
||||
#define PCI_CB_IO_BASE_0 0x2c
|
||||
#define PCI_CB_IO_BASE_0_HI 0x2e
|
||||
#define PCI_CB_IO_LIMIT_0 0x30
|
||||
#define PCI_CB_IO_LIMIT_0_HI 0x32
|
||||
#define PCI_CB_IO_BASE_1 0x34
|
||||
#define PCI_CB_IO_BASE_1_HI 0x36
|
||||
#define PCI_CB_IO_LIMIT_1 0x38
|
||||
#define PCI_CB_IO_LIMIT_1_HI 0x3a
|
||||
#define PCI_CB_IO_RANGE_MASK (~0x03UL)
|
||||
/* 0x3c-0x3d are same as for htype 0 */
|
||||
#define PCI_CB_BRIDGE_CONTROL 0x3e
|
||||
#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */
|
||||
#define PCI_CB_BRIDGE_CTL_SERR 0x02
|
||||
#define PCI_CB_BRIDGE_CTL_ISA 0x04
|
||||
#define PCI_CB_BRIDGE_CTL_VGA 0x08
|
||||
#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20
|
||||
#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */
|
||||
#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */
|
||||
#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */
|
||||
#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200
|
||||
#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400
|
||||
#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40
|
||||
#define PCI_CB_SUBSYSTEM_ID 0x42
|
||||
#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */
|
||||
/* 0x48-0x7f reserved */
|
||||
|
||||
/* Capability lists */
|
||||
|
||||
#define PCI_CAP_LIST_ID 0 /* Capability ID */
|
||||
#define PCI_CAP_ID_PM 0x01 /* Power Management */
|
||||
#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
|
||||
#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
|
||||
#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
|
||||
#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
|
||||
#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
|
||||
#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
|
||||
#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
|
||||
#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */
|
||||
#define PCI_CAP_ID_DBG 0x0A /* Debug port */
|
||||
#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */
|
||||
#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
|
||||
#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */
|
||||
#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
|
||||
#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
|
||||
#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
|
||||
#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */
|
||||
#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
|
||||
#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
|
||||
#define PCI_CAP_SIZEOF 4
|
||||
|
||||
/* Power Management Registers */
|
||||
|
||||
#define PCI_PM_PMC 2 /* PM Capabilities Register */
|
||||
#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */
|
||||
#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
|
||||
#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */
|
||||
#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
|
||||
#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */
|
||||
#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */
|
||||
#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */
|
||||
#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */
|
||||
#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */
|
||||
#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */
|
||||
#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */
|
||||
#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */
|
||||
#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */
|
||||
#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
|
||||
#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */
|
||||
#define PCI_PM_CTRL 4 /* PM control and status register */
|
||||
#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
|
||||
#define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */
|
||||
#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
|
||||
#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
|
||||
#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
|
||||
#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */
|
||||
#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */
|
||||
#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */
|
||||
#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */
|
||||
#define PCI_PM_DATA_REGISTER 7 /* (??) */
|
||||
#define PCI_PM_SIZEOF 8
|
||||
|
||||
/* AGP registers */
|
||||
|
||||
#define PCI_AGP_VERSION 2 /* BCD version number */
|
||||
#define PCI_AGP_RFU 3 /* Rest of capability flags */
|
||||
#define PCI_AGP_STATUS 4 /* Status register */
|
||||
#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */
|
||||
#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */
|
||||
#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */
|
||||
#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */
|
||||
#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */
|
||||
#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */
|
||||
#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */
|
||||
#define PCI_AGP_COMMAND 8 /* Control register */
|
||||
#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
|
||||
#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
|
||||
#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
|
||||
#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
|
||||
#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
|
||||
#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
|
||||
#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
|
||||
#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
|
||||
#define PCI_AGP_SIZEOF 12
|
||||
|
||||
/* Vital Product Data */
|
||||
|
||||
#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */
|
||||
#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */
|
||||
#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */
|
||||
#define PCI_VPD_DATA 4 /* 32-bits of data returned here */
|
||||
|
||||
/* Slot Identification */
|
||||
|
||||
#define PCI_SID_ESR 2 /* Expansion Slot Register */
|
||||
#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */
|
||||
#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
|
||||
#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */
|
||||
|
||||
/* Message Signalled Interrupts registers */
|
||||
|
||||
#define PCI_MSI_FLAGS 2 /* Various flags */
|
||||
#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */
|
||||
#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */
|
||||
#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */
|
||||
#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */
|
||||
#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */
|
||||
#define PCI_MSI_RFU 3 /* Rest of capability flags */
|
||||
#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
|
||||
#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
|
||||
#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
|
||||
#define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */
|
||||
#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
|
||||
#define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */
|
||||
|
||||
/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */
|
||||
#define PCI_MSIX_FLAGS 2
|
||||
#define PCI_MSIX_FLAGS_QSIZE 0x7FF
|
||||
#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
|
||||
#define PCI_MSIX_FLAGS_MASKALL (1 << 14)
|
||||
#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
|
||||
|
||||
/* CompactPCI Hotswap Register */
|
||||
|
||||
#define PCI_CHSWP_CSR 2 /* Control and Status Register */
|
||||
#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */
|
||||
#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */
|
||||
#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */
|
||||
#define PCI_CHSWP_LOO 0x08 /* LED On / Off */
|
||||
#define PCI_CHSWP_PI 0x30 /* Programming Interface */
|
||||
#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */
|
||||
#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */
|
||||
|
||||
/* PCI Advanced Feature registers */
|
||||
|
||||
#define PCI_AF_LENGTH 2
|
||||
#define PCI_AF_CAP 3
|
||||
#define PCI_AF_CAP_TP 0x01
|
||||
#define PCI_AF_CAP_FLR 0x02
|
||||
#define PCI_AF_CTRL 4
|
||||
#define PCI_AF_CTRL_FLR 0x01
|
||||
#define PCI_AF_STATUS 5
|
||||
#define PCI_AF_STATUS_TP 0x01
|
||||
|
||||
/* PCI-X registers */
|
||||
|
||||
#define PCI_X_CMD 2 /* Modes & Features */
|
||||
#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */
|
||||
#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */
|
||||
#define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */
|
||||
#define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */
|
||||
#define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */
|
||||
#define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */
|
||||
#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */
|
||||
/* Max # of outstanding split transactions */
|
||||
#define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */
|
||||
#define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */
|
||||
#define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */
|
||||
#define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */
|
||||
#define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */
|
||||
#define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */
|
||||
#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */
|
||||
#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */
|
||||
#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */
|
||||
#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */
|
||||
#define PCI_X_STATUS 4 /* PCI-X capabilities */
|
||||
#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */
|
||||
#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */
|
||||
#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */
|
||||
#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */
|
||||
#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */
|
||||
#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */
|
||||
#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */
|
||||
#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */
|
||||
#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */
|
||||
#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */
|
||||
#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */
|
||||
#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */
|
||||
#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */
|
||||
|
||||
/* PCI Express capability registers */
|
||||
|
||||
#define PCI_EXP_FLAGS 2 /* Capabilities register */
|
||||
#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */
|
||||
#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */
|
||||
#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */
|
||||
#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */
|
||||
#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */
|
||||
#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
|
||||
#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
|
||||
#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
|
||||
#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
|
||||
#define PCI_EXP_TYPE_RC_EC 0x10 /* Root Complex Event Collector */
|
||||
#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
|
||||
#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
|
||||
#define PCI_EXP_DEVCAP 4 /* Device capabilities */
|
||||
#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */
|
||||
#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */
|
||||
#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */
|
||||
#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */
|
||||
#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */
|
||||
#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */
|
||||
#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */
|
||||
#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */
|
||||
#define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */
|
||||
#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
|
||||
#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
|
||||
#define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */
|
||||
#define PCI_EXP_DEVCTL 8 /* Device Control */
|
||||
#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */
|
||||
#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */
|
||||
#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */
|
||||
#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */
|
||||
#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
|
||||
#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */
|
||||
#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */
|
||||
#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */
|
||||
#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */
|
||||
#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */
|
||||
#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */
|
||||
#define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */
|
||||
#define PCI_EXP_DEVSTA 10 /* Device Status */
|
||||
#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */
|
||||
#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */
|
||||
#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */
|
||||
#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */
|
||||
#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
|
||||
#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
|
||||
#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
|
||||
#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
|
||||
#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
|
||||
#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
|
||||
#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
|
||||
#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */
|
||||
#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */
|
||||
#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Suprise Down Error Reporting Capable */
|
||||
#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */
|
||||
#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */
|
||||
#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */
|
||||
#define PCI_EXP_LNKCTL 16 /* Link Control */
|
||||
#define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */
|
||||
#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */
|
||||
#define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */
|
||||
#define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */
|
||||
#define PCI_EXP_LNKCTL_CCC 0x0040 /* Common Clock Configuration */
|
||||
#define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */
|
||||
#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
|
||||
#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */
|
||||
#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */
|
||||
#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */
|
||||
#define PCI_EXP_LNKSTA 18 /* Link Status */
|
||||
#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
|
||||
#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */
|
||||
#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
|
||||
#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
|
||||
#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */
|
||||
#define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */
|
||||
#define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */
|
||||
#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
|
||||
#define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */
|
||||
#define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */
|
||||
#define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */
|
||||
#define PCI_EXP_SLTCAP_AIP 0x00000008 /* Attention Indicator Present */
|
||||
#define PCI_EXP_SLTCAP_PIP 0x00000010 /* Power Indicator Present */
|
||||
#define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */
|
||||
#define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */
|
||||
#define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value */
|
||||
#define PCI_EXP_SLTCAP_SPLS 0x00018000 /* Slot Power Limit Scale */
|
||||
#define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */
|
||||
#define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */
|
||||
#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */
|
||||
#define PCI_EXP_SLTCTL 24 /* Slot Control */
|
||||
#define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */
|
||||
#define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */
|
||||
#define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */
|
||||
#define PCI_EXP_SLTCTL_PDCE 0x0008 /* Presence Detect Changed Enable */
|
||||
#define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */
|
||||
#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */
|
||||
#define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */
|
||||
#define PCI_EXP_SLTCTL_PIC 0x0300 /* Power Indicator Control */
|
||||
#define PCI_EXP_SLTCTL_PCC 0x0400 /* Power Controller Control */
|
||||
#define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */
|
||||
#define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */
|
||||
#define PCI_EXP_SLTSTA 26 /* Slot Status */
|
||||
#define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */
|
||||
#define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */
|
||||
#define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */
|
||||
#define PCI_EXP_SLTSTA_PDC 0x0008 /* Presence Detect Changed */
|
||||
#define PCI_EXP_SLTSTA_CC 0x0010 /* Command Completed */
|
||||
#define PCI_EXP_SLTSTA_MRLSS 0x0020 /* MRL Sensor State */
|
||||
#define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */
|
||||
#define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */
|
||||
#define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */
|
||||
#define PCI_EXP_RTCTL 28 /* Root Control */
|
||||
#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */
|
||||
#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */
|
||||
#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */
|
||||
#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */
|
||||
#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */
|
||||
#define PCI_EXP_RTCAP 30 /* Root Capabilities */
|
||||
#define PCI_EXP_RTSTA 32 /* Root Status */
|
||||
#define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */
|
||||
#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */
|
||||
#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
|
||||
#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */
|
||||
#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
|
||||
#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */
|
||||
|
||||
/* Extended Capabilities (PCI-X 2.0 and Express) */
|
||||
#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
|
||||
#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf)
|
||||
#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc)
|
||||
|
||||
#define PCI_EXT_CAP_ID_ERR 1
|
||||
#define PCI_EXT_CAP_ID_VC 2
|
||||
#define PCI_EXT_CAP_ID_DSN 3
|
||||
#define PCI_EXT_CAP_ID_PWR 4
|
||||
#define PCI_EXT_CAP_ID_ARI 14
|
||||
#define PCI_EXT_CAP_ID_ATS 15
|
||||
#define PCI_EXT_CAP_ID_SRIOV 16
|
||||
|
||||
/* Advanced Error Reporting */
|
||||
#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
|
||||
#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */
|
||||
#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */
|
||||
#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */
|
||||
#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */
|
||||
#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */
|
||||
#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */
|
||||
#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */
|
||||
#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */
|
||||
#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */
|
||||
#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */
|
||||
#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */
|
||||
#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */
|
||||
/* Same bits as above */
|
||||
#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */
|
||||
/* Same bits as above */
|
||||
#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */
|
||||
#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */
|
||||
#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */
|
||||
#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */
|
||||
#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */
|
||||
#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */
|
||||
#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */
|
||||
/* Same bits as above */
|
||||
#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */
|
||||
#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */
|
||||
#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */
|
||||
#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */
|
||||
#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */
|
||||
#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */
|
||||
#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */
|
||||
#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */
|
||||
/* Correctable Err Reporting Enable */
|
||||
#define PCI_ERR_ROOT_CMD_COR_EN 0x00000001
|
||||
/* Non-fatal Err Reporting Enable */
|
||||
#define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002
|
||||
/* Fatal Err Reporting Enable */
|
||||
#define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004
|
||||
#define PCI_ERR_ROOT_STATUS 48
|
||||
#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */
|
||||
/* Multi ERR_COR Received */
|
||||
#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002
|
||||
/* ERR_FATAL/NONFATAL Recevied */
|
||||
#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004
|
||||
/* Multi ERR_FATAL/NONFATAL Recevied */
|
||||
#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008
|
||||
#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
|
||||
#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
|
||||
#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */
|
||||
#define PCI_ERR_ROOT_COR_SRC 52
|
||||
#define PCI_ERR_ROOT_SRC 54
|
||||
|
||||
/* Virtual Channel */
|
||||
#define PCI_VC_PORT_REG1 4
|
||||
#define PCI_VC_PORT_REG2 8
|
||||
#define PCI_VC_PORT_CTRL 12
|
||||
#define PCI_VC_PORT_STATUS 14
|
||||
#define PCI_VC_RES_CAP 16
|
||||
#define PCI_VC_RES_CTRL 20
|
||||
#define PCI_VC_RES_STATUS 26
|
||||
|
||||
/* Power Budgeting */
|
||||
#define PCI_PWR_DSR 4 /* Data Select Register */
|
||||
#define PCI_PWR_DATA 8 /* Data Register */
|
||||
#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */
|
||||
#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */
|
||||
#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */
|
||||
#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */
|
||||
#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */
|
||||
#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */
|
||||
#define PCI_PWR_CAP 12 /* Capability */
|
||||
#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
|
||||
|
||||
/*
|
||||
* Hypertransport sub capability types
|
||||
*
|
||||
* Unfortunately there are both 3 bit and 5 bit capability types defined
|
||||
* in the HT spec, catering for that is a little messy. You probably don't
|
||||
* want to use these directly, just use pci_find_ht_capability() and it
|
||||
* will do the right thing for you.
|
||||
*/
|
||||
#define HT_3BIT_CAP_MASK 0xE0
|
||||
#define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */
|
||||
#define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */
|
||||
|
||||
#define HT_5BIT_CAP_MASK 0xF8
|
||||
#define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */
|
||||
#define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */
|
||||
#define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */
|
||||
#define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */
|
||||
#define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */
|
||||
#define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */
|
||||
#define HT_MSI_FLAGS 0x02 /* Offset to flags */
|
||||
#define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */
|
||||
#define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */
|
||||
#define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */
|
||||
#define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */
|
||||
#define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */
|
||||
#define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */
|
||||
#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */
|
||||
#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */
|
||||
#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */
|
||||
#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */
|
||||
#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */
|
||||
|
||||
/* Alternative Routing-ID Interpretation */
|
||||
#define PCI_ARI_CAP 0x04 /* ARI Capability Register */
|
||||
#define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */
|
||||
#define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */
|
||||
#define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */
|
||||
#define PCI_ARI_CTRL 0x06 /* ARI Control Register */
|
||||
#define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */
|
||||
#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */
|
||||
#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */
|
||||
|
||||
/* Address Translation Service */
|
||||
#define PCI_ATS_CAP 0x04 /* ATS Capability Register */
|
||||
#define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f) /* Invalidate Queue Depth */
|
||||
#define PCI_ATS_MAX_QDEP 32 /* Max Invalidate Queue Depth */
|
||||
#define PCI_ATS_CTRL 0x06 /* ATS Control Register */
|
||||
#define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */
|
||||
#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */
|
||||
#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */
|
||||
|
||||
/* Single Root I/O Virtualization */
|
||||
#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
|
||||
#define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */
|
||||
#define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */
|
||||
#define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */
|
||||
#define PCI_SRIOV_CTRL_VFE 0x01 /* VF Enable */
|
||||
#define PCI_SRIOV_CTRL_VFM 0x02 /* VF Migration Enable */
|
||||
#define PCI_SRIOV_CTRL_INTR 0x04 /* VF Migration Interrupt Enable */
|
||||
#define PCI_SRIOV_CTRL_MSE 0x08 /* VF Memory Space Enable */
|
||||
#define PCI_SRIOV_CTRL_ARI 0x10 /* ARI Capable Hierarchy */
|
||||
#define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */
|
||||
#define PCI_SRIOV_STATUS_VFM 0x01 /* VF Migration Status */
|
||||
#define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */
|
||||
#define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */
|
||||
#define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */
|
||||
#define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */
|
||||
#define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */
|
||||
#define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */
|
||||
#define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */
|
||||
#define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */
|
||||
#define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */
|
||||
#define PCI_SRIOV_BAR 0x24 /* VF BAR0 */
|
||||
#define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */
|
||||
#define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/
|
||||
#define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */
|
||||
#define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */
|
||||
#define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */
|
||||
#define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */
|
||||
#define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */
|
||||
#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */
|
||||
|
||||
#endif /* LINUX_PCI_REGS_H */
|
||||
+17
-9
@@ -1981,24 +1981,32 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
|
||||
|
||||
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_AMD);
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_AMD_LANCE);
|
||||
*(uint16_t *)&pci_conf[0x04] = cpu_to_le16(0x0007);
|
||||
*(uint16_t *)&pci_conf[0x06] = cpu_to_le16(0x0280);
|
||||
pci_conf[0x08] = 0x10;
|
||||
pci_conf[0x09] = 0x00;
|
||||
/* TODO: value should be 0 at RST# */
|
||||
pci_set_word(pci_conf + PCI_COMMAND,
|
||||
PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
|
||||
pci_set_word(pci_conf + PCI_STATUS,
|
||||
PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);
|
||||
pci_conf[PCI_REVISION_ID] = 0x10;
|
||||
/* TODO: 0 is the default anyway, no need to set it. */
|
||||
pci_conf[PCI_CLASS_PROG] = 0x00;
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
|
||||
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
|
||||
|
||||
*(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001);
|
||||
*(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000);
|
||||
/* TODO: not necessary, is set when BAR is registered. */
|
||||
pci_set_long(pci_conf + PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_SPACE_IO);
|
||||
pci_set_long(pci_conf + PCI_BASE_ADDRESS_0 + 4,
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY);
|
||||
|
||||
pci_conf[0x3d] = 1; // interrupt pin 0
|
||||
pci_conf[0x3e] = 0x06;
|
||||
pci_conf[0x3f] = 0xff;
|
||||
/* TODO: value must be 0 at RST# */
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0
|
||||
pci_conf[PCI_MIN_GNT] = 0x06;
|
||||
pci_conf[PCI_MAX_LAT] = 0xff;
|
||||
|
||||
/* Handler for memory-mapped I/O */
|
||||
s->mmio_index =
|
||||
cpu_register_io_memory(pcnet_mmio_read, pcnet_mmio_write, &d->state);
|
||||
|
||||
/* TODO: use pci_dev, avoid cast below. */
|
||||
pci_register_bar((PCIDevice *)d, 0, PCNET_IOPORT_SIZE,
|
||||
PCI_BASE_ADDRESS_SPACE_IO, pcnet_ioport_map);
|
||||
|
||||
|
||||
@@ -38,13 +38,21 @@
|
||||
#define LMB_BRAM_SIZE (128 * 1024)
|
||||
#define FLASH_SIZE (16 * 1024 * 1024)
|
||||
|
||||
static uint32_t bootstrap_pc;
|
||||
static struct
|
||||
{
|
||||
uint32_t bootstrap_pc;
|
||||
uint32_t cmdline;
|
||||
uint32_t fdt;
|
||||
} boot_info;
|
||||
|
||||
static void main_cpu_reset(void *opaque)
|
||||
{
|
||||
CPUState *env = opaque;
|
||||
|
||||
cpu_reset(env);
|
||||
env->sregs[SR_PC] = bootstrap_pc;
|
||||
env->regs[5] = boot_info.cmdline;
|
||||
env->regs[7] = boot_info.fdt;
|
||||
env->sregs[SR_PC] = boot_info.bootstrap_pc;
|
||||
}
|
||||
|
||||
#define BINARY_DEVICE_TREE_FILE "petalogix-s3adsp1800.dtb"
|
||||
@@ -166,27 +174,24 @@ petalogix_s3adsp1800_init(ram_addr_t ram_size,
|
||||
1, ELF_MACHINE, 0);
|
||||
}
|
||||
/* Always boot into physical ram. */
|
||||
bootstrap_pc = ddr_base + (entry & 0x0fffffff);
|
||||
boot_info.bootstrap_pc = ddr_base + (entry & 0x0fffffff);
|
||||
if (kernel_size < 0) {
|
||||
/* If we failed loading ELF's try a raw image. */
|
||||
kernel_size = load_image_targphys(kernel_filename, ddr_base,
|
||||
ram_size);
|
||||
bootstrap_pc = ddr_base;
|
||||
boot_info.bootstrap_pc = ddr_base;
|
||||
}
|
||||
|
||||
env->regs[5] = ddr_base + kernel_size + 8192;
|
||||
boot_info.cmdline = ddr_base + kernel_size + 8192;
|
||||
if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) {
|
||||
pstrcpy_targphys("cmdline", env->regs[5], 256, kernel_cmdline);
|
||||
pstrcpy_targphys("cmdline", boot_info.cmdline, 256, kernel_cmdline);
|
||||
}
|
||||
env->regs[6] = 0;
|
||||
/* Provide a device-tree. */
|
||||
env->regs[7] = ddr_base + kernel_size + 256;
|
||||
petalogix_load_device_tree(env->regs[7], ram_size,
|
||||
env->regs[6], 0,
|
||||
boot_info.fdt = boot_info.cmdline + 256;
|
||||
petalogix_load_device_tree(boot_info.fdt, ram_size,
|
||||
0, 0,
|
||||
kernel_cmdline);
|
||||
}
|
||||
|
||||
env->sregs[SR_PC] = bootstrap_pc;
|
||||
}
|
||||
|
||||
static QEMUMachine petalogix_s3adsp1800_machine = {
|
||||
|
||||
+17
-5
@@ -29,6 +29,11 @@
|
||||
#include "isa.h"
|
||||
#include "sysbus.h"
|
||||
|
||||
/*
|
||||
* I440FX chipset data sheet.
|
||||
* http://download.intel.com/design/chipsets/datashts/29054901.pdf
|
||||
*/
|
||||
|
||||
typedef PCIHostState I440FXState;
|
||||
|
||||
typedef struct PIIX3State {
|
||||
@@ -44,6 +49,11 @@ struct PCII440FXState {
|
||||
PIIX3State *piix3;
|
||||
};
|
||||
|
||||
|
||||
#define I440FX_PAM 0x59
|
||||
#define I440FX_PAM_SIZE 7
|
||||
#define I440FX_SMRAM 0x72
|
||||
|
||||
static void piix3_set_irq(void *opaque, int irq_num, int level);
|
||||
|
||||
/* return the global irq number corresponding to a given device irq
|
||||
@@ -88,12 +98,12 @@ static void i440fx_update_memory_mappings(PCII440FXState *d)
|
||||
int i, r;
|
||||
uint32_t smram, addr;
|
||||
|
||||
update_pam(d, 0xf0000, 0x100000, (d->dev.config[0x59] >> 4) & 3);
|
||||
update_pam(d, 0xf0000, 0x100000, (d->dev.config[I440FX_PAM] >> 4) & 3);
|
||||
for(i = 0; i < 12; i++) {
|
||||
r = (d->dev.config[(i >> 1) + 0x5a] >> ((i & 1) * 4)) & 3;
|
||||
r = (d->dev.config[(i >> 1) + (I440FX_PAM + 1)] >> ((i & 1) * 4)) & 3;
|
||||
update_pam(d, 0xc0000 + 0x4000 * i, 0xc0000 + 0x4000 * (i + 1), r);
|
||||
}
|
||||
smram = d->dev.config[0x72];
|
||||
smram = d->dev.config[I440FX_SMRAM];
|
||||
if ((d->smm_enabled && (smram & 0x08)) || (smram & 0x40)) {
|
||||
cpu_register_physical_memory(0xa0000, 0x20000, 0xa0000);
|
||||
} else {
|
||||
@@ -132,8 +142,10 @@ static void i440fx_write_config(PCIDevice *dev,
|
||||
|
||||
/* XXX: implement SMRAM.D_LOCK */
|
||||
pci_default_write_config(dev, address, val, len);
|
||||
if ((address >= 0x59 && address <= 0x5f) || address == 0x72)
|
||||
if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
|
||||
range_covers_byte(address, len, I440FX_SMRAM)) {
|
||||
i440fx_update_memory_mappings(d);
|
||||
}
|
||||
}
|
||||
|
||||
static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
|
||||
@@ -196,7 +208,7 @@ static int i440fx_initfn(PCIDevice *dev)
|
||||
pci_config_set_class(d->dev.config, PCI_CLASS_BRIDGE_HOST);
|
||||
d->dev.config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
|
||||
|
||||
d->dev.config[0x72] = 0x02; /* SMRAM */
|
||||
d->dev.config[I440FX_SMRAM] = 0x02;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ static inline uint64_t cpu_ppc_get_tb(ppc_tb_t *tb_env, uint64_t vmclk,
|
||||
return muldiv64(vmclk, tb_env->tb_freq, get_ticks_per_sec()) + tb_offset;
|
||||
}
|
||||
|
||||
uint32_t cpu_ppc_load_tbl (CPUState *env)
|
||||
uint64_t cpu_ppc_load_tbl (CPUState *env)
|
||||
{
|
||||
ppc_tb_t *tb_env = env->tb_env;
|
||||
uint64_t tb;
|
||||
@@ -409,7 +409,7 @@ uint32_t cpu_ppc_load_tbl (CPUState *env)
|
||||
tb = cpu_ppc_get_tb(tb_env, qemu_get_clock(vm_clock), tb_env->tb_offset);
|
||||
LOG_TB("%s: tb %016" PRIx64 "\n", __func__, tb);
|
||||
|
||||
return tb & 0xFFFFFFFF;
|
||||
return tb;
|
||||
}
|
||||
|
||||
static inline uint32_t _cpu_ppc_load_tbu(CPUState *env)
|
||||
@@ -463,7 +463,7 @@ void cpu_ppc_store_tbu (CPUState *env, uint32_t value)
|
||||
_cpu_ppc_store_tbu(env, value);
|
||||
}
|
||||
|
||||
uint32_t cpu_ppc_load_atbl (CPUState *env)
|
||||
uint64_t cpu_ppc_load_atbl (CPUState *env)
|
||||
{
|
||||
ppc_tb_t *tb_env = env->tb_env;
|
||||
uint64_t tb;
|
||||
@@ -471,7 +471,7 @@ uint32_t cpu_ppc_load_atbl (CPUState *env)
|
||||
tb = cpu_ppc_get_tb(tb_env, qemu_get_clock(vm_clock), tb_env->atb_offset);
|
||||
LOG_TB("%s: tb %016" PRIx64 "\n", __func__, tb);
|
||||
|
||||
return tb & 0xFFFFFFFF;
|
||||
return tb;
|
||||
}
|
||||
|
||||
uint32_t cpu_ppc_load_atbu (CPUState *env)
|
||||
@@ -1009,7 +1009,7 @@ struct ppc_dcr_t {
|
||||
int (*write_error)(int dcrn);
|
||||
};
|
||||
|
||||
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp)
|
||||
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp)
|
||||
{
|
||||
ppc_dcrn_t *dcr;
|
||||
|
||||
@@ -1029,7 +1029,7 @@ int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val)
|
||||
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc_dcrn_t *dcr;
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ static inline void clk_setup (clk_setup_t *clk, uint32_t freq)
|
||||
|
||||
clk_setup_cb cpu_ppc_tb_init (CPUState *env, uint32_t freq);
|
||||
/* Embedded PowerPC DCR management */
|
||||
typedef target_ulong (*dcr_read_cb)(void *opaque, int dcrn);
|
||||
typedef void (*dcr_write_cb)(void *opaque, int dcrn, target_ulong val);
|
||||
typedef uint32_t (*dcr_read_cb)(void *opaque, int dcrn);
|
||||
typedef void (*dcr_write_cb)(void *opaque, int dcrn, uint32_t val);
|
||||
int ppc_dcr_init (CPUState *env, int (*dcr_read_error)(int dcrn),
|
||||
int (*dcr_write_error)(int dcrn));
|
||||
int ppc_dcr_register (CPUState *env, int dcrn, void *opaque,
|
||||
|
||||
+23
-23
@@ -107,10 +107,10 @@ struct ppc4xx_plb_t {
|
||||
uint32_t besr;
|
||||
};
|
||||
|
||||
static target_ulong dcr_read_plb (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_plb (void *opaque, int dcrn)
|
||||
{
|
||||
ppc4xx_plb_t *plb;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
plb = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -132,7 +132,7 @@ static target_ulong dcr_read_plb (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_plb (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_plb (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc4xx_plb_t *plb;
|
||||
|
||||
@@ -189,10 +189,10 @@ struct ppc4xx_pob_t {
|
||||
uint32_t besr[2];
|
||||
};
|
||||
|
||||
static target_ulong dcr_read_pob (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_pob (void *opaque, int dcrn)
|
||||
{
|
||||
ppc4xx_pob_t *pob;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
pob = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -212,7 +212,7 @@ static target_ulong dcr_read_pob (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_pob (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_pob (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc4xx_pob_t *pob;
|
||||
|
||||
@@ -410,10 +410,10 @@ enum {
|
||||
EBC0_CFGDATA = 0x013,
|
||||
};
|
||||
|
||||
static target_ulong dcr_read_ebc (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_ebc (void *opaque, int dcrn)
|
||||
{
|
||||
ppc4xx_ebc_t *ebc;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
ebc = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -494,7 +494,7 @@ static target_ulong dcr_read_ebc (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_ebc (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_ebc (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc4xx_ebc_t *ebc;
|
||||
|
||||
@@ -627,7 +627,7 @@ struct ppc405_dma_t {
|
||||
uint32_t pol;
|
||||
};
|
||||
|
||||
static target_ulong dcr_read_dma (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_dma (void *opaque, int dcrn)
|
||||
{
|
||||
ppc405_dma_t *dma;
|
||||
|
||||
@@ -636,7 +636,7 @@ static target_ulong dcr_read_dma (void *opaque, int dcrn)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dcr_write_dma (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_dma (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc405_dma_t *dma;
|
||||
|
||||
@@ -914,10 +914,10 @@ static void ocm_update_mappings (ppc405_ocm_t *ocm,
|
||||
}
|
||||
}
|
||||
|
||||
static target_ulong dcr_read_ocm (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_ocm (void *opaque, int dcrn)
|
||||
{
|
||||
ppc405_ocm_t *ocm;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
ocm = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -941,7 +941,7 @@ static target_ulong dcr_read_ocm (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_ocm (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_ocm (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc405_ocm_t *ocm;
|
||||
uint32_t isarc, dsarc, isacntl, dsacntl;
|
||||
@@ -1578,10 +1578,10 @@ struct ppc40x_mal_t {
|
||||
|
||||
static void ppc40x_mal_reset (void *opaque);
|
||||
|
||||
static target_ulong dcr_read_mal (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_mal (void *opaque, int dcrn)
|
||||
{
|
||||
ppc40x_mal_t *mal;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
mal = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -1650,7 +1650,7 @@ static target_ulong dcr_read_mal (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_mal (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_mal (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc40x_mal_t *mal;
|
||||
int idx;
|
||||
@@ -1951,10 +1951,10 @@ static void ppc405cr_clk_setup (ppc405cr_cpc_t *cpc)
|
||||
clk_setup(&cpc->clk_setup[PPC405CR_UART_CLK], UART_clk);
|
||||
}
|
||||
|
||||
static target_ulong dcr_read_crcpc (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_crcpc (void *opaque, int dcrn)
|
||||
{
|
||||
ppc405cr_cpc_t *cpc;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
cpc = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -1991,7 +1991,7 @@ static target_ulong dcr_read_crcpc (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_crcpc (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_crcpc (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc405cr_cpc_t *cpc;
|
||||
|
||||
@@ -2353,10 +2353,10 @@ static void ppc405ep_compute_clocks (ppc405ep_cpc_t *cpc)
|
||||
clk_setup(&cpc->clk_setup[PPC405EP_UART1_CLK], UART1_clk);
|
||||
}
|
||||
|
||||
static target_ulong dcr_read_epcpc (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_epcpc (void *opaque, int dcrn)
|
||||
{
|
||||
ppc405ep_cpc_t *cpc;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
cpc = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -2393,7 +2393,7 @@ static target_ulong dcr_read_epcpc (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_epcpc (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_epcpc (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc405ep_cpc_t *cpc;
|
||||
|
||||
|
||||
+7
-7
@@ -183,10 +183,10 @@ static void ppcuic_set_irq (void *opaque, int irq_num, int level)
|
||||
ppcuic_trigger_irq(uic);
|
||||
}
|
||||
|
||||
static target_ulong dcr_read_uic (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_uic (void *opaque, int dcrn)
|
||||
{
|
||||
ppcuic_t *uic;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
uic = opaque;
|
||||
dcrn -= uic->dcr_base;
|
||||
@@ -229,13 +229,13 @@ static target_ulong dcr_read_uic (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_uic (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_uic (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppcuic_t *uic;
|
||||
|
||||
uic = opaque;
|
||||
dcrn -= uic->dcr_base;
|
||||
LOG_UIC("%s: dcr %d val " TARGET_FMT_lx "\n", __func__, dcrn, val);
|
||||
LOG_UIC("%s: dcr %d val 0x%x\n", __func__, dcrn, val);
|
||||
switch (dcrn) {
|
||||
case DCR_UICSR:
|
||||
uic->uicsr &= ~val;
|
||||
@@ -448,10 +448,10 @@ static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram)
|
||||
}
|
||||
}
|
||||
|
||||
static target_ulong dcr_read_sdram (void *opaque, int dcrn)
|
||||
static uint32_t dcr_read_sdram (void *opaque, int dcrn)
|
||||
{
|
||||
ppc4xx_sdram_t *sdram;
|
||||
target_ulong ret;
|
||||
uint32_t ret;
|
||||
|
||||
sdram = opaque;
|
||||
switch (dcrn) {
|
||||
@@ -516,7 +516,7 @@ static target_ulong dcr_read_sdram (void *opaque, int dcrn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dcr_write_sdram (void *opaque, int dcrn, target_ulong val)
|
||||
static void dcr_write_sdram (void *opaque, int dcrn, uint32_t val)
|
||||
{
|
||||
ppc4xx_sdram_t *sdram;
|
||||
|
||||
|
||||
+8
-5
@@ -108,7 +108,6 @@ static void ppc_core99_init (ram_addr_t ram_size,
|
||||
MacIONVRAMState *nvr;
|
||||
int nvram_mem_index;
|
||||
int vga_bios_size, bios_size;
|
||||
qemu_irq *dummy_irq;
|
||||
int pic_mem_index, dbdma_mem_index, cuda_mem_index, escc_mem_index;
|
||||
int ppc_boot_device;
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
@@ -120,7 +119,11 @@ static void ppc_core99_init (ram_addr_t ram_size,
|
||||
|
||||
/* init CPUs */
|
||||
if (cpu_model == NULL)
|
||||
#ifdef TARGET_PPC64
|
||||
cpu_model = "970fx";
|
||||
#else
|
||||
cpu_model = "G4";
|
||||
#endif
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
@@ -318,10 +321,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
|
||||
/* init basic PC hardware */
|
||||
pci_vga_init(pci_bus, vga_bios_offset, vga_bios_size);
|
||||
|
||||
/* XXX: suppress that */
|
||||
dummy_irq = i8259_init(NULL);
|
||||
|
||||
escc_mem_index = escc_init(0x80013000, dummy_irq[4], dummy_irq[5],
|
||||
escc_mem_index = escc_init(0x80013000, pic[0x25], pic[0x24],
|
||||
serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
|
||||
|
||||
for(i = 0; i < nb_nics; i++)
|
||||
@@ -389,6 +389,9 @@ static QEMUMachine core99_machine = {
|
||||
.desc = "Mac99 based PowerMAC",
|
||||
.init = ppc_core99_init,
|
||||
.max_cpus = MAX_CPUS,
|
||||
#ifdef TARGET_PPC64
|
||||
.is_default = 1,
|
||||
#endif
|
||||
};
|
||||
|
||||
static void core99_machine_init(void)
|
||||
|
||||
@@ -409,7 +409,9 @@ static QEMUMachine heathrow_machine = {
|
||||
.desc = "Heathrow based PowerMAC",
|
||||
.init = ppc_heathrow_init,
|
||||
.max_cpus = MAX_CPUS,
|
||||
#ifndef TARGET_PPC64
|
||||
.is_default = 1,
|
||||
#endif
|
||||
};
|
||||
|
||||
static void heathrow_machine_init(void)
|
||||
|
||||
+23
-11
@@ -500,7 +500,12 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
|
||||
dev->info->name, name);
|
||||
return -1;
|
||||
}
|
||||
return prop->info->parse(dev, prop, value);
|
||||
if (prop->info->parse(dev, prop, value) != 0) {
|
||||
fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
|
||||
dev->info->name, name, value);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyType type)
|
||||
@@ -593,26 +598,33 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props)
|
||||
}
|
||||
}
|
||||
|
||||
static CompatProperty *compat_props;
|
||||
static QTAILQ_HEAD(, GlobalProperty) global_props = QTAILQ_HEAD_INITIALIZER(global_props);
|
||||
|
||||
void qdev_prop_register_compat(CompatProperty *props)
|
||||
void qdev_prop_register_global(GlobalProperty *prop)
|
||||
{
|
||||
compat_props = props;
|
||||
QTAILQ_INSERT_TAIL(&global_props, prop, next);
|
||||
}
|
||||
|
||||
void qdev_prop_set_compat(DeviceState *dev)
|
||||
void qdev_prop_register_global_list(GlobalProperty *props)
|
||||
{
|
||||
CompatProperty *prop;
|
||||
int i;
|
||||
|
||||
if (!compat_props) {
|
||||
return;
|
||||
for (i = 0; props[i].driver != NULL; i++) {
|
||||
qdev_prop_register_global(props+i);
|
||||
}
|
||||
for (prop = compat_props; prop->driver != NULL; prop++) {
|
||||
if (strcmp(dev->info->name, prop->driver) != 0) {
|
||||
}
|
||||
|
||||
void qdev_prop_set_globals(DeviceState *dev)
|
||||
{
|
||||
GlobalProperty *prop;
|
||||
|
||||
QTAILQ_FOREACH(prop, &global_props, next) {
|
||||
if (strcmp(dev->info->name, prop->driver) != 0 &&
|
||||
strcmp(dev->info->bus_info->name, prop->driver) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (qdev_prop_parse(dev, prop->property, prop->value) != 0) {
|
||||
abort();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ DeviceState *qdev_create(BusState *bus, const char *name)
|
||||
dev->parent_bus = bus;
|
||||
qdev_prop_set_defaults(dev, dev->info->props);
|
||||
qdev_prop_set_defaults(dev, dev->parent_bus->info->props);
|
||||
qdev_prop_set_compat(dev);
|
||||
qdev_prop_set_globals(dev);
|
||||
QLIST_INSERT_HEAD(&bus->children, dev, sibling);
|
||||
if (qdev_hotplug) {
|
||||
assert(bus->allow_hotplug);
|
||||
|
||||
@@ -92,11 +92,12 @@ struct PropertyInfo {
|
||||
int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
|
||||
};
|
||||
|
||||
struct CompatProperty {
|
||||
typedef struct GlobalProperty {
|
||||
const char *driver;
|
||||
const char *property;
|
||||
const char *value;
|
||||
};
|
||||
QTAILQ_ENTRY(GlobalProperty) next;
|
||||
} GlobalProperty;
|
||||
|
||||
/*** Board API. This should go away once we have a machine config file. ***/
|
||||
|
||||
@@ -256,8 +257,9 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value);
|
||||
void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);
|
||||
void qdev_prop_set_defaults(DeviceState *dev, Property *props);
|
||||
|
||||
void qdev_prop_register_compat(CompatProperty *props);
|
||||
void qdev_prop_set_compat(DeviceState *dev);
|
||||
void qdev_prop_register_global(GlobalProperty *prop);
|
||||
void qdev_prop_register_global_list(GlobalProperty *props);
|
||||
void qdev_prop_set_globals(DeviceState *dev);
|
||||
|
||||
/* This is a nasty hack to allow passing a NULL bus to qdev_create. */
|
||||
extern struct BusInfo system_bus_info;
|
||||
|
||||
+10
-2
@@ -192,11 +192,19 @@ static void realview_init(ram_addr_t ram_size,
|
||||
proc_id = 0x02000000;
|
||||
}
|
||||
|
||||
if (is_pb && ram_size > 0x20000000) {
|
||||
/* Core tile RAM. */
|
||||
low_ram_size = ram_size - 0x20000000;
|
||||
ram_size = 0x20000000;
|
||||
ram_offset = qemu_ram_alloc(low_ram_size);
|
||||
cpu_register_physical_memory(0x20000000, low_ram_size,
|
||||
ram_offset | IO_MEM_RAM);
|
||||
}
|
||||
|
||||
ram_offset = qemu_ram_alloc(ram_size);
|
||||
low_ram_size = ram_size;
|
||||
if (low_ram_size > 0x10000000)
|
||||
low_ram_size = 0x10000000;
|
||||
/* ??? RAM should repeat to fill physical memory space. */
|
||||
/* SDRAM at address zero. */
|
||||
cpu_register_physical_memory(0, low_ram_size, ram_offset | IO_MEM_RAM);
|
||||
if (is_pb) {
|
||||
@@ -356,7 +364,7 @@ static void realview_init(ram_addr_t ram_size,
|
||||
realview_binfo.initrd_filename = initrd_filename;
|
||||
realview_binfo.nb_cpus = smp_cpus;
|
||||
realview_binfo.board_id = realview_board_id[board_type];
|
||||
realview_binfo.loader_start = is_pb ? 0x70000000 : 0;
|
||||
realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0);
|
||||
arm_load_kernel(first_cpu, &realview_binfo);
|
||||
}
|
||||
|
||||
|
||||
+11
-14
@@ -3320,16 +3320,20 @@ static int pci_rtl8139_init(PCIDevice *dev)
|
||||
pci_conf = s->dev.config;
|
||||
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
|
||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139);
|
||||
pci_conf[0x04] = 0x05; /* command = I/O space, Bus Master */
|
||||
pci_conf[0x08] = RTL8139_PCI_REVID; /* PCI revision ID; >=0x20 is for 8139C+ */
|
||||
/* TODO: value should be 0 at RST#. */
|
||||
pci_conf[PCI_COMMAND] = PCI_COMMAND_IO | PCI_COMMAND_MASTER;
|
||||
pci_conf[PCI_REVISION_ID] = RTL8139_PCI_REVID; /* >=0x20 is for 8139C+ */
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
|
||||
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; /* header_type */
|
||||
pci_conf[0x3d] = 1; /* interrupt pin 0 */
|
||||
pci_conf[0x34] = 0xdc;
|
||||
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL;
|
||||
/* TODO: value should be 0 at RST# */
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin 0 */
|
||||
/* TODO: start of capability list, but no capability
|
||||
* list bit in status register, and offset 0xdc seems unused. */
|
||||
pci_conf[PCI_CAPABILITY_LIST] = 0xdc;
|
||||
|
||||
/* I/O handler for memory-mapped I/O */
|
||||
s->rtl8139_mmio_io_addr =
|
||||
cpu_register_io_memory(rtl8139_mmio_read, rtl8139_mmio_write, s);
|
||||
cpu_register_io_memory(rtl8139_mmio_read, rtl8139_mmio_write, s);
|
||||
|
||||
pci_register_bar(&s->dev, 0, 0x100,
|
||||
PCI_BASE_ADDRESS_SPACE_IO, rtl8139_ioport_map);
|
||||
@@ -3353,14 +3357,6 @@ static int pci_rtl8139_init(PCIDevice *dev)
|
||||
qemu_mod_timer(s->timer,
|
||||
rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock)));
|
||||
#endif /* RTL8139_ONBOARD_TIMER */
|
||||
|
||||
if (!dev->qdev.hotplugged) {
|
||||
static int loaded = 0;
|
||||
if (!loaded) {
|
||||
rom_add_option("pxe-rtl8139.bin");
|
||||
loaded = 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3371,6 +3367,7 @@ static PCIDeviceInfo rtl8139_info = {
|
||||
.qdev.vmsd = &vmstate_rtl8139,
|
||||
.init = pci_rtl8139_init,
|
||||
.exit = pci_rtl8139_uninit,
|
||||
.romfile = "pxe-rtl8139.bin",
|
||||
.qdev.props = (Property[]) {
|
||||
DEFINE_NIC_PROPERTIES(RTL8139State, conf),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
|
||||
@@ -307,7 +307,7 @@ static void virtio_s390_notify(void *opaque, uint16_t vector)
|
||||
uint64_t token = s390_virtio_device_vq_token(dev, vector);
|
||||
|
||||
/* XXX kvm dependency! */
|
||||
kvm_s390_virtio_irq(s390_cpu_addr2state(0), 1, token);
|
||||
kvm_s390_virtio_irq(s390_cpu_addr2state(0), 0, token);
|
||||
}
|
||||
|
||||
/**************** S390 Virtio Bus Device Descriptions *******************/
|
||||
|
||||
+18
-3
@@ -142,6 +142,13 @@ static void s390_init(ram_addr_t ram_size,
|
||||
ram_addr_t initrd_size = 0;
|
||||
int i;
|
||||
|
||||
/* XXX we only work on KVM for now */
|
||||
|
||||
if (!kvm_enabled()) {
|
||||
fprintf(stderr, "The S390 target only works with KVM enabled\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* get a BUS */
|
||||
s390_bus = s390_virtio_bus_init(&ram_size);
|
||||
|
||||
@@ -181,7 +188,7 @@ static void s390_init(ram_addr_t ram_size,
|
||||
|
||||
cpu_synchronize_state(env);
|
||||
env->psw.addr = KERN_IMAGE_START;
|
||||
env->psw.mask = 0x0000000180000000UL;
|
||||
env->psw.mask = 0x0000000180000000ULL;
|
||||
}
|
||||
|
||||
if (initrd_filename) {
|
||||
@@ -201,7 +208,11 @@ static void s390_init(ram_addr_t ram_size,
|
||||
}
|
||||
|
||||
/* Create VirtIO console */
|
||||
qdev_init_nofail(qdev_create((BusState *)s390_bus, "virtio-console-s390"));
|
||||
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
|
||||
if (virtcon_hds[i]) {
|
||||
qdev_init_nofail(qdev_create((BusState *)s390_bus, "virtio-console-s390"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Create VirtIO network adapters */
|
||||
for(i = 0; i < nb_nics; i++) {
|
||||
@@ -209,7 +220,7 @@ static void s390_init(ram_addr_t ram_size,
|
||||
DeviceState *dev;
|
||||
|
||||
if (!nd->model) {
|
||||
nd->model = (char*)"virtio";
|
||||
nd->model = qemu_strdup("virtio");
|
||||
}
|
||||
|
||||
if (strcmp(nd->model, "virtio")) {
|
||||
@@ -243,6 +254,10 @@ static QEMUMachine s390_machine = {
|
||||
.alias = "s390",
|
||||
.desc = "VirtIO based S390 machine",
|
||||
.init = s390_init,
|
||||
.no_serial = 1,
|
||||
.no_parallel = 1,
|
||||
.use_virtcon = 1,
|
||||
.no_vga = 1,
|
||||
.max_cpus = 255,
|
||||
.is_default = 1,
|
||||
};
|
||||
|
||||
+2
-2
@@ -374,6 +374,7 @@ static const char *scsi_command_name(uint8_t cmd)
|
||||
static const char *names[] = {
|
||||
[ TEST_UNIT_READY ] = "TEST_UNIT_READY",
|
||||
[ REZERO_UNIT ] = "REZERO_UNIT",
|
||||
/* REWIND and REZERO_UNIT use the same operation code */
|
||||
[ REQUEST_SENSE ] = "REQUEST_SENSE",
|
||||
[ FORMAT_UNIT ] = "FORMAT_UNIT",
|
||||
[ READ_BLOCK_LIMITS ] = "READ_BLOCK_LIMITS",
|
||||
@@ -409,7 +410,7 @@ static const char *scsi_command_name(uint8_t cmd)
|
||||
[ SEARCH_LOW ] = "SEARCH_LOW",
|
||||
[ SET_LIMITS ] = "SET_LIMITS",
|
||||
[ PRE_FETCH ] = "PRE_FETCH",
|
||||
[ READ_POSITION ] = "READ_POSITION",
|
||||
/* READ_POSITION and PRE_FETCH use the same operation code */
|
||||
[ SYNCHRONIZE_CACHE ] = "SYNCHRONIZE_CACHE",
|
||||
[ LOCK_UNLOCK_CACHE ] = "LOCK_UNLOCK_CACHE",
|
||||
[ READ_DEFECT_DATA ] = "READ_DEFECT_DATA",
|
||||
@@ -443,7 +444,6 @@ static const char *scsi_command_name(uint8_t cmd)
|
||||
[ SEND_VOLUME_TAG ] = "SEND_VOLUME_TAG",
|
||||
[ WRITE_LONG_2 ] = "WRITE_LONG_2",
|
||||
|
||||
[ REWIND ] = "REWIND",
|
||||
[ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT",
|
||||
[ GET_CONFIGURATION ] = "GET_CONFIGURATION",
|
||||
[ READ_16 ] = "READ_16",
|
||||
|
||||
+15
-6
@@ -5,6 +5,12 @@
|
||||
* Based on code by Fabrice Bellard
|
||||
*
|
||||
* Written by Paul Brook
|
||||
* Modifications:
|
||||
* 2009-Dec-12 Artyom Tarasenko : implemented stamdard inquiry for the case
|
||||
* when the allocation length of CDB is smaller
|
||||
* than 36.
|
||||
* 2009-Oct-13 Artyom Tarasenko : implemented the block descriptor in the
|
||||
* MODE SENSE response.
|
||||
*
|
||||
* This code is licenced under the LGPL.
|
||||
*
|
||||
@@ -406,11 +412,6 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (req->cmd.xfer < 36) {
|
||||
BADF("Error: Inquiry (STANDARD) buffer size %zd "
|
||||
"is less than 36 (TODO: only 5 required)\n", req->cmd.xfer);
|
||||
}
|
||||
|
||||
buflen = req->cmd.xfer;
|
||||
if (buflen > SCSI_MAX_INQUIRY_LEN)
|
||||
buflen = SCSI_MAX_INQUIRY_LEN;
|
||||
@@ -436,7 +437,15 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
|
||||
Some later commands are also implemented. */
|
||||
outbuf[2] = 3;
|
||||
outbuf[3] = 2; /* Format 2 */
|
||||
outbuf[4] = buflen - 5; /* Additional Length = (Len - 1) - 4 */
|
||||
|
||||
if (buflen > 36) {
|
||||
outbuf[4] = buflen - 5; /* Additional Length = (Len - 1) - 4 */
|
||||
} else {
|
||||
/* If the allocation length of CDB is too small,
|
||||
the additional length is not adjusted */
|
||||
outbuf[4] = 36 - 5;
|
||||
}
|
||||
|
||||
/* Sync data transfer and TCQ. */
|
||||
outbuf[7] = 0x10 | (req->bus->tcq ? 0x02 : 0);
|
||||
return buflen;
|
||||
|
||||
@@ -669,6 +669,10 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: /* CMD5: reserved for SDIO cards */
|
||||
sd->card_status |= ILLEGAL_COMMAND;
|
||||
return sd_r0;
|
||||
|
||||
case 6: /* CMD6: SWITCH_FUNCTION */
|
||||
if (sd->spi)
|
||||
goto bad_cmd;
|
||||
|
||||
+50
-1
@@ -95,7 +95,7 @@ struct sun4m_hwdef {
|
||||
target_phys_addr_t iommu_base, slavio_base;
|
||||
target_phys_addr_t intctl_base, counter_base, nvram_base, ms_kb_base;
|
||||
target_phys_addr_t serial_base, fd_base;
|
||||
target_phys_addr_t idreg_base, dma_base, esp_base, le_base;
|
||||
target_phys_addr_t afx_base, idreg_base, dma_base, esp_base, le_base;
|
||||
target_phys_addr_t tcx_base, cs_base, apc_base, aux1_base, aux2_base;
|
||||
target_phys_addr_t ecc_base;
|
||||
uint32_t ecc_version;
|
||||
@@ -600,6 +600,41 @@ static void idreg_register_devices(void)
|
||||
|
||||
device_init(idreg_register_devices);
|
||||
|
||||
/* SS-5 TCX AFX register */
|
||||
static void afx_init(target_phys_addr_t addr)
|
||||
{
|
||||
DeviceState *dev;
|
||||
SysBusDevice *s;
|
||||
|
||||
dev = qdev_create(NULL, "tcx_afx");
|
||||
qdev_init_nofail(dev);
|
||||
s = sysbus_from_qdev(dev);
|
||||
|
||||
sysbus_mmio_map(s, 0, addr);
|
||||
}
|
||||
|
||||
static int afx_init1(SysBusDevice *dev)
|
||||
{
|
||||
ram_addr_t afx_offset;
|
||||
|
||||
afx_offset = qemu_ram_alloc(4);
|
||||
sysbus_init_mmio(dev, 4, afx_offset | IO_MEM_RAM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SysBusDeviceInfo afx_info = {
|
||||
.init = afx_init1,
|
||||
.qdev.name = "tcx_afx",
|
||||
.qdev.size = sizeof(SysBusDevice),
|
||||
};
|
||||
|
||||
static void afx_register_devices(void)
|
||||
{
|
||||
sysbus_register_withprop(&afx_info);
|
||||
}
|
||||
|
||||
device_init(afx_register_devices);
|
||||
|
||||
/* Boot PROM (OpenBIOS) */
|
||||
static void prom_init(target_phys_addr_t addr, const char *bios_name)
|
||||
{
|
||||
@@ -795,6 +830,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
|
||||
idreg_init(hwdef->idreg_base);
|
||||
}
|
||||
|
||||
if (hwdef->afx_base) {
|
||||
afx_init(hwdef->afx_base);
|
||||
}
|
||||
|
||||
iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version,
|
||||
slavio_irq[30]);
|
||||
|
||||
@@ -878,6 +917,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
|
||||
if (kernel_cmdline) {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR);
|
||||
pstrcpy_targphys("cmdline", CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_CMDLINE_DATA,
|
||||
(uint8_t*)strdup(kernel_cmdline),
|
||||
strlen(kernel_cmdline) + 1);
|
||||
} else {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
||||
}
|
||||
@@ -920,6 +962,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
|
||||
.esp_base = 0x78800000,
|
||||
.le_base = 0x78c00000,
|
||||
.apc_base = 0x6a000000,
|
||||
.afx_base = 0x6e000000,
|
||||
.aux1_base = 0x71900000,
|
||||
.aux2_base = 0x71910000,
|
||||
.nvram_machine_id = 0x80,
|
||||
@@ -1460,6 +1503,9 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
|
||||
if (kernel_cmdline) {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR);
|
||||
pstrcpy_targphys("cmdline", CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_CMDLINE_DATA,
|
||||
(uint8_t*)strdup(kernel_cmdline),
|
||||
strlen(kernel_cmdline) + 1);
|
||||
} else {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
||||
}
|
||||
@@ -1648,6 +1694,9 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
|
||||
if (kernel_cmdline) {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR);
|
||||
pstrcpy_targphys("cmdline", CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_CMDLINE_DATA,
|
||||
(uint8_t*)strdup(kernel_cmdline),
|
||||
strlen(kernel_cmdline) + 1);
|
||||
} else {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
||||
}
|
||||
|
||||
+19
-7
@@ -39,12 +39,20 @@
|
||||
#include "elf.h"
|
||||
|
||||
//#define DEBUG_IRQ
|
||||
//#define DEBUG_EBUS
|
||||
|
||||
#ifdef DEBUG_IRQ
|
||||
#define DPRINTF(fmt, ...) \
|
||||
#define CPUIRQ_DPRINTF(fmt, ...) \
|
||||
do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define DPRINTF(fmt, ...)
|
||||
#define CPUIRQ_DPRINTF(fmt, ...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_EBUS
|
||||
#define EBUS_DPRINTF(fmt, ...) \
|
||||
do { printf("EBUS: " fmt , ## __VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define EBUS_DPRINTF(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define KERNEL_LOAD_ADDR 0x00404000
|
||||
@@ -238,14 +246,14 @@ void cpu_check_irqs(CPUState *env)
|
||||
|
||||
env->interrupt_index = TT_EXTINT | i;
|
||||
if (old_interrupt != env->interrupt_index) {
|
||||
DPRINTF("Set CPU IRQ %d\n", i);
|
||||
CPUIRQ_DPRINTF("Set CPU IRQ %d\n", i);
|
||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (!pil && (env->interrupt_index & ~15) == TT_EXTINT) {
|
||||
DPRINTF("Reset CPU IRQ %d\n", env->interrupt_index & 15);
|
||||
CPUIRQ_DPRINTF("Reset CPU IRQ %d\n", env->interrupt_index & 15);
|
||||
env->interrupt_index = 0;
|
||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
||||
}
|
||||
@@ -256,12 +264,12 @@ static void cpu_set_irq(void *opaque, int irq, int level)
|
||||
CPUState *env = opaque;
|
||||
|
||||
if (level) {
|
||||
DPRINTF("Raise CPU IRQ %d\n", irq);
|
||||
CPUIRQ_DPRINTF("Raise CPU IRQ %d\n", irq);
|
||||
env->halted = 0;
|
||||
env->pil_in |= 1 << irq;
|
||||
cpu_check_irqs(env);
|
||||
} else {
|
||||
DPRINTF("Lower CPU IRQ %d\n", irq);
|
||||
CPUIRQ_DPRINTF("Lower CPU IRQ %d\n", irq);
|
||||
env->pil_in &= ~(1 << irq);
|
||||
cpu_check_irqs(env);
|
||||
}
|
||||
@@ -347,7 +355,8 @@ void cpu_tick_set_limit(void *opaque, uint64_t limit)
|
||||
static void ebus_mmio_mapfunc(PCIDevice *pci_dev, int region_num,
|
||||
pcibus_t addr, pcibus_t size, int type)
|
||||
{
|
||||
DPRINTF("Mapping region %d registers at %08x\n", region_num, addr);
|
||||
EBUS_DPRINTF("Mapping region %d registers at %" FMT_PCIBUS "\n",
|
||||
region_num, addr);
|
||||
switch (region_num) {
|
||||
case 0:
|
||||
isa_mmio_init(addr, 0x1000000);
|
||||
@@ -652,6 +661,9 @@ static void sun4uv_init(ram_addr_t RAM_size,
|
||||
if (kernel_cmdline) {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR);
|
||||
pstrcpy_targphys("cmdline", CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_CMDLINE_DATA,
|
||||
(uint8_t*)strdup(kernel_cmdline),
|
||||
strlen(kernel_cmdline) + 1);
|
||||
} else {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
||||
}
|
||||
|
||||
+10
-2
@@ -87,7 +87,7 @@ static uint32_t syborg_virtio_readl(void *opaque, target_phys_addr_t offset)
|
||||
break;
|
||||
case SYBORG_VIRTIO_HOST_FEATURES:
|
||||
ret = vdev->get_features(vdev);
|
||||
ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
|
||||
ret |= vdev->binding->get_features(s);
|
||||
break;
|
||||
case SYBORG_VIRTIO_GUEST_FEATURES:
|
||||
ret = vdev->features;
|
||||
@@ -242,8 +242,16 @@ static void syborg_virtio_update_irq(void *opaque, uint16_t vector)
|
||||
qemu_set_irq(proxy->irq, level != 0);
|
||||
}
|
||||
|
||||
static unsigned syborg_virtio_get_features(void *opaque)
|
||||
{
|
||||
unsigned ret = 0;
|
||||
ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VirtIOBindings syborg_virtio_bindings = {
|
||||
.notify = syborg_virtio_update_irq
|
||||
.notify = syborg_virtio_update_irq,
|
||||
.get_features = syborg_virtio_get_features,
|
||||
};
|
||||
|
||||
static int syborg_virtio_init(SyborgVirtIOProxy *proxy, VirtIODevice *vdev)
|
||||
|
||||
+15
-15
@@ -148,7 +148,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
|
||||
|
||||
/* Use values found on a real PowerMac */
|
||||
/* Uninorth main bus */
|
||||
dev = qdev_create(NULL, "Uni-north main");
|
||||
dev = qdev_create(NULL, "uni-north");
|
||||
qdev_init_nofail(dev);
|
||||
s = sysbus_from_qdev(dev);
|
||||
d = FROM_SYSBUS(UNINState, s);
|
||||
@@ -157,7 +157,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
|
||||
pic, 11 << 3, 4);
|
||||
|
||||
#if 0
|
||||
pci_create_simple(d->host_state.bus, 11 << 3, "Uni-north main");
|
||||
pci_create_simple(d->host_state.bus, 11 << 3, "uni-north");
|
||||
#endif
|
||||
|
||||
sysbus_mmio_map(s, 0, 0xf2800000);
|
||||
@@ -166,12 +166,12 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
|
||||
/* DEC 21154 bridge */
|
||||
#if 0
|
||||
/* XXX: not activated as PPC BIOS doesn't handle multiple buses properly */
|
||||
pci_create_simple(d->host_state.bus, 12 << 3, "DEC 21154");
|
||||
pci_create_simple(d->host_state.bus, 12 << 3, "dec-21154");
|
||||
#endif
|
||||
|
||||
/* Uninorth AGP bus */
|
||||
pci_create_simple(d->host_state.bus, 11 << 3, "Uni-north AGP");
|
||||
dev = qdev_create(NULL, "Uni-north AGP");
|
||||
pci_create_simple(d->host_state.bus, 11 << 3, "uni-north-agp");
|
||||
dev = qdev_create(NULL, "uni-north-agp");
|
||||
qdev_init_nofail(dev);
|
||||
s = sysbus_from_qdev(dev);
|
||||
sysbus_mmio_map(s, 0, 0xf0800000);
|
||||
@@ -180,8 +180,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
|
||||
/* Uninorth internal bus */
|
||||
#if 0
|
||||
/* XXX: not needed for now */
|
||||
pci_create_simple(d->host_state.bus, 14 << 3, "Uni-north internal");
|
||||
dev = qdev_create(NULL, "Uni-north internal");
|
||||
pci_create_simple(d->host_state.bus, 14 << 3, "uni-north-pci");
|
||||
dev = qdev_create(NULL, "uni-north-pci");
|
||||
qdev_init_nofail(dev);
|
||||
s = sysbus_from_qdev(dev);
|
||||
sysbus_mmio_map(s, 0, 0xf4800000);
|
||||
@@ -260,41 +260,41 @@ static int unin_internal_pci_host_init(PCIDevice *d)
|
||||
}
|
||||
|
||||
static PCIDeviceInfo unin_main_pci_host_info = {
|
||||
.qdev.name = "Uni-north main",
|
||||
.qdev.name = "uni-north",
|
||||
.qdev.size = sizeof(PCIDevice),
|
||||
.init = unin_main_pci_host_init,
|
||||
};
|
||||
|
||||
static PCIDeviceInfo dec_21154_pci_host_info = {
|
||||
.qdev.name = "DEC 21154",
|
||||
.qdev.name = "dec-21154",
|
||||
.qdev.size = sizeof(PCIDevice),
|
||||
.init = dec_21154_pci_host_init,
|
||||
};
|
||||
|
||||
static PCIDeviceInfo unin_agp_pci_host_info = {
|
||||
.qdev.name = "Uni-north AGP",
|
||||
.qdev.name = "uni-north-agp",
|
||||
.qdev.size = sizeof(PCIDevice),
|
||||
.init = unin_agp_pci_host_init,
|
||||
};
|
||||
|
||||
static PCIDeviceInfo unin_internal_pci_host_info = {
|
||||
.qdev.name = "Uni-north internal",
|
||||
.qdev.name = "uni-north-pci",
|
||||
.qdev.size = sizeof(PCIDevice),
|
||||
.init = unin_internal_pci_host_init,
|
||||
};
|
||||
|
||||
static void unin_register_devices(void)
|
||||
{
|
||||
sysbus_register_dev("Uni-north main", sizeof(UNINState),
|
||||
sysbus_register_dev("uni-north", sizeof(UNINState),
|
||||
pci_unin_main_init_device);
|
||||
pci_qdev_register(&unin_main_pci_host_info);
|
||||
sysbus_register_dev("DEC 21154", sizeof(UNINState),
|
||||
sysbus_register_dev("dec-21154", sizeof(UNINState),
|
||||
pci_dec_21154_init_device);
|
||||
pci_qdev_register(&dec_21154_pci_host_info);
|
||||
sysbus_register_dev("Uni-north AGP", sizeof(UNINState),
|
||||
sysbus_register_dev("uni-north-agp", sizeof(UNINState),
|
||||
pci_unin_agp_init_device);
|
||||
pci_qdev_register(&unin_agp_pci_host_info);
|
||||
sysbus_register_dev("Uni-north internal", sizeof(UNINState),
|
||||
sysbus_register_dev("uni-north-pci", sizeof(UNINState),
|
||||
pci_unin_internal_init_device);
|
||||
pci_qdev_register(&unin_internal_pci_host_info);
|
||||
}
|
||||
|
||||
+3
-2
@@ -630,7 +630,7 @@ USBDevice *usb_bt_init(HCIInfo *hci)
|
||||
|
||||
if (!hci)
|
||||
return NULL;
|
||||
dev = usb_create_simple(NULL /* FIXME */, "QEMU BT dongle");
|
||||
dev = usb_create_simple(NULL /* FIXME */, "usb-bt-dongle");
|
||||
s = DO_UPCAST(struct USBBtState, dev, dev);
|
||||
s->dev.opaque = s;
|
||||
|
||||
@@ -645,7 +645,8 @@ USBDevice *usb_bt_init(HCIInfo *hci)
|
||||
}
|
||||
|
||||
static struct USBDeviceInfo bt_info = {
|
||||
.qdev.name = "QEMU BT dongle",
|
||||
.product_desc = "QEMU BT dongle",
|
||||
.qdev.name = "usb-bt-dongle",
|
||||
.qdev.size = sizeof(struct USBBtState),
|
||||
.init = usb_bt_initfn,
|
||||
.handle_packet = usb_generic_handle_packet,
|
||||
|
||||
+7
-6
@@ -43,7 +43,7 @@ static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
||||
USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base);
|
||||
int rc;
|
||||
|
||||
pstrcpy(dev->devname, sizeof(dev->devname), qdev->info->name);
|
||||
pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc);
|
||||
dev->info = info;
|
||||
dev->auto_attach = 1;
|
||||
rc = dev->info->init(dev);
|
||||
@@ -131,7 +131,7 @@ static void do_attach(USBDevice *dev)
|
||||
|
||||
if (dev->attached) {
|
||||
fprintf(stderr, "Warning: tried to attach usb device %s twice\n",
|
||||
dev->devname);
|
||||
dev->product_desc);
|
||||
return;
|
||||
}
|
||||
dev->attached++;
|
||||
@@ -153,7 +153,7 @@ int usb_device_attach(USBDevice *dev)
|
||||
|
||||
if (bus->nfree == 1) {
|
||||
/* Create a new hub and chain it on. */
|
||||
hub = usb_create_simple(bus, "QEMU USB Hub");
|
||||
hub = usb_create_simple(bus, "usb-hub");
|
||||
}
|
||||
do_attach(dev);
|
||||
return 0;
|
||||
@@ -166,7 +166,7 @@ int usb_device_detach(USBDevice *dev)
|
||||
|
||||
if (!dev->attached) {
|
||||
fprintf(stderr, "Warning: tried to detach unattached usb device %s\n",
|
||||
dev->devname);
|
||||
dev->product_desc);
|
||||
return -1;
|
||||
}
|
||||
dev->attached--;
|
||||
@@ -228,7 +228,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
|
||||
|
||||
monitor_printf(mon, "%*saddr %d.%d, speed %s, name %s%s\n",
|
||||
indent, "", bus->busnr, dev->addr,
|
||||
usb_speed(dev->speed), dev->devname,
|
||||
usb_speed(dev->speed), dev->product_desc,
|
||||
dev->attached ? ", attached" : "");
|
||||
}
|
||||
|
||||
@@ -249,7 +249,8 @@ void usb_info(Monitor *mon)
|
||||
if (!dev)
|
||||
continue;
|
||||
monitor_printf(mon, " Device %d.%d, Speed %s Mb/s, Product %s\n",
|
||||
bus->busnr, dev->addr, usb_speed(dev->speed), dev->devname);
|
||||
bus->busnr, dev->addr, usb_speed(dev->speed),
|
||||
dev->product_desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -100,7 +100,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
|
||||
0x01, /* u8 bNumInterfaces; (1) */
|
||||
0x01, /* u8 bConfigurationValue; */
|
||||
0x04, /* u8 iConfiguration; */
|
||||
0xa0, /* u8 bmAttributes;
|
||||
0xe0, /* u8 bmAttributes;
|
||||
Bit 7: must be set,
|
||||
6: Self-powered,
|
||||
5: Remote wakeup,
|
||||
@@ -701,7 +701,7 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
|
||||
break;
|
||||
case 2:
|
||||
/* product description */
|
||||
ret = set_usb_string(data, s->dev.devname);
|
||||
ret = set_usb_string(data, s->dev.product_desc);
|
||||
break;
|
||||
case 3:
|
||||
/* vendor description */
|
||||
@@ -880,8 +880,8 @@ void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *))
|
||||
|
||||
static struct USBDeviceInfo hid_info[] = {
|
||||
{
|
||||
.qdev.name = "QEMU USB Tablet",
|
||||
.qdev.alias = "usb-tablet",
|
||||
.product_desc = "QEMU USB Tablet",
|
||||
.qdev.name = "usb-tablet",
|
||||
.usbdevice_name = "tablet",
|
||||
.qdev.size = sizeof(USBHIDState),
|
||||
.init = usb_tablet_initfn,
|
||||
@@ -891,8 +891,8 @@ static struct USBDeviceInfo hid_info[] = {
|
||||
.handle_data = usb_hid_handle_data,
|
||||
.handle_destroy = usb_hid_handle_destroy,
|
||||
},{
|
||||
.qdev.name = "QEMU USB Mouse",
|
||||
.qdev.alias = "usb-mouse",
|
||||
.product_desc = "QEMU USB Mouse",
|
||||
.qdev.name = "usb-mouse",
|
||||
.usbdevice_name = "mouse",
|
||||
.qdev.size = sizeof(USBHIDState),
|
||||
.init = usb_mouse_initfn,
|
||||
@@ -902,8 +902,8 @@ static struct USBDeviceInfo hid_info[] = {
|
||||
.handle_data = usb_hid_handle_data,
|
||||
.handle_destroy = usb_hid_handle_destroy,
|
||||
},{
|
||||
.qdev.name = "QEMU USB Keyboard",
|
||||
.qdev.alias = "usb-kbd",
|
||||
.product_desc = "QEMU USB Keyboard",
|
||||
.qdev.name = "usb-kbd",
|
||||
.usbdevice_name = "keyboard",
|
||||
.qdev.size = sizeof(USBHIDState),
|
||||
.init = usb_keyboard_initfn,
|
||||
|
||||
+3
-2
@@ -113,7 +113,7 @@ static const uint8_t qemu_hub_config_descriptor[] = {
|
||||
0x01, /* u8 bNumInterfaces; (1) */
|
||||
0x01, /* u8 bConfigurationValue; */
|
||||
0x00, /* u8 iConfiguration; */
|
||||
0xc0, /* u8 bmAttributes;
|
||||
0xe0, /* u8 bmAttributes;
|
||||
Bit 7: must be set,
|
||||
6: Self-powered,
|
||||
5: Remote wakeup,
|
||||
@@ -544,7 +544,8 @@ static int usb_hub_initfn(USBDevice *dev)
|
||||
}
|
||||
|
||||
static struct USBDeviceInfo hub_info = {
|
||||
.qdev.name = "QEMU USB Hub",
|
||||
.product_desc = "QEMU USB Hub",
|
||||
.qdev.name = "usb-hub",
|
||||
.qdev.size = sizeof(USBHubState),
|
||||
.init = usb_hub_initfn,
|
||||
.handle_packet = usb_hub_handle_packet,
|
||||
|
||||
+3
-3
@@ -591,7 +591,7 @@ static USBDevice *usb_msd_init(const char *filename)
|
||||
}
|
||||
|
||||
/* create guest device */
|
||||
dev = usb_create(NULL /* FIXME */, "QEMU USB MSD");
|
||||
dev = usb_create(NULL /* FIXME */, "usb-storage");
|
||||
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
|
||||
if (qdev_init(&dev->qdev) < 0)
|
||||
return NULL;
|
||||
@@ -600,8 +600,8 @@ static USBDevice *usb_msd_init(const char *filename)
|
||||
}
|
||||
|
||||
static struct USBDeviceInfo msd_info = {
|
||||
.qdev.name = "QEMU USB MSD",
|
||||
.qdev.alias = "usb-storage",
|
||||
.product_desc = "QEMU USB MSD",
|
||||
.qdev.name = "usb-storage",
|
||||
.qdev.size = sizeof(MSDState),
|
||||
.init = usb_msd_initfn,
|
||||
.handle_packet = usb_generic_handle_packet,
|
||||
|
||||
+107
-57
@@ -24,6 +24,7 @@
|
||||
#include "qemu-timer.h"
|
||||
#include "usb.h"
|
||||
#include "irq.h"
|
||||
#include "hw.h"
|
||||
|
||||
/* Common USB registers */
|
||||
#define MUSB_HDRC_FADDR 0x00 /* 8-bit */
|
||||
@@ -248,6 +249,16 @@
|
||||
#define MGC_M_ULPI_REGCTL_COMPLETE 0x02
|
||||
#define MGC_M_ULPI_REGCTL_REG 0x01
|
||||
|
||||
/* #define MUSB_DEBUG */
|
||||
|
||||
#ifdef MUSB_DEBUG
|
||||
#define TRACE(fmt,...) fprintf(stderr, "%s@%d: " fmt "\n", __FUNCTION__, \
|
||||
__LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define TRACE(...)
|
||||
#endif
|
||||
|
||||
|
||||
static void musb_attach(USBPort *port, USBDevice *dev);
|
||||
|
||||
typedef struct {
|
||||
@@ -263,7 +274,7 @@ typedef struct {
|
||||
uint8_t fifosize;
|
||||
int timeout[2]; /* Always in microframes */
|
||||
|
||||
uint32_t *buf[2];
|
||||
uint8_t *buf[2];
|
||||
int fifolen[2];
|
||||
int fifostart[2];
|
||||
int fifoaddr[2];
|
||||
@@ -299,7 +310,7 @@ struct MUSBState {
|
||||
int setup_len;
|
||||
int session;
|
||||
|
||||
uint32_t buf[0x2000];
|
||||
uint8_t buf[0x8000];
|
||||
|
||||
/* Duplicating the world since 2008!... probably we should have 32
|
||||
* logical, single endpoints instead. */
|
||||
@@ -774,7 +785,7 @@ static void musb_tx_rdy(MUSBState *s, int epnum)
|
||||
MUSBEndPoint *ep = s->ep + epnum;
|
||||
int pid;
|
||||
int total, valid = 0;
|
||||
|
||||
TRACE("start %d, len %d", ep->fifostart[0], ep->fifolen[0] );
|
||||
ep->fifostart[0] += ep->fifolen[0];
|
||||
ep->fifolen[0] = 0;
|
||||
|
||||
@@ -789,18 +800,18 @@ static void musb_tx_rdy(MUSBState *s, int epnum)
|
||||
}
|
||||
|
||||
/* If the packet is not fully ready yet, wait for a next segment. */
|
||||
if (epnum && (ep->fifostart[0] << 2) < total)
|
||||
if (epnum && (ep->fifostart[0]) < total)
|
||||
return;
|
||||
|
||||
if (!valid)
|
||||
total = ep->fifostart[0] << 2;
|
||||
total = ep->fifostart[0];
|
||||
|
||||
pid = USB_TOKEN_OUT;
|
||||
if (!epnum && (ep->csr[0] & MGC_M_CSR0_H_SETUPPKT)) {
|
||||
pid = USB_TOKEN_SETUP;
|
||||
if (total != 8)
|
||||
printf("%s: illegal SETUPPKT length of %i bytes\n",
|
||||
__FUNCTION__, total);
|
||||
if (total != 8) {
|
||||
TRACE("illegal SETUPPKT length of %i bytes", total);
|
||||
}
|
||||
/* Controller should retry SETUP packets three times on errors
|
||||
* but it doesn't make sense for us to do that. */
|
||||
}
|
||||
@@ -817,12 +828,13 @@ static void musb_rx_req(MUSBState *s, int epnum)
|
||||
/* If we already have a packet, which didn't fit into the
|
||||
* 64 bytes of the FIFO, only move the FIFO start and return. (Obsolete) */
|
||||
if (ep->packey[1].pid == USB_TOKEN_IN && ep->status[1] >= 0 &&
|
||||
(ep->fifostart[1] << 2) + ep->rxcount <
|
||||
(ep->fifostart[1]) + ep->rxcount <
|
||||
ep->packey[1].len) {
|
||||
ep->fifostart[1] += ep->rxcount >> 2;
|
||||
TRACE("0x%08x, %d", ep->fifostart[1], ep->rxcount );
|
||||
ep->fifostart[1] += ep->rxcount;
|
||||
ep->fifolen[1] = 0;
|
||||
|
||||
ep->rxcount = MIN(ep->packey[0].len - (ep->fifostart[1] << 2),
|
||||
ep->rxcount = MIN(ep->packey[0].len - (ep->fifostart[1]),
|
||||
ep->maxp[1]);
|
||||
|
||||
ep->csr[1] &= ~MGC_M_RXCSR_H_REQPKT;
|
||||
@@ -872,6 +884,36 @@ static void musb_rx_req(MUSBState *s, int epnum)
|
||||
total, musb_rx_packet_complete, 1);
|
||||
}
|
||||
|
||||
static uint8_t musb_read_fifo(MUSBEndPoint *ep)
|
||||
{
|
||||
uint8_t value;
|
||||
if (ep->fifolen[1] >= 64) {
|
||||
/* We have a FIFO underrun */
|
||||
TRACE("EP%d FIFO is now empty, stop reading", ep->epnum);
|
||||
return 0x00000000;
|
||||
}
|
||||
/* In DMA mode clear RXPKTRDY and set REQPKT automatically
|
||||
* (if AUTOREQ is set) */
|
||||
|
||||
ep->csr[1] &= ~MGC_M_RXCSR_FIFOFULL;
|
||||
value=ep->buf[1][ep->fifostart[1] + ep->fifolen[1] ++];
|
||||
TRACE("EP%d 0x%02x, %d", ep->epnum, value, ep->fifolen[1] );
|
||||
return value;
|
||||
}
|
||||
|
||||
static void musb_write_fifo(MUSBEndPoint *ep, uint8_t value)
|
||||
{
|
||||
TRACE("EP%d = %02x", ep->epnum, value);
|
||||
if (ep->fifolen[0] >= 64) {
|
||||
/* We have a FIFO overrun */
|
||||
TRACE("EP%d FIFO exceeded 64 bytes, stop feeding data", ep->epnum);
|
||||
return;
|
||||
}
|
||||
|
||||
ep->buf[0][ep->fifostart[0] + ep->fifolen[0] ++] = value;
|
||||
ep->csr[0] |= MGC_M_TXCSR_FIFONOTEMPTY;
|
||||
}
|
||||
|
||||
static void musb_ep_frame_cancel(MUSBEndPoint *ep, int dir)
|
||||
{
|
||||
if (ep->intv_timer[dir])
|
||||
@@ -895,7 +937,7 @@ static uint8_t musb_busctl_readb(void *opaque, int ep, int addr)
|
||||
return s->ep[ep].hport[1];
|
||||
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
|
||||
TRACE("unknown register 0x%02x", addr);
|
||||
return 0x00;
|
||||
};
|
||||
}
|
||||
@@ -905,6 +947,12 @@ static void musb_busctl_writeb(void *opaque, int ep, int addr, uint8_t value)
|
||||
MUSBState *s = (MUSBState *) opaque;
|
||||
|
||||
switch (addr) {
|
||||
case MUSB_HDRC_TXFUNCADDR:
|
||||
s->ep[ep].faddr[0] = value;
|
||||
break;
|
||||
case MUSB_HDRC_RXFUNCADDR:
|
||||
s->ep[ep].faddr[1] = value;
|
||||
break;
|
||||
case MUSB_HDRC_TXHUBADDR:
|
||||
s->ep[ep].haddr[0] = value;
|
||||
break;
|
||||
@@ -919,7 +967,8 @@ static void musb_busctl_writeb(void *opaque, int ep, int addr, uint8_t value)
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
|
||||
TRACE("unknown register 0x%02x", addr);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -975,9 +1024,11 @@ static uint8_t musb_ep_readb(void *opaque, int ep, int addr)
|
||||
return 0x00;
|
||||
case MUSB_HDRC_FIFOSIZE:
|
||||
return ep ? s->ep[ep].fifosize : s->ep[ep].config;
|
||||
case MUSB_HDRC_RXCOUNT:
|
||||
return s->ep[ep].rxcount;
|
||||
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
|
||||
TRACE("unknown register 0x%02x", addr);
|
||||
return 0x00;
|
||||
};
|
||||
}
|
||||
@@ -1004,13 +1055,12 @@ static void musb_ep_writeb(void *opaque, int ep, int addr, uint8_t value)
|
||||
case (MUSB_HDRC_FIFOSIZE & ~1):
|
||||
break;
|
||||
case MUSB_HDRC_FIFOSIZE:
|
||||
printf("%s: somebody messes with fifosize (now %i bytes)\n",
|
||||
__FUNCTION__, value);
|
||||
TRACE("somebody messes with fifosize (now %i bytes)", value);
|
||||
s->ep[ep].fifosize = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
|
||||
TRACE("unknown register 0x%02x", addr);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1194,8 +1244,12 @@ static uint32_t musb_readb(void *opaque, target_phys_addr_t addr)
|
||||
ep = (addr >> 4) & 0xf;
|
||||
return musb_ep_readb(s, ep, addr & 0xf);
|
||||
|
||||
case MUSB_HDRC_FIFO ... (MUSB_HDRC_FIFO + 0x3f):
|
||||
ep = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
return musb_read_fifo(s->ep + ep);
|
||||
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, (int) addr);
|
||||
TRACE("unknown register 0x%02x", (int) addr);
|
||||
return 0x00;
|
||||
};
|
||||
}
|
||||
@@ -1276,8 +1330,14 @@ static void musb_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
|
||||
musb_ep_writeb(s, ep, addr & 0xf, value);
|
||||
break;
|
||||
|
||||
case MUSB_HDRC_FIFO ... (MUSB_HDRC_FIFO + 0x3f):
|
||||
ep = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
musb_write_fifo(s->ep + ep, value & 0xff);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, (int) addr);
|
||||
TRACE("unknown register 0x%02x", (int) addr);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1326,6 +1386,10 @@ static uint32_t musb_readh(void *opaque, target_phys_addr_t addr)
|
||||
ep = (addr >> 4) & 0xf;
|
||||
return musb_ep_readh(s, ep, addr & 0xf);
|
||||
|
||||
case MUSB_HDRC_FIFO ... (MUSB_HDRC_FIFO + 0x3f):
|
||||
ep = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
return (musb_read_fifo(s->ep + ep) | musb_read_fifo(s->ep + ep) << 8);
|
||||
|
||||
default:
|
||||
return musb_readb(s, addr) | (musb_readb(s, addr | 1) << 8);
|
||||
};
|
||||
@@ -1353,12 +1417,12 @@ static void musb_writeh(void *opaque, target_phys_addr_t addr, uint32_t value)
|
||||
case MUSB_HDRC_TXFIFOADDR:
|
||||
s->ep[s->idx].fifoaddr[0] = value;
|
||||
s->ep[s->idx].buf[0] =
|
||||
s->buf + ((value << 1) & (sizeof(s->buf) / 4 - 1));
|
||||
s->buf + ((value << 3) & 0x7ff );
|
||||
break;
|
||||
case MUSB_HDRC_RXFIFOADDR:
|
||||
s->ep[s->idx].fifoaddr[1] = value;
|
||||
s->ep[s->idx].buf[1] =
|
||||
s->buf + ((value << 1) & (sizeof(s->buf) / 4 - 1));
|
||||
s->buf + ((value << 3) & 0x7ff);
|
||||
break;
|
||||
|
||||
case MUSB_HDRC_EP_IDX ... (MUSB_HDRC_EP_IDX + 0xf):
|
||||
@@ -1375,6 +1439,12 @@ static void musb_writeh(void *opaque, target_phys_addr_t addr, uint32_t value)
|
||||
musb_ep_writeh(s, ep, addr & 0xf, value);
|
||||
break;
|
||||
|
||||
case MUSB_HDRC_FIFO ... (MUSB_HDRC_FIFO + 0x3f):
|
||||
ep = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
musb_write_fifo(s->ep + ep, value & 0xff);
|
||||
musb_write_fifo(s->ep + ep, (value >> 8) & 0xff);
|
||||
break;
|
||||
|
||||
default:
|
||||
musb_writeb(s, addr, value & 0xff);
|
||||
musb_writeb(s, addr | 1, value >> 8);
|
||||
@@ -1384,28 +1454,17 @@ static void musb_writeh(void *opaque, target_phys_addr_t addr, uint32_t value)
|
||||
static uint32_t musb_readw(void *opaque, target_phys_addr_t addr)
|
||||
{
|
||||
MUSBState *s = (MUSBState *) opaque;
|
||||
MUSBEndPoint *ep;
|
||||
int epnum;
|
||||
int ep;
|
||||
|
||||
switch (addr) {
|
||||
case MUSB_HDRC_FIFO ... (MUSB_HDRC_FIFO + 0x3f):
|
||||
epnum = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
ep = s->ep + epnum;
|
||||
|
||||
if (ep->fifolen[1] >= 16) {
|
||||
/* We have a FIFO underrun */
|
||||
printf("%s: EP%i FIFO is now empty, stop reading\n",
|
||||
__FUNCTION__, epnum);
|
||||
return 0x00000000;
|
||||
}
|
||||
/* In DMA mode clear RXPKTRDY and set REQPKT automatically
|
||||
* (if AUTOREQ is set) */
|
||||
|
||||
ep->csr[1] &= ~MGC_M_RXCSR_FIFOFULL;
|
||||
return ep->buf[1][ep->fifostart[1] + ep->fifolen[1] ++];
|
||||
|
||||
ep = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
return ( musb_read_fifo(s->ep + ep) |
|
||||
musb_read_fifo(s->ep + ep) << 8 |
|
||||
musb_read_fifo(s->ep + ep) << 16 |
|
||||
musb_read_fifo(s->ep + ep) << 24 );
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, (int) addr);
|
||||
TRACE("unknown register 0x%02x", (int) addr);
|
||||
return 0x00000000;
|
||||
};
|
||||
}
|
||||
@@ -1413,28 +1472,19 @@ static uint32_t musb_readw(void *opaque, target_phys_addr_t addr)
|
||||
static void musb_writew(void *opaque, target_phys_addr_t addr, uint32_t value)
|
||||
{
|
||||
MUSBState *s = (MUSBState *) opaque;
|
||||
MUSBEndPoint *ep;
|
||||
int epnum;
|
||||
int ep;
|
||||
|
||||
switch (addr) {
|
||||
case MUSB_HDRC_FIFO ... (MUSB_HDRC_FIFO + 0x3f):
|
||||
epnum = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
ep = s->ep + epnum;
|
||||
|
||||
if (ep->fifolen[0] >= 16) {
|
||||
/* We have a FIFO overrun */
|
||||
printf("%s: EP%i FIFO exceeded 64 bytes, stop feeding data\n",
|
||||
__FUNCTION__, epnum);
|
||||
ep = ((addr - MUSB_HDRC_FIFO) >> 2) & 0xf;
|
||||
musb_write_fifo(s->ep + ep, value & 0xff);
|
||||
musb_write_fifo(s->ep + ep, (value >> 8 ) & 0xff);
|
||||
musb_write_fifo(s->ep + ep, (value >> 16) & 0xff);
|
||||
musb_write_fifo(s->ep + ep, (value >> 24) & 0xff);
|
||||
break;
|
||||
}
|
||||
|
||||
ep->buf[0][ep->fifostart[0] + ep->fifolen[0] ++] = value;
|
||||
if (epnum)
|
||||
ep->csr[0] |= MGC_M_TXCSR_FIFONOTEMPTY;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("%s: unknown register at %02x\n", __FUNCTION__, (int) addr);
|
||||
TRACE("unknown register 0x%02x", (int) addr);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+49
-32
@@ -1420,8 +1420,7 @@ static void usbnet_cleanup(VLANClientState *nc)
|
||||
{
|
||||
USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
|
||||
|
||||
rndis_clear_responsequeue(s);
|
||||
qemu_free(s);
|
||||
s->nic = NULL;
|
||||
}
|
||||
|
||||
static void usb_net_handle_destroy(USBDevice *dev)
|
||||
@@ -1429,9 +1428,18 @@ static void usb_net_handle_destroy(USBDevice *dev)
|
||||
USBNetState *s = (USBNetState *) dev;
|
||||
|
||||
/* TODO: remove the nd_table[] entry */
|
||||
rndis_clear_responsequeue(s);
|
||||
qemu_del_vlan_client(&s->nic->nc);
|
||||
}
|
||||
|
||||
static NetClientInfo net_usbnet_info = {
|
||||
.type = NET_CLIENT_TYPE_NIC,
|
||||
.size = sizeof(NICState),
|
||||
.can_receive = usbnet_can_receive,
|
||||
.receive = usbnet_receive,
|
||||
.cleanup = usbnet_cleanup,
|
||||
};
|
||||
|
||||
static int usb_net_initfn(USBDevice *dev)
|
||||
{
|
||||
USBNetState *s = DO_UPCAST(USBNetState, dev, dev);
|
||||
@@ -1447,47 +1455,50 @@ static int usb_net_initfn(USBDevice *dev)
|
||||
s->media_state = 0; /* NDIS_MEDIA_STATE_CONNECTED */;
|
||||
s->filter = 0;
|
||||
s->vendorid = 0x1234;
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_usbnet_info, &s->conf,
|
||||
s->dev.qdev.info->name, s->dev.qdev.id, s);
|
||||
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
|
||||
snprintf(s->usbstring_mac, sizeof(s->usbstring_mac),
|
||||
"%02x%02x%02x%02x%02x%02x",
|
||||
0x40,
|
||||
s->conf.macaddr.a[1],
|
||||
s->conf.macaddr.a[2],
|
||||
s->conf.macaddr.a[3],
|
||||
s->conf.macaddr.a[4],
|
||||
s->conf.macaddr.a[5]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static NetClientInfo net_usbnet_info = {
|
||||
.type = NET_CLIENT_TYPE_NIC,
|
||||
.size = sizeof(NICState),
|
||||
.can_receive = usbnet_can_receive,
|
||||
.receive = usbnet_receive,
|
||||
.cleanup = usbnet_cleanup,
|
||||
};
|
||||
|
||||
USBDevice *usb_net_init(NICInfo *nd)
|
||||
static USBDevice *usb_net_init(const char *cmdline)
|
||||
{
|
||||
USBDevice *dev;
|
||||
USBNetState *s;
|
||||
QemuOpts *opts;
|
||||
int idx;
|
||||
|
||||
dev = usb_create_simple(NULL /* FIXME */, "QEMU USB Network Interface");
|
||||
s = DO_UPCAST(USBNetState, dev, dev);
|
||||
opts = qemu_opts_parse(&qemu_net_opts, cmdline, NULL);
|
||||
if (!opts) {
|
||||
return NULL;
|
||||
}
|
||||
qemu_opt_set(opts, "type", "nic");
|
||||
qemu_opt_set(opts, "model", "usb");
|
||||
|
||||
memcpy(s->conf.macaddr.a, nd->macaddr, sizeof(nd->macaddr));
|
||||
s->conf.vlan = nd->vlan;
|
||||
s->conf.peer = nd->netdev;
|
||||
idx = net_client_init(NULL, opts, 0);
|
||||
if (idx == -1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s->nic = qemu_new_nic(&net_usbnet_info, &s->conf,
|
||||
nd->model, nd->name, s);
|
||||
|
||||
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
|
||||
|
||||
snprintf(s->usbstring_mac, sizeof(s->usbstring_mac),
|
||||
"%02x%02x%02x%02x%02x%02x",
|
||||
0x40, s->conf.macaddr.a[1], s->conf.macaddr.a[2],
|
||||
s->conf.macaddr.a[3], s->conf.macaddr.a[4], s->conf.macaddr.a[5]);
|
||||
fprintf(stderr, "usbnet: initialized mac %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
s->conf.macaddr.a[0], s->conf.macaddr.a[1], s->conf.macaddr.a[2],
|
||||
s->conf.macaddr.a[3], s->conf.macaddr.a[4], s->conf.macaddr.a[5]);
|
||||
|
||||
return (USBDevice *) s;
|
||||
dev = usb_create(NULL /* FIXME */, "usb-net");
|
||||
qdev_set_nic_properties(&dev->qdev, &nd_table[idx]);
|
||||
qdev_init(&dev->qdev);
|
||||
return dev;
|
||||
}
|
||||
|
||||
static struct USBDeviceInfo net_info = {
|
||||
.qdev.name = "QEMU USB Network Interface",
|
||||
.product_desc = "QEMU USB Network Interface",
|
||||
.qdev.name = "usb-net",
|
||||
.qdev.size = sizeof(USBNetState),
|
||||
.init = usb_net_initfn,
|
||||
.handle_packet = usb_generic_handle_packet,
|
||||
@@ -1495,6 +1506,12 @@ static struct USBDeviceInfo net_info = {
|
||||
.handle_control = usb_net_handle_control,
|
||||
.handle_data = usb_net_handle_data,
|
||||
.handle_destroy = usb_net_handle_destroy,
|
||||
.usbdevice_name = "net",
|
||||
.usbdevice_init = usb_net_init,
|
||||
.qdev.props = (Property[]) {
|
||||
DEFINE_NIC_PROPERTIES(USBNetState, conf),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
}
|
||||
};
|
||||
|
||||
static void usb_net_register_devices(void)
|
||||
|
||||
+6
-5
@@ -1721,14 +1721,16 @@ static int usb_ohci_initfn_pci(struct PCIDevice *dev)
|
||||
pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);
|
||||
pci_config_set_device_id(ohci->pci_dev.config,
|
||||
PCI_DEVICE_ID_APPLE_IPID_USB);
|
||||
ohci->pci_dev.config[0x09] = 0x10; /* OHCI */
|
||||
ohci->pci_dev.config[PCI_CLASS_PROG] = 0x10; /* OHCI */
|
||||
pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);
|
||||
ohci->pci_dev.config[0x3d] = 0x01; /* interrupt pin 1 */
|
||||
/* TODO: RST# value should be 0. */
|
||||
ohci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */
|
||||
|
||||
usb_ohci_init(&ohci->state, &dev->qdev, num_ports,
|
||||
ohci->pci_dev.devfn, ohci->pci_dev.irq[0],
|
||||
OHCI_TYPE_PCI, ohci->pci_dev.name, 0);
|
||||
|
||||
/* TODO: avoid cast below by using dev */
|
||||
pci_register_bar((struct PCIDevice *)ohci, 0, 256,
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY, ohci_mapfunc);
|
||||
return 0;
|
||||
@@ -1736,7 +1738,7 @@ static int usb_ohci_initfn_pci(struct PCIDevice *dev)
|
||||
|
||||
void usb_ohci_init_pci(struct PCIBus *bus, int devfn)
|
||||
{
|
||||
pci_create_simple(bus, devfn, "OHCI USB PCI");
|
||||
pci_create_simple(bus, devfn, "pci-ohci");
|
||||
}
|
||||
|
||||
void usb_ohci_init_pxa(target_phys_addr_t base, int num_ports, int devfn,
|
||||
@@ -1762,8 +1764,7 @@ void usb_ohci_init_sm501(uint32_t mmio_base, uint32_t localmem_base,
|
||||
}
|
||||
|
||||
static PCIDeviceInfo ohci_info = {
|
||||
.qdev.name = "OHCI USB PCI",
|
||||
.qdev.alias = "pci-ohci",
|
||||
.qdev.name = "pci-ohci",
|
||||
.qdev.desc = "Apple USB Controller",
|
||||
.qdev.size = sizeof(OHCIPCIState),
|
||||
.init = usb_ohci_initfn_pci,
|
||||
|
||||
+6
-6
@@ -577,7 +577,7 @@ static USBDevice *usb_serial_init(const char *filename)
|
||||
if (!cdrv)
|
||||
return NULL;
|
||||
|
||||
dev = usb_create(NULL /* FIXME */, "QEMU USB Serial");
|
||||
dev = usb_create(NULL /* FIXME */, "usb-serial");
|
||||
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
|
||||
if (vendorid)
|
||||
qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
|
||||
@@ -597,7 +597,7 @@ static USBDevice *usb_braille_init(const char *unused)
|
||||
if (!cdrv)
|
||||
return NULL;
|
||||
|
||||
dev = usb_create(NULL /* FIXME */, "QEMU USB Braille");
|
||||
dev = usb_create(NULL /* FIXME */, "usb-braille");
|
||||
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
|
||||
qdev_init(&dev->qdev);
|
||||
|
||||
@@ -605,8 +605,8 @@ static USBDevice *usb_braille_init(const char *unused)
|
||||
}
|
||||
|
||||
static struct USBDeviceInfo serial_info = {
|
||||
.qdev.name = "QEMU USB Serial",
|
||||
.qdev.alias = "usb-serial",
|
||||
.product_desc = "QEMU USB Serial",
|
||||
.qdev.name = "usb-serial",
|
||||
.qdev.size = sizeof(USBSerialState),
|
||||
.init = usb_serial_initfn,
|
||||
.handle_packet = usb_generic_handle_packet,
|
||||
@@ -625,8 +625,8 @@ static struct USBDeviceInfo serial_info = {
|
||||
};
|
||||
|
||||
static struct USBDeviceInfo braille_info = {
|
||||
.qdev.name = "QEMU USB Braille",
|
||||
.qdev.alias = "usb-braille",
|
||||
.product_desc = "QEMU USB Braille",
|
||||
.qdev.name = "usb-braille",
|
||||
.qdev.size = sizeof(USBSerialState),
|
||||
.init = usb_serial_initfn,
|
||||
.handle_packet = usb_generic_handle_packet,
|
||||
|
||||
+8
-7
@@ -1065,11 +1065,12 @@ static int usb_uhci_common_initfn(UHCIState *s)
|
||||
uint8_t *pci_conf = s->dev.config;
|
||||
int i;
|
||||
|
||||
pci_conf[0x08] = 0x01; // revision number
|
||||
pci_conf[0x09] = 0x00;
|
||||
pci_conf[PCI_REVISION_ID] = 0x01; // revision number
|
||||
pci_conf[PCI_CLASS_PROG] = 0x00;
|
||||
pci_config_set_class(pci_conf, PCI_CLASS_SERIAL_USB);
|
||||
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
|
||||
pci_conf[0x3d] = 4; // interrupt pin 3
|
||||
/* TODO: reset value should be 0. */
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 4; // interrupt pin 3
|
||||
pci_conf[0x60] = 0x10; // release number
|
||||
|
||||
usb_bus_new(&s->bus, &s->dev.qdev);
|
||||
@@ -1111,12 +1112,12 @@ static int usb_uhci_piix4_initfn(PCIDevice *dev)
|
||||
|
||||
static PCIDeviceInfo uhci_info[] = {
|
||||
{
|
||||
.qdev.name = "PIIX3 USB-UHCI",
|
||||
.qdev.name = "piix3-usb-uhci",
|
||||
.qdev.size = sizeof(UHCIState),
|
||||
.qdev.vmsd = &vmstate_uhci,
|
||||
.init = usb_uhci_piix3_initfn,
|
||||
},{
|
||||
.qdev.name = "PIIX4 USB-UHCI",
|
||||
.qdev.name = "piix4-usb-uhci",
|
||||
.qdev.size = sizeof(UHCIState),
|
||||
.qdev.vmsd = &vmstate_uhci,
|
||||
.init = usb_uhci_piix4_initfn,
|
||||
@@ -1133,10 +1134,10 @@ device_init(uhci_register);
|
||||
|
||||
void usb_uhci_piix3_init(PCIBus *bus, int devfn)
|
||||
{
|
||||
pci_create_simple(bus, devfn, "PIIX3 USB-UHCI");
|
||||
pci_create_simple(bus, devfn, "piix3-usb-uhci");
|
||||
}
|
||||
|
||||
void usb_uhci_piix4_init(PCIBus *bus, int devfn)
|
||||
{
|
||||
pci_create_simple(bus, devfn, "PIIX4 USB-UHCI");
|
||||
pci_create_simple(bus, devfn, "piix4-usb-uhci");
|
||||
}
|
||||
+3
-2
@@ -409,8 +409,9 @@ static int usb_wacom_initfn(USBDevice *dev)
|
||||
}
|
||||
|
||||
static struct USBDeviceInfo wacom_info = {
|
||||
.qdev.name = "QEMU PenPartner Tablet",
|
||||
.qdev.alias = "wacom-tablet",
|
||||
.product_desc = "QEMU PenPartner Tablet",
|
||||
.qdev.name = "usb-wacom-tablet",
|
||||
.qdev.desc = "QEMU PenPartner Tablet",
|
||||
.usbdevice_name = "wacom-tablet",
|
||||
.qdev.size = sizeof(USBWacomState),
|
||||
.init = usb_wacom_initfn,
|
||||
|
||||
@@ -132,7 +132,7 @@ struct USBDevice {
|
||||
|
||||
int speed;
|
||||
uint8_t addr;
|
||||
char devname[32];
|
||||
char product_desc[32];
|
||||
int auto_attach;
|
||||
int attached;
|
||||
|
||||
@@ -185,6 +185,8 @@ struct USBDeviceInfo {
|
||||
*/
|
||||
int (*handle_data)(USBDevice *dev, USBPacket *p);
|
||||
|
||||
const char *product_desc;
|
||||
|
||||
/* handle legacy -usbdevice command line options */
|
||||
const char *usbdevice_name;
|
||||
USBDevice *(*usbdevice_init)(const char *params);
|
||||
@@ -256,9 +258,6 @@ void usb_host_info(Monitor *mon);
|
||||
/* usb-hid.c */
|
||||
void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *));
|
||||
|
||||
/* usb-net.c */
|
||||
USBDevice *usb_net_init(NICInfo *nd);
|
||||
|
||||
/* usb-bt.c */
|
||||
USBDevice *usb_bt_init(HCIInfo *hci);
|
||||
|
||||
|
||||
Loaded 100 of 193 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user