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" |
| 4 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 5 | type sandybridgemc struct { |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 6 | } |
| 7 | |
| 8 | func (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 Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 13 | MainboardEnable += (` /* FIXME: fix these values. */ |
Angel Pons | 6541956 | 2019-01-16 01:12:21 +0100 | [diff] [blame] | 14 | 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 Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 17 | `) |
| 18 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 19 | DevTree = DevTreeNode{ |
| 20 | Chip: "northbridge/intel/sandybridge", |
| 21 | MissingParent: "northbridge", |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 22 | Comment: "FIXME: GPU registers may not always apply.", |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 23 | 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 Cai | 56360d4 | 2020-04-10 20:56:07 +0800 | [diff] [blame] | 35 | "gfx": fmt.Sprintf("GMA_STATIC_DISPLAYS(%d)", (inteltool.IGD[0xc6200] >> 12) & 1), |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 36 | }, |
| 37 | Children: []DevTreeNode{ |
| 38 | { |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 39 | Chip: "domain", |
| 40 | Dev: 0, |
| 41 | PCIController: true, |
| 42 | ChildPCIBus: 0, |
| 43 | PCISlots: []PCISlot{ |
| 44 | PCISlot{PCIAddr: PCIAddr{Dev: 0x0, Func: 0}, writeEmpty: true, additionalComment: "Host bridge"}, |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 45 | PCISlot{PCIAddr: PCIAddr{Dev: 0x1, Func: 0}, writeEmpty: true, additionalComment: "PEG"}, |
| 46 | PCISlot{PCIAddr: PCIAddr{Dev: 0x2, Func: 0}, writeEmpty: true, additionalComment: "iGPU"}, |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 47 | }, |
| 48 | }, |
| 49 | }, |
| 50 | } |
| 51 | |
| 52 | PutPCIDev(addr, "Host bridge") |
| 53 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 54 | /* FIXME:XX some configs are unsupported. */ |
Nico Huber | 772a154 | 2019-05-10 16:48:14 +0200 | [diff] [blame] | 55 | KconfigBool["NORTHBRIDGE_INTEL_SANDYBRIDGE"] = true |
Vladimir Serbinenko | 144eea0 | 2016-02-10 02:36:04 +0100 | [diff] [blame] | 56 | KconfigBool["USE_NATIVE_RAMINIT"] = true |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 57 | KconfigBool["INTEL_INT15"] = true |
| 58 | KconfigBool["HAVE_ACPI_TABLES"] = true |
| 59 | KconfigBool["HAVE_ACPI_RESUME"] = true |
| 60 | |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 61 | DSDTIncludes = append(DSDTIncludes, DSDTInclude{ |
Angel Pons | 07b6f16 | 2019-01-16 00:18:33 +0100 | [diff] [blame] | 62 | File: "cpu/intel/common/acpi/cpu.asl", |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 63 | }) |
| 64 | |
| 65 | DSDTPCI0Includes = append(DSDTPCI0Includes, DSDTInclude{ |
| 66 | File: "northbridge/intel/sandybridge/acpi/sandybridge.asl", |
Nico Huber | 954a55b | 2015-08-27 13:31:46 +0200 | [diff] [blame] | 67 | }, DSDTInclude{ |
| 68 | File: "drivers/intel/gma/acpi/default_brightness_levels.asl", |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 69 | }) |
| 70 | } |
| 71 | |
| 72 | func init() { |
Nico Huber | 772a154 | 2019-05-10 16:48:14 +0200 | [diff] [blame] | 73 | RegisterPCI(0x8086, 0x0100, sandybridgemc{}) |
| 74 | RegisterPCI(0x8086, 0x0104, sandybridgemc{}) |
| 75 | RegisterPCI(0x8086, 0x0150, sandybridgemc{}) |
| 76 | RegisterPCI(0x8086, 0x0154, sandybridgemc{}) |
Jonathan A. Kollasch | a1114f6 | 2020-01-10 12:48:20 -0600 | [diff] [blame] | 77 | RegisterPCI(0x8086, 0x0158, sandybridgemc{}) |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 78 | for _, id := range []uint16{ |
Nico Huber | 23b93dd | 2017-07-29 01:46:23 +0200 | [diff] [blame] | 79 | 0x0102, 0x0106, 0x010a, |
| 80 | 0x0112, 0x0116, 0x0122, 0x0126, |
| 81 | 0x0152, 0x0156, 0x0162, 0x0166, |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 82 | } { |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 83 | RegisterPCI(0x8086, id, GenericVGA{GenericPCI{}}) |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 84 | } |
Angel Pons | 8296fdd | 2019-02-10 19:52:51 +0100 | [diff] [blame] | 85 | |
| 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 Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 93 | } |