Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
radeon_device.c File Reference
#include <linux/console.h>
#include <linux/slab.h>
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h>
#include <drm/radeon_drm.h>
#include <linux/vgaarb.h>
#include <linux/vga_switcheroo.h>
#include <linux/efi.h>
#include "radeon_reg.h"
#include "radeon.h"
#include "atom.h"

Go to the source code of this file.

Functions

void radeon_surface_init (struct radeon_device *rdev)
 
void radeon_scratch_init (struct radeon_device *rdev)
 
int radeon_scratch_get (struct radeon_device *rdev, uint32_t *reg)
 
void radeon_scratch_free (struct radeon_device *rdev, uint32_t reg)
 
void radeon_wb_disable (struct radeon_device *rdev)
 
void radeon_wb_fini (struct radeon_device *rdev)
 
int radeon_wb_init (struct radeon_device *rdev)
 
void radeon_vram_location (struct radeon_device *rdev, struct radeon_mc *mc, u64 base)
 
void radeon_gtt_location (struct radeon_device *rdev, struct radeon_mc *mc)
 
bool radeon_card_posted (struct radeon_device *rdev)
 
void radeon_update_bandwidth_info (struct radeon_device *rdev)
 
bool radeon_boot_test_post_card (struct radeon_device *rdev)
 
int radeon_dummy_page_init (struct radeon_device *rdev)
 
void radeon_dummy_page_fini (struct radeon_device *rdev)
 
int radeon_atombios_init (struct radeon_device *rdev)
 
void radeon_atombios_fini (struct radeon_device *rdev)
 
int radeon_combios_init (struct radeon_device *rdev)
 
void radeon_combios_fini (struct radeon_device *rdev)
 
int radeon_device_init (struct radeon_device *rdev, struct drm_device *ddev, struct pci_dev *pdev, uint32_t flags)
 
void radeon_device_fini (struct radeon_device *rdev)
 
int radeon_suspend_kms (struct drm_device *dev, pm_message_t state)
 
int radeon_resume_kms (struct drm_device *dev)
 
int radeon_gpu_reset (struct radeon_device *rdev)
 
int radeon_debugfs_add_files (struct radeon_device *rdev, struct drm_info_list *files, unsigned nfiles)
 

Function Documentation

void radeon_atombios_fini ( struct radeon_device rdev)

radeon_atombios_fini - free the driver info and callbacks for atombios

: radeon_device pointer

Frees the driver info and register access callbacks for the ATOM interpreter (r4xx+). Called at driver shutdown.

Definition at line 775 of file radeon_device.c.

int radeon_atombios_init ( struct radeon_device rdev)

radeon_atombios_init - init the driver info and callbacks for atombios

: radeon_device pointer

Initializes the driver info and register access callbacks for the ATOM interpreter (r4xx+). Returns 0 on sucess, -ENOMEM on failure. Called at driver startup.

Definition at line 733 of file radeon_device.c.

bool radeon_boot_test_post_card ( struct radeon_device rdev)

radeon_boot_test_post_card - check and possibly initialize the hw

: radeon_device pointer

Check if the asic is initialized and if not, attempt to initialize it (all asics). Returns true if initialized or false if not.

Definition at line 514 of file radeon_device.c.

bool radeon_card_posted ( struct radeon_device rdev)

radeon_card_posted - check if the hw has already been initialized

: radeon_device pointer

Check if the asic has been initialized (all asics). Used at driver startup. Returns true if initialized or false if not.

Definition at line 428 of file radeon_device.c.

void radeon_combios_fini ( struct radeon_device rdev)

radeon_combios_fini - free the driver info for combios

: radeon_device pointer

Frees the driver info for combios (r1xx-r3xx). Called at driver shutdown.

Definition at line 814 of file radeon_device.c.

int radeon_combios_init ( struct radeon_device rdev)

radeon_combios_init - init the driver info for combios

: radeon_device pointer

Initializes the driver info for combios (r1xx-r3xx). Returns 0 on sucess. Called at driver startup.

Definition at line 800 of file radeon_device.c.

int radeon_debugfs_add_files ( struct radeon_device rdev,
struct drm_info_list *  files,
unsigned  nfiles 
)

Definition at line 1379 of file radeon_device.c.

void radeon_device_fini ( struct radeon_device rdev)

radeon_device_fini - tear down the driver

: radeon_device pointer

Tear down the driver info (all asics). Called at driver shutdown.

Definition at line 1129 of file radeon_device.c.

int radeon_device_init ( struct radeon_device rdev,
struct drm_device ddev,
struct pci_dev pdev,
uint32_t  flags 
)

radeon_device_init - initialize the driver

: radeon_device pointer : drm dev pointer : pci dev pointer : driver flags

Initializes the driver info and hw (all asics). Returns 0 for success or an error on failure. Called at driver startup.

Definition at line 966 of file radeon_device.c.

void radeon_dummy_page_fini ( struct radeon_device rdev)

radeon_dummy_page_fini - free dummy page used by the driver

: radeon_device pointer

Frees the dummy page used by the driver (all asics).

Definition at line 567 of file radeon_device.c.

int radeon_dummy_page_init ( struct radeon_device rdev)

radeon_dummy_page_init - init dummy page used by the driver

: radeon_device pointer

