Attach dwiic(4) to AMD FCH I2C controllers. These busses are separate from the SMBus that we attach to piixpm(4) today, and support direct config via ACPI.diff -r1.582 -r1.583 src/sys/arch/amd64/conf/GENERIC
(jmcneill)
--- src/sys/arch/amd64/conf/GENERIC 2021/01/20 13:22:08 1.582
+++ src/sys/arch/amd64/conf/GENERIC 2021/01/24 16:33:48 1.583
@@ -1,38 +1,38 @@ | @@ -1,38 +1,38 @@ | |||
1 | # $NetBSD: GENERIC,v 1.582 2021/01/20 13:22:08 nia Exp $ | 1 | # $NetBSD: GENERIC,v 1.583 2021/01/24 16:33:48 jmcneill Exp $ | |
2 | # | 2 | # | |
3 | # GENERIC machine description file | 3 | # GENERIC machine description file | |
4 | # | 4 | # | |
5 | # This machine description file is used to generate the default NetBSD | 5 | # This machine description file is used to generate the default NetBSD | |
6 | # kernel. The generic kernel does not include all options, subsystems | 6 | # kernel. The generic kernel does not include all options, subsystems | |
7 | # and device drivers, but should be useful for most applications. | 7 | # and device drivers, but should be useful for most applications. | |
8 | # | 8 | # | |
9 | # The machine description file can be customised for your specific | 9 | # The machine description file can be customised for your specific | |
10 | # machine to reduce the kernel size and improve its performance. | 10 | # machine to reduce the kernel size and improve its performance. | |
11 | # | 11 | # | |
12 | # For further information on compiling NetBSD kernels, see the config(8) | 12 | # For further information on compiling NetBSD kernels, see the config(8) | |
13 | # man page. | 13 | # man page. | |
14 | # | 14 | # | |
15 | # For further information on hardware support for this architecture, see | 15 | # For further information on hardware support for this architecture, see | |
16 | # the intro(4) man page. For further information about kernel options | 16 | # the intro(4) man page. For further information about kernel options | |
17 | # for this architecture, see the options(4) man page. For an explanation | 17 | # for this architecture, see the options(4) man page. For an explanation | |
18 | # of each device driver in this file see the section 4 man page for the | 18 | # of each device driver in this file see the section 4 man page for the | |
19 | # device. | 19 | # device. | |
20 | 20 | |||
21 | include "arch/amd64/conf/std.amd64" | 21 | include "arch/amd64/conf/std.amd64" | |
22 | 22 | |||
23 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | 23 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | |
24 | 24 | |||
25 | #ident "GENERIC-$Revision: 1.582 $" | 25 | #ident "GENERIC-$Revision: 1.583 $" | |
26 | 26 | |||
27 | maxusers 64 # estimated number of users | 27 | maxusers 64 # estimated number of users | |
28 | 28 | |||
29 | # delay between "rebooting ..." message and hardware reset, in milliseconds | 29 | # delay between "rebooting ..." message and hardware reset, in milliseconds | |
30 | #options CPURESET_DELAY=2000 | 30 | #options CPURESET_DELAY=2000 | |
31 | 31 | |||
32 | # This option allows you to force a serial console at the specified | 32 | # This option allows you to force a serial console at the specified | |
33 | # I/O address. see console(4) for details. | 33 | # I/O address. see console(4) for details. | |
34 | #options CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=57600 | 34 | #options CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=57600 | |
35 | # you don't want the option below ON iff you are using the | 35 | # you don't want the option below ON iff you are using the | |
36 | # serial console option of the new boot strap code. | 36 | # serial console option of the new boot strap code. | |
37 | #options CONS_OVERRIDE # Always use above! independent of boot info | 37 | #options CONS_OVERRIDE # Always use above! independent of boot info | |
38 | 38 | |||
@@ -535,28 +535,29 @@ iic* at nfsmb? | @@ -535,28 +535,29 @@ iic* at nfsmb? | |||
535 | 535 | |||
536 | # Intel PIIX4 power management controllers | 536 | # Intel PIIX4 power management controllers | |
537 | piixpm* at pci? dev ? function ? # PIIX4 compatible PM controller | 537 | piixpm* at pci? dev ? function ? # PIIX4 compatible PM controller | |
538 | iic* at piixpm? # SMBus on PIIX4 | 538 | iic* at piixpm? # SMBus on PIIX4 | |
539 | 539 | |||
540 | # Intel ICH SMBus controller | 540 | # Intel ICH SMBus controller | |
541 | ichsmb* at pci? dev ? function ? | 541 | ichsmb* at pci? dev ? function ? | |
542 | iic* at ichsmb? | 542 | iic* at ichsmb? | |
543 | 543 | |||
544 | # Intel S1200,C2000 (non-pch) SMBus controller | 544 | # Intel S1200,C2000 (non-pch) SMBus controller | |
545 | ismt* at pci? dev ? function ? | 545 | ismt* at pci? dev ? function ? | |
546 | iic* at ismt? | 546 | iic* at ismt? | |
547 | 547 | |||
548 | # I2C controller as found in some Intel PCH devices. | 548 | # DesignWare I2C controller as found in some Intel PCH and AMD FCH devices. | |
549 | dwiic* at pci? # I2C controller | 549 | dwiic* at acpi? # DesignWare I2C controller | |
550 | dwiic* at pci? # DesignWare I2C controller | |||
550 | iic* at dwiic? | 551 | iic* at dwiic? | |
551 | 552 | |||
552 | # Thermal monitor and fan controller | 553 | # Thermal monitor and fan controller | |
553 | #dbcool* at iic? addr 0x2C # Unknown other motherboard(s) | 554 | #dbcool* at iic? addr 0x2C # Unknown other motherboard(s) | |
554 | #dbcool* at iic? addr 0x2D # Tyan S2881 | 555 | #dbcool* at iic? addr 0x2D # Tyan S2881 | |
555 | #dbcool* at iic? addr 0x2E # Tyan S2882-D | 556 | #dbcool* at iic? addr 0x2E # Tyan S2882-D | |
556 | 557 | |||
557 | # IBM Thinkpad Active Protection System | 558 | # IBM Thinkpad Active Protection System | |
558 | #aps0 at isa? port 0x1600 | 559 | #aps0 at isa? port 0x1600 | |
559 | 560 | |||
560 | # Fintek Super I/O with hardware monitor | 561 | # Fintek Super I/O with hardware monitor | |
561 | #finsio0 at isa? port 0x4e | 562 | #finsio0 at isa? port 0x4e | |
562 | 563 |
--- src/sys/dev/acpi/dwiic_acpi.c 2020/12/07 10:02:51 1.4
+++ src/sys/dev/acpi/dwiic_acpi.c 2021/01/24 16:33:48 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dwiic_acpi.c,v 1.4 2020/12/07 10:02:51 jmcneill Exp $ */ | 1 | /* $NetBSD: dwiic_acpi.c,v 1.5 2021/01/24 16:33:48 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jared McNeill <jmcneill@invisible.ca>. | 8 | * by Jared McNeill <jmcneill@invisible.ca>. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.4 2020/12/07 10:02:51 jmcneill Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.5 2021/01/24 16:33:48 jmcneill Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/bus.h> | 36 | #include <sys/bus.h> | |
37 | #include <sys/cpu.h> | 37 | #include <sys/cpu.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | 39 | |||
40 | #include <dev/acpi/acpireg.h> | 40 | #include <dev/acpi/acpireg.h> | |
41 | #include <dev/acpi/acpivar.h> | 41 | #include <dev/acpi/acpivar.h> | |
42 | #include <dev/acpi/acpi_intr.h> | 42 | #include <dev/acpi/acpi_intr.h> | |
43 | #include <dev/acpi/acpi_i2c.h> | 43 | #include <dev/acpi/acpi_i2c.h> | |
44 | 44 | |||
45 | #include <dev/ic/dwiic_var.h> | 45 | #include <dev/ic/dwiic_var.h> | |
46 | 46 | |||
@@ -50,26 +50,28 @@ struct dwiic_acpi_param { | @@ -50,26 +50,28 @@ struct dwiic_acpi_param { | |||
50 | uint32_t ht; | 50 | uint32_t ht; | |
51 | }; | 51 | }; | |
52 | 52 | |||
53 | static int dwiic_acpi_match(device_t, cfdata_t, void *); | 53 | static int dwiic_acpi_match(device_t, cfdata_t, void *); | |
54 | static void dwiic_acpi_attach(device_t, device_t, void *); | 54 | static void dwiic_acpi_attach(device_t, device_t, void *); | |
55 | 55 | |||
56 | static void dwiic_acpi_parse_param(struct dwiic_softc *, ACPI_HANDLE, | 56 | static void dwiic_acpi_parse_param(struct dwiic_softc *, ACPI_HANDLE, | |
57 | const char *, struct dwiic_acpi_param *); | 57 | const char *, struct dwiic_acpi_param *); | |
58 | static void dwiic_acpi_configure(struct dwiic_softc *, ACPI_HANDLE); | 58 | static void dwiic_acpi_configure(struct dwiic_softc *, ACPI_HANDLE); | |
59 | 59 | |||
60 | CFATTACH_DECL_NEW(dwiic_acpi, sizeof(struct dwiic_softc), dwiic_acpi_match, dwiic_acpi_attach, NULL, NULL); | 60 | CFATTACH_DECL_NEW(dwiic_acpi, sizeof(struct dwiic_softc), dwiic_acpi_match, dwiic_acpi_attach, NULL, NULL); | |
61 | 61 | |||
62 | static const char * const compatible[] = { | 62 | static const char * const compatible[] = { | |
63 | "AMD0010", /* AMD FCH */ | |||
64 | "AMDI0010", /* AMD FCH */ | |||
63 | "AMDI0510", /* AMD Seattle */ | 65 | "AMDI0510", /* AMD Seattle */ | |
64 | "APMC0D0F", /* Ampere eMAG */ | 66 | "APMC0D0F", /* Ampere eMAG */ | |
65 | NULL | 67 | NULL | |
66 | }; | 68 | }; | |
67 | 69 | |||
68 | static int | 70 | static int | |
69 | dwiic_acpi_match(device_t parent, cfdata_t cf, void *aux) | 71 | dwiic_acpi_match(device_t parent, cfdata_t cf, void *aux) | |
70 | { | 72 | { | |
71 | struct acpi_attach_args *aa = aux; | 73 | struct acpi_attach_args *aa = aux; | |
72 | 74 | |||
73 | if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE) | 75 | if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE) | |
74 | return 0; | 76 | return 0; | |
75 | 77 |