agp_amd.c (87479) | agp_amd.c (94790) |
---|---|
1/*- 2 * Copyright (c) 2000 Doug Rabson 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2000 Doug Rabson 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/agp/agp_amd.c 87479 2001-12-07 05:41:26Z cokane $ | 26 * $FreeBSD: head/sys/dev/agp/agp_amd.c 94790 2002-04-15 18:57:26Z cokane $ |
27 */ 28 29#include "opt_bus.h" 30#include "opt_pci.h" 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/malloc.h> --- 72 unchanged lines hidden (view full) --- 107 return 0; 108 } 109 bzero(gatt->ag_virtual, entries * sizeof(u_int32_t)); 110 111 /* 112 * Allocate the page directory. 113 */ 114 gatt->ag_vdir = malloc(AGP_PAGE_SIZE, M_AGP, M_NOWAIT); | 27 */ 28 29#include "opt_bus.h" 30#include "opt_pci.h" 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/malloc.h> --- 72 unchanged lines hidden (view full) --- 107 return 0; 108 } 109 bzero(gatt->ag_virtual, entries * sizeof(u_int32_t)); 110 111 /* 112 * Allocate the page directory. 113 */ 114 gatt->ag_vdir = malloc(AGP_PAGE_SIZE, M_AGP, M_NOWAIT); |
115 bzero(gatt->ag_vdir, AGP_PAGE_SIZE); 116 | |
117 if (!gatt->ag_vdir) { 118 if (bootverbose) 119 device_printf(dev, 120 "failed to allocate page directory\n"); 121 free(gatt->ag_virtual, M_AGP); 122 free(gatt, M_AGP); 123 return 0; 124 } | 115 if (!gatt->ag_vdir) { 116 if (bootverbose) 117 device_printf(dev, 118 "failed to allocate page directory\n"); 119 free(gatt->ag_virtual, M_AGP); 120 free(gatt, M_AGP); 121 return 0; 122 } |
123 bzero(gatt->ag_vdir, AGP_PAGE_SIZE); 124 |
|
125 gatt->ag_pdir = vtophys((vm_offset_t) gatt->ag_vdir); 126 if(bootverbose) 127 device_printf(dev, "gatt -> ag_pdir %8x\n", 128 (vm_offset_t)gatt->ag_pdir); 129 /* 130 * Allocate the gatt pages 131 */ 132 gatt->ag_entries = entries; 133 if(bootverbose) 134 device_printf(dev, "allocating GATT for %d AGP page entries\n", 135 gatt->ag_entries); | 125 gatt->ag_pdir = vtophys((vm_offset_t) gatt->ag_vdir); 126 if(bootverbose) 127 device_printf(dev, "gatt -> ag_pdir %8x\n", 128 (vm_offset_t)gatt->ag_pdir); 129 /* 130 * Allocate the gatt pages 131 */ 132 gatt->ag_entries = entries; 133 if(bootverbose) 134 device_printf(dev, "allocating GATT for %d AGP page entries\n", 135 gatt->ag_entries); |
136 gatt->ag_virtual = malloc(entries * sizeof(u_int32_t), M_AGP, 137 M_NOWAIT); 138 if(!gatt->ag_virtual) { 139 if(bootverbose) 140 device_printf(dev, "allocation failed\n"); 141 free(gatt, M_AGP); 142 return 0; 143 } | 136 |
144 gatt->ag_physical = vtophys((vm_offset_t) gatt->ag_virtual); 145 146 /* 147 * Map the pages of the GATT into the page directory. 148 * 149 * The GATT page addresses are mapped into the directory offset by 150 * an amount dependent on the base address of the aperture. This 151 * is and offset into the page directory, not an offset added to --- 275 unchanged lines hidden --- | 137 gatt->ag_physical = vtophys((vm_offset_t) gatt->ag_virtual); 138 139 /* 140 * Map the pages of the GATT into the page directory. 141 * 142 * The GATT page addresses are mapped into the directory offset by 143 * an amount dependent on the base address of the aperture. This 144 * is and offset into the page directory, not an offset added to --- 275 unchanged lines hidden --- |