TianoCore EDK2 master
Loading...
Searching...
No Matches
GrantTable.c File Reference
#include "XenBusDxe.h"
#include <IndustryStandard/Xen/memory.h>
#include <Library/XenHypercallLib.h>
#include <Library/SynchronizationLib.h>
#include "GrantTable.h"

Go to the source code of this file.

Macros

#define NR_RESERVED_ENTRIES   8
 
#define NR_GRANT_FRAMES   (FixedPcdGet32 (PcdXenGrantFrames))
 
#define NR_GRANT_ENTRIES   (NR_GRANT_FRAMES * EFI_PAGE_SIZE / sizeof(grant_entry_v1_t))
 

Functions

STATIC VOID XenGrantTablePutFreeEntry (grant_ref_t Ref)
 
STATIC grant_ref_t XenGrantTableGetFreeEntry (VOID)
 
STATIC grant_ref_t XenGrantTableGrantAccess (IN domid_t DomainId, IN UINTN Frame, IN BOOLEAN ReadOnly)
 
STATIC EFI_STATUS XenGrantTableEndAccess (grant_ref_t Ref)
 
VOID XenGrantTableInit (IN XENBUS_DEVICE *Dev)
 
VOID XenGrantTableDeinit (XENBUS_DEVICE *Dev)
 
EFI_STATUS EFIAPI XenBusGrantAccess (IN XENBUS_PROTOCOL *This, IN domid_t DomainId, IN UINTN Frame, IN BOOLEAN ReadOnly, OUT grant_ref_t *RefPtr)
 
EFI_STATUS EFIAPI XenBusGrantEndAccess (IN XENBUS_PROTOCOL *This, IN grant_ref_t Ref)
 

Variables

STATIC grant_entry_v1_tGrantTable = NULL
 
STATIC grant_ref_t GrantList [NR_GRANT_ENTRIES]
 
STATIC EFI_LOCK mGrantListLock
 

Detailed Description

Grant Table function implementation.

Grant Table are used to grant access to certain page of the current VM to an other VM.

Author: Steven Smith (sos22.nosp@m.@cam.nosp@m..ac.u.nosp@m.k) Changes: Grzegorz Milos (gm281.nosp@m.@cam.nosp@m..ac.u.nosp@m.k) Copyright (C) 2006, Cambridge University Copyright (C) 2014, Citrix Ltd.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file GrantTable.c.

Macro Definition Documentation

◆ NR_GRANT_ENTRIES

#define NR_GRANT_ENTRIES   (NR_GRANT_FRAMES * EFI_PAGE_SIZE / sizeof(grant_entry_v1_t))

Definition at line 26 of file GrantTable.c.

◆ NR_GRANT_FRAMES

#define NR_GRANT_FRAMES   (FixedPcdGet32 (PcdXenGrantFrames))

Definition at line 25 of file GrantTable.c.

◆ NR_RESERVED_ENTRIES

#define NR_RESERVED_ENTRIES   8

Definition at line 23 of file GrantTable.c.

Function Documentation

◆ XenBusGrantAccess()

EFI_STATUS EFIAPI XenBusGrantAccess ( IN XENBUS_PROTOCOL This,
IN domid_t  DomainId,
IN UINTN  Frame,
IN BOOLEAN  ReadOnly,
OUT grant_ref_t *  RefPtr 
)

Grant access to the page Frame to the domain DomainId.

Parameters
ThisA pointer to XENBUS_PROTOCOL instance.
DomainIdID of the domain to grant access to.
FrameFrame Number of the page to grant access to.
ReadOnlyProvide read-only or read-write access.
RefPtrReference number of the grant will be written to this pointer.

Definition at line 191 of file GrantTable.c.

◆ XenBusGrantEndAccess()

EFI_STATUS EFIAPI XenBusGrantEndAccess ( IN XENBUS_PROTOCOL This,
IN grant_ref_t  Ref 
)

End access to grant Ref, previously return by XenBusGrantAccess.

Parameters
ThisA pointer to XENBUS_PROTOCOL instance.
RefReference numeber of a grant previously returned by XenBusGrantAccess.

Definition at line 205 of file GrantTable.c.

◆ XenGrantTableDeinit()

VOID XenGrantTableDeinit ( XENBUS_DEVICE Dev)

Definition at line 157 of file GrantTable.c.

◆ XenGrantTableEndAccess()

STATIC EFI_STATUS XenGrantTableEndAccess ( grant_ref_t  Ref)

Definition at line 99 of file GrantTable.c.

◆ XenGrantTableGetFreeEntry()

STATIC grant_ref_t XenGrantTableGetFreeEntry ( VOID  )

Definition at line 53 of file GrantTable.c.

◆ XenGrantTableGrantAccess()

STATIC grant_ref_t XenGrantTableGrantAccess ( IN domid_t  DomainId,
IN UINTN  Frame,
IN BOOLEAN  ReadOnly 
)

Definition at line 73 of file GrantTable.c.

◆ XenGrantTableInit()

VOID XenGrantTableInit ( IN XENBUS_DEVICE Dev)

Initialize the Grant Table at the address MmioAddr.

Parameters
DevA pointer to XENBUS_DEVICE.
MmioAddrAn address where the grant table can be mapped into the guest.

Definition at line 123 of file GrantTable.c.

◆ XenGrantTablePutFreeEntry()

STATIC VOID XenGrantTablePutFreeEntry ( grant_ref_t  Ref)

Definition at line 37 of file GrantTable.c.

Variable Documentation

◆ GrantList

STATIC grant_ref_t GrantList[NR_GRANT_ENTRIES]

Definition at line 29 of file GrantTable.c.

◆ GrantTable

STATIC grant_entry_v1_t* GrantTable = NULL

Definition at line 28 of file GrantTable.c.

◆ mGrantListLock

STATIC EFI_LOCK mGrantListLock

Definition at line 30 of file GrantTable.c.