mail.coreboot.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
List overview
Download
coreboot-gerrit
February 2014
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
coreboot-gerrit@coreboot.org
1 participants
1135 discussions
Start a n
N
ew thread
New patch to review for coreboot: 5715f22 NOTFORMERGE: x60, x201: Read EDID rather than hardcoding.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5250
-gerrit commit 5715f22533f32a2cbf33476a2ca95decf3f0adc1 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sun Feb 16 03:42:22 2014 +0100 NOTFORMERGE: x60, x201: Read EDID rather than hardcoding. Change-Id: I023b6793dd0d35292993192fc006b21accbdab49 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/drivers/intel/Makefile.inc | 1 + src/drivers/intel/gma/Kconfig | 4 + src/drivers/intel/gma/Makefile.inc | 2 +- src/drivers/intel/gma/edid.c | 79 ++++++++++ src/drivers/intel/gma/edid.h | 2 + src/mainboard/lenovo/x60/Kconfig | 1 + src/mainboard/lenovo/x60/i915.c | 14 +- src/northbridge/intel/nehalem/Kconfig | 1 + src/northbridge/intel/nehalem/fake_vbios.c | 232 +---------------------------- src/northbridge/intel/nehalem/gma.c | 17 +++ src/northbridge/intel/nehalem/nehalem.h | 1 - 11 files changed, 111 insertions(+), 243 deletions(-) diff --git a/src/drivers/intel/Makefile.inc b/src/drivers/intel/Makefile.inc index 82d5449..7cce77e 100644 --- a/src/drivers/intel/Makefile.inc +++ b/src/drivers/intel/Makefile.inc @@ -1 +1,2 @@ subdirs-$(CONFIG_INTEL_DP) += gma +subdirs-$(CONFIG_INTEL_EDID) += gma diff --git a/src/drivers/intel/gma/Kconfig b/src/drivers/intel/gma/Kconfig index 073f708..c9c1bca 100644 --- a/src/drivers/intel/gma/Kconfig +++ b/src/drivers/intel/gma/Kconfig @@ -28,3 +28,7 @@ config INTEL_DDI default n help helper functions for intel DDI operations + +config INTEL_EDID + bool + default n \ No newline at end of file diff --git a/src/drivers/intel/gma/Makefile.inc b/src/drivers/intel/gma/Makefile.inc index 0c3f45a..bea597e 100644 --- a/src/drivers/intel/gma/Makefile.inc +++ b/src/drivers/intel/gma/Makefile.inc @@ -19,4 +19,4 @@ ramstage-$(CONFIG_INTEL_DP) += intel_dp.c drm_dp_helper.c ramstage-$(CONFIG_INTEL_DDI) += intel_ddi.c - +ramstage-$(CONFIG_INTEL_EDID) += edid.c diff --git a/src/drivers/intel/gma/edid.c b/src/drivers/intel/gma/edid.c new file mode 100644 index 0000000..f712e7d --- /dev/null +++ b/src/drivers/intel/gma/edid.c @@ -0,0 +1,79 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2014 Vladimir Serbinenko <phcoder(a)gmail.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2, or (at your option) + * any later verion of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include <arch/io.h> +#include <console/console.h> +#include <delay.h> + +#include "i915.h" +#include "i915_reg.h" +#include "edid.h" + +static void +wait_rdy(void) +{ + unsigned try = 100; + + while (try--) { + if (io_i915_read32(PCH_GMBUS2) & (1 << 11)) + return; + udelay(10); + } +} + +void +intel_gmbus_read_edid(u8 bus, u8 slave, u8 *edid) +{ + int i; + + wait_rdy(); + /* 100 KHz, hold 0ns, */ + io_i915_write32(bus, PCH_GMBUS0); + wait_rdy(); + /* Ensure index bits are disabled. */ + io_i915_write32(0, PCH_GMBUS5); + io_i915_write32(0x46000000 | (slave << 1), PCH_GMBUS1); + wait_rdy(); + /* Ensure index bits are disabled. */ + io_i915_write32(0, PCH_GMBUS5); + io_i915_write32(0x4a800001 | (slave << 1), PCH_GMBUS1); + for (i = 0; i < 128 / 4; i++) { + u32 reg32; + wait_rdy(); + reg32 = io_i915_read32(PCH_GMBUS3); + edid[4 * i] = reg32 & 0xff; + edid[4 * i + 1] = (reg32 >> 8) & 0xff; + edid[4 * i + 2] = (reg32 >> 16) & 0xff; + edid[4 * i + 3] = (reg32 >> 24) & 0xff; + } + wait_rdy(); + io_i915_write32(0x4a800000 | (slave << 1), PCH_GMBUS1); + wait_rdy(); + io_i915_write32(0x48000000, PCH_GMBUS0); + io_i915_write32(0x00008000, PCH_GMBUS2); + + printk (BIOS_INFO, "EDID:\n"); + for (i = 0; i < 128; i++) { + printk (BIOS_INFO, "%02x ", edid[i]); + if ((i & 0xf) == 0xf) + printk (BIOS_INFO, "\n"); + } +} diff --git a/src/drivers/intel/gma/edid.h b/src/drivers/intel/gma/edid.h new file mode 100644 index 0000000..d5d5244 --- /dev/null +++ b/src/drivers/intel/gma/edid.h @@ -0,0 +1,2 @@ +void +intel_gmbus_read_edid(u8 bus, u8 slave, u8 *edid); diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig index 7ed2665..977d9e5 100644 --- a/src/mainboard/lenovo/x60/Kconfig +++ b/src/mainboard/lenovo/x60/Kconfig @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_NATIVE_VGA_INIT select EARLY_CBMEM_INIT select H8_DOCK_EARLY_INIT + select INTEL_EDID config MAINBOARD_DIR string diff --git a/src/mainboard/lenovo/x60/i915.c b/src/mainboard/lenovo/x60/i915.c index 4870fd8..abff0ca 100644 --- a/src/mainboard/lenovo/x60/i915.c +++ b/src/mainboard/lenovo/x60/i915.c @@ -64,16 +64,6 @@ static unsigned int physbase; static u32 htotal, hblank, hsync, vtotal, vblank, vsync; -const u8 x60_edid_data[] = { - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x30, 0xae, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x01, 0x03, 0x80, 0x19, 0x12, 0x78, 0xea, 0xed, 0x75, 0x91, 0x57, 0x4f, 0x8b, 0x26, - 0x21, 0x50, 0x54, 0x21, 0x08, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x28, 0x15, 0x00, 0x40, 0x41, 0x00, 0x26, 0x30, 0x18, 0x88, - 0x36, 0x00, 0xf6, 0xb9, 0x00, 0x00, 0x00, 0x18, 0xed, 0x10, 0x00, 0x40, 0x41, 0x00, 0x26, 0x30, - 0x18, 0x88, 0x36, 0x00, 0xf6, 0xb9, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x61, - 0x43, 0x32, 0x61, 0x43, 0x28, 0x0f, 0x01, 0x00, 0x4c, 0xa3, 0x58, 0x4a, 0x00, 0x00, 0x00, 0xfe, - 0x00, 0x4c, 0x54, 0x4e, 0x31, 0x32, 0x31, 0x58, 0x4a, 0x2d, 0x4c, 0x30, 0x37, 0x0a, 0x00, 0x00, -}; #define READ32(addr) io_i915_READ32(addr) #define WRITE32(val, addr) io_i915_WRITE32(val, addr) @@ -279,6 +269,7 @@ int i915lightup(unsigned int pphysbase, unsigned int piobase, unsigned int pmmio, unsigned int pgfx) { static struct edid edid; + static u8 x60_edid_data[128]; int index; unsigned long temp; @@ -293,7 +284,8 @@ int i915lightup(unsigned int pphysbase, unsigned int piobase, globalstart = rdtscll(); - decode_edid((unsigned char *)&x60_edid_data, + intel_gmbus_read_edid(3, 0x50, x60_edid_data); + decode_edid(x60_edid_data, sizeof(x60_edid_data), &edid); htotal = (edid.ha - 1) | ((edid.ha + edid.hbl - 1) << 16); diff --git a/src/northbridge/intel/nehalem/Kconfig b/src/northbridge/intel/nehalem/Kconfig index 69d0eee..4cbaf22 100644 --- a/src/northbridge/intel/nehalem/Kconfig +++ b/src/northbridge/intel/nehalem/Kconfig @@ -23,6 +23,7 @@ config NORTHBRIDGE_INTEL_NEHALEM select MMCONF_SUPPORT select MMCONF_SUPPORT_DEFAULT select VGA + select INTEL_EDID if NORTHBRIDGE_INTEL_NEHALEM diff --git a/src/northbridge/intel/nehalem/fake_vbios.c b/src/northbridge/intel/nehalem/fake_vbios.c index 5daf5ff..2aae2e3 100644 --- a/src/northbridge/intel/nehalem/fake_vbios.c +++ b/src/northbridge/intel/nehalem/fake_vbios.c @@ -320,236 +320,8 @@ inb(0x03c8); // Device I/O --> 00 outb(0x01, 0x03c4); // Device I/O <-- inw(0x03c4); // Device I/O --> 0x2001 outw(0x2001, 0x03c4); // Device I/O -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00000800 -outl(0x000c5100, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00000000 -outl(0x00000003, 0x1044); // Device I/O -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008800 -outl(0x000c5120, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00000000 -outl(0x00000000, 0x1044); // Device I/O -outl(0x000c5104, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00000000 -outl(0x460000a0, 0x1044); // Device I/O -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 0000ca00 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 0000ca00 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 0000ca00 -outl(0x000c5120, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00000000 -outl(0x00000000, 0x1044); // Device I/O -outl(0x000c5104, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 060000a0 -outl(0x4a8000a1, 0x1044); // Device I/O -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a08 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a08 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> ffffff00 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a0c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a0c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00ffffff -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a10 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a10 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 4011ae30 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a14 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a14 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00000000 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a18 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a18 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 03011300 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a1c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a1c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 78101a80 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a20 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a20 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 9795baea -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a24 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a24 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 278c5559 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a28 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a28 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00545021 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a2c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a2c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 01010000 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a30 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a30 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 01010101 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a34 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a34 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 01010101 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a38 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a38 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 01010101 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a3c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a3c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 1b120101 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a40 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a40 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 20508000 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a44 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a44 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 20183014 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a48 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a48 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> a3050044 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a4c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a4c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 1f000010 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a50 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a50 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 80001693 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a54 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a54 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 30142050 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a58 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a58 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00442018 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a5c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a5c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 0010a305 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a60 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a60 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00001f00 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a64 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a64 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 81000f00 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a68 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a68 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 0a813c0a -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a6c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a6c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00091632 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a70 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a70 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 01f0e430 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a74 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a74 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> fe000000 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a78 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a78 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 31504c00 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a7c -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008a7c -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 58573132 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008800 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008800 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 4c542d33 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008800 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008800 -outl(0x000c510c, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> ac003143 -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008000 -outl(0x000c5104, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 028000a1 -outl(0x480000a0, 0x1044); // Device I/O -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008000 -outl(0x000c5100, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00000003 -outl(0x48000000, 0x1044); // Device I/O -outl(0x000c5108, 0x1040); // Device I/O -inl(0x1044); // Device I/O --> 00008000 -outl(0x00008000, 0x1044); // Device I/O +u8 edid[128]; +intel_gmbus_read_edid(3, 0x50, edid); outb(0x01, 0x03c4); // Device I/O <-- inw(0x03c4); // Device I/O --> 0x2001 outw(0x0001, 0x03c4); // Device I/O diff --git a/src/northbridge/intel/nehalem/gma.c b/src/northbridge/intel/nehalem/gma.c index 2f13a6b..4d304f3 100644 --- a/src/northbridge/intel/nehalem/gma.c +++ b/src/northbridge/intel/nehalem/gma.c @@ -28,6 +28,8 @@ #include <device/pci_ops.h> #include <cpu/x86/msr.h> #include <cpu/x86/mtrr.h> +#include <drivers/intel/gma/edid.h> +#include <drivers/intel/gma/i915.h> #include "chip.h" #include "nehalem.h" @@ -549,6 +551,21 @@ static void gma_pm_init_pre_vbios(struct device *dev) #include <pc80/vga_io.h> #if CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT + +/* The mainboard must provide these functions. */ +unsigned long io_i915_read32(unsigned long addr) +{ + outl(addr, 0x1040); + return inl(0x1044); +} +void io_i915_write32(unsigned long val, unsigned long addr) +{ + outl(addr, 0x1040); + inl(0x1044); + outl(val, 0x1044); +} + + static void fake_vbios(void) { #include "fake_vbios.c" diff --git a/src/northbridge/intel/nehalem/nehalem.h b/src/northbridge/intel/nehalem/nehalem.h index e79a343..60cafdf 100644 --- a/src/northbridge/intel/nehalem/nehalem.h +++ b/src/northbridge/intel/nehalem/nehalem.h @@ -504,7 +504,6 @@ void init_iommu(void); #define MCHBAR32(x) *((volatile u32 *)(DEFAULT_MCHBAR + x)) #define MCHBAR32_OR(x, or) MCHBAR32(x) = (MCHBAR32(x) | (or)) -#define SSKPD 0x5d14 /* 16bit (scratchpad) */ #define BIOS_RESET_CPL 0x5da8 /* 8bit */ /*
1
0
0
0
Patch set updated for coreboot: d9ba06e lenovo/x60: Support digitizer on X60t and X201t.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5239
-gerrit commit d9ba06eaaade32e39ef1db4e1ab83b1679de73f9 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 17:00:46 2014 +0100 lenovo/x60: Support digitizer on X60t and X201t. Change-Id: I5b0399a8edca3b73aa7d515d2c446c31b3239fa5 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/Kconfig | 4 +- src/mainboard/lenovo/x201/Kconfig | 4 +- src/mainboard/lenovo/x201/acpi_tables.c | 2 + src/mainboard/lenovo/x201/devicetree.cb | 14 +++ src/mainboard/lenovo/x201/romstage.c | 2 +- src/mainboard/lenovo/x60/Kconfig | 3 +- src/mainboard/lenovo/x60/acpi_tables.c | 2 + src/mainboard/lenovo/x60/devicetree.cb | 7 +- src/odm_oem/Kconfig | 2 + src/odm_oem/lenovo/Kconfig | 28 +++++ src/odm_oem/lenovo/Makefile.inc | 1 + src/odm_oem/lenovo/lenovo.h | 3 + src/odm_oem/lenovo/wacom.c | 174 ++++++++++++++++++++++++++++++++ 13 files changed, 239 insertions(+), 7 deletions(-) diff --git a/src/mainboard/lenovo/Kconfig b/src/mainboard/lenovo/Kconfig index a29fdbf..1de11a8 100644 --- a/src/mainboard/lenovo/Kconfig +++ b/src/mainboard/lenovo/Kconfig @@ -4,7 +4,7 @@ choice prompt "Mainboard model" config BOARD_LENOVO_X60 - bool "ThinkPad X60 / X60s" + bool "ThinkPad X60 / X60s / X60t" help The following X60 series ThinkPad machines have been verified to work correctly: @@ -13,7 +13,7 @@ config BOARD_LENOVO_X60 ThinkPad X60 (Model 1709) config BOARD_LENOVO_X201 - bool "ThinkPad X201" + bool "ThinkPad X201 / X201s / X201t" help Lenovo X201 laptop. Consult wiki for details. diff --git a/src/mainboard/lenovo/x201/Kconfig b/src/mainboard/lenovo/x201/Kconfig index 8e7ebae..4caf58c 100644 --- a/src/mainboard/lenovo/x201/Kconfig +++ b/src/mainboard/lenovo/x201/Kconfig @@ -18,6 +18,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select EARLY_CBMEM_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT + select SUPERIO_NSC_PC87382 + select DRIVERS_LENOVO_WACOM config MAINBOARD_DIR string @@ -29,7 +31,7 @@ config MAINBOARD_PART_NUMBER config MAINBOARD_VERSION string - default "ThinkPad X201" + default "ThinkPad X201 / X201s / X201t" config MAINBOARD_VENDOR string diff --git a/src/mainboard/lenovo/x201/acpi_tables.c b/src/mainboard/lenovo/x201/acpi_tables.c index 165de0d..981c52e 100644 --- a/src/mainboard/lenovo/x201/acpi_tables.c +++ b/src/mainboard/lenovo/x201/acpi_tables.c @@ -31,6 +31,7 @@ #include <device/pci.h> #include <device/pci_ids.h> #include "southbridge/intel/ibexpeak/nvs.h" +#include "odm_oem/lenovo/lenovo.h" extern const unsigned char AmlCode[]; #if CONFIG_HAVE_ACPI_SLIC @@ -93,6 +94,7 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0); return (unsigned long)(acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x201/devicetree.cb b/src/mainboard/lenovo/x201/devicetree.cb index 37a430c..0b978de 100644 --- a/src/mainboard/lenovo/x201/devicetree.cb +++ b/src/mainboard/lenovo/x201/devicetree.cb @@ -139,6 +139,20 @@ chip northbridge/intel/nehalem end device pci 1f.0 on # PCI-LPC bridge subsystemid 0x17aa 0x2166 + chip superio/nsc/pc87382 + device pnp 164e.3 on # Digitizer + io 0x60 = 0x200 + irq 0x29 = 0xb0 + irq 0x70 = 0x5 + irq 0xf0 = 0x82 + end + # IR, not connected + device pnp 164e.2 off end + # GPIO, not connected + device pnp 164e.7 off end + # DLPC, not connected + device pnp 164e.19 off end + end end device pci 1f.2 on # IDE/SATA subsystemid 0x17aa 0x2168 diff --git a/src/mainboard/lenovo/x201/romstage.c b/src/mainboard/lenovo/x201/romstage.c index f0874d3..9b99c4e 100644 --- a/src/mainboard/lenovo/x201/romstage.c +++ b/src/mainboard/lenovo/x201/romstage.c @@ -53,7 +53,7 @@ static void pch_enable_lpc(void) /* Enable EC, PS/2 Keyboard/Mouse */ pci_write_config16(PCH_LPC_DEV, LPC_EN, CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN | - COMA_LPC_EN); + COMA_LPC_EN | GAMEL_LPC_EN); pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, 0x7c1601); pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, 0xc15e1); diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig index 7ed2665..8c1417e 100644 --- a/src/mainboard/lenovo/x60/Kconfig +++ b/src/mainboard/lenovo/x60/Kconfig @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_NATIVE_VGA_INIT select EARLY_CBMEM_INIT select H8_DOCK_EARLY_INIT + select DRIVERS_LENOVO_WACOM config MAINBOARD_DIR string @@ -41,7 +42,7 @@ config DCACHE_RAM_SIZE config MAINBOARD_PART_NUMBER string - default "ThinkPad X60 / X60s" + default "ThinkPad X60 / X60s / X60t" config MMCONF_BASE_ADDRESS hex diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c index f6ed4ae..d6ce4ba 100644 --- a/src/mainboard/lenovo/x60/acpi_tables.c +++ b/src/mainboard/lenovo/x60/acpi_tables.c @@ -29,6 +29,7 @@ #include <device/device.h> #include <device/pci.h> #include <device/pci_ids.h> +#include "odm_oem/lenovo/lenovo.h" extern const unsigned char AmlCode[]; #if CONFIG_HAVE_ACPI_SLIC @@ -86,6 +87,7 @@ unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1); return (unsigned long) (acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb index 3880f18..5b4e37f 100644 --- a/src/mainboard/lenovo/x60/devicetree.cb +++ b/src/mainboard/lenovo/x60/devicetree.cb @@ -127,8 +127,11 @@ chip northbridge/intel/i945 io 0x60 = 0x2f8 end - device pnp 164e.3 off # Serial Port - io 0x60 = 0x3f8 + device pnp 164e.3 on # Digitizer + io 0x60 = 0x200 + irq 0x29 = 0xb0 + irq 0x70 = 0x5 + irq 0xf0 = 0x82 end device pnp 164e.7 on # GPIO diff --git a/src/odm_oem/Kconfig b/src/odm_oem/Kconfig index 6eb2993..e1f5243 100644 --- a/src/odm_oem/Kconfig +++ b/src/odm_oem/Kconfig @@ -1,3 +1,5 @@ menu "OEM / ODM" +source "src/odm_oem/lenovo/Kconfig" + endmenu diff --git a/src/odm_oem/lenovo/Kconfig b/src/odm_oem/lenovo/Kconfig new file mode 100644 index 0000000..5056b1e --- /dev/null +++ b/src/odm_oem/lenovo/Kconfig @@ -0,0 +1,28 @@ +config DRIVERS_LENOVO_WACOM + bool + default n + +if DRIVERS_LENOVO_WACOM + +choice + prompt "Digitizer" + +config DIGITIZER_AUTODETECT + bool "Autodetect" + help + The presence of digitizer is inferred from model number stored in + AT24RF chip. + +config DIGITIZER_PRESENT + bool "Present" + help + The digitizer is assumed to be present. + +config DIGITIZER_ABSENT + bool "Absent" + help + The digitizer is assumed to be absent. + +endchoice + +endif diff --git a/src/odm_oem/lenovo/Makefile.inc b/src/odm_oem/lenovo/Makefile.inc index 18e2110..bbb39d4 100644 --- a/src/odm_oem/lenovo/Makefile.inc +++ b/src/odm_oem/lenovo/Makefile.inc @@ -1 +1,2 @@ ramstage-y += serials.c +ramstage-$(CONFIG_DRIVERS_LENOVO_WACOM) += wacom.c diff --git a/src/odm_oem/lenovo/lenovo.h b/src/odm_oem/lenovo/lenovo.h index 6824eb6..25074bc 100644 --- a/src/odm_oem/lenovo/lenovo.h +++ b/src/odm_oem/lenovo/lenovo.h @@ -1 +1,4 @@ const char *lenovo_mainboard_partnumber(void); +int drivers_lenovo_is_wacom_present(void); +void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, + int have_dock_serial); diff --git a/src/odm_oem/lenovo/wacom.c b/src/odm_oem/lenovo/wacom.c new file mode 100644 index 0000000..c5be6ed --- /dev/null +++ b/src/odm_oem/lenovo/wacom.c @@ -0,0 +1,174 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2009 coresystems GmbH + * Copyright (C) 2011 The Chromium OS Authors. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2, or (at your + * option) any later version, of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include <types.h> +#include <console/console.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <device/device.h> +#include <device/pnp.h> +#include <string.h> +#include "odm_oem/lenovo/lenovo.h" + +const char tablet_numbers[][5] = { + /* X60t. */ + "6363", "6364", "6365", "6366", + "6367", "6368", "7762", "7763", + "7764", "7767", "7768", "7769", + /* X201t. */ + "0053", "0831", "2985", "3093", + "3113", "3144", "3239", "4184", + "7448", "7449", "7450", "7453", + "2263", "2266", +}; + +int +drivers_lenovo_is_wacom_present(void) +{ +#if IS_ENABLED(CONFIG_DIGITIZER_PRESENT) + printk (BIOS_INFO, "Digitizer state forced as present\n"); + return 1; +#elif IS_ENABLED(CONFIG_DIGITIZER_ABSENT) + printk (BIOS_INFO, "Digitizer state forced as absent\n"); + return 0; +#else + const char *pn; + int i; + static int result = -1; + device_t superio; + u8 sioid; + + if (result != -1) + return result; + superio = dev_find_slot_pnp (0x164e, 3); + if (!superio) { + printk (BIOS_INFO, "No Super I/O, skipping wacom\n"); + return (result = 0); + } + + /* Probe ID. */ + sioid = pnp_read_config(superio, 0x20); + if (sioid == 0xff) { + printk (BIOS_INFO, "Super I/O probe failed, skipping wacom\n"); + return (result = 0); + } + + pn = lenovo_mainboard_partnumber(); + if (!pn) + return 0; + printk (BIOS_DEBUG, "Lenovo P/N is %s\n", pn); + for (i = 0; i < sizeof (tablet_numbers) / sizeof (tablet_numbers[0]); + i++) + if (memcmp (tablet_numbers[i], pn, 4) == 0) { + printk (BIOS_DEBUG, "Lenovo P/N %s is a tablet\n", pn); + return (result = 1); + } + printk (BIOS_DEBUG, "Lenovo P/N %s is not a tablet\n", pn); + return (result = 0); +#endif +} + +void +drivers_lenovo_serial_ports_ssdt_generate(const char *scope, + int have_dock_serial) +{ + int scopelen, devicelen, reslen, methodlen; + + scopelen = acpigen_write_scope(scope); + + if (drivers_lenovo_is_wacom_present()) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("DTR"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("WACF004"); + + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x200, 0x200, 1, 8, 1); + reslen += acpigen_write_irq(0x20); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + + acpigen_patch_len(methodlen); + devicelen += methodlen; + + acpigen_patch_len(devicelen - 1); + scopelen += devicelen; + } + + if (have_dock_serial) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("COMA"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("PNP0501"); + devicelen += acpigen_write_name("_UID"); + /* Byte */ + devicelen += acpigen_write_byte(0x2); + + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x3f8, 0x3f8, 1, 8, 1); + reslen += acpigen_write_irq(0x10); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + acpigen_patch_len(methodlen); + + devicelen += methodlen; + + acpigen_patch_len(devicelen - 1); + scopelen += devicelen; + } + + acpigen_patch_len(scopelen - 1); +}
1
0
0
0
Patch set updated for coreboot: e033ead lenovo/t60: Enable Infrared port.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5243
-gerrit commit e033eadf19de41c5ddd8de077f6cb121d9388c74 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 19:17:10 2014 +0100 lenovo/t60: Enable Infrared port. Change-Id: I10f05334328c9929a99352185d286a7a17898801 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/t60/acpi/superio.asl | 16 ++++++++++++++++ src/mainboard/lenovo/t60/devicetree.cb | 4 ++++ src/mainboard/lenovo/t60/romstage.c | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mainboard/lenovo/t60/acpi/superio.asl b/src/mainboard/lenovo/t60/acpi/superio.asl index e69de29..a0d8e0a 100644 --- a/src/mainboard/lenovo/t60/acpi/superio.asl +++ b/src/mainboard/lenovo/t60/acpi/superio.asl @@ -0,0 +1,16 @@ + Device (FIR) // Infrared + { + Name(_HID, EISAID("IBM0071")) + Name(_CID, EISAID("PNP0511")) + + Name(_CRS, ResourceTemplate() + { + IO (Decode16, 0x2f8, 0x2f8, 0x01, 0x08) + IRQNoFlags () {3} + }) + + Method (_STA, 0) + { + Return (0xf) + } + } diff --git a/src/mainboard/lenovo/t60/devicetree.cb b/src/mainboard/lenovo/t60/devicetree.cb index b87a223..cce5f93 100644 --- a/src/mainboard/lenovo/t60/devicetree.cb +++ b/src/mainboard/lenovo/t60/devicetree.cb @@ -148,6 +148,10 @@ chip northbridge/intel/i945 chip superio/nsc/pc87382 device pnp 164e.2 on # IR io 0x60 = 0x2f8 + irq 0x29 = 0xb0 + irq 0x70 = 0x3 + drq 0x74 = 0x1 + irq 0xf0 = 0x82 end device pnp 164e.3 off # Serial Port diff --git a/src/mainboard/lenovo/t60/romstage.c b/src/mainboard/lenovo/t60/romstage.c index dae917c..237e967 100644 --- a/src/mainboard/lenovo/t60/romstage.c +++ b/src/mainboard/lenovo/t60/romstage.c @@ -79,7 +79,7 @@ static void ich7_enable_lpc(void) // decode range pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x80, 0x0210); // decode range - pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0d); + pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0f); /* range 0x1600 - 0x167f */ pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x84, 0x1601);
1
0
0
0
Patch set updated for coreboot: 33afc1f lenovo/x60: Enable Infrared port.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5242
-gerrit commit 33afc1f4aa7f8a8aa7f2ceea2e025de3a12c8192 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 19:13:00 2014 +0100 lenovo/x60: Enable Infrared port. Change-Id: I8ce0195bc85a983627826b31eb9879c3dbc80dd9 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/x201/acpi_tables.c | 2 +- src/mainboard/lenovo/x60/acpi_tables.c | 2 +- src/mainboard/lenovo/x60/devicetree.cb | 4 +++ src/mainboard/lenovo/x60/romstage.c | 2 +- src/odm_oem/lenovo/lenovo.h | 3 ++- src/odm_oem/lenovo/wacom.c | 44 ++++++++++++++++++++++++++++++++- 6 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/mainboard/lenovo/x201/acpi_tables.c b/src/mainboard/lenovo/x201/acpi_tables.c index 981c52e..26c8f02 100644 --- a/src/mainboard/lenovo/x201/acpi_tables.c +++ b/src/mainboard/lenovo/x201/acpi_tables.c @@ -94,7 +94,7 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); - drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0, 0); return (unsigned long)(acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c index d6ce4ba..c7c0a1a 100644 --- a/src/mainboard/lenovo/x60/acpi_tables.c +++ b/src/mainboard/lenovo/x60/acpi_tables.c @@ -87,7 +87,7 @@ unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); - drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1, 1); return (unsigned long) (acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb index 5b4e37f..acd5af3 100644 --- a/src/mainboard/lenovo/x60/devicetree.cb +++ b/src/mainboard/lenovo/x60/devicetree.cb @@ -125,6 +125,10 @@ chip northbridge/intel/i945 chip superio/nsc/pc87382 device pnp 164e.2 on # IR io 0x60 = 0x2f8 + irq 0x29 = 0xb0 + irq 0x70 = 0x3 + drq 0x74 = 0x1 + irq 0xf0 = 0x82 end device pnp 164e.3 on # Digitizer diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c index 1198fb2..8eca464 100644 --- a/src/mainboard/lenovo/x60/romstage.c +++ b/src/mainboard/lenovo/x60/romstage.c @@ -86,7 +86,7 @@ static void ich7_enable_lpc(void) // decode range pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x80, 0x0210); // decode range - pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0d); + pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0f); /* range 0x1600 - 0x167f */ pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x84, 0x1601); diff --git a/src/odm_oem/lenovo/lenovo.h b/src/odm_oem/lenovo/lenovo.h index 25074bc..9abda4b 100644 --- a/src/odm_oem/lenovo/lenovo.h +++ b/src/odm_oem/lenovo/lenovo.h @@ -1,4 +1,5 @@ const char *lenovo_mainboard_partnumber(void); int drivers_lenovo_is_wacom_present(void); void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, - int have_dock_serial); + int have_dock_serial, + int have_infrared); diff --git a/src/odm_oem/lenovo/wacom.c b/src/odm_oem/lenovo/wacom.c index c5be6ed..bc962c8 100644 --- a/src/odm_oem/lenovo/wacom.c +++ b/src/odm_oem/lenovo/wacom.c @@ -89,7 +89,8 @@ drivers_lenovo_is_wacom_present(void) void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, - int have_dock_serial) + int have_dock_serial, + int have_infrared) { int scopelen, devicelen, reslen, methodlen; @@ -131,6 +132,47 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope, scopelen += devicelen; } + if (have_infrared) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("FIR"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("IBM0071"); + devicelen += acpigen_write_name("_CID"); + devicelen += acpigen_emit_eisaid("PNP0511"); + devicelen += acpigen_write_name("_UID"); + + /* One */ + devicelen += acpigen_write_byte(0x1); + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x2f8, 0x2f8, 1, 8, 1); + reslen += acpigen_write_irq(0x08); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + acpigen_patch_len(methodlen); + + devicelen += methodlen; + + acpigen_patch_len(devicelen - 1); + scopelen += devicelen; + } + if (have_dock_serial) { /* Device op. */ scopelen += acpigen_emit_byte(0x5b);
1
0
0
0
Patch set updated for coreboot: d36a969 lenovo/t60: Enable Infrared port.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5243
-gerrit commit d36a969ba61dce4a168ba60bc38a37df4ea0d6f7 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 19:17:10 2014 +0100 lenovo/t60: Enable Infrared port. Change-Id: I10f05334328c9929a99352185d286a7a17898801 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/t60/acpi/superio.asl | 16 ++++++++++++++++ src/mainboard/lenovo/t60/devicetree.cb | 4 ++++ src/mainboard/lenovo/t60/romstage.c | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mainboard/lenovo/t60/acpi/superio.asl b/src/mainboard/lenovo/t60/acpi/superio.asl index e69de29..a0d8e0a 100644 --- a/src/mainboard/lenovo/t60/acpi/superio.asl +++ b/src/mainboard/lenovo/t60/acpi/superio.asl @@ -0,0 +1,16 @@ + Device (FIR) // Infrared + { + Name(_HID, EISAID("IBM0071")) + Name(_CID, EISAID("PNP0511")) + + Name(_CRS, ResourceTemplate() + { + IO (Decode16, 0x2f8, 0x2f8, 0x01, 0x08) + IRQNoFlags () {3} + }) + + Method (_STA, 0) + { + Return (0xf) + } + } diff --git a/src/mainboard/lenovo/t60/devicetree.cb b/src/mainboard/lenovo/t60/devicetree.cb index b87a223..cce5f93 100644 --- a/src/mainboard/lenovo/t60/devicetree.cb +++ b/src/mainboard/lenovo/t60/devicetree.cb @@ -148,6 +148,10 @@ chip northbridge/intel/i945 chip superio/nsc/pc87382 device pnp 164e.2 on # IR io 0x60 = 0x2f8 + irq 0x29 = 0xb0 + irq 0x70 = 0x3 + drq 0x74 = 0x1 + irq 0xf0 = 0x82 end device pnp 164e.3 off # Serial Port diff --git a/src/mainboard/lenovo/t60/romstage.c b/src/mainboard/lenovo/t60/romstage.c index dae917c..237e967 100644 --- a/src/mainboard/lenovo/t60/romstage.c +++ b/src/mainboard/lenovo/t60/romstage.c @@ -79,7 +79,7 @@ static void ich7_enable_lpc(void) // decode range pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x80, 0x0210); // decode range - pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0d); + pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0f); /* range 0x1600 - 0x167f */ pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x84, 0x1601);
1
0
0
0
Patch set updated for coreboot: 2896789 lenovo/x60: Enable Infrared port.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5242
-gerrit commit 28967896bca9ce36efa5cce9c1f5b4f7a5235918 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 19:13:00 2014 +0100 lenovo/x60: Enable Infrared port. Change-Id: I8ce0195bc85a983627826b31eb9879c3dbc80dd9 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/x201/acpi_tables.c | 2 +- src/mainboard/lenovo/x60/acpi_tables.c | 2 +- src/mainboard/lenovo/x60/devicetree.cb | 4 +++ src/mainboard/lenovo/x60/romstage.c | 2 +- src/odm_oem/lenovo/lenovo.h | 3 ++- src/odm_oem/lenovo/wacom.c | 44 ++++++++++++++++++++++++++++++++- 6 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/mainboard/lenovo/x201/acpi_tables.c b/src/mainboard/lenovo/x201/acpi_tables.c index 981c52e..26c8f02 100644 --- a/src/mainboard/lenovo/x201/acpi_tables.c +++ b/src/mainboard/lenovo/x201/acpi_tables.c @@ -94,7 +94,7 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); - drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0, 0); return (unsigned long)(acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c index d6ce4ba..c7c0a1a 100644 --- a/src/mainboard/lenovo/x60/acpi_tables.c +++ b/src/mainboard/lenovo/x60/acpi_tables.c @@ -87,7 +87,7 @@ unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); - drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1, 1); return (unsigned long) (acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb index 5b4e37f..acd5af3 100644 --- a/src/mainboard/lenovo/x60/devicetree.cb +++ b/src/mainboard/lenovo/x60/devicetree.cb @@ -125,6 +125,10 @@ chip northbridge/intel/i945 chip superio/nsc/pc87382 device pnp 164e.2 on # IR io 0x60 = 0x2f8 + irq 0x29 = 0xb0 + irq 0x70 = 0x3 + drq 0x74 = 0x1 + irq 0xf0 = 0x82 end device pnp 164e.3 on # Digitizer diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c index 1198fb2..8eca464 100644 --- a/src/mainboard/lenovo/x60/romstage.c +++ b/src/mainboard/lenovo/x60/romstage.c @@ -86,7 +86,7 @@ static void ich7_enable_lpc(void) // decode range pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x80, 0x0210); // decode range - pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0d); + pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0f); /* range 0x1600 - 0x167f */ pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x84, 0x1601); diff --git a/src/odm_oem/lenovo/lenovo.h b/src/odm_oem/lenovo/lenovo.h index 25074bc..9abda4b 100644 --- a/src/odm_oem/lenovo/lenovo.h +++ b/src/odm_oem/lenovo/lenovo.h @@ -1,4 +1,5 @@ const char *lenovo_mainboard_partnumber(void); int drivers_lenovo_is_wacom_present(void); void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, - int have_dock_serial); + int have_dock_serial, + int have_infrared); diff --git a/src/odm_oem/lenovo/wacom.c b/src/odm_oem/lenovo/wacom.c index 241db83..39f293f 100644 --- a/src/odm_oem/lenovo/wacom.c +++ b/src/odm_oem/lenovo/wacom.c @@ -89,7 +89,8 @@ drivers_lenovo_is_wacom_present(void) void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, - int have_dock_serial) + int have_dock_serial, + int have_infrared) { int scopelen, devicelen, reslen, methodlen; @@ -131,6 +132,47 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope, scopelen += devicelen; } + if (have_infrared) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("FIR"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("IBM0071"); + devicelen += acpigen_write_name("_CID"); + devicelen += acpigen_emit_eisaid("PNP0511"); + devicelen += acpigen_write_name("_UID"); + + /* One */ + devicelen += acpigen_write_byte(0x1); + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x2f8, 0x2f8, 1, 8, 1); + reslen += acpigen_write_irq(0x08); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + acpigen_patch_len(methodlen); + + devicelen += methodlen; + + acpigen_patch_len(devicelen - 1); + scopelen += devicelen; + } + if (have_dock_serial) { /* Device op. */ scopelen += acpigen_emit_byte(0x5b);
1
0
0
0
Patch set updated for coreboot: 0f34e18 lenovo/x60: Support digitizer on X60t and X201t.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5239
-gerrit commit 0f34e18abb5278f64bc0086861412d7e44dab919 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 17:00:46 2014 +0100 lenovo/x60: Support digitizer on X60t and X201t. Change-Id: I5b0399a8edca3b73aa7d515d2c446c31b3239fa5 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/Kconfig | 4 +- src/mainboard/lenovo/x201/Kconfig | 4 +- src/mainboard/lenovo/x201/acpi_tables.c | 2 + src/mainboard/lenovo/x201/devicetree.cb | 14 +++ src/mainboard/lenovo/x201/romstage.c | 2 +- src/mainboard/lenovo/x60/Kconfig | 3 +- src/mainboard/lenovo/x60/acpi_tables.c | 2 + src/mainboard/lenovo/x60/devicetree.cb | 7 +- src/odm_oem/Kconfig | 2 + src/odm_oem/lenovo/Kconfig | 28 +++++ src/odm_oem/lenovo/Makefile.inc | 1 + src/odm_oem/lenovo/lenovo.h | 3 + src/odm_oem/lenovo/wacom.c | 174 ++++++++++++++++++++++++++++++++ 13 files changed, 239 insertions(+), 7 deletions(-) diff --git a/src/mainboard/lenovo/Kconfig b/src/mainboard/lenovo/Kconfig index a29fdbf..1de11a8 100644 --- a/src/mainboard/lenovo/Kconfig +++ b/src/mainboard/lenovo/Kconfig @@ -4,7 +4,7 @@ choice prompt "Mainboard model" config BOARD_LENOVO_X60 - bool "ThinkPad X60 / X60s" + bool "ThinkPad X60 / X60s / X60t" help The following X60 series ThinkPad machines have been verified to work correctly: @@ -13,7 +13,7 @@ config BOARD_LENOVO_X60 ThinkPad X60 (Model 1709) config BOARD_LENOVO_X201 - bool "ThinkPad X201" + bool "ThinkPad X201 / X201s / X201t" help Lenovo X201 laptop. Consult wiki for details. diff --git a/src/mainboard/lenovo/x201/Kconfig b/src/mainboard/lenovo/x201/Kconfig index 8e7ebae..4caf58c 100644 --- a/src/mainboard/lenovo/x201/Kconfig +++ b/src/mainboard/lenovo/x201/Kconfig @@ -18,6 +18,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select EARLY_CBMEM_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT + select SUPERIO_NSC_PC87382 + select DRIVERS_LENOVO_WACOM config MAINBOARD_DIR string @@ -29,7 +31,7 @@ config MAINBOARD_PART_NUMBER config MAINBOARD_VERSION string - default "ThinkPad X201" + default "ThinkPad X201 / X201s / X201t" config MAINBOARD_VENDOR string diff --git a/src/mainboard/lenovo/x201/acpi_tables.c b/src/mainboard/lenovo/x201/acpi_tables.c index 165de0d..981c52e 100644 --- a/src/mainboard/lenovo/x201/acpi_tables.c +++ b/src/mainboard/lenovo/x201/acpi_tables.c @@ -31,6 +31,7 @@ #include <device/pci.h> #include <device/pci_ids.h> #include "southbridge/intel/ibexpeak/nvs.h" +#include "odm_oem/lenovo/lenovo.h" extern const unsigned char AmlCode[]; #if CONFIG_HAVE_ACPI_SLIC @@ -93,6 +94,7 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0); return (unsigned long)(acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x201/devicetree.cb b/src/mainboard/lenovo/x201/devicetree.cb index 37a430c..0b978de 100644 --- a/src/mainboard/lenovo/x201/devicetree.cb +++ b/src/mainboard/lenovo/x201/devicetree.cb @@ -139,6 +139,20 @@ chip northbridge/intel/nehalem end device pci 1f.0 on # PCI-LPC bridge subsystemid 0x17aa 0x2166 + chip superio/nsc/pc87382 + device pnp 164e.3 on # Digitizer + io 0x60 = 0x200 + irq 0x29 = 0xb0 + irq 0x70 = 0x5 + irq 0xf0 = 0x82 + end + # IR, not connected + device pnp 164e.2 off end + # GPIO, not connected + device pnp 164e.7 off end + # DLPC, not connected + device pnp 164e.19 off end + end end device pci 1f.2 on # IDE/SATA subsystemid 0x17aa 0x2168 diff --git a/src/mainboard/lenovo/x201/romstage.c b/src/mainboard/lenovo/x201/romstage.c index f0874d3..9b99c4e 100644 --- a/src/mainboard/lenovo/x201/romstage.c +++ b/src/mainboard/lenovo/x201/romstage.c @@ -53,7 +53,7 @@ static void pch_enable_lpc(void) /* Enable EC, PS/2 Keyboard/Mouse */ pci_write_config16(PCH_LPC_DEV, LPC_EN, CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN | - COMA_LPC_EN); + COMA_LPC_EN | GAMEL_LPC_EN); pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, 0x7c1601); pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, 0xc15e1); diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig index 7ed2665..8c1417e 100644 --- a/src/mainboard/lenovo/x60/Kconfig +++ b/src/mainboard/lenovo/x60/Kconfig @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_NATIVE_VGA_INIT select EARLY_CBMEM_INIT select H8_DOCK_EARLY_INIT + select DRIVERS_LENOVO_WACOM config MAINBOARD_DIR string @@ -41,7 +42,7 @@ config DCACHE_RAM_SIZE config MAINBOARD_PART_NUMBER string - default "ThinkPad X60 / X60s" + default "ThinkPad X60 / X60s / X60t" config MMCONF_BASE_ADDRESS hex diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c index f6ed4ae..d6ce4ba 100644 --- a/src/mainboard/lenovo/x60/acpi_tables.c +++ b/src/mainboard/lenovo/x60/acpi_tables.c @@ -29,6 +29,7 @@ #include <device/device.h> #include <device/pci.h> #include <device/pci_ids.h> +#include "odm_oem/lenovo/lenovo.h" extern const unsigned char AmlCode[]; #if CONFIG_HAVE_ACPI_SLIC @@ -86,6 +87,7 @@ unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1); return (unsigned long) (acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb index 3880f18..5b4e37f 100644 --- a/src/mainboard/lenovo/x60/devicetree.cb +++ b/src/mainboard/lenovo/x60/devicetree.cb @@ -127,8 +127,11 @@ chip northbridge/intel/i945 io 0x60 = 0x2f8 end - device pnp 164e.3 off # Serial Port - io 0x60 = 0x3f8 + device pnp 164e.3 on # Digitizer + io 0x60 = 0x200 + irq 0x29 = 0xb0 + irq 0x70 = 0x5 + irq 0xf0 = 0x82 end device pnp 164e.7 on # GPIO diff --git a/src/odm_oem/Kconfig b/src/odm_oem/Kconfig index 6eb2993..e1f5243 100644 --- a/src/odm_oem/Kconfig +++ b/src/odm_oem/Kconfig @@ -1,3 +1,5 @@ menu "OEM / ODM" +source "src/odm_oem/lenovo/Kconfig" + endmenu diff --git a/src/odm_oem/lenovo/Kconfig b/src/odm_oem/lenovo/Kconfig new file mode 100644 index 0000000..5056b1e --- /dev/null +++ b/src/odm_oem/lenovo/Kconfig @@ -0,0 +1,28 @@ +config DRIVERS_LENOVO_WACOM + bool + default n + +if DRIVERS_LENOVO_WACOM + +choice + prompt "Digitizer" + +config DIGITIZER_AUTODETECT + bool "Autodetect" + help + The presence of digitizer is inferred from model number stored in + AT24RF chip. + +config DIGITIZER_PRESENT + bool "Present" + help + The digitizer is assumed to be present. + +config DIGITIZER_ABSENT + bool "Absent" + help + The digitizer is assumed to be absent. + +endchoice + +endif diff --git a/src/odm_oem/lenovo/Makefile.inc b/src/odm_oem/lenovo/Makefile.inc index 18e2110..bbb39d4 100644 --- a/src/odm_oem/lenovo/Makefile.inc +++ b/src/odm_oem/lenovo/Makefile.inc @@ -1 +1,2 @@ ramstage-y += serials.c +ramstage-$(CONFIG_DRIVERS_LENOVO_WACOM) += wacom.c diff --git a/src/odm_oem/lenovo/lenovo.h b/src/odm_oem/lenovo/lenovo.h index 6824eb6..25074bc 100644 --- a/src/odm_oem/lenovo/lenovo.h +++ b/src/odm_oem/lenovo/lenovo.h @@ -1 +1,4 @@ const char *lenovo_mainboard_partnumber(void); +int drivers_lenovo_is_wacom_present(void); +void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, + int have_dock_serial); diff --git a/src/odm_oem/lenovo/wacom.c b/src/odm_oem/lenovo/wacom.c new file mode 100644 index 0000000..241db83 --- /dev/null +++ b/src/odm_oem/lenovo/wacom.c @@ -0,0 +1,174 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2009 coresystems GmbH + * Copyright (C) 2011 The Chromium OS Authors. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2, or (at your + * option) any later version, of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include <types.h> +#include <console/console.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <device/device.h> +#include <device/pnp.h> +#include <string.h> +#include "odm_oem/lenovo/lenovo.h" + +const char tablet_numbers[][5] = { + /* X60t. */ + "6363", "6364", "6365", "6366", + "6367", "6368", "7762", "7763", + "7764", "7767", "7768", "7769", + /* X201t. */ + "0053", "0831", "2985", "3093", + "3113", "3144", "3239", "4184", + "7448", "7449", "7450", "7453", + "2263", "2266", +}; + +int +drivers_lenovo_is_wacom_present(void) +{ +#if IS_ENABLED(CONFIG_DIGITIZER_PRESENT) + printk (BIOS_INFO, "Digitizer state forced as present\n"); + return 1; +#elif IS_ENABLED(CONFIG_DIGITIZER_ABSENT) + printk (BIOS_INFO, "Digitizer state forced as absent\n"); + return 0; +#else + const char *pn; + int i; + static int result = -1; + device_t superio; + u8 sioid; + + if (result != -1) + return result; + superio = dev_find_slot_pnp (0x164e, 3); + if (!superio) { + printk (BIOS_INFO, "No Super I/O, skipping wacom\n"); + return (result = 0); + } + + /* Probe ID. */ + sioid = pnp_read_config(superio, 0x20); + if (sioid == 0xff) { + printk (BIOS_INFO, "Super I/O probe failed, skipping wacom\n"); + return (result = 0); + } + + pn = lenovo_mainboard_partnumber(); + if (!pn) + return 0; + printk (BIOS_DEBUG, "Lenovo P/N is %s\n", pn); + for (i = 0; i < sizeof (tablet_numbers) / sizeof (tablet_numbers[0]); + i++) + if (memcmp (tablet_numbers[i], pn, 4) == 0) { + printk (BIOS_DEBUG, "Lenovo P/N %s is a tablet\n", pn); + return (result = 1); + } + printk (BIOS_DEBUG, "Lenovo P/N %s is not a tablet\n", pn); + return (result = 0); +#endif +} + +void +drivers_lenovo_serial_ports_ssdt_generate(const char *scope, + int have_dock_serial) +{ + int scopelen, devicelen, reslen, methodlen; + + scopelen = acpigen_write_scope(scope); + + if (drivers_lenovo_is_wacom_present()) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("DTR"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("WACF004"); + + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x200, 0x200, 1, 8, 1); + reslen += acpigen_write_irq(0x20); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + + acpigen_patch_len(methodlen); + devicelen += methodlen; + + acpigen_patch_len(devicelen - 1); + scopelen += devicelen; + } + + if (have_dock_serial) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("COMA"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("PNP0511"); + devicelen += acpigen_write_name("_UID"); + /* Byte */ + devicelen += acpigen_write_byte(0x2); + + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x3f8, 0x3f8, 1, 8, 1); + reslen += acpigen_write_irq(0x10); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + acpigen_patch_len(methodlen); + + devicelen += methodlen; + + acpigen_patch_len(devicelen - 1); + scopelen += devicelen; + } + + acpigen_patch_len(scopelen - 1); +}
1
0
0
0
Patch set updated for coreboot: e204c67 lenovo/t60: Enable Infrared port.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5243
-gerrit commit e204c672302203cedfa900d3ad66cc7692624c7e Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 19:17:10 2014 +0100 lenovo/t60: Enable Infrared port. Change-Id: I10f05334328c9929a99352185d286a7a17898801 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/t60/acpi/superio.asl | 16 ++++++++++++++++ src/mainboard/lenovo/t60/devicetree.cb | 4 ++++ src/mainboard/lenovo/t60/romstage.c | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mainboard/lenovo/t60/acpi/superio.asl b/src/mainboard/lenovo/t60/acpi/superio.asl index e69de29..a0d8e0a 100644 --- a/src/mainboard/lenovo/t60/acpi/superio.asl +++ b/src/mainboard/lenovo/t60/acpi/superio.asl @@ -0,0 +1,16 @@ + Device (FIR) // Infrared + { + Name(_HID, EISAID("IBM0071")) + Name(_CID, EISAID("PNP0511")) + + Name(_CRS, ResourceTemplate() + { + IO (Decode16, 0x2f8, 0x2f8, 0x01, 0x08) + IRQNoFlags () {3} + }) + + Method (_STA, 0) + { + Return (0xf) + } + } diff --git a/src/mainboard/lenovo/t60/devicetree.cb b/src/mainboard/lenovo/t60/devicetree.cb index b87a223..cce5f93 100644 --- a/src/mainboard/lenovo/t60/devicetree.cb +++ b/src/mainboard/lenovo/t60/devicetree.cb @@ -148,6 +148,10 @@ chip northbridge/intel/i945 chip superio/nsc/pc87382 device pnp 164e.2 on # IR io 0x60 = 0x2f8 + irq 0x29 = 0xb0 + irq 0x70 = 0x3 + drq 0x74 = 0x1 + irq 0xf0 = 0x82 end device pnp 164e.3 off # Serial Port diff --git a/src/mainboard/lenovo/t60/romstage.c b/src/mainboard/lenovo/t60/romstage.c index dae917c..237e967 100644 --- a/src/mainboard/lenovo/t60/romstage.c +++ b/src/mainboard/lenovo/t60/romstage.c @@ -79,7 +79,7 @@ static void ich7_enable_lpc(void) // decode range pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x80, 0x0210); // decode range - pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0d); + pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0f); /* range 0x1600 - 0x167f */ pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x84, 0x1601);
1
0
0
0
Patch set updated for coreboot: 72b6aa5 lenovo/x60: Enable Infrared port.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5242
-gerrit commit 72b6aa5d954211ff0b329a64cb8fba73c2eb7da9 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 19:13:00 2014 +0100 lenovo/x60: Enable Infrared port. Change-Id: I8ce0195bc85a983627826b31eb9879c3dbc80dd9 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/x201/acpi_tables.c | 2 +- src/mainboard/lenovo/x60/acpi_tables.c | 2 +- src/mainboard/lenovo/x60/devicetree.cb | 4 +++ src/mainboard/lenovo/x60/romstage.c | 2 +- src/odm_oem/lenovo/lenovo.h | 3 ++- src/odm_oem/lenovo/wacom.c | 44 ++++++++++++++++++++++++++++++++- 6 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/mainboard/lenovo/x201/acpi_tables.c b/src/mainboard/lenovo/x201/acpi_tables.c index 981c52e..26c8f02 100644 --- a/src/mainboard/lenovo/x201/acpi_tables.c +++ b/src/mainboard/lenovo/x201/acpi_tables.c @@ -94,7 +94,7 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); - drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0, 0); return (unsigned long)(acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c index d6ce4ba..c7c0a1a 100644 --- a/src/mainboard/lenovo/x60/acpi_tables.c +++ b/src/mainboard/lenovo/x60/acpi_tables.c @@ -87,7 +87,7 @@ unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); - drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1, 1); return (unsigned long) (acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb index 5b4e37f..acd5af3 100644 --- a/src/mainboard/lenovo/x60/devicetree.cb +++ b/src/mainboard/lenovo/x60/devicetree.cb @@ -125,6 +125,10 @@ chip northbridge/intel/i945 chip superio/nsc/pc87382 device pnp 164e.2 on # IR io 0x60 = 0x2f8 + irq 0x29 = 0xb0 + irq 0x70 = 0x3 + drq 0x74 = 0x1 + irq 0xf0 = 0x82 end device pnp 164e.3 on # Digitizer diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c index 1198fb2..8eca464 100644 --- a/src/mainboard/lenovo/x60/romstage.c +++ b/src/mainboard/lenovo/x60/romstage.c @@ -86,7 +86,7 @@ static void ich7_enable_lpc(void) // decode range pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x80, 0x0210); // decode range - pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0d); + pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x82, 0x1f0f); /* range 0x1600 - 0x167f */ pci_write_config16(PCI_DEV(0, 0x1f, 0), 0x84, 0x1601); diff --git a/src/odm_oem/lenovo/lenovo.h b/src/odm_oem/lenovo/lenovo.h index 25074bc..9abda4b 100644 --- a/src/odm_oem/lenovo/lenovo.h +++ b/src/odm_oem/lenovo/lenovo.h @@ -1,4 +1,5 @@ const char *lenovo_mainboard_partnumber(void); int drivers_lenovo_is_wacom_present(void); void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, - int have_dock_serial); + int have_dock_serial, + int have_infrared); diff --git a/src/odm_oem/lenovo/wacom.c b/src/odm_oem/lenovo/wacom.c index 241db83..cd6dd38 100644 --- a/src/odm_oem/lenovo/wacom.c +++ b/src/odm_oem/lenovo/wacom.c @@ -89,7 +89,8 @@ drivers_lenovo_is_wacom_present(void) void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, - int have_dock_serial) + int have_dock_serial, + int have_infrared) { int scopelen, devicelen, reslen, methodlen; @@ -131,6 +132,47 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope, scopelen += devicelen; } + if (have_infrared) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("FIR"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("IBM0071"); + devicelen += acpigen_write_name("_CID"); + devicelen += acpigen_emit_eisaid("PNP0511"); + devicelen += acpigen_write_name("_UID"); + + /* One */ + devicelen += acpigen_write_byte(0x1); + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x2f8, 0x2f8, 1, 8, 1); + reslen += acpigen_write_irq(0x80); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + acpigen_patch_len(methodlen); + + devicelen += methodlen; + + acpigen_patch_len(devicelen - 1); + scopelen += devicelen; + } + if (have_dock_serial) { /* Device op. */ scopelen += acpigen_emit_byte(0x5b);
1
0
0
0
Patch set updated for coreboot: 5ebf91b lenovo/x60: Support digitizer on X60t and X201t.
by Vladimir Serbinenko
16 Feb '14
16 Feb '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/5239
-gerrit commit 5ebf91bbc17b616bc3140737cd37da03acbc31c7 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Feb 15 17:00:46 2014 +0100 lenovo/x60: Support digitizer on X60t and X201t. Change-Id: I5b0399a8edca3b73aa7d515d2c446c31b3239fa5 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/lenovo/Kconfig | 4 +- src/mainboard/lenovo/x201/Kconfig | 4 +- src/mainboard/lenovo/x201/acpi_tables.c | 2 + src/mainboard/lenovo/x201/devicetree.cb | 14 +++ src/mainboard/lenovo/x201/romstage.c | 2 +- src/mainboard/lenovo/x60/Kconfig | 3 +- src/mainboard/lenovo/x60/acpi_tables.c | 2 + src/mainboard/lenovo/x60/devicetree.cb | 7 +- src/odm_oem/Kconfig | 2 + src/odm_oem/lenovo/Kconfig | 28 +++++ src/odm_oem/lenovo/Makefile.inc | 1 + src/odm_oem/lenovo/lenovo.h | 3 + src/odm_oem/lenovo/wacom.c | 174 ++++++++++++++++++++++++++++++++ 13 files changed, 239 insertions(+), 7 deletions(-) diff --git a/src/mainboard/lenovo/Kconfig b/src/mainboard/lenovo/Kconfig index a29fdbf..1de11a8 100644 --- a/src/mainboard/lenovo/Kconfig +++ b/src/mainboard/lenovo/Kconfig @@ -4,7 +4,7 @@ choice prompt "Mainboard model" config BOARD_LENOVO_X60 - bool "ThinkPad X60 / X60s" + bool "ThinkPad X60 / X60s / X60t" help The following X60 series ThinkPad machines have been verified to work correctly: @@ -13,7 +13,7 @@ config BOARD_LENOVO_X60 ThinkPad X60 (Model 1709) config BOARD_LENOVO_X201 - bool "ThinkPad X201" + bool "ThinkPad X201 / X201s / X201t" help Lenovo X201 laptop. Consult wiki for details. diff --git a/src/mainboard/lenovo/x201/Kconfig b/src/mainboard/lenovo/x201/Kconfig index 8e7ebae..4caf58c 100644 --- a/src/mainboard/lenovo/x201/Kconfig +++ b/src/mainboard/lenovo/x201/Kconfig @@ -18,6 +18,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy select HAVE_ACPI_RESUME select EARLY_CBMEM_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT + select SUPERIO_NSC_PC87382 + select DRIVERS_LENOVO_WACOM config MAINBOARD_DIR string @@ -29,7 +31,7 @@ config MAINBOARD_PART_NUMBER config MAINBOARD_VERSION string - default "ThinkPad X201" + default "ThinkPad X201 / X201s / X201t" config MAINBOARD_VENDOR string diff --git a/src/mainboard/lenovo/x201/acpi_tables.c b/src/mainboard/lenovo/x201/acpi_tables.c index 165de0d..981c52e 100644 --- a/src/mainboard/lenovo/x201/acpi_tables.c +++ b/src/mainboard/lenovo/x201/acpi_tables.c @@ -31,6 +31,7 @@ #include <device/pci.h> #include <device/pci_ids.h> #include "southbridge/intel/ibexpeak/nvs.h" +#include "odm_oem/lenovo/lenovo.h" extern const unsigned char AmlCode[]; #if CONFIG_HAVE_ACPI_SLIC @@ -93,6 +94,7 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0); return (unsigned long)(acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x201/devicetree.cb b/src/mainboard/lenovo/x201/devicetree.cb index 37a430c..0b978de 100644 --- a/src/mainboard/lenovo/x201/devicetree.cb +++ b/src/mainboard/lenovo/x201/devicetree.cb @@ -139,6 +139,20 @@ chip northbridge/intel/nehalem end device pci 1f.0 on # PCI-LPC bridge subsystemid 0x17aa 0x2166 + chip superio/nsc/pc87382 + device pnp 164e.3 on # Digitizer + io 0x60 = 0x200 + irq 0x29 = 0xb0 + irq 0x70 = 0x5 + irq 0xf0 = 0x82 + end + # IR, not connected + device pnp 164e.2 off end + # GPIO, not connected + device pnp 164e.7 off end + # DLPC, not connected + device pnp 164e.19 off end + end end device pci 1f.2 on # IDE/SATA subsystemid 0x17aa 0x2168 diff --git a/src/mainboard/lenovo/x201/romstage.c b/src/mainboard/lenovo/x201/romstage.c index f0874d3..9b99c4e 100644 --- a/src/mainboard/lenovo/x201/romstage.c +++ b/src/mainboard/lenovo/x201/romstage.c @@ -53,7 +53,7 @@ static void pch_enable_lpc(void) /* Enable EC, PS/2 Keyboard/Mouse */ pci_write_config16(PCH_LPC_DEV, LPC_EN, CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN | - COMA_LPC_EN); + COMA_LPC_EN | GAMEL_LPC_EN); pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, 0x7c1601); pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, 0xc15e1); diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig index 7ed2665..8c1417e 100644 --- a/src/mainboard/lenovo/x60/Kconfig +++ b/src/mainboard/lenovo/x60/Kconfig @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_NATIVE_VGA_INIT select EARLY_CBMEM_INIT select H8_DOCK_EARLY_INIT + select DRIVERS_LENOVO_WACOM config MAINBOARD_DIR string @@ -41,7 +42,7 @@ config DCACHE_RAM_SIZE config MAINBOARD_PART_NUMBER string - default "ThinkPad X60 / X60s" + default "ThinkPad X60 / X60s / X60t" config MMCONF_BASE_ADDRESS hex diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c index f6ed4ae..d6ce4ba 100644 --- a/src/mainboard/lenovo/x60/acpi_tables.c +++ b/src/mainboard/lenovo/x60/acpi_tables.c @@ -29,6 +29,7 @@ #include <device/device.h> #include <device/pci.h> #include <device/pci_ids.h> +#include "odm_oem/lenovo/lenovo.h" extern const unsigned char AmlCode[]; #if CONFIG_HAVE_ACPI_SLIC @@ -86,6 +87,7 @@ unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { generate_cpu_entries(); + drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1); return (unsigned long) (acpigen_get_current()); } diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb index 3880f18..5b4e37f 100644 --- a/src/mainboard/lenovo/x60/devicetree.cb +++ b/src/mainboard/lenovo/x60/devicetree.cb @@ -127,8 +127,11 @@ chip northbridge/intel/i945 io 0x60 = 0x2f8 end - device pnp 164e.3 off # Serial Port - io 0x60 = 0x3f8 + device pnp 164e.3 on # Digitizer + io 0x60 = 0x200 + irq 0x29 = 0xb0 + irq 0x70 = 0x5 + irq 0xf0 = 0x82 end device pnp 164e.7 on # GPIO diff --git a/src/odm_oem/Kconfig b/src/odm_oem/Kconfig index 6eb2993..e1f5243 100644 --- a/src/odm_oem/Kconfig +++ b/src/odm_oem/Kconfig @@ -1,3 +1,5 @@ menu "OEM / ODM" +source "src/odm_oem/lenovo/Kconfig" + endmenu diff --git a/src/odm_oem/lenovo/Kconfig b/src/odm_oem/lenovo/Kconfig new file mode 100644 index 0000000..5056b1e --- /dev/null +++ b/src/odm_oem/lenovo/Kconfig @@ -0,0 +1,28 @@ +config DRIVERS_LENOVO_WACOM + bool + default n + +if DRIVERS_LENOVO_WACOM + +choice + prompt "Digitizer" + +config DIGITIZER_AUTODETECT + bool "Autodetect" + help + The presence of digitizer is inferred from model number stored in + AT24RF chip. + +config DIGITIZER_PRESENT + bool "Present" + help + The digitizer is assumed to be present. + +config DIGITIZER_ABSENT + bool "Absent" + help + The digitizer is assumed to be absent. + +endchoice + +endif diff --git a/src/odm_oem/lenovo/Makefile.inc b/src/odm_oem/lenovo/Makefile.inc index 18e2110..bbb39d4 100644 --- a/src/odm_oem/lenovo/Makefile.inc +++ b/src/odm_oem/lenovo/Makefile.inc @@ -1 +1,2 @@ ramstage-y += serials.c +ramstage-$(CONFIG_DRIVERS_LENOVO_WACOM) += wacom.c diff --git a/src/odm_oem/lenovo/lenovo.h b/src/odm_oem/lenovo/lenovo.h index 6824eb6..25074bc 100644 --- a/src/odm_oem/lenovo/lenovo.h +++ b/src/odm_oem/lenovo/lenovo.h @@ -1 +1,4 @@ const char *lenovo_mainboard_partnumber(void); +int drivers_lenovo_is_wacom_present(void); +void drivers_lenovo_serial_ports_ssdt_generate(const char *scope, + int have_dock_serial); diff --git a/src/odm_oem/lenovo/wacom.c b/src/odm_oem/lenovo/wacom.c new file mode 100644 index 0000000..c28f5a5 --- /dev/null +++ b/src/odm_oem/lenovo/wacom.c @@ -0,0 +1,174 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2009 coresystems GmbH + * Copyright (C) 2011 The Chromium OS Authors. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2, or (at your + * option) any later version, of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include <types.h> +#include <console/console.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <device/device.h> +#include <device/pnp.h> +#include <string.h> +#include "odm_oem/lenovo/lenovo.h" + +const char tablet_numbers[][5] = { + /* X60t. */ + "6363", "6364", "6365", "6366", + "6367", "6368", "7762", "7763", + "7764", "7767", "7768", "7769", + /* X201t. */ + "0053", "0831", "2985", "3093", + "3113", "3144", "3239", "4184", + "7448", "7449", "7450", "7453", + "2263", "2266", +}; + +int +drivers_lenovo_is_wacom_present(void) +{ +#if IS_ENABLED(CONFIG_DIGITIZER_PRESENT) + printk (BIOS_INFO, "Digitizer state forced as present\n"); + return 1; +#elif IS_ENABLED(CONFIG_DIGITIZER_ABSENT) + printk (BIOS_INFO, "Digitizer state forced as absent\n"); + return 0; +#else + const char *pn; + int i; + static int result = -1; + device_t superio; + u8 sioid; + + if (result != -1) + return result; + superio = dev_find_slot_pnp (0x164e, 3); + if (!superio) { + printk (BIOS_INFO, "No Super I/O, skipping wacom\n"); + return (result = 0); + } + + /* Probe ID. */ + sioid = pnp_read_config(superio, 0x20); + if (sioid == 0xff) { + printk (BIOS_INFO, "Super I/O probe failed, skipping wacom\n"); + return (result = 0); + } + + pn = lenovo_mainboard_partnumber(); + if (!pn) + return 0; + printk (BIOS_DEBUG, "Lenovo P/N is %s\n", pn); + for (i = 0; i < sizeof (tablet_numbers) / sizeof (tablet_numbers[0]); + i++) + if (memcmp (tablet_numbers[i], pn, 4) == 0) { + printk (BIOS_DEBUG, "Lenovo P/N %s is a tablet\n", pn); + return (result = 1); + } + printk (BIOS_DEBUG, "Lenovo P/N %s is not a tablet\n", pn); + return (result = 0); +#endif +} + +void +drivers_lenovo_serial_ports_ssdt_generate(const char *scope, + int have_dock_serial) +{ + int scopelen, devicelen, reslen, methodlen; + + scopelen = acpigen_write_scope(scope); + + if (drivers_lenovo_is_wacom_present()) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("DTR"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("WACF004"); + + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x200, 0x200, 1, 8, 1); + reslen += acpigen_write_irq(0x20); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + + acpigen_patch_len(methodlen - 1); + devicelen += methodlen; + + acpigen_patch_len(devicelen); + scopelen += devicelen; + } + + if (have_dock_serial) { + /* Device op. */ + scopelen += acpigen_emit_byte(0x5b); + scopelen += acpigen_emit_byte(0x82); + devicelen = acpigen_write_len_f(); + devicelen += acpigen_emit_namestring("COMA"); + + devicelen += acpigen_write_name("_HID"); + devicelen += acpigen_emit_eisaid("PNP0511"); + devicelen += acpigen_write_name("_UID"); + /* Byte */ + devicelen += acpigen_write_byte(0x2); + + devicelen += acpigen_write_name("_CRS"); + + reslen = acpigen_write_resourcetemplate_header(); + reslen += acpigen_write_io16(0x3f8, 0x3f8, 1, 8, 1); + reslen += acpigen_write_irq(0x10); + + devicelen += reslen; + devicelen += acpigen_write_resourcetemplate_footer(reslen); + + /* method op */ + devicelen += acpigen_emit_byte(0x14); + methodlen = acpigen_write_len_f(); + methodlen += acpigen_emit_namestring("_STA"); + /* no fnarg */ + methodlen += acpigen_emit_byte(0x00); + /* return */ + methodlen += acpigen_emit_byte(0xa4); + methodlen += acpigen_write_byte(0xf); + acpigen_patch_len(methodlen - 1); + + devicelen += methodlen; + + acpigen_patch_len(devicelen); + scopelen += devicelen; + } + + acpigen_patch_len(scopelen - 1); +}
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
114
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Results per page:
10
25
50
100
200