X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=OvmfPkg%2FXenBusDxe%2FXenBus.c;h=bb8ddbc4d44da4f07ab6f67f22faccef12948d6e;hb=b0663641c977f97bef785c86978603c3a31a3d1c;hp=896a6607b73fce0d21225dbb7c585337721034b9;hpb=e86895d9e489dafe904622867b197acff6ef4355;p=mirror_edk2.git diff --git a/OvmfPkg/XenBusDxe/XenBus.c b/OvmfPkg/XenBusDxe/XenBus.c index 896a6607b7..bb8ddbc4d4 100644 --- a/OvmfPkg/XenBusDxe/XenBus.c +++ b/OvmfPkg/XenBusDxe/XenBus.c @@ -14,23 +14,7 @@ This file may be distributed separately from the Linux kernel, or incorporated into other software packages, subject to the following license: - Permission is hereby granted, free of charge, to any person obtaining a copy - of this source file (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. + SPDX-License-Identifier: MIT **/ #include @@ -45,13 +29,19 @@ STATIC XENBUS_PRIVATE_DATA gXenBusPrivateData; STATIC XENBUS_DEVICE_PATH gXenBusDevicePathTemplate = { - .Vendor.Header.Type = HARDWARE_DEVICE_PATH, - .Vendor.Header.SubType = HW_VENDOR_DP, - .Vendor.Header.Length[0] = (UINT8) sizeof (XENBUS_DEVICE_PATH), - .Vendor.Header.Length[1] = (UINT8) (sizeof (XENBUS_DEVICE_PATH) >> 8), - .Vendor.Guid = XENBUS_PROTOCOL_GUID, - .Type = 0, - .DeviceId = 0 + { // Vendor + { // Vendor.Header + HARDWARE_DEVICE_PATH, // Vendor.Header.Type + HW_VENDOR_DP, // Vendor.Header.SubType + { + (UINT8) (sizeof (XENBUS_DEVICE_PATH)), // Vendor.Header.Length[0] + (UINT8) (sizeof (XENBUS_DEVICE_PATH) >> 8), // Vendor.Header.Length[1] + } + }, + XENBUS_PROTOCOL_GUID, // Vendor.Guid + }, + 0, // Type + 0 // DeviceId }; @@ -132,7 +122,7 @@ XenBusAddDevice ( XENBUS_PRIVATE_DATA *Private; EFI_STATUS Status; XENBUS_DEVICE_PATH *TempXenBusPath; - VOID *ChildPciIo; + VOID *ChildXenIo; AsciiSPrint (DevicePath, sizeof (DevicePath), "device/%a/%a", Type, Id); @@ -176,7 +166,7 @@ XenBusAddDevice ( Private->XenBusIo.Type = AsciiStrDup (Type); Private->XenBusIo.Node = AsciiStrDup (DevicePath); Private->XenBusIo.Backend = BackendPath; - Private->XenBusIo.DeviceId = AsciiStrDecimalToUintn (Id); + Private->XenBusIo.DeviceId = (UINT16)AsciiStrDecimalToUintn (Id); Private->Dev = Dev; TempXenBusPath = AllocateCopyPool (sizeof (XENBUS_DEVICE_PATH), @@ -202,8 +192,8 @@ XenBusAddDevice ( } Status = gBS->OpenProtocol (Dev->ControllerHandle, - &gEfiPciIoProtocolGuid, - &ChildPciIo, Dev->This->DriverBindingHandle, + &gXenIoProtocolGuid, + &ChildXenIo, Dev->This->DriverBindingHandle, Private->Handle, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER); if (EFI_ERROR (Status)) { @@ -268,7 +258,7 @@ XenBusEnumerateDeviceType ( XenBusAddDevice (Dev, Type, Directory[Index]); } - FreePool (Directory); + FreePool ((VOID*)Directory); } @@ -304,7 +294,7 @@ XenBusEnumerateBus ( XenBusEnumerateDeviceType (Dev, Types[Index]); } - FreePool (Types); + FreePool ((VOID*)Types); return XENSTORE_STATUS_SUCCESS; } @@ -314,7 +304,7 @@ XENSTORE_STATUS EFIAPI XenBusSetState ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN enum xenbus_state NewState ) { @@ -348,28 +338,33 @@ Out: } STATIC XENBUS_PRIVATE_DATA gXenBusPrivateData = { - .Signature = XENBUS_PRIVATE_DATA_SIGNATURE, - - .XenBusIo.XsRead = XenBusXenStoreRead, - .XenBusIo.XsBackendRead = XenBusXenStoreBackendRead, - .XenBusIo.XsPrintf = XenBusXenStoreSPrint, - .XenBusIo.XsRemove = XenBusXenStoreRemove, - .XenBusIo.XsTransactionStart = XenBusXenStoreTransactionStart, - .XenBusIo.XsTransactionEnd = XenBusXenStoreTransactionEnd, - .XenBusIo.SetState = XenBusSetState, - .XenBusIo.GrantAccess = XenBusGrantAccess, - .XenBusIo.GrantEndAccess = XenBusGrantEndAccess, - .XenBusIo.EventChannelAllocate = XenBusEventChannelAllocate, - .XenBusIo.EventChannelNotify = XenBusEventChannelNotify, - .XenBusIo.EventChannelClose = XenBusEventChannelClose, - .XenBusIo.RegisterWatch = XenBusRegisterWatch, - .XenBusIo.RegisterWatchBackend = XenBusRegisterWatchBackend, - .XenBusIo.UnregisterWatch = XenBusUnregisterWatch, - .XenBusIo.WaitForWatch = XenBusWaitForWatch, - - .XenBusIo.Type = NULL, - .XenBusIo.Node = NULL, - .XenBusIo.Backend = NULL, - - .Dev = NULL + XENBUS_PRIVATE_DATA_SIGNATURE, // Signature + { NULL, NULL }, // Link + NULL, // Handle + { // XenBusIo + XenBusXenStoreRead, // XenBusIo.XsRead + XenBusXenStoreBackendRead, // XenBusIo.XsBackendRead + XenBusXenStoreSPrint, // XenBusIo.XsPrintf + XenBusXenStoreRemove, // XenBusIo.XsRemove + XenBusXenStoreTransactionStart, // XenBusIo.XsTransactionStart + XenBusXenStoreTransactionEnd, // XenBusIo.XsTransactionEnd + XenBusSetState, // XenBusIo.SetState + XenBusGrantAccess, // XenBusIo.GrantAccess + XenBusGrantEndAccess, // XenBusIo.GrantEndAccess + XenBusEventChannelAllocate, // XenBusIo.EventChannelAllocate + XenBusEventChannelNotify, // XenBusIo.EventChannelNotify + XenBusEventChannelClose, // XenBusIo.EventChannelClose + XenBusRegisterWatch, // XenBusIo.RegisterWatch + XenBusRegisterWatchBackend, // XenBusIo.RegisterWatchBackend + XenBusUnregisterWatch, // XenBusIo.UnregisterWatch + XenBusWaitForWatch, // XenBusIo.WaitForWatch + + NULL, // XenBusIo.Type + 0, // XenBusIo.DeviceId + NULL, // XenBusIo.Node + NULL, // XenBusIo.Backend + }, + + NULL, // Dev + NULL // DevicePath };