ni.c (1b37078b7ddf35cab12ac6544187e3636d50c0dc) | ni.c (b15ba51207e54245409d6f46e20dab36f906eed1) |
---|---|
1/* 2 * Copyright 2010 Advanced Micro Devices, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the --- 1439 unchanged lines hidden (view full) --- 1448 return r; 1449 r = cayman_cp_load_microcode(rdev); 1450 if (r) 1451 return r; 1452 r = cayman_cp_resume(rdev); 1453 if (r) 1454 return r; 1455 | 1/* 2 * Copyright 2010 Advanced Micro Devices, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the --- 1439 unchanged lines hidden (view full) --- 1448 return r; 1449 r = cayman_cp_load_microcode(rdev); 1450 if (r) 1451 return r; 1452 r = cayman_cp_resume(rdev); 1453 if (r) 1454 return r; 1455 |
1456 r = radeon_ib_pool_start(rdev); 1457 if (r) 1458 return r; 1459 1460 r = r600_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX); 1461 if (r) { 1462 DRM_ERROR("radeon: failed testing IB (%d).\n", r); 1463 rdev->accel_working = false; 1464 return r; 1465 } 1466 |
|
1456 return 0; 1457} 1458 1459int cayman_resume(struct radeon_device *rdev) 1460{ 1461 int r; 1462 1463 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, 1464 * posting will perform necessary task to bring back GPU into good 1465 * shape. 1466 */ 1467 /* post card */ 1468 atom_asic_init(rdev->mode_info.atom_context); 1469 | 1467 return 0; 1468} 1469 1470int cayman_resume(struct radeon_device *rdev) 1471{ 1472 int r; 1473 1474 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, 1475 * posting will perform necessary task to bring back GPU into good 1476 * shape. 1477 */ 1478 /* post card */ 1479 atom_asic_init(rdev->mode_info.atom_context); 1480 |
1481 rdev->accel_working = true; |
|
1470 r = cayman_startup(rdev); 1471 if (r) { 1472 DRM_ERROR("cayman startup failed on resume\n"); 1473 return r; 1474 } | 1482 r = cayman_startup(rdev); 1483 if (r) { 1484 DRM_ERROR("cayman startup failed on resume\n"); 1485 return r; 1486 } |
1475 1476 r = r600_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX); 1477 if (r) { 1478 DRM_ERROR("radeon: failled testing IB (%d).\n", r); 1479 return r; 1480 } 1481 | |
1482 return r; | 1487 return r; |
1483 | |
1484} 1485 1486int cayman_suspend(struct radeon_device *rdev) 1487{ 1488 /* FIXME: we should wait for ring to be empty */ | 1488} 1489 1490int cayman_suspend(struct radeon_device *rdev) 1491{ 1492 /* FIXME: we should wait for ring to be empty */ |
1493 radeon_ib_pool_suspend(rdev); 1494 r600_blit_suspend(rdev); |
|
1489 cayman_cp_enable(rdev, false); 1490 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; 1491 evergreen_irq_suspend(rdev); 1492 radeon_wb_disable(rdev); 1493 cayman_pcie_gart_disable(rdev); | 1495 cayman_cp_enable(rdev, false); 1496 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; 1497 evergreen_irq_suspend(rdev); 1498 radeon_wb_disable(rdev); 1499 cayman_pcie_gart_disable(rdev); |
1494 r600_blit_suspend(rdev); 1495 | |
1496 return 0; 1497} 1498 1499/* Plan is to move initialization in that function and use 1500 * helper function so that radeon_device_init pretty much 1501 * do nothing more than calling asic specific function. This 1502 * should also allow to remove a bunch of callback function 1503 * like vram_info. --- 58 unchanged lines hidden (view full) --- 1562 1563 rdev->ih.ring_obj = NULL; 1564 r600_ih_ring_init(rdev, 64 * 1024); 1565 1566 r = r600_pcie_gart_init(rdev); 1567 if (r) 1568 return r; 1569 | 1500 return 0; 1501} 1502 1503/* Plan is to move initialization in that function and use 1504 * helper function so that radeon_device_init pretty much 1505 * do nothing more than calling asic specific function. This 1506 * should also allow to remove a bunch of callback function 1507 * like vram_info. --- 58 unchanged lines hidden (view full) --- 1566 1567 rdev->ih.ring_obj = NULL; 1568 r600_ih_ring_init(rdev, 64 * 1024); 1569 1570 r = r600_pcie_gart_init(rdev); 1571 if (r) 1572 return r; 1573 |
1574 r = radeon_ib_pool_init(rdev); |
|
1570 rdev->accel_working = true; | 1575 rdev->accel_working = true; |
1576 if (r) { 1577 dev_err(rdev->dev, "IB initialization failed (%d).\n", r); 1578 rdev->accel_working = false; 1579 } 1580 |
|
1571 r = cayman_startup(rdev); 1572 if (r) { 1573 dev_err(rdev->dev, "disabling GPU acceleration\n"); 1574 cayman_cp_fini(rdev); 1575 r600_irq_fini(rdev); 1576 radeon_wb_fini(rdev); | 1581 r = cayman_startup(rdev); 1582 if (r) { 1583 dev_err(rdev->dev, "disabling GPU acceleration\n"); 1584 cayman_cp_fini(rdev); 1585 r600_irq_fini(rdev); 1586 radeon_wb_fini(rdev); |
1587 r100_ib_fini(rdev); |
|
1577 radeon_irq_kms_fini(rdev); 1578 cayman_pcie_gart_fini(rdev); 1579 rdev->accel_working = false; 1580 } | 1588 radeon_irq_kms_fini(rdev); 1589 cayman_pcie_gart_fini(rdev); 1590 rdev->accel_working = false; 1591 } |
1581 if (rdev->accel_working) { 1582 r = radeon_ib_pool_init(rdev); 1583 if (r) { 1584 DRM_ERROR("radeon: failed initializing IB pool (%d).\n", r); 1585 rdev->accel_working = false; 1586 } 1587 r = r600_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX); 1588 if (r) { 1589 DRM_ERROR("radeon: failed testing IB (%d).\n", r); 1590 rdev->accel_working = false; 1591 } 1592 } | |
1593 1594 /* Don't start up if the MC ucode is missing. 1595 * The default clocks and voltages before the MC ucode 1596 * is loaded are not suffient for advanced operations. 1597 */ 1598 if (!rdev->mc_fw) { 1599 DRM_ERROR("radeon: MC ucode required for NI+.\n"); 1600 return -EINVAL; 1601 } 1602 1603 return 0; 1604} 1605 1606void cayman_fini(struct radeon_device *rdev) 1607{ 1608 r600_blit_fini(rdev); 1609 cayman_cp_fini(rdev); 1610 r600_irq_fini(rdev); 1611 radeon_wb_fini(rdev); | 1592 1593 /* Don't start up if the MC ucode is missing. 1594 * The default clocks and voltages before the MC ucode 1595 * is loaded are not suffient for advanced operations. 1596 */ 1597 if (!rdev->mc_fw) { 1598 DRM_ERROR("radeon: MC ucode required for NI+.\n"); 1599 return -EINVAL; 1600 } 1601 1602 return 0; 1603} 1604 1605void cayman_fini(struct radeon_device *rdev) 1606{ 1607 r600_blit_fini(rdev); 1608 cayman_cp_fini(rdev); 1609 r600_irq_fini(rdev); 1610 radeon_wb_fini(rdev); |
1612 radeon_ib_pool_fini(rdev); | 1611 r100_ib_fini(rdev); |
1613 radeon_irq_kms_fini(rdev); 1614 cayman_pcie_gart_fini(rdev); 1615 r600_vram_scratch_fini(rdev); 1616 radeon_gem_fini(rdev); 1617 radeon_semaphore_driver_fini(rdev); 1618 radeon_fence_driver_fini(rdev); 1619 radeon_bo_fini(rdev); 1620 radeon_atombios_fini(rdev); 1621 kfree(rdev->bios); 1622 rdev->bios = NULL; 1623} 1624 | 1612 radeon_irq_kms_fini(rdev); 1613 cayman_pcie_gart_fini(rdev); 1614 r600_vram_scratch_fini(rdev); 1615 radeon_gem_fini(rdev); 1616 radeon_semaphore_driver_fini(rdev); 1617 radeon_fence_driver_fini(rdev); 1618 radeon_bo_fini(rdev); 1619 radeon_atombios_fini(rdev); 1620 kfree(rdev->bios); 1621 rdev->bios = NULL; 1622} 1623 |