Lines 1454-1459
Link Here
|
1454 |
xf86PrintEDID(MonInfo); |
1454 |
xf86PrintEDID(MonInfo); |
1455 |
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n"); |
1455 |
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n"); |
1456 |
xf86SetDDCproperties(pScrn, MonInfo); |
1456 |
xf86SetDDCproperties(pScrn, MonInfo); |
|
|
1457 |
|
1458 |
MGARestore(pScrn); |
1459 |
MGAUnmapMem(pScrn); |
1460 |
|
1457 |
return MonInfo; |
1461 |
return MonInfo; |
1458 |
} |
1462 |
} |
1459 |
|
1463 |
|
Lines 2990-3019
Link Here
|
2990 |
#ifdef XSERVER_LIBPCIACCESS |
2994 |
#ifdef XSERVER_LIBPCIACCESS |
2991 |
struct pci_device *const dev = pMga->PciInfo; |
2995 |
struct pci_device *const dev = pMga->PciInfo; |
2992 |
struct pci_mem_region *region; |
2996 |
struct pci_mem_region *region; |
2993 |
void **memory[2]; |
|
|
2994 |
int i, err; |
2997 |
int i, err; |
2995 |
#endif |
2998 |
#endif |
2996 |
|
2999 |
|
2997 |
|
3000 |
|
2998 |
if (!pMga->FBDev) { |
3001 |
if (!pMga->FBDev) { |
2999 |
#ifdef XSERVER_LIBPCIACCESS |
3002 |
#ifdef XSERVER_LIBPCIACCESS |
3000 |
memory[pMga->io_bar] = &pMga->IOBase; |
|
|
3001 |
memory[pMga->framebuffer_bar] = &pMga->FbBase; |
3002 |
|
3003 |
|
3003 |
for (i = 0; i < 2; i++) { |
3004 |
pciaddr_t fbaddr = pMga->FbAddress; |
3004 |
region = &dev->regions[i]; |
3005 |
pciaddr_t fbsize = pMga->FbMapSize; |
3005 |
err = pci_device_map_range(dev, |
3006 |
err = pci_device_map_range(dev, |
3006 |
region->base_addr, region->size, |
3007 |
fbaddr, fbsize, |
3007 |
PCI_DEV_MAP_FLAG_WRITABLE, |
3008 |
PCI_DEV_MAP_FLAG_WRITABLE, |
3008 |
memory[i]); |
3009 |
(void **)&pMga->FbBase); |
3009 |
|
3010 |
|
3010 |
if (err) { |
3011 |
if (err) { |
3011 |
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, |
3012 |
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, |
3012 |
"Unable to map BAR %i. %s (%d)\n", |
3013 |
"Unable to map Framebuffer %08llX %llx. %s (%d)\n", (long long)fbaddr, (long long)fbsize, |
3013 |
i, strerror(err), err); |
3014 |
strerror(err), err); |
3014 |
return FALSE; |
3015 |
return FALSE; |
3015 |
} |
3016 |
} |
3016 |
} |
3017 |
else |
|
|
3018 |
xf86DrvMsg(pScrn->scrnIndex, X_INFO, |
3019 |
"MAPPED Framebuffer %08llX %llx to %08llX.\n", (long long)fbaddr, (long long)fbsize, (long long)pMga->FbBase); |
3020 |
|
3021 |
|
3022 |
if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) |
3023 |
{ |
3024 |
region = &dev->regions[pMga->io_bar]; |
3025 |
err = pci_device_map_range(dev, |
3026 |
region->base_addr, region->size, |
3027 |
PCI_DEV_MAP_FLAG_WRITABLE, |
3028 |
&pMga->IOBase); |
3029 |
|
3030 |
if (err) { |
3031 |
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, |
3032 |
"Unable to map IO Region %i. %s (%d)\n", |
3033 |
pMga->io_bar, strerror(err), err); |
3034 |
return FALSE; |
3035 |
} |
3036 |
|
3037 |
if(pMga->entityPrivate != NULL) |
3038 |
{ |
3039 |
pMga->entityPrivate->mappedIOBase = pMga->IOBase; |
3040 |
} |
3041 |
} |
3042 |
else |
3043 |
pMga->IOBase = pMga->entityPrivate->mappedIOBase; |
3044 |
|
3045 |
if(pMga->entityPrivate != NULL) |
3046 |
pMga->entityPrivate->mappedIOUsage ++; |
3047 |
|
3017 |
#else |
3048 |
#else |
3018 |
/* |
3049 |
/* |
3019 |
* For Alpha, we need to map SPARSE memory, since we need |
3050 |
* For Alpha, we need to map SPARSE memory, since we need |
Lines 3055-3070
Link Here
|
3055 |
if (pMga->iload_bar != -1) { |
3086 |
if (pMga->iload_bar != -1) { |
3056 |
#ifdef XSERVER_LIBPCIACCESS |
3087 |
#ifdef XSERVER_LIBPCIACCESS |
3057 |
region = &dev->regions[pMga->iload_bar]; |
3088 |
region = &dev->regions[pMga->iload_bar]; |
3058 |
err = pci_device_map_range(dev, |
3089 |
|
|
|
3090 |
if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedILOADUsage == 0) |
3091 |
{ |
3092 |
err = pci_device_map_range(dev, |
3059 |
region->base_addr, region->size, |
3093 |
region->base_addr, region->size, |
3060 |
PCI_DEV_MAP_FLAG_WRITABLE, |
3094 |
PCI_DEV_MAP_FLAG_WRITABLE, |
3061 |
(void *) &pMga->ILOADBase); |
3095 |
(void *) &pMga->ILOADBase); |
3062 |
if (err) { |
3096 |
if (err) { |
3063 |
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, |
3097 |
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, |
3064 |
"Unable to map BAR 2 (ILOAD region). %s (%d)\n", |
3098 |
"Unable to map BAR 2 (ILOAD region). %s (%d)\n", |
3065 |
strerror(err), err); |
3099 |
strerror(err), err); |
3066 |
return FALSE; |
3100 |
return FALSE; |
|
|
3101 |
} |
3102 |
|
3103 |
if(pMga->entityPrivate != NULL) |
3104 |
pMga->entityPrivate->mappedILOADBase = pMga->ILOADBase; |
3067 |
} |
3105 |
} |
|
|
3106 |
else |
3107 |
pMga->ILOADBase = pMga->entityPrivate->mappedILOADBase; |
3108 |
|
3109 |
if(pMga->entityPrivate != NULL) |
3110 |
pMga->entityPrivate->mappedILOADUsage ++; |
3068 |
#else |
3111 |
#else |
3069 |
pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, |
3112 |
pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, |
3070 |
VIDMEM_MMIO | VIDMEM_MMIO_32BIT | |
3113 |
VIDMEM_MMIO | VIDMEM_MMIO_32BIT | |
Lines 3094-3103
Link Here
|
3094 |
|
3137 |
|
3095 |
if (!pMga->FBDev) { |
3138 |
if (!pMga->FBDev) { |
3096 |
#ifdef XSERVER_LIBPCIACCESS |
3139 |
#ifdef XSERVER_LIBPCIACCESS |
3097 |
pci_device_unmap_range(dev, pMga->IOBase, |
3140 |
if(pMga->entityPrivate != NULL) |
3098 |
dev->regions[pMga->io_bar].size); |
3141 |
pMga->entityPrivate->mappedIOUsage --; |
|
|
3142 |
|
3143 |
if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) |
3144 |
{ |
3145 |
pci_device_unmap_range(dev, pMga->IOBase, |
3146 |
dev->regions[pMga->io_bar].size); |
3147 |
|
3148 |
if(pMga->entityPrivate != NULL) |
3149 |
pMga->entityPrivate->mappedIOBase = NULL; |
3150 |
} |
3151 |
|
3152 |
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer 0x%08llX, 0x%llX.\n", (long long)pMga->FbBase, (long long)pMga->FbMapSize); |
3099 |
pci_device_unmap_range(dev, pMga->FbBase, |
3153 |
pci_device_unmap_range(dev, pMga->FbBase, |
3100 |
dev->regions[pMga->framebuffer_bar].size); |
3154 |
pMga->FbMapSize); |
3101 |
#else |
3155 |
#else |
3102 |
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000); |
3156 |
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000); |
3103 |
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize); |
3157 |
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize); |
Lines 3110-3117
Link Here
|
3110 |
|
3164 |
|
3111 |
if ((pMga->iload_bar != -1) && (pMga->ILOADBase != NULL)) { |
3165 |
if ((pMga->iload_bar != -1) && (pMga->ILOADBase != NULL)) { |
3112 |
#ifdef XSERVER_LIBPCIACCESS |
3166 |
#ifdef XSERVER_LIBPCIACCESS |
3113 |
pci_device_unmap_range(dev, pMga->ILOADBase, |
3167 |
if(pMga->entityPrivate != NULL) |
|
|
3168 |
pMga->entityPrivate->mappedILOADUsage --; |
3169 |
|
3170 |
if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedILOADUsage == 0) |
3171 |
{ |
3172 |
pci_device_unmap_range(dev, pMga->ILOADBase, |
3114 |
dev->regions[pMga->iload_bar].size); |
3173 |
dev->regions[pMga->iload_bar].size); |
|
|
3174 |
|
3175 |
if(pMga->entityPrivate != NULL) |
3176 |
pMga->entityPrivate->mappedILOADBase = NULL; |
3177 |
} |
3178 |
|
3115 |
#else |
3179 |
#else |
3116 |
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000); |
3180 |
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000); |
3117 |
#endif |
3181 |
#endif |