From owner-p4-projects@FreeBSD.ORG Mon Jul 10 22:51:42 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7AC2B16A4E1; Mon, 10 Jul 2006 22:51:42 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 55C8916A4DD for ; Mon, 10 Jul 2006 22:51:42 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 216A243D73 for ; Mon, 10 Jul 2006 22:51:42 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6AMpfC6090944 for ; Mon, 10 Jul 2006 22:51:42 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6AMpfhH090941 for perforce@freebsd.org; Mon, 10 Jul 2006 22:51:41 GMT (envelope-from imp@freebsd.org) Date: Mon, 10 Jul 2006 22:51:41 GMT Message-Id: <200607102251.k6AMpfhH090941@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 101248 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2006 22:51:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=101248 Change 101248 by imp@imp_lighthouse on 2006/07/10 22:50:49 Allow device units to be hard wired on the pci bus. rl1: port 0xa000:0x100 mem 0xc020a400:0x100 irq 22 at device 6.0 on pci6 (and no rl0) from the following lines: hint.rl.1.at="pci" hint.rl.1.location="6:6:0" Affected files ... .. //depot/projects/arm/src/sys/dev/pci/pci.c#9 edit Differences ... ==== //depot/projects/arm/src/sys/dev/pci/pci.c#9 (text+ko) ==== @@ -90,6 +90,8 @@ static void pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg); static void pci_read_extcap(device_t pcib, pcicfgregs *cfg); +static void pci_hint_device_unit(device_t bus, device_t child, + int *unit); static device_method_t pci_methods[] = { /* Device interface */ @@ -119,6 +121,7 @@ DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), DEVMETHOD(bus_child_location_str, pci_child_location_str_method), + DEVMETHOD(bus_hint_device_unit, pci_hint_device_unit), /* PCI interface */ DEVMETHOD(pci_read_config, pci_read_config_method), @@ -1999,6 +2002,23 @@ return (0); } +void +pci_hint_device_unit(device_t bus, device_t child, int *unit) +{ + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + int i; + char buf[10]; + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; + i = 0; + snprintf(buf, sizeof(buf), "%d:%d:%d", cfg->bus, cfg->slot, cfg->func); + resource_find_dev(&i, device_get_name(child), unit, "location", buf); + device_printf(bus, "%s now %d\n", device_get_nameunit(child), *unit); + return; +} + int pci_assign_interrupt_method(device_t dev, device_t child) {