blob: d86f9ee98e9b2acb8c13680d153c20ff016ce036 [file] [log] [blame]
Lee Leahy77ff0b12015-05-05 15:07:29 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Google Inc.
Lee Leahy32471722015-04-20 15:20:28 -07005 * Copyright (C) 2015 Intel Corp.
Lee Leahy77ff0b12015-05-05 15:07:29 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Lee Leahy77ff0b12015-05-05 15:07:29 -070015 */
16
Lee Leahy32471722015-04-20 15:20:28 -070017#ifndef _SOC_PATTRS_H_
18#define _SOC_PATTRS_H_
Lee Leahy77ff0b12015-05-05 15:07:29 -070019
20#include <stdint.h>
21#include <cpu/x86/msr.h>
22
23enum {
24 IACORE_MIN,
25 IACORE_LFM,
26 IACORE_MAX,
27 IACORE_TURBO,
28 IACORE_END
29};
30
Lee Leahy32471722015-04-20 15:20:28 -070031/*
32 * The pattrs structure is a common place to stash pertinent information
Lee Leahy77ff0b12015-05-05 15:07:29 -070033 * about the processor or platform. Instead of going to the source (msrs, cpuid)
34 * every time an attribute is needed use the pattrs structure.
35 */
36struct pattrs {
37 msr_t platform_id;
38 msr_t platform_info;
39 int iacore_ratios[IACORE_END];
40 int iacore_vids[IACORE_END];
41 uint32_t cpuid;
42 int revid;
43 int stepping;
44 const void *microcode_patch;
45 int address_bits;
46 int num_cpus;
Subrata Banik45a221d2015-08-05 17:01:55 +053047 unsigned int bclk_khz;
Lee Leahy77ff0b12015-05-05 15:07:29 -070048};
49
Lee Leahy32471722015-04-20 15:20:28 -070050/*
51 * This is just to hide the abstraction w/o relying on how the underlying
52 * storage is allocated.
53 */
54extern struct pattrs __global_pattrs;
Lee Leahy77ff0b12015-05-05 15:07:29 -070055static inline const struct pattrs *pattrs_get(void)
56{
Lee Leahy32471722015-04-20 15:20:28 -070057 return &__global_pattrs;
Lee Leahy77ff0b12015-05-05 15:07:29 -070058}
59
Lee Leahy32471722015-04-20 15:20:28 -070060#endif /* _SOC_PATTRS_H_ */