Commit Graph

19 Commits

Author SHA1 Message Date
Laszlo Ersek 2462bd3d85 OvmfPkg/XenBusDxe: eliminate AsciiStrCat() calls
AsciiStrCat() is deprecated / disabled under the
DISABLE_NEW_DEPRECATED_INTERFACES feature test macro.

Replace AsciiStrCat() with AsciiSPrint(). Spell out the (already existent)
PrintLib dependency in the INF file. Add an explicit ASSERT() to document
that XenStoreJoin() assumes that the pool allocation always succeeds.

Cc: Anthony PERARD <anthony.perard@citrix.com>
Cc: Gary Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=166
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Gary Lin <glin@suse.com>
Tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-25 10:46:14 +02:00
Ard Biesheuvel e482753b33 Ovmf/Xen: port XenBusDxe to other architectures
This patch updates XenBusDxe to use the 16-bit compare and exchange
function that was introduced for this purpose to the
BaseSynchronizationLib. It also provides a new generic implementation
of TestAndClearBit () using the same 16-bit compare and exchange, making
this module fully architecture agnostic.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16975 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-28 20:33:34 +00:00
Ard Biesheuvel d9fdfd851a Ovmf/Xen: move XenBusDxe to abstract XENIO_PROTOCOL
While Xen on Intel uses a virtual PCI device to communicate the
base address of the grant table, the ARM implementation uses a DT
node, which is fundamentally incompatible with the way XenBusDxe is
implemented, i.e., as a UEFI Driver Model implementation for a PCI
device.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16973 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-28 20:33:11 +00:00
Ard Biesheuvel cd8ff8fdda Ovmf/Xen: move XenBusDxe hypercall code to separate library
This moves all of the Xen hypercall code that was private to XenBusDxe
to a new library class XenHypercallLib. This will allow us to reimplement
it for ARM, and to export the Xen hypercall functionality to other parts
of the code, such as a Xen console SerialPortLib driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16970 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-28 20:32:39 +00:00
Anthony PERARD 6f6c3a1fb6 OvmfPkg XenBusDxe: Convert X64/TestAndClearBit.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/TestAndClearBit.asm to X64/TestAndClearBit.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16319 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-08 02:41:35 +00:00
Anthony PERARD 0ae9d5e88e OvmfPkg XenBusDxe: Convert X64/InterlockedCompareExchange16.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/InterlockedCompareExchange16.asm to X64/InterlockedCompareExchange16.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16318 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-08 02:41:28 +00:00
Anthony PERARD 60aafa1bde OvmfPkg XenBusDxe: Convert X64/hypercall.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/hypercall.asm to X64/hypercall.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16317 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-08 02:41:15 +00:00
Anthony PERARD 31c0aa2fd0 OvmfPkg XenBusDxe: Convert Ia32/TestAndClearBit.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
Ia32/TestAndClearBit.asm to Ia32/TestAndClearBit.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16316 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-08 02:41:07 +00:00
Anthony PERARD 09c3757bc4 OvmfPkg XenBusDxe: Convert Ia32/InterlockedCompareExchange16.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
Ia32/InterlockedCompareExchange16.asm to Ia32/InterlockedCompareExchange16.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16315 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-08 02:40:58 +00:00
Anthony PERARD 8e7ca01de0 OvmfPkg XenBusDxe: Convert Ia32/hypercall.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
Ia32/hypercall.asm to Ia32/hypercall.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16314 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-08 02:40:44 +00:00
Anthony PERARD 86d968e05e OvmfPkg/XenBusDxe: Introduce XenBus support itself.
This is a bus-like on top of XenStore. It will look for advertised
ParaVirtualized devices and initialize them by producing XenBus
protocol.

Change in V4:
- Replace the license by the commonly used file header text.
- Clean XenBus.h header (remove copyright that does not belong to the
  file anymore; and rewrite the brief description of the file)
- Fix description on the function

Change in V3:
- Insert to ChildList later, once populated.
- Remove XENBUS_XENSTORE_NODE macro.
- add comment to XenBusAddDevice and XenBusEnumerateBus about
  concurrency calls.
- Add a description to the introduced member to the protocol.

Change in V2:
- comment, file header
- Fix comment style
- Error handling in the main init function
- coding style
- Fix error path in add device.

Origin: FreeBSD 10.0
License: This patch adds XenBus.c which is under the MIT licence.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16270 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:51:18 +00:00
Anthony PERARD a9090a94bb OvmfPkg/XenBusDxe: Add XenStore client implementation
XenStore is a key/value database, which is running on another virtual
machine. It can be accessed through shared memory. This is a client
implementation.

