Date: Mon, 10 Jul 2006 22:51:41 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 101248 for review Message-ID: <200607102251.k6AMpfhH090941@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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: <RealTek 8139 10/100BaseTX> 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607102251.k6AMpfhH090941>