Compare commits

..
154 Commits
Author SHA1 Message Date
Anthony Liguori 6c412ddf1c Update for 0.12.0 release
Signed-off-by: Anthony Liguori <[email protected]>
2009-12-19 08:26:29 -06:00
Anthony Liguori 862ad4be53 Update to SeaBIOS 0.5.0
The only change is updating the makefile but that way we're carrying an official
release.

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit eac1bb74be4d95616b8a6217e020b1b0d6918608)
2009-12-19 08:26:28 -06:00
Anthony Liguori aac2ad563a Revert "monitor: Convert do_migrate_set_speed() to QObject"
This reverts commit 3a4921047d.

From Luiz:

  do_migrate_set_speed() accepts a suffix for the 'value' argument and this is
  not good for QMP.  We will have to add a new argument type to handle that and
  this will have to wait for 0.13.

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 46ee2295678af629a2869e4e331e4e002bcc31fd)
2009-12-19 08:26:28 -06:00
Anthony Liguori eb41f58a4e e1000: Don't muck with PCI commmand register
Otherwise, the driver does not work in Linux after the INT_DISABLE changes in
PCI.

Michael Tsirkin had a patch to do this, I'm not sure what happened to it.

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 17a7a5c59c4d72dd1d5666f348b010be6b10163c)
2009-12-19 08:26:28 -06:00
Luiz Capitulino 5543b41167 monitor: do_balloon(): Use 'M' argument type
This makes do_balloon() accept megabyte values from the user
Monitor while accepting byte values for QMP.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 056001ab30b1e596b992e70f9cb2adacef9c0ad0)
2009-12-19 08:26:28 -06:00
Luiz Capitulino 31d85f6a6b monitor: Introduce 'M' argument type
This is a target long value in megabytes which should be
converted to bytes.

It will be used by handlers which accept a megabyte value
when in "user mode".

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 7cfe34fe4e3b518485c15aa9a78b4cf9cbd11a4d)
2009-12-19 08:26:28 -06:00
Luiz Capitulino 9c49a2533c QMP: Update spec file
- Remove "draft" status
- Change default success response to be json-object
- Change error and event data member to be a json-object
- Update examples
- Add new section "Compatibility Considerations"
- Other fixes and clarifications

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 58341bcd112cf11c6266cabe36921572fa4b019d)
2009-12-19 08:26:28 -06:00
Luiz Capitulino c6faf5fd73 QMP: Update README file
- Fix output description
- Fix command-line usage notes
- Minor improvements

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d683cfb1a94aa61ace4ce7ce824f1e087b37b851)
2009-12-19 08:26:27 -06:00
Luiz Capitulino 069def25cb QMP: Assure that returned data is a QDict
This is for debug purposes only.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 19863875a2e18fc868a7b830f16fa76d32518bd1)
2009-12-19 08:26:27 -06:00
Luiz Capitulino 3733a1e804 QMP: Return an empty dict by default
Currently, when a regular command doesn't have any data to output,
QMP will emit:

{ "return": "OK" }

Returning an empty dict is better though, because dicts can support
some protocol changes in a compatible way.

So, with this commit we will return:

{ "return": {} }

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit e38fb11b5099db8de8d60d536d4a01610ee4c08b)
2009-12-19 08:26:27 -06:00
Luiz Capitulino 5b06a3f785 QMP: Only handle converted commands
Looks like I dropped this check when addressing the 'query-'
commands request.

QMP should only handle converted commands, obviously.

Reported-by: Markus Armbruster <[email protected]>

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 89f5461fc9a3c437e632f6895dc605e8f03b925e)
2009-12-19 08:26:27 -06:00
Anthony Liguori baaf73aaac Update SeaBIOS to include PCI based option rom loading
Also remove pcbios from the tree.  It will no longer work.

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2dc3f77c86)
2009-12-19 08:26:27 -06:00
Gerd Hoffmann 345c22aa80 roms: remove option rom packing logic
Now that we load the option roms via fw_cfg, we can stop copying
them to the 0xc000 -> 0xe000.  The patch does just that.

Also the rom loader gets simplified as all remaining users of the
rom loader load the bits at a fixed address so the packing and
aligning logic can go away.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 632cf034b4)
2009-12-19 08:26:26 -06:00
Gerd Hoffmann 26bb2a0865 roms: use new fw_cfg file xfer support.
roms: use fw_cfg for vgabios and option rom loading, additionally to
deploying them the traditional way (copy to 0xc0000 -> 0xe0000 range).

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 379526a40e)
2009-12-19 08:26:25 -06:00
Gerd Hoffmann e6ea832410 fw_cfg: add API for file transfer.
This patch adds a file transfer interface to fw_cfg.  Intended to be
used for passing non-pci option roms and vgabios to seabios.  Namespace
is modeled after the existing cbfs filesystem support in seabios.

Reading the new FW_CFG_FILE_DIR entry returns a file list.
Fields there are in network byte order (aka bigendian).

aliguori: fix fw_cfg.h for multiboot.bin, add proper fw_cfg.h declarations,
          quiet fprintf() in fw_cfg.c

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit abe147e0ce)
2009-12-19 08:26:25 -06:00
Gerd Hoffmann 22d0cc8d38 fw_cfg: make calls typesafe
Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit c2b5bda43a)
2009-12-19 08:26:25 -06:00
Gerd Hoffmann 898829d5c7 pci romfiles: add property, add default to PCIDeviceInfo
This patch adds a romfile property to the pci bus.  It allows to specify
a romfile to load into the rom bar of the pci device.  The default value
comes from a new field in PCIDeviceInfo.  The property allows to change
the file and also to disable the rom loading using an empty string.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 8c52c8f320)
2009-12-19 08:26:24 -06:00
Anthony Liguori 72bb3c7571 Support PCI based option rom loading
Currently, we preload option roms into the option rom space in memory.  This
prevents DDIM from functioning correctly which severely limits the number
of roms we can support.

This patch introduces a pci_add_option_rom() which registers the
PCI_ROM_ADDRESS bar which points to our option rom.  It also converts over
the cirrus vga adapter, the rtl8139, virtio, and the e1000 to use this
new mechanism.

The result is that PXE boot functions even with three unique types of cards.

Signed-off-by: Anthony Liguori <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit c2039bd0ff)
2009-12-19 08:26:24 -06:00
Daniel P. Berrange 48c437f0ab Fix backcompat for hotplug of SCSI controllers
SCSI controllers have no trouble existing without any attached
disks. This could be achieved with the (legacy) monitor syntax

  pci_add pci_addr=auto storage if=scsi

This is now denied with

  scsi requires a backing file/device.
  failed to add if=scsi

There is no need for this denial and it breaks compatability
with existing QEMU usage, so remove the check for presence
of a drive.

  Signed-off-by: Daniel P. Berrange <[email protected]>

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit ec7efac4a9)
2009-12-19 08:26:24 -06:00
Juan Quintela 07d00c2174 fdc: fix migration from 0.11
0.11 uses as instance ide io_base, get it back

Signed-off-by: Juan Quintela <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 47f5ba7248)
2009-12-19 08:26:24 -06:00
Juan Quintela 3243a06f51 Revert "fdc: fix vmstate variable passed"
Floppy used the io_base address to register savevm region.

This reverts commit 2966b390d0.

Signed-off-by: Juan Quintela <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit aef30c3c6a)
2009-12-19 08:26:24 -06:00
Jan Kiszka 1c3f96be38 monitor: Accept input only byte-wise
This allows to suspend command interpretation and execution
synchronously, e.g. during migration.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit c62313bbdc)
2009-12-19 08:26:24 -06:00
Anthony Liguori df9e7219db Revert "kvm: x86: Save/restore exception_index"
This reverts commit ebbc8a3d8e.

As suggested by Jan Kiszka,

  "It was obsoleted by d1793b836f8f123b961c613de1bb1c0c185c84cc and now
   saves/restores a useless field."

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit acb6685fea)
2009-12-19 08:26:24 -06:00
Dave Airlie e83421f511 vmware: increase cursor buffer size.
The cursor pixmap size we calculate later ends up being 4096 dwords
long by the looks of it. This boots an F12 LiveCD now.

Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 8095cb3ed2)
2009-12-19 08:26:24 -06:00
Anthony Liguori 2b311b3cce VMware VGA: Only enable dirty log tracking when fifo is disabled
This patch enables dirty log tracking whenever it's needed and disables it
when it is not.

We unconditionally enable dirty log tracking on reset, restart dirty log
tracking when PCI IO regions are remapped, and disable/enable it based on
commands from the guest.

Rebased-by: Dave Airlie <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit b5cc6e32ba)
2009-12-19 08:26:23 -06:00
Anthony Liguori 4b5db3749c Fix VMware VGA depth computation
VMware VGA requires that the depth presented to the guest is the same as the
DisplaySurface that it renders to.  This is because it performs a very simple
memcpy() to blit from one surface to another.

We currently hardcode a 24-bit depth.  The surface allocator for SDL may, and
usually will, allocate a surface with a different depth causing screen
corruption.

This changes the code to allocate the DisplaySurface before initializing the
device which allows the depth of the DisplaySurface to be used instead of
hardcoding something.

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit a6109ff1b5)
2009-12-19 08:26:23 -06:00
Anthony Liguori a1497a782c Make sure to enable dirty log tracking for VMware VGA
This is needed for VMware VGA to work properly under KVM.

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit ee3e41a9a0)
2009-12-19 08:26:23 -06:00
Anthony Liguori 3c547d7bb7 Make sure to enable dirty tracking of VBE vram mapping
Apparently, VBE maps the VGA vram to a fixed physical location.  KVM requires
that all mappings of the VGA vram have dirty tracking enabled on them.  Any
access to the VGA vram through the VBE mapping currently fails to result in
dirty page tracking updates causing a black screen.

This is the true root cause of VMware VGA not working correctly under KVM and
likely also an issue with some of the std-vga black screen issues too.

Cirrus does not enable VBE so it would not be a problem when using Cirrus.

Signed-off-by: Anthony Liguori <[email protected]>
Rebased-by: Dave Airlie <[email protected]>
(cherry picked from commit f0138a63a4)
2009-12-19 08:26:23 -06:00
Dave Airlie 3b43502e3a vmware: setup PCI BAR 2 for FIFO as per vmware spec
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit f351d050dc)
2009-12-19 08:26:23 -06:00
Gerd Hoffmann 078517421f qdev: improve property error reporting.
Add a error message in case we fail to parse a qdev property.

Also make qemu not abort() in case setting a global property can't be
set.  This used to be a clear programming error.  The introduction of
the -global switch changed that though, so better exit instead (after
printing the new error message).

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 9ef5c4bf81)
2009-12-19 08:26:22 -06:00
Gerd Hoffmann afc7055619 fix vga names in default_list
Fix mismerge between 64465297 and 556cd098.

Cc: Markus Armbruster <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 69fd02eea6)
2009-12-19 08:26:22 -06:00
Gerd Hoffmann 53425683d4 usb-host: check mon before using it.
Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit eba6fe8732)
2009-12-19 08:26:22 -06:00
Gerd Hoffmann ef5a63186a usb-net: use qdev for -usbdevice
Rebased to master, adapted to device renaming by armbru,
no other changes.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 42be86ce95)
2009-12-19 08:26:22 -06:00
Gerd Hoffmann 4a0e0accd7 Check rom_load_all() return value.
Check rom_load_all() return value.
Also don't make option rom loading failure fatal.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 15ff770544)
2009-12-19 08:26:22 -06:00
Gerd Hoffmann 73e47683de defaults: update device_list[]
Add isa-fdc (disables default_floppy).
Add ide-drive (disables default_cdrom).

Also walk the -global QemuOpts, so we'll catch
-global isa-fdc.drive{A,B}=<name> too.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d8bcbabf26)
2009-12-19 08:26:21 -06:00
Gerd Hoffmann 115e94a31e defaults: split default_drive
Split default_drive into default_{floppy,cdrom,sdcard}.
Also add QEMUMachine flags to disable them per machine.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit ac33f8fad1)
2009-12-19 08:26:21 -06:00
Luiz Capitulino 5fd5f6999d monitor: Catch printing to non-existent monitor
The monitor_vprintf() function now touches the 'mon' pointer
before calling monitor_puts(), this causes block migration
to segfault as its functions call monitor_printf() with a
NULL 'mon'.

To fix the problem this commit moves the 'mon' NULL check
from monitor_puts() to monitor_vprintf().

This can potentially hide bugs, but for some reason this has
been the behavior for a long time.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2daa119126)
2009-12-19 08:26:21 -06:00
Luiz Capitulino 602e97b725 monitor: Avoid readline functions in QMP
The monitor_read_command() function is readline specific
and should only be used when readline is available.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 183e6e5257)
2009-12-19 08:26:21 -06:00
Luiz Capitulino 97b766dfcd monitor: do_balloon(): Check for errors
do_balloon() should check for ballooning availability as
do_info_balloon() does.

Noted by Daniel P. Berrange <[email protected]>.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit cfdf2c4057)
2009-12-19 08:26:21 -06:00
Luiz Capitulino fb8cf78db6 monitor: Use 'device' in eject
Monitor's eject command uses 'filename' for the device name
argument, but 'device' is a better name.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 78d714e08f)
2009-12-19 08:26:21 -06:00
Luiz Capitulino c5238ac21b QDict: Fix size update
Key replacement should not update the dictionary's size.

This commit also adds a test for the bug.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 29ec3156ee)
2009-12-19 08:26:21 -06:00
Markus Armbruster 99917a99cd qdev: Improve uni-north device names
Switch to the names suggested by Blue Swirl.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 18dd19a7d9)
2009-12-19 08:26:21 -06:00
Daniel P. Berrange 55ed56908f Avoid permanently disabled QEMU monitor when UNIX migration fails
If a UNIX migration command is attempt to a UNIX socket which does
not exist, then the monitor is suspended, but never resumed. This
prevents any further use of the monitor

* migration-unix.c: Only call migrate_fd_monitor_suspend() once
  connected to the UNIX socket.

   Signed-off-by: Daniel P. Berrange <[email protected]>

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2dd650e58a)
2009-12-19 08:26:20 -06:00
Kevin Wolf 139e310025 Fix loading of ELF multiboot kernels
The multiboot implementation assumed that there is only one program header
(which contains the entry point) and that the entry point is at the start of
the code. This doesn't hold true generally and caused too little data to be
loaded.

Fix the loading code to pass the whole loaded data to the Multiboot Option ROM.

Signed-off-by: Kevin Wolf <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 092493be3c)
2009-12-19 08:26:20 -06:00
Kevin Wolf bed93b1dcb Revert "Rename DriveInfo.onerror to on_write_error" (fix mismerge)
Part of the first patch of the -drive rerror series has been merged once more
on top of the rest of the series. This effectively disables the rerror option
and always goes with the default value. Reverting the commit re-enables the
option.

This reverts commit fc072ec4df.

Signed-off-by: Kevin Wolf <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 75f1247539)
2009-12-19 08:26:20 -06:00
Kevin Wolf 73b4ac5cd8 qemu-io: Fix memory leak
Signed-off-by: Kevin Wolf <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 40a0d7c395)
2009-12-19 08:26:20 -06:00
Paolo Bonzini 00e8277b83 Fix thinko in linuxboot.S
The %gs segment that was used was not matching the comments.
I just moved the GDT descriptor on the stack instead.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 36ecd7c016)
2009-12-19 08:26:20 -06:00
Jan Kiszka a8ea3a357b target-i386: Fix evaluation of DR7 register
hw_breakpoint_type and hw_breakpoint_len used the wrong index multiplier
to extract type and len.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d46272c774)
2009-12-19 08:26:20 -06:00
Jan Kiszka f8051485c1 kvm: x86: Use separate exception_injected CPUState field
Marcelo correctly remarked that there are usage conflicts between QEMU
core code and KVM /wrt exception_index. So spend a separate field and
also save/restore it properly.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 31827373f0)
2009-12-19 08:26:20 -06:00
Anthony Liguori 807c80b259 vnc: hextile: do not generate ForegroundSpecified and SubrectsColoured tiles
This violates the RFB specification (section 6.6.4).  It happens to work with
most clients but it's still wrong.

Reported-by: Yaniv Kaul <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 02c2b87fff)
2009-12-19 08:26:20 -06:00
Anthony Liguori 686a3c3dc2 Revert "pci: interrupt disable bit support"
This reverts commit 0ea5709a32.

Per discussion with Michael Tsirkin, this is too risky for 0.12

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d587e07871)
2009-12-19 08:26:19 -06:00
Alexander Graf a381d8277c target-ppc: fix ppc32 kvm build
My segment sync patch broke compilation on PPC32, because it was trying to
sync the SLB even though ppc32 CPUs don't have an SLB.

So let's only sync it when we're on a PP64 one!

Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit 82c09f2f0d)
2009-12-19 09:30:40 +01:00
Alexander Graf 8647b09bfd S390: Bail out without KVM
Currently only the S390 KVM target works. To keep users from accidently not
using KVM, let's not even initialize the machine when KVM is not used.

Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit e249651ca9)
2009-12-18 16:39:40 +01:00
Alexander Graf 9153014fa0 S390: Don't tell guest we're updating config space
Currently we always set the "config space changed" bit to 1 when triggering
any virtio interrupt. While that worked in 2.6.27, newer kernels interpret
that value as "only the config space changed and nothing else happened".

Since we usually trigger interrupts to tell the guest that something did
happen, we just not tell it the config space changed for now until we
implement the correct callback for that.

Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit 86f3dba651)
2009-12-18 16:36:39 +01:00
Alexander Graf f6d4446ea8 add default virtcon initialization
When going through the default devices, we don't initialize the virtio
console, unless we're doing -nographic.

I suppose that's just a leftover from the recent code restructuring, so
let's put it in.

Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit 38536da1e3)
2009-12-18 16:36:39 +01:00
Alexander Graf f1e247ee6b S390: Loop through virtio console devices
We used to always create one single virtio console device. This breaks when
either zero of multiple virtio console devices are requested, so let's use
the same code as on x86.

Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit a1e4b07f04)
2009-12-18 16:36:38 +01:00
Alexander Graf a49668769d target-s390: Fail on unknown instructions
We were being a bit too nice and didn't give the guest an invalid instruction
interrupt.

While that works, it's not exactly the fastest thing to do, since now the
guest doesn't know that we're not really implementing that instruction, so it
continues doing it.

We run into this with the set_page_unstable hint instruction. So let's bail out
in these cases.

Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit d7963c43b9)
2009-12-18 16:36:37 +01:00
Andre Przywara 97d949d9da osdep: Fix runtime failure on older Linux kernels
If QEMU finds newer kernel header files on compilation time, it will use
advertised features like pipe2 or SOCK_CLOEXEC by just doing a compile test.
If later the executables are executed on an older kernel (<2.6.27,
like Xen Dom0 2.6.18), then QEMU will fail on opening sockets and creating
pipes and returns the rather unspecific "qemu_init_main_loop failed".
This patch fixes this by checking the return values of these calls
for EINVAL and ENOSYS and falling back to the older versions automatically.

Signed-off-by: Andre Przywara <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
2009-12-18 16:30:45 +01:00
Juergen Lock 040093b1a5 Fix a make -j race
Make libuser.a depend on $(GENERATED_HEADERS) too so make -j won't start
building it before the headers exist.  (There may be more bugs like this
but at least this makes (g)make -j4 started from scratch on a quadcore
now always complete here again.)

Signed-off-by: Juergen Lock <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit c1bb0dcef2)
2009-12-17 18:27:27 +01:00
Richard Henderson 5d4e53dc81 target-alpha: Fix generic ctz64.
Signed-off-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit 06445248d2)
2009-12-17 18:24:59 +01:00
Stefan Weil 3ebee80226 s390: Fix buggy assignment
nd->model keeps dynamically allocated model names.
So casting of a constant string is wrong here.

Signed-off-by: Stefan Weil <[email protected]>
Acked-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit 5a2b3fc5aa)
2009-12-16 18:25:30 +01:00
Nathan Froyd 869ca150e7 target-mips: fix user-mode emulation startup
Running programs with the MIPS user-mode emulator fails during dynamic
loading, as floating-point instructions are not enabled in in
env->hflags.  Move the code for doing so from fpu_init to cpu_reset so
the MIPS_HFLAG_{FPU,F64} setting doesn't get clobbered by cpu_reset
setting env->hflags to MIPS_HFLAG_UM.

The same end can be achieved by swapping the ordering of fpu_init and
cpu_reset in cpu_mips_init, but it seemed better to consolidate the
CONFIG_USER_ONLY code into a single location.

Signed-off-by: Nathan Froyd <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit 91a7593526)
2009-12-13 21:05:16 +01:00
Andre Przywara 910628f396 target-i386: Update CPUID feature set for TCG
The CPUID features QEMU presented to the guest were not up-to-date
with QEMU's emulated feature set.
Add the missing bits of recent (and not so recent) additions to
QEMU's emulation engine.
For stability reasons only the user mode usable bits are exposed for
now, features like Monitor or CR8LEG are left out.

Signed-off-by: Andre Przywara <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit f1e00a9cf3)
2009-12-13 20:56:26 +01:00
Michael S. Tsirkin 251241dc90 s390: typo fix
s390 code has an obvious typo, which results in:
hw/s390-virtio.c: At top level:
hw/s390-virtio.c:249: error: request for member ‘no_vga’ in something not a structure or union

Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
2009-12-13 19:47:12 +01:00
Michael S. Tsirkin 03a23e5c6e s390: fix build on 32 bit host
Building on 32 bit host we get:
hw/s390-virtio.c: In function ‘s390_init’:
hw/s390-virtio.c:184: error: integer constant is too large for ‘unsigned long’ type
64 bit values must be ULL.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
2009-12-13 19:47:09 +01:00
Anthony Liguori a68fc29ceb Update Changelog and VERSION for 0.12.0-rc2
Signed-off-by: Anthony Liguori <[email protected]>
2009-12-12 08:29:25 -06:00
Glauber Costa 0014803d23 v2: properly save kvm system time msr registers
Currently, the msrs involved in setting up pvclock are not saved over
migration and/or save/restore. This patch puts their value in special
fields in our CPUState, and deal with them using vmstate.

kvm also has to account for it, by including them in the msr list
for the ioctls.

This is a backport from qemu-kvm.git

[v2: sucessfully build without kerneldir ]

Signed-off-by: Glauber Costa <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 1a03675db1)
2009-12-12 08:17:33 -06:00
Luiz Capitulino 5118f7b47c VNC: Convert do_info_vnc() to QObject
Return a QDict with server information. Connected clients are returned
as a QList of QDicts.

The new functions (vnc_qdict_remote_addr(), vnc_qdict_local_addr() and
put_addr_qdict()) are used to insert 'host' and 'service' information
in the returned QDict.

This patch is big, but I don't see how to split it.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d96fd29cca)
2009-12-12 08:17:33 -06:00
Luiz Capitulino 1c1d7bda2c PCI: Convert pci_device_hot_add() to QObject
Return a QDict with information about the just added device.

This commit should not change user output.

Please, note that this patch does not do error handling
conversion. In error conditions the handler still calls
monitor_printf().

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 7a344f7ac7)
2009-12-12 08:17:32 -06:00
Luiz Capitulino bdae662c94 char: Convert qemu_chr_info() to QObject
Each device is represented by a QDict. The returned QObject is a QList
of all devices.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 588b383201)
2009-12-12 08:17:32 -06:00
Luiz Capitulino 0108d4e323 block: Convert bdrv_info_stats() to QObject
Each device statistic information is stored in a QDict and
the returned QObject is a QList of all devices.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 218a536a7a)
2009-12-12 08:17:32 -06:00
Luiz Capitulino 4305793bad block: Convert bdrv_info() to QObject
Each block device information is stored in a QDict and the
returned QObject is a QList of all devices.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d15e546567)
2009-12-12 08:17:32 -06:00
Luiz Capitulino d2d51eeff0 migration: Convert do_info_migrate() to QObject
Return a QDict, which may contain up to more two QDicts, depending
on the type of migration we're performing.

