vga_pci.c (10b3b54548f2290bbe8d8f88c59c28d12b7a635d) | vga_pci.c (3219f535d98ad7c1a1b731f022c7b9ec4402094c) |
---|---|
1/*- 2 * Copyright (c) 2005 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 29 unchanged lines hidden (view full) --- 38 * in or rename it. 39 */ 40 41#include <sys/param.h> 42#include <sys/bus.h> 43#include <sys/kernel.h> 44#include <sys/module.h> 45#include <sys/rman.h> | 1/*- 2 * Copyright (c) 2005 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 29 unchanged lines hidden (view full) --- 38 * in or rename it. 39 */ 40 41#include <sys/param.h> 42#include <sys/bus.h> 43#include <sys/kernel.h> 44#include <sys/module.h> 45#include <sys/rman.h> |
46#include <sys/sysctl.h> |
|
46#include <sys/systm.h> 47 48#include <dev/pci/pcireg.h> 49#include <dev/pci/pcivar.h> 50 51struct vga_resource { 52 struct resource *vr_res; 53 int vr_refs; 54}; 55 56struct vga_pci_softc { 57 device_t vga_msi_child; /* Child driver using MSI. */ 58 struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1]; 59}; 60 | 47#include <sys/systm.h> 48 49#include <dev/pci/pcireg.h> 50#include <dev/pci/pcivar.h> 51 52struct vga_resource { 53 struct resource *vr_res; 54 int vr_refs; 55}; 56 57struct vga_pci_softc { 58 device_t vga_msi_child; /* Child driver using MSI. */ 59 struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1]; 60}; 61 |
62SYSCTL_DECL(_hw_pci); 63 64int vga_pci_default_unit = -1; 65TUNABLE_INT("hw.pci.default_vgapci_unit", &vga_pci_default_unit); 66SYSCTL_INT(_hw_pci, OID_AUTO, default_vgapci_unit, CTLFLAG_RD, 67 &vga_pci_default_unit, -1, "Default VGA-compatible display"); 68 |
|
61static int 62vga_pci_probe(device_t dev) 63{ | 69static int 70vga_pci_probe(device_t dev) 71{ |
72 device_t bdev; 73 int unit; 74 uint16_t bctl; |
|
64 65 switch (pci_get_class(dev)) { 66 case PCIC_DISPLAY: 67 break; 68 case PCIC_OLD: 69 if (pci_get_subclass(dev) != PCIS_OLD_VGA) 70 return (ENXIO); 71 break; 72 default: 73 return (ENXIO); 74 } | 75 76 switch (pci_get_class(dev)) { 77 case PCIC_DISPLAY: 78 break; 79 case PCIC_OLD: 80 if (pci_get_subclass(dev) != PCIS_OLD_VGA) 81 return (ENXIO); 82 break; 83 default: 84 return (ENXIO); 85 } |
86 87 /* Probe default display. */ 88 unit = device_get_unit(dev); 89 bdev = device_get_parent(device_get_parent(dev)); 90 bctl = pci_read_config(bdev, PCIR_BRIDGECTL_1, 2); 91 if (vga_pci_default_unit < 0 && (bctl & PCIB_BCR_VGA_ENABLE) != 0) 92 vga_pci_default_unit = unit; 93 if (vga_pci_default_unit == unit) 94 device_set_flags(dev, 1); 95 |
|
75 device_set_desc(dev, "VGA-compatible display"); 76 return (BUS_PROBE_GENERIC); 77} 78 79static int 80vga_pci_attach(device_t dev) 81{ 82 --- 346 unchanged lines hidden --- | 96 device_set_desc(dev, "VGA-compatible display"); 97 return (BUS_PROBE_GENERIC); 98} 99 100static int 101vga_pci_attach(device_t dev) 102{ 103 --- 346 unchanged lines hidden --- |