cvs commit: src/sys/dev/pci vga_pci.c

Nate Lawson nate at root.org
Tue Dec 20 14:47:42 PST 2005


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?

> +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));
> +}
> +
> +/* 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);
> +}
> +
> +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));
> +}
> +
> +/* 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);
> +}
> +
> +static int
> +vga_pci_enable_busmaster(device_t dev, device_t child)
> +{
> +
> +	device_printf(dev, "child %s requested pci_enable_busmaster\n",
> +	    device_get_nameunit(child));
> +	return (pci_enable_busmaster(dev));
> +}
> +
> +static int
> +vga_pci_disable_busmaster(device_t dev, device_t child)
> +{
> +
> +	device_printf(dev, "child %s requested pci_disable_busmaster\n",
> +	    device_get_nameunit(child));
> +	return (pci_disable_busmaster(dev));
> +}
> +
> +static int
> +vga_pci_enable_io(device_t dev, device_t child, int space)
> +{
> +
> +	device_printf(dev, "child %s requested pci_enable_io\n",
> +	    device_get_nameunit(child));
> +	return (pci_enable_io(dev, space));
> +}
> +
> +static int
> +vga_pci_disable_io(device_t dev, device_t child, int space)
> +{
> +
> +	device_printf(dev, "child %s requested pci_disable_io\n",
> +	    device_get_nameunit(child));
> +	return (pci_disable_io(dev, space));
> +}
> +
> +static int
> +vga_pci_set_powerstate(device_t dev, device_t child, int state)
> +{
> +
> +	device_printf(dev, "child %s requested pci_set_powerstate\n",
> +	    device_get_nameunit(child));
> +	return (pci_set_powerstate(dev, state));
> +}
> +
> +static int
> +vga_pci_get_powerstate(device_t dev, device_t child)
> +{
> +
> +	device_printf(dev, "child %s requested pci_get_powerstate\n",
> +	    device_get_nameunit(child));
> +	return (pci_get_powerstate(dev));
> +}
> +
> +static int
> +vga_pci_assign_interrupt(device_t dev, device_t child)
> +{
> +
> +	device_printf(dev, "child %s requested pci_assign_interrupt\n",
> +	    device_get_nameunit(child));
> +	return (PCI_ASSIGN_INTERRUPT(device_get_parent(dev), dev));
> +}
> +
> +static int
> +vga_pci_find_extcap(device_t dev, device_t child, int capability,
> +    int *capreg)
> +{
> +
> +	return (pci_find_extcap(dev, capability, capreg));
> +}


-- 
Nate


More information about the cvs-src mailing list