Changeset 99404 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/CpuIoPei/CpuIoPei.c
- Timestamp:
- Apr 14, 2023 3:17:44 PM (23 months ago)
- svn:sync-xref-src-repo-rev:
- 156854
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-145445 /vendor/edk2/current 103735-103757,103769-103776,129194-156846
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/CpuIoPei/CpuIoPei.c
r80721 r99404 44 44 // PPI Descriptor used to install the CPU I/O PPI 45 45 // 46 EFI_PEI_PPI_DESCRIPTOR gPpiList = {46 EFI_PEI_PPI_DESCRIPTOR gPpiList = { 47 47 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), 48 48 &gEfiPeiCpuIoPpiInstalledGuid, … … 53 53 // Lookup table for increment values based on transfer widths 54 54 // 55 UINT8 mInStride[] = {55 UINT8 mInStride[] = { 56 56 1, // EfiPeiCpuIoWidthUint8 57 57 2, // EfiPeiCpuIoWidthUint16 … … 71 71 // Lookup table for increment values based on transfer widths 72 72 // 73 UINT8 mOutStride[] = {73 UINT8 mOutStride[] = { 74 74 1, // EfiPeiCpuIoWidthUint8 75 75 2, // EfiPeiCpuIoWidthUint16 … … 132 132 // so treat Count as 1 133 133 // 134 if ( Width >= EfiPeiCpuIoWidthFifoUint8 && Width <= EfiPeiCpuIoWidthFifoUint64) {134 if ((Width >= EfiPeiCpuIoWidthFifoUint8) && (Width <= EfiPeiCpuIoWidthFifoUint64)) { 135 135 Count = 1; 136 136 } … … 139 139 // Check to see if Width is in the valid range for I/O Port operations 140 140 // 141 Width = (EFI_PEI_CPU_IO_PPI_WIDTH) 141 Width = (EFI_PEI_CPU_IO_PPI_WIDTH)(Width & 0x03); 142 142 if (!MmioOperation && (Width == EfiPeiCpuIoWidthUint64)) { 143 143 return EFI_INVALID_PARAMETER; … … 169 169 return EFI_UNSUPPORTED; 170 170 } 171 171 172 if (Address > LShiftU64 (MaxCount - Count + 1, Width)) { 172 173 return EFI_UNSUPPORTED; … … 221 222 // Select loop based on the width of the transfer 222 223 // 223 InStride = mInStride[Width];224 OutStride = mOutStride[Width];225 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) 226 Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00);224 InStride = mInStride[Width]; 225 OutStride = mOutStride[Width]; 226 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH)(Width & 0x03); 227 Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00); 227 228 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) { 228 229 if (OperationWidth == EfiPeiCpuIoWidthUint8) { … … 248 249 } 249 250 } 251 250 252 return EFI_SUCCESS; 251 253 } … … 295 297 // Select loop based on the width of the transfer 296 298 // 297 InStride = mInStride[Width];298 OutStride = mOutStride[Width];299 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) 300 Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00);299 InStride = mInStride[Width]; 300 OutStride = mOutStride[Width]; 301 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH)(Width & 0x03); 302 Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00); 301 303 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) { 302 304 if (OperationWidth == EfiPeiCpuIoWidthUint8) { … … 322 324 } 323 325 } 326 324 327 return EFI_SUCCESS; 325 328 } … … 369 372 // Select loop based on the width of the transfer 370 373 // 371 InStride = mInStride[Width];372 OutStride = mOutStride[Width];373 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) 374 InStride = mInStride[Width]; 375 OutStride = mOutStride[Width]; 376 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH)(Width & 0x03); 374 377 375 378 // … … 378 381 if (InStride == 0) { 379 382 switch (OperationWidth) { 380 case EfiPeiCpuIoWidthUint8:381 IoReadFifo8 ((UINTN)Address, Count, Buffer);382 return EFI_SUCCESS;383 case EfiPeiCpuIoWidthUint16:384 IoReadFifo16 ((UINTN)Address, Count, Buffer);385 return EFI_SUCCESS;386 case EfiPeiCpuIoWidthUint32:387 IoReadFifo32 ((UINTN)Address, Count, Buffer);388 return EFI_SUCCESS;389 default:390 //391 // The CpuIoCheckParameter call above will ensure that this392 // path is not taken.393 //394 ASSERT (FALSE);395 break;383 case EfiPeiCpuIoWidthUint8: 384 IoReadFifo8 ((UINTN)Address, Count, Buffer); 385 return EFI_SUCCESS; 386 case EfiPeiCpuIoWidthUint16: 387 IoReadFifo16 ((UINTN)Address, Count, Buffer); 388 return EFI_SUCCESS; 389 case EfiPeiCpuIoWidthUint32: 390 IoReadFifo32 ((UINTN)Address, Count, Buffer); 391 return EFI_SUCCESS; 392 default: 393 // 394 // The CpuIoCheckParameter call above will ensure that this 395 // path is not taken. 396 // 397 ASSERT (FALSE); 398 break; 396 399 } 397 400 } … … 466 469 // Select loop based on the width of the transfer 467 470 // 468 InStride = mInStride[Width];469 OutStride = mOutStride[Width];470 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) 471 InStride = mInStride[Width]; 472 OutStride = mOutStride[Width]; 473 OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH)(Width & 0x03); 471 474 472 475 // … … 475 478 if (InStride == 0) { 476 479 switch (OperationWidth) { 477 case EfiPeiCpuIoWidthUint8:478 IoWriteFifo8 ((UINTN)Address, Count, Buffer);479 return EFI_SUCCESS;480 case EfiPeiCpuIoWidthUint16:481 IoWriteFifo16 ((UINTN)Address, Count, Buffer);482 return EFI_SUCCESS;483 case EfiPeiCpuIoWidthUint32:484 IoWriteFifo32 ((UINTN)Address, Count, Buffer);485 return EFI_SUCCESS;486 default:487 //488 // The CpuIoCheckParameter call above will ensure that this489 // path is not taken.490 //491 ASSERT (FALSE);492 break;480 case EfiPeiCpuIoWidthUint8: 481 IoWriteFifo8 ((UINTN)Address, Count, Buffer); 482 return EFI_SUCCESS; 483 case EfiPeiCpuIoWidthUint16: 484 IoWriteFifo16 ((UINTN)Address, Count, Buffer); 485 return EFI_SUCCESS; 486 case EfiPeiCpuIoWidthUint32: 487 IoWriteFifo32 ((UINTN)Address, Count, Buffer); 488 return EFI_SUCCESS; 489 default: 490 // 491 // The CpuIoCheckParameter call above will ensure that this 492 // path is not taken. 493 // 494 ASSERT (FALSE); 495 break; 493 496 } 494 497 } … … 573 576 EFIAPI 574 577 CpuIoRead32 ( 575 IN CONST EFI_PEI_SERVICES 576 IN CONST EFI_PEI_CPU_IO_PPI 577 IN UINT64 578 IN CONST EFI_PEI_SERVICES **PeiServices, 579 IN CONST EFI_PEI_CPU_IO_PPI *This, 580 IN UINT64 Address 578 581 ) 579 582 { … … 901 904 // Shadow completed and running from memory 902 905 // 903 DEBUG (( EFI_D_INFO, "CpuIO PPI has been loaded into memory. Reinstalled PPI=0x%x\n", &gCpuIoPpi));906 DEBUG ((DEBUG_INFO, "CpuIO PPI has been loaded into memory. Reinstalled PPI=0x%x\n", &gCpuIoPpi)); 904 907 } else { 905 908 Status = PeiServicesInstallPpi (&gPpiList);
Note:
See TracChangeset
for help on using the changeset viewer.