VirtualBox

Ignore:
Timestamp:
Mar 12, 2019 12:40:12 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129295
Message:

EFI: First step in UDK2018 merge. Does not build yet.

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf

    r58466 r77662  
    55#  This library assumes there are no chipset dependencies required to maintain caches.
    66#
    7 #  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
     7#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
    88#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
    99#
     
    2424  FILE_GUID                      = 123dd843-57c9-4158-8418-ce68b3944ce7
    2525  MODULE_TYPE                    = BASE
    26   VERSION_STRING                 = 1.0
     26  VERSION_STRING                 = 1.1
    2727  LIBRARY_CLASS                  = CacheMaintenanceLib
    2828
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.uni

    r58464 r77662  
    1 // /** @file
     1// /** @file
    22// Instance of Cache Maintenance Library using Base Library services.
    33//
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c

    r58466 r77662  
    22  Cache Maintenance Functions.
    33
    4   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    1717#include <Library/BaseLib.h>
    1818#include <Library/DebugLib.h>
    19 
    20 //
    21 // This size must be at or below the smallest cache size possible among all
    22 // supported processors
    23 //
    24 #define CACHE_LINE_SIZE             0x20
    2519
    2620/**
     
    129123  )
    130124{
     125  UINT32                            RegEbx;
     126  UINT32                            RegEdx;
     127  UINTN                             CacheLineSize;
    131128  UINTN                             Start;
    132129  UINTN                             End;
     
    138135  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Address));
    139136
     137  //
     138  // If the CPU does not support CLFLUSH instruction,
     139  // then promote flush range to flush entire cache.
     140  //
     141  AsmCpuid (0x01, NULL, &RegEbx, NULL, &RegEdx);
     142  if ((RegEdx & BIT19) == 0) {
     143    AsmWbinvd ();
     144    return Address;
     145  }
     146
     147  //
     148  // Cache line size is 8 * Bits 15-08 of EBX returned from CPUID 01H
     149  //
     150  CacheLineSize = (RegEbx & 0xff00) >> 5;
     151
    140152  Start = (UINTN)Address;
    141153  //
    142154  // Calculate the cache line alignment
    143155  //
    144   End = (Start + Length + (CACHE_LINE_SIZE - 1)) & ~(CACHE_LINE_SIZE - 1);
    145   Start &= ~((UINTN) CACHE_LINE_SIZE - 1);
     156  End = (Start + Length + (CacheLineSize - 1)) & ~(CacheLineSize - 1);
     157  Start &= ~((UINTN)CacheLineSize - 1);
    146158
    147159  do {
    148     Start = (UINTN)AsmFlushCacheLine ((VOID*)Start) + CACHE_LINE_SIZE;
     160    Start = (UINTN)AsmFlushCacheLine ((VOID*)Start) + CacheLineSize;
    149161  } while (Start != End);
    150162  return Address;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette