summaryrefslogtreecommitdiffstats
path: root/meta-moblin/packages/xorg-driver/files/pci.patch
blob: 2bdf43158ff5cf56adfd5367f50cb369a98168e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
Index: git/configure.ac
===================================================================
--- git.orig/configure.ac	2008-12-12 15:14:28.000000000 +0000
+++ git/configure.ac	2009-02-04 16:38:32.000000000 +0000
@@ -1,3 +1,4 @@
+AC_DEFUN(CC_AC_CHECK_FILE, $2)
 #  Copyright 2005 Adam Jackson.
 #
 #  Permission is hereby granted, free of charge, to any person obtaining a
@@ -65,17 +66,19 @@
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto xf86dgaproto $REQUIRED_MODULES])
 sdkdir=$(pkg-config --variable=sdkdir xorg-server)
 
+PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
+
 # Checks for libraries.
 
 # Checks for header files.
 AC_HEADER_STDC
 
 if test "$DRI" != no; then
-        AC_CHECK_FILE([${sdkdir}/dri.h],
+        CC_AC_CHECK_FILE([${sdkdir}/dri.h],
                       [have_dri_h="yes"], [have_dri_h="no"])
-        AC_CHECK_FILE([${sdkdir}/sarea.h],
+        CC_AC_CHECK_FILE([${sdkdir}/sarea.h],
                       [have_sarea_h="yes"], [have_sarea_h="no"])
-        AC_CHECK_FILE([${sdkdir}/dristruct.h],
+        CC_AC_CHECK_FILE([${sdkdir}/dristruct.h],
                       [have_dristruct_h="yes"], [have_dristruct_h="no"])
 fi
 
Index: git/exa/exa.c
===================================================================
--- git.orig/exa/exa.c	2008-12-12 15:14:28.000000000 +0000
+++ git/exa/exa.c	2009-02-04 16:38:32.000000000 +0000
@@ -44,7 +44,6 @@
 #include "exa.h"
 #include "cw.h"
 
-static int exaGeneration;
 int exaScreenPrivateIndex;
 int exaPixmapPrivateIndex;
 
@@ -239,7 +238,7 @@
  * for scratch pixmaps, or to represent the visible screen.
  */
 static PixmapPtr
-exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
+exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, int usage_hint)
 {
     PixmapPtr		pPixmap;
     ExaPixmapPrivPtr	pExaPixmap;
@@ -249,7 +248,7 @@
     if (w > 32767 || h > 32767)
 	return NullPixmap;
 
-    pPixmap = fbCreatePixmap (pScreen, w, h, depth);
+    pPixmap = fbCreatePixmap (pScreen, w, h, depth, usage_hint);
     if (!pPixmap)
 	return NULL;
     pExaPixmap = ExaGetPixmapPriv(pPixmap);
@@ -606,12 +605,6 @@
 #ifdef RENDER
     ps = GetPictureScreenIfSet(pScreen);
 #endif
-    if (exaGeneration != serverGeneration)
-    {
-	exaScreenPrivateIndex = AllocateScreenPrivateIndex();
-	exaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
-	exaGeneration = serverGeneration;
-    }
 
     pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
 
@@ -623,7 +616,7 @@
 
     pExaScr->info = pScreenInfo;
 
-    pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
+    dixSetPrivate(&pScreen->devPrivates, &exaScreenPrivateIndex, pExaScr);
 
     pExaScr->migration = ExaMigrationAlways;
 
Index: git/exa/exa_priv.h
===================================================================
--- git.orig/exa/exa_priv.h	2008-12-12 15:14:28.000000000 +0000
+++ git/exa/exa_priv.h	2009-02-04 16:38:32.000000000 +0000
@@ -129,7 +129,8 @@
 
 extern int exaScreenPrivateIndex;
 extern int exaPixmapPrivateIndex;
-#define ExaGetScreenPriv(s)	((ExaScreenPrivPtr)(s)->devPrivates[exaScreenPrivateIndex].ptr)
+
+#define ExaGetScreenPriv(s)	((ExaScreenPrivPtr) dixLookupPrivate(&s->devPrivates, &exaScreenPrivateIndex))
 #define ExaScreenPriv(s)	ExaScreenPrivPtr    pExaScr = ExaGetScreenPriv(s)
 
 /** Align an offset to an arbitrary alignment */
@@ -145,8 +146,8 @@
 #define EXA_PIXMAP_SCORE_PINNED	    1000
 #define EXA_PIXMAP_SCORE_INIT	    1001
 
-#define ExaGetPixmapPriv(p)	((ExaPixmapPrivPtr)(p)->devPrivates[exaPixmapPrivateIndex].ptr)
-#define ExaSetPixmapPriv(p,a)	((p)->devPrivates[exaPixmapPrivateIndex].ptr = (pointer) (a))
+#define ExaGetPixmapPriv(p)	((ExaPixmapPrivPtr)dixLookupPrivate(&p->devPrivates, &exaPixmapPrivateIndex))
+#define ExaSetPixmapPriv(p,a)	(dixSetPrivate(&p->devPrivates, &exaScreenPrivateIndex, (a)))
 #define ExaPixmapPriv(p)	ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
 
 typedef struct {
Index: git/exa/exa_render.c
===================================================================
--- git.orig/exa/exa_render.c	2008-12-12 15:14:28.000000000 +0000
+++ git/exa/exa_render.c	2009-02-04 16:38:32.000000000 +0000
@@ -898,7 +898,7 @@
 	width = extents.x2 - extents.x1;
 	height = extents.y2 - extents.y1;
 	pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
-						maskFormat->depth);
+						maskFormat->depth, 0);
 	if (!pMaskPixmap)
 	    return;
 	component_alpha = NeedsComponent(maskFormat->format);
@@ -960,7 +960,7 @@
 
 	/* Create the (real) temporary pixmap to store the current glyph in */
 	pPixmap = (*pScreen->CreatePixmap) (pScreen, maxwidth, maxheight,
-					    list->format->depth);
+					    list->format->depth, 0);
 	if (!pPixmap)
 	    return;
 
Index: git/exa/examodule.c
===================================================================
--- git.orig/exa/examodule.c	2008-12-12 15:14:28.000000000 +0000
+++ git/exa/examodule.c	2009-02-04 16:38:32.000000000 +0000
@@ -42,8 +42,7 @@
     OptionInfoPtr		 options;
 } ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
 
