ソースを参照

[efi] Make EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL optional

Some UEFI systems (observed with a Hyper-V virtual machine) do not
provide EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.  Make this an optional
protocol (and fail any attempts to access PCI configuration space via
the root bridge if the protocol is missing).

Reported-by: Colin Blacker <Colin.Blacker@computerplanet.co.uk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9年前
コミット
3bb910caa8
1個のファイルの変更7行の追加1行の削除
  1. 7
    1
      src/interface/efi/efi_pci.c

+ 7
- 1
src/interface/efi/efi_pci.c ファイルの表示

59
 
59
 
60
 /** PCI root bridge I/O protocol */
60
 /** PCI root bridge I/O protocol */
61
 static EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *efipci;
61
 static EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *efipci;
62
-EFI_REQUIRE_PROTOCOL ( EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL, &efipci );
62
+EFI_REQUEST_PROTOCOL ( EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL, &efipci );
63
 
63
 
64
 static unsigned long efipci_address ( struct pci_device *pci,
64
 static unsigned long efipci_address ( struct pci_device *pci,
65
 				      unsigned long location ) {
65
 				      unsigned long location ) {
74
 	EFI_STATUS efirc;
74
 	EFI_STATUS efirc;
75
 	int rc;
75
 	int rc;
76
 
76
 
77
+	if ( ! efipci )
78
+		return -ENOTSUP;
79
+
77
 	if ( ( efirc = efipci->Pci.Read ( efipci, EFIPCI_WIDTH ( location ),
80
 	if ( ( efirc = efipci->Pci.Read ( efipci, EFIPCI_WIDTH ( location ),
78
 					  efipci_address ( pci, location ), 1,
81
 					  efipci_address ( pci, location ), 1,
79
 					  value ) ) != 0 ) {
82
 					  value ) ) != 0 ) {
92
 	EFI_STATUS efirc;
95
 	EFI_STATUS efirc;
93
 	int rc;
96
 	int rc;
94
 
97
 
98
+	if ( ! efipci )
99
+		return -ENOTSUP;
100
+
95
 	if ( ( efirc = efipci->Pci.Write ( efipci, EFIPCI_WIDTH ( location ),
101
 	if ( ( efirc = efipci->Pci.Write ( efipci, EFIPCI_WIDTH ( location ),
96
 					   efipci_address ( pci, location ), 1,
102
 					   efipci_address ( pci, location ), 1,
97
 					   &value ) ) != 0 ) {
103
 					   &value ) ) != 0 ) {

読み込み中…
キャンセル
保存