Skip to content

Commit

Permalink
Updates to deal with windows union padding in FwCmd
Browse files Browse the repository at this point in the history
Signed-off-by: Glenn L Diviney <[email protected]>
  • Loading branch information
kellycouch authored and gldiviney committed Jun 28, 2019
1 parent 9afba64 commit 1f0930d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions DcpmPkg/cli/Common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,7 @@ ReadCmdLinePrintOptions(
}

FreeStringArray(Toks, NumToks);
FREE_POOL_SAFE(OutputOptions);
return ReturnCode;
}

Expand Down
1 change: 1 addition & 0 deletions DcpmPkg/cli/CreateGoalCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ CreateGoal(
FREE_POOL_SAFE(pDimms);
FREE_POOL_SAFE(pShowGoalOutputArgs);
FREE_POOL_SAFE(pUnitsStr);
FREE_POOL_SAFE(pCommandStr);
NVDIMM_EXIT_I64(ReturnCode);
return ReturnCode;
}
Expand Down
1 change: 1 addition & 0 deletions DcpmPkg/cli/LoadGoalCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ LoadGoal(
FREE_POOL_SAFE(pSocketIds);
FREE_POOL_SAFE(pDimmIds);
FREE_POOL_SAFE(pDimms);
FREE_POOL_SAFE(pCommandStr);
FREE_POOL_SAFE(pLoadUserPath);
FREE_POOL_SAFE(pUnitsStr);
NVDIMM_EXIT_I64(ReturnCode);
Expand Down
1 change: 1 addition & 0 deletions DcpmPkg/common/DataSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ GetDataSet(DATA_SET_CONTEXT *Root, CHAR16 *NamePath, ...) {

//split path, result toks are data set names
if (NULL == (DataSetToks = StrSplit(FormattedNamePath, L'/', &NumDataSetToks))) {
FreePool(FormattedNamePath);
return NULL;
}
FreePool(FormattedNamePath);
Expand Down
5 changes: 3 additions & 2 deletions DcpmPkg/common/FwUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#define OUT_MB_SIZE (1 << 20) //!< Size of the OS mailbox large output payload
#define IN_PAYLOAD_SIZE (128) //!< Total size of the input payload registers
#define OUT_PAYLOAD_SIZE (128) //!< Total size of the output payload registers
#define IN_PAYLOAD_SIZE_EXT_PAD (12) //!< Additional bytes to deal with DSM calls

#define MB_COMPLETE 0x1
#define STATUS_MASK 0xFF
Expand All @@ -53,8 +54,8 @@ typedef struct {
UINT32 OutputPayloadSize;
UINT32 LargeOutputPayloadSize;
union{
UINT8 Data[IN_PAYLOAD_SIZE];
struct {
UINT8 Data[IN_PAYLOAD_SIZE + IN_PAYLOAD_SIZE_EXT_PAD];
struct {
UINT8 Opcode;
UINT8 SubOpcode;
UINT8 TransportInterface;
Expand Down
6 changes: 4 additions & 2 deletions DcpmPkg/driver/Core/Dimm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3311,7 +3311,7 @@ FwCmdGetErrorLog (
pFwCmd->InputPayloadSize = sizeof(*pInputPayload);
pFwCmd->OutputPayloadSize = OutputPayloadSize;
pFwCmd->LargeOutputPayloadSize = LargeOutputPayloadSize;
CopyMem_S(&pFwCmd->InputPayload.Data, sizeof(pFwCmd->InputPayload.Data), pInputPayload, sizeof(pFwCmd->InputPayload.Data));
CopyMem_S(&pFwCmd->InputPayload.Data, sizeof(pFwCmd->InputPayload.Data), pInputPayload, pFwCmd->InputPayloadSize);

ReturnCode = PassThru(pDimm, pFwCmd, PT_LONG_TIMEOUT_INTERVAL);
if (EFI_ERROR(ReturnCode)) {
Expand Down Expand Up @@ -6880,7 +6880,6 @@ PopulateUninitializedDimmList(
EFI_STATUS TempReturnCode = EFI_SUCCESS;
PT_ID_DIMM_PAYLOAD *pPayload = NULL;


// Only populate dimms found from the NFIT table (they are already placed in
// the UninitializedDimms list)
LIST_FOR_EACH(pNode, &gNvmDimmData->PMEMDev.UninitializedDimms) {
Expand Down Expand Up @@ -6917,7 +6916,10 @@ PopulateUninitializedDimmList(
pDimm->ControllerRid = pPayload->Rid;
}
}

FREE_POOL_SAFE(pPayload);
}

return ReturnCode;
}

Expand Down
3 changes: 2 additions & 1 deletion src/os/os_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ enum dsm_vendor_error {
#define IN_MB_SIZE (1 << 20) //!< Size of the OS mailbox large input payload
#define OUT_MB_SIZE (1 << 20) //!< Size of the OS mailbox large output payload
#define IN_PAYLOAD_SIZE (128) //!< Total size of the input payload registers
#define IN_PAYLOAD_SIZE_EXT_PAD (12) //!< Additional bytes to deal with DSM calls
#define OUT_PAYLOAD_SIZE (128) //!< Total size of the output payload registers

#define MB_COMPLETE 0x1
Expand All @@ -140,7 +141,7 @@ struct fw_cmd {
unsigned int OutputPayloadSize;
unsigned int LargeOutputPayloadSize;
union {
unsigned char Data[IN_PAYLOAD_SIZE];
unsigned char Data[IN_PAYLOAD_SIZE + IN_PAYLOAD_SIZE_EXT_PAD];
struct {
unsigned char Opcode;
unsigned char SubOpcode;
Expand Down

0 comments on commit 1f0930d

Please sign in to comment.