-static int exaXorgServerGeneration;
-static int exaXorgScreenPrivateIndex;
+int exaXorgScreenPrivateIndex;
 
 typedef enum {
     EXAOPT_MIGRATION_HEURISTIC,
@@ -69,8 +68,8 @@
 exaXorgCloseScreen (int i, ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
-    ExaXorgScreenPrivPtr pScreenPriv =
-	pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
+
+    ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, &exaXorgScreenPrivateIndex);
 
     pScreen->CloseScreen = pScreenPriv->SavedCloseScreen;
 
@@ -86,8 +85,8 @@
 exaXorgEnableDisableFBAccess (int index, Bool enable)
 {
     ScreenPtr pScreen = screenInfo.screens[index];
-    ExaXorgScreenPrivPtr pScreenPriv =
-	pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
+
+    ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, &exaXorgScreenPrivateIndex);
 
     if (!enable)
 	exaEnableDisableFBAccess (index, enable);
@@ -111,11 +110,6 @@
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     ExaXorgScreenPrivPtr pScreenPriv;
 
-    if (exaXorgServerGeneration != serverGeneration) {
-	exaXorgScreenPrivateIndex = AllocateScreenPrivateIndex();
-	exaXorgServerGeneration = serverGeneration;
-    }
-
     pScreenPriv = xcalloc (1, sizeof(ExaXorgScreenPrivRec));
     if (pScreenPriv == NULL)
 	return;
@@ -166,7 +160,7 @@
 	pExaScr->info->DownloadFromScreen = NULL;
     }
 
