blob: 6f57847a1ddee1f84b225caf99c8faadf45a9698 [file] [log] [blame]
Vladimir Serbinenko3129f792014-10-15 21:51:47 +02001package main
2
Iru Cai56360d42020-04-10 20:56:07 +08003import "fmt"
4
Vladimir Serbinenko3129f792014-10-15 21:51:47 +02005type sandybridgemc struct {
Vladimir Serbinenko3129f792014-10-15 21:51:47 +02006}
7
8func (i sandybridgemc) Scan(ctx Context, addr PCIDevData) {
9 inteltool := ctx.InfoSource.GetInteltool()
10
11 /* FIXME:XX Move this somewhere else. */
12 MainboardIncludes = append(MainboardIncludes, "drivers/intel/gma/int15.h")
Angel Pons6779d232020-01-08 15:05:56 +010013 MainboardEnable += (` /* FIXME: fix these values. */
Angel Pons65419562019-01-16 01:12:21 +010014 install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,
15 GMA_INT15_PANEL_FIT_DEFAULT,
16 GMA_INT15_BOOT_DISPLAY_DEFAULT, 0);
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020017`)
18
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020019 DevTree = DevTreeNode{
20 Chip: "northbridge/intel/sandybridge",
21 MissingParent: "northbridge",
Angel Pons6779d232020-01-08 15:05:56 +010022 Comment: "FIXME: GPU registers may not always apply.",
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020023 Registers: map[string]string{
24 "gpu_dp_b_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 2) & 7),
25 "gpu_dp_c_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 10) & 7),
26 "gpu_dp_d_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 18) & 7),
27 "gpu_panel_port_select": FormatInt32((inteltool.IGD[0xc7208] >> 30) & 3),
28 "gpu_panel_power_up_delay": FormatInt32((inteltool.IGD[0xc7208] >> 16) & 0x1fff),
29 "gpu_panel_power_backlight_on_delay": FormatInt32(inteltool.IGD[0xc7208] & 0x1fff),
30 "gpu_panel_power_down_delay": FormatInt32((inteltool.IGD[0xc720c] >> 16) & 0x1fff),
31 "gpu_panel_power_backlight_off_delay": FormatInt32(inteltool.IGD[0xc720c] & 0x1fff),
32 "gpu_panel_power_cycle_delay": FormatInt32(inteltool.IGD[0xc7210] & 0xff),
33 "gpu_cpu_backlight": FormatHex32(inteltool.IGD[0x48254]),
34 "gpu_pch_backlight": FormatHex32((inteltool.IGD[0xc8254] >> 16) * 0x10001),
Iru Cai56360d42020-04-10 20:56:07 +080035 "gfx": fmt.Sprintf("GMA_STATIC_DISPLAYS(%d)", (inteltool.IGD[0xc6200] >> 12) & 1),
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020036 },
37 Children: []DevTreeNode{
38 {
39 Chip: "cpu_cluster",
40 Dev: 0,
41 Children: []DevTreeNode{
42 {
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020043 Chip: "cpu/intel/model_206ax",
44 Comment: "FIXME: check all registers",
45 Registers: map[string]string{
46 /* FIXME:XX hardcoded. */
47 "c1_acpower": "1",
48 "c2_acpower": "3",
49 "c3_acpower": "5",
50 "c1_battery": "1",
51 "c2_battery": "3",
52 "c3_battery": "5",
53 },
54 Children: []DevTreeNode{
55 {
Arthur Heymans7e6946a2019-01-21 17:55:02 +010056 Chip: "lapic",
57 Dev: 0,
58 },
59 {
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020060 Chip: "lapic",
61 Dev: 0xacac,
62 Disabled: true,
63 },
64 },
65 },
66 },
67 },
68
69 {
70 Chip: "domain",
71 Dev: 0,
72 PCIController: true,
73 ChildPCIBus: 0,
74 PCISlots: []PCISlot{
75 PCISlot{PCIAddr: PCIAddr{Dev: 0x0, Func: 0}, writeEmpty: true, additionalComment: "Host bridge"},
Angel Pons6779d232020-01-08 15:05:56 +010076 PCISlot{PCIAddr: PCIAddr{Dev: 0x1, Func: 0}, writeEmpty: true, additionalComment: "PEG"},
77 PCISlot{PCIAddr: PCIAddr{Dev: 0x2, Func: 0}, writeEmpty: true, additionalComment: "iGPU"},
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020078 },
79 },
80 },
81 }
82
83 PutPCIDev(addr, "Host bridge")
84
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020085 /* FIXME:XX some configs are unsupported. */
Nico Huber772a1542019-05-10 16:48:14 +020086 KconfigBool["NORTHBRIDGE_INTEL_SANDYBRIDGE"] = true
Vladimir Serbinenko144eea02016-02-10 02:36:04 +010087 KconfigBool["USE_NATIVE_RAMINIT"] = true
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020088 KconfigBool["INTEL_INT15"] = true
89 KconfigBool["HAVE_ACPI_TABLES"] = true
90 KconfigBool["HAVE_ACPI_RESUME"] = true
91
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020092 KconfigInt["MAX_CPUS"] = 8
93
94 DSDTIncludes = append(DSDTIncludes, DSDTInclude{
Angel Pons07b6f162019-01-16 00:18:33 +010095 File: "cpu/intel/common/acpi/cpu.asl",
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020096 })
97
98 DSDTPCI0Includes = append(DSDTPCI0Includes, DSDTInclude{
99 File: "northbridge/intel/sandybridge/acpi/sandybridge.asl",
Nico Huber954a55b2015-08-27 13:31:46 +0200100 }, DSDTInclude{
101 File: "drivers/intel/gma/acpi/default_brightness_levels.asl",
Vladimir Serbinenko3129f792014-10-15 21:51:47 +0200102 })
103}
104
105func init() {
Nico Huber772a1542019-05-10 16:48:14 +0200106 RegisterPCI(0x8086, 0x0100, sandybridgemc{})
107 RegisterPCI(0x8086, 0x0104, sandybridgemc{})
108 RegisterPCI(0x8086, 0x0150, sandybridgemc{})
109 RegisterPCI(0x8086, 0x0154, sandybridgemc{})
Jonathan A. Kollascha1114f62020-01-10 12:48:20 -0600110 RegisterPCI(0x8086, 0x0158, sandybridgemc{})
Vladimir Serbinenko3129f792014-10-15 21:51:47 +0200111 for _, id := range []uint16{
Nico Huber23b93dd2017-07-29 01:46:23 +0200112 0x0102, 0x0106, 0x010a,
113 0x0112, 0x0116, 0x0122, 0x0126,
114 0x0152, 0x0156, 0x0162, 0x0166,
Vladimir Serbinenko3129f792014-10-15 21:51:47 +0200115 } {
Angel Pons6779d232020-01-08 15:05:56 +0100116 RegisterPCI(0x8086, id, GenericVGA{GenericPCI{}})
Vladimir Serbinenko3129f792014-10-15 21:51:47 +0200117 }
Angel Pons8296fdd2019-02-10 19:52:51 +0100118
119 /* PCIe bridge */
120 for _, id := range []uint16{
121 0x0101, 0x0105, 0x0109, 0x010d,
122 0x0151, 0x0155, 0x0159, 0x015d,
123 } {
124 RegisterPCI(0x8086, id, GenericPCI{})
125 }
Vladimir Serbinenko3129f792014-10-15 21:51:47 +0200126}