acpi.c (4c87aefe) acpi.c (154972af)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 NetApp, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 60 unchanged lines hidden (view full) ---

69#include <unistd.h>
70
71#include <machine/vmm.h>
72#include <vmmapi.h>
73
74#include "bhyverun.h"
75#include "acpi.h"
76#include "pci_emul.h"
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 NetApp, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 60 unchanged lines hidden (view full) ---

69#include <unistd.h>
70
71#include <machine/vmm.h>
72#include <vmmapi.h>
73
74#include "bhyverun.h"
75#include "acpi.h"
76#include "pci_emul.h"
77#include "vmgenc.h"
77
78/*
79 * Define the base address of the ACPI tables, the sizes of some tables,
80 * and the offsets to the individual tables,
81 */
82#define BHYVE_ACPI_BASE 0xf2400
83#define RSDT_OFFSET 0x040
84#define XSDT_OFFSET 0x080

--- 227 unchanged lines hidden (view full) ---

312 EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0000\n");
313 EFPRINTF(fp, "\t\t\tPolarity : 3\n");
314 EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n");
315 EFPRINTF(fp, "\n");
316
317 /* Local APIC NMI is connected to LINT 1 on all CPUs */
318 EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n");
319 EFPRINTF(fp, "[0001]\t\tLength : 06\n");
78
79/*
80 * Define the base address of the ACPI tables, the sizes of some tables,
81 * and the offsets to the individual tables,
82 */
83#define BHYVE_ACPI_BASE 0xf2400
84#define RSDT_OFFSET 0x040
85#define XSDT_OFFSET 0x080

--- 227 unchanged lines hidden (view full) ---

313 EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0000\n");
314 EFPRINTF(fp, "\t\t\tPolarity : 3\n");
315 EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n");
316 EFPRINTF(fp, "\n");
317
318 /* Local APIC NMI is connected to LINT 1 on all CPUs */
319 EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n");
320 EFPRINTF(fp, "[0001]\t\tLength : 06\n");
320 EFPRINTF(fp, "[0001]\t\tProcessorId : FF\n");
321 EFPRINTF(fp, "[0001]\t\tProcessor ID : FF\n");
321 EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n");
322 EFPRINTF(fp, "\t\t\tPolarity : 1\n");
323 EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n");
322 EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n");
323 EFPRINTF(fp, "\t\t\tPolarity : 1\n");
324 EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n");
324 EFPRINTF(fp, "[0001]\t\tInterrupt : 01\n");
325 EFPRINTF(fp, "[0001]\t\tInterrupt Input LINT : 01\n");
325 EFPRINTF(fp, "\n");
326
327 EFFLUSH(fp);
328
329 return (0);
330
331err_exit:
332 return (errno);

--- 37 unchanged lines hidden (view full) ---

370 PM1A_EVT_ADDR);
371 EFPRINTF(fp, "[0004]\t\tPM1B Event Block Address : 00000000\n");
372 EFPRINTF(fp, "[0004]\t\tPM1A Control Block Address : %08X\n",
373 PM1A_CNT_ADDR);
374 EFPRINTF(fp, "[0004]\t\tPM1B Control Block Address : 00000000\n");
375 EFPRINTF(fp, "[0004]\t\tPM2 Control Block Address : 00000000\n");
376 EFPRINTF(fp, "[0004]\t\tPM Timer Block Address : %08X\n",
377 IO_PMTMR);
326 EFPRINTF(fp, "\n");
327
328 EFFLUSH(fp);
329
330 return (0);
331
332err_exit:
333 return (errno);

--- 37 unchanged lines hidden (view full) ---

