diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2010-08-29 08:18:49 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-09-08 16:20:19 -0400 |
commit | 3b15a9d7cd59b7ec79f61aafabfbe84116561461 (patch) | |
tree | fa53438e6bee5bedd9ce32a9ba35854dcc6f1b73 /drivers/char/agp/intel-gtt.c | |
parent | 2d2430cf9bf9e8b0ad9ea34a103625f4fe7e4477 (diff) |
intel-gtt: call init_gtt_init in probe function
This way create_gatt_table become dummy glue functions for the fake
agp driver - rename them accordingly (and kill the now unnecessary
i9xx copy).
With this change, the gtt initialization code is almost independant
from the agp stuff. Two things are still missing:
- the scratch page is created by the generic agp code.
- filling the whole gtt with scratch_page ptes is not yet consolidated -
this needs abstracted pte handling, first.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/char/agp/intel-gtt.c')
-rw-r--r-- | drivers/char/agp/intel-gtt.c | 60 |
1 files changed, 15 insertions, 45 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 7ac7d5cb3dc1..d7207e8092ab 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -804,6 +804,13 @@ static unsigned int intel_gtt_mappable_entries(void) | |||
804 | static int intel_gtt_init(void) | 804 | static int intel_gtt_init(void) |
805 | { | 805 | { |
806 | u32 gtt_map_size; | 806 | u32 gtt_map_size; |
807 | int ret; | ||
808 | |||
809 | intel_private.base.gtt_mappable_entries = intel_gtt_mappable_entries(); | ||
810 | |||
811 | ret = intel_private.driver->setup(); | ||
812 | if (ret != 0) | ||
813 | return ret; | ||
807 | 814 | ||
808 | intel_private.base.gtt_mappable_entries = intel_gtt_mappable_entries(); | 815 | intel_private.base.gtt_mappable_entries = intel_gtt_mappable_entries(); |
809 | intel_private.base.gtt_total_entries = intel_gtt_total_entries(); | 816 | intel_private.base.gtt_total_entries = intel_gtt_total_entries(); |
@@ -938,21 +945,8 @@ static int i830_setup(void) | |||
938 | return 0; | 945 | return 0; |
939 | } | 946 | } |
940 | 947 | ||
941 | /* The intel i830 automatically initializes the agp aperture during POST. | 948 | static int intel_fake_agp_create_gatt_table(struct agp_bridge_data *bridge) |
942 | * Use the memory already set aside for in the GTT. | ||
943 | */ | ||
944 | static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge) | ||
945 | { | 949 | { |
946 | int ret; | ||
947 | |||
948 | ret = intel_private.driver->setup(); | ||
949 | if (ret != 0) | ||
950 | return ret; | ||
951 | |||
952 | ret = intel_gtt_init(); | ||
953 | if (ret != 0) | ||
954 | return ret; | ||
955 | |||
956 | agp_bridge->gatt_table_real = NULL; | 950 | agp_bridge->gatt_table_real = NULL; |
957 | agp_bridge->gatt_table = NULL; | 951 | agp_bridge->gatt_table = NULL; |
958 | agp_bridge->gatt_bus_addr = 0; | 952 | agp_bridge->gatt_bus_addr = 0; |
@@ -960,9 +954,6 @@ static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge) | |||
960 | return 0; | 954 | return 0; |
961 | } | 955 | } |
962 | 956 | ||
963 | /* Return the gatt table to a sane state. Use the top of stolen | ||
964 | * memory for the GTT. | ||
965 | */ | ||
966 | static int intel_fake_agp_free_gatt_table(struct agp_bridge_data *bridge) | 957 | static int intel_fake_agp_free_gatt_table(struct agp_bridge_data *bridge) |
967 | { | 958 | { |
968 | return 0; | 959 | return 0; |
@@ -1321,28 +1312,6 @@ static int i9xx_setup(void) | |||
1321 | return 0; | 1312 | return 0; |
1322 | } | 1313 | } |
1323 | 1314 | ||
1324 | /* The intel i915 automatically initializes the agp aperture during POST. | ||
1325 | * Use the memory already set aside for in the GTT. | ||
1326 | */ | ||
1327 | static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | ||
1328 | { | ||
1329 | int ret; | ||
1330 | |||
1331 | ret = intel_private.driver->setup(); | ||
1332 | if (ret != 0) | ||
1333 | return ret; | ||
1334 | |||
1335 | ret = intel_gtt_init(); | ||
1336 | if (ret != 0) | ||
1337 | return ret; | ||
1338 | |||
1339 | agp_bridge->gatt_table_real = NULL; | ||
1340 | agp_bridge->gatt_table = NULL; | ||
1341 | agp_bridge->gatt_bus_addr = 0; | ||
1342 | |||
1343 | return 0; | ||
1344 | } | ||
1345 | |||
1346 | /* | 1315 | /* |
1347 | * The i965 supports 36-bit physical addresses, but to keep | 1316 | * The i965 supports 36-bit physical addresses, but to keep |
1348 | * the format of the GTT the same, the bits that don't fit | 1317 | * the format of the GTT the same, the bits that don't fit |
@@ -1411,7 +1380,7 @@ static const struct agp_bridge_driver intel_830_driver = { | |||
1411 | .masks = intel_i810_masks, | 1380 | .masks = intel_i810_masks, |
1412 | .agp_enable = intel_fake_agp_enable, | 1381 | .agp_enable = intel_fake_agp_enable, |
1413 | .cache_flush = global_cache_flush, | 1382 | .cache_flush = global_cache_flush, |
1414 | .create_gatt_table = intel_i830_create_gatt_table, | 1383 | .create_gatt_table = intel_fake_agp_create_gatt_table, |
1415 | .free_gatt_table = intel_fake_agp_free_gatt_table, | 1384 | .free_gatt_table = intel_fake_agp_free_gatt_table, |
1416 | .insert_memory = intel_i830_insert_entries, | 1385 | .insert_memory = intel_i830_insert_entries, |
1417 | .remove_memory = intel_i830_remove_entries, | 1386 | .remove_memory = intel_i830_remove_entries, |
@@ -1438,7 +1407,7 @@ static const struct agp_bridge_driver intel_915_driver = { | |||
1438 | .masks = intel_i810_masks, | 1407 | .masks = intel_i810_masks, |
1439 | .agp_enable = intel_fake_agp_enable, | 1408 | .agp_enable = intel_fake_agp_enable, |
1440 | .cache_flush = global_cache_flush, | 1409 | .cache_flush = global_cache_flush, |
1441 | .create_gatt_table = intel_i915_create_gatt_table, | 1410 | .create_gatt_table = intel_fake_agp_create_gatt_table, |
1442 | .free_gatt_table = intel_fake_agp_free_gatt_table, | 1411 | .free_gatt_table = intel_fake_agp_free_gatt_table, |
1443 | .insert_memory = intel_i915_insert_entries, | 1412 | .insert_memory = intel_i915_insert_entries, |
1444 | .remove_memory = intel_i915_remove_entries, | 1413 | .remove_memory = intel_i915_remove_entries, |
@@ -1471,7 +1440,7 @@ static const struct agp_bridge_driver intel_i965_driver = { | |||
1471 | .masks = intel_i810_masks, | 1440 | .masks = intel_i810_masks, |
1472 | .agp_enable = intel_fake_agp_enable, | 1441 | .agp_enable = intel_fake_agp_enable, |
1473 | .cache_flush = global_cache_flush, | 1442 | .cache_flush = global_cache_flush, |
1474 | .create_gatt_table = intel_i915_create_gatt_table, | 1443 | .create_gatt_table = intel_fake_agp_create_gatt_table, |
1475 | .free_gatt_table = intel_fake_agp_free_gatt_table, | 1444 | .free_gatt_table = intel_fake_agp_free_gatt_table, |
1476 | .insert_memory = intel_i915_insert_entries, | 1445 | .insert_memory = intel_i915_insert_entries, |
1477 | .remove_memory = intel_i915_remove_entries, | 1446 | .remove_memory = intel_i915_remove_entries, |
@@ -1504,7 +1473,7 @@ static const struct agp_bridge_driver intel_gen6_driver = { | |||
1504 | .masks = intel_gen6_masks, | 1473 | .masks = intel_gen6_masks, |
1505 | .agp_enable = intel_fake_agp_enable, | 1474 | .agp_enable = intel_fake_agp_enable, |
1506 | .cache_flush = global_cache_flush, | 1475 | .cache_flush = global_cache_flush, |
1507 | .create_gatt_table = intel_i915_create_gatt_table, | 1476 | .create_gatt_table = intel_fake_agp_create_gatt_table, |
1508 | .free_gatt_table = intel_fake_agp_free_gatt_table, | 1477 | .free_gatt_table = intel_fake_agp_free_gatt_table, |
1509 | .insert_memory = intel_i915_insert_entries, | 1478 | .insert_memory = intel_i915_insert_entries, |
1510 | .remove_memory = intel_i915_remove_entries, | 1479 | .remove_memory = intel_i915_remove_entries, |
@@ -1537,7 +1506,7 @@ static const struct agp_bridge_driver intel_g33_driver = { | |||
1537 | .masks = intel_i810_masks, | 1506 | .masks = intel_i810_masks, |
1538 | .agp_enable = intel_fake_agp_enable, | 1507 | .agp_enable = intel_fake_agp_enable, |
1539 | .cache_flush = global_cache_flush, | 1508 | .cache_flush = global_cache_flush, |
1540 | .create_gatt_table = intel_i915_create_gatt_table, | 1509 | .create_gatt_table = intel_fake_agp_create_gatt_table, |
1541 | .free_gatt_table = intel_fake_agp_free_gatt_table, | 1510 | .free_gatt_table = intel_fake_agp_free_gatt_table, |
1542 | .insert_memory = intel_i915_insert_entries, | 1511 | .insert_memory = intel_i915_insert_entries, |
1543 | .remove_memory = intel_i915_remove_entries, | 1512 | .remove_memory = intel_i915_remove_entries, |
@@ -1744,7 +1713,8 @@ int intel_gmch_probe(struct pci_dev *pdev, | |||
1744 | if (bridge->driver == &intel_810_driver) | 1713 | if (bridge->driver == &intel_810_driver) |
1745 | return 1; | 1714 | return 1; |
1746 | 1715 | ||
1747 | intel_private.base.gtt_mappable_entries = intel_gtt_mappable_entries(); | 1716 | if (intel_gtt_init() != 0) |
1717 | return 0; | ||
1748 | 1718 | ||
1749 | return 1; | 1719 | return 1; |
1750 | } | 1720 | } |