-    pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr = pScreenPriv;
+    dixSetPrivate(&pScreen->devPrivates, &exaXorgScreenPrivateIndex, pScreenPriv);
 
     pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
     pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess;
Index: git/src/i830_bios.c
===================================================================
--- git.orig/src/i830_bios.c	2008-12-12 15:14:28.000000000 +0000
+++ git/src/i830_bios.c	2009-02-04 16:38:32.000000000 +0000
@@ -97,7 +97,7 @@
 	       INTEL_VBIOS_SIZE);
 	vbeFree(pVbe);
     } else {
-	xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, INTEL_VBIOS_SIZE);
+        pci_device_read_rom(pI830->PciInfo, bios);
     }
 
     if (0)
@@ -159,7 +159,7 @@
     for (bdb_block_off = bdb->header_size; bdb_block_off < bdb->bdb_size;
 	 bdb_block_off += block_size) {
 	int start = bdb_off + bdb_block_off;
-	int id, i, num_entries;
+	int id, num_entries;
 	struct lvds_bdb_1 *lvds1;
 	struct lvds_bdb_2 *lvds2;
 	struct lvds_bdb_2_fp_params *fpparam;
Index: git/src/psb_dri.c
===================================================================
--- git.orig/src/psb_dri.c	2008-12-12 15:14:28.000000000 +0000
+++ git/src/psb_dri.c	2009-02-04 16:38:32.000000000 +0000
@@ -139,9 +139,9 @@
 	return;
 
     pDevice->irq = drmGetInterruptFromBusID(pDevice->drmFD,
-					    pDevice->pciInfo->bus,
-					    pDevice->pciInfo->device,
-					    pDevice->pciInfo->func);
+					    ((pDevice->PciInfo->domain << 8) | pDevice->PciInfo->bus),
+					    pDevice->PciInfo->dev,
+					    pDevice->PciInfo->func);
     if ((drmCtlInstHandler(pDevice->drmFD, pDevice->irq))) {
 	xf86DrvMsg(-1, X_WARNING, "[drm] Failed to install IRQ handler.\n");
 	pDevice->irq = -1;
@@ -530,7 +530,6 @@
     DRIInfoPtr pDRIInfo;
     PsbDRIPtr pPsbDRI;
     int major, minor, patch;
-    pciVideoPtr pciInfo;
 
     PSB_DEBUG(pScrn->scrnIndex, 2, "psbDRIScreenInit\n");
 
@@ -568,8 +567,8 @@
         pDRIInfo->clientDriverName = NULL;
     pDRIInfo->busIdString = xalloc(64);
     sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
-	    pDevice->pciInfo->bus,
-	    pDevice->pciInfo->device, pDevice->pciInfo->func);
+	    ((pDevice->PciInfo->domain << 8) | pDevice->PciInfo->bus),
+	    pDevice->PciInfo->dev, pDevice->PciInfo->func);
     pDRIInfo->ddxDriverMajorVersion = PSB_DRIDDX_VERSION_MAJOR;
     pDRIInfo->ddxDriverMinorVersion = PSB_DRIDDX_VERSION_MINOR;
     pDRIInfo->ddxDriverPatchVersion = PSB_DRIDDX_VERSION_PATCH;
@@ -608,8 +607,8 @@
     }
 
     pPsbDRI->pciVendor = PCI_VENDOR_INTEL;
-    pciInfo = xf86GetPciInfoForEntity(pDevice->pEnt->index);
-    pPsbDRI->pciDevice = pciInfo->chipType;
+    /*pciInfo = xf86GetPciInfoForEntity(pDevice->pEnt->index);*/
+    pPsbDRI->pciDevice = pDevice->PciInfo->device_id;
     pPsbDRI->lockSAreaSize = PSB_DRI_LOCK_SAREA_SIZE;
 #if PSB_LEGACY_DRI
     pPsbDRI->lockSAreaHandle = 0;
