root / hw / q35.h @ bf3bc4c4
History | View | Annotate | Download (6 kB)
1 | df2d8b3e | Isaku Yamahata | /*
|
---|---|---|---|
2 | df2d8b3e | Isaku Yamahata | * q35.h
|
3 | df2d8b3e | Isaku Yamahata | *
|
4 | df2d8b3e | Isaku Yamahata | * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
|
5 | df2d8b3e | Isaku Yamahata | * VA Linux Systems Japan K.K.
|
6 | df2d8b3e | Isaku Yamahata | * Copyright (C) 2012 Jason Baron <jbaron@redhat.com>
|
7 | df2d8b3e | Isaku Yamahata | *
|
8 | df2d8b3e | Isaku Yamahata | * This program is free software; you can redistribute it and/or modify
|
9 | df2d8b3e | Isaku Yamahata | * it under the terms of the GNU General Public License as published by
|
10 | df2d8b3e | Isaku Yamahata | * the Free Software Foundation; either version 2 of the License, or
|
11 | df2d8b3e | Isaku Yamahata | * (at your option) any later version.
|
12 | df2d8b3e | Isaku Yamahata | *
|
13 | df2d8b3e | Isaku Yamahata | * This program is distributed in the hope that it will be useful,
|
14 | df2d8b3e | Isaku Yamahata | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 | df2d8b3e | Isaku Yamahata | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 | df2d8b3e | Isaku Yamahata | * GNU General Public License for more details.
|
17 | df2d8b3e | Isaku Yamahata | *
|
18 | df2d8b3e | Isaku Yamahata | * You should have received a copy of the GNU Lesser General Public
|
19 | df2d8b3e | Isaku Yamahata | * License along with this library; if not, see <http://www.gnu.org/licenses/>
|
20 | df2d8b3e | Isaku Yamahata | */
|
21 | df2d8b3e | Isaku Yamahata | |
22 | df2d8b3e | Isaku Yamahata | #ifndef HW_Q35_H
|
23 | df2d8b3e | Isaku Yamahata | #define HW_Q35_H
|
24 | df2d8b3e | Isaku Yamahata | |
25 | df2d8b3e | Isaku Yamahata | #include "hw.h" |
26 | df2d8b3e | Isaku Yamahata | #include "range.h" |
27 | df2d8b3e | Isaku Yamahata | #include "isa.h" |
28 | df2d8b3e | Isaku Yamahata | #include "sysbus.h" |
29 | df2d8b3e | Isaku Yamahata | #include "pc.h" |
30 | df2d8b3e | Isaku Yamahata | #include "apm.h" |
31 | df2d8b3e | Isaku Yamahata | #include "apic.h" |
32 | df2d8b3e | Isaku Yamahata | #include "pci.h" |
33 | df2d8b3e | Isaku Yamahata | #include "pcie_host.h" |
34 | df2d8b3e | Isaku Yamahata | #include "acpi.h" |
35 | df2d8b3e | Isaku Yamahata | #include "acpi_ich9.h" |
36 | df2d8b3e | Isaku Yamahata | #include "pam.h" |
37 | df2d8b3e | Isaku Yamahata | |
38 | df2d8b3e | Isaku Yamahata | #define TYPE_Q35_HOST_DEVICE "q35-pcihost" |
39 | df2d8b3e | Isaku Yamahata | #define Q35_HOST_DEVICE(obj) \
|
40 | df2d8b3e | Isaku Yamahata | OBJECT_CHECK(Q35PCIHost, (obj), TYPE_Q35_HOST_DEVICE) |
41 | df2d8b3e | Isaku Yamahata | |
42 | df2d8b3e | Isaku Yamahata | #define TYPE_MCH_PCI_DEVICE "mch" |
43 | df2d8b3e | Isaku Yamahata | #define MCH_PCI_DEVICE(obj) \
|
44 | df2d8b3e | Isaku Yamahata | OBJECT_CHECK(MCHPCIState, (obj), TYPE_MCH_PCI_DEVICE) |
45 | df2d8b3e | Isaku Yamahata | |
46 | df2d8b3e | Isaku Yamahata | typedef struct MCHPCIState { |
47 | df2d8b3e | Isaku Yamahata | PCIDevice d; |
48 | df2d8b3e | Isaku Yamahata | MemoryRegion *ram_memory; |
49 | df2d8b3e | Isaku Yamahata | MemoryRegion *pci_address_space; |
50 | df2d8b3e | Isaku Yamahata | MemoryRegion *system_memory; |
51 | df2d8b3e | Isaku Yamahata | MemoryRegion *address_space_io; |
52 | df2d8b3e | Isaku Yamahata | PAMMemoryRegion pam_regions[13];
|
53 | df2d8b3e | Isaku Yamahata | MemoryRegion smram_region; |
54 | df2d8b3e | Isaku Yamahata | MemoryRegion pci_hole; |
55 | df2d8b3e | Isaku Yamahata | MemoryRegion pci_hole_64bit; |
56 | df2d8b3e | Isaku Yamahata | uint8_t smm_enabled; |
57 | df2d8b3e | Isaku Yamahata | ram_addr_t below_4g_mem_size; |
58 | df2d8b3e | Isaku Yamahata | ram_addr_t above_4g_mem_size; |
59 | df2d8b3e | Isaku Yamahata | } MCHPCIState; |
60 | df2d8b3e | Isaku Yamahata | |
61 | df2d8b3e | Isaku Yamahata | typedef struct Q35PCIHost { |
62 | df2d8b3e | Isaku Yamahata | PCIExpressHost host; |
63 | df2d8b3e | Isaku Yamahata | MCHPCIState mch; |
64 | df2d8b3e | Isaku Yamahata | } Q35PCIHost; |
65 | df2d8b3e | Isaku Yamahata | |
66 | df2d8b3e | Isaku Yamahata | #define Q35_MASK(bit, ms_bit, ls_bit) \
|
67 | df2d8b3e | Isaku Yamahata | ((uint##bit##_t)(((1ULL << ((ms_bit) + 1)) - 1) & ~((1ULL << ls_bit) - 1))) |
68 | df2d8b3e | Isaku Yamahata | |
69 | df2d8b3e | Isaku Yamahata | /*
|
70 | df2d8b3e | Isaku Yamahata | * gmch part
|
71 | df2d8b3e | Isaku Yamahata | */
|
72 | df2d8b3e | Isaku Yamahata | |
73 | df2d8b3e | Isaku Yamahata | /* PCI configuration */
|
74 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE "MCH" |
75 | df2d8b3e | Isaku Yamahata | |
76 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_CONFIG_ADDR 0xcf8 |
77 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_CONFIG_DATA 0xcfc |
78 | df2d8b3e | Isaku Yamahata | |
79 | df2d8b3e | Isaku Yamahata | /* D0:F0 configuration space */
|
80 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_REVISION_DEFUALT 0x0 |
81 | df2d8b3e | Isaku Yamahata | |
82 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR 0x60 /* 64bit register */ |
83 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_SIZE 8 /* 64bit register */ |
84 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT 0xb0000000 |
85 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_ADMSK Q35_MASK(64, 35, 28) |
86 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_128ADMSK ((uint64_t)(1 << 26)) |
87 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_64ADMSK ((uint64_t)(1 << 25)) |
88 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_MASK ((uint64_t)(0x3 << 1)) |
89 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_256M ((uint64_t)(0x0 << 1)) |
90 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_128M ((uint64_t)(0x1 << 1)) |
91 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_64M ((uint64_t)(0x2 << 1)) |
92 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_RVD ((uint64_t)(0x3 << 1)) |
93 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PCIEXBAREN ((uint64_t)1) |
94 | df2d8b3e | Isaku Yamahata | |
95 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_NB 7 |
96 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_SIZE 7 |
97 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM0 0x90 |
98 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_BIOS_AREA 0xf0000 |
99 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_AREA_SIZE 0x10000 /* 16KB */ |
100 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM1 0x91 |
101 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_EXPAN_AREA 0xc0000 |
102 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_EXPAN_SIZE 0x04000 |
103 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM2 0x92 |
104 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM3 0x93 |
105 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM4 0x94 |
106 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_EXBIOS_AREA 0xe0000 |
107 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_EXBIOS_SIZE 0x04000 |
108 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM5 0x95 |
109 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM6 0x96 |
110 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_WE_HI ((uint8_t)(0x2 << 4)) |
111 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_RE_HI ((uint8_t)(0x1 << 4)) |
112 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_HI_MASK ((uint8_t)(0x3 << 4)) |
113 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_WE_LO ((uint8_t)0x2) |
114 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_RE_LO ((uint8_t)0x1) |
115 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_LO_MASK ((uint8_t)0x3) |
116 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_WE ((uint8_t)0x2) |
117 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_RE ((uint8_t)0x1) |
118 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_PAM_MASK ((uint8_t)0x3) |
119 | df2d8b3e | Isaku Yamahata | |
120 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_SMRAM 0x9d |
121 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_SMRAM_SIZE 1 |
122 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_DEFAULT ((uint8_t)0x2) |
123 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_D_OPEN ((uint8_t)(1 << 6)) |
124 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_D_CLS ((uint8_t)(1 << 5)) |
125 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_D_LCK ((uint8_t)(1 << 4)) |
126 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_G_SMRAME ((uint8_t)(1 << 3)) |
127 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_C_BASE_SEG_MASK ((uint8_t)0x7) |
128 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_C_BASE_SEG ((uint8_t)0x2) /* hardwired to b010 */ |
129 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_C_BASE 0xa0000 |
130 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_C_END 0xc0000 |
131 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_SMRAM_C_SIZE 0x20000 |
132 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_UPPER_SYSTEM_BIOS_END 0x100000 |
133 | df2d8b3e | Isaku Yamahata | |
134 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRIDGE_ESMRAMC 0x9e |
135 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_H_SMRAME ((uint8_t)(1 << 6)) |
136 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_E_SMERR ((uint8_t)(1 << 5)) |
137 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_SM_CACHE ((uint8_t)(1 << 4)) |
138 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_SM_L1 ((uint8_t)(1 << 3)) |
139 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_SM_L2 ((uint8_t)(1 << 2)) |
140 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_TSEG_SZ_MASK ((uint8_t)(0x3 << 1)) |
141 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_TSEG_SZ_1MB ((uint8_t)(0x0 << 1)) |
142 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_TSEG_SZ_2MB ((uint8_t)(0x1 << 1)) |
143 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_TSEG_SZ_8MB ((uint8_t)(0x2 << 1)) |
144 | df2d8b3e | Isaku Yamahata | #define MCH_HOST_BRDIGE_ESMRAMC_T_EN ((uint8_t)1) |
145 | df2d8b3e | Isaku Yamahata | |
146 | df2d8b3e | Isaku Yamahata | /* D1:F0 PCIE* port*/
|
147 | df2d8b3e | Isaku Yamahata | #define MCH_PCIE_DEV 1 |
148 | df2d8b3e | Isaku Yamahata | #define MCH_PCIE_FUNC 0 |
149 | df2d8b3e | Isaku Yamahata | |
150 | df2d8b3e | Isaku Yamahata | #endif /* HW_Q35_H */ |