To install a new MIF file, the component instrumentation fills out a DmiCiInstallData block and sends it to the service layer with the DmiInvoke() function call.
The format for the command block is: ┌──────────────────────────────────────────────────────────────────────────────┐
Variable Name
│ Table 41. DmiCiInstallData Command Block │
├───────────────┬───────────────┬───────────────┬──────────────────────────────┤
│ OFFSET │ SIZE │ TYPE │ VARIABLE NAME │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 0 │ 64 │ STRUCT │ DmiMgmtCommand │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 64 │ 4 │ INT │ iComponentId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 68 │ 4 │ INT │ iFileCount │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 72 │ 8 │ STRUCT │ DmiFileData[ ] │
└───────────────┴───────────────┴───────────────┴──────────────────────────────┘
DmiMgmtCommand
Variable Description
The format of the DmiFileData block is: ┌──────────────────────────────────────────────────────────────────────────────┐│Table42
.DmiFileDataCommandBlock │
├───────────────┬───────────────┬───────────────┬──────────────────────────────┤
│ OFFSET │ SIZE │ TYPE │ VARIABLE NAME │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 0 │ 4 │ INT │ iFileType │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 4 │ 4 │ OFFSET │ osFileData │
└───────────────┴───────────────┴───────────────┴──────────────────────────────┘
Variable Name
The following type codes are defined:
Type code
Meaning
Issuing DmiCiInstallData displays an example of how to issue the DmiCiInstallData
command to the CI. IssuingDmiCiInstallData
DmiLibInstallData_t *InstallMIF(char *MIF_FileName) // Receive thread -- handles all confirm processing
{
DMI_CiInstallData_t *inst;
ULONG reqSize,FileOffset,FileSize;
DMI_STRING *FileName;
ULONG RC = SLERR_OUT_OF_MEMORY;
FileName = (DMI_STRING *)malloc((ULONG) (strlen(MIF_FileName) + sizeof(ULONG)));
if(FileName != (DMI_STRING *)NULL){ // we got the memory we asked for
memcpy(FileName->body,MIF_FileName,(FileName->length = strlen(MIF_FileName))); // set up the file
// name string
FileOffset = reqSize = (ULONG)sizeof(DMI_CiInstallData_t); // install structure includes ONE
// file structure
reqSize += (ULONG) (FileName->length + sizeof(FileName->length)); // add length of DMI string
inst = (DMI_CiInstallData_t *)malloc(reqSize);
if(inst != (DMI_CiInstallData_t *)NULL){ // we've got the memory
memset(inst,0,reqSize); /* clear out the whole thing */
inst->DmiMgmtCommand.iLevelCheck = DMI_LEVEL_CHECK;
inst->DmiMgmtCommand.iCmdLen = reqSize;
inst->DmiMgmtCommand.iCmdHandle = 1;
inst->DmiMgmtCommand.iRequestCount = 1;
inst->DmiMgmtCommand.iCommand = DmiCiInstallCmd;
inst->iFileCount = 1;
inst->DmiFileListφ0∙.iFileType = MIF_MIF_FILE_NAME_FILE_TYPE;
inst->DmiFileListφ0∙.oFileData = FileOffset;
FileSize = (size_t) (sizeof(FileName->length) + FileName->length);
memcpy(((char *)inst + FileOffset),FileName, FileSize);
RC = DmiInvoke((DMI_MgmtCommand_t *)inst);
if(RC != SLERR_NO_ERROR) free(inst);
}
free(FileName);
}
return RC;
}