Change in V3:
- moving xs_wire.h from patch #1 to this patch
- fix return value of XenStoreListDirectory
- Use a timeout to print a debug message if the other side of the
  xenstore ring does not notify through the event channel.
  This is done with the new XenStoreWaitForEvent function.
- Have XenStoreReadReply check status of XenStoreProcessMessage and
  return an error if needed.
- Have XenStoreTalkv return the status of XenStoreReadReply.
- Have a loop to check for the quiescent of the response ring in the
  XenStoreInitComms function. (with a timeout of 5 seconds)
- use the recently introduced XenStore 'closing' feature.

Change in V2:
- Change comment style, from freebsd to ovmf
- Fix type of EventChannel
- Fix debug print, no more cast
- Implement XenStoreDeinit.
- Clean up comments
- Fix few codding style issue
- Add FAIL xenstore status value.

Origin: FreeBSD 10.0
License: This patch adds several files under the MIT licence.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16267 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:50:50 +00:00
Anthony PERARD 6342f1fea8 OvmfPkg/XenBusDxe: Add TestAndClearBit.
This atomically test's and clear's a bit.

Change in V3:
- adding IA32 support. (not yet reviewed)
  both XenBusDxe/Ia32/TestAndClearBit.{S,asm} are new

Change in V2:
- Adding .asm version
- Comment the function

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16266 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:50:35 +00:00
Anthony PERARD f1259bba36 OvmfPkg/XenBusDxe: Add Event Channel Notify.
This first function is used to notify the other side that there is
something to do. The other side is another Xen domain.

Change in V4:
- Replace the license by the commonly used file header text.

Change in V3:
- Return error code from hypercall instead of ASSERT for
  XenEventChannelNotify
- moving event_channel.h to this patch.

Change in V2:
- file header
- coding style
- adding comment to functions
- Licenses

License: This patch adds event_channel.h which is under MIT licence.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16265 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:50:24 +00:00
Steven Smith 0fd142464f OvmfPkg/XenBusDxe: Add Grant Table functions.
There are used to grant access of pages to other Xen domains.

This code originaly comes from the Xen Project, and more precisely from
MiniOS.

Change in V4:
- Add license to GrantTable.h

Change in V3:
- Add a comment about the use of the BAR of the device.

Change in V2:
- Adding locks
- Redo the file header
- Add functions comment
- Add license

Signed-off-by: Steven Smith <sos22@cam.ac.uk>
Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16264 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:50:14 +00:00
Anthony PERARD bba9d16231 OvmfPkg/XenBusDxe: Add InterlockedCompareExchange16.
This patch is inspired by InterlockedCompareExchange32 from the
BaseSynchronizationLib.

The function will be used in the "OvmfPkg/XenBusDxe: Add Grant Table
functions" patch.

Change in V3:
- Implement both .S and .asm, to get rid of GCC specific asm.
- Implement 32bit part of the assembly

Change in V2:
- Add intel compilation code
  MSFT code is not compied over because I don't know how it works.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16263 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:49:55 +00:00
Anthony PERARD 12a16f2d1c OvmfPkg: Introduce XenBus Protocol.
This protocol will be used for communication between a PV driver (like a
PV block driver) and the XenBus/XenStore.

Change in V5:
- Replace the license by the commonly used file header text.

Change in V3:
- Add disclaimer about the volatile nature of the protocol.
- Add a description on the two introduced members to the protocol.

Change in V2:
- Comment, file header
- Protocol License
- Declare xen interface version earlier
- Rename protocol from Xenbus to XenBus

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16262 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:49:38 +00:00
Anthony PERARD abcbbb14a4 OvmfPkg/XenBusDxe: Add support to make Xen Hypercalls.
Change in V4:
- Replace the license by the commonly used file header text.
- add file header to XenHypercall.h (license, copyright, brief desc)

Change in V3:
- adding IA32 support. (not reviewed yet)
  both XenBusDxe/Ia32/hypercall.{S,asm} file are new

Change in V2:
- file header, copyright
- Add License
- Add push/pop instruction.
- fix types
- Comment of exported functions
- Improve coding style
- Add error handling in the main init function (of the drivers)
- Comment assembly

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16260 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:49:10 +00:00
Anthony PERARD e65e8802e5 OvmfPkg: Add basic skeleton for the XenBus bus driver.
This includes Component Name and Driver Binding.

Change in V4:
- Replace the license by the commonly used file header text.
- Add brief description for the driver.

Change in V3:
- enable compilation for Ia32 and Ia32X64
- fix version (driver binding)

Change in V2:
- Simple support of controller name.
- Cleaning up comments, files header.
- Add Licenses
- Rename XenbusDxe to XenBusDxe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16258 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-29 06:48:50 +00:00