From owner-svn-src-all@freebsd.org Thu Nov 26 07:34:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A66C64A3FE7; Thu, 26 Nov 2020 07:34:21 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ChTzK4N7Fz3MGv; Thu, 26 Nov 2020 07:34:21 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A7EB1F3F6; Thu, 26 Nov 2020 07:34:21 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AQ7YLER040603; Thu, 26 Nov 2020 07:34:21 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AQ7YL7L040602; Thu, 26 Nov 2020 07:34:21 GMT (envelope-from phk@FreeBSD.org) Message-Id: <202011260734.0AQ7YL7L040602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Thu, 26 Nov 2020 07:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368052 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 368052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2020 07:34:21 -0000 Author: phk Date: Thu Nov 26 07:34:20 2020 New Revision: 368052 URL: https://svnweb.freebsd.org/changeset/base/368052 Log: Add support for Fintek F81803 SuperIO chip Reviewed by: avg Modified: head/sys/dev/superio/superio.c head/sys/dev/superio/superio.h Modified: head/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Thu Nov 26 07:31:30 2020 (r368051) +++ head/sys/dev/superio/superio.c Thu Nov 26 07:34:20 2020 (r368052) @@ -233,9 +233,29 @@ static const struct sio_conf_methods nvt_conf_methods .vendor = SUPERIO_VENDOR_NUVOTON }; +static void +fintek_conf_enter(struct resource* res, uint16_t port) +{ + bus_write_1(res, 0, 0x87); + bus_write_1(res, 0, 0x87); +} + +static void +fintek_conf_exit(struct resource* res, uint16_t port) +{ + bus_write_1(res, 0, 0xaa); +} + +static const struct sio_conf_methods fintek_conf_methods = { + .enter = fintek_conf_enter, + .exit = fintek_conf_exit, + .vendor = SUPERIO_VENDOR_FINTEK +}; + static const struct sio_conf_methods * const methods_table[] = { &ite_conf_methods, &nvt_conf_methods, + &fintek_conf_methods, NULL }; @@ -261,6 +281,11 @@ const struct sio_device nct5104_devices[] = { { .type = SUPERIO_DEV_NONE }, }; +const struct sio_device fintek_devices[] = { + { .ldn = 7, .type = SUPERIO_DEV_WDT }, + { .type = SUPERIO_DEV_NONE }, +}; + static const struct { superio_vendor_t vendor; uint16_t devid; @@ -410,6 +435,11 @@ static const struct { .descr = "Nuvoton NCT6795", .devices = nvt_devices, }, + { + .vendor = SUPERIO_VENDOR_FINTEK, .devid = 0x1210, .mask = 0xff, + .descr = "Fintek F81803", + .devices = fintek_devices, + }, { 0, 0 } }; @@ -472,6 +502,10 @@ superio_detect(device_t dev, bool claim, struct siosc devid = sio_readw(res, 0x20); revid = sio_read(res, 0x22); } else if (methods_table[m]->vendor == SUPERIO_VENDOR_NUVOTON) { + devid = sio_read(res, 0x20); + revid = sio_read(res, 0x21); + devid = (devid << 8) | revid; + } else if (methods_table[m]->vendor == SUPERIO_VENDOR_FINTEK) { devid = sio_read(res, 0x20); revid = sio_read(res, 0x21); devid = (devid << 8) | revid; Modified: head/sys/dev/superio/superio.h ============================================================================== --- head/sys/dev/superio/superio.h Thu Nov 26 07:31:30 2020 (r368051) +++ head/sys/dev/superio/superio.h Thu Nov 26 07:34:20 2020 (r368052) @@ -34,6 +34,7 @@ typedef enum superio_vendor { SUPERIO_VENDOR_NONE, SUPERIO_VENDOR_ITE, SUPERIO_VENDOR_NUVOTON, + SUPERIO_VENDOR_FINTEK, SUPERIO_VENDOR_MAX } superio_vendor_t; @@ -58,7 +59,7 @@ device_t superio_find_dev(device_t superio, superio_de int ldn); enum superio_ivars { - SUPERIO_IVAR_LDN = 10600, + SUPERIO_IVAR_LDN = 10600, SUPERIO_IVAR_TYPE, SUPERIO_IVAR_IOBASE, SUPERIO_IVAR_IOBASE2,