mirror of https://github.com/acidanthera/audk.git
OvmfPkg: Fix BhyveFwCtlLib build with VS2019
Update BhyveFwCtlLib.c to fix problems with UINT32/UINTN types that prevented Bhyve from building with VS2019. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Message-Id: <20201130053412.2-2-rebecca@bsdio.com> Acked-by: Peter Grehan <grehan@freebsd.org> Acked-by: Laszlo Ersek <lersek@redhat.com> Build-tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
8501bb0c05
commit
666923359e
|
@ -40,12 +40,12 @@ STATIC CONST CHAR8 mBhyveSig[4] = { 'B', 'H', 'Y', 'V' };
|
||||||
|
|
||||||
STATIC BOOLEAN mBhyveFwCtlSupported = FALSE;
|
STATIC BOOLEAN mBhyveFwCtlSupported = FALSE;
|
||||||
|
|
||||||
STATIC INTN mBhyveFwCtlTxid = 0xa5;
|
STATIC INT32 mBhyveFwCtlTxid = 0xa5;
|
||||||
|
|
||||||
/* XXX Maybe a better inbuilt version of this ? */
|
/* XXX Maybe a better inbuilt version of this ? */
|
||||||
struct BIoVec {
|
struct BIoVec {
|
||||||
VOID *Base;
|
VOID *Base;
|
||||||
UINTN Len;
|
UINT32 Len;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MsgRxHdr {
|
struct MsgRxHdr {
|
||||||
|
@ -86,14 +86,14 @@ BhyveFwCtl_CvtErr (
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
UINTN
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BIov_WLen (
|
BIov_WLen (
|
||||||
IN struct BIoVec b[]
|
IN struct BIoVec b[]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN i;
|
UINT32 i;
|
||||||
UINTN tLen;
|
UINT32 tLen;
|
||||||
|
|
||||||
tLen = 0;
|
tLen = 0;
|
||||||
|
|
||||||
|
@ -106,14 +106,14 @@ BIov_WLen (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Utility to send 1-3 bhyes of input as a 4-byte value
|
Utility to send 1-3 bytes of input as a 4-byte value
|
||||||
with trailing zeroes.
|
with trailing zeroes.
|
||||||
**/
|
**/
|
||||||
STATIC
|
STATIC
|
||||||
UINT32
|
UINT32
|
||||||
BIov_Send_Rem (
|
BIov_Send_Rem (
|
||||||
IN UINT32 *Data,
|
IN UINT32 *Data,
|
||||||
IN UINTN Len
|
IN UINT32 Len
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
|
@ -121,7 +121,7 @@ BIov_Send_Rem (
|
||||||
UINT32 w;
|
UINT32 w;
|
||||||
} u;
|
} u;
|
||||||
UINT8 *cdata;
|
UINT8 *cdata;
|
||||||
UINTN i;
|
UINT32 i;
|
||||||
|
|
||||||
cdata = (UINT8 *)Data;
|
cdata = (UINT8 *)Data;
|
||||||
u.w = 0;
|
u.w = 0;
|
||||||
|
@ -140,7 +140,7 @@ STATIC
|
||||||
VOID
|
VOID
|
||||||
BIov_Send (
|
BIov_Send (
|
||||||
IN char *Data,
|
IN char *Data,
|
||||||
IN UINTN Len
|
IN UINT32 Len
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 *LData;
|
UINT32 *LData;
|
||||||
|
@ -166,7 +166,7 @@ BIov_SendAll (
|
||||||
IN struct BIoVec b[]
|
IN struct BIoVec b[]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
INTN i;
|
INT32 i;
|
||||||
|
|
||||||
if (b != NULL) {
|
if (b != NULL) {
|
||||||
for (i = 0; b[i].Base; i++) {
|
for (i = 0; b[i].Base; i++) {
|
||||||
|
@ -182,13 +182,13 @@ STATIC
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BhyveFwCtl_MsgSend(
|
BhyveFwCtl_MsgSend(
|
||||||
IN UINTN OpCode,
|
IN UINT32 OpCode,
|
||||||
IN struct BIoVec Data[]
|
IN struct BIoVec Data[]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct BIoVec hIov[4];
|
struct BIoVec hIov[4];
|
||||||
UINT32 Hdr[3];
|
UINT32 Hdr[3];
|
||||||
UINTN i;
|
UINT32 i;
|
||||||
|
|
||||||
/* Set up header as an iovec */
|
/* Set up header as an iovec */
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
|
@ -200,7 +200,7 @@ BhyveFwCtl_MsgSend(
|
||||||
|
|
||||||
/* Initialize header */
|
/* Initialize header */
|
||||||
Hdr[0] = BIov_WLen (hIov) + BIov_WLen (Data);
|
Hdr[0] = BIov_WLen (hIov) + BIov_WLen (Data);
|
||||||
Hdr[1] = OpCode;
|
Hdr[1] = (UINT32)OpCode;
|
||||||
Hdr[2] = mBhyveFwCtlTxid;
|
Hdr[2] = mBhyveFwCtlTxid;
|
||||||
|
|
||||||
/* Send header and data */
|
/* Send header and data */
|
||||||
|
@ -222,8 +222,8 @@ BhyveFwCtl_MsgRecv(
|
||||||
RETURN_STATUS Status;
|
RETURN_STATUS Status;
|
||||||
UINT32 *Dp;
|
UINT32 *Dp;
|
||||||
UINT32 Rd;
|
UINT32 Rd;
|
||||||
UINTN remLen;
|
UINT32 remLen;
|
||||||
INTN oLen, xLen;
|
INT32 oLen, xLen;
|
||||||
|
|
||||||
Rd = IoRead32 (FW_PORT);
|
Rd = IoRead32 (FW_PORT);
|
||||||
if (Rd < sizeof(struct MsgRxHdr)) {
|
if (Rd < sizeof(struct MsgRxHdr)) {
|
||||||
|
@ -283,7 +283,7 @@ STATIC
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BhyveFwCtl_Msg(
|
BhyveFwCtl_Msg(
|
||||||
IN UINTN OpCode,
|
IN UINT32 OpCode,
|
||||||
IN struct BIoVec Sdata[],
|
IN struct BIoVec Sdata[],
|
||||||
OUT struct BIoVec Rdata[]
|
OUT struct BIoVec Rdata[]
|
||||||
)
|
)
|
||||||
|
@ -306,18 +306,18 @@ RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BhyveFwCtlGetLen (
|
BhyveFwCtlGetLen (
|
||||||
IN CONST CHAR8 *Name,
|
IN CONST CHAR8 *Name,
|
||||||
IN OUT UINTN *Size
|
IN OUT UINT32 *Size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct BIoVec Req[2], Resp[2];
|
struct BIoVec Req[2], Resp[2];
|
||||||
RETURN_STATUS Status;
|
RETURN_STATUS Status;
|
||||||
|
|
||||||
Req[0].Base = (VOID *)Name;
|
Req[0].Base = (VOID *)Name;
|
||||||
Req[0].Len = AsciiStrLen (Name) + 1;
|
Req[0].Len = (UINT32)AsciiStrLen (Name) + 1;
|
||||||
Req[1].Base = NULL;
|
Req[1].Base = NULL;
|
||||||
|
|
||||||
Resp[0].Base = Size;
|
Resp[0].Base = Size;
|
||||||
Resp[0].Len = sizeof(UINTN);
|
Resp[0].Len = sizeof(UINT32);
|
||||||
Resp[1].Base = NULL;
|
Resp[1].Base = NULL;
|
||||||
|
|
||||||
Status = BhyveFwCtl_Msg (OP_GET_LEN, Req, Resp);
|
Status = BhyveFwCtl_Msg (OP_GET_LEN, Req, Resp);
|
||||||
|
@ -337,7 +337,7 @@ EFIAPI
|
||||||
BhyveFwCtlGetVal (
|
BhyveFwCtlGetVal (
|
||||||
IN CONST CHAR8 *Name,
|
IN CONST CHAR8 *Name,
|
||||||
OUT VOID *Item,
|
OUT VOID *Item,
|
||||||
IN OUT UINTN *Size
|
IN OUT UINT32 *Size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct BIoVec Req[2], Resp[2];
|
struct BIoVec Req[2], Resp[2];
|
||||||
|
@ -348,7 +348,7 @@ BhyveFwCtlGetVal (
|
||||||
return RETURN_INVALID_PARAMETER;
|
return RETURN_INVALID_PARAMETER;
|
||||||
|
|
||||||
Req[0].Base = (VOID *)Name;
|
Req[0].Base = (VOID *)Name;
|
||||||
Req[0].Len = AsciiStrLen(Name) + 1;
|
Req[0].Len = (UINT32)AsciiStrLen(Name) + 1;
|
||||||
Req[1].Base = NULL;
|
Req[1].Base = NULL;
|
||||||
|
|
||||||
Resp[0].Base = &FwGetvalBuf;
|
Resp[0].Base = &FwGetvalBuf;
|
||||||
|
@ -363,7 +363,7 @@ BhyveFwCtlGetVal (
|
||||||
* multiple iovecs.
|
* multiple iovecs.
|
||||||
*/
|
*/
|
||||||
if ((Status == RETURN_SUCCESS) || (Status == RETURN_BUFFER_TOO_SMALL)) {
|
if ((Status == RETURN_SUCCESS) || (Status == RETURN_BUFFER_TOO_SMALL)) {
|
||||||
*Size = FwGetvalBuf.fSize;
|
*Size = (UINT32)FwGetvalBuf.fSize;
|
||||||
CopyMem (Item, FwGetvalBuf.fData, *Size);
|
CopyMem (Item, FwGetvalBuf.fData, *Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,9 +387,9 @@ BhyveFwCtlGet (
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
|
|
||||||
if (Item == NULL) {
|
if (Item == NULL) {
|
||||||
Status = BhyveFwCtlGetLen (Name, Size);
|
Status = BhyveFwCtlGetLen (Name, (UINT32*)Size);
|
||||||
} else {
|
} else {
|
||||||
Status = BhyveFwCtlGetVal (Name, Item, Size);
|
Status = BhyveFwCtlGetVal (Name, Item, (UINT32*)Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -406,7 +406,7 @@ BhyveFwCtlInitialize (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN i;
|
UINT32 i;
|
||||||
UINT8 ch;
|
UINT8 ch;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "FwCtlInitialize\n"));
|
DEBUG ((DEBUG_INFO, "FwCtlInitialize\n"));
|
||||||
|
|
Loading…
Reference in New Issue