Skip to contentSkip to conversation

x86/EFI: simplify PCI option retrieval

PATCH New Jan Beulich 1 participant 1 message Jan 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/EFI: simplify PCI option retrieval

While putting together the kernel side of this I realized that c/s 26397:d9c7b82aa7b1 went a little too far in requiring a buffer for the option ROM contents - all that is really needed is handing Dom0 physical address and size of the data block.

xen/arch/x86/efi/runtime.c +2 -9
@@ -189,16 +189,9 @@ int efi_get_info(uint32_t idx, union xen
                  info->pci_rom.vendor == ent->vendor &&
                  info->pci_rom.devid == ent->devid )
             {
-                int rc = 0;
-
-                if ( info->pci_rom.size < ent->size )
-                    rc = -ENOSPC;
-                else if ( copy_to_guest(info->pci_rom.data,
-                                        ent->data, ent->size) )
-                    rc = -EFAULT;
+                info->pci_rom.address = __pa(ent->data);
                 info->pci_rom.size = ent->size;
-
-                return rc;
+                return 0;
             }
         return -ESRCH;
     }
xen/include/public/platform.h +2 -2
@@ -274,9 +274,9 @@ struct xenpf_firmware_info {
                 uint8_t devfn;
                 uint16_t vendor;
                 uint16_t devid;
-                /* IN/OUT variables */
+                /* OUT variables */
+                uint64_t address;
                 xen_ulong_t size;
-                XEN_GUEST_HANDLE(void) data;
             } pci_rom;
         } efi_info; /* XEN_FW_EFI_INFO */
 

x86/EFI: simplify PCI option retrieval

While putting together the kernel side of this I realized that c/s 26397:d9c7b82aa7b1 went a little too far in requiring a buffer for the option ROM contents - all that is really needed is handing Dom0 physical address and size of the data block.

xen/arch/x86/efi/runtime.c +2 -9
@@ -189,16 +189,9 @@ int efi_get_info(uint32_t idx, union xen
                  info->pci_rom.vendor == ent->vendor &&
                  info->pci_rom.devid == ent->devid )
             {
-                int rc = 0;
-
-                if ( info->pci_rom.size < ent->size )
-                    rc = -ENOSPC;
-                else if ( copy_to_guest(info->pci_rom.data,
-                                        ent->data, ent->size) )
-                    rc = -EFAULT;
+                info->pci_rom.address = __pa(ent->data);
                 info->pci_rom.size = ent->size;
-
-                return rc;
+                return 0;
             }
         return -ESRCH;
     }
xen/include/public/platform.h +2 -2
@@ -274,9 +274,9 @@ struct xenpf_firmware_info {
                 uint8_t devfn;
                 uint16_t vendor;
                 uint16_t devid;
-                /* IN/OUT variables */
+                /* OUT variables */
+                uint64_t address;
                 xen_ulong_t size;
-                XEN_GUEST_HANDLE(void) data;
             } pci_rom;
         } efi_info; /* XEN_FW_EFI_INFO */
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel