peci, hwmon: Switch to new Intel CPU model defines
Update peci subsystem to use the same vendor-family-model combined definition that core x86 code uses. Signed-off-by: Tony Luck <tony.luck@intel.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com> Link: https://lore.kernel.org/r/20240529171920.62571-1-tony.luck@intel.com Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
This commit is contained in:
parent
6ba59ff422
commit
a43b9ec091
@ -360,10 +360,10 @@ static int init_core_mask(struct peci_cputemp *priv)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Get the RESOLVED_CORES register value */
|
/* Get the RESOLVED_CORES register value */
|
||||||
switch (peci_dev->info.model) {
|
switch (peci_dev->info.x86_vfm) {
|
||||||
case INTEL_FAM6_ICELAKE_X:
|
case INTEL_ICELAKE_X:
|
||||||
case INTEL_FAM6_ICELAKE_D:
|
case INTEL_ICELAKE_D:
|
||||||
case INTEL_FAM6_SAPPHIRERAPIDS_X:
|
case INTEL_SAPPHIRERAPIDS_X:
|
||||||
ret = peci_ep_pci_local_read(peci_dev, 0, reg->bus, reg->dev,
|
ret = peci_ep_pci_local_read(peci_dev, 0, reg->bus, reg->dev,
|
||||||
reg->func, reg->offset + 4, &data);
|
reg->func, reg->offset + 4, &data);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -163,9 +163,8 @@ EXPORT_SYMBOL_NS_GPL(devm_peci_controller_add, PECI);
|
|||||||
static const struct peci_device_id *
|
static const struct peci_device_id *
|
||||||
peci_bus_match_device_id(const struct peci_device_id *id, struct peci_device *device)
|
peci_bus_match_device_id(const struct peci_device_id *id, struct peci_device *device)
|
||||||
{
|
{
|
||||||
while (id->family != 0) {
|
while (id->x86_vfm != 0) {
|
||||||
if (id->family == device->info.family &&
|
if (id->x86_vfm == device->info.x86_vfm)
|
||||||
id->model == device->info.model)
|
|
||||||
return id;
|
return id;
|
||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
|
@ -294,38 +294,31 @@ peci_cpu_probe(struct peci_device *device, const struct peci_device_id *id)
|
|||||||
|
|
||||||
static const struct peci_device_id peci_cpu_device_ids[] = {
|
static const struct peci_device_id peci_cpu_device_ids[] = {
|
||||||
{ /* Haswell Xeon */
|
{ /* Haswell Xeon */
|
||||||
.family = 6,
|
.x86_vfm = INTEL_HASWELL_X,
|
||||||
.model = INTEL_FAM6_HASWELL_X,
|
|
||||||
.data = "hsx",
|
.data = "hsx",
|
||||||
},
|
},
|
||||||
{ /* Broadwell Xeon */
|
{ /* Broadwell Xeon */
|
||||||
.family = 6,
|
.x86_vfm = INTEL_BROADWELL_X,
|
||||||
.model = INTEL_FAM6_BROADWELL_X,
|
|
||||||
.data = "bdx",
|
.data = "bdx",
|
||||||
},
|
},
|
||||||
{ /* Broadwell Xeon D */
|
{ /* Broadwell Xeon D */
|
||||||
.family = 6,
|
.x86_vfm = INTEL_BROADWELL_D,
|
||||||
.model = INTEL_FAM6_BROADWELL_D,
|
|
||||||
.data = "bdxd",
|
.data = "bdxd",
|
||||||
},
|
},
|
||||||
{ /* Skylake Xeon */
|
{ /* Skylake Xeon */
|
||||||
.family = 6,
|
.x86_vfm = INTEL_SKYLAKE_X,
|
||||||
.model = INTEL_FAM6_SKYLAKE_X,
|
|
||||||
.data = "skx",
|
.data = "skx",
|
||||||
},
|
},
|
||||||
{ /* Icelake Xeon */
|
{ /* Icelake Xeon */
|
||||||
.family = 6,
|
.x86_vfm = INTEL_ICELAKE_X,
|
||||||
.model = INTEL_FAM6_ICELAKE_X,
|
|
||||||
.data = "icx",
|
.data = "icx",
|
||||||
},
|
},
|
||||||
{ /* Icelake Xeon D */
|
{ /* Icelake Xeon D */
|
||||||
.family = 6,
|
.x86_vfm = INTEL_ICELAKE_D,
|
||||||
.model = INTEL_FAM6_ICELAKE_D,
|
|
||||||
.data = "icxd",
|
.data = "icxd",
|
||||||
},
|
},
|
||||||
{ /* Sapphire Rapids Xeon */
|
{ /* Sapphire Rapids Xeon */
|
||||||
.family = 6,
|
.x86_vfm = INTEL_SAPPHIRERAPIDS_X,
|
||||||
.model = INTEL_FAM6_SAPPHIRERAPIDS_X,
|
|
||||||
.data = "spr",
|
.data = "spr",
|
||||||
},
|
},
|
||||||
{ }
|
{ }
|
||||||
|
@ -100,8 +100,7 @@ static int peci_device_info_init(struct peci_device *device)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
device->info.family = peci_x86_cpu_family(cpu_id);
|
device->info.x86_vfm = IFM(peci_x86_cpu_family(cpu_id), peci_x86_cpu_model(cpu_id));
|
||||||
device->info.model = peci_x86_cpu_model(cpu_id);
|
|
||||||
|
|
||||||
ret = peci_get_revision(device, &revision);
|
ret = peci_get_revision(device, &revision);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -66,13 +66,11 @@ struct peci_request *peci_xfer_ep_mmio64_readl(struct peci_device *device, u8 ba
|
|||||||
/**
|
/**
|
||||||
* struct peci_device_id - PECI device data to match
|
* struct peci_device_id - PECI device data to match
|
||||||
* @data: pointer to driver private data specific to device
|
* @data: pointer to driver private data specific to device
|
||||||
* @family: device family
|
* @x86_vfm: device vendor-family-model
|
||||||
* @model: device model
|
|
||||||
*/
|
*/
|
||||||
struct peci_device_id {
|
struct peci_device_id {
|
||||||
const void *data;
|
const void *data;
|
||||||
u16 family;
|
u32 x86_vfm;
|
||||||
u8 model;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct device_type peci_device_type;
|
extern const struct device_type peci_device_type;
|
||||||
|
@ -6,6 +6,30 @@
|
|||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
|
/* Copied from x86 <asm/processor.h> */
|
||||||
|
#define X86_VENDOR_INTEL 0
|
||||||
|
|
||||||
|
/* Copied from x86 <asm/cpu_device_id.h> */
|
||||||
|
#define VFM_MODEL_BIT 0
|
||||||
|
#define VFM_FAMILY_BIT 8
|
||||||
|
#define VFM_VENDOR_BIT 16
|
||||||
|
#define VFM_RSVD_BIT 24
|
||||||
|
|
||||||
|
#define VFM_MODEL_MASK GENMASK(VFM_FAMILY_BIT - 1, VFM_MODEL_BIT)
|
||||||
|
#define VFM_FAMILY_MASK GENMASK(VFM_VENDOR_BIT - 1, VFM_FAMILY_BIT)
|
||||||
|
#define VFM_VENDOR_MASK GENMASK(VFM_RSVD_BIT - 1, VFM_VENDOR_BIT)
|
||||||
|
|
||||||
|
#define VFM_MODEL(vfm) (((vfm) & VFM_MODEL_MASK) >> VFM_MODEL_BIT)
|
||||||
|
#define VFM_FAMILY(vfm) (((vfm) & VFM_FAMILY_MASK) >> VFM_FAMILY_BIT)
|
||||||
|
#define VFM_VENDOR(vfm) (((vfm) & VFM_VENDOR_MASK) >> VFM_VENDOR_BIT)
|
||||||
|
|
||||||
|
#define VFM_MAKE(_vendor, _family, _model) ( \
|
||||||
|
((_model) << VFM_MODEL_BIT) | \
|
||||||
|
((_family) << VFM_FAMILY_BIT) | \
|
||||||
|
((_vendor) << VFM_VENDOR_BIT) \
|
||||||
|
)
|
||||||
|
/* End of copied code */
|
||||||
|
|
||||||
#include "../../arch/x86/include/asm/intel-family.h"
|
#include "../../arch/x86/include/asm/intel-family.h"
|
||||||
|
|
||||||
#define PECI_PCS_PKG_ID 0 /* Package Identifier Read */
|
#define PECI_PCS_PKG_ID 0 /* Package Identifier Read */
|
||||||
|
@ -59,8 +59,7 @@ static inline struct peci_controller *to_peci_controller(void *d)
|
|||||||
* struct peci_device - PECI device
|
* struct peci_device - PECI device
|
||||||
* @dev: device object to register PECI device to the device model
|
* @dev: device object to register PECI device to the device model
|
||||||
* @info: PECI device characteristics
|
* @info: PECI device characteristics
|
||||||
* @info.family: device family
|
* @info.x86_vfm: device vendor-family-model
|
||||||
* @info.model: device model
|
|
||||||
* @info.peci_revision: PECI revision supported by the PECI device
|
* @info.peci_revision: PECI revision supported by the PECI device
|
||||||
* @info.socket_id: the socket ID represented by the PECI device
|
* @info.socket_id: the socket ID represented by the PECI device
|
||||||
* @addr: address used on the PECI bus connected to the parent controller
|
* @addr: address used on the PECI bus connected to the parent controller
|
||||||
@ -73,8 +72,7 @@ static inline struct peci_controller *to_peci_controller(void *d)
|
|||||||
struct peci_device {
|
struct peci_device {
|
||||||
struct device dev;
|
struct device dev;
|
||||||
struct {
|
struct {
|
||||||
u16 family;
|
u32 x86_vfm;
|
||||||
u8 model;
|
|
||||||
u8 peci_revision;
|
u8 peci_revision;
|
||||||
u8 socket_id;
|
u8 socket_id;
|
||||||
} info;
|
} info;
|
||||||
|
Loading…
Reference in New Issue
Block a user