Example #1
0
/*
 * Helper routines for writing to the DSDT from other modules.
 */
void
dsdt_line(const char *fmt, ...)
{
	va_list ap;
	int err;

	err = 0;

	if (dsdt_error != 0)
		return;

	if (strcmp(fmt, "") != 0) {
		if (dsdt_indent_level != 0)
			EFPRINTF(dsdt_fp, "%*c", dsdt_indent_level * 2, ' ');
		va_start(ap, fmt);
		if (vfprintf(dsdt_fp, fmt, ap) < 0)
			goto err_exit;
		va_end(ap);
	}
	EFPRINTF(dsdt_fp, "\n");
	return;

err_exit:
	dsdt_error = errno;
}
Example #2
0
/* read len bytes from file specified by fd from offset, and write to file specified by fp */
static int
copy_table_pos_len(int fd, int offset, int len, FILE *fp)
{
	int pos, i;
	uint8_t data;

	if ((fd < 0) || (fp == NULL))
		return -1;

	pos = lseek(fd, offset, SEEK_SET);
	if (pos != offset)
		return -1;

	for (i = 0; i < len; i++) {
		if (read(fd, &data, 1) != 1) {
			fprintf(stderr, "%s: read fail! %s\n", __func__, strerror(errno));
			return -1;
		}
		EFPRINTF(fp, "UINT8 : %02X\n", data);
	}
	return 0;
}
Example #3
0
static int
basl_fwrite_mcfg(FILE *fp)
{
	int err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve MCFG template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"MCFG\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"BHYVE \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVMCFG  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");

	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "[0008]\t\tReserved : 0\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0008]\t\tBase Address : %016llx\n", pci_ecfg_base());
	EFPRINTF(fp, "[0002]\t\tSegment Group: 0000\n");
	EFPRINTF(fp, "[0001]\t\tStart Bus: 00\n");
	EFPRINTF(fp, "[0001]\t\tEnd Bus: FF\n");
	EFPRINTF(fp, "[0004]\t\tReserved : 0\n");
	EFFLUSH(fp);
	return (0);
