示例#1
0
void decodeSMBIOSTable(SMBEntryPoint *eps)
{
	uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;
	SMBStructHeader *structHeader = (SMBStructHeader *)ptr;

	minorVersion = eps->minorVersion;
	majorVersion = eps->majorVersion;
	bcdRevisionHi = eps->dmi.bcdRevision >> 4;
	bcdRevisionLo = eps->dmi.bcdRevision & 0x0F;

	getBoolForKey(kPrivateData, &privateData, &bootInfo->chameleonConfig);  // Bungo: chek if mask some data

	DBG("\n");
	DBG("SMBIOS rev.: %d.%d, DMI rev.: %d.%d\n", majorVersion, minorVersion, bcdRevisionHi, bcdRevisionLo);
	DBG("\n");
	for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
	{
		switch (structHeader->type)
		{
			case kSMBTypeBIOSInformation: // Type 0
				decodeBIOSInformation(structHeader);
				break;

			case kSMBTypeSystemInformation: // Type 1
				decodeSystemInformation(structHeader);
				break;

			case kSMBTypeBaseBoard: // Type 2
				decodeBaseBoard(structHeader);
				break;

			case kSMBTypeSystemEnclosure: // Type 3
				decodeSystemEnclosure(structHeader);
				break;

			case kSMBTypeProcessorInformation: // Type 4
				decodeProcessorInformation(structHeader);
				break;

			//case kSMBTypeMemoryModule: // Type 6
			//	decodeMemoryModule(structHeader);
			//	break;

			//case kSMBTypeSystemSlot: // Type 9
			//	decodeSMBTypeSystemSlot(structHeader);
			//	break;

			case kSMBOEMStrings: // Type 11
				decodeSMBOEMStrings(structHeader);
				break;

			case kSMBTypeMemoryDevice: // Type 17
				decodeMemoryDevice(structHeader);
				break;

			//kSMBTypeMemoryArrayMappedAddress: // Type 19
			//	break;

			/* Skip all Apple Specific Structures */
			// case kSMBTypeFirmwareVolume: // Type 128
			// case kSMBTypeMemorySPD: // Type 130
			//	break;

			case kSMBTypeOemProcessorType: // Type 131
				decodeOemProcessorType(structHeader);
				break;

			case kSMBTypeOemProcessorBusSpeed: // Type 132
				decodeOemProcessorBusSpeed(structHeader);
				break;

			//kSMBTypeOemPlatformFeature: // Type 133
			//	decodeOemPlatformFeature(structHeader);
			//	break;

			case kSMBTypeEndOfTable: // Type 127
				DBG("Handle 0x%04x, DMI type %d, %d  bytes\n", structHeader->handle, structHeader->type, structHeader->length);
				DBG("End of Table\n");
				break;

			default:
				break;
		}

		ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
		for (; ((uint16_t *)ptr)[0] != 0; ptr++);

		if (((uint16_t *)ptr)[0] == 0) {
			ptr += 2;
		}

		structHeader = (SMBStructHeader *)ptr;
	}
	DBG("\n");
}
示例#2
0
void decodeSMBIOSTable(SMBEntryPoint *eps)
{
	uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;
	SMBStructHeader *structHeader = (SMBStructHeader *)ptr;

	minorVersion = eps->minorVersion;

	DBG("\n");
	for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
	{
		DBG("Type: %d, Length: %d, Handle: 0x%x\n", 
				structHeader->type, structHeader->length, structHeader->handle);

		switch (structHeader->type)
		{
			case kSMBTypeBIOSInformation:
				decodeBIOSInformation((SMBBIOSInformation *)structHeader);
				break;

			case kSMBTypeSystemInformation:
				decodeSystemInformation((SMBSystemInformation *)structHeader);
				break;

			case kSMBTypeBaseBoard:
				decodeBaseBoard((SMBBaseBoard *)structHeader);
				break;

			case kSMBTypeSystemEnclosure:
				decodeSystemEnclosure((SMBSystemEnclosure *)structHeader);
				break;

			case kSMBTypeProcessorInformation:
				decodeProcessorInformation((SMBProcessorInformation *)structHeader);
				break;

			case kSMBTypeMemoryDevice:
				decodeMemoryDevice((SMBMemoryDevice *)structHeader);
				break;

			/* Skip all Apple Specific Structures */
			case kSMBTypeFirmwareVolume:
			case kSMBTypeMemorySPD:
				break;

			case kSMBTypeOemProcessorType:
				decodeOemProcessorType((SMBOemProcessorType *)structHeader);
				break;

			case kSMBTypeOemProcessorBusSpeed:
				decodeOemProcessorBusSpeed((SMBOemProcessorBusSpeed *)structHeader);
				break;

			case kSMBTypeEndOfTable:
				/* Skip, to be added at the end */
				break;

			default:
				break;
		}

		ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
		for (; ((uint16_t *)ptr)[0] != 0; ptr++);

		if (((uint16_t *)ptr)[0] == 0)
			ptr += 2;

		structHeader = (SMBStructHeader *)ptr;
	}
	DBG("\n");
}