machfb.c (295880) | machfb.c (298431) |
---|---|
1/*- 2 * Copyright (c) 2002 Bang Jun-Young 3 * Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 15 unchanged lines hidden (view full) --- 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * from: NetBSD: machfb.c,v 1.23 2005/03/07 21:45:24 martin Exp 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002 Bang Jun-Young 3 * Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 15 unchanged lines hidden (view full) --- 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * from: NetBSD: machfb.c,v 1.23 2005/03/07 21:45:24 martin Exp 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/fb/machfb.c 295880 2016-02-22 09:02:20Z skra $"); | 32__FBSDID("$FreeBSD: head/sys/dev/fb/machfb.c 298431 2016-04-21 19:40:10Z pfg $"); |
33 34/* 35 * Driver for ATI Mach64 graphics chips. Some code is derived from the 36 * ATI Rage Pro and Derivatives Programmer's Guide. 37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> --- 432 unchanged lines hidden (view full) --- 473 return (0); 474 if ((output = OF_instance_to_package(stdout)) == -1) 475 return (0); 476 if ((OF_getprop(output, "vendor-id", &id, sizeof(id)) == -1) || 477 id != ATI_VENDOR) 478 return (0); 479 if (OF_getprop(output, "device-id", &id, sizeof(id)) == -1) 480 return (0); | 33 34/* 35 * Driver for ATI Mach64 graphics chips. Some code is derived from the 36 * ATI Rage Pro and Derivatives Programmer's Guide. 37 */ 38 39#include <sys/param.h> 40#include <sys/systm.h> --- 432 unchanged lines hidden (view full) --- 473 return (0); 474 if ((output = OF_instance_to_package(stdout)) == -1) 475 return (0); 476 if ((OF_getprop(output, "vendor-id", &id, sizeof(id)) == -1) || 477 id != ATI_VENDOR) 478 return (0); 479 if (OF_getprop(output, "device-id", &id, sizeof(id)) == -1) 480 return (0); |
481 for (i = 0; i < sizeof(machfb_info) / sizeof(machfb_info[0]); i++) { | 481 for (i = 0; i < nitems(machfb_info); i++) { |
482 if (id == machfb_info[i].chip_id) { 483 sc->sc_flags = MACHFB_CONSOLE; 484 sc->sc_node = output; 485 sc->sc_chip_id = id; 486 break; 487 } 488 } 489 if (!(sc->sc_flags & MACHFB_CONSOLE)) --- 37 unchanged lines hidden (view full) --- 527 528 sc = (struct machfb_softc *)adp; 529 vi = &adp->va_info; 530 531 if ((regr(sc, CONFIG_CHIP_ID) & 0xffff) != sc->sc_chip_id) 532 return (ENXIO); 533 534 sc->sc_ramdac_freq = 0; | 482 if (id == machfb_info[i].chip_id) { 483 sc->sc_flags = MACHFB_CONSOLE; 484 sc->sc_node = output; 485 sc->sc_chip_id = id; 486 break; 487 } 488 } 489 if (!(sc->sc_flags & MACHFB_CONSOLE)) --- 37 unchanged lines hidden (view full) --- 527 528 sc = (struct machfb_softc *)adp; 529 vi = &adp->va_info; 530 531 if ((regr(sc, CONFIG_CHIP_ID) & 0xffff) != sc->sc_chip_id) 532 return (ENXIO); 533 534 sc->sc_ramdac_freq = 0; |
535 for (i = 0; i < sizeof(machfb_info) / sizeof(machfb_info[0]); i++) { | 535 for (i = 0; i < nitems(machfb_info); i++) { |
536 if (sc->sc_chip_id == machfb_info[i].chip_id) { 537 sc->sc_ramdac_freq = machfb_info[i].ramdac_freq; 538 break; 539 } 540 } 541 if (sc->sc_ramdac_freq == 0) 542 return (ENXIO); 543 if (sc->sc_chip_id == ATI_RAGE_II && sc->sc_chip_rev & 0x07) --- 590 unchanged lines hidden (view full) --- 1134machfb_pci_probe(device_t dev) 1135{ 1136 int i; 1137 1138 if (pci_get_class(dev) != PCIC_DISPLAY || 1139 pci_get_subclass(dev) != PCIS_DISPLAY_VGA) 1140 return (ENXIO); 1141 | 536 if (sc->sc_chip_id == machfb_info[i].chip_id) { 537 sc->sc_ramdac_freq = machfb_info[i].ramdac_freq; 538 break; 539 } 540 } 541 if (sc->sc_ramdac_freq == 0) 542 return (ENXIO); 543 if (sc->sc_chip_id == ATI_RAGE_II && sc->sc_chip_rev & 0x07) --- 590 unchanged lines hidden (view full) --- 1134machfb_pci_probe(device_t dev) 1135{ 1136 int i; 1137 1138 if (pci_get_class(dev) != PCIC_DISPLAY || 1139 pci_get_subclass(dev) != PCIS_DISPLAY_VGA) 1140 return (ENXIO); 1141 |
1142 for (i = 0; i < sizeof(machfb_info) / sizeof(machfb_info[0]); i++) { | 1142 for (i = 0; i < nitems(machfb_info); i++) { |
1143 if (pci_get_device(dev) == machfb_info[i].chip_id) { 1144 device_set_desc(dev, machfb_info[i].name); 1145 return (BUS_PROBE_DEFAULT); 1146 } 1147 } 1148 1149 return (ENXIO); 1150} --- 429 unchanged lines hidden --- | 1143 if (pci_get_device(dev) == machfb_info[i].chip_id) { 1144 device_set_desc(dev, machfb_info[i].name); 1145 return (BUS_PROBE_DEFAULT); 1146 } 1147 } 1148 1149 return (ENXIO); 1150} --- 429 unchanged lines hidden --- |