TianoCore EDK2 master
Loading...
Searching...
No Matches
BhyveFwCtlLib.c File Reference

Go to the source code of this file.

Data Structures

struct  BIO_VEC
 
struct  MSG_RX_HDR
 

Macros

#define FW_PORT   0x510
 
#define FW_IPORT   0x511
 
#define OP_NULL   1
 
#define OP_ECHO   2
 
#define OP_GET   3
 
#define OP_GET_LEN   4
 
#define OP_SET   5
 
#define T_ESUCCESS   0
 
#define T_ENOENT   2
 
#define T_E2BIG   7
 
#define T_EMSGSIZE   40
 
#define ROUNDUP(x, y)   ((((x)+((y)-1))/(y))*(y))
 
#define FMAXSZ   1024
 

Functions

STATIC RETURN_STATUS EFIAPI BhyveFwCtl_CvtErr (IN UINT32 errno)
 
STATIC UINT32 EFIAPI BIov_WLen (IN BIO_VEC b[])
 
STATIC UINT32 BIov_Send_Rem (IN UINT32 *Data, IN UINT32 Len)
 
STATIC VOID BIov_Send (IN char *Data, IN UINT32 Len)
 
STATIC VOID BIov_SendAll (IN BIO_VEC b[])
 
STATIC VOID EFIAPI BhyveFwCtl_MsgSend (IN UINT32 OpCode, IN BIO_VEC Data[])
 
STATIC RETURN_STATUS EFIAPI BhyveFwCtl_MsgRecv (OUT MSG_RX_HDR *Rhdr, OUT BIO_VEC Data[])
 
STATIC RETURN_STATUS EFIAPI BhyveFwCtl_Msg (IN UINT32 OpCode, IN BIO_VEC Sdata[], OUT BIO_VEC Rdata[])
 
STATIC RETURN_STATUS EFIAPI BhyveFwCtlGetLen (IN CONST CHAR8 *Name, IN OUT UINT32 *Size)
 
STATIC RETURN_STATUS EFIAPI BhyveFwCtlGetVal (IN CONST CHAR8 *Name, OUT VOID *Item, IN OUT UINT32 *Size)
 
RETURN_STATUS EFIAPI BhyveFwCtlGet (IN CONST CHAR8 *Name, OUT VOID *Item, IN OUT UINTN *Size)
 
RETURN_STATUS EFIAPI BhyveFwCtlInitialize (VOID)
 

Variables

STATIC CONST CHAR8 mBhyveSig [4] = { 'B', 'H', 'Y', 'V' }
 
STATIC BOOLEAN mBhyveFwCtlSupported = FALSE
 
STATIC INT32 mBhyveFwCtlTxid = 0xa5
 
struct {
   UINT64   fSize
 
   UINT32   fData [FMAXSZ]
 
FwGetvalBuf
 

Detailed Description

Copyright (c) 2020, Rebecca Cran rebec.nosp@m.ca@b.nosp@m.sdio..nosp@m.com Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
Copyright (C) 2013, Red Hat, Inc. Copyright (c) 2015, Nahanni Systems.

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

Definition in file BhyveFwCtlLib.c.

Macro Definition Documentation

◆ FMAXSZ

#define FMAXSZ   1024

Definition at line 332 of file BhyveFwCtlLib.c.

◆ FW_IPORT

#define FW_IPORT   0x511

Definition at line 22 of file BhyveFwCtlLib.c.

◆ FW_PORT

#define FW_PORT   0x510

Definition at line 21 of file BhyveFwCtlLib.c.

◆ OP_ECHO

#define OP_ECHO   2

Definition at line 26 of file BhyveFwCtlLib.c.

◆ OP_GET

#define OP_GET   3

Definition at line 27 of file BhyveFwCtlLib.c.

◆ OP_GET_LEN

#define OP_GET_LEN   4

Definition at line 28 of file BhyveFwCtlLib.c.

◆ OP_NULL

#define OP_NULL   1

Definition at line 25 of file BhyveFwCtlLib.c.

◆ OP_SET

#define OP_SET   5

Definition at line 29 of file BhyveFwCtlLib.c.

◆ ROUNDUP

#define ROUNDUP (   x,
 
)    ((((x)+((y)-1))/(y))*(y))

Definition at line 37 of file BhyveFwCtlLib.c.

◆ T_E2BIG

#define T_E2BIG   7

Definition at line 34 of file BhyveFwCtlLib.c.

◆ T_EMSGSIZE

#define T_EMSGSIZE   40

