From owner-svn-src-head@freebsd.org Sat Jan 6 06:00:47 2018 Return-Path: Delivered-To: svn-src-head@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 47E68EC0214; Sat, 6 Jan 2018 06:00:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0514E76A69; Sat, 6 Jan 2018 06:00:47 +0000 (UTC) (envelope-from imp@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 2DD36B7C9; Sat, 6 Jan 2018 06:00:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0660kG1015157; Sat, 6 Jan 2018 06:00:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0660j2d014536; Sat, 6 Jan 2018 06:00:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801060600.w0660j2d014536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 6 Jan 2018 06:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327612 - in head/stand/i386: libfirewire libi386 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand/i386: libfirewire libi386 X-SVN-Commit-Revision: 327612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jan 2018 06:00:47 -0000 Author: imp Date: Sat Jan 6 06:00:45 2018 New Revision: 327612 URL: https://svnweb.freebsd.org/changeset/base/327612 Log: Invent new #defines for the biospci_{read,write}_config function to specify the width and use them everywhere. Sponsored by: Netflix Modified: head/stand/i386/libfirewire/firewire.c head/stand/i386/libi386/biospci.c head/stand/i386/libi386/comconsole.c head/stand/i386/libi386/libi386.h Modified: head/stand/i386/libfirewire/firewire.c ============================================================================== --- head/stand/i386/libfirewire/firewire.c Sat Jan 6 06:00:40 2018 (r327611) +++ head/stand/i386/libfirewire/firewire.c Sat Jan 6 06:00:45 2018 (r327612) @@ -108,11 +108,11 @@ fw_probe(int index, struct fwohci_softc *sc) biospci_write_config(sc->locator, 0x4 /* command */, 0x6 /* enable bus master and memory mapped I/O */, - 1 /* word */); + BIOSPCI_16BITS); - biospci_read_config(sc->locator, 0x00 /*devid*/, 2 /*dword*/, + biospci_read_config(sc->locator, 0x00 /*devid*/, BIOSPCI_32BITS, &sc->devid); - biospci_read_config(sc->locator, 0x10 /*base_addr*/, 2 /*dword*/, + biospci_read_config(sc->locator, 0x10 /*base_addr*/, BIOSPCI_32BITS, &sc->base_addr); sc->handle = (uint32_t)PTOV(sc->base_addr); Modified: head/stand/i386/libi386/biospci.c ============================================================================== --- head/stand/i386/libi386/biospci.c Sat Jan 6 06:00:40 2018 (r327611) +++ head/stand/i386/libi386/biospci.c Sat Jan 6 06:00:45 2018 (r327612) @@ -285,7 +285,7 @@ biospci_enumerate(void) break; /* Read the device identifier from the nominated device */ - err = biospci_read_config(locator, 0, 2, &devid); + err = biospci_read_config(locator, 0, BIOSPCI_32BITS, &devid); if (err != 0) break; Modified: head/stand/i386/libi386/comconsole.c ============================================================================== --- head/stand/i386/libi386/comconsole.c Sat Jan 6 06:00:40 2018 (r327611) +++ head/stand/i386/libi386/comconsole.c Sat Jan 6 06:00:45 2018 (r327612) @@ -263,7 +263,7 @@ comc_pcidev_handle(uint32_t locator) uint32_t port; if (biospci_read_config(locator & 0xffff, - (locator & 0xff0000) >> 16, 2, &port) == -1) { + (locator & 0xff0000) >> 16, BIOSPCI_32BITS, &port) == -1) { printf("Cannot read bar at 0x%x\n", locator); return (CMD_ERROR); } Modified: head/stand/i386/libi386/libi386.h ============================================================================== --- head/stand/i386/libi386/libi386.h Sat Jan 6 06:00:40 2018 (r327611) +++ head/stand/i386/libi386/libi386.h Sat Jan 6 06:00:45 2018 (r327612) @@ -135,6 +135,13 @@ extern vm_offset_t memtop_copyin; /* memtop less heap extern uint32_t high_heap_size; /* extended memory region available */ extern vm_offset_t high_heap_base; /* for use as the heap */ +/* + * Values for width parameter to biospci_{read,write}_config + */ +#define BIOSPCI_8BITS 0 +#define BIOSPCI_16BITS 1 +#define BIOSPCI_32BITS 2 + void biospci_detect(void); int biospci_find_devclass(uint32_t class, int index, uint32_t *locator); int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val);