From owner-freebsd-hackers@freebsd.org Sat Nov 18 17:53:11 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D91B5DC0839 for ; Sat, 18 Nov 2017 17:53:11 +0000 (UTC) (envelope-from harald.boehm@fau.de) Received: from mx-rz-1.rrze.uni-erlangen.de (mx-rz-1.rrze.uni-erlangen.de [IPv6:2001:638:a000:1025::14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9127077515 for ; Sat, 18 Nov 2017 17:53:11 +0000 (UTC) (envelope-from harald.boehm@fau.de) Received: from mx-rz-1.rrze.uni-erlangen.de (mx-rz-1.rrze.uni-erlangen.de [IPv6:2001:638:a000:1025::14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx-rz-1.rrze.uni-erlangen.de (Postfix) with ESMTPS id 3yfMyg5jYCz8ssq for ; Sat, 18 Nov 2017 18:52:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fau.de; s=fau-2013; t=1511027579; bh=Dwlbc7v+MJW6G7ch2l7o8aXk9OXhPcJbiSMgWT8CEb8=; h=To:From:Subject:Date:From:To:CC:Subject; b=e5RQ5A3s2o/t6UiiebJOEfUcrVM0O01rS77hcajF/CQ56Qpy2laUuOOxWMY111HiX lNiKChuAhOI1UNXbT03B1pXFuUl2CPfhYtodxdqQ+9UFYECOUWFDz4rRzWpx0jec15 wJdGW9/8sXulttA5iVoocsStqUk00XD7LzGh+rfLjdTHVmIpLpTmjM2qIJaCtWUqu+ r1rxUER/xvaUE+x9bkYG/jiDRiHTirFdl4MuIVZxgCTyyT8Ml6usMCm7L3tEnaNXNg OIL7xCInBY87Xkxz8YysKgR6QW6du0hikQSmdfuaJ62/zb0ssbhgxuVh0qETpgwKMD NTWUTCBRFOoOg== X-Virus-Scanned: amavisd-new at boeck4.rrze.uni-erlangen.de (RRZE) X-RRZE-Flag: Not-Spam X-RRZE-Submit-IP: 84.63.161.43 Received: from [192.168.2.100] (dslb-084-063-161-043.084.063.pools.vodafone-ip.de [84.63.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: U2FsdGVkX18RdeC4xE6iAHnyX+IJY2moODR69nrHJWI=) by smtp-auth.uni-erlangen.de (Postfix) with ESMTPSA id 3yfMyZ74kZz8t9p for ; Sat, 18 Nov 2017 18:52:54 +0100 (CET) To: "'freebsd-hackers@freebsd.org'" From: =?UTF-8?Q?Harald_B=c3=b6hm?= Subject: ACPICA missing support for device I/O port ranges Message-ID: Date: Sat, 18 Nov 2017 18:52:54 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Nov 2017 17:53:11 -0000 Hi all, I've been working on a device driver lately and was having trouble allocating its resources using bus_alloc_resource_any(), although its I/O ports can be read from its _CRS. This is the output of acpidump -td: Device (GMUX) { ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { IO (Decode16, 0x0700, // Range Minimum 0x07FF, // Range Maximum 0x01, // Alignment 0xFF, // Length ) }) ... } After digging into the code in /sys/dev/acpica/acpi_resources.c I was able to find the problem. The function acpi_res_set_iorange(), which seems to be responsible for calling bus_set_resource() is just a function stub that prints a message that I/O ranges are not supported. static void acpi_res_set_iorange(device_t dev, void *context, uint64_t low, uint64_t high, uint64_t length, uint64_t align) { struct acpi_res_context *cp = (struct acpi_res_context *)context; if (cp == NULL) return; device_printf(dev, "I/O range not supported\n"); } After adding a call to bus_set_resource() to that function, I was able to allocate the device's resources. Does anyone know, why the function has not been implemented or why I/O ranges are not supported? Thanks, Harald