Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 1 | package main |
| 2 | |
Iru Cai | 56360d4 | 2020-04-10 20:56:07 +0800 | [diff] [blame] | 3 | import "fmt" |
Angel Pons | 496362d | 2024-05-13 19:09:29 +0200 | [diff] [blame^] | 4 | import "strings" |
Iru Cai | 56360d4 | 2020-04-10 20:56:07 +0800 | [diff] [blame] | 5 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 6 | type sandybridgemc struct { |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 7 | } |
| 8 | |
Angel Pons | 496362d | 2024-05-13 19:09:29 +0200 | [diff] [blame^] | 9 | func MakeSPDMap(ctx Context) string { |
| 10 | var values []string |
| 11 | for _, addr := range GuessSPDMap(ctx) { |
| 12 | values = append(values, fmt.Sprintf("0x%02x", addr)) |
| 13 | } |
| 14 | return "{"+strings.Join(values, ", ")+"}" |
| 15 | } |
| 16 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 17 | func (i sandybridgemc) Scan(ctx Context, addr PCIDevData) { |
| 18 | inteltool := ctx.InfoSource.GetInteltool() |
| 19 | |
| 20 | /* FIXME:XX Move this somewhere else. */ |
| 21 | MainboardIncludes = append(MainboardIncludes, "drivers/intel/gma/int15.h") |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 22 | MainboardEnable += (` /* FIXME: fix these values. */ |
Angel Pons | 6541956 | 2019-01-16 01:12:21 +0100 | [diff] [blame] | 23 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, |
| 24 | GMA_INT15_PANEL_FIT_DEFAULT, |
| 25 | GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 26 | `) |
| 27 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 28 | DevTree = DevTreeNode{ |
| 29 | Chip: "northbridge/intel/sandybridge", |
| 30 | MissingParent: "northbridge", |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 31 | Comment: "FIXME: GPU registers may not always apply.", |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 32 | Registers: map[string]string{ |
| 33 | "gpu_dp_b_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 2) & 7), |
| 34 | "gpu_dp_c_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 10) & 7), |
| 35 | "gpu_dp_d_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 18) & 7), |
| 36 | "gpu_panel_port_select": FormatInt32((inteltool.IGD[0xc7208] >> 30) & 3), |
| 37 | "gpu_panel_power_up_delay": FormatInt32((inteltool.IGD[0xc7208] >> 16) & 0x1fff), |
| 38 | "gpu_panel_power_backlight_on_delay": FormatInt32(inteltool.IGD[0xc7208] & 0x1fff), |
| 39 | "gpu_panel_power_down_delay": FormatInt32((inteltool.IGD[0xc720c] >> 16) & 0x1fff), |
| 40 | "gpu_panel_power_backlight_off_delay": FormatInt32(inteltool.IGD[0xc720c] & 0x1fff), |
| 41 | "gpu_panel_power_cycle_delay": FormatInt32(inteltool.IGD[0xc7210] & 0xff), |
| 42 | "gpu_cpu_backlight": FormatHex32(inteltool.IGD[0x48254]), |
| 43 | "gpu_pch_backlight": FormatHex32((inteltool.IGD[0xc8254] >> 16) * 0x10001), |
Iru Cai | 56360d4 | 2020-04-10 20:56:07 +0800 | [diff] [blame] | 44 | "gfx": fmt.Sprintf("GMA_STATIC_DISPLAYS(%d)", (inteltool.IGD[0xc6200] >> 12) & 1), |
Angel Pons | 496362d | 2024-05-13 19:09:29 +0200 | [diff] [blame^] | 45 | "spd_addresses": MakeSPDMap(ctx)+"\" # FIXME: Put proper SPD map here", |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 46 | }, |
| 47 | Children: []DevTreeNode{ |
| 48 | { |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 49 | Chip: "domain", |
| 50 | Dev: 0, |
| 51 | PCIController: true, |
| 52 | ChildPCIBus: 0, |
| 53 | PCISlots: []PCISlot{ |
Arthur Heymans | bc3261f | 2023-01-30 13:32:44 +0100 | [diff] [blame] | 54 | PCISlot{PCIAddr: PCIAddr{Dev: 0x0, Func: 0}, writeEmpty: true, alias: "host_bridge", additionalComment: "Host bridge"}, |
| 55 | PCISlot{PCIAddr: PCIAddr{Dev: 0x1, Func: 0}, writeEmpty: true, alias: "peg10", additionalComment: "PEG"}, |
| 56 | PCISlot{PCIAddr: PCIAddr{Dev: 0x2, Func: 0}, writeEmpty: true, alias: "igd", additionalComment: "iGPU"}, |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 57 | }, |
| 58 | }, |
| 59 | }, |
| 60 | } |
| 61 | |
| 62 | PutPCIDev(addr, "Host bridge") |
| 63 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 64 | /* FIXME:XX some configs are unsupported. */ |
Nico Huber | 772a154 | 2019-05-10 16:48:14 +0200 | [diff] [blame] | 65 | KconfigBool["NORTHBRIDGE_INTEL_SANDYBRIDGE"] = true |
Vladimir Serbinenko | 144eea0 | 2016-02-10 02:36:04 +0100 | [diff] [blame] | 66 | KconfigBool["USE_NATIVE_RAMINIT"] = true |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 67 | KconfigBool["INTEL_INT15"] = true |
| 68 | KconfigBool["HAVE_ACPI_TABLES"] = true |
| 69 | KconfigBool["HAVE_ACPI_RESUME"] = true |
| 70 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 71 | DSDTIncludes = append(DSDTIncludes, DSDTInclude{ |
Angel Pons | 07b6f16 | 2019-01-16 00:18:33 +0100 | [diff] [blame] | 72 | File: "cpu/intel/common/acpi/cpu.asl", |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 73 | }) |
| 74 | |
| 75 | DSDTPCI0Includes = append(DSDTPCI0Includes, DSDTInclude{ |
| 76 | File: "northbridge/intel/sandybridge/acpi/sandybridge.asl", |
Nico Huber | 954a55b | 2015-08-27 13:31:46 +0200 | [diff] [blame] | 77 | }, DSDTInclude{ |
| 78 | File: "drivers/intel/gma/acpi/default_brightness_levels.asl", |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 79 | }) |
| 80 | } |
| 81 | |
| 82 | func init() { |
Nico Huber | 772a154 | 2019-05-10 16:48:14 +0200 | [diff] [blame] | 83 | RegisterPCI(0x8086, 0x0100, sandybridgemc{}) |
| 84 | RegisterPCI(0x8086, 0x0104, sandybridgemc{}) |
| 85 | RegisterPCI(0x8086, 0x0150, sandybridgemc{}) |
| 86 | RegisterPCI(0x8086, 0x0154, sandybridgemc{}) |
Jonathan A. Kollasch | a1114f6 | 2020-01-10 12:48:20 -0600 | [diff] [blame] | 87 | RegisterPCI(0x8086, 0x0158, sandybridgemc{}) |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 88 | for _, id := range []uint16{ |
Nico Huber | 23b93dd | 2017-07-29 01:46:23 +0200 | [diff] [blame] | 89 | 0x0102, 0x0106, 0x010a, |
| 90 | 0x0112, 0x0116, 0x0122, 0x0126, |
| 91 | 0x0152, 0x0156, 0x0162, 0x0166, |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 92 | } { |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 93 | RegisterPCI(0x8086, id, GenericVGA{GenericPCI{}}) |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 94 | } |
Angel Pons | 8296fdd | 2019-02-10 19:52:51 +0100 | [diff] [blame] | 95 | |
| 96 | /* PCIe bridge */ |
| 97 | for _, id := range []uint16{ |
| 98 | 0x0101, 0x0105, 0x0109, 0x010d, |
| 99 | 0x0151, 0x0155, 0x0159, 0x015d, |
| 100 | } { |
| 101 | RegisterPCI(0x8086, id, GenericPCI{}) |
| 102 | } |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 103 | } |