Index: git/src/psb_driver.c
===================================================================
--- git.orig/src/psb_driver.c	2008-12-12 15:14:28.000000000 +0000
+++ git/src/psb_driver.c	2009-02-04 16:48:40.000000000 +0000
@@ -58,7 +58,7 @@
 /* Mandatory functions */
 static const OptionInfoRec *psbAvailableOptions(int chipid, int busid);
 static void psbIdentify(int flags);
-static Bool psbProbe(DriverPtr drv, int flags);
+static Bool psbProbe(DriverPtr drv, int entity_num, struct pci_device  *device, intptr_t match_data);
 static Bool psbPreInit(ScrnInfoPtr pScrn, int flags);
 static Bool psbScreenInit(int Index, ScreenPtr pScreen, int argc,
 			  char **argv);
@@ -92,6 +92,13 @@
 #define makedev(x,y)    ((dev_t)(((x) << 8) | (y)))
 #endif
 
+
+static const struct pci_id_match psbDeviceMatch[] = {
+    { 0x8086, PCI_CHIP_PSB1, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0 },
+    { 0x8086, PCI_CHIP_PSB2, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0 },
+    { 0, 0, 0 },
+};
+
 /* 
  * This contains the functions needed by the server after loading the
  * driver module.  It must be supplied, and gets added the driver list by
@@ -104,10 +111,13 @@
     PSB_VERSION,
     PSB_DRIVER_NAME,
     psbIdentify,
-    psbProbe,
+    NULL,
     psbAvailableOptions,
     NULL,
-    0
+    0,
+    NULL,
+    psbDeviceMatch,
+    psbProbe
 };
 
 enum GenericTypes
@@ -350,122 +360,85 @@
  * do a minimal probe for supported hardware.
  */
 
