Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 2 | |
| 3 | #ifndef NORTHBRIDGE_INTEL_PINEVIEW_H |
| 4 | #define NORTHBRIDGE_INTEL_PINEVIEW_H |
| 5 | |
Angel Pons | d25e2f6 | 2020-09-15 00:48:16 +0200 | [diff] [blame] | 6 | #include <northbridge/intel/pineview/memmap.h> |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 7 | #include <southbridge/intel/i82801gx/i82801gx.h> |
| 8 | |
Damien Zammit | f7060f1 | 2015-11-14 00:59:21 +1100 | [diff] [blame] | 9 | #define BOOT_PATH_NORMAL 0 |
| 10 | #define BOOT_PATH_RESET 1 |
| 11 | #define BOOT_PATH_RESUME 2 |
| 12 | |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 13 | /* Device 0:0.0 PCI configuration space (Host Bridge) */ |
Angel Pons | 39ff703 | 2020-03-09 21:39:44 +0100 | [diff] [blame] | 14 | #define HOST_BRIDGE PCI_DEV(0, 0, 0) |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 15 | |
Angel Pons | 0ddc245 | 2020-07-22 11:40:46 +0200 | [diff] [blame] | 16 | #include "hostbridge_regs.h" |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 17 | |
| 18 | /* Device 0:1.0 PCI configuration space (PCI Express) */ |
| 19 | |
Angel Pons | 39ff703 | 2020-03-09 21:39:44 +0100 | [diff] [blame] | 20 | #define PEGSTS 0x214 /* 32 bits */ |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 21 | |
Angel Pons | 39ff703 | 2020-03-09 21:39:44 +0100 | [diff] [blame] | 22 | /* Device 0:2.0 PCI configuration space (Integrated Graphics Device) */ |
| 23 | #define GMCH_IGD PCI_DEV(0, 2, 0) |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 24 | |
| 25 | #define GMADR 0x18 |
| 26 | #define GTTADR 0x1c |
| 27 | #define BSM 0x5c |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 28 | |
Damien Zammit | f7060f1 | 2015-11-14 00:59:21 +1100 | [diff] [blame] | 29 | #define GPIO32(x) *((volatile u32 *)(DEFAULT_GPIOBASE + x)) |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 30 | |
| 31 | /* |
| 32 | * MCHBAR |
| 33 | */ |
| 34 | |
Angel Pons | 39ff703 | 2020-03-09 21:39:44 +0100 | [diff] [blame] | 35 | #define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x)))) |
| 36 | #define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x)))) |
| 37 | #define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + x))) /* FIXME: causes changes */ |
| 38 | #define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and)) |
| 39 | #define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and)) |
| 40 | #define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and)) |
| 41 | #define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or)) |
| 42 | #define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or)) |
| 43 | #define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or)) |
| 44 | #define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or)) |
| 45 | #define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or)) |
| 46 | #define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or)) |
| 47 | |
| 48 | /* As there are many registers, define them on a separate file */ |
| 49 | |
| 50 | #include "mchbar_regs.h" |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 51 | |
| 52 | /* |
| 53 | * EPBAR - Egress Port Root Complex Register Block |
| 54 | */ |
| 55 | |
Angel Pons | 6549661 | 2020-09-15 00:51:36 +0200 | [diff] [blame] | 56 | #define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + (x))) |
| 57 | #define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + (x))) |
| 58 | #define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + (x))) |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 59 | |
| 60 | /* |
| 61 | * DMIBAR |
| 62 | */ |
| 63 | |
Angel Pons | 6549661 | 2020-09-15 00:51:36 +0200 | [diff] [blame] | 64 | #define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + (x))) |
| 65 | #define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + (x))) |
| 66 | #define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + (x))) |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 67 | |
Angel Pons | 39ff703 | 2020-03-09 21:39:44 +0100 | [diff] [blame] | 68 | void pineview_early_init(void); |
Damien Zammit | f7060f1 | 2015-11-14 00:59:21 +1100 | [diff] [blame] | 69 | u32 decode_igd_memory_size(const u32 gms); |
| 70 | u32 decode_igd_gtt_size(const u32 gsm); |
Angel Pons | 653d871 | 2020-08-03 15:40:54 +0200 | [diff] [blame] | 71 | int decode_pcie_bar(u32 *const base, u32 *const len); |
Damien Zammit | f7060f1 | 2015-11-14 00:59:21 +1100 | [diff] [blame] | 72 | |
Arthur Heymans | c6ff1ac | 2019-01-11 16:06:19 +0100 | [diff] [blame] | 73 | /* Mainboard romstage callback functions */ |
Arthur Heymans | c6ff1ac | 2019-01-11 16:06:19 +0100 | [diff] [blame] | 74 | void get_mb_spd_addrmap(u8 *spd_addr_map); |
| 75 | void mb_pirq_setup(void); /* optional */ |
| 76 | |
Damien Zammit | 6247793 | 2015-05-03 21:34:38 +1000 | [diff] [blame] | 77 | #endif /* NORTHBRIDGE_INTEL_PINEVIEW_H */ |