err_exit:
	return (errno);
}
Example #4
0
static int
basl_fwrite_hpet(FILE *fp)
{
	int err;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve HPET template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"HPET\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"BHYVE \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVHPET  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");

	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0004]\t\tTimer Block ID : %08X\n", hpet_capabilities);
	EFPRINTF(fp,
	    "[0012]\t\tTimer Block Register : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 00 [SystemMemory]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp,
		 "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 00000000FED00000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0001]\t\tHPET Number : 00\n");
	EFPRINTF(fp, "[0002]\t\tMinimum Clock Ticks : 0000\n");
	EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
	EFPRINTF(fp, "\t\t\t4K Page Protect : 1\n");
	EFPRINTF(fp, "\t\t\t64K Page Protect : 0\n");
	EFPRINTF(fp, "\n");

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #5
0
static int
basl_fwrite_fadt(FILE *fp)
{
	int err;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve FADT template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"FACP\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 0000010C\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 05\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"BHYVE \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVFACP  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");
	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0004]\t\tFACS Address : %08X\n",
	    basl_acpi_base + FACS_OFFSET);
	EFPRINTF(fp, "[0004]\t\tDSDT Address : %08X\n",
	    basl_acpi_base + DSDT_OFFSET);
	EFPRINTF(fp, "[0001]\t\tModel : 01\n");
	EFPRINTF(fp, "[0001]\t\tPM Profile : 00 [Unspecified]\n");
	EFPRINTF(fp, "[0002]\t\tSCI Interrupt : %04X\n",
	    SCI_INT);
	EFPRINTF(fp, "[0004]\t\tSMI Command Port : %08X\n",
	    SMI_CMD);
	EFPRINTF(fp, "[0001]\t\tACPI Enable Value : %02X\n",
	    BHYVE_ACPI_ENABLE);
	EFPRINTF(fp, "[0001]\t\tACPI Disable Value : %02X\n",
	    BHYVE_ACPI_DISABLE);
	EFPRINTF(fp, "[0001]\t\tS4BIOS Command : 00\n");
	EFPRINTF(fp, "[0001]\t\tP-State Control : 00\n");
	EFPRINTF(fp, "[0004]\t\tPM1A Event Block Address : %08X\n",
	    PM1A_EVT_ADDR);
	EFPRINTF(fp, "[0004]\t\tPM1B Event Block Address : 00000000\n");
	EFPRINTF(fp, "[0004]\t\tPM1A Control Block Address : %08X\n",
	    PM1A_CNT_ADDR);
	EFPRINTF(fp, "[0004]\t\tPM1B Control Block Address : 00000000\n");
	EFPRINTF(fp, "[0004]\t\tPM2 Control Block Address : 00000000\n");
	EFPRINTF(fp, "[0004]\t\tPM Timer Block Address : %08X\n",
	    IO_PMTMR);
	EFPRINTF(fp, "[0004]\t\tGPE0 Block Address : 00000000\n");
	EFPRINTF(fp, "[0004]\t\tGPE1 Block Address : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tPM1 Event Block Length : 04\n");
	EFPRINTF(fp, "[0001]\t\tPM1 Control Block Length : 02\n");
	EFPRINTF(fp, "[0001]\t\tPM2 Control Block Length : 00\n");
	EFPRINTF(fp, "[0001]\t\tPM Timer Block Length : 04\n");
	EFPRINTF(fp, "[0001]\t\tGPE0 Block Length : 00\n");
	EFPRINTF(fp, "[0001]\t\tGPE1 Block Length : 00\n");
	EFPRINTF(fp, "[0001]\t\tGPE1 Base Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\t_CST Support : 00\n");
	EFPRINTF(fp, "[0002]\t\tC2 Latency : 0000\n");
	EFPRINTF(fp, "[0002]\t\tC3 Latency : 0000\n");
	EFPRINTF(fp, "[0002]\t\tCPU Cache Size : 0000\n");
	EFPRINTF(fp, "[0002]\t\tCache Flush Stride : 0000\n");
	EFPRINTF(fp, "[0001]\t\tDuty Cycle Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\tDuty Cycle Width : 00\n");
	EFPRINTF(fp, "[0001]\t\tRTC Day Alarm Index : 00\n");
	EFPRINTF(fp, "[0001]\t\tRTC Month Alarm Index : 00\n");
	EFPRINTF(fp, "[0001]\t\tRTC Century Index : 32\n");
	EFPRINTF(fp, "[0002]\t\tBoot Flags (decoded below) : 0000\n");
	EFPRINTF(fp, "\t\t\tLegacy Devices Supported (V2) : 0\n");
	EFPRINTF(fp, "\t\t\t8042 Present on ports 60/64 (V2) : 0\n");
	EFPRINTF(fp, "\t\t\tVGA Not Present (V4) : 1\n");
	EFPRINTF(fp, "\t\t\tMSI Not Supported (V4) : 0\n");
	EFPRINTF(fp, "\t\t\tPCIe ASPM Not Supported (V4) : 1\n");
	EFPRINTF(fp, "\t\t\tCMOS RTC Not Present (V5) : 0\n");
	EFPRINTF(fp, "[0001]\t\tReserved : 00\n");
	EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000000\n");
	EFPRINTF(fp, "\t\t\tWBINVD instruction is operational (V1) : 1\n");
	EFPRINTF(fp, "\t\t\tWBINVD flushes all caches (V1) : 0\n");
	EFPRINTF(fp, "\t\t\tAll CPUs support C1 (V1) : 1\n");
	EFPRINTF(fp, "\t\t\tC2 works on MP system (V1) : 0\n");
	EFPRINTF(fp, "\t\t\tControl Method Power Button (V1) : 0\n");
	EFPRINTF(fp, "\t\t\tControl Method Sleep Button (V1) : 1\n");
	EFPRINTF(fp, "\t\t\tRTC wake not in fixed reg space (V1) : 0\n");
	EFPRINTF(fp, "\t\t\tRTC can wake system from S4 (V1) : 0\n");
	EFPRINTF(fp, "\t\t\t32-bit PM Timer (V1) : 1\n");
	EFPRINTF(fp, "\t\t\tDocking Supported (V1) : 0\n");
	EFPRINTF(fp, "\t\t\tReset Register Supported (V2) : 1\n");
	EFPRINTF(fp, "\t\t\tSealed Case (V3) : 0\n");
	EFPRINTF(fp, "\t\t\tHeadless - No Video (V3) : 1\n");
	EFPRINTF(fp, "\t\t\tUse native instr after SLP_TYPx (V3) : 0\n");
	EFPRINTF(fp, "\t\t\tPCIEXP_WAK Bits Supported (V4) : 0\n");
	EFPRINTF(fp, "\t\t\tUse Platform Timer (V4) : 0\n");
	EFPRINTF(fp, "\t\t\tRTC_STS valid on S4 wake (V4) : 0\n");
	EFPRINTF(fp, "\t\t\tRemote Power-on capable (V4) : 0\n");
	EFPRINTF(fp, "\t\t\tUse APIC Cluster Model (V4) : 0\n");
	EFPRINTF(fp, "\t\t\tUse APIC Physical Destination Mode (V4) : 1\n");
	EFPRINTF(fp, "\t\t\tHardware Reduced (V5) : 0\n");
	EFPRINTF(fp, "\t\t\tLow Power S0 Idle (V5) : 0\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp,
	    "[0012]\t\tReset Register : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 08\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000CF9\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0001]\t\tValue to cause reset : 06\n");
	EFPRINTF(fp, "[0002]\t\tARM Flags (decoded below): 0000\n");
	EFPRINTF(fp, "\t\t\tPSCI Compliant : 0\n");
	EFPRINTF(fp, "\t\t\tMust use HVC for PSCI : 0\n");
	EFPRINTF(fp, "[0001]\t\tFADT Minor Revision : 01\n");
	EFPRINTF(fp, "[0008]\t\tFACS Address : 00000000%08X\n",
	    basl_acpi_base + FACS_OFFSET);
	EFPRINTF(fp, "[0008]\t\tDSDT Address : 00000000%08X\n",
	    basl_acpi_base + DSDT_OFFSET);
	EFPRINTF(fp,
	    "[0012]\t\tPM1A Event Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 20\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 02 [Word Access:16]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n",
	    PM1A_EVT_ADDR);
	EFPRINTF(fp, "\n");

	EFPRINTF(fp,
	    "[0012]\t\tPM1B Event Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp,
	    "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp,
	    "[0012]\t\tPM1A Control Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 10\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 02 [Word Access:16]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n",
	    PM1A_CNT_ADDR);
	EFPRINTF(fp, "\n");

	EFPRINTF(fp,
	    "[0012]\t\tPM1B Control Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp,
	    "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp,
	    "[0012]\t\tPM2 Control Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 08\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp,
	    "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");
	EFPRINTF(fp, "\n");

	/* Valid for bhyve */
	EFPRINTF(fp,
	    "[0012]\t\tPM Timer Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 20\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp,
	    "[0001]\t\tEncoded Access Width : 03 [DWord Access:32]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n",
	    IO_PMTMR);
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0012]\t\tGPE0 Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0012]\t\tGPE1 Block : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp,
	    "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp,
	   "[0012]\t\tSleep Control Register : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 08\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp,
	    "[0012]\t\tSleep Status Register : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 08\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #6