Definition at line 35 of file BhyveFwCtlLib.c.

◆ T_ENOENT

#define T_ENOENT   2

Definition at line 33 of file BhyveFwCtlLib.c.

◆ T_ESUCCESS

#define T_ESUCCESS   0

Definition at line 32 of file BhyveFwCtlLib.c.

Function Documentation

◆ BhyveFwCtl_CvtErr()

STATIC RETURN_STATUS EFIAPI BhyveFwCtl_CvtErr ( IN UINT32  errno)

Definition at line 61 of file BhyveFwCtlLib.c.

◆ BhyveFwCtl_Msg()

STATIC RETURN_STATUS EFIAPI BhyveFwCtl_Msg ( IN UINT32  OpCode,
IN BIO_VEC  Sdata[],
OUT BIO_VEC  Rdata[] 
)

Definition at line 289 of file BhyveFwCtlLib.c.

◆ BhyveFwCtl_MsgRecv()

STATIC RETURN_STATUS EFIAPI BhyveFwCtl_MsgRecv ( OUT MSG_RX_HDR Rhdr,
OUT BIO_VEC  Data[] 
)

Read a transport response and optional data from the i/o port.

Definition at line 220 of file BhyveFwCtlLib.c.

◆ BhyveFwCtl_MsgSend()

STATIC VOID EFIAPI BhyveFwCtl_MsgSend ( IN UINT32  OpCode,
IN BIO_VEC  Data[] 
)

Prepend the transport header to a block of data and send.

Definition at line 186 of file BhyveFwCtlLib.c.

◆ BhyveFwCtlGet()

RETURN_STATUS EFIAPI BhyveFwCtlGet ( IN CONST CHAR8 *  Name,
OUT VOID *  Item,
IN OUT UINTN Size 
)

Front end to the internal GET_LEN and GET protocols

Definition at line 384 of file BhyveFwCtlLib.c.

◆ BhyveFwCtlGetLen()

STATIC RETURN_STATUS EFIAPI BhyveFwCtlGetLen ( IN CONST CHAR8 *  Name,
IN OUT UINT32 *  Size 
)

Definition at line 311 of file BhyveFwCtlLib.c.

◆ BhyveFwCtlGetVal()

STATIC RETURN_STATUS EFIAPI BhyveFwCtlGetVal ( IN CONST CHAR8 *  Name,
OUT VOID *  Item,
IN OUT UINT32 *  Size 
)

Definition at line 341 of file BhyveFwCtlLib.c.

◆ BhyveFwCtlInitialize()

RETURN_STATUS EFIAPI BhyveFwCtlInitialize ( VOID  )

Library initialization. Probe the host to see if the f/w ctl interface is supported.

Definition at line 411 of file BhyveFwCtlLib.c.

◆ BIov_Send()

STATIC VOID BIov_Send ( IN char *  Data,
IN UINT32  Len 
)

Send a block of data out the i/o port as 4-byte quantities, appending trailing zeroes on the last if required.

Definition at line 143 of file BhyveFwCtlLib.c.

◆ BIov_Send_Rem()

STATIC UINT32 BIov_Send_Rem ( IN UINT32 *  Data,
IN UINT32  Len 
)

Utility to send 1-3 bytes of input as a 4-byte value with trailing zeroes.

Definition at line 115 of file BhyveFwCtlLib.c.

◆ BIov_SendAll()

STATIC VOID BIov_SendAll ( IN BIO_VEC  b[])

Send data described by an array of iovecs out the i/o port.

Definition at line 167 of file BhyveFwCtlLib.c.

◆ BIov_WLen()

STATIC UINT32 EFIAPI BIov_WLen ( IN BIO_VEC  b[])

Definition at line 91 of file BhyveFwCtlLib.c.

Variable Documentation

◆ fData

UINT32 fData[FMAXSZ]

Definition at line 335 of file BhyveFwCtlLib.c.

◆ fSize

UINT64 fSize

Definition at line 334 of file BhyveFwCtlLib.c.

◆ mBhyveFwCtlSupported

STATIC BOOLEAN mBhyveFwCtlSupported = FALSE

Definition at line 41 of file BhyveFwCtlLib.c.

◆ mBhyveFwCtlTxid

STATIC INT32 mBhyveFwCtlTxid = 0xa5

Definition at line 43 of file BhyveFwCtlLib.c.

◆ mBhyveSig

STATIC CONST CHAR8 mBhyveSig[4] = { 'B', 'H', 'Y', 'V' }

Definition at line 39 of file BhyveFwCtlLib.c.