blob: 27295955b166cc7426c2e521036fea2b73f3e525 [file] [log] [blame]
Angel Pons6e5aabd2020-03-23 23:44:42 +01001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer00636b02012-04-04 00:08:51 +02002
3#ifndef __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__
Edward O'Callaghan089a5102015-01-06 02:48:57 +11004#define __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__
Stefan Reinauer00636b02012-04-04 00:08:51 +02005
Stefan Reinauer00636b02012-04-04 00:08:51 +02006/* Device ID for SandyBridge and IvyBridge */
7#define BASE_REV_SNB 0x00
8#define BASE_REV_IVB 0x50
9#define BASE_REV_MASK 0x50
10
Angel Ponsdfca1692020-09-14 16:54:42 +020011#include "memmap.h"
Nico Huberbb9469c2015-10-21 11:49:23 +020012
Stefan Reinauer00636b02012-04-04 00:08:51 +020013/* Everything below this line is ignored in the DSDT */
14#ifndef __ACPI__
Angel Pons964d91f2020-12-07 13:11:17 +010015#include <types.h>
Patrick Rudolph74203de2017-11-20 11:57:01 +010016
17/* Chipset types */
18enum platform_type {
19 PLATFORM_MOBILE = 0,
20 PLATFORM_DESKTOP_SERVER,
21};
Stefan Reinauer00636b02012-04-04 00:08:51 +020022
23/* Device 0:0.0 PCI configuration space (Host Bridge) */
Angel Pons7c49cb82020-03-16 23:17:32 +010024#define HOST_BRIDGE PCI_DEV(0, 0, 0)
Stefan Reinauer00636b02012-04-04 00:08:51 +020025
Angel Pons3447db52020-09-14 18:09:46 +020026#include "registers/host_bridge.h"
Angel Pons7c49cb82020-03-16 23:17:32 +010027
Angel Pons7c49cb82020-03-16 23:17:32 +010028/* Devices 0:1.0, 0:1.1, 0:1.2, 0:6.0 PCI configuration space (PCI Express Graphics) */
29
30#define AFE_PWRON 0xc24 /* PEG Analog Front-End Power-On */
31
Stefan Reinauer00636b02012-04-04 00:08:51 +020032/* Device 0:2.0 PCI configuration space (Graphics Device) */
33
34#define MSAC 0x62 /* Multi Size Aperture Control */
Stefan Reinauer00636b02012-04-04 00:08:51 +020035
36/*
37 * MCHBAR
38 */
39
Angel Ponsd9e58dc2021-01-20 01:22:20 +010040#include <northbridge/intel/common/fixed_bars.h>
41
Angel Pons7c49cb82020-03-16 23:17:32 +010042#define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and))
43#define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and))
44#define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and))
45#define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or))
46#define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or))
47#define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or))
48#define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or))
49#define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or))
Angel Pons26be0bd2019-12-31 14:29:48 +010050#define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or))
Stefan Reinauer00636b02012-04-04 00:08:51 +020051
Angel Pons7c49cb82020-03-16 23:17:32 +010052/* As there are many registers, define them on a separate file */
Angel Pons3447db52020-09-14 18:09:46 +020053#include "registers/mchbar.h"
Stefan Reinauer00636b02012-04-04 00:08:51 +020054
55/*
56 * EPBAR - Egress Port Root Complex Register Block
57 */
58
Angel Ponsb8ebeba2020-09-14 18:11:40 +020059#include "registers/epbar.h"
Stefan Reinauer00636b02012-04-04 00:08:51 +020060
Stefan Reinauer00636b02012-04-04 00:08:51 +020061/*
62 * DMIBAR
63 */
64
Angel Ponsb8ebeba2020-09-14 18:11:40 +020065#include "registers/dmibar.h"
Stefan Reinauer00636b02012-04-04 00:08:51 +020066
67#ifndef __ASSEMBLER__
Stefan Reinauer00636b02012-04-04 00:08:51 +020068
Angel Pons964d91f2020-12-07 13:11:17 +010069bool is_sandybridge(void);
70
Stefan Reinauer00636b02012-04-04 00:08:51 +020071void intel_sandybridge_finalize_smm(void);
Patrick Rudolph2cdb65d2019-03-24 18:08:43 +010072void systemagent_early_init(void);
Nico Huberbb9469c2015-10-21 11:49:23 +020073void sandybridge_init_iommu(void);
Stefan Reinauer00636b02012-04-04 00:08:51 +020074void sandybridge_late_initialization(void);
Vladimir Serbinenkoc845b432014-09-05 03:37:44 +020075void northbridge_romstage_finalize(int s3resume);
Patrick Rudolph6aca7e62019-03-26 18:22:36 +010076void early_init_dmi(void);
Stefan Reinauer00636b02012-04-04 00:08:51 +020077
Angel Pons7c49cb82020-03-16 23:17:32 +010078/* mainboard_early_init: Optional callback, run after console init but before raminit. */
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010079void mainboard_early_init(int s3resume);
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010080int mainboard_should_reset_usb(int s3resume);
81void perform_raminit(int s3resume);
Angel Pons064c7992020-03-17 23:09:16 +010082void report_memory_config(void);
Patrick Rudolph74203de2017-11-20 11:57:01 +010083enum platform_type get_platform_type(void);
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010084
Nico Huber9d9ce0d2015-10-26 12:59:49 +010085#include <device/device.h>
86
87struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -070088unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
Angel Pons7c49cb82020-03-16 23:17:32 +010089 struct acpi_rsdp *rsdp);
Nico Huber9d9ce0d2015-10-26 12:59:49 +010090
Stefan Reinauer00636b02012-04-04 00:08:51 +020091#endif
92#endif
Edward O'Callaghan089a5102015-01-06 02:48:57 +110093#endif /* __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__ */