IMPORTANT: as a QInt stores a int64_t integer, RAM values are going
to be stored as int64_t and not as uint64_t as they are today. If
this is a problem QInt will have to be changed.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit c86a668390)
2009-12-12 08:17:32 -06:00
Luiz Capitulino 3be42b28c1 monitor: Convert do_info_mice() to QObject
Each mouse is represented by a QDict, the returned QObject is a QList of
all mice.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit e78c48ec4e)
2009-12-12 08:17:32 -06:00
Luiz Capitulino ee70ef8771 monitor: Convert do_info_uuid() to QObject
snprintf() is used because the UUID_FMT is too complex for
qobject_from_jsonf().

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 9603ceba2e)
2009-12-12 08:17:31 -06:00
Luiz Capitulino 5f9fe0f8d0 monitor: Convert do_info_hpet() to QObject
Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 14f0720df9)
2009-12-12 08:17:31 -06:00
Luiz Capitulino 7589acc9e8 monitor: Convert do_info_name() to QObject
Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit e05486cba6)
2009-12-12 08:17:31 -06:00
Luiz Capitulino 94f539bdac monitor: Convert do_info_kvm() to QObject
Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2af5ba712b)
2009-12-12 08:17:31 -06:00
Luiz Capitulino e637fd2386 monitor: Convert do_info_status() to QObject
Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit c0e8520ed5)
2009-12-12 08:17:31 -06:00
Luiz Capitulino 6e785bee32 monitor: do_info_version(): Use QDict
All 'info' commands should use QDict, this commit also kills
monitor_print_qobject() as do_info_version() doesn't use it
anymore (and no handler will).

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 45e914cfe0)
2009-12-12 08:17:31 -06:00
Luiz Capitulino f883e4f7b8 monitor: do_info_cpus(): Use QBool
While there update the documentation as well.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 55483ad657)
2009-12-12 08:17:31 -06:00
Luiz Capitulino 5daa7bb7a4 monitor: Fix do_info_commands() output
Should return a QDict and should not print the user protocol bits
(eg. "c|cont").

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 1a728677d4)
2009-12-12 08:17:31 -06:00
Luiz Capitulino b0a84d0525 monitor: Fix do_info_balloon() output
Monitor commands should always return values in bytes and info
commands should always return a QDict.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 7f1796713e)
2009-12-12 08:17:31 -06:00
Luiz Capitulino f1f84ba223 QDict: Introduce qdict_get_qlist()
A helper function to get a QList from a QDict.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit f2e1750803)
2009-12-12 08:17:31 -06:00
Luiz Capitulino db830f26cb QDict: Introduce qdict_get_qbool()
This is a helper function that does type checking before retrieving
a QBool from the dictionary.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit cd4dde36ae)
2009-12-12 08:17:31 -06:00
Luiz Capitulino 61a606dade Makefile: move QObject objs to their own entry
Other subsystems will need to link against them.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2a01000f7d)
2009-12-12 08:17:31 -06:00
Luiz Capitulino 2d95575edb Introduce qemu-objects.h header file
An easy way to include all QEMU objects.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2471dd00ef)
2009-12-12 08:17:31 -06:00
Gerd Hoffmann d707483ce3 vnc: fix capslock tracking logic.
The capslock tracking logic added by commit
6b1325029d doesn't work correctly for vnc
clients without EXT_KEY_EVENT support.  The reason is that qemu converts
keysyms for letters to lowercase for the keysym2scancode lookup.  It
then also passes the lowercase value down to do_key_event(), but the
capslock tracking code needs it with the correct case to work properly.

This patch adds a new variable for the lowercase keysym so we'll keep
the unmodified value for do_key_event().

The keysym2scancode is not needed with EXT_KEY_EVENT capable clients
like any app based on the gtk-vnc widget, so I missed that case in
testing ...

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 4a93fe1708)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann e2deb622c2 QemuOpts: allow larger option values.
Use case: loooooooooooooooooong file names for -drive file=...

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d318ff9900)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann 6e792a557e scsi: fix drive hotplug.
This patch fills the DriveInfo->unit after hotplugging a scsi disk.
It makes a difference when auto-assigning a scsi id, where unit was
left filled with '-1' instead of the actual scsi id.

With this patch applied the the drive naming logic in drive_init() works
as good as it did in previous releases.  Which means it works fine with
a single scsi bus.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 11f4d7f483)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann ea2138cf90 pci: don't hw_error() when no slot is available.
Current PCI code will simply hw_error() and thus abort in case no free
PCI slot is available or the requested PCI slot is already in use by
another device.  For the hotplug case this behavior is not acceptable.
This patch makes qemu pass up the error properly, so the calling code
can decide whenever it wants to exit with an error (on startup) or
whenever it wants to continue (hotplug).

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 09e3acc6cf)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann 992f3cb78e pci: don't abort() when trying to hotplug with acpi off.
The PCI bus on x86 requires ACPI for hotplug support, thus disbling ACPI
also disables hotplug for the PCI bus.  This patch makes qemu check
whenever the PCI bus in question can handle hotplug before trying to add
devices.  This is needed because qdev will abort() on any attempt to
hotplug devices into a non-hotpluggable bus.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 53e0d8affe)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann 828b2ff676 Set default console to virtio on S390x
All "normal" system emulation targets in qemu I'm aware of display
output on either VGA or serial output.

Our S390x virtio machine doesn't have such kind of legacy hardware. So
instead we need to default to a virtio console.

Add flags to QEMUMachine to indicate which kind of default devices make
sense for the machine in question.  Use it for S390x: enable virtcon,
disable serial, parallel and vga.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 986c5f7854)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann a231a8272c default devices: virtio consoles.
This patch adds a variable default_virtcon which says whenever a default
virtio console should be added.  It is disabled by default, followup
patch will enable it for s390.  It is cleared when qemu finds
'-virtiocon', '-device virtio-console-s390' or '-device
virtio-console-pci' on the command line.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit aee1b935c5)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann f2604b35dc add -qmp convinience switch
Acts like -monitor but switched into qmp mode.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 6ca5582d4f)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann fc05630f1f add new -mon switch
Add -mon switch which maps pretty straight forward into the QemuOpts
internal representation:

  -mon chardev=<name>[,mode=[control|readline]][,[no]default]

Via config file:

[mon]
   chardev = "<name>"
   mode = "readline"
   default = "on"

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 22a0e04b9b)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann ad960ddbce rework -monitor handling, switch to QemuOpts
This patch reworks the -monitor handling:

 - It adds a new "mon" QemuOpts list for the monitor(s).
 - It adds a monitor_parse() function to parse the -monitor switch.
 - It adds a mon_init function to initialize the monitor(s) from the
   "mon" QemuOpts list.
 - It winds up everything and removes the old bits.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 8858934370)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann 239a69680c un-static qemu_chr_parse_compat()
Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 33521634bf)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann f4f1df70f2 default devices: drives
Add a default_drive variable which specified whenever the default drives
(cdrom, floppy, sd) should be created.  It is cleared when the new
-nodefaults switch is specified on the command line.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit aa40fc9c96)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann 782e9e6554 default devices: network
Add a default_net variable which specified whenever a default network
should be created.  It is cleared in case any -net option is specified
and it is also added to the new -nodefaults switch.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit cb4522ccf6)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann 64de0113f1 default devices: add global cmd line option.
Add global command line option to disable default devices.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d8c208dd8a)
2009-12-12 08:17:30 -06:00
Gerd Hoffmann 84db615abc default devices: vga adapter.
Qemu creates a vga display for you in case you didn't specify one on the
command line.  Right now this is tied to the '-vga <type>' command line
switch, which in turn causes trouble if you are creating your gfx card
using '-device VGA,<props>'.

This patch adds a variable default_vga which says whenever a default
serial line should be added.  It is enabled by default.  It is cleared
when qemu finds '-vga' or '-device {VGA,Cirrus VGA,QEMUware SVGA}' on
the command line.

'-device VGA' still doesn't work though due to a initialization order
issue (vga must init before calling i440fx_init_memory_mappings).

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 64465297cd)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann 7c6a56cc63 zap serial_monitor_mux
The logic in this code obviously predates the multiple monitor
capability of qemu and looks increasingly silly these days.

I think the intention of this piece of code is to get a reasonable
default for the -nographic case: have monitor and serial line muxed
on stdio.

With the new default_serial and default_monitor variables we have now
doing just that became much easier ;)

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit e1c09175bc)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann a20600b917 default devices: qemu monitor.
This patch makes the monitor default device configuration work like the
default serial and parallel port devices.  It adds a variable
default_monitor which says whenever a default monitor should be added.
It is enabled by default.  It is cleared when qemu finds '-monitor' on
the command line.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit abdeed06b4)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann 4986fd4111 default devices: parallel port.
Qemu creates a default parallel port for you in case you didn't specify
one on the command line.  Right now this is tied to the '-parallel
<chardev>' command line switch, which in turn causes trouble if you are
creating your parallel port via '-device isa-parallel,<props>'.

This patch adds a variable default_parallel which says whenever a default
parallel port should be added.  It is enabled by default.  It is cleared
when qemu finds '-parallel' or '-device isa-parallel' on the command line.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 6a5e8b0e31)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann 96639424e2 default devices: core code & serial lines.
Qemu creates a default serial line for you in case you didn't specify
one on the command line.  Right now this is tied to the '-serial
<chardev>' command line switch, which in turn causes trouble if you are
creating your serial line via '-device isa-serial,<props>'.

This patch adds a variable default_serial which says whenever a default
serial line should be added.  It is enabled by default.  It is cleared
when qemu finds '-serial' or '-device isa-serial' on the command line.

Part of the patch is some infrastructure for the '-device $driver'
checking (default_driver_check function) which will also be used by the
other patches of this series.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 998bbd74b9)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann 6ac733bf09 vc: colorize chardev title line with blue background.
Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 735ba58849)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann 25d82d3311 chardev: move greeting into vc backend.
Make the 'vc' chardev backend print a title line with the chardev name
after initialization, using CharDriverState->label.

This replaces the banner printing code in vl.c.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 51bfa4d316)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann f9800fe5a0 Revert "Set default console to virtio on S390x"
This reverts commit 93d434b4ae.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 014100bb73)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann 542d991b4c Revert "monitor: Command-line flag to enable control mode"
This reverts commit adcb181afe.

Conflicts:

	monitor.h

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 4e307fc883)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann d1d6963eba chardev: make chardevs specified in config file work.
The patch decuples the -chardev switch and the actual chardev
initialization.  Without this patch qemu ignores chardev entries
coming via -readconfig.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 1a688d3bbc)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann 7058b807cd qdev: also match bus name for global properties
i.e. -global PCI.<property>=<value> will set a default property for all
PCI devices.  Also works for the compat properties used by machine
types.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 07a8de3566)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann f49d2561cb qdev: add command line option to set global defaults for properties.
This patch adds infrastructure and command line option for setting
global defaults for device properties, i.e. you can for example use

  -global virtio-blk-pci.vectors=0

to turn off msi by default for all virtio block devices.  The config
file syntax is:

[global]
  driver = "virtio-blk-pci"
  property = "vectors"
  value = "0"

This can also be used to set properties for devices which are not
created via -device but implicitly via machine init, i.e.

  -global isa-fdc,driveA=<name>

This patch uses the mechanism which configures properties for the
compatibility machine types (pc-0.10 & friends).  The command line
takes precedence over the machine type values.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit d0fef6fbea)
2009-12-12 08:17:29 -06:00
Gerd Hoffmann a63e5f1971 qdev: make compat stuff more generic
This patch renames the compat properties into global properties and
makes them more generic.  The compatibility stuff is only one of
multiple possible users now.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 458fb6792d)
2009-12-12 08:17:29 -06:00
Jan Kiszka ebbc8a3d8e kvm: x86: Save/restore exception_index
As KVM now makes use of exception_index to keep pending exceptions, we
have to save&restore this field as well.

NOTE: We have to nail the arch-independent exception_index down to a
certain bit width for proper vmstate processing, namely to 32 bit.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 4d6e3ac5d4)
2009-12-12 08:17:28 -06:00
Markus Armbruster 08b2d3ba9a Fix recently added QERR_ definitions
Commits c7c338c4, 41471a23, 7a046f5f and a488be27 used
lower_case_with_underscores for class values.  Existing usage
CamelCase.  ChangeToThatForConsistency.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit bd9d30640c)
2009-12-12 08:17:28 -06:00
Markus Armbruster 72fbd9f97c qdev: Replace device names containing whitespace
Device names with whitespace require quoting in the shell and in the
monitor.  Some of the offenders are also overly long.  Some have a
more convenient alias, some don't.

The place for verbose device names is DeviceInfo member desc.  The
name should be short & sweet.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 556cd09885)
2009-12-12 08:17:28 -06:00
Markus Armbruster 5b6d0419d9 qdev: Separate USB product description from qdev name
Using the qdev name for the product description makes for inconvenient
qdev names.

Put the product description in new USBDeviceInfo member product_desc.
Make usb_qdev_init() use it.  No user or guest visible change, since
the value is still the same.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 063846984c)
2009-12-12 08:17:28 -06:00
Markus Armbruster 9df9eeeb18 qdev: Rename USBDevice member devname to product_desc
It's not a device name, it's the USB product description string.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 0fe6d12e0b)
2009-12-12 08:17:28 -06:00
Gleb Natapov 5b6321a237 fix rtc-td-hack on host without high-res timers
On hosts without high-res timers it is impossible to inject rtc interrupt
faster then 1kHz. Windows sometimes configures RTC to generate 1kHz
interrupts, so we can't inject missed interrupts when running on such
hosts. Always injecting an interrupt on REG_C read is also not an option
since Windows wait for REG_C to become zero with interrupt disabled
during boot. This patch uses mixed approach: accelerate timer + inject
up to 1000 interrupts on REG_C read.

Signed-off-by: Gleb Natapov <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit ba32edab7f)
2009-12-12 08:17:28 -06:00
Michael S. Tsirkin 5e0c455842 virtio: verify features on load
migrating between hosts which have different features
might break silently, if the migration destination
does not support some features supported by source.

Prevent this from happening by comparing acked feature
bits with the mask supported by the device.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 6d74ca5aa8)
2009-12-12 08:17:28 -06:00
Dave Airlie 4d687b13cf vmware_vga: add rom file so that it boots.
This just adds the rom file to the vmware SVGA chipset so it boots.

Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit b3c3f123f7)
2009-12-12 08:17:28 -06:00
Anthony Liguori d7b8193716 Do not abort on qemu_malloc(0) in production builds
qemu_malloc() does not allow size=0 to be passed in and aborts on this behavior.

Unfortunately, there is good reason to believe that within qemu, there are a
number of, so far, undetected places that assume size=0 can be safely passed.
Since we do not want to abort unnecessarily in production builds, return
qemu_malloc(1) whenever the version file indicates that this is a production
build.

Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 20ff6c8066)
2009-12-12 08:17:26 -06:00
Paul Brook 2e51813417 Fix ARM userspace strex implementation.
Signed-off-by: Paul Brook <[email protected]>
2009-12-11 15:49:14 +00:00
Michael S. Tsirkin 90f445e1c9 qemu: delete rule target on error
Instruct make to remove any rule target on error. This prevetns
situation where there was an error during build but generated file still
stays behind.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 7dbbbb0c9e)
2009-12-07 16:36:50 -06:00
Markus Armbruster 143d288cba QMP: add human-readable description to error response
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 77e595e7c6)
2009-12-07 16:36:50 -06:00
Markus Armbruster 13a2ccc46f monitor: convert do_getfd() to QError
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 7cdfcfe18f)
2009-12-07 16:36:50 -06:00
Markus Armbruster ea2b7d7079 QError: New QERR_TOO_MANY_FILES
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit a488be27e5)
2009-12-07 16:36:50 -06:00
Markus Armbruster 0b52786ce1 New QERR_INVALID_PARAMETER
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 7a046f5f14)
2009-12-07 16:36:50 -06:00
Markus Armbruster e36469149a QError: New QERR_FD_NOT_SUPPLIED
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 41471a2338)
2009-12-07 16:36:50 -06:00
Markus Armbruster e5fc266be5 monitor: convert do_closefd() to QError
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 063c1a0918)
2009-12-07 16:36:50 -06:00
Markus Armbruster 3e4cd634cc QError: New QERR_FD_NOT_FOUND
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit c7c338c497)
2009-12-07 16:36:50 -06:00
Markus Armbruster 06976f82e7 monitor: convert do_change() to QObject, QError
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit ec3b82afaa)
2009-12-07 16:36:50 -06:00
Markus Armbruster fe7c6c90a8 QError: New QERR_VNC_SERVER_FAILED
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit a6906e31a8)
2009-12-07 16:36:50 -06:00
Markus Armbruster 960a4b537a QError: New QERR_SET_PASSWD_FAILED
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 7a84cb23c0)
2009-12-07 16:36:49 -06:00
Markus Armbruster c756b1e762 QError: New QERR_INVALID_BLOCK_FORMAT
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 17901e7532)
2009-12-07 16:36:49 -06:00
Markus Armbruster 06921ec84f monitor: convert do_eject() to QError
Also affects do_change(), because the two share eject_device().

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2c2a6bb860)
2009-12-07 16:36:49 -06:00
Markus Armbruster 8cb1cec656 QError: New QERR_DEVICE_NOT_REMOVABLE
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 5cfe026475)
2009-12-07 16:36:49 -06:00
Markus Armbruster a46657d185 QError: New QERR_DEVICE_LOCKED
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit b086838090)
2009-12-07 16:36:49 -06:00
Markus Armbruster 28acf422cb QError: Put error definitions in alphabetical order
Also fix the odd typoe and clean up whitespace.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit e16a181222)
2009-12-07 16:36:49 -06:00
Markus Armbruster a7d5da8857 monitor: Fix double-prompt after "change vnc passwd BLA"
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 2895e075c6)
2009-12-07 16:36:49 -06:00
Luiz Capitulino 931a548be3 monitor: do_cont(): Don't ask for passwords
The do_cont() function will ask the user to enter a password if a
device is encrypted.

This is invalid under QMP, so we raise a QERR_DEVICE_ENCRYPTED
error.

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 94171e119c)
2009-12-07 16:36:49 -06:00
Luiz Capitulino bcddbd0f6a QError: new class for device encrypted errors
Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 0df37c411c)
2009-12-07 16:36:49 -06:00
Luiz Capitulino b3dfdb5a3b monitor: Introduce 'block_passwd' command
When using encrypted disk images, QEMU will prompt the user
for passwords when started.

This makes sense for the user protocol, but doesn't for QMP.

The solution is to have Monitor command which allows the user
or a Client to set passwords in advance, so that we avoid
the prompt completely.

This is what block_passwd does, for example:

(QEMU) block_passwd ide0-hd0 foobar

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit a3a55a2edb)
2009-12-07 16:36:49 -06:00
Luiz Capitulino 6ccc51fd20 QError: Add class for invalid passwords
Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit f6d855c50d)
2009-12-07 16:36:49 -06:00
Michael S. Tsirkin 0ea5709a32 pci: interrupt disable bit support
Interrupt disable bit is mandatory in PCI spec.
Implement it to make devices spec compliant.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Isaku Yamahata <[email protected]>
(cherry picked from commit b6981cb57b)
2009-12-07 16:36:49 -06:00
Michael S. Tsirkin 67a2698dac pci: interrupt status bit implementation
interrupt status is a mandatory feature in PCI spec,
so devices must implement it to be spec compliant.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Isaku Yamahata <[email protected]>
(cherry picked from commit f9bf77dd1f)
2009-12-07 16:36:48 -06:00
Michael S. Tsirkin eea4acfa5c pci: prepare irq code for interrupt state
This rearranges code in preparation for interrupt state
implementation.
Changes:
	- split up bus walk away from interrupt handling
          into a subroutine
	- change irq_state from an array to bitmask
	- verify that irq_state values are 0 or 1 on load

There are no functional changes.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Isaku Yamahata <[email protected]>
(cherry picked from commit d036bb215e)
2009-12-07 16:36:48 -06:00
Michael S. Tsirkin c99d32efe6 msix: function mask support
Function mask is a mandatory feature in MSIX
spec so not implementing it is a spec violation.
Implement.

Signed-off-by: Michael S. Tsirkin <[email protected]>
(cherry picked from commit 5b5cb08683)
2009-12-07 16:36:48 -06:00
Michael S. Tsirkin 9fa7591beb msix: macro rename for function mask support
rename ENABLE_OFFSET -> CONTROL_OFFSET, since
same byte includes function mask.
This is in preparation for function mask support.

Signed-off-by: Michael S. Tsirkin <[email protected]>
(cherry picked from commit 2760952ba9)
2009-12-07 16:36:48 -06:00
Andre Przywara 066263f377 cpuid: Fix multicore setup on Intel
The multicore CPUID code detects whether the guest is an Intel or an
AMD CPU, because the Linux kernel is picky about the CmpLegacy bit.
KVM by default passes through the host's vendor, which was not
catched by the code. So fork out the vendor determining bits into a
separate function to be used from both places and always get the real
vendor.
This fixes KVM's multicore setup on Intel CPUs.

Signed-off-by: Andre Przywara <[email protected]>
Reported-by: Dietmar Maurer <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 6d9fef1a02)
2009-12-07 16:36:48 -06:00
Jan Kiszka 20c1a35211 kvm: x86: Fix initial kvm_has_msr_star
KVM_GET_MSR_INDEX_LIST returns -E2BIG when the provided space is too
small for all MSRs. But this is precisely the error we trigger with the
initial request in order to obtain that size. Do not fail in that case.

This caused a subtle corruption of the guest state as MSR_STAR was not
properly saved/restored. The corruption became visible with latest kvm
optimizing the MSR updates.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
(cherry picked from commit 6fb6d24554)
2009-12-07 16:36:46 -06:00
Aurelien Jarno ea6112b165 Update OpenBIOS images to r640
Signed-off-by: Aurelien Jarno <[email protected]>
2009-12-06 13:00:22 +01:00
Anthony Liguori e222100afe Update version to -rc1
Signed-off-by: Anthony Liguori <[email protected]>
2009-12-05 11:22:19 -06:00
127 changed files with 2035 additions and 5868 deletions

No files matched your search