371 PM1A_EVT_ADDR);
372 EFPRINTF(fp, "[0004]\t\tPM1B Event Block Address : 00000000\n");
373 EFPRINTF(fp, "[0004]\t\tPM1A Control Block Address : %08X\n",
374 PM1A_CNT_ADDR);
375 EFPRINTF(fp, "[0004]\t\tPM1B Control Block Address : 00000000\n");
376 EFPRINTF(fp, "[0004]\t\tPM2 Control Block Address : 00000000\n");
377 EFPRINTF(fp, "[0004]\t\tPM Timer Block Address : %08X\n",
378 IO_PMTMR);
378 EFPRINTF(fp, "[0004]\t\tGPE0 Block Address : 00000000\n");
379 EFPRINTF(fp, "[0004]\t\tGPE0 Block Address : %08X\n", IO_GPE0_BLK);
379 EFPRINTF(fp, "[0004]\t\tGPE1 Block Address : 00000000\n");
380 EFPRINTF(fp, "[0001]\t\tPM1 Event Block Length : 04\n");
381 EFPRINTF(fp, "[0001]\t\tPM1 Control Block Length : 02\n");
382 EFPRINTF(fp, "[0001]\t\tPM2 Control Block Length : 00\n");
383 EFPRINTF(fp, "[0001]\t\tPM Timer Block Length : 04\n");
380 EFPRINTF(fp, "[0004]\t\tGPE1 Block Address : 00000000\n");
381 EFPRINTF(fp, "[0001]\t\tPM1 Event Block Length : 04\n");
382 EFPRINTF(fp, "[0001]\t\tPM1 Control Block Length : 02\n");
383 EFPRINTF(fp, "[0001]\t\tPM2 Control Block Length : 00\n");
384 EFPRINTF(fp, "[0001]\t\tPM Timer Block Length : 04\n");
384 EFPRINTF(fp, "[0001]\t\tGPE0 Block Length : 00\n");
385 EFPRINTF(fp, "[0001]\t\tGPE0 Block Length : %02x\n", IO_GPE0_LEN);
385 EFPRINTF(fp, "[0001]\t\tGPE1 Block Length : 00\n");
386 EFPRINTF(fp, "[0001]\t\tGPE1 Base Offset : 00\n");
387 EFPRINTF(fp, "[0001]\t\t_CST Support : 00\n");
388 EFPRINTF(fp, "[0002]\t\tC2 Latency : 0000\n");
389 EFPRINTF(fp, "[0002]\t\tC3 Latency : 0000\n");
390 EFPRINTF(fp, "[0002]\t\tCPU Cache Size : 0000\n");
391 EFPRINTF(fp, "[0002]\t\tCache Flush Stride : 0000\n");
392 EFPRINTF(fp, "[0001]\t\tDuty Cycle Offset : 00\n");

--- 111 unchanged lines hidden (view full) ---

504 EFPRINTF(fp,
505 "[0001]\t\tEncoded Access Width : 03 [DWord Access:32]\n");
506 EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n",
507 IO_PMTMR);
508 EFPRINTF(fp, "\n");
509
510 EFPRINTF(fp, "[0012]\t\tGPE0 Block : [Generic Address Structure]\n");
511 EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
386 EFPRINTF(fp, "[0001]\t\tGPE1 Block Length : 00\n");
387 EFPRINTF(fp, "[0001]\t\tGPE1 Base Offset : 00\n");
388 EFPRINTF(fp, "[0001]\t\t_CST Support : 00\n");
389 EFPRINTF(fp, "[0002]\t\tC2 Latency : 0000\n");
390 EFPRINTF(fp, "[0002]\t\tC3 Latency : 0000\n");
391 EFPRINTF(fp, "[0002]\t\tCPU Cache Size : 0000\n");
392 EFPRINTF(fp, "[0002]\t\tCache Flush Stride : 0000\n");
393 EFPRINTF(fp, "[0001]\t\tDuty Cycle Offset : 00\n");

--- 111 unchanged lines hidden (view full) ---

505 EFPRINTF(fp,
506 "[0001]\t\tEncoded Access Width : 03 [DWord Access:32]\n");
507 EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n",
508 IO_PMTMR);
509 EFPRINTF(fp, "\n");
510
511 EFPRINTF(fp, "[0012]\t\tGPE0 Block : [Generic Address Structure]\n");
512 EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
512 EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
513 EFPRINTF(fp, "[0001]\t\tBit Width : %02x\n", IO_GPE0_LEN * 8);
513 EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
514 EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n");
514 EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
515 EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n");
515 EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n");
516 EFPRINTF(fp, "[0008]\t\tAddress : %016X\n", IO_GPE0_BLK);
516 EFPRINTF(fp, "\n");
517
518 EFPRINTF(fp, "[0012]\t\tGPE1 Block : [Generic Address Structure]\n");
519 EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
520 EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
521 EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
522 EFPRINTF(fp,
523 "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");

--- 39 unchanged lines hidden (view full) ---

563 EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVHPET \"\n");
564 EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");
565
566 /* iasl will fill in the compiler ID/revision fields */
567 EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
568 EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
569 EFPRINTF(fp, "\n");
570
517 EFPRINTF(fp, "\n");
518
519 EFPRINTF(fp, "[0012]\t\tGPE1 Block : [Generic Address Structure]\n");
520 EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n");
521 EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
522 EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
523 EFPRINTF(fp,
524 "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");

--- 39 unchanged lines hidden (view full) ---