0
static int
basl_fwrite_madt(FILE *fp)
{
	int err;
	int i;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve MADT template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"APIC\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"BHYVE \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVMADT  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");

	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0004]\t\tLocal Apic Address : FEE00000\n");
	EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
	EFPRINTF(fp, "\t\t\tPC-AT Compatibility : 1\n");
	EFPRINTF(fp, "\n");

	/* Add a Processor Local APIC entry for each CPU */
	for (i = 0; i < basl_ncpu; i++) {
		EFPRINTF(fp, "[0001]\t\tSubtable Type : 00\n");
		EFPRINTF(fp, "[0001]\t\tLength : 08\n");
		/* iasl expects hex values for the proc and apic id's */
		EFPRINTF(fp, "[0001]\t\tProcessor ID : %02x\n", i);
		EFPRINTF(fp, "[0001]\t\tLocal Apic ID : %02x\n", i);
		EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
		EFPRINTF(fp, "\t\t\tProcessor Enabled : 1\n");
		EFPRINTF(fp, "\n");
	}

	/* Always a single IOAPIC entry, with ID 0 */
	EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n");
	EFPRINTF(fp, "[0001]\t\tLength : 0C\n");
	/* iasl expects a hex value for the i/o apic id */
	EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0);
	EFPRINTF(fp, "[0001]\t\tReserved : 00\n");
	EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n");
	EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n");
	EFPRINTF(fp, "\n");

	/* Legacy IRQ0 is connected to pin 2 of the IOAPIC */
	EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n");
	EFPRINTF(fp, "[0001]\t\tLength : 0A\n");
	EFPRINTF(fp, "[0001]\t\tBus : 00\n");
	EFPRINTF(fp, "[0001]\t\tSource : 00\n");
	EFPRINTF(fp, "[0004]\t\tInterrupt : 00000002\n");
	EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n");
	EFPRINTF(fp, "\t\t\tPolarity : 1\n");
	EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n");
	EFPRINTF(fp, "[0001]\t\tLength : 0A\n");
	EFPRINTF(fp, "[0001]\t\tBus : 00\n");
	EFPRINTF(fp, "[0001]\t\tSource : %02X\n", SCI_INT);
	EFPRINTF(fp, "[0004]\t\tInterrupt : %08X\n", SCI_INT);
	EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0000\n");
	EFPRINTF(fp, "\t\t\tPolarity : 3\n");
	EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n");
	EFPRINTF(fp, "\n");

	/* Local APIC NMI is connected to LINT 1 on all CPUs */
	EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n");
	EFPRINTF(fp, "[0001]\t\tLength : 06\n");
	EFPRINTF(fp, "[0001]\t\tProcessorId : FF\n");
	EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n");
	EFPRINTF(fp, "\t\t\tPolarity : 1\n");
	EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n");
	EFPRINTF(fp, "[0001]\t\tInterrupt : 01\n");
	EFPRINTF(fp, "\n");

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #7
0
static int
basl_fwrite_xsdt(FILE *fp)
{
	int err;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve XSDT template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"XSDT\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"BHYVE \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVXSDT  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");
	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "\n");

	/* Add in pointers to the MADT, FADT and HPET */
	EFPRINTF(fp, "[0004]\t\tACPI Table Address 0 : 00000000%08X\n",
	    basl_acpi_base + MADT_OFFSET);
	EFPRINTF(fp, "[0004]\t\tACPI Table Address 1 : 00000000%08X\n",
	    basl_acpi_base + FADT_OFFSET);
	EFPRINTF(fp, "[0004]\t\tACPI Table Address 2 : 00000000%08X\n",
	    basl_acpi_base + HPET_OFFSET);
	EFPRINTF(fp, "[0004]\t\tACPI Table Address 3 : 00000000%08X\n",
	    basl_acpi_base + MCFG_OFFSET);

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #8
0
static int
basl_fwrite_rsdp(FILE *fp)
{
	int err;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve RSDP template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0008]\t\tSignature : \"RSD PTR \"\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 43\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"BHYVE \"\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 02\n");
	EFPRINTF(fp, "[0004]\t\tRSDT Address : %08X\n",
	    basl_acpi_base + RSDT_OFFSET);
	EFPRINTF(fp, "[0004]\t\tLength : 00000024\n");
	EFPRINTF(fp, "[0008]\t\tXSDT Address : 00000000%08X\n",
	    basl_acpi_base + XSDT_OFFSET);
	EFPRINTF(fp, "[0001]\t\tExtended Checksum : 00\n");
	EFPRINTF(fp, "[0003]\t\tReserved : 000000\n");

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #9
0
static int
basl_fwrite_xsdt(FILE *fp, struct vmctx *ctx)
{
	uint32_t num = 0U;
	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * dm XSDT template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"XSDT\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"DM \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"DMXSDT  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");
	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "\n");

	/* Add in pointers to the MADT, FADT, HPET and TPM2 */
	EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++,
	    basl_acpi_base + MADT_OFFSET);
	EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++,
	    basl_acpi_base + FADT_OFFSET);
	EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++,
	    basl_acpi_base + HPET_OFFSET);
	EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++,
	    basl_acpi_base + MCFG_OFFSET);

	if (acpi_table_is_valid(NHLT_ENTRY_NO))
		EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++,
		    basl_acpi_base + NHLT_OFFSET);

	if (ctx->tpm_dev)
		EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++,
		    basl_acpi_base + TPM2_OFFSET);

	if (acpi_table_is_valid(PSDS_ENTRY_NO))
		EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++,
		    basl_acpi_base + PSDS_OFFSET);
	EFFLUSH(fp);

	return 0;
}
Example #10
0
static int
basl_fwrite_madt(FILE *fp)
{
	int err;
	int i;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve MADT template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"APIC\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"BHYVE \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVMADT  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");

	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0004]\t\tLocal Apic Address : FEE00000\n");
	EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
	EFPRINTF(fp, "\t\t\tPC-AT Compatibility : 1\n");
	EFPRINTF(fp, "\n");

	/* Add a Processor Local APIC entry for each CPU */
	for (i = 0; i < basl_ncpu; i++) {
		EFPRINTF(fp, "[0001]\t\tSubtable Type : 00\n");
		EFPRINTF(fp, "[0001]\t\tLength : 08\n");
		EFPRINTF(fp, "[0001]\t\tProcessor ID : %02d\n", i);
		EFPRINTF(fp, "[0001]\t\tLocal Apic ID : %02d\n", i);
		EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
		EFPRINTF(fp, "\t\t\tProcessor Enabled : 1\n");
		EFPRINTF(fp, "\n");
	}

	/* Always a single IOAPIC entry, with ID ncpu+1 */
	EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n");
	EFPRINTF(fp, "[0001]\t\tLength : 0C\n");
	EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02d\n", basl_ncpu);
	EFPRINTF(fp, "[0001]\t\tReserved : 00\n");
	EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n");
	EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n");
	EFPRINTF(fp, "\n");

	/* Override the 8259 chained vector. XXX maybe not needed */
	EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n");
	EFPRINTF(fp, "[0001]\t\tLength : 0A\n");
	EFPRINTF(fp, "[0001]\t\tBus : 00\n");
	EFPRINTF(fp, "[0001]\t\tSource : 09\n");
	EFPRINTF(fp, "[0004]\t\tInterrupt : 00000009\n");
	EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0000\n");
	EFPRINTF(fp, "\t\t\tPolarity : 0\n");
	EFPRINTF(fp, "\t\t\tTrigger Mode : 0\n");
	EFPRINTF(fp, "\n");

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #11
0
static int
basl_fwrite_tpm2(FILE *fp, struct vmctx *ctx)
{
	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * dm TPM2 template\n");
	EFPRINTF(fp, " */\n");

	EFPRINTF(fp, "[0004]\t\tSignature : \"TPM2\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 0000004C\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 00\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"ACRNDM\"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"DMTPM2  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000000\n");

	/* iasl will fill the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");

	EFPRINTF(fp, "[0002]\t\tPlatform Class : 0000\n");
	EFPRINTF(fp, "[0002]\t\tReserved : 0000\n");
	EFPRINTF(fp, "[0008]\t\tControl Address : %016lX\n", (long)CRB_REGS_CTRL_REQ);
	EFPRINTF(fp, "[0004]\t\tStart Method : 00000007\n");

	EFPRINTF(fp, "[0012]\t\tMethod Parameters : 00 00 00 00 00 00 00 00 00 00 00 00\n");
	EFPRINTF(fp, "[0004]\t\tMinimum Log Length : 00000000\n");
	EFPRINTF(fp, "[0008]\t\tLog Address : 0000000000000000\n");

	EFFLUSH(fp);

	return 0;
}
Example #12
0
/* Intel Platform Security Discovery is designed specifically to allow other applications at
 * runtime to know what hardware security capabilities are available on the platform.
 * Format of the PSD structure:
 * [0024] 36 byte common header
 * [0004] PSD Version
 * [0004] CSME Sec Capabilities
 * [0002] SGX Capabilities
 * [0004] FW Version Minor
 * [0004] FW Version Major
 * [0004] FW Version Build Number
 * [0004] FW Version Hot Fix
 * [0010] FW Vendor
 * [0001] EOM State
 * [0001] Secure Boot Enabled
 * [0001] Measured Boot Enabled
 * [0001] Hwrot Type
 * [0001] fwHashIndex
 * [0001] fwHashDataLen
 * [xxxx] fwHashData (if fwHashDataLen != 0)
 */
static int
basl_fwrite_psds(FILE *fp, struct vmctx *ctx)
{
	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * dm PSDS template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"PSDS\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 00\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"INTEL \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"EDK2    \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");
	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");

	/* passthru the following @36 - 4 bytes:
	 * [0004]PSD Version
	 */
	if (copy_table_pos_len(psds_fd, 36, 4, fp) != 0) {
		fprintf(stderr, "Failed to read psds table!\n");
		return -1;
	}

	EFPRINTF(fp, "UINT32 : %08X\n", csme_sec_cap);		/* [0004]CSME Sec Capabilities */
	EFPRINTF(fp, "UINT16 : 0000\n");			/* [0002]SGX Capabilities */

	/* passthru the following @46 - 33 bytes:
	 * [0010]FW Versions
	 * [0010]FW Vendor
	 * [0001]EOM State
	 */
	if (copy_table_pos_len(psds_fd, 46, 33, fp) !=0) {
		fprintf(stderr, "Failed to read psds table!\n");
		return -1;
	}

	EFPRINTF(fp, "UINT8 : 00\n");				/* [0001]Secure Boot Enabled */
	EFPRINTF(fp, "UINT8 : 00\n");				/* [0001]Measured Boot Enabled */
	EFPRINTF(fp, "UINT8 : 00\n");				/* [0001]Hwrot Type */
	EFPRINTF(fp, "UINT8 : 00\n");				/* [0001]fwHashIndex */
	EFPRINTF(fp, "UINT8 : 00\n");				/* [0001]fwHashDataLen */

	EFFLUSH(fp);
	return 0;
}
Example #13
0
static int
basl_fwrite_nhlt(FILE *fp, struct vmctx *ctx)
{
	int offset, len;
	uint8_t data;
	int fd = open("/sys/firmware/acpi/tables/NHLT", O_RDONLY);

	if (fd < 0) {
		fprintf(stderr, "Open host NHLT fail! %s\n", strerror(errno));
		return -1;
	}


	audio_nhlt_len = lseek(fd, 0, SEEK_END);
	/* check if file size exceeds reserved room */
	if (audio_nhlt_len > DSDT_OFFSET - NHLT_OFFSET) {
		fprintf(stderr, "Host NHLT exceeds reserved room!\n");
		close(fd);
		return -1;
	}

	/* skip 36 bytes as NHLT table header */
	offset = lseek(fd, 36, SEEK_SET);
	if (offset != 36) {
		fprintf(stderr, "Seek NHLT data fail! %s\n", strerror(errno));
		close(fd);
		return -1;
	}

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * dm NHLT template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"NHLT\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 00\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"INTEL \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"NHLT-GPA\"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000003\n");

	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");

	while ((len = read(fd, &data, 1)) == 1)
		EFPRINTF(fp, "UINT8 : %02X\n", data);

	if (len < 0) {
		fprintf(stderr, "Read host NHLT fail! %s\n", strerror(errno));
		close(fd);
		return -1;
	}

	EFFLUSH(fp);
	close(fd);

	return 0;
}
Example #14
0
static int
basl_fwrite_mcfg(FILE *fp, struct vmctx *ctx)
{
	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * dm MCFG template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"MCFG\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"DM \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"DMMCFG  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");

	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "[0008]\t\tReserved : 0\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0008]\t\tBase Address : %016lX\n", pci_ecfg_base());
	EFPRINTF(fp, "[0002]\t\tSegment Group: 0000\n");
	EFPRINTF(fp, "[0001]\t\tStart Bus: 00\n");
	EFPRINTF(fp, "[0001]\t\tEnd Bus: FF\n");
	EFPRINTF(fp, "[0004]\t\tReserved : 0\n");
	EFFLUSH(fp);

	return 0;
}
Example #15
0
static int
basl_fwrite_hpet(FILE *fp, struct vmctx *ctx)
{
	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * dm HPET template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"HPET\"\n");
	EFPRINTF(fp, "[0004]\t\tTable Length : 00000000\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 01\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 00\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"DM \"\n");
	EFPRINTF(fp, "[0008]\t\tOem Table ID : \"DMHPET  \"\n");
	EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");

	/* iasl will fill in the compiler ID/revision fields */
	EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
	EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0004]\t\tTimer Block ID : %08X\n",
	    (uint32_t)vhpet_capabilities());
	EFPRINTF(fp,
	    "[0012]\t\tTimer Block Register : [Generic Address Structure]\n");
	EFPRINTF(fp, "[0001]\t\tSpace ID : 00 [SystemMemory]\n");
	EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
	EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
	EFPRINTF(fp,
		 "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
	EFPRINTF(fp, "[0008]\t\tAddress : %016X\n", VHPET_BASE);
	EFPRINTF(fp, "\n");

	EFPRINTF(fp, "[0001]\t\tHPET Number : 00\n");
	EFPRINTF(fp, "[0002]\t\tMinimum Clock Ticks : 0000\n");
	EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
	EFPRINTF(fp, "\t\t\t4K Page Protect : 1\n");
	EFPRINTF(fp, "\t\t\t64K Page Protect : 0\n");
	EFPRINTF(fp, "\n");

	EFFLUSH(fp);

	return 0;
}
Example #16
0
static int
basl_fwrite_facs(FILE *fp)
{
	int err;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve FACS template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0004]\t\tSignature : \"FACS\"\n");
	EFPRINTF(fp, "[0004]\t\tLength : 00000040\n");
	EFPRINTF(fp, "[0004]\t\tHardware Signature : 00000000\n");
	EFPRINTF(fp, "[0004]\t\t32 Firmware Waking Vector : 00000000\n");
	EFPRINTF(fp, "[0004]\t\tGlobal Lock : 00000000\n");
	EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000000\n");
	EFPRINTF(fp, "\t\t\tS4BIOS Support Present : 0\n");
	EFPRINTF(fp, "\t\t\t64-bit Wake Supported (V2) : 0\n");
	EFPRINTF(fp,
	    "[0008]\t\t64 Firmware Waking Vector : 0000000000000000\n");
	EFPRINTF(fp, "[0001]\t\tVersion : 02\n");
	EFPRINTF(fp, "[0003]\t\tReserved : 000000\n");
	EFPRINTF(fp, "[0004]\t\tOspmFlags (decoded below) : 00000000\n");
	EFPRINTF(fp, "\t\t\t64-bit Wake Env Required (V2) : 0\n");

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #17
0
static int
basl_fwrite_dsdt(FILE *fp)
{
	int err;

	err = 0;

	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * bhyve DSDT template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "DefinitionBlock (\"bhyve_dsdt.aml\", \"DSDT\", 2,"
		 "\"BHYVE \", \"BVDSDT  \", 0x00000001)\n");
	EFPRINTF(fp, "{\n");
	EFPRINTF(fp, "  Scope (_SB)\n");
	EFPRINTF(fp, "  {\n");
	EFPRINTF(fp, "    Device (PCI0)\n");
	EFPRINTF(fp, "    {\n");
	EFPRINTF(fp, "      Name (_HID, EisaId (\"PNP0A03\"))\n");
	EFPRINTF(fp, "      Name (_ADR, Zero)\n");
	EFPRINTF(fp, "      Name (_UID, One)\n");
	EFPRINTF(fp, "      Name (_CRS, ResourceTemplate ()\n");
	EFPRINTF(fp, "      {\n");
	EFPRINTF(fp, "        WordBusNumber (ResourceProducer, MinFixed,"
		 "MaxFixed, PosDecode,\n");
	EFPRINTF(fp, "            0x0000,             // Granularity\n");
	EFPRINTF(fp, "            0x0000,             // Range Minimum\n");
	EFPRINTF(fp, "            0x00FF,             // Range Maximum\n");
	EFPRINTF(fp, "            0x0000,             // Transl Offset\n");
	EFPRINTF(fp, "            0x0100,             // Length\n");
	EFPRINTF(fp, "            ,, )\n");
	EFPRINTF(fp, "         IO (Decode16,\n");
	EFPRINTF(fp, "            0x0CF8,             // Range Minimum\n");
	EFPRINTF(fp, "            0x0CF8,             // Range Maximum\n");
	EFPRINTF(fp, "            0x01,               // Alignment\n");
	EFPRINTF(fp, "            0x08,               // Length\n");
	EFPRINTF(fp, "            )\n");
	EFPRINTF(fp, "         WordIO (ResourceProducer, MinFixed, MaxFixed,"
		 "PosDecode, EntireRange,\n");
	EFPRINTF(fp, "            0x0000,             // Granularity\n");
	EFPRINTF(fp, "            0x0000,             // Range Minimum\n");
	EFPRINTF(fp, "            0x0CF7,             // Range Maximum\n");
	EFPRINTF(fp, "            0x0000,             // Transl Offset\n");
	EFPRINTF(fp, "            0x0CF8,             // Length\n");
	EFPRINTF(fp, "            ,, , TypeStatic)\n");
	EFPRINTF(fp, "         WordIO (ResourceProducer, MinFixed, MaxFixed,"
		 "PosDecode, EntireRange,\n");
	EFPRINTF(fp, "            0x0000,             // Granularity\n");
	EFPRINTF(fp, "            0x0D00,             // Range Minimum\n");
	EFPRINTF(fp, "            0xFFFF,             // Range Maximum\n");
	EFPRINTF(fp, "            0x0000,             // Transl Offset\n");
	EFPRINTF(fp, "            0xF300,             // Length\n");
	EFPRINTF(fp, "             ,, , TypeStatic)\n");
	EFPRINTF(fp, "          })\n");
	EFPRINTF(fp, "     }\n");
	EFPRINTF(fp, "  }\n");
	EFPRINTF(fp, "\n");
	EFPRINTF(fp, "  Scope (_SB.PCI0)\n");
	EFPRINTF(fp, "  {\n");
	EFPRINTF(fp, "    Device (ISA)\n");
	EFPRINTF(fp, "    {\n");
	EFPRINTF(fp, "      Name (_ADR, 0x00010000)\n");
	EFPRINTF(fp, "      OperationRegion (P40C, PCI_Config, 0x60, 0x04)\n");
	EFPRINTF(fp, "    }\n");
	EFPRINTF(fp, "  }\n");
	EFPRINTF(fp, "\n");
	EFPRINTF(fp, "  Scope (_SB.PCI0.ISA)\n");
        EFPRINTF(fp, "  {\n");
	EFPRINTF(fp, "    Device (RTC)\n");
        EFPRINTF(fp, "    {\n");
	EFPRINTF(fp, "      Name (_HID, EisaId (\"PNP0B00\"))\n");
	EFPRINTF(fp, "      Name (_CRS, ResourceTemplate ()\n");
	EFPRINTF(fp, "      {\n");
	EFPRINTF(fp, "        IO (Decode16,\n");
	EFPRINTF(fp, "            0x0070,             // Range Minimum\n");
	EFPRINTF(fp, "            0x0070,             // Range Maximum\n");
	EFPRINTF(fp, "            0x10,               // Alignment\n");
	EFPRINTF(fp, "            0x02,               // Length\n");
	EFPRINTF(fp, "            )\n");
	EFPRINTF(fp, "        IRQNoFlags ()\n");
	EFPRINTF(fp, "            {8}\n");
	EFPRINTF(fp, "        IO (Decode16,\n");
	EFPRINTF(fp, "            0x0072,             // Range Minimum\n");
	EFPRINTF(fp, "            0x0072,             // Range Maximum\n");
	EFPRINTF(fp, "            0x02,               // Alignment\n");
	EFPRINTF(fp, "            0x06,               // Length\n");
	EFPRINTF(fp, "            )\n");
	EFPRINTF(fp, "      })\n");
        EFPRINTF(fp, "    }\n");
	EFPRINTF(fp, "  }\n");
	EFPRINTF(fp, "}\n");

	EFFLUSH(fp);

	return (0);

err_exit:
	return (errno);
}
Example #18
0
static int
basl_fwrite_rsdp(FILE *fp, struct vmctx *ctx)
{
	EFPRINTF(fp, "/*\n");
	EFPRINTF(fp, " * dm RSDP template\n");
	EFPRINTF(fp, " */\n");
	EFPRINTF(fp, "[0008]\t\tSignature : \"RSD PTR \"\n");
	EFPRINTF(fp, "[0001]\t\tChecksum : 43\n");
	EFPRINTF(fp, "[0006]\t\tOem ID : \"DM \"\n");
	EFPRINTF(fp, "[0001]\t\tRevision : 02\n");
	EFPRINTF(fp, "[0004]\t\tRSDT Address : %08X\n",
	    basl_acpi_base + RSDT_OFFSET);
	EFPRINTF(fp, "[0004]\t\tLength : 00000024\n");
	EFPRINTF(fp, "[0008]\t\tXSDT Address : 00000000%08X\n",
	    basl_acpi_base + XSDT_OFFSET);
	EFPRINTF(fp, "[0001]\t\tExtended Checksum : 00\n");
	EFPRINTF(fp, "[0003]\t\tReserved : 000000\n");

	EFFLUSH(fp);

	return 0;
}