summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/CpuHotplugSmm/QemuCpuhp.h
blob: 8bb3c66e9b446f119a7c823e80db5260a1f73487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/** @file
  Simple wrapper functions and utility functions that access QEMU's modern CPU
  hotplug register block.

  These functions manipulate some of the registers described in
  "docs/specs/acpi_cpu_hotplug.txt" in the QEMU source. IO Ports are accessed
  via EFI_MM_CPU_IO_PROTOCOL. If a protocol call fails, these functions don't
  return.

  Copyright (c) 2020, Red Hat, Inc.

  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef QEMU_CPUHP_H_
#define QEMU_CPUHP_H_

#include <Protocol/MmCpuIo.h>  // EFI_MM_CPU_IO_PROTOCOL
#include <Uefi/UefiBaseType.h> // EFI_STATUS

#include "ApicId.h"            // APIC_ID

UINT32
QemuCpuhpReadCommandData2 (
  IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo
  );

UINT8
QemuCpuhpReadCpuStatus (
  IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo
  );

UINT32
QemuCpuhpReadCommandData (
  IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo
  );

VOID
QemuCpuhpWriteCpuSelector (
  IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
  IN UINT32                       Selector
  );

VOID
QemuCpuhpWriteCpuStatus (
  IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
  IN UINT8                        CpuStatus
  );

VOID
QemuCpuhpWriteCommand (
  IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
  IN UINT8                        Command
  );

EFI_STATUS
QemuCpuhpCollectApicIds (
  IN  CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
  IN  UINT32                       PossibleCpuCount,
  IN  UINT32                       ApicIdCount,
  OUT APIC_ID                      *PluggedApicIds,
  OUT UINT32                       *PluggedCount,
  OUT APIC_ID                      *ToUnplugApicIds,
  OUT UINT32                       *ToUnplugSelectors,
  OUT UINT32                       *ToUnplugCount
  );

#endif // QEMU_CPUHP_H_