r600.c (1b37078b7ddf35cab12ac6544187e3636d50c0dc) r600.c (b15ba51207e54245409d6f46e20dab36f906eed1)
1/*
2 * Copyright 2008 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
4 * Copyright 2009 Jerome Glisse.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation

--- 2472 unchanged lines hidden (view full) ---

2481 return r;
2482 r = r600_cp_load_microcode(rdev);
2483 if (r)
2484 return r;
2485 r = r600_cp_resume(rdev);
2486 if (r)
2487 return r;
2488
1/*
2 * Copyright 2008 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
4 * Copyright 2009 Jerome Glisse.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation

--- 2472 unchanged lines hidden (view full) ---

2481 return r;
2482 r = r600_cp_load_microcode(rdev);
2483 if (r)
2484 return r;
2485 r = r600_cp_resume(rdev);
2486 if (r)
2487 return r;
2488
2489 r = radeon_ib_pool_start(rdev);
2490 if (r)
2491 return r;
2492
2493 r = r600_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX);
2494 if (r) {
2495 DRM_ERROR("radeon: failed testing IB (%d).\n", r);
2496 rdev->accel_working = false;
2497 return r;
2498 }
2499
2489 return 0;
2490}
2491
2492void r600_vga_set_state(struct radeon_device *rdev, bool state)
2493{
2494 uint32_t temp;
2495
2496 temp = RREG32(CONFIG_CNTL);

--- 12 unchanged lines hidden (view full) ---

2509
2510 /* Do not reset GPU before posting, on r600 hw unlike on r500 hw,
2511 * posting will perform necessary task to bring back GPU into good
2512 * shape.
2513 */
2514 /* post card */
2515 atom_asic_init(rdev->mode_info.atom_context);
2516
2500 return 0;
2501}
2502
2503void r600_vga_set_state(struct radeon_device *rdev, bool state)
2504{
2505 uint32_t temp;
2506
2507 temp = RREG32(CONFIG_CNTL);

--- 12 unchanged lines hidden (view full) ---

2520
2521 /* Do not reset GPU before posting, on r600 hw unlike on r500 hw,
2522 * posting will perform necessary task to bring back GPU into good
2523 * shape.
2524 */
2525 /* post card */
2526 atom_asic_init(rdev->mode_info.atom_context);
2527
2528 rdev->accel_working = true;
2517 r = r600_startup(rdev);
2518 if (r) {
2519 DRM_ERROR("r600 startup failed on resume\n");
2520 return r;
2521 }
2522
2529 r = r600_startup(rdev);
2530 if (r) {
2531 DRM_ERROR("r600 startup failed on resume\n");
2532 return r;
2533 }
2534
2523 r = r600_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX);
2524 if (r) {
2525 DRM_ERROR("radeon: failed testing IB (%d).\n", r);
2526 return r;
2527 }
2528
2529 r = r600_audio_init(rdev);
2530 if (r) {
2531 DRM_ERROR("radeon: audio resume failed\n");
2532 return r;
2533 }
2534
2535 return r;
2536}
2537
2538int r600_suspend(struct radeon_device *rdev)
2539{
2540 r600_audio_fini(rdev);
2535 r = r600_audio_init(rdev);
2536 if (r) {
2537 DRM_ERROR("radeon: audio resume failed\n");
2538 return r;
2539 }
2540
2541 return r;
2542}
2543
2544int r600_suspend(struct radeon_device *rdev)
2545{
2546 r600_audio_fini(rdev);
2547 radeon_ib_pool_suspend(rdev);
2548 r600_blit_suspend(rdev);
2541 /* FIXME: we should wait for ring to be empty */
2542 r600_cp_stop(rdev);
2543 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false;
2544 r600_irq_suspend(rdev);
2545 radeon_wb_disable(rdev);
2546 r600_pcie_gart_disable(rdev);
2549 /* FIXME: we should wait for ring to be empty */
2550 r600_cp_stop(rdev);
2551 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false;
2552 r600_irq_suspend(rdev);
2553 radeon_wb_disable(rdev);
2554 r600_pcie_gart_disable(rdev);
2547 r600_blit_suspend(rdev);
2548
2549 return 0;
2550}
2551
2552/* Plan is to move initialization in that function and use
2553 * helper function so that radeon_device_init pretty much
2554 * do nothing more than calling asic specific function. This
2555 * should also allow to remove a bunch of callback function

--- 64 unchanged lines hidden (view full) ---

2620
2621 rdev->ih.ring_obj = NULL;
2622 r600_ih_ring_init(rdev, 64 * 1024);
2623
2624 r = r600_pcie_gart_init(rdev);
2625 if (r)
2626 return r;
2627
2555
2556 return 0;
2557}
2558
2559/* Plan is to move initialization in that function and use
2560 * helper function so that radeon_device_init pretty much
2561 * do nothing more than calling asic specific function. This
2562 * should also allow to remove a bunch of callback function

--- 64 unchanged lines hidden (view full) ---

2627
2628 rdev->ih.ring_obj = NULL;
2629 r600_ih_ring_init(rdev, 64 * 1024);
2630
2631 r = r600_pcie_gart_init(rdev);
2632 if (r)
2633 return r;
2634
2635 r = radeon_ib_pool_init(rdev);
2628 rdev->accel_working = true;
2636 rdev->accel_working = true;
2637 if (r) {
2638 dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
2639 rdev->accel_working = false;
2640 }
2641
2629 r = r600_startup(rdev);
2630 if (r) {
2631 dev_err(rdev->dev, "disabling GPU acceleration\n");
2632 r600_cp_fini(rdev);
2633 r600_irq_fini(rdev);
2634 radeon_wb_fini(rdev);
2642 r = r600_startup(rdev);
2643 if (r) {
2644 dev_err(rdev->dev, "disabling GPU acceleration\n");
2645 r600_cp_fini(rdev);
2646 r600_irq_fini(rdev);
2647 radeon_wb_fini(rdev);
2648 r100_ib_fini(rdev);
2635 radeon_irq_kms_fini(rdev);
2636 r600_pcie_gart_fini(rdev);
2637 rdev->accel_working = false;
2638 }
2649 radeon_irq_kms_fini(rdev);
2650 r600_pcie_gart_fini(rdev);
2651 rdev->accel_working = false;
2652 }
2639 if (rdev->accel_working) {
2640 r = radeon_ib_pool_init(rdev);
2641 if (r) {
2642 dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
2643 rdev->accel_working = false;
2644 } else {
2645 r = r600_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX);
2646 if (r) {
2647 dev_err(rdev->dev, "IB test failed (%d).\n", r);
2648 rdev->accel_working = false;
2649 }
2650 }
2651 }
2652
2653 r = r600_audio_init(rdev);
2654 if (r)
2655 return r; /* TODO error handling */
2656 return 0;
2657}
2658
2659void r600_fini(struct radeon_device *rdev)
2660{
2661 r600_audio_fini(rdev);
2662 r600_blit_fini(rdev);
2663 r600_cp_fini(rdev);
2664 r600_irq_fini(rdev);
2665 radeon_wb_fini(rdev);
2653
2654 r = r600_audio_init(rdev);
2655 if (r)
2656 return r; /* TODO error handling */
2657 return 0;
2658}
2659
2660void r600_fini(struct radeon_device *rdev)
2661{
2662 r600_audio_fini(rdev);
2663 r600_blit_fini(rdev);
2664 r600_cp_fini(rdev);
2665 r600_irq_fini(rdev);
2666 radeon_wb_fini(rdev);
2666 radeon_ib_pool_fini(rdev);
2667 r100_ib_fini(rdev);
2667 radeon_irq_kms_fini(rdev);
2668 r600_pcie_gart_fini(rdev);
2669 r600_vram_scratch_fini(rdev);
2670 radeon_agp_fini(rdev);
2671 radeon_gem_fini(rdev);
2672 radeon_semaphore_driver_fini(rdev);
2673 radeon_fence_driver_fini(rdev);
2674 radeon_bo_fini(rdev);

--- 1118 unchanged lines hidden ---
2668 radeon_irq_kms_fini(rdev);
2669 r600_pcie_gart_fini(rdev);
2670 r600_vram_scratch_fini(rdev);
2671 radeon_agp_fini(rdev);
2672 radeon_gem_fini(rdev);
2673 radeon_semaphore_driver_fini(rdev);
2674 radeon_fence_driver_fini(rdev);
2675 radeon_bo_fini(rdev);

--- 1118 unchanged lines hidden ---