View | Details | Raw Unified | Return to bug 72372
Collapse All | Expand All

(-)agp_nvidia.c (-11 / +20 lines)
Lines 148-155 Link Here
148
		sc->wbc_mask = 0x80000000;
148
		sc->wbc_mask = 0x80000000;
149
		break;
149
		break;
150
	default:
150
	default:
151
		sc->wbc_mask = 0;
151
		device_printf(dev, "Bad chip id\n");
152
		break;
152
		return (ENODEV);
153
	}
153
	}
154
154
155
	/* AGP Controller */
155
	/* AGP Controller */
Lines 227-234 Link Here
227
	for (i = 0; i < 8; i++) {
227
	for (i = 0; i < 8; i++) {
228
		pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_ATTBASE(i),
228
		pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_ATTBASE(i),
229
				 (sc->gatt->ag_physical +
229
				 (sc->gatt->ag_physical +
230
				   (i % sc->num_dirs) * 64 * 1024),
230
				   (i % sc->num_dirs) * 64 * 1024) | 1, 4);
231
				 4);
232
	}
231
	}
233
232
234
	/* GTLB Control */
233
	/* GTLB Control */
Lines 279-288 Link Here
279
static u_int32_t
278
static u_int32_t
280
agp_nvidia_get_aperture(device_t dev)
279
agp_nvidia_get_aperture(device_t dev)
281
{
280
{
282
	u_int8_t	key;
281
	switch (pci_read_config(dev, AGP_NVIDIA_0_APSIZE, 1) & 0x0f) {
283
282
	case 0: return (512 * 1024 * 1024); break;
284
	key = ffs(pci_read_config(dev, AGP_NVIDIA_0_APSIZE, 1) & 0x0f);
283
	case 8: return (256 * 1024 * 1024); break;
285
	return (1 << (24 + (key ? key : 5)));
284
	case 12: return (128 * 1024 * 1024); break;
285
	case 14: return (64 * 1024 * 1024); break;
286
	case 15: return (32 * 1024 * 1024); break;
287
	default:
288
		device_printf(dev, "Invalid aperture setting 0x%x",
289
		    pci_read_config(dev, AGP_NVIDIA_0_APSIZE, 1));
290
		return 0;
291
	}
286
}
292
}
287
293
288
static int
294
static int
Lines 318-324 Link Here
318
		return (EINVAL);
324
		return (EINVAL);
319
325
320
	index = (sc->pg_offset + offset) >> AGP_PAGE_SHIFT;
326
	index = (sc->pg_offset + offset) >> AGP_PAGE_SHIFT;
321
	sc->gatt->ag_virtual[index] = physical;
327
	sc->gatt->ag_virtual[index] = physical | 1;
322
328
323
	return (0);
329
	return (0);
324
}
330
}
Lines 343-348 Link Here
343
{
349
{
344
	struct agp_nvidia_softc *sc;
350
	struct agp_nvidia_softc *sc;
345
	u_int32_t wbc_reg, temp;
351
	u_int32_t wbc_reg, temp;
352
	volatile u_int32_t *ag_virtual;
346
	int i;
353
	int i;
347
354
348
	sc = (struct agp_nvidia_softc *)device_get_softc(dev);
355
	sc = (struct agp_nvidia_softc *)device_get_softc(dev);
Lines 366-376 Link Here
366
				"TLB flush took more than 3 seconds.\n");
373
				"TLB flush took more than 3 seconds.\n");
367
	}
374
	}
368
375
376
	ag_virtual = (volatile u_int32_t *)sc->gatt->ag_virtual;
377
369
	/* Flush TLB entries. */
378
	/* Flush TLB entries. */
370
	for(i = 0; i < 32 + 1; i++)
379
	for(i = 0; i < 32 + 1; i++)
371
		temp = sc->gatt->ag_virtual[i * PAGE_SIZE / sizeof(u_int32_t)];
380
		temp = ag_virtual[i * PAGE_SIZE / sizeof(u_int32_t)];
372
	for(i = 0; i < 32 + 1; i++)
381
	for(i = 0; i < 32 + 1; i++)
373
		temp = sc->gatt->ag_virtual[i * PAGE_SIZE / sizeof(u_int32_t)];
382
		temp = ag_virtual[i * PAGE_SIZE / sizeof(u_int32_t)];
374
383
375
	return (0);
384
	return (0);
376
}
385
}

Return to bug 72372