-static Bool
-psbProbe(DriverPtr drv, int flags)
+
+/*psbProbe(DriverPtr drv, int flags)*/
+static Bool psbProbe (DriverPtr         driver,
+                           int                entity_num,
+                           struct pci_device  *device,
+                           intptr_t           match_data)
 {
+    ScrnInfoPtr     scrn = NULL;
     Bool foundScreen = FALSE;
-    int numDevSections, numUsed;
-    GDevPtr *devSections = NULL;
-    int *usedChips = NULL;
-    int i;
+    int numUsed;
     EntityInfoPtr pEnt;
     PsbDevicePtr pPsbDev;
     DevUnion *pPriv;
 
+
     PSB_DEBUG(-1, 2, "psbProbe\n");
     numUsed = 0;
 
-    /*
-     * Find the config file Device sections that match this
-     * driver, and return if there are none.
-     */
-
-    if ((numDevSections = xf86MatchDevice(PSB_NAME, &devSections)) <= 0)
-	return (FALSE);
-
-    if (xf86GetPciVideoInfo()) {
-
-	/*
-	 * This function allocates screens to devices according to
-	 * bus ids in the config file. Multiple device sections may point
-	 * to the same PCI device.
-	 */
-
-	numUsed = xf86MatchPciInstances(PSB_NAME, PCI_VENDOR_INTEL,
-					psbChipsets, psbPCIchipsets,
-					devSections, numDevSections, drv,
-					&usedChips);
-    }
-
-    if (numUsed <= 0)
-	goto out;
-
-    if (flags & PROBE_DETECT) {
-	foundScreen = TRUE;
-	goto out;
-    }
-
-    if (psbEntityIndex == -1)
-	psbEntityIndex = xf86AllocateEntityPrivateIndex();
+    scrn = xf86ConfigPciEntity (scrn, 0, entity_num, psbPCIchipsets,
+                               NULL,
+                               NULL, NULL, NULL, NULL);
 
-    for (i = 0; i < numUsed; i++) {
-	ScrnInfoPtr pScrn = NULL;
-
-	/* Allocate a ScrnInfoRec  */
-	if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
-					 psbPCIchipsets, NULL, NULL, NULL,
-					 NULL, NULL))) {
-	    pScrn->driverVersion = PSB_VERSION;
-	    pScrn->driverName = PSB_DRIVER_NAME;
-	    pScrn->name = PSB_NAME;
-	    pScrn->Probe = psbProbe;
-	    pScrn->PreInit = psbPreInit;
-	    pScrn->ScreenInit = psbScreenInit;
-	    pScrn->SwitchMode = psbSwitchMode;
-	    pScrn->AdjustFrame = psbAdjustFrame;
-	    pScrn->EnterVT = psbEnterVT;
-	    pScrn->LeaveVT = psbLeaveVT;
-	    pScrn->FreeScreen = psbFreeScreen;
-	    pScrn->ValidMode = NULL;
-	    foundScreen = TRUE;
-	}
+    if (scrn != NULL)
+    {
+       scrn->driverVersion = PSB_VERSION;
+       scrn->driverName = PSB_DRIVER_NAME;
+       scrn->name = PSB_NAME;
+       scrn->Probe = NULL;
+       scrn->PreInit = psbPreInit;
+       scrn->ScreenInit = psbScreenInit;
+       scrn->SwitchMode = psbSwitchMode;
+       scrn->AdjustFrame = psbAdjustFrame;
+       scrn->EnterVT = psbEnterVT;
+       scrn->LeaveVT = psbLeaveVT;
+       scrn->FreeScreen = psbFreeScreen;
+       scrn->ValidMode = NULL;
+       foundScreen = TRUE;
 
 	/*
 	 * We support dual head, And need a per-device structure.
 	 */
 
 	pPsbDev = NULL;
-	pEnt = xf86GetEntityInfo(usedChips[i]);
-	xf86SetEntitySharable(usedChips[i]);
+	pEnt = xf86GetEntityInfo(entity_num);
+	xf86SetEntitySharable(entity_num);
 
-	pPriv = xf86GetEntityPrivate(pScrn->entityList[0], psbEntityIndex);
+        /* Allocate an entity private if necessary */		
+        if (psbEntityIndex < 0)					
+            psbEntityIndex = xf86AllocateEntityPrivateIndex();
+
+	pPriv = xf86GetEntityPrivate(scrn->entityList[0], psbEntityIndex);
 
 	if (!pPriv->ptr) {
-	    PSB_DEBUG(pScrn->scrnIndex, 3, "Allocating new device\n");
+	    PSB_DEBUG(scrn->scrnIndex, 3, "Allocating new device\n");
 
 	    pPriv->ptr = xnfcalloc(sizeof(PsbDevice), 1);
 	    pPsbDev = pPriv->ptr;
 	    pPsbDev->lastInstance = -1;
 	    pPsbDev->pEnt = pEnt;
-	    pPsbDev->pciInfo = xf86GetPciInfoForEntity(pEnt->index);
-	    pPsbDev->pciTag = pciTag(pPsbDev->pciInfo->bus,
-				     pPsbDev->pciInfo->device,
-				     pPsbDev->pciInfo->func);
 	    pPsbDev->refCount = 0;
-	    pPsbDev->pScrns[0] = pScrn;
+	    pPsbDev->pScrns[0] = scrn;
 	} else {
 	    pPsbDev = pPriv->ptr;
-	    PSB_DEBUG(pScrn->scrnIndex, 3, "Secondary screen %d\n",
+	    PSB_DEBUG(scrn->scrnIndex, 3, "Secondary screen %d\n",
 		      pPsbDev->lastInstance + 1);
-	    pPsbDev->pScrns[1] = pScrn;
+	    pPsbDev->pScrns[1] = scrn;
 	}
 
 	pPsbDev->lastInstance++;
 	pPsbDev->numScreens = pPsbDev->lastInstance + 1;
 
-	xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0],
+	xf86SetEntityInstanceForScreen(scrn, scrn->entityList[0],
 				       pPsbDev->lastInstance);
-	pPsbDev->device = xf86GetDevFromEntity(pScrn->entityList[0],
-					       pScrn->entityInstanceList[0]);
+	pPsbDev->device = xf86GetDevFromEntity(scrn->entityList[0],
+					       scrn->entityInstanceList[0]);
     }
 
