sandybridge.go 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package main
  2. import "fmt"
  3. type sandybridgemc struct {
  4. }
  5. func (i sandybridgemc) Scan(ctx Context, addr PCIDevData) {
  6. inteltool := ctx.InfoSource.GetInteltool()
  7. /* FIXME:XX Move this somewhere else. */
  8. MainboardIncludes = append(MainboardIncludes, "drivers/intel/gma/int15.h")
  9. MainboardEnable += (` /* FIXME: fix these values. */
  10. install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,
  11. GMA_INT15_PANEL_FIT_DEFAULT,
  12. GMA_INT15_BOOT_DISPLAY_DEFAULT, 0);
  13. `)
  14. DevTree = DevTreeNode{
  15. Chip: "northbridge/intel/sandybridge",
  16. MissingParent: "northbridge",
  17. Comment: "FIXME: GPU registers may not always apply.",
  18. Registers: map[string]string{
  19. "gpu_dp_b_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 2) & 7),
  20. "gpu_dp_c_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 10) & 7),
  21. "gpu_dp_d_hotplug": FormatInt32((inteltool.IGD[0xc4030] >> 18) & 7),
  22. "gpu_panel_port_select": FormatInt32((inteltool.IGD[0xc7208] >> 30) & 3),
  23. "gpu_panel_power_up_delay": FormatInt32((inteltool.IGD[0xc7208] >> 16) & 0x1fff),
  24. "gpu_panel_power_backlight_on_delay": FormatInt32(inteltool.IGD[0xc7208] & 0x1fff),
  25. "gpu_panel_power_down_delay": FormatInt32((inteltool.IGD[0xc720c] >> 16) & 0x1fff),
  26. "gpu_panel_power_backlight_off_delay": FormatInt32(inteltool.IGD[0xc720c] & 0x1fff),
  27. "gpu_panel_power_cycle_delay": FormatInt32(inteltool.IGD[0xc7210] & 0xff),
  28. "gpu_cpu_backlight": FormatHex32(inteltool.IGD[0x48254]),
  29. "gpu_pch_backlight": FormatHex32((inteltool.IGD[0xc8254] >> 16) * 0x10001),
  30. "gfx": fmt.Sprintf("GMA_STATIC_DISPLAYS(%d)", (inteltool.IGD[0xc6200] >> 12) & 1),
  31. },
  32. Children: []DevTreeNode{
  33. {
  34. Chip: "domain",
  35. Dev: 0,
  36. PCIController: true,
  37. ChildPCIBus: 0,
  38. PCISlots: []PCISlot{
  39. PCISlot{PCIAddr: PCIAddr{Dev: 0x0, Func: 0}, writeEmpty: true, alias: "host_bridge", additionalComment: "Host bridge"},
  40. PCISlot{PCIAddr: PCIAddr{Dev: 0x1, Func: 0}, writeEmpty: true, alias: "peg10", additionalComment: "PEG"},
  41. PCISlot{PCIAddr: PCIAddr{Dev: 0x2, Func: 0}, writeEmpty: true, alias: "igd", additionalComment: "iGPU"},
  42. },
  43. },
  44. },
  45. }
  46. PutPCIDev(addr, "Host bridge")
  47. /* FIXME:XX some configs are unsupported. */
  48. KconfigBool["NORTHBRIDGE_INTEL_SANDYBRIDGE"] = true
  49. KconfigBool["USE_NATIVE_RAMINIT"] = true
  50. KconfigBool["INTEL_INT15"] = true
  51. KconfigBool["HAVE_ACPI_TABLES"] = true
  52. KconfigBool["HAVE_ACPI_RESUME"] = true
  53. DSDTIncludes = append(DSDTIncludes, DSDTInclude{
  54. File: "cpu/intel/common/acpi/cpu.asl",
  55. })
  56. DSDTPCI0Includes = append(DSDTPCI0Includes, DSDTInclude{
  57. File: "northbridge/intel/sandybridge/acpi/sandybridge.asl",
  58. }, DSDTInclude{
  59. File: "drivers/intel/gma/acpi/default_brightness_levels.asl",
  60. })
  61. }
  62. func init() {
  63. RegisterPCI(0x8086, 0x0100, sandybridgemc{})
  64. RegisterPCI(0x8086, 0x0104, sandybridgemc{})
  65. RegisterPCI(0x8086, 0x0150, sandybridgemc{})
  66. RegisterPCI(0x8086, 0x0154, sandybridgemc{})
  67. RegisterPCI(0x8086, 0x0158, sandybridgemc{})
  68. for _, id := range []uint16{
  69. 0x0102, 0x0106, 0x010a,
  70. 0x0112, 0x0116, 0x0122, 0x0126,
  71. 0x0152, 0x0156, 0x0162, 0x0166,
  72. } {
  73. RegisterPCI(0x8086, id, GenericVGA{GenericPCI{}})
  74. }
  75. /* PCIe bridge */
  76. for _, id := range []uint16{
  77. 0x0101, 0x0105, 0x0109, 0x010d,
  78. 0x0151, 0x0155, 0x0159, 0x015d,
  79. } {
  80. RegisterPCI(0x8086, id, GenericPCI{})
  81. }
  82. }