blob: bd7f0f0c30805451f1d85a48027846a8dc8fe545 [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 {
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020039 Chip: "domain",
40 Dev: 0,
41 PCIController: true,
42 ChildPCIBus: 0,
43 PCISlots: []PCISlot{
Arthur Heymansbc3261f2023-01-30 13:32:44 +010044 PCISlot{PCIAddr: PCIAddr{Dev: 0x0, Func: 0}, writeEmpty: true, alias: "host_bridge", additionalComment: "Host bridge"},
45 PCISlot{PCIAddr: PCIAddr{Dev: 0x1, Func: 0}, writeEmpty: true, alias: "peg10", additionalComment: "PEG"},
46 PCISlot{PCIAddr: PCIAddr{Dev: 0x2, Func: 0}, writeEmpty: true, alias: "igd", additionalComment: "iGPU"},
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020047 },
48 },
49 },
50 }
51
52 PutPCIDev(addr, "Host bridge")
53
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020054 /* FIXME:XX some configs are unsupported. */
Nico Huber772a1542019-05-10 16:48:14 +020055 KconfigBool["NORTHBRIDGE_INTEL_SANDYBRIDGE"] = true
Vladimir Serbinenko144eea02016-02-10 02:36:04 +010056 KconfigBool["USE_NATIVE_RAMINIT"] = true
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020057 KconfigBool["INTEL_INT15"] = true
58 KconfigBool["HAVE_ACPI_TABLES"] = true
59 KconfigBool["HAVE_ACPI_RESUME"] = true
60
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020061 DSDTIncludes = append(DSDTIncludes, DSDTInclude{
Angel Pons07b6f162019-01-16 00:18:33 +010062 File: "cpu/intel/common/acpi/cpu.asl",
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020063 })
64
65 DSDTPCI0Includes = append(DSDTPCI0Includes, DSDTInclude{
66 File: "northbridge/intel/sandybridge/acpi/sandybridge.asl",
Nico Huber954a55b2015-08-27 13:31:46 +020067 }, DSDTInclude{
68 File: "drivers/intel/gma/acpi/default_brightness_levels.asl",
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020069 })
70}
71
72func init() {
Nico Huber772a1542019-05-10 16:48:14 +020073 RegisterPCI(0x8086, 0x0100, sandybridgemc{})
74 RegisterPCI(0x8086, 0x0104, sandybridgemc{})
75 RegisterPCI(0x8086, 0x0150, sandybridgemc{})
76 RegisterPCI(0x8086, 0x0154, sandybridgemc{})
Jonathan A. Kollascha1114f62020-01-10 12:48:20 -060077 RegisterPCI(0x8086, 0x0158, sandybridgemc{})
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020078 for _, id := range []uint16{
Nico Huber23b93dd2017-07-29 01:46:23 +020079 0x0102, 0x0106, 0x010a,
80 0x0112, 0x0116, 0x0122, 0x0126,
81 0x0152, 0x0156, 0x0162, 0x0166,
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020082 } {
Angel Pons6779d232020-01-08 15:05:56 +010083 RegisterPCI(0x8086, id, GenericVGA{GenericPCI{}})
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020084 }
Angel Pons8296fdd2019-02-10 19:52:51 +010085
86 /* PCIe bridge */
87 for _, id := range []uint16{
88 0x0101, 0x0105, 0x0109, 0x010d,
89 0x0151, 0x0155, 0x0159, 0x015d,
90 } {
91 RegisterPCI(0x8086, id, GenericPCI{})
92 }
Vladimir Serbinenko3129f792014-10-15 21:51:47 +020093}