Browse Source

[bofm] Pass BOFM version 2 table to SetStatus() if applicable

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
e58e4238b6
1 changed files with 29 additions and 10 deletions
  1. 29
    10
      src/interface/efi/efi_bofm.c

+ 29
- 10
src/interface/efi/efi_bofm.c View File

@@ -97,6 +97,9 @@ typedef struct {
97 97
 typedef struct _IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL
98 98
 	IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL;
99 99
 
100
+typedef struct _IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2
101
+	IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2;
102
+
100 103
 typedef EFI_STATUS ( EFIAPI *IBM_BOFM_DRIVER_CONFIGURATION_SUPPORT ) (
101 104
 	IN IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL *This,
102 105
 	EFI_HANDLE ControllerHandle,
@@ -112,20 +115,27 @@ typedef EFI_STATUS ( EFIAPI *IBM_BOFM_DRIVER_CONFIGURATION_STATUS ) (
112 115
 	UINT8 BOFMReturnCode
113 116
 );
114 117
 
118
+typedef EFI_STATUS ( EFIAPI *IBM_BOFM_DRIVER_CONFIGURATION_STATUS2 ) (
119
+	IN IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2 *This,
120
+	EFI_HANDLE ControllerHandle,
121
+	BOOLEAN ResetRequired,
122
+	UINT8 BOFMReturnCode
123
+);
124
+
115 125
 struct _IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL {
116 126
 	IBM_BOFM_TABLE BofmTable;
117 127
 	IBM_BOFM_DRIVER_CONFIGURATION_STATUS SetStatus;
118 128
 	IBM_BOFM_DRIVER_CONFIGURATION_SUPPORT RegisterSupport;
119 129
 };
120 130
 
121
-typedef struct _IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2 {
131
+struct _IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2 {
122 132
 	UINT32 Signature;
123 133
 	UINT32 Reserved1;
124 134
 	UINT64 Reserved2;
125
-	IBM_BOFM_DRIVER_CONFIGURATION_STATUS SetStatus;
135
+	IBM_BOFM_DRIVER_CONFIGURATION_STATUS2 SetStatus;
126 136
 	IBM_BOFM_DRIVER_CONFIGURATION_SUPPORT RegisterSupport;
127 137
 	IBM_BOFM_TABLE BofmTable;
128
-} IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2;
138
+};
129 139
 
130 140
 /***************************************************************************
131 141
  *
@@ -280,7 +290,6 @@ static EFI_STATUS EFIAPI efi_bofm_start ( EFI_DRIVER_BINDING_PROTOCOL *driver,
280 290
 		       bofmtab2->Parameters.Length );
281 291
 		assert ( bofm2.bofm2->RegisterSupport ==
282 292
 			 bofm1.bofm1->RegisterSupport );
283
-		assert ( bofm2.bofm2->SetStatus == bofm1.bofm1->SetStatus );
284 293
 	} else {
285 294
 		DBGC ( efidrv, "EFIBOFM " PCI_FMT " cannot find BOFM2 "
286 295
 		       "protocol\n", PCI_ARGS ( &efipci->pci ) );
@@ -311,12 +320,22 @@ static EFI_STATUS EFIAPI efi_bofm_start ( EFI_DRIVER_BINDING_PROTOCOL *driver,
311 320
 	}
312 321
 
313 322
 	/* Return BOFM status */
314
-	if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device, FALSE,
315
-						bofmrc ) ) != 0 ) {
316
-		DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not set BOFM status: "
317
-		       "%s\n", PCI_ARGS ( &efipci->pci ),
318
-		       efi_strerror ( efirc ) );
319
-		goto err_set_status;
323
+	if ( bofmtab2 ) {
324
+		if ( ( efirc = bofm2.bofm2->SetStatus ( bofm2.bofm2, device,
325
+							FALSE, bofmrc ) ) != 0){
326
+			DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not set "
327
+			       "BOFM2 status: %s\n", PCI_ARGS ( &efipci->pci ),
328
+			       efi_strerror ( efirc ) );
329
+			goto err_set_status;
330
+		}
331
+	} else {
332
+		if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device,
333
+							FALSE, bofmrc ) ) != 0){
334
+			DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not set "
335
+			       "BOFM status: %s\n", PCI_ARGS ( &efipci->pci ),
336
+			       efi_strerror ( efirc ) );
337
+			goto err_set_status;
338
+		}
320 339
 	}
321 340
 
322 341
 	/* Destroy the PCI device anyway; we have no further use for it */

Loading…
Cancel
Save