FreeBSD Bugzilla – Attachment 17853 Details for
Bug 32301
Fix for agpgart for the AMD-751 and related parts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 5.71 KB, created by
joeo
on 2001-11-26 21:40:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
joeo
Created:
2001-11-26 21:40:00 UTC
Size:
5.71 KB
patch
obsolete
>*** agp_amd.c.old Mon Nov 26 21:10:45 2001 >--- agp_amd.c Mon Nov 26 21:05:14 2001 >*************** >*** 58,66 **** > > struct agp_amd_gatt { > u_int32_t ag_entries; > u_int32_t *ag_vdir; /* virtual address of page dir */ > vm_offset_t ag_pdir; /* physical address of page dir */ >- u_int32_t *ag_virtual; /* virtual address of gatt */ > }; > > struct agp_amd_softc { >--- 58,67 ---- > > struct agp_amd_gatt { > u_int32_t ag_entries; >+ u_int32_t *ag_virtual; /* virtual address of gatt */ >+ vm_offset_t ag_physical; /* physical address of the gatt */ > u_int32_t *ag_vdir; /* virtual address of page dir */ > vm_offset_t ag_pdir; /* physical address of page dir */ > }; > > struct agp_amd_softc { >*************** >*** 78,84 **** > u_int32_t apsize = AGP_GET_APERTURE(dev); > u_int32_t entries = apsize >> AGP_PAGE_SHIFT; > struct agp_amd_gatt *gatt; >! int i, npages; > > if (bootverbose) > device_printf(dev, >--- 79,85 ---- > u_int32_t apsize = AGP_GET_APERTURE(dev); > u_int32_t entries = apsize >> AGP_PAGE_SHIFT; > struct agp_amd_gatt *gatt; >! int i, npages, pdir_offset; > > if (bootverbose) > device_printf(dev, >*************** >*** 92,113 **** > /* > * The AMD751 uses a page directory to map a non-contiguous > * gatt so we don't need to use contigmalloc. > */ >- gatt->ag_entries = entries; >- gatt->ag_virtual = malloc(entries * sizeof(u_int32_t), >- M_AGP, M_NOWAIT); >- if (!gatt->ag_virtual) { >- if (bootverbose) >- device_printf(dev, "allocation failed\n"); >- free(gatt, M_AGP); >- return 0; >- } >- bzero(gatt->ag_virtual, entries * sizeof(u_int32_t)); > > /* > * Allocate the page directory. > */ > gatt->ag_vdir = malloc(AGP_PAGE_SIZE, M_AGP, M_NOWAIT); > if (!gatt->ag_vdir) { > if (bootverbose) > device_printf(dev, >--- 93,108 ---- > /* > * The AMD751 uses a page directory to map a non-contiguous > * gatt so we don't need to use contigmalloc. >+ * Malloc indiviual gatt pages and map them into the page >+ * directory. > */ > > /* > * Allocate the page directory. > */ > gatt->ag_vdir = malloc(AGP_PAGE_SIZE, M_AGP, M_NOWAIT); >+ bzero(gatt->ag_vdir, AGP_PAGE_SIZE); >+ > if (!gatt->ag_vdir) { > if (bootverbose) > device_printf(dev, >*************** >*** 116,130 **** > free(gatt, M_AGP); > return 0; > } >- bzero(gatt->ag_vdir, AGP_PAGE_SIZE); > gatt->ag_pdir = vtophys((vm_offset_t) gatt->ag_vdir); >! gatt->ag_pdir = vtophys(gatt->ag_virtual); > > /* > * Map the pages of the GATT into the page directory. > */ > npages = ((entries * sizeof(u_int32_t) + AGP_PAGE_SIZE - 1) > >> AGP_PAGE_SHIFT); > for (i = 0; i < npages; i++) { > vm_offset_t va; > vm_offset_t pa; >--- 111,157 ---- > free(gatt, M_AGP); > return 0; > } > gatt->ag_pdir = vtophys((vm_offset_t) gatt->ag_vdir); >! if (bootverbose) >! device_printf(dev, >! "gatt -> ag_pdir %8x\n", >! (vm_offset_t) gatt->ag_pdir ); >! >! /* >! * Allocate the gatt pages >! */ >! gatt->ag_entries = entries; >! if (bootverbose) >! device_printf(dev, >! "allocating GATT for %d AGP page entries\n", >! gatt->ag_entries = entries); >! >! gatt->ag_virtual = malloc(entries * sizeof(u_int32_t), >! M_AGP, M_NOWAIT); >! >! if (!gatt->ag_virtual) { >! if (bootverbose) >! device_printf(dev, "allocation failed\n"); >! free(gatt, M_AGP); >! return 0; >! } >! bzero(gatt->ag_virtual, entries * sizeof(u_int32_t)); >! gatt->ag_physical = vtophys((vm_offset_t) gatt->ag_virtual); > > /* > * Map the pages of the GATT into the page directory. >+ * >+ * The gatt page addresses are mapped into the directory >+ * offset by an amount dependent on the base address of the >+ * aperture. This is an offset into the page directory >+ * not an offset added to the addresses of the gatt pages. > */ >+ >+ pdir_offset = pci_read_config(dev, AGP_AMD751_APBASE, 4) >> 22; >+ > npages = ((entries * sizeof(u_int32_t) + AGP_PAGE_SIZE - 1) > >> AGP_PAGE_SHIFT); >+ > for (i = 0; i < npages; i++) { > vm_offset_t va; > vm_offset_t pa; >*************** >*** 131,137 **** > > va = ((vm_offset_t) gatt->ag_virtual) + i * AGP_PAGE_SIZE; > pa = vtophys(va); >! gatt->ag_vdir[i] = pa | 1; > } > > /* >--- 158,164 ---- > > va = ((vm_offset_t) gatt->ag_virtual) + i * AGP_PAGE_SIZE; > pa = vtophys(va); >! gatt->ag_vdir[i + pdir_offset ] = pa | 1; > } > > /* >*************** >*** 163,168 **** >--- 190,201 ---- > switch (pci_get_devid(dev)) { > case 0x70061022: > return ("AMD 751 host to AGP bridge"); >+ >+ case 0x700e1022: >+ return ("AMD 761 host to AGP bridge"); >+ >+ case 0x700c1022: >+ return ("AMD 762 host to AGP bridge"); > }; > > return NULL; >*************** >*** 301,309 **** > > vas = ffs(aperture / 32*1024*1024) - 1; > > pci_write_config(dev, AGP_AMD751_APCTRL, >! ((pci_read_config(dev, AGP_AMD751_APCTRL, 1) & ~0x06) >! | vas << 1), 1); > > return 0; > } >--- 335,348 ---- > > vas = ffs(aperture / 32*1024*1024) - 1; > >+ /* >+ * while the size register is bits 1-3 of APCTRL, bit 0 needs >+ * be set for the size value to be "valid" >+ */ >+ > pci_write_config(dev, AGP_AMD751_APCTRL, >! (((pci_read_config(dev, AGP_AMD751_APCTRL, 1) & ~0x06) >! | ((vas << 1) | 1))), 1); > > return 0; > } >*************** >*** 316,322 **** > if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) > return EINVAL; > >! sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical | 1; > return 0; > } > >--- 355,366 ---- > if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) > return EINVAL; > >! sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical | 1 ; >! >! /* ivalidate the cache */ >! AGP_FLUSH_TLB(dev); >! >! > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 32301
:
17852
| 17853