-1
View File
@@ -46,7 +46,6 @@ 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 -1
View File
@@ -75,7 +75,7 @@ Main loop Fabrice Bellard (new maintainer needed)
TCG Fabrice Bellard
IDE device ?
SCSI device Paul Brook
PCI layer Michael S. Tsirkin
PCI layer ?
USB layer ?
Block layer ?
Graphic layer ?
+130 -32
View File
@@ -1,5 +1,6 @@
# Makefile for QEMU.
# This needs to be defined before rules.mak
GENERATED_HEADERS = config-host.h
ifneq ($(wildcard config-host.mak),)
@@ -7,7 +8,7 @@ ifneq ($(wildcard config-host.mak),)
all: build-all
include config-host.mak
include $(SRC_PATH)/rules.mak
config-host.mak: $(SRC_PATH)/configure
config-host.mak: configure
@echo $@ is out-of-date, running configure
@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
else
@@ -24,7 +25,7 @@ configure: ;
.PHONY: all clean cscope distclean dvi html info install install-doc \
recurse-all speed tar tarbin test build-all
$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
LIBS+=-lz $(LIBS_TOOLS)
@@ -42,22 +43,12 @@ config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
%/config-devices.mak: default-configs/%.mak
$(call quiet-command,cat $< > $@.tmp, " GEN $@")
@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; \
@if test -f $@ ; then \
echo "WARNING: $@ out of date." ;\
echo "Run \"make defconfig\" to regenerate." ; \
rm $@.tmp ; \
else \
mv $@.tmp $@; \
cp -p $@ $@.old; \
mv $@.tmp $@ ; \
fi
defconfig:
@@ -75,10 +66,7 @@ SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
subdir-%: $(GENERATED_HEADERS)
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
include $(SRC_PATH)/Makefile.objs
$(common-obj-y): $(GENERATED_HEADERS)
$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y)
$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
$(filter %-user,$(SUBDIR_RULES)): libuser.a
@@ -93,8 +81,124 @@ ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
#######################################################################
# 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.
obj-y = $(block-obj-y)
obj-y += $(net-obj-y)
obj-y += $(qobject-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 += 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
@@ -125,23 +229,17 @@ 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
obj-y = qemu-img.o qemu-tool.o $(block-obj-y) $(qobject-obj-y)
qemu-img$(EXESUF): qemu-img.o qemu-tool.o $(block-obj-y) $(qobject-obj-y)
qemu-img$(EXESUF): $(obj-y)
qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o $(block-obj-y) $(qobject-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-io$(EXESUF): qemu-io.o qemu-tool.o cmd.o $(block-obj-y) $(qobject-obj-y)
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
+32 -3
View File
@@ -7,16 +7,45 @@ include $(SRC_PATH)/rules.mak
.PHONY: all
$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
include $(SRC_PATH)/Makefile.objs
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
all: $(hw-obj-y)
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)
# Dummy command so that make thinks it has done something
@true
$(HWLIB): $(obj-y)
clean:
rm -f *.o *.d *.a *~
-155
View File
@@ -1,155 +0,0 @@
#######################################################################
# 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
+14 -34
View File
@@ -1,21 +1,17 @@
# -*- 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)
$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
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)
@@ -68,10 +64,10 @@ libobj-$(CONFIG_S390_DIS) += s390-dis.o
libobj-$(CONFIG_SH4_DIS) += sh4-dis.o
libobj-$(CONFIG_SPARC_DIS) += sparc-dis.o
$(libobj-y): $(GENERATED_HEADERS)
# libqemu
libqemu.a: $(libobj-y)
translate.o: translate.c cpu.h
translate-all.o: translate-all.c cpu.h
@@ -91,8 +87,7 @@ signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
ifdef CONFIG_LINUX_USER
$(call set-vpath, $(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR))
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
@@ -111,10 +106,7 @@ obj-arm-y += arm-semi.o
obj-m68k-y += m68k-sim.o m68k-semi.o
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
obj-y += $(addprefix ../libuser/, $(user-obj-y))
obj-y += $(libobj-y)
ARLIBS=../libuser/libuser.a libqemu.a
endif #CONFIG_LINUX_USER
@@ -123,8 +115,7 @@ endif #CONFIG_LINUX_USER
ifdef CONFIG_DARWIN_USER
$(call set-vpath, $(SRC_PATH)/darwin-user)
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
@@ -137,10 +128,7 @@ obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
obj-i386-y += ioport-user.o
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
obj-y += $(addprefix ../libuser/, $(user-obj-y))
obj-y += $(libobj-y)
ARLIBS=../libuser/libuser.a libqemu.a
endif #CONFIG_DARWIN_USER
@@ -149,8 +137,7 @@ endif #CONFIG_DARWIN_USER
ifdef CONFIG_BSD_USER
$(call set-vpath, $(SRC_PATH)/bsd-user)
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 \
@@ -158,10 +145,7 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
obj-i386-y += ioport-user.o
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
obj-y += $(addprefix ../libuser/, $(user-obj-y))
obj-y += $(libobj-y)
ARLIBS=../libuser/libuser.a libqemu.a
endif #CONFIG_BSD_USER
@@ -210,7 +194,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 debugcon.o multiboot.o
obj-i386-y += ne2000-isa.o
# shared objects
obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
@@ -319,21 +303,17 @@ vl.o: qemu-options.h
monitor.o: qemu-monitor.h
$(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))
ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
endif # CONFIG_SOFTMMU
obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
$(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
gdbstub-xml.c: $(TARGET_XML_FILES) 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
+8 -4
View File
@@ -2,20 +2,24 @@
include ../config-host.mak
include $(SRC_PATH)/rules.mak
-include config.mak
.PHONY: all
$(call set-vpath, $(SRC_PATH))
VPATH=$(SRC_PATH)
QEMU_CFLAGS+=-I..
include $(SRC_PATH)/Makefile.objs
obj-y =
obj-y += envlist.o path.o
obj-y += tcg-runtime.o host-utils.o
obj-y += cutils.o cache-utils.o
all: $(user-obj-y)
all: libuser.a
# Dummy command so that make thinks it has done something
@true
libuser.a: $(obj-y)
clean:
rm -f *.o *.d *.a *~
+1 -1
View File
@@ -1 +1 @@
0.12.50
0.12.0
+1 -12
View File
@@ -240,9 +240,7 @@ 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;
@@ -283,7 +281,6 @@ 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;
@@ -292,17 +289,9 @@ 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
#ifdef OSS_GETVERSION
&& version >= 0x040000
#else
0
#endif
)
{
if (conf.policy >= 0 && version >= 0x040000) {
int policy = conf.policy;
if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
+2 -2
View File
@@ -396,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 if (!realpath(filename, backing_filename))
return -errno;
else
realpath(filename, backing_filename);
bdrv_qcow2 = bdrv_find_format("qcow2");
options = parse_option_parameters("", bdrv_qcow2->create_options, NULL);
+4 -12
View File
@@ -146,9 +146,7 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags)
bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512;
}
if (lseek(s->fd, le32_to_cpu(bochs.header), SEEK_SET) == (off_t)-1) {
goto fail;
}
lseek(s->fd, le32_to_cpu(bochs.header), SEEK_SET);
s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog);
s->catalog_bitmap = qemu_malloc(s->catalog_size * 4);
@@ -199,13 +197,9 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
// bitmap_offset, block_offset);
// read in bitmap for current extent
if (lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET) ==
(off_t)-1) {
return -1;
}
lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET);
if (read(s->fd, &bitmap_entry, 1) != 1)
return -1;
read(s->fd, &bitmap_entry, 1);
if (!((bitmap_entry >> (extent_offset % 8)) & 1))
{
@@ -214,9 +208,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
return -1; // not allocated
}
if (lseek(s->fd, block_offset, SEEK_SET) == (off_t)-1) {
return -1;
}
lseek(s->fd, block_offset, SEEK_SET);
return 0;
}
+2 -5
View File
@@ -411,17 +411,14 @@ 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 + header.block_size - 1) / header.block_size !=
(uint64_t)header.blocks_in_image) {
} else if (header.disk_size !=
(uint64_t)header.blocks_in_image * header.block_size) {
logout("unexpected block number %u B\n", header.blocks_in_image);
goto fail;
} else if (!uuid_is_null(header.uuid_link)) {
+12 -44
View File
@@ -28,13 +28,6 @@
#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
@@ -236,7 +229,7 @@ int keymap[] =
*/
};
static int cocoa_keycode_to_qemu(int keycode)
int cocoa_keycode_to_qemu(int keycode)
{
if((sizeof(keymap)/sizeof(int)) <= keycode)
{
@@ -305,11 +298,6 @@ static int cocoa_keycode_to_qemu(int keycode)
[super dealloc];
}
- (BOOL) isOpaque
{
return YES;
}
- (void) drawRect:(NSRect) rect
{
COCOA_DEBUG("QemuCocoaView: drawRect\n");
@@ -327,7 +315,7 @@ static int cocoa_keycode_to_qemu(int keycode)
screen.bitsPerComponent, //bitsPerComponent
screen.bitsPerPixel, //bitsPerPixel
(screen.width * (screen.bitsPerComponent/2)), //bytesPerRow
#ifdef __LITTLE_ENDIAN__
#if __LITTLE_ENDIAN__
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), //colorspace for OS X >= 10.4
kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
#else
@@ -339,7 +327,7 @@ static int cocoa_keycode_to_qemu(int keycode)
0, //interpolate
kCGRenderingIntentDefault //intent
);
// test if host supports "CGImageCreateWithImageInRect" at compile time
// test if host support "CGImageCreateWithImageInRect" at compiletime
#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
@@ -349,11 +337,7 @@ static 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;
@@ -419,7 +403,7 @@ static 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:NO];
[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];
}
screen.width = w;
screen.height = h;
@@ -436,8 +420,8 @@ static int cocoa_keycode_to_qemu(int keycode)
isFullscreen = FALSE;
[self ungrabMouse];
[self setContentDimensions];
// test if host supports "exitFullScreenModeWithOptions" at compile time
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
// test if host support "enterFullScreenMode:withOptions" at compiletime
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
if ([NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime
[self exitFullScreenModeWithOptions:nil];
} else {
@@ -446,15 +430,15 @@ static 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_5)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
}
#endif
} else { // switch from desktop to fullscreen
isFullscreen = TRUE;
[self grabMouse];
[self setContentDimensions];
// test if host supports "enterFullScreenMode:withOptions" at compile time
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
// test if host support "enterFullScreenMode:withOptions" at compiletime
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
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,
@@ -470,7 +454,7 @@ static 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_5)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
}
#endif
}
@@ -740,7 +724,6 @@ static 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];
@@ -784,11 +767,6 @@ static 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");
@@ -805,7 +783,7 @@ static int cocoa_keycode_to_qemu(int keycode)
if(returnCode == NSCancelButton) {
exit(0);
} else if(returnCode == NSOKButton) {
const char *bin = "qemu";
char *bin = "qemu";
char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
char **argv = (char**)malloc( sizeof(char*)*3 );
@@ -861,16 +839,6 @@ 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];
@@ -954,7 +922,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
w * [cocoaView cdx],
h * [cocoaView cdy]);
}
[cocoaView setNeedsDisplayInRect:rect];
[cocoaView displayRect:rect];
}
static void cocoa_resize(DisplayState *ds)
Vendored
+38 -6
View File
@@ -1707,6 +1707,37 @@ 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"
@@ -1991,6 +2022,9 @@ 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
@@ -2107,7 +2141,7 @@ esac
tools=
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
if [ "$linux" = "yes" ] ; then
tools="qemu-nbd\$(EXESUF) $tools"
if [ "$check_utests" = "yes" ]; then
tools="check-qint check-qstring check-qdict check-qlist $tools"
@@ -2393,7 +2427,7 @@ fi
if test "$target_softmmu" = "yes" ; then
echo "CONFIG_SOFTMMU=y" >> $config_target_mak
echo "LIBS+=$libs_softmmu" >> $config_target_mak
echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_target_mak
echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
fi
if test "$target_user_only" = "yes" ; then
@@ -2414,7 +2448,7 @@ if test ! -z "$gdb_xml_files" ; then
fi
case "$target_arch2" in
alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
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
;;
*)
@@ -2610,6 +2644,7 @@ 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
@@ -2617,6 +2652,3 @@ 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
+1 -2
View File
@@ -1017,8 +1017,7 @@ static inline int64_t cpu_get_real_ticks (void)
#endif
}
#elif defined(__mips__) && \
((defined(__mips_isa_rev) && __mips_isa_rev >= 2) || defined(__linux__))
#elif (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
View File
@@ -82,9 +82,9 @@ static inline uint64_t cpu_ppc_get_tb (CPUState *env)
return 0;
}
uint64_t cpu_ppc_load_tbl (CPUState *env)
uint32_t cpu_ppc_load_tbl (CPUState *env)
{
return cpu_ppc_get_tb(env);
return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
}
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;
}
uint64_t cpu_ppc_load_atbl (CPUState *env)
uint32_t cpu_ppc_load_atbl (CPUState *env)
{
return cpu_ppc_get_tb(env);
return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
}
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, uint32_t *valp)
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, uint32_t val)
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val)
{
return -1;
}
+6 -8
View File
@@ -192,11 +192,7 @@ 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;
@@ -1530,22 +1526,24 @@ 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) {
spin_lock(&interrupt_lock);
if (tb && !testandset(&interrupt_lock)) {
env->current_tb = NULL;
tb_reset_jump_recursive(tb);
spin_unlock(&interrupt_lock);
resetlock(&interrupt_lock);
}
#endif
}
/* mask must never be zero, except for A20 change call */
@@ -2917,7 +2915,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;
}
+1 -1
View File
@@ -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
+2 -2
View File
@@ -61,7 +61,7 @@ typedef struct {
*----------------------------------------------------------------------------*/
#if defined(TARGET_SPARC)
#define float32_default_nan make_float32(0x7FFFFFFF)
#elif defined(TARGET_POWERPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA)
#elif defined(TARGET_POWERPC) || defined(TARGET_ARM)
#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) || defined(TARGET_ALPHA)
#elif defined(TARGET_POWERPC) || defined(TARGET_ARM)
#define float64_default_nan make_float64(LIT64( 0x7FF8000000000000 ))
#elif defined(TARGET_HPPA)
#define float64_default_nan make_float64(LIT64( 0x7FF4000000000000 ))
-1
View File
@@ -187,7 +187,6 @@ 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
+3 -15
View File
@@ -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 | !!(env->hflags & MIPS_HFLAG_M16));
case 37: GET_REGL(env->active_tc.PC);
case 72: GET_REGL(0); /* fp */
case 89: GET_REGL((int32_t)env->CP0_PRid);
}
@@ -1114,14 +1114,7 @@ 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 & ~(target_ulong)1;
if (tmp & 1) {
env->hflags |= MIPS_HFLAG_M16;
} else {
env->hflags &= ~(MIPS_HFLAG_M16);
}
break;
case 37: env->active_tc.PC = tmp; break;
case 72: /* fp, ignored */ break;
default:
if (n > 89)
@@ -1665,12 +1658,7 @@ 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 & ~(target_ulong)1;
if (pc & 1) {
s->c_cpu->hflags |= MIPS_HFLAG_M16;
} else {
s->c_cpu->hflags &= ~(MIPS_HFLAG_M16);
}
s->c_cpu->active_tc.PC = pc;
#elif defined (TARGET_MICROBLAZE)
s->c_cpu->sregs[SR_PC] = pc;
#elif defined (TARGET_CRIS)
+22 -27
View File
@@ -1284,42 +1284,37 @@ 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 */
/* TODO: no need to override */
c[PCI_COMMAND] = 0x00; /* pcicmd pci command rw, ro */
c[PCI_COMMAND + 1] = 0x00;
c[0x04] = 0x00; /* pcicmd pci command rw, ro */
c[0x05] = 0x00;
/* TODO: */
c[PCI_STATUS] = PCI_STATUS_FAST_BACK; /* pcists pci status rwc, ro */
c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;
c[0x06] = 0x80; /* pcists pci status rwc, ro */
c[0x07] = 0x02;
c[PCI_REVISION_ID] = 0x01; /* rid revision ro */
c[PCI_CLASS_PROG] = 0x00; /* pi programming interface ro */
c[0x08] = 0x01; /* rid revision ro */
c[0x09] = 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 */
/* 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[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. */
/* 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[0x14] = 0x01; /* nabmbar native audio bus mastering
base address rw */
c[0x15] = 0x00;
c[0x16] = 0x00;
c[0x17] = 0x00;
c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86; /* svid subsystem vendor id rwo */
c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80;
c[0x2c] = 0x86; /* svid subsystem vendor id rwo */
c[0x2d] = 0x80;
c[PCI_SUBSYSTEM_ID] = 0x00; /* sid subsystem id rwo */
c[PCI_SUBSYSTEM_ID + 1] = 0x00;
c[0x2e] = 0x00; /* sid subsystem id rwo */
c[0x2f] = 0x00;
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 */
c[0x3c] = 0x00; /* intr_ln interrupt line rw */
c[0x3d] = 0x01; /* intr_pn interrupt pin ro */
pci_register_bar (&s->dev, 0, 256 * 4, PCI_BASE_ADDRESS_SPACE_IO,
ac97_map);
+1 -1
View File
@@ -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 (range_covers_byte(address, len, 0x80))
if (address == 0x80)
pm_io_space_update((PIIX4PMState *)d);
}
+8 -35
View File
@@ -1060,17 +1060,8 @@ 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]);
@@ -1085,37 +1076,19 @@ 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);
/* Handled in the translator for usermode. */
abort();
break;
case 0x9F:
/* WRUNIQUE */
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);
env->unique = env->ir[IR_A0];
qemu_log("WRUNIQUE: " TARGET_FMT_lx "\n", env->unique);
break;
default:
qemu_log("%s: unhandled palcode %02x\n", __func__, palcode);
qemu_log("%s: unhandled palcode %02x\n",
__func__, palcode);
exit(1);
}
}
-2
View File
@@ -225,8 +225,6 @@ 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),
+1 -1
View File
@@ -19,7 +19,7 @@ typedef struct QEMUMachine {
QEMUMachineInitFunc *init;
int use_scsi;
int max_cpus;
unsigned int no_serial:1,
int no_serial:1,
no_parallel:1,
use_virtcon:1,
no_vga:1,
-107
View File
@@ -1,107 +0,0 @@
/*
* 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)
+4 -10
View File
@@ -1,9 +1,6 @@
/*
* 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:
@@ -1092,15 +1089,12 @@ 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);
/* 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;
*(uint16_t *)(pci_conf+0x06) = cpu_to_le16(0x0010);
pci_conf[0x08] = 0x03;
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
/* TODO: RST# value should be 0, PCI spec 6.2.4 */
pci_conf[PCI_CACHE_LINE_SIZE] = 0x10;
pci_conf[0x0c] = 0x10;
/* TODO: RST# value should be 0 if programmable, PCI spec 6.2.4 */
pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0
pci_conf[0x3d] = 1; // interrupt pin 0
d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
e1000_mmio_write, d);
+17 -32
View File
@@ -412,24 +412,19 @@ 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 */
/* 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_CONFIG_16(PCI_STATUS, 0x2800);
/* PCI Revision ID */
PCI_CONFIG_8(PCI_REVISION_ID, 0x08);
/* TODO: this is the default, do not override. */
/* PCI Class Code */
PCI_CONFIG_8(PCI_CLASS_PROG, 0x00);
PCI_CONFIG_8(0x09, 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(PCI_LATENCY_TIMER, 0x20); // latency timer = 32 clocks
PCI_CONFIG_8(0x0d, 0x20); // latency timer = 32 clocks
/* PCI Header Type */
/* BIST (built-in self test) */
#if defined(TARGET_I386)
@@ -451,20 +446,16 @@ static void pci_reset(EEPRO100State * s)
#endif
#endif
/* Expansion ROM Base Address (depends on boot disable!!!) */
/* TODO: not needed, set when BAR is registered */
PCI_CONFIG_32(PCI_ROM_ADDRESS, PCI_BASE_ADDRESS_SPACE_MEMORY);
PCI_CONFIG_32(0x30, 0x00000000);
/* Capability Pointer */
/* 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);
PCI_CONFIG_8(0x34, 0xdc);
/* Interrupt Line */
/* Interrupt Pin */
/* TODO: RST# value should be 0 */
PCI_CONFIG_8(PCI_INTERRUPT_PIN, 1); // interrupt pin 0
PCI_CONFIG_8(0x3d, 1); // interrupt pin 0
/* Minimum Grant */
PCI_CONFIG_8(PCI_MIN_GNT, 0x08);
PCI_CONFIG_8(0x3e, 0x08);
/* Maximum Latency */
PCI_CONFIG_8(PCI_MAX_LAT, 0x18);
PCI_CONFIG_8(0x3f, 0x18);
switch (device) {
case i82550:
@@ -488,57 +479,52 @@ 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(PCI_CAPABILITY_LIST, 0x00);
PCI_CONFIG_8(0x34, 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(PCI_CAPABILITY_LIST, 0x00);
PCI_CONFIG_8(0x34, 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(PCI_CAPABILITY_LIST, 0x00);
PCI_CONFIG_8(0x34, 0x00);
power_management = 0;
break;
case i82558A:
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82557);
PCI_CONFIG_16(PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
PCI_CONFIG_16(PCI_STATUS, 0x0290);
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, PCI_STATUS_DEVSEL_MEDIUM |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
PCI_CONFIG_16(PCI_STATUS, 0x0290);
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, PCI_STATUS_DEVSEL_MEDIUM |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
PCI_CONFIG_16(PCI_STATUS, 0x0290);
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, PCI_STATUS_DEVSEL_MEDIUM |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
PCI_CONFIG_16(PCI_STATUS, 0x0290);
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, PCI_STATUS_DEVSEL_MEDIUM |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
PCI_CONFIG_16(PCI_STATUS, 0x0290);
PCI_CONFIG_8(PCI_REVISION_ID, 0x08);
// TODO: Windows wants revision id 0x0c.
PCI_CONFIG_8(PCI_REVISION_ID, 0x0c);
@@ -551,8 +537,7 @@ 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, PCI_STATUS_DEVSEL_MEDIUM |
PCI_STATUS_FAST_BACK | PCI_STATUS_CAP_LIST);
PCI_CONFIG_16(PCI_STATUS, 0x0290);
PCI_CONFIG_8(PCI_REVISION_ID, 0x09);
s->stats_size = 80;
s->has_extended_tcb_support = 1;
+2 -7
View File
@@ -149,14 +149,9 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab,
}
i++;
}
if (nsyms) {
syms = qemu_realloc(syms, nsyms * sizeof(*syms));
syms = qemu_realloc(syms, nsyms * sizeof(*syms));
qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
} else {
qemu_free(syms);
syms = NULL;
}
qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
/* String table */
if (symtab->sh_link >= ehdr->e_shnum)
+14 -15
View File
@@ -1000,28 +1000,27 @@ 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[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_SLOW >> 8;
c[0x07] = 2 << 1;
pci_config_set_class (c, PCI_CLASS_MULTIMEDIA_AUDIO);
#if 1
c[PCI_SUBSYSTEM_VENDOR_ID] = 0x42;
c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x49;
c[PCI_SUBSYSTEM_ID] = 0x4c;
c[PCI_SUBSYSTEM_ID + 1] = 0x4c;
c[0x2c] = 0x42;
c[0x2d] = 0x49;
c[0x2e] = 0x4c;
c[0x2f] = 0x4c;
#else
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[0x2c] = 0x74;
c[0x2d] = 0x12;
c[0x2e] = 0x71;
c[0x2f] = 0x13;
c[0x34] = 0xdc;
c[0x3c] = 10;
c[0xdc] = 0x00;
#endif
/* TODO: RST# value should be 0. */
c[PCI_INTERRUPT_PIN] = 1;
c[PCI_MIN_GNT] = 0x0c;
c[PCI_MAX_LAT] = 0x80;
c[0x3d] = 1;
c[0x3e] = 0x0c;
c[0x3f] = 0x80;
pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, es1370_map);
qemu_register_reset (es1370_on_reset, s);
-6
View File
@@ -935,12 +935,6 @@ 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;
+12 -1
View File
@@ -1082,6 +1082,17 @@ 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;
@@ -1114,7 +1125,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, NULL, NULL);
0, gt64120_read_config, gt64120_write_config);
/* FIXME: Malta specific hw assumptions ahead */
+8 -6
View File
@@ -70,7 +70,11 @@ static void ide_map(PCIDevice *pci_dev, int region_num,
static PCIIDEState *pci_from_bm(BMDMAState *bm)
{
return bm->pci_dev;
if (bm->unit == 0) {
return container_of(bm, PCIIDEState, bmdma[0]);
} else {
return container_of(bm, PCIIDEState, bmdma[1]);
}
}
static uint32_t bmdma_readb(void *opaque, uint32_t addr)
@@ -141,7 +145,6 @@ 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);
@@ -206,8 +209,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[PCI_REVISION_ID] = 0x07; // IDE controller revision
pci_conf[PCI_CLASS_PROG] = 0x8f;
pci_conf[0x08] = 0x07; // IDE controller revision
pci_conf[0x09] = 0x8f;
pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
@@ -224,8 +227,7 @@ 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);
/* TODO: RST# value should be 0 */
pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1
pci_conf[0x3d] = 0x01; // interrupt on pin 1
irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);
ide_bus_new(&d->bus[0], &d->dev.qdev);
-1
View File
@@ -474,7 +474,6 @@ struct BMDMAState {
uint8_t status;
uint32_t addr;
struct PCIIDEState *pci_dev;
IDEBus *bus;
/* current transfer state */
uint32_t cur_addr;
+5 -9
View File
@@ -78,7 +78,6 @@ 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);
@@ -107,13 +106,10 @@ static void piix3_reset(void *opaque)
ide_dma_reset(&d->bmdma[i]);
}
/* 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[0x04] = 0x00;
pci_conf[0x05] = 0x00;
pci_conf[0x06] = 0x80; /* FBC */
pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
pci_conf[0x20] = 0x01; /* BMIBA: 20-23h */
}
@@ -121,7 +117,7 @@ static int pci_piix_ide_initfn(PCIIDEState *d)
{
uint8_t *pci_conf = d->dev.config;
pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
pci_conf[0x09] = 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
+5 -89
View File
@@ -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
#define CSR_GPT_CNT 0x90
#define CSR_GPT_CFG 0x8c /* TODO */
#define CSR_GPT_CNT 0x90 /* TODO */
#define CSR_WORD_SWAP 0x98
#define CSR_FREE_RUN 0x9c
#define CSR_RX_DROP 0xa0
@@ -52,7 +52,6 @@ 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
@@ -118,16 +117,6 @@ 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,
@@ -152,7 +141,6 @@ typedef struct {
NICConf conf;
qemu_irq irq;
int mmio_index;
ptimer_state *timer;
uint32_t irq_cfg;
uint32_t int_sts;
@@ -163,7 +151,6 @@ 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;
@@ -182,8 +169,6 @@ 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];
@@ -219,11 +204,6 @@ 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;
}
@@ -251,28 +231,14 @@ 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)
@@ -282,11 +248,9 @@ static void lan9118_set_link(VLANClientState *nc)
static void phy_reset(lan9118_state *s)
{
s->phy_status = 0x7809;
s->phy_status = 0x7805;
s->phy_control = 0x3000;
s->phy_advertise = 0x01e1;
s->phy_int_mask = 0;
s->phy_int = 0;
phy_update_link(s);
}
@@ -328,10 +292,6 @@ 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;
@@ -680,8 +640,6 @@ 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;
@@ -698,13 +656,6 @@ 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;
@@ -728,11 +679,7 @@ 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, 31 */
case 30: /* Interrupt mask */
s->phy_int_mask = val & 0xff;
phy_update_irq(s);
break;
/* TODO 17, 18, 27, 29, 30, 31 */
default:
BADF("PHY write reg %d = 0x%04x\n", reg, val);
}
@@ -873,15 +820,6 @@ 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)
{
@@ -897,7 +835,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 = (s->irq_cfg & IRQ_INT) | (val & IRQ_EN);
s->irq_cfg = (val & IRQ_EN);
break;
case CSR_INT_STS:
s->int_sts &= ~val;
@@ -967,18 +905,6 @@ 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;
@@ -1062,10 +988,6 @@ 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:
@@ -1119,7 +1041,6 @@ 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,
@@ -1138,11 +1059,6 @@ 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;
}
+7 -14
View File
@@ -636,9 +636,8 @@ static void rom_reset(void *unused)
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (rom->fw_file) {
if (rom->addr == 0)
continue;
}
if (rom->data == NULL)
continue;
cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize);
@@ -657,9 +656,8 @@ int rom_load_all(void)
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (rom->fw_file) {
if (rom->addr == 0)
continue;
}
if (addr > rom->addr) {
fprintf(stderr, "rom: requested regions overlap "
"(rom %s. free=0x" TARGET_FMT_plx
@@ -695,9 +693,8 @@ static Rom *find_rom(target_phys_addr_t addr)
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (rom->fw_file) {
if (rom->addr == 0)
continue;
}
if (rom->addr > addr)
continue;
if (rom->addr + rom->romsize < addr)
@@ -707,11 +704,6 @@ static Rom *find_rom(target_phys_addr_t addr)
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;
@@ -720,9 +712,10 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (rom->fw_file) {
if (rom->addr == 0)
continue;
if (rom->addr > addr)
continue;
}
if (rom->addr + rom->romsize < addr)
continue;
if (rom->addr > end)
@@ -764,7 +757,7 @@ void do_info_roms(Monitor *mon)
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
if (!rom->fw_file) {
if (rom->addr) {
monitor_printf(mon, "addr=" TARGET_FMT_plx
" size=0x%06zx mem=%s name=\"%s\" \n",
rom->addr, rom->romsize,
+5 -7
View File
@@ -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,20 +2120,18 @@ 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[PCI_SUBSYSTEM_ID] = 0x00;
pci_conf[PCI_SUBSYSTEM_ID + 1] = 0x10;
pci_conf[0x2e] = 0x00;
pci_conf[0x2f] = 0x10;
/* PCI latency timer = 255 */
pci_conf[PCI_LATENCY_TIMER] = 0xff;
/* TODO: RST# value should be 0 */
pci_conf[0x0d] = 0xff;
/* Interrupt pin 1 */
pci_conf[PCI_INTERRUPT_PIN] = 0x01;
pci_conf[0x3d] = 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,
+39 -46
View File
@@ -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",
ch->regs[DBDMA_CMDPTR_LO]);
cpu_physical_memory_read(ch->regs[DBDMA_CMDPTR_LO],
be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]));
cpu_physical_memory_read(be32_to_cpu(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",
ch->regs[DBDMA_CMDPTR_LO]);
be32_to_cpu(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(ch->regs[DBDMA_CMDPTR_LO],
cpu_physical_memory_write(be32_to_cpu(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] |= DEAD;
ch->regs[DBDMA_STATUS] &= ~ACTIVE;
ch->regs[DBDMA_STATUS] |= cpu_to_be32(DEAD);
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~ACTIVE);
qemu_irq_raise(ch->irq);
}
@@ -230,10 +230,10 @@ static void conditional_interrupt(DBDMA_channel *ch)
return;
}
status = ch->regs[DBDMA_STATUS] & DEVSTAT;
status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;
sel_mask = (ch->regs[DBDMA_INTR_SEL] >> 16) & 0x0f;
sel_value = ch->regs[DBDMA_INTR_SEL] & 0x0f;
sel_mask = (be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f;
sel_value = be32_to_cpu(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 = ch->regs[DBDMA_STATUS] & DEVSTAT;
status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;
sel_mask = (ch->regs[DBDMA_WAIT_SEL] >> 16) & 0x0f;
sel_value = ch->regs[DBDMA_WAIT_SEL] & 0x0f;
sel_mask = (be32_to_cpu(ch->regs[DBDMA_WAIT_SEL]) >> 16) & 0x0f;
sel_value = be32_to_cpu(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] &= ~BT;
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~BT);
cp = ch->regs[DBDMA_CMDPTR_LO];
ch->regs[DBDMA_CMDPTR_LO] = cp + sizeof(dbdma_cmd);
cp = be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]);
ch->regs[DBDMA_CMDPTR_LO] = cpu_to_be32(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] |= BT;
ch->regs[DBDMA_STATUS] |= cpu_to_be32(BT);
dbdma_cmdptr_load(ch);
}
@@ -331,10 +331,10 @@ static void conditional_branch(DBDMA_channel *ch)
return;
}
status = ch->regs[DBDMA_STATUS] & DEVSTAT;
status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;
sel_mask = (ch->regs[DBDMA_BRANCH_SEL] >> 16) & 0x0f;
sel_value = ch->regs[DBDMA_BRANCH_SEL] & 0x0f;
sel_mask = (be32_to_cpu(ch->regs[DBDMA_BRANCH_SEL]) >> 16) & 0x0f;
sel_value = be32_to_cpu(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(ch->regs[DBDMA_STATUS]);
current->res_count = cpu_to_le16(io->len);
current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));
current->res_count = cpu_to_le16(be32_to_cpu(io->len));
dbdma_cmdptr_save(ch);
if (io->is_last)
ch->regs[DBDMA_STATUS] &= ~FLUSH;
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH);
conditional_interrupt(ch);
conditional_branch(ch);
wait:
ch->processing = 0;
if ((ch->regs[DBDMA_STATUS] & RUN) &&
(ch->regs[DBDMA_STATUS] & ACTIVE))
if ((ch->regs[DBDMA_STATUS] & cpu_to_be32(RUN)) &&
(ch->regs[DBDMA_STATUS] & cpu_to_be32(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(ch->regs[DBDMA_STATUS]);
current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));
dbdma_cmdptr_save(ch);
ch->regs[DBDMA_STATUS] &= ~FLUSH;
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~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(ch->regs[DBDMA_STATUS]);
current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));
dbdma_cmdptr_save(ch);
ch->regs[DBDMA_STATUS] &= ~FLUSH;
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~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(ch->regs[DBDMA_STATUS]);
current->xfer_status = cpu_to_le16(be32_to_cpu(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] &= ~(ACTIVE|DEAD|FLUSH);
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~(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] &= ~WAKE;
ch->regs[DBDMA_STATUS] &= cpu_to_be32(~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 = ch->regs[DBDMA_STATUS];
uint32_t status = be32_to_cpu(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 = (ch->regs[DBDMA_CONTROL] >> 16) & 0xffff;
value = ch->regs[DBDMA_CONTROL] & 0xffff;
mask = (be32_to_cpu(ch->regs[DBDMA_CONTROL]) >> 16) & 0xffff;
value = be32_to_cpu(ch->regs[DBDMA_CONTROL]) & 0xffff;
value &= (RUN | PAUSE | FLUSH | WAKE | DEVSTAT);
status = ch->regs[DBDMA_STATUS];
status = be32_to_cpu(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 ((ch->regs[DBDMA_STATUS] & RUN) && !(status & RUN)) {
if ((be32_to_cpu(ch->regs[DBDMA_STATUS]) & RUN) && !(status & RUN)) {
/* RUN is cleared */
status &= ~(ACTIVE|DEAD);
}
DBDMA_DPRINTF(" status 0x%08x\n", status);
ch->regs[DBDMA_STATUS] = status;
ch->regs[DBDMA_STATUS] = cpu_to_be32(status);
if (status & ACTIVE)
qemu_bh_schedule(dbdma_bh);
@@ -703,14 +703,10 @@ 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] & (RUN | ACTIVE)))
(ch->regs[DBDMA_STATUS] & cpu_to_be32(RUN | ACTIVE)))
return;
ch->regs[reg] = value;
@@ -721,7 +717,7 @@ static void dbdma_writel (void *opaque,
break;
case DBDMA_CMDPTR_LO:
/* 16-byte aligned */
ch->regs[DBDMA_CMDPTR_LO] &= ~0xf;
ch->regs[DBDMA_CMDPTR_LO] &= cpu_to_be32(~0xf);
dbdma_cmdptr_load(ch);
break;
case DBDMA_STATUS:
@@ -786,9 +782,6 @@ static uint32_t dbdma_readl (void *opaque, target_phys_addr_t addr)
break;
}
#ifdef TARGET_WORDS_BIGENDIAN
value = bswap32(value);
#endif
return value;
}
+1 -1
View File
@@ -175,7 +175,7 @@ void msix_write_config(PCIDevice *dev, uint32_t addr,
unsigned enable_pos = dev->msix_cap + MSIX_CONTROL_OFFSET;
int vector;
if (!range_covers_byte(addr, len, enable_pos)) {
if (addr + len <= enable_pos || addr > enable_pos) {
return;
}
-331
View File
@@ -1,331 +0,0 @@
/*
* 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 */
}
-12
View File
@@ -1,12 +0,0 @@
#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
+1 -2
View File
@@ -724,8 +724,7 @@ 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
/* TODO: RST# value should be 0. PCI spec 6.2.4 */
pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0
pci_conf[0x3d] = 1; // interrupt pin 0
pci_register_bar(&d->dev, 0, 0x100,
PCI_BASE_ADDRESS_SPACE_IO, ne2000_map);
+131 -133
View File
@@ -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,34 +434,32 @@ 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));
opp->dst[i].raised.next = -1;
memset(&opp->dst[i].servicing, 0, sizeof(IRQ_queue_t));
opp->dst[i].servicing.next = -1;
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));
}
/* 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 */
@@ -474,11 +472,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;
@@ -494,95 +492,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
@@ -608,9 +606,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))) {
@@ -624,7 +622,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:
@@ -642,7 +640,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;
}
@@ -664,13 +662,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:
@@ -681,14 +679,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;
}
@@ -719,18 +717,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;
}
}
@@ -750,17 +748,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
@@ -849,21 +847,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];
@@ -874,7 +872,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;
}
@@ -898,46 +896,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:
+235 -11
View File
@@ -44,11 +44,13 @@
#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)
@@ -504,6 +506,234 @@ 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;
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;
mb_kernel_data = qemu_malloc(mb_kernel_size);
if (rom_copy(mb_kernel_data, mh_load_addr, mb_kernel_size) != mb_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,
@@ -540,8 +770,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, kernel_size, header))
if (load_multiboot(fw_cfg, f, kernel_filename,
initrd_filename, kernel_cmdline, header))
return;
protocol = 0;
}
@@ -657,14 +887,8 @@ static void load_linux(void *fw_cfg,
setup = qemu_malloc(setup_size);
kernel = qemu_malloc(kernel_size);
fseek(f, 0, SEEK_SET);
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);
}
fread(setup, 1, setup_size, f);
fread(kernel, 1, kernel_size, f);
fclose(f);
memcpy(setup, header, MIN(sizeof(header), setup_size));
+12 -49
View File
@@ -41,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 */
@@ -72,6 +72,7 @@ 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;
@@ -237,11 +238,6 @@ 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)
@@ -419,7 +415,7 @@ static int pci_set_default_subsystem_id(PCIDevice *pci_dev)
{
uint16_t *id;
id = (void*)(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID]);
id = (void*)(&pci_dev->config[PCI_SUBVENDOR_ID]);
id[0] = cpu_to_le16(pci_default_sub_vendor_id);
id[1] = cpu_to_le16(pci_default_sub_device_id);
return 0;
@@ -525,8 +521,7 @@ 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_INTX_DISABLE);
PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
memset(dev->wmask + PCI_CONFIG_HEADER_SIZE, 0xff,
config_size - PCI_CONFIG_HEADER_SIZE);
@@ -639,11 +634,9 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
}
return pci_dev;
}
static target_phys_addr_t pci_to_cpu_addr(PCIBus *bus,
target_phys_addr_t addr)
static target_phys_addr_t pci_to_cpu_addr(target_phys_addr_t addr)
{
return addr + bus->mem_base;
return addr + pci_mem_base;
}
static void pci_unregister_io_regions(PCIDevice *pci_dev)
@@ -658,10 +651,9 @@ 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(pci_dev->bus,
r->addr),
r->filtered_size,
IO_MEM_UNASSIGNED);
cpu_register_physical_memory(pci_to_cpu_addr(r->addr),
r->filtered_size,
IO_MEM_UNASSIGNED);
}
}
}
@@ -933,7 +925,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(d->bus, r->addr),
cpu_register_physical_memory(pci_to_cpu_addr(r->addr),
r->filtered_size,
IO_MEM_UNASSIGNED);
qemu_unregister_coalesced_mmio(r->addr, r->filtered_size);
@@ -949,35 +941,11 @@ static void pci_update_mappings(PCIDevice *d)
* Teach them such cases, such that filtered_size < size and
* addr & (size - 1) != 0.
*/
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);
}
r->map_func(d, i, 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)
{
@@ -990,7 +958,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, was_irq_disabled = pci_irq_disabled(d);
int i;
uint32_t config_size = pci_config_size(d);
for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) {
@@ -1002,9 +970,6 @@ 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);
}
/***********************************************************/
@@ -1022,8 +987,6 @@ static void pci_set_irq(void *opaque, int irq_num, int level)
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);
}
+72 -5
View File
@@ -10,6 +10,8 @@
/* 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)
@@ -92,10 +94,77 @@ typedef struct PCIIORegion {
#define PCI_ROM_SLOT 6
#define PCI_NUM_REGIONS 7
#include "pci_regs.h"
/* PCI HEADER_TYPE */
/* 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_STATUS_INTERRUPT 0x08
#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
#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 | \
@@ -217,8 +286,6 @@ 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,
-665
View File
@@ -1,665 +0,0 @@
/*
* 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 */
+9 -17
View File
@@ -1981,32 +1981,24 @@ 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);
/* 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;
*(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;
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
/* 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);
*(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001);
*(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000);
/* 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;
pci_conf[0x3d] = 1; // interrupt pin 0
pci_conf[0x3e] = 0x06;
pci_conf[0x3f] = 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);
+12 -17
View File
@@ -38,21 +38,13 @@
#define LMB_BRAM_SIZE (128 * 1024)
#define FLASH_SIZE (16 * 1024 * 1024)
static struct
{
uint32_t bootstrap_pc;
uint32_t cmdline;
uint32_t fdt;
} boot_info;
static uint32_t bootstrap_pc;
static void main_cpu_reset(void *opaque)
{
CPUState *env = opaque;
cpu_reset(env);
env->regs[5] = boot_info.cmdline;
env->regs[7] = boot_info.fdt;
env->sregs[SR_PC] = boot_info.bootstrap_pc;
env->sregs[SR_PC] = bootstrap_pc;
}
#define BINARY_DEVICE_TREE_FILE "petalogix-s3adsp1800.dtb"
@@ -174,24 +166,27 @@ petalogix_s3adsp1800_init(ram_addr_t ram_size,
1, ELF_MACHINE, 0);
}
/* Always boot into physical ram. */
boot_info.bootstrap_pc = ddr_base + (entry & 0x0fffffff);
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);
boot_info.bootstrap_pc = ddr_base;
bootstrap_pc = ddr_base;
}
boot_info.cmdline = ddr_base + kernel_size + 8192;
env->regs[5] = ddr_base + kernel_size + 8192;
if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) {
pstrcpy_targphys("cmdline", boot_info.cmdline, 256, kernel_cmdline);
pstrcpy_targphys("cmdline", env->regs[5], 256, kernel_cmdline);
}
env->regs[6] = 0;
/* Provide a device-tree. */
boot_info.fdt = boot_info.cmdline + 256;
petalogix_load_device_tree(boot_info.fdt, ram_size,
0, 0,
env->regs[7] = ddr_base + kernel_size + 256;
petalogix_load_device_tree(env->regs[7], ram_size,
env->regs[6], 0,
kernel_cmdline);
}
env->sregs[SR_PC] = bootstrap_pc;
}
static QEMUMachine petalogix_s3adsp1800_machine = {
+5 -17
View File
@@ -29,11 +29,6 @@
#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 {
@@ -49,11 +44,6 @@ 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
@@ -98,12 +88,12 @@ static void i440fx_update_memory_mappings(PCII440FXState *d)
int i, r;
uint32_t smram, addr;
update_pam(d, 0xf0000, 0x100000, (d->dev.config[I440FX_PAM] >> 4) & 3);
update_pam(d, 0xf0000, 0x100000, (d->dev.config[0x59] >> 4) & 3);
for(i = 0; i < 12; i++) {
r = (d->dev.config[(i >> 1) + (I440FX_PAM + 1)] >> ((i & 1) * 4)) & 3;
r = (d->dev.config[(i >> 1) + 0x5a] >> ((i & 1) * 4)) & 3;
update_pam(d, 0xc0000 + 0x4000 * i, 0xc0000 + 0x4000 * (i + 1), r);
}
smram = d->dev.config[I440FX_SMRAM];
smram = d->dev.config[0x72];
if ((d->smm_enabled && (smram & 0x08)) || (smram & 0x40)) {
cpu_register_physical_memory(0xa0000, 0x20000, 0xa0000);
} else {
@@ -142,10 +132,8 @@ static void i440fx_write_config(PCIDevice *dev,
/* XXX: implement SMRAM.D_LOCK */
pci_default_write_config(dev, address, val, len);
if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
range_covers_byte(address, len, I440FX_SMRAM)) {
if ((address >= 0x59 && address <= 0x5f) || address == 0x72)
i440fx_update_memory_mappings(d);
}
}
static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
@@ -208,7 +196,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[I440FX_SMRAM] = 0x02;
d->dev.config[0x72] = 0x02; /* SMRAM */
return 0;
}
+6 -6
View File
@@ -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;
}
uint64_t cpu_ppc_load_tbl (CPUState *env)
uint32_t cpu_ppc_load_tbl (CPUState *env)
{
ppc_tb_t *tb_env = env->tb_env;
uint64_t tb;
@@ -409,7 +409,7 @@ uint64_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;
return tb & 0xFFFFFFFF;
}
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);
}
uint64_t cpu_ppc_load_atbl (CPUState *env)
uint32_t cpu_ppc_load_atbl (CPUState *env)
{
ppc_tb_t *tb_env = env->tb_env;
uint64_t tb;
@@ -471,7 +471,7 @@ uint64_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;
return tb & 0xFFFFFFFF;
}
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, uint32_t *valp)
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp)
{
ppc_dcrn_t *dcr;
@@ -1029,7 +1029,7 @@ 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, uint32_t val)
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val)
{
ppc_dcrn_t *dcr;
+2 -2
View File
@@ -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 uint32_t (*dcr_read_cb)(void *opaque, int dcrn);
typedef void (*dcr_write_cb)(void *opaque, int dcrn, uint32_t val);
typedef target_ulong (*dcr_read_cb)(void *opaque, int dcrn);
typedef void (*dcr_write_cb)(void *opaque, int dcrn, target_ulong 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
View File
@@ -107,10 +107,10 @@ struct ppc4xx_plb_t {
uint32_t besr;
};
static uint32_t dcr_read_plb (void *opaque, int dcrn)
static target_ulong dcr_read_plb (void *opaque, int dcrn)
{
ppc4xx_plb_t *plb;
uint32_t ret;
target_ulong ret;
plb = opaque;
switch (dcrn) {
@@ -132,7 +132,7 @@ static uint32_t dcr_read_plb (void *opaque, int dcrn)
return ret;
}
static void dcr_write_plb (void *opaque, int dcrn, uint32_t val)
static void dcr_write_plb (void *opaque, int dcrn, target_ulong val)
{
ppc4xx_plb_t *plb;
@@ -189,10 +189,10 @@ struct ppc4xx_pob_t {
uint32_t besr[2];
};
static uint32_t dcr_read_pob (void *opaque, int dcrn)
static target_ulong dcr_read_pob (void *opaque, int dcrn)
{
ppc4xx_pob_t *pob;
uint32_t ret;
target_ulong ret;
pob = opaque;
switch (dcrn) {
@@ -212,7 +212,7 @@ static uint32_t dcr_read_pob (void *opaque, int dcrn)
return ret;
}
static void dcr_write_pob (void *opaque, int dcrn, uint32_t val)
static void dcr_write_pob (void *opaque, int dcrn, target_ulong val)
{
ppc4xx_pob_t *pob;
@@ -410,10 +410,10 @@ enum {
EBC0_CFGDATA = 0x013,
};
static uint32_t dcr_read_ebc (void *opaque, int dcrn)
static target_ulong dcr_read_ebc (void *opaque, int dcrn)
{
ppc4xx_ebc_t *ebc;
uint32_t ret;
target_ulong ret;
ebc = opaque;
switch (dcrn) {
@@ -494,7 +494,7 @@ static uint32_t dcr_read_ebc (void *opaque, int dcrn)
return ret;
}
static void dcr_write_ebc (void *opaque, int dcrn, uint32_t val)
static void dcr_write_ebc (void *opaque, int dcrn, target_ulong val)
{
ppc4xx_ebc_t *ebc;
@@ -627,7 +627,7 @@ struct ppc405_dma_t {
uint32_t pol;
};
static uint32_t dcr_read_dma (void *opaque, int dcrn)
static target_ulong dcr_read_dma (void *opaque, int dcrn)
{
ppc405_dma_t *dma;
@@ -636,7 +636,7 @@ static uint32_t dcr_read_dma (void *opaque, int dcrn)
return 0;
}
static void dcr_write_dma (void *opaque, int dcrn, uint32_t val)
static void dcr_write_dma (void *opaque, int dcrn, target_ulong val)
{
ppc405_dma_t *dma;
@@ -914,10 +914,10 @@ static void ocm_update_mappings (ppc405_ocm_t *ocm,
}
}
static uint32_t dcr_read_ocm (void *opaque, int dcrn)
static target_ulong dcr_read_ocm (void *opaque, int dcrn)
{
ppc405_ocm_t *ocm;
uint32_t ret;
target_ulong ret;
ocm = opaque;
switch (dcrn) {
@@ -941,7 +941,7 @@ static uint32_t dcr_read_ocm (void *opaque, int dcrn)
return ret;
}
static void dcr_write_ocm (void *opaque, int dcrn, uint32_t val)
static void dcr_write_ocm (void *opaque, int dcrn, target_ulong 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 uint32_t dcr_read_mal (void *opaque, int dcrn)
static target_ulong dcr_read_mal (void *opaque, int dcrn)
{
ppc40x_mal_t *mal;
uint32_t ret;
target_ulong ret;
mal = opaque;
switch (dcrn) {
@@ -1650,7 +1650,7 @@ static uint32_t dcr_read_mal (void *opaque, int dcrn)
return ret;
}
static void dcr_write_mal (void *opaque, int dcrn, uint32_t val)
static void dcr_write_mal (void *opaque, int dcrn, target_ulong 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 uint32_t dcr_read_crcpc (void *opaque, int dcrn)
static target_ulong dcr_read_crcpc (void *opaque, int dcrn)
{
ppc405cr_cpc_t *cpc;
uint32_t ret;
target_ulong ret;
cpc = opaque;
switch (dcrn) {
@@ -1991,7 +1991,7 @@ static uint32_t dcr_read_crcpc (void *opaque, int dcrn)
return ret;
}
static void dcr_write_crcpc (void *opaque, int dcrn, uint32_t val)
static void dcr_write_crcpc (void *opaque, int dcrn, target_ulong 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 uint32_t dcr_read_epcpc (void *opaque, int dcrn)
static target_ulong dcr_read_epcpc (void *opaque, int dcrn)
{
ppc405ep_cpc_t *cpc;
uint32_t ret;
target_ulong ret;
cpc = opaque;
switch (dcrn) {
@@ -2393,7 +2393,7 @@ static uint32_t dcr_read_epcpc (void *opaque, int dcrn)
return ret;
}
static void dcr_write_epcpc (void *opaque, int dcrn, uint32_t val)
static void dcr_write_epcpc (void *opaque, int dcrn, target_ulong val)
{
ppc405ep_cpc_t *cpc;
+7 -7
View File
@@ -183,10 +183,10 @@ static void ppcuic_set_irq (void *opaque, int irq_num, int level)
ppcuic_trigger_irq(uic);
}
static uint32_t dcr_read_uic (void *opaque, int dcrn)
static target_ulong dcr_read_uic (void *opaque, int dcrn)
{
ppcuic_t *uic;
uint32_t ret;
target_ulong ret;
uic = opaque;
dcrn -= uic->dcr_base;
@@ -229,13 +229,13 @@ static uint32_t dcr_read_uic (void *opaque, int dcrn)
return ret;
}
static void dcr_write_uic (void *opaque, int dcrn, uint32_t val)
static void dcr_write_uic (void *opaque, int dcrn, target_ulong val)
{
ppcuic_t *uic;
uic = opaque;
dcrn -= uic->dcr_base;
LOG_UIC("%s: dcr %d val 0x%x\n", __func__, dcrn, val);
LOG_UIC("%s: dcr %d val " TARGET_FMT_lx "\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 uint32_t dcr_read_sdram (void *opaque, int dcrn)
static target_ulong dcr_read_sdram (void *opaque, int dcrn)
{
ppc4xx_sdram_t *sdram;
uint32_t ret;
target_ulong ret;
sdram = opaque;
switch (dcrn) {
@@ -516,7 +516,7 @@ static uint32_t dcr_read_sdram (void *opaque, int dcrn)
return ret;
}
static void dcr_write_sdram (void *opaque, int dcrn, uint32_t val)
static void dcr_write_sdram (void *opaque, int dcrn, target_ulong val)
{
ppc4xx_sdram_t *sdram;
+5 -8
View File
@@ -108,6 +108,7 @@ 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];
@@ -119,11 +120,7 @@ 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) {
@@ -321,7 +318,10 @@ 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);
escc_mem_index = escc_init(0x80013000, pic[0x25], pic[0x24],
/* XXX: suppress that */
dummy_irq = i8259_init(NULL);
escc_mem_index = escc_init(0x80013000, dummy_irq[4], dummy_irq[5],
serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
for(i = 0; i < nb_nics; i++)
@@ -389,9 +389,6 @@ 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)
-2
View File
@@ -409,9 +409,7 @@ 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)
+2 -10
View File
@@ -192,19 +192,11 @@ 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) {
@@ -364,7 +356,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 = (board_type == BOARD_PB_A8 ? 0x70000000 : 0);
realview_binfo.loader_start = is_pb ? 0x70000000 : 0;
arm_load_kernel(first_cpu, &realview_binfo);
}
+6 -10
View File
@@ -3320,20 +3320,16 @@ 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);
/* 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_conf[0x04] = 0x05; /* command = I/O space, Bus Master */
pci_conf[0x08] = RTL8139_PCI_REVID; /* PCI revision ID; >=0x20 is for 8139C+ */
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
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;
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; /* header_type */
pci_conf[0x3d] = 1; /* interrupt pin 0 */
pci_conf[0x34] = 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);
+2 -2
View File
@@ -374,7 +374,6 @@ 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",
@@ -410,7 +409,7 @@ static const char *scsi_command_name(uint8_t cmd)
[ SEARCH_LOW ] = "SEARCH_LOW",
[ SET_LIMITS ] = "SET_LIMITS",
[ PRE_FETCH ] = "PRE_FETCH",
/* READ_POSITION and PRE_FETCH use the same operation code */
[ READ_POSITION ] = "READ_POSITION",
[ SYNCHRONIZE_CACHE ] = "SYNCHRONIZE_CACHE",
[ LOCK_UNLOCK_CACHE ] = "LOCK_UNLOCK_CACHE",
[ READ_DEFECT_DATA ] = "READ_DEFECT_DATA",
@@ -444,6 +443,7 @@ 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",
+6 -15
View File
@@ -5,12 +5,6 @@
* 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.
*
@@ -412,6 +406,11 @@ 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;
@@ -437,15 +436,7 @@ 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 */
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;
}
outbuf[4] = buflen - 5; /* Additional Length = (Len - 1) - 4 */
/* Sync data transfer and TCQ. */
outbuf[7] = 0x10 | (req->bus->tcq ? 0x02 : 0);
return buflen;
-4
View File
@@ -669,10 +669,6 @@ 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;
+1 -50
View File
@@ -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 afx_base, idreg_base, dma_base, esp_base, le_base;
target_phys_addr_t 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,41 +600,6 @@ 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)
{
@@ -830,10 +795,6 @@ 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]);
@@ -917,9 +878,6 @@ 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);
}
@@ -962,7 +920,6 @@ 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,
@@ -1503,9 +1460,6 @@ 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);
}
@@ -1694,9 +1648,6 @@ 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);
}
+7 -19
View File
@@ -39,20 +39,12 @@
#include "elf.h"
//#define DEBUG_IRQ
//#define DEBUG_EBUS
#ifdef DEBUG_IRQ
#define CPUIRQ_DPRINTF(fmt, ...) \
#define DPRINTF(fmt, ...) \
do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0)
#else
#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, ...)
#define DPRINTF(fmt, ...)
#endif
#define KERNEL_LOAD_ADDR 0x00404000
@@ -246,14 +238,14 @@ void cpu_check_irqs(CPUState *env)
env->interrupt_index = TT_EXTINT | i;
if (old_interrupt != env->interrupt_index) {
CPUIRQ_DPRINTF("Set CPU IRQ %d\n", i);
DPRINTF("Set CPU IRQ %d\n", i);
cpu_interrupt(env, CPU_INTERRUPT_HARD);
}
break;
}
}
} else if (!pil && (env->interrupt_index & ~15) == TT_EXTINT) {
CPUIRQ_DPRINTF("Reset CPU IRQ %d\n", env->interrupt_index & 15);
DPRINTF("Reset CPU IRQ %d\n", env->interrupt_index & 15);
env->interrupt_index = 0;
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
}
@@ -264,12 +256,12 @@ static void cpu_set_irq(void *opaque, int irq, int level)
CPUState *env = opaque;
if (level) {
CPUIRQ_DPRINTF("Raise CPU IRQ %d\n", irq);
DPRINTF("Raise CPU IRQ %d\n", irq);
env->halted = 0;
env->pil_in |= 1 << irq;
cpu_check_irqs(env);
} else {
CPUIRQ_DPRINTF("Lower CPU IRQ %d\n", irq);
DPRINTF("Lower CPU IRQ %d\n", irq);
env->pil_in &= ~(1 << irq);
cpu_check_irqs(env);
}
@@ -355,8 +347,7 @@ 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)
{
EBUS_DPRINTF("Mapping region %d registers at %" FMT_PCIBUS "\n",
region_num, addr);
DPRINTF("Mapping region %d registers at %08x\n", region_num, addr);
switch (region_num) {
case 0:
isa_mmio_init(addr, 0x1000000);
@@ -661,9 +652,6 @@ 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);
}
+1 -1
View File
@@ -100,7 +100,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
0x01, /* u8 bNumInterfaces; (1) */
0x01, /* u8 bConfigurationValue; */
0x04, /* u8 iConfiguration; */
0xe0, /* u8 bmAttributes;
0xa0, /* u8 bmAttributes;
Bit 7: must be set,
6: Self-powered,
5: Remote wakeup,
+1 -1
View File
@@ -113,7 +113,7 @@ static const uint8_t qemu_hub_config_descriptor[] = {
0x01, /* u8 bNumInterfaces; (1) */
0x01, /* u8 bConfigurationValue; */
0x00, /* u8 iConfiguration; */
0xe0, /* u8 bmAttributes;
0xc0, /* u8 bmAttributes;
Bit 7: must be set,
6: Self-powered,
5: Remote wakeup,
+57 -107
View File
@@ -24,7 +24,6 @@
#include "qemu-timer.h"
#include "usb.h"
#include "irq.h"
#include "hw.h"
/* Common USB registers */
#define MUSB_HDRC_FADDR 0x00 /* 8-bit */
@@ -249,16 +248,6 @@
#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 {
@@ -274,7 +263,7 @@ typedef struct {
uint8_t fifosize;
int timeout[2]; /* Always in microframes */
uint8_t *buf[2];
uint32_t *buf[2];
int fifolen[2];
int fifostart[2];
int fifoaddr[2];
@@ -310,7 +299,7 @@ struct MUSBState {
int setup_len;
int session;
uint8_t buf[0x8000];
uint32_t buf[0x2000];
/* Duplicating the world since 2008!... probably we should have 32
* logical, single endpoints instead. */
@@ -785,7 +774,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;
@@ -800,18 +789,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]) < total)
if (epnum && (ep->fifostart[0] << 2) < total)
return;
if (!valid)
total = ep->fifostart[0];
total = ep->fifostart[0] << 2;
pid = USB_TOKEN_OUT;
if (!epnum && (ep->csr[0] & MGC_M_CSR0_H_SETUPPKT)) {
pid = USB_TOKEN_SETUP;
if (total != 8) {
TRACE("illegal SETUPPKT length of %i bytes", total);
}
if (total != 8)
printf("%s: illegal SETUPPKT length of %i bytes\n",
__FUNCTION__, total);
/* Controller should retry SETUP packets three times on errors
* but it doesn't make sense for us to do that. */
}
@@ -828,13 +817,12 @@ 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]) + ep->rxcount <
(ep->fifostart[1] << 2) + ep->rxcount <
ep->packey[1].len) {
TRACE("0x%08x, %d", ep->fifostart[1], ep->rxcount );
ep->fifostart[1] += ep->rxcount;
ep->fifostart[1] += ep->rxcount >> 2;
ep->fifolen[1] = 0;
ep->rxcount = MIN(ep->packey[0].len - (ep->fifostart[1]),
ep->rxcount = MIN(ep->packey[0].len - (ep->fifostart[1] << 2),
ep->maxp[1]);
ep->csr[1] &= ~MGC_M_RXCSR_H_REQPKT;
@@ -884,36 +872,6 @@ 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])
@@ -937,7 +895,7 @@ static uint8_t musb_busctl_readb(void *opaque, int ep, int addr)
return s->ep[ep].hport[1];
default:
TRACE("unknown register 0x%02x", addr);
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
return 0x00;
};
}
@@ -947,12 +905,6 @@ 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;
@@ -967,8 +919,7 @@ static void musb_busctl_writeb(void *opaque, int ep, int addr, uint8_t value)
break;
default:
TRACE("unknown register 0x%02x", addr);
break;
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
};
}
@@ -1024,11 +975,9 @@ 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:
TRACE("unknown register 0x%02x", addr);
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
return 0x00;
};
}
@@ -1055,12 +1004,13 @@ static void musb_ep_writeb(void *opaque, int ep, int addr, uint8_t value)
case (MUSB_HDRC_FIFOSIZE & ~1):
break;
case MUSB_HDRC_FIFOSIZE:
TRACE("somebody messes with fifosize (now %i bytes)", value);
printf("%s: somebody messes with fifosize (now %i bytes)\n",
__FUNCTION__, value);
s->ep[ep].fifosize = value;
break;
default:
TRACE("unknown register 0x%02x", addr);
break;
printf("%s: unknown register at %02x\n", __FUNCTION__, addr);
};
}
@@ -1244,12 +1194,8 @@ 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:
TRACE("unknown register 0x%02x", (int) addr);
printf("%s: unknown register at %02x\n", __FUNCTION__, (int) addr);
return 0x00;
};
}
@@ -1330,14 +1276,8 @@ 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:
TRACE("unknown register 0x%02x", (int) addr);
break;
printf("%s: unknown register at %02x\n", __FUNCTION__, (int) addr);
};
}
@@ -1386,10 +1326,6 @@ 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);
};
@@ -1417,12 +1353,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 << 3) & 0x7ff );
s->buf + ((value << 1) & (sizeof(s->buf) / 4 - 1));
break;
case MUSB_HDRC_RXFIFOADDR:
s->ep[s->idx].fifoaddr[1] = value;
s->ep[s->idx].buf[1] =
s->buf + ((value << 3) & 0x7ff);
s->buf + ((value << 1) & (sizeof(s->buf) / 4 - 1));
break;
case MUSB_HDRC_EP_IDX ... (MUSB_HDRC_EP_IDX + 0xf):
@@ -1439,12 +1375,6 @@ 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);
@@ -1454,17 +1384,28 @@ 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;
int ep;
MUSBEndPoint *ep;
int epnum;
switch (addr) {
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 |
musb_read_fifo(s->ep + ep) << 16 |
musb_read_fifo(s->ep + ep) << 24 );
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] ++];
default:
TRACE("unknown register 0x%02x", (int) addr);
printf("%s: unknown register at %02x\n", __FUNCTION__, (int) addr);
return 0x00000000;
};
}
@@ -1472,19 +1413,28 @@ 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;
int ep;
MUSBEndPoint *ep;
int epnum;
switch (addr) {
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);
musb_write_fifo(s->ep + ep, (value >> 16) & 0xff);
musb_write_fifo(s->ep + ep, (value >> 24) & 0xff);
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);
break;
default:
TRACE("unknown register 0x%02x", (int) addr);
}
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);
};
}
+2 -4
View File
@@ -1721,16 +1721,14 @@ 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[PCI_CLASS_PROG] = 0x10; /* OHCI */
ohci->pci_dev.config[0x09] = 0x10; /* OHCI */
pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);
/* TODO: RST# value should be 0. */
ohci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */
ohci->pci_dev.config[0x3d] = 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;
+3 -4
View File
@@ -1065,12 +1065,11 @@ static int usb_uhci_common_initfn(UHCIState *s)
uint8_t *pci_conf = s->dev.config;
int i;
pci_conf[PCI_REVISION_ID] = 0x01; // revision number
pci_conf[PCI_CLASS_PROG] = 0x00;
pci_conf[0x08] = 0x01; // revision number
pci_conf[0x09] = 0x00;
pci_config_set_class(pci_conf, PCI_CLASS_SERIAL_USB);
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
/* TODO: reset value should be 0. */
pci_conf[PCI_INTERRUPT_PIN] = 4; // interrupt pin 3
pci_conf[0x3d] = 4; // interrupt pin 3
pci_conf[0x60] = 0x10; // release number
usb_bus_new(&s->bus, &s->dev.qdev);
+9 -11
View File
@@ -1203,18 +1203,16 @@ static int pci_vmsvga_initfn(PCIDevice *dev)
pci_config_set_vendor_id(s->card.config, PCI_VENDOR_ID_VMWARE);
pci_config_set_device_id(s->card.config, SVGA_PCI_DEVICE_ID);
s->card.config[PCI_COMMAND] = PCI_COMMAND_IO |
PCI_COMMAND_MEMORY |
PCI_COMMAND_MASTER; /* I/O + Memory */
s->card.config[PCI_COMMAND] = 0x07; /* I/O + Memory */
pci_config_set_class(s->card.config, PCI_CLASS_DISPLAY_VGA);
s->card.config[PCI_CACHE_LINE_SIZE] = 0x08; /* Cache line size */
s->card.config[PCI_LATENCY_TIMER] = 0x40; /* Latency timer */
s->card.config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL;
s->card.config[PCI_SUBSYSTEM_VENDOR_ID] = PCI_VENDOR_ID_VMWARE & 0xff;
s->card.config[PCI_SUBSYSTEM_VENDOR_ID + 1] = PCI_VENDOR_ID_VMWARE >> 8;
s->card.config[PCI_SUBSYSTEM_ID] = SVGA_PCI_DEVICE_ID & 0xff;
s->card.config[PCI_SUBSYSTEM_ID + 1] = SVGA_PCI_DEVICE_ID >> 8;
s->card.config[PCI_INTERRUPT_LINE] = 0xff; /* End */
s->card.config[0x0c] = 0x08; /* Cache line size */
s->card.config[0x0d] = 0x40; /* Latency timer */
s->card.config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL;
s->card.config[0x2c] = PCI_VENDOR_ID_VMWARE & 0xff;
s->card.config[0x2d] = PCI_VENDOR_ID_VMWARE >> 8;
s->card.config[0x2e] = SVGA_PCI_DEVICE_ID & 0xff;
s->card.config[0x2f] = SVGA_PCI_DEVICE_ID >> 8;
s->card.config[0x3c] = 0xff; /* End */
pci_register_bar(&s->card, 0, 0x10,
PCI_BASE_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport);
+1 -1
View File
@@ -411,7 +411,7 @@ static int i6300esb_init(PCIDevice *dev)
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9);
pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER);
pci_conf[PCI_HEADER_TYPE] = 0x00;
pci_conf[0x0e] = 0x00;
pci_register_bar(&d->dev, 0, 0x10,
PCI_BASE_ADDRESS_SPACE_MEMORY, i6300esb_map);
-212
View File
@@ -39,215 +39,3 @@ struct target_pt_regs {
};
#define UNAME_MACHINE "alpha"
#undef TARGET_EDEADLK
#define TARGET_EDEADLK 11
#undef TARGET_EAGAIN
#define TARGET_EAGAIN 35
#undef TARGET_EINPROGRESS
#define TARGET_EINPROGRESS 36
#undef TARGET_EALREADY
#define TARGET_EALREADY 37
#undef TARGET_ENOTSOCK
#define TARGET_ENOTSOCK 38
#undef TARGET_EDESTADDRREQ
#define TARGET_EDESTADDRREQ 39
#undef TARGET_EMSGSIZE
#define TARGET_EMSGSIZE 40
#undef TARGET_EPROTOTYPE
#define TARGET_EPROTOTYPE 41
#undef TARGET_ENOPROTOOPT
#define TARGET_ENOPROTOOPT 42
#undef TARGET_EPROTONOSUPPORT
#define TARGET_EPROTONOSUPPORT 43
#undef TARGET_ESOCKTNOSUPPORT
#define TARGET_ESOCKTNOSUPPORT 44
#undef TARGET_EOPNOTSUPP
#define TARGET_EOPNOTSUPP 45
#undef TARGET_EPFNOSUPPORT
#define TARGET_EPFNOSUPPORT 46
#undef TARGET_EAFNOSUPPORT
#define TARGET_EAFNOSUPPORT 47
#undef TARGET_EADDRINUSE
#define TARGET_EADDRINUSE 48
#undef TARGET_EADDRNOTAVAIL
#define TARGET_EADDRNOTAVAIL 49
#undef TARGET_ENETDOWN
#define TARGET_ENETDOWN 50
#undef TARGET_ENETUNREACH
#define TARGET_ENETUNREACH 51
#undef TARGET_ENETRESET
#define TARGET_ENETRESET 52
#undef TARGET_ECONNABORTED
#define TARGET_ECONNABORTED 53
#undef TARGET_ECONNRESET
#define TARGET_ECONNRESET 54
#undef TARGET_ENOBUFS
#define TARGET_ENOBUFS 55
#undef TARGET_EISCONN
#define TARGET_EISCONN 56
#undef TARGET_ENOTCONN
#define TARGET_ENOTCONN 57
#undef TARGET_ESHUTDOWN
#define TARGET_ESHUTDOWN 58
#undef TARGET_ETOOMANYREFS
#define TARGET_ETOOMANYREFS 59
#undef TARGET_ETIMEDOUT
#define TARGET_ETIMEDOUT 60
#undef TARGET_ECONNREFUSED
#define TARGET_ECONNREFUSED 61
#undef TARGET_ELOOP
#define TARGET_ELOOP 62
#undef TARGET_ENAMETOOLONG
#define TARGET_ENAMETOOLONG 63
#undef TARGET_EHOSTDOWN
#define TARGET_EHOSTDOWN 64
#undef TARGET_EHOSTUNREACH
#define TARGET_EHOSTUNREACH 65
#undef TARGET_ENOTEMPTY
#define TARGET_ENOTEMPTY 66
// Unused 67
#undef TARGET_EUSERS
#define TARGET_EUSERS 68
#undef TARGET_EDQUOT
#define TARGET_EDQUOT 69
#undef TARGET_ESTALE
#define TARGET_ESTALE 70
#undef TARGET_EREMOTE
#define TARGET_EREMOTE 71
// Unused 72-76
#undef TARGET_ENOLCK
#define TARGET_ENOLCK 77
#undef TARGET_ENOSYS
#define TARGET_ENOSYS 78
// Unused 79
#undef TARGET_ENOMSG
#define TARGET_ENOMSG 80
#undef TARGET_EIDRM
#define TARGET_EIDRM 81
#undef TARGET_ENOSR
#define TARGET_ENOSR 82
#undef TARGET_ETIME
#define TARGET_ETIME 83
#undef TARGET_EBADMSG
#define TARGET_EBADMSG 84
#undef TARGET_EPROTO
#define TARGET_EPROTO 85
#undef TARGET_ENODATA
#define TARGET_ENODATA 86
#undef TARGET_ENOSTR
#define TARGET_ENOSTR 87
#undef TARGET_ECHRNG
#define TARGET_ECHRNG 88
#undef TARGET_EL2NSYNC
#define TARGET_EL2NSYNC 89
#undef TARGET_EL3HLT
#define TARGET_EL3HLT 90
#undef TARGET_EL3RST
#define TARGET_EL3RST 91
#undef TARGET_ENOPKG
#define TARGET_ENOPKG 92
#undef TARGET_ELNRNG
#define TARGET_ELNRNG 93
#undef TARGET_EUNATCH
#define TARGET_EUNATCH 94
#undef TARGET_ENOCSI
#define TARGET_ENOCSI 95
#undef TARGET_EL2HLT
#define TARGET_EL2HLT 96
#undef TARGET_EBADE
#define TARGET_EBADE 97
#undef TARGET_EBADR
#define TARGET_EBADR 98
#undef TARGET_EXFULL
#define TARGET_EXFULL 99
#undef TARGET_ENOANO
#define TARGET_ENOANO 100
#undef TARGET_EBADRQC
#define TARGET_EBADRQC 101
#undef TARGET_EBADSLT
#define TARGET_EBADSLT 102
// Unused 103
#undef TARGET_EBFONT
#define TARGET_EBFONT 104
#undef TARGET_ENONET
#define TARGET_ENONET 105
#undef TARGET_ENOLINK
#define TARGET_ENOLINK 106
#undef TARGET_EADV
#define TARGET_EADV 107
#undef TARGET_ESRMNT
#define TARGET_ESRMNT 108
#undef TARGET_ECOMM
#define TARGET_ECOMM 109
#undef TARGET_EMULTIHOP
#define TARGET_EMULTIHOP 110
#undef TARGET_EDOTDOT
#define TARGET_EDOTDOT 111
#undef TARGET_EOVERFLOW
#define TARGET_EOVERFLOW 112
#undef TARGET_ENOTUNIQ
#define TARGET_ENOTUNIQ 113
#undef TARGET_EBADFD
#define TARGET_EBADFD 114
#undef TARGET_EREMCHG
#define TARGET_EREMCHG 115
#undef TARGET_EILSEQ
#define TARGET_EILSEQ 116
// Same as default 117-121
#undef TARGET_ELIBACC
#define TARGET_ELIBACC 122
#undef TARGET_ELIBBAD
#define TARGET_ELIBBAD 123
#undef TARGET_ELIBSCN
#define TARGET_ELIBSCN 124
#undef TARGET_ELIBMAX
#define TARGET_ELIBMAX 125
#undef TARGET_ELIBEXEC
#define TARGET_ELIBEXEC 126
#undef TARGET_ERESTART
#define TARGET_ERESTART 127
#undef TARGET_ESTRPIPE
#define TARGET_ESTRPIPE 128
#undef TARGET_ENOMEDIUM
#define TARGET_ENOMEDIUM 129
#undef TARGET_EMEDIUMTYPE
#define TARGET_EMEDIUMTYPE 130
#undef TARGET_ECANCELED
#define TARGET_ECANCELED 131
#undef TARGET_ENOKEY
#define TARGET_ENOKEY 132
#undef TARGET_EKEYEXPIRED
#define TARGET_EKEYEXPIRED 133
#undef TARGET_EKEYREVOKED
#define TARGET_EKEYREVOKED 134
#undef TARGET_EKEYREJECTED
#define TARGET_EKEYREJECTED 135
#undef TARGET_EOWNERDEAD
#define TARGET_EOWNERDEAD 136
#undef TARGET_ENOTRECOVERABLE
#define TARGET_ENOTRECOVERABLE 137
#undef TARGET_ERFKILL
#define TARGET_ERFKILL 138
// For sys_osf_getsysinfo
#define TARGET_GSI_UACPROC 8
#define TARGET_GSI_IEEE_FP_CONTROL 45
#define TARGET_GSI_IEEE_STATE_AT_SIGNAL 46
#define TARGET_GSI_PROC_TYPE 60
#define TARGET_GSI_GET_HWRPB 101
// For sys_ofs_setsysinfo
#define TARGET_SSI_NVPAIRS 1
#define TARGET_SSI_IEEE_FP_CONTROL 14
#define TARGET_SSI_IEEE_STATE_AT_SIGNAL 15
#define TARGET_SSI_IEEE_IGNORE_STATE_AT_SIGNAL 16
#define TARGET_SSI_IEEE_RAISE_EXCEPTION 1001
#define TARGET_SSIN_UACPROC 6
#define TARGET_UAC_NOPRINT 1
#define TARGET_UAC_NOFIX 2
#define TARGET_UAC_SIGBUS 4
-8
View File
@@ -411,11 +411,3 @@
#define TARGET_NR_signalfd 476
#define TARGET_NR_timerfd 477
#define TARGET_NR_eventfd 478
/* The following aliases are defined in order to match up with the
standard i386 syscalls implemented in syscalls.c. */
#define TARGET_NR_chown32 TARGET_NR_chown
#define TARGET_NR_setuid32 TARGET_NR_setuid
#define TARGET_NR_setgid32 TARGET_NR_setgid
#define TARGET_NR_setfsuid32 TARGET_NR_setfsuid
#define TARGET_NR_setfsgid32 TARGET_NR_setfsgid
+45 -164
View File
@@ -97,16 +97,6 @@ enum {
#define ELIBBAD 80
#endif
typedef target_ulong target_elf_greg_t;
#ifdef USE_UID16
typedef uint16_t target_uid_t;
typedef uint16_t target_gid_t;
#else
typedef uint32_t target_uid_t;
typedef uint32_t target_gid_t;
#endif
typedef int32_t target_pid_t;
#ifdef TARGET_I386
#define ELF_PLATFORM get_elf_platform()
@@ -144,6 +134,11 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->rip = infop->entry;
}
typedef target_ulong target_elf_greg_t;
typedef uint32_t target_uid_t;
typedef uint32_t target_gid_t;
typedef int32_t target_pid_t;
#define ELF_NREG 27
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
@@ -216,6 +211,11 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->edx = 0;
}
typedef target_ulong target_elf_greg_t;
typedef uint16_t target_uid_t;
typedef uint16_t target_gid_t;
typedef int32_t target_pid_t;
#define ELF_NREG 17
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
@@ -286,30 +286,35 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->ARM_r10 = infop->start_data;
}
typedef uint32_t target_elf_greg_t;
typedef uint16_t target_uid_t;
typedef uint16_t target_gid_t;
typedef int32_t target_pid_t;
#define ELF_NREG 18
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
{
(*regs)[0] = tswapl(env->regs[0]);
(*regs)[1] = tswapl(env->regs[1]);
(*regs)[2] = tswapl(env->regs[2]);
(*regs)[3] = tswapl(env->regs[3]);
(*regs)[4] = tswapl(env->regs[4]);
(*regs)[5] = tswapl(env->regs[5]);
(*regs)[6] = tswapl(env->regs[6]);
(*regs)[7] = tswapl(env->regs[7]);
(*regs)[8] = tswapl(env->regs[8]);
(*regs)[9] = tswapl(env->regs[9]);
(*regs)[10] = tswapl(env->regs[10]);
(*regs)[11] = tswapl(env->regs[11]);
(*regs)[12] = tswapl(env->regs[12]);
(*regs)[13] = tswapl(env->regs[13]);
(*regs)[14] = tswapl(env->regs[14]);
(*regs)[15] = tswapl(env->regs[15]);
(*regs)[0] = env->regs[0];
(*regs)[1] = env->regs[1];
(*regs)[2] = env->regs[2];
(*regs)[3] = env->regs[3];
(*regs)[4] = env->regs[4];
(*regs)[5] = env->regs[5];
(*regs)[6] = env->regs[6];
(*regs)[7] = env->regs[7];
(*regs)[8] = env->regs[8];
(*regs)[9] = env->regs[9];
(*regs)[10] = env->regs[10];
(*regs)[11] = env->regs[11];
(*regs)[12] = env->regs[12];
(*regs)[13] = env->regs[13];
(*regs)[14] = env->regs[14];
(*regs)[15] = env->regs[15];
(*regs)[16] = tswapl(cpsr_read((CPUState *)env));
(*regs)[17] = tswapl(env->regs[0]); /* XXX */
(*regs)[16] = cpsr_read((CPUState *)env);
(*regs)[17] = env->regs[0]; /* XXX */
}
#define USE_ELF_CORE_DUMP
@@ -539,32 +544,6 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *
_regs->gpr[5] = pos;
}
/* See linux kernel: arch/powerpc/include/asm/elf.h. */
#define ELF_NREG 48
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
{
int i;
target_ulong ccr = 0;
for (i = 0; i < ARRAY_SIZE(env->gpr); i++) {
(*regs)[i] = tswapl(env->gpr[i]);
}
(*regs)[32] = tswapl(env->nip);
(*regs)[33] = tswapl(env->msr);
(*regs)[35] = tswapl(env->ctr);
(*regs)[36] = tswapl(env->lr);
(*regs)[37] = tswapl(env->xer);
for (i = 0; i < ARRAY_SIZE(env->crf); i++) {
ccr |= env->crf[i] << (32 - ((i + 1) * 4));
}
(*regs)[38] = tswapl(ccr);
}
#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 4096
#endif
@@ -594,52 +573,6 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->regs[29] = infop->start_stack;
}
/* See linux kernel: arch/mips/include/asm/elf.h. */
#define ELF_NREG 45
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
/* See linux kernel: arch/mips/include/asm/reg.h. */
enum {
#ifdef TARGET_MIPS64
TARGET_EF_R0 = 0,
#else
TARGET_EF_R0 = 6,
#endif
TARGET_EF_R26 = TARGET_EF_R0 + 26,
TARGET_EF_R27 = TARGET_EF_R0 + 27,
TARGET_EF_LO = TARGET_EF_R0 + 32,
TARGET_EF_HI = TARGET_EF_R0 + 33,
TARGET_EF_CP0_EPC = TARGET_EF_R0 + 34,
TARGET_EF_CP0_BADVADDR = TARGET_EF_R0 + 35,
TARGET_EF_CP0_STATUS = TARGET_EF_R0 + 36,
TARGET_EF_CP0_CAUSE = TARGET_EF_R0 + 37
};
/* See linux kernel: arch/mips/kernel/process.c:elf_dump_regs. */
static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
{
int i;
for (i = 0; i < TARGET_EF_R0; i++) {
(*regs)[i] = 0;
}
(*regs)[TARGET_EF_R0] = 0;
for (i = 1; i < ARRAY_SIZE(env->active_tc.gpr); i++) {
(*regs)[TARGET_EF_R0 + i] = tswapl(env->active_tc.gpr[i]);
}
(*regs)[TARGET_EF_R26] = 0;
(*regs)[TARGET_EF_R27] = 0;
(*regs)[TARGET_EF_LO] = tswapl(env->active_tc.LO[0]);
(*regs)[TARGET_EF_HI] = tswapl(env->active_tc.HI[0]);
(*regs)[TARGET_EF_CP0_EPC] = tswapl(env->active_tc.PC);
(*regs)[TARGET_EF_CP0_BADVADDR] = tswapl(env->CP0_BadVAddr);
(*regs)[TARGET_EF_CP0_STATUS] = tswapl(env->CP0_Status);
(*regs)[TARGET_EF_CP0_CAUSE] = tswapl(env->CP0_Cause);
}
#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 4096
#endif /* TARGET_MIPS */
@@ -682,39 +615,6 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->regs[15] = infop->start_stack;
}
/* See linux kernel: arch/sh/include/asm/elf.h. */
#define ELF_NREG 23
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
/* See linux kernel: arch/sh/include/asm/ptrace.h. */
enum {
TARGET_REG_PC = 16,
TARGET_REG_PR = 17,
TARGET_REG_SR = 18,
TARGET_REG_GBR = 19,
TARGET_REG_MACH = 20,
TARGET_REG_MACL = 21,
TARGET_REG_SYSCALL = 22
};
static inline void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
{
int i;
for (i = 0; i < 16; i++) {
(*regs[i]) = tswapl(env->gregs[i]);
}
(*regs)[TARGET_REG_PC] = tswapl(env->pc);
(*regs)[TARGET_REG_PR] = tswapl(env->pr);
(*regs)[TARGET_REG_SR] = tswapl(env->sr);
(*regs)[TARGET_REG_GBR] = tswapl(env->gbr);
(*regs)[TARGET_REG_MACH] = tswapl(env->mach);
(*regs)[TARGET_REG_MACL] = tswapl(env->macl);
(*regs)[TARGET_REG_SYSCALL] = 0; /* FIXME */
}
#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 4096
#endif
@@ -758,35 +658,6 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->pc = infop->entry;
}
/* See linux kernel: arch/m68k/include/asm/elf.h. */
#define ELF_NREG 20
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
{
(*regs)[0] = tswapl(env->dregs[1]);
(*regs)[1] = tswapl(env->dregs[2]);
(*regs)[2] = tswapl(env->dregs[3]);
(*regs)[3] = tswapl(env->dregs[4]);
(*regs)[4] = tswapl(env->dregs[5]);
(*regs)[5] = tswapl(env->dregs[6]);
(*regs)[6] = tswapl(env->dregs[7]);
(*regs)[7] = tswapl(env->aregs[0]);
(*regs)[8] = tswapl(env->aregs[1]);
(*regs)[9] = tswapl(env->aregs[2]);
(*regs)[10] = tswapl(env->aregs[3]);
(*regs)[11] = tswapl(env->aregs[4]);
(*regs)[12] = tswapl(env->aregs[5]);
(*regs)[13] = tswapl(env->aregs[6]);
(*regs)[14] = tswapl(env->dregs[0]);
(*regs)[15] = tswapl(env->aregs[7]);
(*regs)[16] = tswapl(env->dregs[0]); /* FIXME: orig_d0 */
(*regs)[17] = tswapl(env->sr);
(*regs)[18] = tswapl(env->pc);
(*regs)[19] = 0; /* FIXME: regs->format | regs->vector */
}
#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 8192
#endif
@@ -806,6 +677,9 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->pc = infop->entry;
regs->ps = 8;
regs->usp = infop->start_stack;
regs->unique = infop->start_data; /* ? */
printf("Set unique value to " TARGET_FMT_lx " (" TARGET_FMT_lx ")\n",
regs->unique, infop->start_data);
}
#define ELF_EXEC_PAGESIZE 8192
@@ -1893,7 +1767,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
* Core dump code is copied from linux kernel (fs/binfmt_elf.c).
*
* Porting ELF coredump for target is (quite) simple process. First you
* define USE_ELF_CORE_DUMP in target ELF code (where init_thread() for
* define ELF_USE_CORE_DUMP in target ELF code (where init_thread() for
* the target resides):
*
* #define USE_ELF_CORE_DUMP
@@ -1905,6 +1779,13 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
* #define ELF_NREG <number of registers>
* typedef taret_elf_greg_t target_elf_gregset_t[ELF_NREG];
*
* Then define following types to match target types. Actual types can
* be found from linux kernel (arch/<ARCH>/include/asm/posix_types.h):
*
* typedef <target_uid_type> target_uid_t;
* typedef <target_gid_type> target_gid_t;
* typedef <target_pid_type> target_pid_t;
*
* Last step is to implement target specific function that copies registers
* from given cpu into just specified register set. Prototype is:
*
@@ -2711,7 +2592,7 @@ static int elf_core_dump(int signr, const CPUState *env)
*/
error = copy_from_user(page, addr, sizeof (page));
if (error != 0) {
(void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n",
(void) fprintf(stderr, "unable to dump " TARGET_FMT_lx "\n",
addr);
errno = -error;
goto out;
+8 -10
View File
@@ -99,14 +99,13 @@ static int pending_cpus;
/* Make sure everything is in a consistent state for calling fork(). */
void fork_start(void)
{
mmap_fork_start();
pthread_mutex_lock(&tb_lock);
pthread_mutex_lock(&exclusive_lock);
mmap_fork_start();
}
void fork_end(int child)
{
mmap_fork_end(child);
if (child) {
/* Child processes created by fork() only have a single thread.
Discard information about the parent threads. */
@@ -123,6 +122,7 @@ void fork_end(int child)
pthread_mutex_unlock(&exclusive_lock);
pthread_mutex_unlock(&tb_lock);
}
mmap_fork_end(child);
}
/* Wait for pending exclusive operations to complete. The exclusive lock
@@ -548,8 +548,6 @@ static int do_strex(CPUARMState *env)
case 3:
segv = get_user_u32(val, addr);
break;
default:
abort();
}
if (segv) {
env->cp15.c6_data = addr;
@@ -1070,9 +1068,9 @@ static inline uint64_t cpu_ppc_get_tb (CPUState *env)
return 0;
}
uint64_t cpu_ppc_load_tbl (CPUState *env)
uint32_t cpu_ppc_load_tbl (CPUState *env)
{
return cpu_ppc_get_tb(env);
return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
}
uint32_t cpu_ppc_load_tbu (CPUState *env)
@@ -1080,9 +1078,9 @@ uint32_t cpu_ppc_load_tbu (CPUState *env)
return cpu_ppc_get_tb(env) >> 32;
}
uint64_t cpu_ppc_load_atbl (CPUState *env)
uint32_t cpu_ppc_load_atbl (CPUState *env)
{
return cpu_ppc_get_tb(env);
return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
}
uint32_t cpu_ppc_load_atbu (CPUState *env)
@@ -1099,12 +1097,12 @@ uint32_t cpu_ppc601_load_rtcl (CPUState *env)
}
/* XXX: to be fixed */
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp)
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, uint32_t val)
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val)
{
return -1;
}
+20 -20
View File
@@ -366,19 +366,19 @@ static inline void free_sigqueue(CPUState *env, struct sigqueue *q)
}
/* abort execution with signal */
static void QEMU_NORETURN force_sig(int target_sig)
static void QEMU_NORETURN force_sig(int sig)
{
TaskState *ts = (TaskState *)thread_env->opaque;
int host_sig, core_dumped = 0;
struct sigaction act;
host_sig = target_to_host_signal(target_sig);
gdb_signalled(thread_env, target_sig);
host_sig = target_to_host_signal(sig);
gdb_signalled(thread_env, sig);
/* dump core if supported by target binary format */
if (core_dump_signal(target_sig) && (ts->bprm->core_dump != NULL)) {
if (core_dump_signal(sig) && (ts->bprm->core_dump != NULL)) {
stop_all_tasks();
core_dumped =
((*ts->bprm->core_dump)(target_sig, thread_env) == 0);
((*ts->bprm->core_dump)(sig, thread_env) == 0);
}
if (core_dumped) {
/* we already dumped the core of target process, we don't want
@@ -388,7 +388,7 @@ static void QEMU_NORETURN force_sig(int target_sig)
nodump.rlim_cur=0;
setrlimit(RLIMIT_CORE, &nodump);
(void) fprintf(stderr, "qemu: uncaught target signal %d (%s) - %s\n",
target_sig, strsignal(host_sig), "core dumped" );
sig, strsignal(host_sig), "core dumped" );
}
/* The proper exit code for dieing from an uncaught signal is
@@ -1487,7 +1487,7 @@ static long do_sigreturn_v1(CPUState *env)
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV /* , current */);
force_sig(SIGSEGV /* , current */);
return 0;
}
@@ -1539,7 +1539,7 @@ static long do_sigreturn_v2(CPUState *env)
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV /* , current */);
force_sig(SIGSEGV /* , current */);
return 0;
}
@@ -1589,7 +1589,7 @@ static long do_rt_sigreturn_v1(CPUState *env)
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV /* , current */);
force_sig(SIGSEGV /* , current */);
return 0;
}
@@ -1618,7 +1618,7 @@ static long do_rt_sigreturn_v2(CPUState *env)
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV /* , current */);
force_sig(SIGSEGV /* , current */);
return 0;
}
@@ -2160,7 +2160,7 @@ void sparc64_set_context(CPUSPARCState *env)
return;
do_sigsegv:
unlock_user_struct(ucp, ucp_addr, 0);
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
void sparc64_get_context(CPUSPARCState *env)
@@ -2254,7 +2254,7 @@ void sparc64_get_context(CPUSPARCState *env)
return;
do_sigsegv:
unlock_user_struct(ucp, ucp_addr, 1);
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
#endif
#elif defined(TARGET_ABI_MIPSN64)
@@ -2908,7 +2908,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
give_sigsegv:
unlock_user_struct(frame, frame_addr, 1);
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
static void setup_rt_frame(int sig, struct target_sigaction *ka,
@@ -2971,7 +2971,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
give_sigsegv:
unlock_user_struct(frame, frame_addr, 1);
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
long do_sigreturn(CPUState *regs)
@@ -3850,7 +3850,7 @@ sigsegv:
unlock_user_struct(frame, frame_addr, 1);
if (logfile)
fprintf (logfile, "segfaulting from setup_frame\n");
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
static void setup_rt_frame(int sig, struct target_sigaction *ka,
@@ -3919,7 +3919,7 @@ sigsegv:
unlock_user_struct(rt_sf, rt_sf_addr, 1);
if (logfile)
fprintf (logfile, "segfaulting from setup_rt_frame\n");
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
@@ -3961,7 +3961,7 @@ sigsegv:
unlock_user_struct(sc, sc_addr, 1);
if (logfile)
fprintf (logfile, "segfaulting from do_sigreturn\n");
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
return 0;
}
@@ -4024,7 +4024,7 @@ sigsegv:
unlock_user_struct(rt_sf, rt_sf_addr, 1);
if (logfile)
fprintf (logfile, "segfaulting from do_rt_sigreturn\n");
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
return 0;
}
@@ -4194,7 +4194,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
give_sigsegv:
unlock_user_struct(frame, frame_addr, 1);
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
@@ -4336,7 +4336,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
give_sigsegv:
unlock_user_struct(frame, frame_addr, 1);
force_sig(TARGET_SIGSEGV);
force_sig(SIGSEGV);
}
long do_sigreturn(CPUState *env)
+10 -127
View File
@@ -6390,142 +6390,25 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#if defined(TARGET_NR_getxuid) && defined(TARGET_ALPHA)
/* Alpha specific */
case TARGET_NR_getxuid:
{
uid_t euid;
euid=geteuid();
((CPUAlphaState *)cpu_env)->ir[IR_A4]=euid;
}
{
uid_t euid;
euid=geteuid();
((CPUAlphaState *)cpu_env)->ir[IR_A4]=euid;
}
ret = get_errno(getuid());
break;
#endif
#if defined(TARGET_NR_getxgid) && defined(TARGET_ALPHA)
/* Alpha specific */
case TARGET_NR_getxgid:
{
uid_t egid;
egid=getegid();
((CPUAlphaState *)cpu_env)->ir[IR_A4]=egid;
}
{
uid_t egid;
egid=getegid();
((CPUAlphaState *)cpu_env)->ir[IR_A4]=egid;
}
ret = get_errno(getgid());
break;
#endif
#if defined(TARGET_NR_osf_getsysinfo) && defined(TARGET_ALPHA)
/* Alpha specific */
case TARGET_NR_osf_getsysinfo:
ret = -TARGET_EOPNOTSUPP;
switch (arg1) {
case TARGET_GSI_IEEE_FP_CONTROL:
{
uint64_t swcr, fpcr = cpu_alpha_load_fpcr (cpu_env);
/* Copied from linux ieee_fpcr_to_swcr. */
swcr = (fpcr >> 35) & SWCR_STATUS_MASK;
swcr |= (fpcr >> 36) & SWCR_MAP_DMZ;
swcr |= (~fpcr >> 48) & (SWCR_TRAP_ENABLE_INV
| SWCR_TRAP_ENABLE_DZE
| SWCR_TRAP_ENABLE_OVF);
swcr |= (~fpcr >> 57) & (SWCR_TRAP_ENABLE_UNF
| SWCR_TRAP_ENABLE_INE);
swcr |= (fpcr >> 47) & SWCR_MAP_UMZ;
swcr |= (~fpcr >> 41) & SWCR_TRAP_ENABLE_DNO;
if (put_user_u64 (swcr, arg2))
goto efault;
ret = 0;
}
break;
/* case GSI_IEEE_STATE_AT_SIGNAL:
-- Not implemented in linux kernel.
case GSI_UACPROC:
-- Retrieves current unaligned access state; not much used.
case GSI_PROC_TYPE:
-- Retrieves implver information; surely not used.
case GSI_GET_HWRPB:
-- Grabs a copy of the HWRPB; surely not used.
*/
}
break;
#endif
#if defined(TARGET_NR_osf_setsysinfo) && defined(TARGET_ALPHA)
/* Alpha specific */
case TARGET_NR_osf_setsysinfo:
ret = -TARGET_EOPNOTSUPP;
switch (arg1) {
case TARGET_SSI_IEEE_FP_CONTROL:
case TARGET_SSI_IEEE_RAISE_EXCEPTION:
{
uint64_t swcr, fpcr, orig_fpcr;
if (get_user_u64 (swcr, arg2))
goto efault;
orig_fpcr = cpu_alpha_load_fpcr (cpu_env);
fpcr = orig_fpcr & FPCR_DYN_MASK;
/* Copied from linux ieee_swcr_to_fpcr. */
fpcr |= (swcr & SWCR_STATUS_MASK) << 35;
fpcr |= (swcr & SWCR_MAP_DMZ) << 36;
fpcr |= (~swcr & (SWCR_TRAP_ENABLE_INV
| SWCR_TRAP_ENABLE_DZE
| SWCR_TRAP_ENABLE_OVF)) << 48;
fpcr |= (~swcr & (SWCR_TRAP_ENABLE_UNF
| SWCR_TRAP_ENABLE_INE)) << 57;
fpcr |= (swcr & SWCR_MAP_UMZ ? FPCR_UNDZ | FPCR_UNFD : 0);
fpcr |= (~swcr & SWCR_TRAP_ENABLE_DNO) << 41;
cpu_alpha_store_fpcr (cpu_env, fpcr);
ret = 0;
if (arg1 == TARGET_SSI_IEEE_RAISE_EXCEPTION) {
/* Old exceptions are not signaled. */
fpcr &= ~(orig_fpcr & FPCR_STATUS_MASK);
/* If any exceptions set by this call, and are unmasked,
send a signal. */
/* ??? FIXME */
}
}
break;
/* case SSI_NVPAIRS:
-- Used with SSIN_UACPROC to enable unaligned accesses.
case SSI_IEEE_STATE_AT_SIGNAL:
case SSI_IEEE_IGNORE_STATE_AT_SIGNAL:
-- Not implemented in linux kernel
*/
}
break;
#endif
#ifdef TARGET_NR_osf_sigprocmask
/* Alpha specific. */
case TARGET_NR_osf_sigprocmask:
{
abi_ulong mask;
int how = arg1;
sigset_t set, oldset;
switch(arg1) {
case TARGET_SIG_BLOCK:
how = SIG_BLOCK;
break;
case TARGET_SIG_UNBLOCK:
how = SIG_UNBLOCK;
break;
case TARGET_SIG_SETMASK:
how = SIG_SETMASK;
break;
default:
ret = -TARGET_EINVAL;
goto fail;
}
mask = arg2;
target_to_host_old_sigset(&set, &mask);
sigprocmask(arg1, &set, &oldset);
host_to_target_old_sigset(&mask, &oldset);
ret = mask;
}
break;
#endif
#ifdef TARGET_NR_getgid32
case TARGET_NR_getgid32:
+96 -354
View File
@@ -12,8 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* Copyright (c) 2001 Xilinx, Inc. All rights reserved.
@@ -38,9 +37,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define STATIC_TABLE
#define DEFINE_TABLE
#define TRUE 1
#define FALSE 0
#ifndef MICROBLAZE_OPC
#define MICROBLAZE_OPC
/* Assembler instructions for Xilinx's microblaze processor
@@ -58,8 +54,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* Copyright (c) 2001 Xilinx, Inc. All rights reserved.
@@ -104,33 +99,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
enum microblaze_instr {
add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, cmp, cmpu,
addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, mulh, mulhu, mulhsu,
addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, wic, wdc, wdcclear, wdcflush, mts, mfs, br, brd,
andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, wic, wdc, mts, mfs, br, brd,
brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
bgtid, bgei, bgeid, lbu, lhu, lw, lwx, sb, sh, sw, swx, lbui, lhui, lwi,
bgtid, bgei, bgeid, lbu, lhu, lw, sb, sh, sw, lbui, lhui, lwi,
sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv,
fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, fint, fsqrt,
tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
eget, ecget, neget, necget, eput, ecput, neput, necput,
teget, tecget, tneget, tnecget, teput, tecput, tneput, tnecput,
aget, caget, naget, ncaget, aput, caput, naput, ncaput,
taget, tcaget, tnaget, tncaget, taput, tcaput, tnaput, tncaput,
eaget, ecaget, neaget, necaget, eaput, ecaput, neaput, necaput,
teaget, tecaget, tneaget, tnecaget, teaput, tecaput, tneaput, tnecaput,
getd, tgetd, cgetd, tcgetd, ngetd, tngetd, ncgetd, tncgetd,
putd, tputd, cputd, tcputd, nputd, tnputd, ncputd, tncputd,
egetd, tegetd, ecgetd, tecgetd, negetd, tnegetd, necgetd, tnecgetd,
eputd, teputd, ecputd, tecputd, neputd, tneputd, necputd, tnecputd,
agetd, tagetd, cagetd, tcagetd, nagetd, tnagetd, ncagetd, tncagetd,
aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
invalid_inst } ;
fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, invalid_inst } ;
enum microblaze_instr_type {
arithmetic_inst, logical_inst, mult_inst, div_inst, branch_inst,
@@ -147,38 +126,15 @@ enum microblaze_instr_type {
#define REG_EAR_MASK 0x8003
#define REG_ESR_MASK 0x8005
#define REG_FSR_MASK 0x8007
#define REG_BTR_MASK 0x800b
#define REG_EDR_MASK 0x800d
#define REG_PVR_MASK 0xa000
#define REG_PID_MASK 0x9000
#define REG_ZPR_MASK 0x9001
#define REG_TLBX_MASK 0x9002
#define REG_TLBLO_MASK 0x9003
#define REG_TLBHI_MASK 0x9004
#define REG_TLBSX_MASK 0x9005
#define MIN_REGNUM 0
#define MAX_REGNUM 31
#define MIN_PVR_REGNUM 0
#define MAX_PVR_REGNUM 15
#define REG_PC 32 /* PC */
#define REG_MSR 33 /* machine status reg */
#define REG_EAR 35 /* Exception reg */
#define REG_ESR 37 /* Exception reg */
#define REG_FSR 39 /* FPU Status reg */
#define REG_BTR 43 /* Branch Target reg */
#define REG_EDR 45 /* Exception reg */
#define REG_PVR 40960 /* Program Verification reg */
#define REG_PID 36864 /* MMU: Process ID reg */
#define REG_ZPR 36865 /* MMU: Zone Protect reg */
#define REG_TLBX 36866 /* MMU: TLB Index reg */
#define REG_TLBLO 36867 /* MMU: TLB Low reg */
#define REG_TLBHI 36868 /* MMU: TLB High reg */
#define REG_TLBSX 36869 /* MMU: TLB Search Index reg */
/* alternate names for gen purpose regs */
#define REG_SP 1 /* stack pointer */
@@ -203,11 +159,11 @@ enum microblaze_instr_type {
#define IMM5_MASK 0x0000001F
// FSL imm mask for get, put instructions
#define RFSL_MASK 0x000000F
// imm mask for get, put instructions
#define IMM12_MASK 0x00000FFF
// imm mask for msrset, msrclr instructions
#define IMM15_MASK 0x00007FFF
#define IMM14_MASK 0x00003FFF
#endif /* MICROBLAZE-OPCM */
@@ -226,21 +182,18 @@ enum microblaze_instr_type {
#define INST_TYPE_R1 12
// new instn type for barrel shift imms
#define INST_TYPE_RD_R1_IMM5 13
#define INST_TYPE_RD_RFSL 14
#define INST_TYPE_R1_RFSL 15
#define INST_TYPE_RD_IMM12 14
#define INST_TYPE_R1_IMM12 15
// new insn type for insn cache
#define INST_TYPE_RD_R1_SPECIAL 16
// new insn type for msrclr, msrset insns.
#define INST_TYPE_RD_IMM15 17
#define INST_TYPE_RD_IMM14 17
// new insn type for tuqula rd - addik rd, r0, 42
#define INST_TYPE_RD 18
// new insn type for t*put
#define INST_TYPE_RFSL 19
#define INST_TYPE_NONE 25
@@ -257,25 +210,24 @@ enum microblaze_instr_type {
#define OPCODE_MASK_H2 0xFC1F0000 /* High 6 and bits 20-16 */
#define OPCODE_MASK_H12 0xFFFF0000 /* High 16 */
#define OPCODE_MASK_H4 0xFC0007FF /* High 6 and low 11 bits */
#define OPCODE_MASK_H13S 0xFFE0EFF0 /* High 11 and 15:1 bits and last nibble of last byte for spr */
#define OPCODE_MASK_H23S 0xFC1FC000 /* High 6, 20-16 and 15:1 bits and last nibble of last byte for spr */
#define OPCODE_MASK_H13S 0xFFE0FFF0 /* High 11 and 15:1 bits and last nibble of last byte for spr */
#define OPCODE_MASK_H23S 0xFC1FFFF0 /* High 6, 20-16 and 15:1 bits and last nibble of last byte for spr */
#define OPCODE_MASK_H34 0xFC00FFFF /* High 6 and low 16 bits */
#define OPCODE_MASK_H14 0xFFE007FF /* High 11 and low 11 bits */
#define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits */
#define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits */
#define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits */
#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22 */
#define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21 */
#define OPCODE_MASK_H32 0xFC00F000 /* High 6 bits and bit 16, 17, 18 and 19*/
#define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits */
#define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26 */
// New Mask for msrset, msrclr insns.
#define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16 */
#define OPCODE_MASK_H23N 0xFC1FC000 /* High 6 and bits 12 - 18 */
#define DELAY_SLOT 1
#define NO_DELAY_SLOT 0
#define MAX_OPCODES 280
#define MAX_OPCODES 149
struct op_code_struct {
const char *name;
@@ -310,22 +262,19 @@ struct op_code_struct {
{"addikc",INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, addikc, arithmetic_inst },
{"rsubikc",INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, rsubikc, arithmetic_inst },
{"mul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000000, OPCODE_MASK_H4, mul, mult_inst },
{"mulh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000001, OPCODE_MASK_H4, mulh, mult_inst },
{"mulhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000003, OPCODE_MASK_H4, mulhu, mult_inst },
{"mulhsu",INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000002, OPCODE_MASK_H4, mulhsu, mult_inst },
{"idiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x48000000, OPCODE_MASK_H4, idiv, div_inst },
{"idivu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x48000002, OPCODE_MASK_H4, idivu, div_inst },
{"bsll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000400, OPCODE_MASK_H3, bsll, barrel_shift_inst },
{"bsra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000200, OPCODE_MASK_H3, bsra, barrel_shift_inst },
{"bsrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000000, OPCODE_MASK_H3, bsrl, barrel_shift_inst },
{"get", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C000000, OPCODE_MASK_H32, get, anyware_inst },
{"put", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C008000, OPCODE_MASK_H32, put, anyware_inst },
{"nget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C004000, OPCODE_MASK_H32, nget, anyware_inst },
{"nput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00C000, OPCODE_MASK_H32, nput, anyware_inst },
{"cget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C002000, OPCODE_MASK_H32, cget, anyware_inst },
{"cput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00A000, OPCODE_MASK_H32, cput, anyware_inst },
{"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
{"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
{"get", INST_TYPE_RD_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C000000, OPCODE_MASK_H32, get, anyware_inst },
{"put", INST_TYPE_R1_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C008000, OPCODE_MASK_H32, put, anyware_inst },
{"nget", INST_TYPE_RD_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C004000, OPCODE_MASK_H32, nget, anyware_inst },
{"nput", INST_TYPE_R1_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00C000, OPCODE_MASK_H32, nput, anyware_inst },
{"cget", INST_TYPE_RD_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C002000, OPCODE_MASK_H32, cget, anyware_inst },
{"cput", INST_TYPE_R1_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00A000, OPCODE_MASK_H32, cput, anyware_inst },
{"ncget", INST_TYPE_RD_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
{"ncput", INST_TYPE_R1_IMM12, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
{"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
{"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
{"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
@@ -345,8 +294,6 @@ struct op_code_struct {
{"sext16",INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000061, OPCODE_MASK_H34, sext16, logical_inst },
{"wic", INST_TYPE_RD_R1_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
{"wdc", INST_TYPE_RD_R1_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
{"wdc.clear", INST_TYPE_RD_R1_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
{"wdc.flush", INST_TYPE_RD_R1_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
{"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
{"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
{"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
@@ -399,11 +346,9 @@ struct op_code_struct {
{"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst },
{"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst },
{"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst },
{"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst },
{"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst },
{"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst },
{"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst },
{"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst },
{"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst },
{"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst },
{"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst },
@@ -419,8 +364,8 @@ struct op_code_struct {
{"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra */
{"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst },
{"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
{"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
{"msrclr",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94110000, OPCODE_MASK_H23N, msrclr, special_inst },
{"msrset",INST_TYPE_RD_IMM14, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
{"msrclr",INST_TYPE_RD_IMM14, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94110000, OPCODE_MASK_H23N, msrclr, special_inst },
{"fadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000000, OPCODE_MASK_H4, fadd, arithmetic_inst },
{"frsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000080, OPCODE_MASK_H4, frsub, arithmetic_inst },
{"fmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000100, OPCODE_MASK_H4, fmul, arithmetic_inst },
@@ -432,155 +377,24 @@ struct op_code_struct {
{"fcmp.ne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000250, OPCODE_MASK_H4, fcmp_ne, arithmetic_inst },
{"fcmp.ge", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000260, OPCODE_MASK_H4, fcmp_ge, arithmetic_inst },
{"fcmp.un", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000200, OPCODE_MASK_H4, fcmp_un, arithmetic_inst },
{"flt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000280, OPCODE_MASK_H4, flt, arithmetic_inst },
{"fint", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000300, OPCODE_MASK_H4, fint, arithmetic_inst },
{"fsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000380, OPCODE_MASK_H4, fsqrt, arithmetic_inst },
{"tget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C001000, OPCODE_MASK_H32, tget, anyware_inst },
{"tcget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C003000, OPCODE_MASK_H32, tcget, anyware_inst },
{"tnget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C005000, OPCODE_MASK_H32, tnget, anyware_inst },
{"tncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C007000, OPCODE_MASK_H32, tncget, anyware_inst },
{"tput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C009000, OPCODE_MASK_H32, tput, anyware_inst },
{"tcput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00B000, OPCODE_MASK_H32, tcput, anyware_inst },
{"tnput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00D000, OPCODE_MASK_H32, tnput, anyware_inst },
{"tncput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00F000, OPCODE_MASK_H32, tncput, anyware_inst },
{"eget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C000400, OPCODE_MASK_H32, eget, anyware_inst },
{"ecget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C002400, OPCODE_MASK_H32, ecget, anyware_inst },
{"neget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C004400, OPCODE_MASK_H32, neget, anyware_inst },
{"necget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006400, OPCODE_MASK_H32, necget, anyware_inst },
{"eput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C008400, OPCODE_MASK_H32, eput, anyware_inst },
{"ecput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00A400, OPCODE_MASK_H32, ecput, anyware_inst },
{"neput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00C400, OPCODE_MASK_H32, neput, anyware_inst },
{"necput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E400, OPCODE_MASK_H32, necput, anyware_inst },
{"teget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C001400, OPCODE_MASK_H32, teget, anyware_inst },
{"tecget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C003400, OPCODE_MASK_H32, tecget, anyware_inst },
{"tneget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C005400, OPCODE_MASK_H32, tneget, anyware_inst },
{"tnecget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C007400, OPCODE_MASK_H32, tnecget, anyware_inst },
{"teput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C009400, OPCODE_MASK_H32, teput, anyware_inst },
{"tecput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00B400, OPCODE_MASK_H32, tecput, anyware_inst },
{"tneput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00D400, OPCODE_MASK_H32, tneput, anyware_inst },
{"tnecput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00F400, OPCODE_MASK_H32, tnecput, anyware_inst },
{"aget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C000800, OPCODE_MASK_H32, aget, anyware_inst },
{"caget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C002800, OPCODE_MASK_H32, caget, anyware_inst },
{"naget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C004800, OPCODE_MASK_H32, naget, anyware_inst },
{"ncaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006800, OPCODE_MASK_H32, ncaget, anyware_inst },
{"aput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C008800, OPCODE_MASK_H32, aput, anyware_inst },
{"caput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00A800, OPCODE_MASK_H32, caput, anyware_inst },
{"naput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00C800, OPCODE_MASK_H32, naput, anyware_inst },
{"ncaput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E800, OPCODE_MASK_H32, ncaput, anyware_inst },
{"taget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C001800, OPCODE_MASK_H32, taget, anyware_inst },
{"tcaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C003800, OPCODE_MASK_H32, tcaget, anyware_inst },
{"tnaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C005800, OPCODE_MASK_H32, tnaget, anyware_inst },
{"tncaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C007800, OPCODE_MASK_H32, tncaget, anyware_inst },
{"taput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C009800, OPCODE_MASK_H32, taput, anyware_inst },
{"tcaput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00B800, OPCODE_MASK_H32, tcaput, anyware_inst },
{"tnaput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00D800, OPCODE_MASK_H32, tnaput, anyware_inst },
{"tncaput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00F800, OPCODE_MASK_H32, tncaput, anyware_inst },
{"eaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C000C00, OPCODE_MASK_H32, eget, anyware_inst },
{"ecaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C002C00, OPCODE_MASK_H32, ecget, anyware_inst },
{"neaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C004C00, OPCODE_MASK_H32, neget, anyware_inst },
{"necaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006C00, OPCODE_MASK_H32, necget, anyware_inst },
{"eaput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C008C00, OPCODE_MASK_H32, eput, anyware_inst },
{"ecaput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00AC00, OPCODE_MASK_H32, ecput, anyware_inst },
{"neaput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00CC00, OPCODE_MASK_H32, neput, anyware_inst },
{"necaput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00EC00, OPCODE_MASK_H32, necput, anyware_inst },
{"teaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C001C00, OPCODE_MASK_H32, teaget, anyware_inst },
{"tecaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C003C00, OPCODE_MASK_H32, tecaget, anyware_inst },
{"tneaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C005C00, OPCODE_MASK_H32, tneaget, anyware_inst },
{"tnecaget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C007C00, OPCODE_MASK_H32, tnecaget, anyware_inst },
{"teaput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C009C00, OPCODE_MASK_H32, teaput, anyware_inst },
{"tecaput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00BC00, OPCODE_MASK_H32, tecaput, anyware_inst },
{"tneaput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00DC00, OPCODE_MASK_H32, tneaput, anyware_inst },
{"tnecaput", INST_TYPE_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00FC00, OPCODE_MASK_H32, tnecaput, anyware_inst },
{"getd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000000, OPCODE_MASK_H34C, getd, anyware_inst },
{"tgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000080, OPCODE_MASK_H34C, tgetd, anyware_inst },
{"cgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000100, OPCODE_MASK_H34C, cgetd, anyware_inst },
{"tcgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000180, OPCODE_MASK_H34C, tcgetd, anyware_inst },
{"ngetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000200, OPCODE_MASK_H34C, ngetd, anyware_inst },
{"tngetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000280, OPCODE_MASK_H34C, tngetd, anyware_inst },
{"ncgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000300, OPCODE_MASK_H34C, ncgetd, anyware_inst },
{"tncgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000380, OPCODE_MASK_H34C, tncgetd, anyware_inst },
{"putd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000400, OPCODE_MASK_H34C, putd, anyware_inst },
{"tputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000480, OPCODE_MASK_H34C, tputd, anyware_inst },
{"cputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000500, OPCODE_MASK_H34C, cputd, anyware_inst },
{"tcputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000580, OPCODE_MASK_H34C, tcputd, anyware_inst },
{"nputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000600, OPCODE_MASK_H34C, nputd, anyware_inst },
{"tnputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000680, OPCODE_MASK_H34C, tnputd, anyware_inst },
{"ncputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000700, OPCODE_MASK_H34C, ncputd, anyware_inst },
{"tncputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000780, OPCODE_MASK_H34C, tncputd, anyware_inst },
{"egetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000020, OPCODE_MASK_H34C, egetd, anyware_inst },
{"tegetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0000A0, OPCODE_MASK_H34C, tegetd, anyware_inst },
{"ecgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000120, OPCODE_MASK_H34C, ecgetd, anyware_inst },
{"tecgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0001A0, OPCODE_MASK_H34C, tecgetd, anyware_inst },
{"negetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000220, OPCODE_MASK_H34C, negetd, anyware_inst },
{"tnegetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0002A0, OPCODE_MASK_H34C, tnegetd, anyware_inst },
{"necgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000320, OPCODE_MASK_H34C, necgetd, anyware_inst },
{"tnecgetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0003A0, OPCODE_MASK_H34C, tnecgetd, anyware_inst },
{"eputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000420, OPCODE_MASK_H34C, eputd, anyware_inst },
{"teputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0004A0, OPCODE_MASK_H34C, teputd, anyware_inst },
{"ecputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000520, OPCODE_MASK_H34C, ecputd, anyware_inst },
{"tecputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0005A0, OPCODE_MASK_H34C, tecputd, anyware_inst },
{"neputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000620, OPCODE_MASK_H34C, neputd, anyware_inst },
{"tneputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0006A0, OPCODE_MASK_H34C, tneputd, anyware_inst },
{"necputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000720, OPCODE_MASK_H34C, necputd, anyware_inst },
{"tnecputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0007A0, OPCODE_MASK_H34C, tnecputd, anyware_inst },
{"agetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000040, OPCODE_MASK_H34C, agetd, anyware_inst },
{"tagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0000C0, OPCODE_MASK_H34C, tagetd, anyware_inst },
{"cagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000140, OPCODE_MASK_H34C, cagetd, anyware_inst },
{"tcagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0001C0, OPCODE_MASK_H34C, tcagetd, anyware_inst },
{"nagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000240, OPCODE_MASK_H34C, nagetd, anyware_inst },
{"tnagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0002C0, OPCODE_MASK_H34C, tnagetd, anyware_inst },
{"ncagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000340, OPCODE_MASK_H34C, ncagetd, anyware_inst },
{"tncagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0003C0, OPCODE_MASK_H34C, tncagetd, anyware_inst },
{"aputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000440, OPCODE_MASK_H34C, aputd, anyware_inst },
{"taputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0004C0, OPCODE_MASK_H34C, taputd, anyware_inst },
{"caputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000540, OPCODE_MASK_H34C, caputd, anyware_inst },
{"tcaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0005C0, OPCODE_MASK_H34C, tcaputd, anyware_inst },
{"naputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000640, OPCODE_MASK_H34C, naputd, anyware_inst },
{"tnaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0006C0, OPCODE_MASK_H34C, tnaputd, anyware_inst },
{"ncaputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000740, OPCODE_MASK_H34C, ncaputd, anyware_inst },
{"tncaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0007C0, OPCODE_MASK_H34C, tncaputd, anyware_inst },
{"eagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000060, OPCODE_MASK_H34C, eagetd, anyware_inst },
{"teagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0000E0, OPCODE_MASK_H34C, teagetd, anyware_inst },
{"ecagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000160, OPCODE_MASK_H34C, ecagetd, anyware_inst },
{"tecagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0001E0, OPCODE_MASK_H34C, tecagetd, anyware_inst },
{"neagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000260, OPCODE_MASK_H34C, neagetd, anyware_inst },
{"tneagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0002E0, OPCODE_MASK_H34C, tneagetd, anyware_inst },
{"necagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000360, OPCODE_MASK_H34C, necagetd, anyware_inst },
{"tnecagetd", INST_TYPE_RD_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0003E0, OPCODE_MASK_H34C, tnecagetd, anyware_inst },
{"eaputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000460, OPCODE_MASK_H34C, eaputd, anyware_inst },
{"teaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0004E0, OPCODE_MASK_H34C, teaputd, anyware_inst },
{"ecaputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000560, OPCODE_MASK_H34C, ecaputd, anyware_inst },
{"tecaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0005E0, OPCODE_MASK_H34C, tecaputd, anyware_inst },
{"neaputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000660, OPCODE_MASK_H34C, neaputd, anyware_inst },
{"tneaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0006E0, OPCODE_MASK_H34C, tneaputd, anyware_inst },
{"necaputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000760, OPCODE_MASK_H34C, necaputd, anyware_inst },
{"tnecaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0007E0, OPCODE_MASK_H34C, tnecaputd, anyware_inst },
{"", 0, 0, 0, 0, 0, 0, 0, 0},
{""}
};
/* prefix for register names */
char register_prefix[] = "r";
char special_register_prefix[] = "spr";
char fsl_register_prefix[] = "rfsl";
char pvr_register_prefix[] = "rpvr";
/* #defines for valid immediate range */
#define MIN_IMM ((int) 0x80000000)
#define MAX_IMM ((int) 0x7fffffff)
#define MIN_IMM 0x80000000
#define MAX_IMM 0x7fffffff
#define MIN_IMM15 ((int) 0x0000)
#define MAX_IMM15 ((int) 0x7fff)
#define MIN_IMM12 0x000
#define MAX_IMM12 0x7ff
#define MIN_IMM14 0x0000
#define MAX_IMM14 0x1fff
#endif /* MICROBLAZE_OPC */
@@ -593,42 +407,8 @@ char pvr_register_prefix[] = "rpvr";
#define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
#define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
/* Local function prototypes. */
static char * get_field (long instr, long mask, unsigned short low);
static char * get_field_imm (long instr);
static char * get_field_imm5 (long instr);
static char * get_field_rfsl (long instr);
static char * get_field_imm15 (long instr);
#if 0
static char * get_field_unsigned_imm (long instr);
#endif
char * get_field_special (long instr, struct op_code_struct * op);
unsigned long read_insn_microblaze (bfd_vma memaddr,
struct disassemble_info *info,
struct op_code_struct **opr);
enum microblaze_instr get_insn_microblaze (long inst,
bfd_boolean *isunsignedimm,
enum microblaze_instr_type *insn_type,
short *delay_slots);
short get_delay_slots_microblaze (long inst);
enum microblaze_instr microblaze_decode_insn (long insn,
int *rd,
int *ra,
int *rb,
int *imm);
unsigned long
microblaze_get_target_address (long inst,
bfd_boolean immfound,
int immval,
long pcval,
long r1val,
long r2val,
bfd_boolean *targetvalid,
bfd_boolean *unconditionalbranch);
static char *
get_field (long instr, long mask, unsigned short low)
get_field (long instr, long mask, unsigned short low)
{
char tmpstr[25];
sprintf(tmpstr, "%s%d", register_prefix, (int)((instr & mask) >> low));
@@ -636,7 +416,7 @@ get_field (long instr, long mask, unsigned short low)
}
static char *
get_field_imm (long instr)
get_field_imm (long instr)
{
char tmpstr[25];
sprintf(tmpstr, "%d", (short)((instr & IMM_MASK) >> IMM_LOW));
@@ -644,7 +424,7 @@ get_field_imm (long instr)
}
static char *
get_field_imm5 (long instr)
get_field_imm5 (long instr)
{
char tmpstr[25];
sprintf(tmpstr, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
@@ -652,24 +432,24 @@ get_field_imm5 (long instr)
}
static char *
get_field_rfsl (long instr)
get_field_imm12 (long instr)
{
char tmpstr[25];
sprintf(tmpstr, "%s%d", fsl_register_prefix, (short)((instr & RFSL_MASK) >> IMM_LOW));
sprintf(tmpstr, "%s%d", fsl_register_prefix, (short)((instr & IMM12_MASK) >> IMM_LOW));
return(strdup(tmpstr));
}
static char *
get_field_imm15 (long instr)
get_field_imm14 (long instr)
{
char tmpstr[25];
sprintf(tmpstr, "%d", (short)((instr & IMM15_MASK) >> IMM_LOW));
sprintf(tmpstr, "%d", (short)((instr & IMM14_MASK) >> IMM_LOW));
return(strdup(tmpstr));
}
#if 0
static char *
get_field_unsigned_imm (long instr)
get_field_unsigned_imm (long instr)
{
char tmpstr[25];
sprintf(tmpstr, "%d", (int)((instr & IMM_MASK) >> IMM_LOW));
@@ -690,14 +470,13 @@ get_field_unsigned_imm (long instr)
}
*/
char *
get_field_special (long instr, struct op_code_struct * op)
static char *
get_field_special (long instr, struct op_code_struct * op)
{
char tmpstr[25];
char spr[6];
char spr[5];
switch ( (((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) ) {
case REG_MSR_MASK :
strcpy(spr, "msr");
break;
@@ -712,51 +491,19 @@ get_field_special (long instr, struct op_code_struct * op)
break;
case REG_FSR_MASK :
strcpy(spr, "fsr");
break;
case REG_BTR_MASK :
strcpy(spr, "btr");
break;
case REG_EDR_MASK :
strcpy(spr, "edr");
break;
case REG_PID_MASK :
strcpy(spr, "pid");
break;
case REG_ZPR_MASK :
strcpy(spr, "zpr");
break;
case REG_TLBX_MASK :
strcpy(spr, "tlbx");
break;
case REG_TLBLO_MASK :
strcpy(spr, "tlblo");
break;
case REG_TLBHI_MASK :
strcpy(spr, "tlbhi");
break;
case REG_TLBSX_MASK :
strcpy(spr, "tlbsx");
break;
default :
{
if ( ((((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) & 0xE000) == REG_PVR_MASK) {
sprintf(tmpstr, "%spvr%d", register_prefix, (unsigned short)(((instr & IMM_MASK) >> IMM_LOW) ^ op->immval_mask) ^ REG_PVR_MASK);
return(strdup(tmpstr));
} else {
strcpy(spr, "pc");
}
}
break;
strcpy(spr, "pc");
break;
}
sprintf(tmpstr, "%s%s", register_prefix, spr);
return(strdup(tmpstr));
}
unsigned long
read_insn_microblaze (bfd_vma memaddr,
struct disassemble_info *info,
struct op_code_struct **opr)
static unsigned long
read_insn_microblaze(bfd_vma memaddr, struct disassemble_info *info,
struct op_code_struct ** opr)
{
unsigned char ibytes[4];
int status;
@@ -796,7 +543,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
unsigned long inst, prev_inst;
struct op_code_struct * op, *pop;
int immval = 0;
bfd_boolean immfound = FALSE;
bfd_boolean immfound = false;
static bfd_vma prev_insn_addr = -1; /*init the prev insn addr */
static int prev_insn_vma = -1; /*init the prev insn vma */
int curr_insn_vma = info->buffer_vma;
@@ -804,9 +551,8 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
info->bytes_per_chunk = 4;
inst = read_insn_microblaze (memaddr, info, &op);
if (inst == 0) {
if (inst == 0)
return -1;
}
if (prev_insn_vma == curr_insn_vma) {
if (memaddr-(info->bytes_per_chunk) == prev_insn_addr) {
@@ -815,11 +561,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
return -1;
if (pop->instr == imm) {
immval = (get_int_field_imm(prev_inst) << 16) & 0xffff0000;
immfound = TRUE;
immfound = true;
}
else {
immval = 0;
immfound = FALSE;
immfound = false;
}
}
}
@@ -827,9 +573,8 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
prev_insn_addr = memaddr;
prev_insn_vma = curr_insn_vma;
if (op->name == 0) {
if (op->name == 0)
fprintf (stream, ".short 0x%04x", inst);
}
else
{
fprintf (stream, "%s", op->name);
@@ -858,11 +603,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
case INST_TYPE_RD_R1_IMM5:
fprintf(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm5(inst));
break;
case INST_TYPE_RD_RFSL:
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_rfsl(inst));
case INST_TYPE_RD_IMM12:
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_imm12(inst));
break;
case INST_TYPE_R1_RFSL:
fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_rfsl(inst));
case INST_TYPE_R1_IMM12:
fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_imm12(inst));
break;
case INST_TYPE_RD_SPECIAL:
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_special(inst, op));
@@ -949,16 +694,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
case INST_TYPE_RD_R1_SPECIAL:
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst));
break;
case INST_TYPE_RD_IMM15:
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_imm15(inst));
case INST_TYPE_RD_IMM14:
fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_imm14(inst));
break;
/* For tuqula instruction */
case INST_TYPE_RD:
fprintf(stream, "\t%s", get_field_rd(inst));
break;
case INST_TYPE_RFSL:
fprintf(stream, "\t%s", get_field_rfsl(inst));
break;
default:
/* if the disassembler lags the instruction set */
fprintf (stream, "\tundecoded operands, inst is 0x%04x", inst);
@@ -970,14 +713,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
return 4;
}
enum microblaze_instr
get_insn_microblaze (long inst,
bfd_boolean *isunsignedimm,
enum microblaze_instr_type *insn_type,
short *delay_slots)
#if 0
static enum microblaze_instr
get_insn_microblaze (long inst, boolean *isunsignedimm,
enum microblaze_instr_type *insn_type,
short *delay_slots )
{
struct op_code_struct * op;
*isunsignedimm = FALSE;
*isunsignedimm = false;
/* Just a linear search of the table. */
for (op = opcodes; op->name != 0; op ++)
@@ -993,11 +736,13 @@ get_insn_microblaze (long inst,
return op->instr;
}
}
#endif
short
get_delay_slots_microblaze (long inst)
#if 0
static short
get_delay_slots_microblaze ( long inst )
{
bfd_boolean isunsignedimm;
boolean isunsignedimm;
enum microblaze_instr_type insn_type;
enum microblaze_instr op;
short delay_slots;
@@ -1008,16 +753,14 @@ get_delay_slots_microblaze (long inst)
else
return delay_slots;
}
#endif
enum microblaze_instr
microblaze_decode_insn (long insn,
int *rd,
int *ra,
int *rb,
int *imm)
#if 0
static enum microblaze_instr
microblaze_decode_insn (long insn, int *rd, int *ra, int *rb, int *imm)
{
enum microblaze_instr op;
bfd_boolean t1;
boolean t1;
enum microblaze_instr_type t2;
short t3;
@@ -1029,42 +772,40 @@ microblaze_decode_insn (long insn,
*imm = (int) t3;
return (op);
}
#endif
unsigned long
microblaze_get_target_address (long inst,
bfd_boolean immfound,
int immval,
long pcval,
long r1val,
long r2val,
bfd_boolean *targetvalid,
bfd_boolean *unconditionalbranch)
#if 0
static unsigned long
microblaze_get_target_address (long inst, boolean immfound, int immval,
long pcval, long r1val, long r2val,
boolean *targetvalid,
boolean *unconditionalbranch)
{
struct op_code_struct * op;
long targetaddr = 0;
*unconditionalbranch = FALSE;
*unconditionalbranch = false;
/* Just a linear search of the table. */
for (op = opcodes; op->name != 0; op ++)
if (op->bit_sequence == (inst & op->opcode_mask))
break;
if (op->name == 0) {
*targetvalid = FALSE;
*targetvalid = false;
} else if (op->instr_type == branch_inst) {
switch (op->inst_type) {
case INST_TYPE_R2:
*unconditionalbranch = TRUE;
*unconditionalbranch = true;
/* fallthru */
case INST_TYPE_RD_R2:
case INST_TYPE_R1_R2:
targetaddr = r2val;
*targetvalid = TRUE;
*targetvalid = true;
if (op->inst_offset_type == INST_PC_OFFSET)
targetaddr += pcval;
break;
case INST_TYPE_IMM:
*unconditionalbranch = TRUE;
*unconditionalbranch = true;
/* fallthru */
case INST_TYPE_RD_IMM:
case INST_TYPE_R1_IMM:
@@ -1078,10 +819,10 @@ microblaze_get_target_address (long inst,
}
if (op->inst_offset_type == INST_PC_OFFSET)
targetaddr += pcval;
*targetvalid = TRUE;
*targetvalid = true;
break;
default:
*targetvalid = FALSE;
*targetvalid = false;
break;
}
} else if (op->instr_type == return_inst) {
@@ -1094,9 +835,10 @@ microblaze_get_target_address (long inst,
targetaddr |= 0xFFFF0000;
}
targetaddr += r1val;
*targetvalid = TRUE;
*targetvalid = true;
} else {
*targetvalid = FALSE;
*targetvalid = false;
}
return targetaddr;
}
#endif
+1
View File
@@ -283,6 +283,7 @@ static void monitor_protocol_emitter(Monitor *mon, QObject *data)
if (!monitor_has_error(mon)) {
/* success response */
if (data) {
assert(qobject_type(data) == QTYPE_QDICT);
qobject_incref(data);
qdict_put_obj(qmp, "return", data);
} else {
-3
View File
@@ -1,7 +1,6 @@
#ifndef QEMU_NET_H
#define QEMU_NET_H
#include <stdbool.h>
#include "qemu-queue.h"
#include "qemu-common.h"
#include "qdict.h"
@@ -37,7 +36,6 @@ typedef enum {
NET_CLIENT_TYPE_DUMP
} net_client_type;
typedef void (NetPoll)(VLANClientState *, bool enable);
typedef int (NetCanReceive)(VLANClientState *);
typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t);
typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int);
@@ -53,7 +51,6 @@ typedef struct NetClientInfo {
NetCanReceive *can_receive;
NetCleanup *cleanup;
LinkStatusChanged *link_status_changed;
NetPoll *poll;
} NetClientInfo;
struct VLANClientState {
-1
View File
@@ -23,7 +23,6 @@
*/
#include "net/tap.h"
#include "sysemu.h"
#include <sys/stat.h>
#include <sys/ethernet.h>
-8
View File
@@ -262,13 +262,6 @@ static void tap_cleanup(VLANClientState *nc)
close(s->fd);
}
static void tap_poll(VLANClientState *nc, bool enable)
{
TAPState *s = DO_UPCAST(TAPState, nc, nc);
tap_read_poll(s, enable);
tap_write_poll(s, enable);
}
/* fd support */
static NetClientInfo net_tap_info = {
@@ -277,7 +270,6 @@ static NetClientInfo net_tap_info = {
.receive = tap_receive,
.receive_raw = tap_receive_raw,
.receive_iov = tap_receive_iov,
.poll = tap_poll,
.cleanup = tap_cleanup,
};
+11 -2
View File
@@ -133,16 +133,25 @@ int qemu_create_pidfile(const char *filename)
return -1;
#else
HANDLE file;
DWORD flags;
OVERLAPPED overlap;
BOOL ret;
memset(&overlap, 0, sizeof(overlap));
file = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL,
/* Open for writing with no sharing. */
file = CreateFile(filename, GENERIC_WRITE, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (file == INVALID_HANDLE_VALUE)
return -1;
flags = LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY;
overlap.hEvent = 0;
/* Lock 1 byte. */
ret = LockFileEx(file, flags, 0, 0, 1, &overlap);
if (ret == 0)
return -1;
/* Write PID to file. */
len = snprintf(buffer, sizeof(buffer), "%ld\n", (long)getpid());
ret = WriteFileEx(file, (LPCVOID)buffer, (DWORD)len,
&overlap, NULL);
+1 -4
View File
@@ -46,10 +46,7 @@ static struct pathelem *new_entry(const char *root,
{
struct pathelem *new = malloc(sizeof(*new));
new->name = strdup(name);
if (asprintf(&new->pathname, "%s/%s", root, name) == -1) {
printf("Cannot allocate memory\n");
exit(1);
}
asprintf(&new->pathname, "%s/%s", root, name);
new->num_entries = 0;
return new;
}
+2 -3
View File
@@ -13,9 +13,8 @@
- OpenBIOS (http://www.openbios.org/) is a free (GPL v2) portable
firmware implementation. The goal is to implement a 100% IEEE
1275-1994 (referred to as Open Firmware) compliant firmware.
The included images for Sparc32 and PowerPC (for 32 and 64 bit
PPC CPUs) are built from OpenBIOS SVN revision 640, Sparc64 image
from r649.
The included images for Sparc32, Sparc64 and PowerPC (for 32 and 64 bit
PPC CPUs) are built from OpenBIOS SVN revision 569.
- The PXE roms come from Rom-o-Matic gPXE 0.9.9 with BANNER_TIMEOUT=0
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -2
View File
@@ -5,8 +5,7 @@ all: build-all
include ../../config-host.mak
include $(SRC_PATH)/rules.mak
$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
VPATH=$(SRC_PATH)/pc-bios/optionrom
.PHONY : all clean build-all
CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
+2 -3
View File
@@ -86,10 +86,9 @@ copy_kernel:
/* Now create the GDT descriptor */
movw $((3 * 8) - 1), -16(%bp)
mov %cs, %eax
movzwl %ax, %eax
shl $4, %eax
addl $gdt, %eax
movl %eax, -14(%bp)
addl $gdt, %ebx
movl %ebx, -14(%bp)
/* And load the GDT */
data32 lgdt -16(%bp)
-3
View File
@@ -34,9 +34,6 @@ if [ $cpu != "i386" ] ; then
echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "alpha" ] ; then
echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-alpha:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "arm" ] ; then
echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
+2 -11
View File
@@ -1659,17 +1659,8 @@ LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
PL181 MultiMedia Card Interface with SD card.
@end itemize
Several variants of the ARM RealView baseboard are emulated,
including the EB, PB-A8 and PBX-A9. Due to interactions with the
bootloader, only certain Linux kernel configurations work out
of the box on these boards.
Kernels for the PB-A8 board should have CONFIG_REALVIEW_HIGH_PHYS_OFFSET
enabled in the kernel, and expect 512M RAM. Kernels for The PBX-A9 board
should have CONFIG_SPARSEMEM enabled, CONFIG_REALVIEW_HIGH_PHYS_OFFSET
disabled and expect 1024M RAM.
The following devices are emuilated:
The ARM RealView Emulation/Platform baseboard is emulated with the following
devices:
@itemize @minus
@item
+3 -5
View File
@@ -492,8 +492,7 @@ readv_f(int argc, char **argv)
int c, cnt;
char *buf;
int64_t offset;
/* Some compilers get confused and warn if this is not initialized. */
int total = 0;
int total;
int nr_iov;
QEMUIOVector qiov;
int pattern = 0;
@@ -748,8 +747,7 @@ writev_f(int argc, char **argv)
int c, cnt;
char *buf;
int64_t offset;
/* Some compilers get confused and warn if this is not initialized. */
int total = 0;
int total;
int nr_iov;
int pattern = 0xcd;
QEMUIOVector qiov;
@@ -1419,7 +1417,7 @@ int main(int argc, char **argv)
int readonly = 0;
int growable = 0;
const char *sopt = "hVc:Crsnmgk";
const struct option lopt[] = {
struct option lopt[] = {
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'V' },
{ "offset", 1, NULL, 'o' },
+1 -3
View File
@@ -30,7 +30,6 @@
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <signal.h>
#include <libgen.h>
#define SOCKET_PATH "/var/lock/qemu-nbd-%s"
@@ -353,8 +352,7 @@ int main(int argc, char **argv)
}
if (socket == NULL) {
snprintf(sockpath, sizeof(sockpath), SOCKET_PATH,
basename(device));
sprintf(sockpath, SOCKET_PATH, basename(device));
socket = sockpath;
}
+1 -12
View File
@@ -1598,17 +1598,6 @@ STEXI
Setup monitor on chardev @var{name}.
ETEXI
DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
"-debugcon dev redirect the debug console to char device 'dev'\n")
STEXI
@item -debugcon @var{dev}
Redirect the debug console to host device @var{dev} (same devices as the
serial port). The debug console is an I/O port which is typically port
0xe9; writing to that I/O port sends output to this device.
The default device is @code{vc} in graphical mode and @code{stdio} in
non graphical mode.
ETEXI
DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
"-pidfile file write PID to 'file'\n")
STEXI
@@ -1947,4 +1936,4 @@ DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
"-readconfig <file>\n")
DEF("writeconfig", HAS_ARG, QEMU_OPTION_writeconfig,
"-writeconfig <file>\n"
" read/write config file\n")
" read/write config file")
+2 -5
View File
@@ -14,7 +14,7 @@ MAKEFLAGS += -rR
# Flags for dependency generation
QEMU_DGFLAGS += -MMD -MP -MT $@
%.o: %.c
%.o: %.c $(GENERATED_HEADERS)
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")
%.o: %.S
@@ -23,7 +23,7 @@ QEMU_DGFLAGS += -MMD -MP -MT $@
%.o: %.m
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@")
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS)," LINK $(TARGET_DIR)$@")
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS)," LINK $(TARGET_DIR)$@")
%$(EXESUF): %.o
$(call LINK,$^)
@@ -39,9 +39,6 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
>/dev/null 2>&1 && echo OK), $2, $3)
VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.texi
set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES), $(eval vpath $(PATTERN) $1)))
# Generate timestamp files for .h include files
%.h: %.h-timestamp
+2 -1
View File
@@ -339,7 +339,8 @@ static int file_put_buffer(void *opaque, const uint8_t *buf,
{
QEMUFileStdio *s = opaque;
fseek(s->stdio_file, pos, SEEK_SET);
return fwrite(buf, 1, size, s->stdio_file);
fwrite(buf, 1, size, s->stdio_file);
return size;
}
static int file_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
+1 -2
View File
@@ -849,8 +849,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
if (SDL_Init (flags)) {
fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
SDL_GetError());
fprintf(stderr, "Could not initialize SDL - exiting\n");
exit(1);
}
vi = SDL_GetVideoInfo();
+7 -7
View File
@@ -91,7 +91,7 @@ struct ip {
u_int8_t ip_p; /* protocol */
u_int16_t ip_sum; /* checksum */
struct in_addr ip_src,ip_dst; /* source and dest address */
} __attribute__((packed));
};
#define IP_MAXPACKET 65535 /* maximum packet size */
@@ -153,7 +153,7 @@ struct ip_timestamp {
n_long ipt_time;
} ipt_ta[1];
} ipt_timestamp;
} __attribute__((packed));
};
/* flag bits for ipt_flg */
#define IPOPT_TS_TSONLY 0 /* timestamps only */
@@ -183,11 +183,11 @@ struct ip_timestamp {
struct mbuf_ptr {
struct mbuf *mptr;
uint32_t dummy;
} __attribute__((packed));
};
#else
struct mbuf_ptr {
struct mbuf *mptr;
} __attribute__((packed));
};
#endif
struct qlink {
void *next, *prev;
@@ -219,7 +219,7 @@ struct ipq {
u_int8_t ipq_p; /* protocol of this fragment */
u_int16_t ipq_id; /* sequence id for reassembly */
struct in_addr ipq_src,ipq_dst;
} __attribute__((packed));
};
/*
* Ip header, when holding a fragment.
@@ -229,7 +229,7 @@ struct ipq {
struct ipasfrag {
struct qlink ipf_link;
struct ip ipf_ip;
} __attribute__((packed));
};
#define ipf_off ipf_ip.ip_off
#define ipf_tos ipf_ip.ip_tos
@@ -248,6 +248,6 @@ struct ipasfrag {
struct ipoption {
struct in_addr ipopt_dst; /* first-hop dst if source routed */
int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
} __attribute__((packed));
};
#endif
Loaded 100 of 127 files, more files were not shown because too many files have changed in this diff. Show more