Allocate the dummy page used by the driver (all asics). This dummy page is used by the driver as a filler for gart entries when pages are taken out of the GART Returns 0 on sucess, -ENOMEM on failure.

Definition at line 542 of file radeon_device.c.

int radeon_gpu_reset ( struct radeon_device rdev)

radeon_gpu_reset - reset the asic

: radeon device pointer

Attempt the reset the GPU if it has hung (all asics). Returns 0 for success or an error on failure.

Definition at line 1306 of file radeon_device.c.

void radeon_gtt_location ( struct radeon_device rdev,
struct radeon_mc mc 
)

radeon_gtt_location - try to find GTT location : radeon device structure holding all necessary informations : memory controller structure holding memory informations

Function will place try to place GTT before or after VRAM.

If GTT size is bigger than space left then we ajust GTT size. Thus function will never fails.

FIXME: when reducing GTT size align new size on power of 2.

Definition at line 392 of file radeon_device.c.

int radeon_resume_kms ( struct drm_device dev)

radeon_resume_kms - initiate device resume

: drm dev pointer

Bring the hw back to operating state (all asics). Returns 0 for success or an error on failure. Called at driver resume.

Definition at line 1243 of file radeon_device.c.

void radeon_scratch_free ( struct radeon_device rdev,
uint32_t  reg 
)

radeon_scratch_free - Free a scratch register

: radeon_device pointer : scratch register mmio offset

Free a CP scratch register allocated for use by the driver (all asics)

Definition at line 181 of file radeon_device.c.

int radeon_scratch_get ( struct radeon_device rdev,
uint32_t reg 
)

radeon_scratch_get - Allocate a scratch register

: radeon_device pointer : scratch register mmio offset

Allocate a CP scratch register for use by the driver (all asics). Returns 0 on success or -EINVAL on failure.

Definition at line 159 of file radeon_device.c.

void radeon_scratch_init ( struct radeon_device rdev)

radeon_scratch_init - Init scratch register driver information.

: radeon_device pointer

Init CP scratch register driver information (r1xx-r5xx)

Definition at line 133 of file radeon_device.c.

void radeon_surface_init ( struct radeon_device rdev)

radeon_surface_init - Clear GPU surface registers.

: radeon_device pointer

Clear GPU surface registers (r1xx-r5xx).

Definition at line 106 of file radeon_device.c.

int radeon_suspend_kms ( struct drm_device dev,
pm_message_t  state 
)

radeon_suspend_kms - initiate device suspend

: drm dev pointer : suspend state

Puts the hw in the suspend state (all asics). Returns 0 for success or an error on failure. Called at driver suspend.

Definition at line 1160 of file radeon_device.c.

void radeon_update_bandwidth_info ( struct radeon_device rdev)

radeon_update_bandwidth_info - update display bandwidth params

: radeon_device pointer

Used when sclk/mclk are switched or display modes are set. params are used to calculate display watermarks (all asics)

Definition at line 485 of file radeon_device.c.

void radeon_vram_location ( struct radeon_device rdev,
struct radeon_mc mc,
u64  base 
)

radeon_vram_location - try to find VRAM location : radeon device structure holding all necessary informations : memory controller structure holding memory informations : base address at which to put VRAM

Function will place try to place VRAM at base address provided as parameter (which is so far either PCI aperture address or for IGP TOM base address).

If there is not enough space to fit the unvisible VRAM in the 32bits address space then we limit the VRAM size to the aperture.

If we are using AGP and if the AGP aperture doesn't allow us to have room for all the VRAM than we restrict the VRAM to the PCI aperture size and print a warning.

This function will never fails, worst case are limiting VRAM.

Note: GTT start, end, size should be initialized before calling this function on AGP platform.

Note: We don't explicitly enforce VRAM start to be aligned on VRAM size, this shouldn't be a problem as we are using the PCI aperture as a reference. Otherwise this would be needed for rv280, all r3xx, and all r4xx, but not IGP.

Note: we use mc_vram_size as on some board we need to program the mc to cover the whole aperture even if VRAM size is inferior to aperture size Novell bug 204882 + along with lots of ubuntu ones

Note: when limiting vram it's safe to overwritte real_vram_size because we are not in case where real_vram_size is inferior to mc_vram_size (ie note afected by bogus hw of Novell bug 204882 + along with lots of ubuntu ones)

Note: IGP TOM addr should be the same as the aperture addr, we don't explicitly check for that thought.

FIXME: when reducing VRAM size align new size on power of 2.

Definition at line 356 of file radeon_device.c.

void radeon_wb_disable ( struct radeon_device rdev)

radeon_wb_disable - Disable Writeback

: radeon_device pointer

Disables Writeback (all asics). Used for suspend.

Definition at line 207 of file radeon_device.c.

void radeon_wb_fini ( struct radeon_device rdev)

radeon_wb_fini - Disable Writeback and free memory

: radeon_device pointer

Disables Writeback and frees the Writeback memory (all asics). Used at driver shutdown.

Definition at line 230 of file radeon_device.c.

int radeon_wb_init ( struct radeon_device rdev)

radeon_wb_init- Init Writeback driver info and allocate memory

: radeon_device pointer

Disables Writeback and frees the Writeback memory (all asics). Used at driver startup. Returns 0 on success or an -error on failure.

Definition at line 249 of file radeon_device.c.