564 EFPRINTF(fp, "[0008]\t\tOem Table ID : \"BVHPET \"\n");
565 EFPRINTF(fp, "[0004]\t\tOem Revision : 00000001\n");
566
567 /* iasl will fill in the compiler ID/revision fields */
568 EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
569 EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
570 EFPRINTF(fp, "\n");
571
571 EFPRINTF(fp, "[0004]\t\tTimer Block ID : %08X\n", hpet_capabilities);
572 EFPRINTF(fp, "[0004]\t\tHardware Block ID : %08X\n", hpet_capabilities);
572 EFPRINTF(fp,
573 "[0012]\t\tTimer Block Register : [Generic Address Structure]\n");
574 EFPRINTF(fp, "[0001]\t\tSpace ID : 00 [SystemMemory]\n");
575 EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
576 EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
577 EFPRINTF(fp,
578 "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
579 EFPRINTF(fp, "[0008]\t\tAddress : 00000000FED00000\n");
580 EFPRINTF(fp, "\n");
581
573 EFPRINTF(fp,
574 "[0012]\t\tTimer Block Register : [Generic Address Structure]\n");
575 EFPRINTF(fp, "[0001]\t\tSpace ID : 00 [SystemMemory]\n");
576 EFPRINTF(fp, "[0001]\t\tBit Width : 00\n");
577 EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n");
578 EFPRINTF(fp,
579 "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n");
580 EFPRINTF(fp, "[0008]\t\tAddress : 00000000FED00000\n");
581 EFPRINTF(fp, "\n");
582
582 EFPRINTF(fp, "[0001]\t\tHPET Number : 00\n");
583 EFPRINTF(fp, "[0001]\t\tSequence Number : 00\n");
583 EFPRINTF(fp, "[0002]\t\tMinimum Clock Ticks : 0000\n");
584 EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
585 EFPRINTF(fp, "\t\t\t4K Page Protect : 1\n");
586 EFPRINTF(fp, "\t\t\t64K Page Protect : 0\n");
587 EFPRINTF(fp, "\n");
588
589 EFFLUSH(fp);
590

--- 19 unchanged lines hidden (view full) ---

610
611 /* iasl will fill in the compiler ID/revision fields */
612 EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
613 EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
614 EFPRINTF(fp, "[0008]\t\tReserved : 0\n");
615 EFPRINTF(fp, "\n");
616
617 EFPRINTF(fp, "[0008]\t\tBase Address : %016lX\n", pci_ecfg_base());
584 EFPRINTF(fp, "[0002]\t\tMinimum Clock Ticks : 0000\n");
585 EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n");
586 EFPRINTF(fp, "\t\t\t4K Page Protect : 1\n");
587 EFPRINTF(fp, "\t\t\t64K Page Protect : 0\n");
588 EFPRINTF(fp, "\n");
589
590 EFFLUSH(fp);
591

--- 19 unchanged lines hidden (view full) ---

611
612 /* iasl will fill in the compiler ID/revision fields */
613 EFPRINTF(fp, "[0004]\t\tAsl Compiler ID : \"xxxx\"\n");
614 EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n");
615 EFPRINTF(fp, "[0008]\t\tReserved : 0\n");
616 EFPRINTF(fp, "\n");
617
618 EFPRINTF(fp, "[0008]\t\tBase Address : %016lX\n", pci_ecfg_base());
618 EFPRINTF(fp, "[0002]\t\tSegment Group: 0000\n");
619 EFPRINTF(fp, "[0001]\t\tStart Bus: 00\n");
620 EFPRINTF(fp, "[0001]\t\tEnd Bus: FF\n");
619 EFPRINTF(fp, "[0002]\t\tSegment Group Number : 0000\n");
620 EFPRINTF(fp, "[0001]\t\tStart Bus Number : 00\n");
621 EFPRINTF(fp, "[0001]\t\tEnd Bus Number : FF\n");
621 EFPRINTF(fp, "[0004]\t\tReserved : 0\n");
622 EFFLUSH(fp);
623 return (0);
624err_exit:
625 return (errno);
626}
627
628static int

--- 130 unchanged lines hidden (view full) ---

759 dsdt_line(" Name (_CRS, ResourceTemplate ()");
760 dsdt_line(" {");
761 dsdt_indent(4);
762 dsdt_fixed_mem32(0xFED00000, 0x400);
763 dsdt_unindent(4);
764 dsdt_line(" })");
765 dsdt_line(" }");
766 dsdt_line(" }");
622 EFPRINTF(fp, "[0004]\t\tReserved : 0\n");
623 EFFLUSH(fp);
624 return (0);
625err_exit:
626 return (errno);
627}
628
629static int

--- 130 unchanged lines hidden (view full) ---

760 dsdt_line(" Name (_CRS, ResourceTemplate ()");
761 dsdt_line(" {");
762 dsdt_indent(4);
763 dsdt_fixed_mem32(0xFED00000, 0x400);
764 dsdt_unindent(4);
765 dsdt_line(" })");
766 dsdt_line(" }");
767 dsdt_line(" }");
768
769 vmgenc_write_dsdt();
770
767 dsdt_line("}");
768
769 if (dsdt_error != 0)
770 return (dsdt_error);
771
772 EFFLUSH(fp);
773
774 return (0);

--- 233 unchanged lines hidden ---
771 dsdt_line("}");
772
773 if (dsdt_error != 0)
774 return (dsdt_error);
775
776 EFFLUSH(fp);
777
778 return (0);

--- 233 unchanged lines hidden ---