-  out:
-    if (usedChips != NULL)
-	xfree(usedChips);
-    if (devSections != NULL)
-	xfree(devSections);
 
-    return foundScreen;
+    return scrn != NULL;
 }
 
 static PsbPtr
@@ -492,8 +465,10 @@
     I830Ptr pI830 = &pPsb->i830Ptr;
 
     pI830->pEnt = pDevice->pEnt;
-    pI830->PciTag = pDevice->pciTag;
-    pI830->PciInfo = pDevice->pciInfo;
+    pI830->PciInfo = pDevice->PciInfo;
+    pI830->mmio_bar = pDevice->mmio_bar;
+    pI830->fb_bar = pDevice->fb_bar;
+    pI830->gtt_bar = pDevice->gtt_bar;
     pI830->pDevice = pDevice;
 }
 
@@ -607,7 +582,6 @@
 psbPreInitDRI(ScrnInfoPtr pScrn)
 {
     PsbPtr pPsb = psbPTR(pScrn);
-    MessageType from;
 
     mmInitListHead(&pPsb->sAreaList);
     pPsb->dri = TRUE;
@@ -930,12 +904,13 @@
 	    400,
 	    533,
 	};
-	PCITAG host = pciTag(0, 0, 0);
-	CARD32 clock, period;
 
-	pciWriteLong(host, 0xD0, 0xD0050300);
+	CARD32 period;
+	unsigned int clock;
+
+	pci_device_cfg_write_u32(pDevice->PciInfo, 0xD0050300, 0xD0);
 
-	clock = pciReadLong(host, 0xD4);
+	pci_device_cfg_read_u32(pDevice->PciInfo, &clock, 0xD4);
 
 	pPsb->CoreClock = CoreClocks[clock & 0x07];
 	pPsb->MemClock = MemClocks[(clock & 0x08) >> 3];
@@ -1054,8 +1029,8 @@
     if (!vgaHWGetHWRec(pDevice->pScrns[0]))
 	return FALSE;
 
-    pDevice->regPhys = pDevice->pciInfo->memBase[0];
-    pDevice->regSize = 1 << pDevice->pciInfo->size[0];
+    pDevice->regPhys = pDevice->PciInfo->regions[0].base_addr;
+    pDevice->regSize = 1 << pDevice->PciInfo->regions[0].size;
 
     pDevice->regMap = xf86MapVidMem(scrnIndex, VIDMEM_MMIO_32BIT,
 				    pDevice->regPhys, pDevice->regSize);
@@ -1076,12 +1051,12 @@
      * Map the OpRegion SCI region
      */
     {
-	CARD32 OpRegion_Phys;
+	unsigned int OpRegion_Phys;
 	unsigned int OpRegion_Size = 0x100;
 	OpRegionPtr OpRegion;
 	char *OpRegion_String = "IntelGraphicsMem";
 
-	OpRegion_Phys = pciReadLong(pDevice->pciTag, 0xFC);
+	pci_device_cfg_read_u32(pDevice->PciInfo, &OpRegion_Phys, 0xFC);
 
 	pDevice->OpRegion = xf86MapVidMem(scrnIndex, VIDMEM_MMIO_32BIT,
 					  OpRegion_Phys, OpRegion_Size);
@@ -1107,8 +1082,10 @@
 	}
     }
 
