agp_i810.c (153031) | agp_i810.c (153579) |
---|---|
1/*- 2 * Copyright (c) 2000 Doug Rabson 3 * Copyright (c) 2000 Ruslan Ermilov 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: --- 17 unchanged lines hidden (view full) --- 26 */ 27 28/* 29 * Fixes for 830/845G support: David Dawes <dawes@xfree86.org> 30 * 852GM/855GM/865G support added by David Dawes <dawes@xfree86.org> 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Doug Rabson 3 * Copyright (c) 2000 Ruslan Ermilov 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: --- 17 unchanged lines hidden (view full) --- 26 */ 27 28/* 29 * Fixes for 830/845G support: David Dawes <dawes@xfree86.org> 30 * 852GM/855GM/865G support added by David Dawes <dawes@xfree86.org> 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/agp/agp_i810.c 153031 2005-12-02 23:51:36Z anholt $"); | 34__FBSDID("$FreeBSD: head/sys/dev/agp/agp_i810.c 153579 2005-12-20 22:44:36Z jhb $"); |
35 36#include "opt_bus.h" 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/malloc.h> 41#include <sys/kernel.h> 42#include <sys/module.h> --- 130 unchanged lines hidden (view full) --- 173 case 0x25628086: 174 case 0x35828086: 175 case 0x25728086: 176 case 0x25828086: 177 case 0x25928086: 178 devid -= 0x20000; 179 break; 180 }; | 35 36#include "opt_bus.h" 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/malloc.h> 41#include <sys/kernel.h> 42#include <sys/module.h> --- 130 unchanged lines hidden (view full) --- 173 case 0x25628086: 174 case 0x35828086: 175 case 0x25728086: 176 case 0x25828086: 177 case 0x25928086: 178 devid -= 0x20000; 179 break; 180 }; |
181 if (device_get_children(device_get_parent(dev), &children, &nchildren)) | 181 if (device_get_children(device_get_parent(device_get_parent(dev)), 182 &children, &nchildren)) |
182 return 0; 183 184 for (i = 0; i < nchildren; i++) { 185 child = children[i]; 186 187 if (pci_get_devid(child) == devid) { 188 free(children, M_TEMP); 189 return child; --- 66 unchanged lines hidden (view full) --- 256 return ENXIO; 257 } 258 break; 259 260 default: 261 return ENXIO; 262 } 263 | 183 return 0; 184 185 for (i = 0; i < nchildren; i++) { 186 child = children[i]; 187 188 if (pci_get_devid(child) == devid) { 189 free(children, M_TEMP); 190 return child; --- 66 unchanged lines hidden (view full) --- 257 return ENXIO; 258 } 259 break; 260 261 default: 262 return ENXIO; 263 } 264 |
264 device_verbose(dev); | |
265 device_set_desc(dev, desc); 266 return BUS_PROBE_DEFAULT; 267 } 268 269 return ENXIO; 270} 271 272static int --- 174 unchanged lines hidden (view full) --- 447 /* GATT address is already in there, make sure it's enabled */ 448 pgtblctl = READ4(AGP_I810_PGTBL_CTL); 449 pgtblctl |= 1; 450 WRITE4(AGP_I810_PGTBL_CTL, pgtblctl); 451 452 gatt->ag_physical = pgtblctl & ~1; 453 } 454 | 265 device_set_desc(dev, desc); 266 return BUS_PROBE_DEFAULT; 267 } 268 269 return ENXIO; 270} 271 272static int --- 174 unchanged lines hidden (view full) --- 447 /* GATT address is already in there, make sure it's enabled */ 448 pgtblctl = READ4(AGP_I810_PGTBL_CTL); 449 pgtblctl |= 1; 450 WRITE4(AGP_I810_PGTBL_CTL, pgtblctl); 451 452 gatt->ag_physical = pgtblctl & ~1; 453 } 454 |
455 /* Add a device for the drm to attach to */ 456 if (!device_add_child( dev, "drmsub", -1 )) 457 printf("out of memory...\n"); 458 459 return bus_generic_attach(dev); | 455 return 0; |
460} 461 462static int 463agp_i810_detach(device_t dev) 464{ 465 struct agp_i810_softc *sc = device_get_softc(dev); 466 int error; | 456} 457 458static int 459agp_i810_detach(device_t dev) 460{ 461 struct agp_i810_softc *sc = device_get_softc(dev); 462 int error; |
467 device_t child; | |
468 469 error = agp_generic_detach(dev); 470 if (error) 471 return error; 472 473 /* Clear the GATT base. */ 474 if ( sc->chiptype == CHIP_I810 ) { 475 WRITE4(AGP_I810_PGTBL_CTL, 0); --- 17 unchanged lines hidden (view full) --- 493 sc->gtt); 494 bus_release_resource(dev, SYS_RES_MEMORY, AGP_I915_MMADR, 495 sc->regs); 496 } else { 497 bus_release_resource(dev, SYS_RES_MEMORY, AGP_I810_MMADR, 498 sc->regs); 499 } 500 | 463 464 error = agp_generic_detach(dev); 465 if (error) 466 return error; 467 468 /* Clear the GATT base. */ 469 if ( sc->chiptype == CHIP_I810 ) { 470 WRITE4(AGP_I810_PGTBL_CTL, 0); --- 17 unchanged lines hidden (view full) --- 488 sc->gtt); 489 bus_release_resource(dev, SYS_RES_MEMORY, AGP_I915_MMADR, 490 sc->regs); 491 } else { 492 bus_release_resource(dev, SYS_RES_MEMORY, AGP_I810_MMADR, 493 sc->regs); 494 } 495 |
501 child = device_find_child( dev, "drmsub", 0 ); 502 if (child) 503 device_delete_child( dev, child ); 504 | |
505 return 0; 506} 507 508static u_int32_t 509agp_i810_get_aperture(device_t dev) 510{ 511 struct agp_i810_softc *sc = device_get_softc(dev); 512 uint32_t temp; --- 288 unchanged lines hidden (view full) --- 801 return EINVAL; 802 803 for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE) 804 WRITE4(AGP_I810_GTT + (i >> AGP_PAGE_SHIFT) * 4, 0); 805 806 return 0; 807} 808 | 496 return 0; 497} 498 499static u_int32_t 500agp_i810_get_aperture(device_t dev) 501{ 502 struct agp_i810_softc *sc = device_get_softc(dev); 503 uint32_t temp; --- 288 unchanged lines hidden (view full) --- 792 return EINVAL; 793 794 for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE) 795 WRITE4(AGP_I810_GTT + (i >> AGP_PAGE_SHIFT) * 4, 0); 796 797 return 0; 798} 799 |
809static int 810agp_i810_print_child(device_t dev, device_t child) 811{ 812 int retval = 0; 813 814 retval += bus_print_child_header(dev, child); 815 retval += printf(": (child of agp_i810.c)"); 816 retval += bus_print_child_footer(dev, child); 817 818 return retval; 819} 820 | |
821static device_method_t agp_i810_methods[] = { 822 /* Device interface */ 823 DEVMETHOD(device_probe, agp_i810_probe), 824 DEVMETHOD(device_attach, agp_i810_attach), 825 DEVMETHOD(device_detach, agp_i810_detach), | 800static device_method_t agp_i810_methods[] = { 801 /* Device interface */ 802 DEVMETHOD(device_probe, agp_i810_probe), 803 DEVMETHOD(device_attach, agp_i810_attach), 804 DEVMETHOD(device_detach, agp_i810_detach), |
826 DEVMETHOD(device_shutdown, bus_generic_shutdown), 827 DEVMETHOD(device_suspend, bus_generic_suspend), 828 DEVMETHOD(device_resume, bus_generic_resume), | |
829 830 /* AGP interface */ 831 DEVMETHOD(agp_get_aperture, agp_i810_get_aperture), 832 DEVMETHOD(agp_set_aperture, agp_i810_set_aperture), 833 DEVMETHOD(agp_bind_page, agp_i810_bind_page), 834 DEVMETHOD(agp_unbind_page, agp_i810_unbind_page), 835 DEVMETHOD(agp_flush_tlb, agp_i810_flush_tlb), 836 DEVMETHOD(agp_enable, agp_i810_enable), 837 DEVMETHOD(agp_alloc_memory, agp_i810_alloc_memory), 838 DEVMETHOD(agp_free_memory, agp_i810_free_memory), 839 DEVMETHOD(agp_bind_memory, agp_i810_bind_memory), 840 DEVMETHOD(agp_unbind_memory, agp_i810_unbind_memory), 841 | 805 806 /* AGP interface */ 807 DEVMETHOD(agp_get_aperture, agp_i810_get_aperture), 808 DEVMETHOD(agp_set_aperture, agp_i810_set_aperture), 809 DEVMETHOD(agp_bind_page, agp_i810_bind_page), 810 DEVMETHOD(agp_unbind_page, agp_i810_unbind_page), 811 DEVMETHOD(agp_flush_tlb, agp_i810_flush_tlb), 812 DEVMETHOD(agp_enable, agp_i810_enable), 813 DEVMETHOD(agp_alloc_memory, agp_i810_alloc_memory), 814 DEVMETHOD(agp_free_memory, agp_i810_free_memory), 815 DEVMETHOD(agp_bind_memory, agp_i810_bind_memory), 816 DEVMETHOD(agp_unbind_memory, agp_i810_unbind_memory), 817 |
842 /* bus methods */ 843 DEVMETHOD(bus_print_child, agp_i810_print_child), 844 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), 845 DEVMETHOD(bus_release_resource, bus_generic_release_resource), 846 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), 847 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), 848 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), 849 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), | |
850 { 0, 0 } 851}; 852 853static driver_t agp_i810_driver = { 854 "agp", 855 agp_i810_methods, 856 sizeof(struct agp_i810_softc), 857}; 858 859static devclass_t agp_devclass; 860 | 818 { 0, 0 } 819}; 820 821static driver_t agp_i810_driver = { 822 "agp", 823 agp_i810_methods, 824 sizeof(struct agp_i810_softc), 825}; 826 827static devclass_t agp_devclass; 828 |
861DRIVER_MODULE(agp_i810, pci, agp_i810_driver, agp_devclass, 0, 0); | 829DRIVER_MODULE(agp_i810, vgapci, agp_i810_driver, agp_devclass, 0, 0); |
862MODULE_DEPEND(agp_i810, agp, 1, 1, 1); 863MODULE_DEPEND(agp_i810, pci, 1, 1, 1); | 830MODULE_DEPEND(agp_i810, agp, 1, 1, 1); 831MODULE_DEPEND(agp_i810, pci, 1, 1, 1); |