From owner-cvs-all@FreeBSD.ORG Wed Dec 21 15:35:29 2005 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 23F1216A41F; Wed, 21 Dec 2005 15:35:29 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF13D43D53; Wed, 21 Dec 2005 15:35:27 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.5b3) with ESMTP id 4293189 for multiple; Wed, 21 Dec 2005 10:36:31 -0500 Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id jBLFYp8I014889; Wed, 21 Dec 2005 10:34:52 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Nate Lawson Date: Wed, 21 Dec 2005 10:35:26 -0500 User-Agent: KMail/1.8.2 References: <20051220224208.DB1B916A449@hub.freebsd.org> <43A88A00.9040407@root.org> In-Reply-To: <43A88A00.9040407@root.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512211035.28006.jhb@freebsd.org> X-Virus-Scanned: ClamAV version 0.87.1, clamav-milter version 0.87 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/dev/pci vga_pci.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2005 15:35:29 -0000 On Tuesday 20 December 2005 05:47 pm, Nate Lawson wrote: > John Baldwin wrote: > > jhb 2005-12-20 22:41:33 UTC > > > > FreeBSD src repository > > > > Added files: > > sys/dev/pci vga_pci.c > > Log: > > Add a vgapci(4) stub device driver for VGA PCI devices. This device > > serves as a bus so that other drivers such as drm(4), acpi_video(4), and > > agp(4) can attach to it thus allowing multiple drivers for the same > > device. It also removes the need for the drmsub hack for the > > i8[13]0/i915 drm and agp drivers. > > > > Revision Changes Path > > 1.3 +262 -0 src/sys/dev/pci/vga_pci.c (new) > > All the methods seem to just be a straight-through mapping or a debug > print + mapping. For the ones you don't plan to do anything special in, > can you just make the methods map directly to the generic versions? The ones that do map, yes. I was mostly paranoid to see if functions whose stubs weren't really right were getting called or not. There is room for cleaning. > > +static int > > +vga_pci_suspend(device_t dev) > > +{ > > + > > + return (bus_generic_suspend(dev)); > > +} > > + > > +static int > > +vga_pci_resume(device_t dev) > > +{ > > + > > + return (bus_generic_resume(dev)); > > +} These are generics and could just use bus_generic_foo(). > > + > > +/* Bus interface. */ > > + > > +static int > > +vga_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t > > *result) +{ > > + > > + return (BUS_READ_IVAR(device_get_parent(dev), dev, which, result)); > > +} > > + > > +static int > > +vga_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t > > value) +{ > > + > > + return (EINVAL); > > +} These are not generics. The generic would pass child as the second arg rather than dev. > > +static struct resource * > > +vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, > > + u_long start, u_long end, u_long count, u_int flags) > > +{ > > + > > + return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); > > +} > > + > > +static int > > +vga_pci_release_resource(device_t dev, device_t child, int type, int > > rid, + struct resource *r) > > +{ > > + > > + return (bus_release_resource(dev, type, rid, r)); > > +} Same with these two. > > + > > +/* PCI interface. */ > > + > > +static uint32_t > > +vga_pci_read_config(device_t dev, device_t child, int reg, int width) > > +{ > > + > > + return (pci_read_config(dev, reg, width)); > > +} > > + > > +static void > > +vga_pci_write_config(device_t dev, device_t child, int reg, > > + uint32_t val, int width) > > +{ > > + > > + pci_write_config(dev, reg, val, width); > > +} And all of the PCI ones including these and the others you quoted. The different is subtle, but important. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org