Date: Wed, 21 Dec 2005 10:35:26 -0500 From: John Baldwin <jhb@freebsd.org> To: Nate Lawson <nate@root.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/dev/pci vga_pci.c Message-ID: <200512211035.28006.jhb@freebsd.org> In-Reply-To: <43A88A00.9040407@root.org> References: <20051220224208.DB1B916A449@hub.freebsd.org> <43A88A00.9040407@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512211035.28006.jhb>