-    pDevice->stolenBase =
-	(unsigned long)pciReadLong(pDevice->pciTag, PSB_BSM) & 0xFFFFF000;
+    pci_device_cfg_read_u32(pDevice->PciInfo, &pDevice->stolenBase, PSB_BSM);
+
+    pDevice->stolenBase = pDevice->stolenBase & 0xFFFFF000;
+
     pDevice->stolenSize = PSB_READ32(PSB_PGETBL_CTL) & 0xFFFFF000;
 
     pDevice->stolenSize -= pDevice->stolenBase;
Index: git/src/psb_driver.h
===================================================================
--- git.orig/src/psb_driver.h	2008-12-12 15:14:28.000000000 +0000
+++ git/src/psb_driver.h	2009-02-04 16:38:32.000000000 +0000
@@ -54,6 +54,9 @@
 #include "xf86Crtc.h"
 #include "xf86str.h"
 
+#include "xorg-server.h"
+#include <pciaccess.h>
+
 #include "libmm/mm_defines.h"
 #include "libmm/mm_interface.h"
 
@@ -137,8 +140,10 @@
     unsigned deviceIndex;
     EntityInfoPtr pEnt;
     GDevPtr device;
-    pciVideoPtr pciInfo;
-    PCITAG pciTag;
+    struct pci_device *PciInfo;
+    int mmio_bar;
+    int fb_bar;
+    int gtt_bar;
     unsigned long regPhys;
     unsigned long regSize;
     unsigned long fbPhys;
@@ -202,8 +207,10 @@
 typedef struct _I830Rec
 {
     EntityInfoPtr pEnt;
-    PCITAG PciTag;
-    pciVideoPtr PciInfo;
+    struct pci_device *PciInfo;
+    int mmio_bar;
+    int fb_bar;
+    int gtt_bar;
     PsbDevicePtr pDevice;
 } I830Rec, *I830Ptr;
 
Index: git/src/psb_lvds.c
===================================================================
--- git.orig/src/psb_lvds.c	2008-12-12 15:14:28.000000000 +0000
+++ git/src/psb_lvds.c	2009-02-04 16:38:32.000000000 +0000
@@ -131,7 +131,7 @@
 
 #define MAGIC_SCI 0x8001
     /* Go get the data from SCI */
-    pciWriteLong(pDevice->pciTag, 0xE0, MAGIC_SCI);
+    pci_device_cfg_write_u32(pDevice->PciInfo, MAGIC_SCI, 0xE0);
 
     /* wait for the data */
     loop = (*SciDSLP == 0) ? 10 : *SciDSLP;
@@ -281,7 +281,7 @@
 psbLVDSSetBacklight(PsbLVDSOutputPtr pLVDS, int level)
 {
     PsbDevicePtr pDevice = pLVDS->psbOutput.pDevice;
-    CARD32 blc_pwm_ctl, blc_pwm_duty_cycle;
+    CARD32 blc_pwm_duty_cycle;
     PsbPtr pPsb = psbPTR(pLVDS->psbOutput.pScrn);
     CARD32 max_pwm_blc;
     unsigned long newbacklight = 0;
@@ -322,7 +322,7 @@
 static CARD32
 psbLVDSGetMaxBacklight(PsbLVDSOutputPtr pLVDS)
 {
-    PsbDevicePtr pDevice = pLVDS->psbOutput.pDevice;
+    /*PsbDevicePtr pDevice = pLVDS->psbOutput.pDevice;*/
     return BRIGHTNESS_MAX_LEVEL;
 }
 
Index: git/src/psb_ioctl.h
===================================================================
--- git.orig/src/psb_ioctl.h	2009-02-04 16:47:55.000000000 +0000
+++ git/src/psb_ioctl.h	2009-02-04 16:48:08.000000000 +0000
@@ -33,6 +33,8 @@
 #ifndef _PSB_IOCTL_H_
 #define _PSB_IOCTL_H_
 
+#include "libdrm_lists.h"
+
 typedef struct _drmBOList
 {
     unsigned numTarget;