1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* Copyright (c) 2021 Intel Corporation */ 3 4 #ifndef __LINUX_PECI_CPU_H 5 #define __LINUX_PECI_CPU_H 6 7 #include <linux/types.h> 8 9 /* Copied from x86 <asm/processor.h> */ 10 #define X86_VENDOR_INTEL 0 11 12 /* Copied from x86 <asm/cpu_device_id.h> */ 13 #define VFM_MODEL_BIT 0 14 #define VFM_FAMILY_BIT 8 15 #define VFM_VENDOR_BIT 16 16 #define VFM_RSVD_BIT 24 17 18 #define VFM_MODEL_MASK GENMASK(VFM_FAMILY_BIT - 1, VFM_MODEL_BIT) 19 #define VFM_FAMILY_MASK GENMASK(VFM_VENDOR_BIT - 1, VFM_FAMILY_BIT) 20 #define VFM_VENDOR_MASK GENMASK(VFM_RSVD_BIT - 1, VFM_VENDOR_BIT) 21 22 #define VFM_MODEL(vfm) (((vfm) & VFM_MODEL_MASK) >> VFM_MODEL_BIT) 23 #define VFM_FAMILY(vfm) (((vfm) & VFM_FAMILY_MASK) >> VFM_FAMILY_BIT) 24 #define VFM_VENDOR(vfm) (((vfm) & VFM_VENDOR_MASK) >> VFM_VENDOR_BIT) 25 26 #define VFM_MAKE(_vendor, _family, _model) ( \ 27 ((_model) << VFM_MODEL_BIT) | \ 28 ((_family) << VFM_FAMILY_BIT) | \ 29 ((_vendor) << VFM_VENDOR_BIT) \ 30 ) 31 /* End of copied code */ 32 33 #include "../../arch/x86/include/asm/intel-family.h" 34 35 #define PECI_PCS_PKG_ID 0 /* Package Identifier Read */ 36 #define PECI_PKG_ID_CPU_ID 0x0000 /* CPUID Info */ 37 #define PECI_PKG_ID_PLATFORM_ID 0x0001 /* Platform ID */ 38 #define PECI_PKG_ID_DEVICE_ID 0x0002 /* Uncore Device ID */ 39 #define PECI_PKG_ID_MAX_THREAD_ID 0x0003 /* Max Thread ID */ 40 #define PECI_PKG_ID_MICROCODE_REV 0x0004 /* CPU Microcode Update Revision */ 41 #define PECI_PKG_ID_MCA_ERROR_LOG 0x0005 /* Machine Check Status */ 42 #define PECI_PCS_MODULE_TEMP 9 /* Per Core DTS Temperature Read */ 43 #define PECI_PCS_THERMAL_MARGIN 10 /* DTS thermal margin */ 44 #define PECI_PCS_DDR_DIMM_TEMP 14 /* DDR DIMM Temperature */ 45 #define PECI_PCS_TEMP_TARGET 16 /* Temperature Target Read */ 46 #define PECI_PCS_TDP_UNITS 30 /* Units for power/energy registers */ 47 48 struct peci_device; 49 50 int peci_temp_read(struct peci_device *device, s16 *temp_raw); 51 52 int peci_pcs_read(struct peci_device *device, u8 index, 53 u16 param, u32 *data); 54 55 int peci_pci_local_read(struct peci_device *device, u8 bus, u8 dev, 56 u8 func, u16 reg, u32 *data); 57 58 int peci_ep_pci_local_read(struct peci_device *device, u8 seg, 59 u8 bus, u8 dev, u8 func, u16 reg, u32 *data); 60 61 int peci_mmio_read(struct peci_device *device, u8 bar, u8 seg, 62 u8 bus, u8 dev, u8 func, u64 address, u32 *data); 63 64 #endif /* __LINUX_PECI_CPU_H */ 65