forked from KolibriOS/kolibrios
kms radeon driver
git-svn-id: svn://kolibrios.org@1117 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5710e61b10
commit
2f1717a403
739
drivers/video/drm/include/drm_crtc.h
Normal file
739
drivers/video/drm/include/drm_crtc.h
Normal file
@ -0,0 +1,739 @@
|
||||
/*
|
||||
* Copyright © 2006 Keith Packard
|
||||
* Copyright © 2007-2008 Dave Airlie
|
||||
* Copyright © 2007-2008 Intel Corporation
|
||||
* Jesse Barnes <jesse.barnes@intel.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __DRM_CRTC_H__
|
||||
#define __DRM_CRTC_H__
|
||||
|
||||
//#include <linux/i2c.h>
|
||||
//#include <linux/spinlock.h>
|
||||
//#include <linux/types.h>
|
||||
//#include <linux/idr.h>
|
||||
|
||||
//#include <linux/fb.h>
|
||||
|
||||
struct drm_device;
|
||||
struct drm_mode_set;
|
||||
struct drm_framebuffer;
|
||||
|
||||
|
||||
#define DRM_MODE_OBJECT_CRTC 0xcccccccc
|
||||
#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
|
||||
#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
|
||||
#define DRM_MODE_OBJECT_MODE 0xdededede
|
||||
#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
|
||||
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
|
||||
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
|
||||
|
||||
struct drm_mode_object {
|
||||
uint32_t id;
|
||||
uint32_t type;
|
||||
};
|
||||
|
||||
/*
|
||||
* Note on terminology: here, for brevity and convenience, we refer to connector
|
||||
* control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,
|
||||
* DVI, etc. And 'screen' refers to the whole of the visible display, which
|
||||
* may span multiple monitors (and therefore multiple CRTC and connector
|
||||
* structures).
|
||||
*/
|
||||
|
||||
enum drm_mode_status {
|
||||
MODE_OK = 0, /* Mode OK */
|
||||
MODE_HSYNC, /* hsync out of range */
|
||||
MODE_VSYNC, /* vsync out of range */
|
||||
MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
|
||||
MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
|
||||
MODE_BAD_WIDTH, /* requires an unsupported linepitch */
|
||||
MODE_NOMODE, /* no mode with a maching name */
|
||||
MODE_NO_INTERLACE, /* interlaced mode not supported */
|
||||
MODE_NO_DBLESCAN, /* doublescan mode not supported */
|
||||
MODE_NO_VSCAN, /* multiscan mode not supported */
|
||||
MODE_MEM, /* insufficient video memory */
|
||||
MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
|
||||
MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
|
||||
MODE_MEM_VIRT, /* insufficient video memory given virtual size */
|
||||
MODE_NOCLOCK, /* no fixed clock available */
|
||||
MODE_CLOCK_HIGH, /* clock required is too high */
|
||||
MODE_CLOCK_LOW, /* clock required is too low */
|
||||
MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
|
||||
MODE_BAD_HVALUE, /* horizontal timing was out of range */
|
||||
MODE_BAD_VVALUE, /* vertical timing was out of range */
|
||||
MODE_BAD_VSCAN, /* VScan value out of range */
|
||||
MODE_HSYNC_NARROW, /* horizontal sync too narrow */
|
||||
MODE_HSYNC_WIDE, /* horizontal sync too wide */
|
||||
MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
|
||||
MODE_HBLANK_WIDE, /* horizontal blanking too wide */
|
||||
MODE_VSYNC_NARROW, /* vertical sync too narrow */
|
||||
MODE_VSYNC_WIDE, /* vertical sync too wide */
|
||||
MODE_VBLANK_NARROW, /* vertical blanking too narrow */
|
||||
MODE_VBLANK_WIDE, /* vertical blanking too wide */
|
||||
MODE_PANEL, /* exceeds panel dimensions */
|
||||
MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
|
||||
MODE_ONE_WIDTH, /* only one width is supported */
|
||||
MODE_ONE_HEIGHT, /* only one height is supported */
|
||||
MODE_ONE_SIZE, /* only one resolution is supported */
|
||||
MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
|
||||
MODE_UNVERIFIED = -3, /* mode needs to reverified */
|
||||
MODE_BAD = -2, /* unspecified reason */
|
||||
MODE_ERROR = -1 /* error condition */
|
||||
};
|
||||
|
||||
#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
|
||||
DRM_MODE_TYPE_CRTC_C)
|
||||
|
||||
#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
|
||||
.name = nm, .status = 0, .type = (t), .clock = (c), \
|
||||
.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
|
||||
.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
|
||||
.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
|
||||
.vscan = (vs), .flags = (f), .vrefresh = 0
|
||||
|
||||
#define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
|
||||
|
||||
struct drm_display_mode {
|
||||
/* Header */
|
||||
// struct list_head head;
|
||||
struct drm_mode_object base;
|
||||
|
||||
char name[DRM_DISPLAY_MODE_LEN];
|
||||
|
||||
int connector_count;
|
||||
enum drm_mode_status status;
|
||||
int type;
|
||||
|
||||
/* Proposed mode values */
|
||||
int clock;
|
||||
int hdisplay;
|
||||
int hsync_start;
|
||||
int hsync_end;
|
||||
int htotal;
|
||||
int hskew;
|
||||
int vdisplay;
|
||||
int vsync_start;
|
||||
int vsync_end;
|
||||
int vtotal;
|
||||
int vscan;
|
||||
unsigned int flags;
|
||||
|
||||
/* Addressable image size (may be 0 for projectors, etc.) */
|
||||
int width_mm;
|
||||
int height_mm;
|
||||
|
||||
/* Actual mode we give to hw */
|
||||
int clock_index;
|
||||
int synth_clock;
|
||||
int crtc_hdisplay;
|
||||
int crtc_hblank_start;
|
||||
int crtc_hblank_end;
|
||||
int crtc_hsync_start;
|
||||
int crtc_hsync_end;
|
||||
int crtc_htotal;
|
||||
int crtc_hskew;
|
||||
int crtc_vdisplay;
|
||||
int crtc_vblank_start;
|
||||
int crtc_vblank_end;
|
||||
int crtc_vsync_start;
|
||||
int crtc_vsync_end;
|
||||
int crtc_vtotal;
|
||||
int crtc_hadjusted;
|
||||
int crtc_vadjusted;
|
||||
|
||||
/* Driver private mode info */
|
||||
int private_size;
|
||||
int *private;
|
||||
int private_flags;
|
||||
|
||||
int vrefresh;
|
||||
float hsync;
|
||||
};
|
||||
|
||||
enum drm_connector_status {
|
||||
connector_status_connected = 1,
|
||||
connector_status_disconnected = 2,
|
||||
connector_status_unknown = 3,
|
||||
};
|
||||
|
||||
enum subpixel_order {
|
||||
SubPixelUnknown = 0,
|
||||
SubPixelHorizontalRGB,
|
||||
SubPixelHorizontalBGR,
|
||||
SubPixelVerticalRGB,
|
||||
SubPixelVerticalBGR,
|
||||
SubPixelNone,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Describes a given display (e.g. CRT or flat panel) and its limitations.
|
||||
*/
|
||||
struct drm_display_info {
|
||||
char name[DRM_DISPLAY_INFO_LEN];
|
||||
/* Input info */
|
||||
bool serration_vsync;
|
||||
bool sync_on_green;
|
||||
bool composite_sync;
|
||||
bool separate_syncs;
|
||||
bool blank_to_black;
|
||||
unsigned char video_level;
|
||||
bool digital;
|
||||
/* Physical size */
|
||||
unsigned int width_mm;
|
||||
unsigned int height_mm;
|
||||
|
||||
/* Display parameters */
|
||||
unsigned char gamma; /* FIXME: storage format */
|
||||
bool gtf_supported;
|
||||
bool standard_color;
|
||||
enum {
|
||||
monochrome = 0,
|
||||
rgb,
|
||||
other,
|
||||
unknown,
|
||||
} display_type;
|
||||
bool active_off_supported;
|
||||
bool suspend_supported;
|
||||
bool standby_supported;
|
||||
|
||||
/* Color info FIXME: storage format */
|
||||
unsigned short redx, redy;
|
||||
unsigned short greenx, greeny;
|
||||
unsigned short bluex, bluey;
|
||||
unsigned short whitex, whitey;
|
||||
|
||||
/* Clock limits FIXME: storage format */
|
||||
unsigned int min_vfreq, max_vfreq;
|
||||
unsigned int min_hfreq, max_hfreq;
|
||||
unsigned int pixel_clock;
|
||||
|
||||
/* White point indices FIXME: storage format */
|
||||
unsigned int wpx1, wpy1;
|
||||
unsigned int wpgamma1;
|
||||
unsigned int wpx2, wpy2;
|
||||
unsigned int wpgamma2;
|
||||
|
||||
enum subpixel_order subpixel_order;
|
||||
|
||||
char *raw_edid; /* if any */
|
||||
};
|
||||
|
||||
struct drm_framebuffer_funcs {
|
||||
void (*destroy)(struct drm_framebuffer *framebuffer);
|
||||
int (*create_handle)(struct drm_framebuffer *fb,
|
||||
struct drm_file *file_priv,
|
||||
unsigned int *handle);
|
||||
};
|
||||
|
||||
struct drm_framebuffer {
|
||||
struct drm_device *dev;
|
||||
// struct list_head head;
|
||||
struct drm_mode_object base;
|
||||
const struct drm_framebuffer_funcs *funcs;
|
||||
unsigned int pitch;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
/* depth can be 15 or 16 */
|
||||
unsigned int depth;
|
||||
int bits_per_pixel;
|
||||
int flags;
|
||||
void *fbdev;
|
||||
u32_t pseudo_palette[17];
|
||||
// struct list_head filp_head;
|
||||
};
|
||||
|
||||
struct drm_property_blob {
|
||||
struct drm_mode_object base;
|
||||
// struct list_head head;
|
||||
unsigned int length;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct drm_property_enum {
|
||||
uint64_t value;
|
||||
// struct list_head head;
|
||||
char name[DRM_PROP_NAME_LEN];
|
||||
};
|
||||
|
||||
struct drm_property {
|
||||
// struct list_head head;
|
||||
struct drm_mode_object base;
|
||||
uint32_t flags;
|
||||
char name[DRM_PROP_NAME_LEN];
|
||||
uint32_t num_values;
|
||||
uint64_t *values;
|
||||
|
||||
// struct list_head enum_blob_list;
|
||||
};
|
||||
|
||||
struct drm_crtc;
|
||||
struct drm_connector;
|
||||
struct drm_encoder;
|
||||
|
||||
/**
|
||||
* drm_crtc_funcs - control CRTCs for a given device
|
||||
* @dpms: control display power levels
|
||||
* @save: save CRTC state
|
||||
* @resore: restore CRTC state
|
||||
* @lock: lock the CRTC
|
||||
* @unlock: unlock the CRTC
|
||||
* @shadow_allocate: allocate shadow pixmap
|
||||
* @shadow_create: create shadow pixmap for rotation support
|
||||
* @shadow_destroy: free shadow pixmap
|
||||
* @mode_fixup: fixup proposed mode
|
||||
* @mode_set: set the desired mode on the CRTC
|
||||
* @gamma_set: specify color ramp for CRTC
|
||||
* @destroy: deinit and free object.
|
||||
*
|
||||
* The drm_crtc_funcs structure is the central CRTC management structure
|
||||
* in the DRM. Each CRTC controls one or more connectors (note that the name
|
||||
* CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
|
||||
* connectors, not just CRTs).
|
||||
*
|
||||
* Each driver is responsible for filling out this structure at startup time,
|
||||
* in addition to providing other modesetting features, like i2c and DDC
|
||||
* bus accessors.
|
||||
*/
|
||||
struct drm_crtc_funcs {
|
||||
/* Save CRTC state */
|
||||
void (*save)(struct drm_crtc *crtc); /* suspend? */
|
||||
/* Restore CRTC state */
|
||||
void (*restore)(struct drm_crtc *crtc); /* resume? */
|
||||
|
||||
/* cursor controls */
|
||||
int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
|
||||
uint32_t handle, uint32_t width, uint32_t height);
|
||||
int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
|
||||
|
||||
/* Set gamma on the CRTC */
|
||||
void (*gamma_set)(struct drm_crtc *crtc, u16_t *r, u16_t *g, u16_t *b,
|
||||
uint32_t size);
|
||||
/* Object destroy routine */
|
||||
void (*destroy)(struct drm_crtc *crtc);
|
||||
|
||||
int (*set_config)(struct drm_mode_set *set);
|
||||
};
|
||||
|
||||
/**
|
||||
* drm_crtc - central CRTC control structure
|
||||
* @enabled: is this CRTC enabled?
|
||||
* @x: x position on screen
|
||||
* @y: y position on screen
|
||||
* @desired_mode: new desired mode
|
||||
* @desired_x: desired x for desired_mode
|
||||
* @desired_y: desired y for desired_mode
|
||||
* @funcs: CRTC control functions
|
||||
*
|
||||
* Each CRTC may have one or more connectors associated with it. This structure
|
||||
* allows the CRTC to be controlled.
|
||||
*/
|
||||
struct drm_crtc {
|
||||
struct drm_device *dev;
|
||||
// struct list_head head;
|
||||
|
||||
struct drm_mode_object base;
|
||||
|
||||
/* framebuffer the connector is currently bound to */
|
||||
struct drm_framebuffer *fb;
|
||||
|
||||
bool enabled;
|
||||
|
||||
struct drm_display_mode mode;
|
||||
|
||||
int x, y;
|
||||
struct drm_display_mode *desired_mode;
|
||||
int desired_x, desired_y;
|
||||
const struct drm_crtc_funcs *funcs;
|
||||
|
||||
/* CRTC gamma size for reporting to userspace */
|
||||
uint32_t gamma_size;
|
||||
uint16_t *gamma_store;
|
||||
|
||||
/* if you are using the helper */
|
||||
void *helper_private;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* drm_connector_funcs - control connectors on a given device
|
||||
* @dpms: set power state (see drm_crtc_funcs above)
|
||||
* @save: save connector state
|
||||
* @restore: restore connector state
|
||||
* @mode_valid: is this mode valid on the given connector?
|
||||
* @mode_fixup: try to fixup proposed mode for this connector
|
||||
* @mode_set: set this mode
|
||||
* @detect: is this connector active?
|
||||
* @get_modes: get mode list for this connector
|
||||
* @set_property: property for this connector may need update
|
||||
* @destroy: make object go away
|
||||
*
|
||||
* Each CRTC may have one or more connectors attached to it. The functions
|
||||
* below allow the core DRM code to control connectors, enumerate available modes,
|
||||
* etc.
|
||||
*/
|
||||
struct drm_connector_funcs {
|
||||
void (*dpms)(struct drm_connector *connector, int mode);
|
||||
void (*save)(struct drm_connector *connector);
|
||||
void (*restore)(struct drm_connector *connector);
|
||||
enum drm_connector_status (*detect)(struct drm_connector *connector);
|
||||
int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
|
||||
int (*set_property)(struct drm_connector *connector, struct drm_property *property,
|
||||
uint64_t val);
|
||||
void (*destroy)(struct drm_connector *connector);
|
||||
};
|
||||
|
||||
struct drm_encoder_funcs {
|
||||
void (*destroy)(struct drm_encoder *encoder);
|
||||
};
|
||||
|
||||
#define DRM_CONNECTOR_MAX_UMODES 16
|
||||
#define DRM_CONNECTOR_MAX_PROPERTY 16
|
||||
#define DRM_CONNECTOR_LEN 32
|
||||
#define DRM_CONNECTOR_MAX_ENCODER 2
|
||||
|
||||
/**
|
||||
* drm_encoder - central DRM encoder structure
|
||||
*/
|
||||
struct drm_encoder {
|
||||
struct drm_device *dev;
|
||||
// struct list_head head;
|
||||
|
||||
struct drm_mode_object base;
|
||||
int encoder_type;
|
||||
uint32_t possible_crtcs;
|
||||
uint32_t possible_clones;
|
||||
|
||||
struct drm_crtc *crtc;
|
||||
const struct drm_encoder_funcs *funcs;
|
||||
void *helper_private;
|
||||
};
|
||||
|
||||
/**
|
||||
* drm_connector - central DRM connector control structure
|
||||
* @crtc: CRTC this connector is currently connected to, NULL if none
|
||||
* @interlace_allowed: can this connector handle interlaced modes?
|
||||
* @doublescan_allowed: can this connector handle doublescan?
|
||||
* @available_modes: modes available on this connector (from get_modes() + user)
|
||||
* @initial_x: initial x position for this connector
|
||||
* @initial_y: initial y position for this connector
|
||||
* @status: connector connected?
|
||||
* @funcs: connector control functions
|
||||
*
|
||||
* Each connector may be connected to one or more CRTCs, or may be clonable by
|
||||
* another connector if they can share a CRTC. Each connector also has a specific
|
||||
* position in the broader display (referred to as a 'screen' though it could
|
||||
* span multiple monitors).
|
||||
*/
|
||||
struct drm_connector {
|
||||
struct drm_device *dev;
|
||||
// struct device kdev;
|
||||
struct device_attribute *attr;
|
||||
// struct list_head head;
|
||||
|
||||
struct drm_mode_object base;
|
||||
|
||||
int connector_type;
|
||||
int connector_type_id;
|
||||
bool interlace_allowed;
|
||||
bool doublescan_allowed;
|
||||
// struct list_head modes; /* list of modes on this connector */
|
||||
|
||||
int initial_x, initial_y;
|
||||
enum drm_connector_status status;
|
||||
|
||||
/* these are modes added by probing with DDC or the BIOS */
|
||||
// struct list_head probed_modes;
|
||||
|
||||
struct drm_display_info display_info;
|
||||
const struct drm_connector_funcs *funcs;
|
||||
|
||||
// struct list_head user_modes;
|
||||
struct drm_property_blob *edid_blob_ptr;
|
||||
u32_t property_ids[DRM_CONNECTOR_MAX_PROPERTY];
|
||||
uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
|
||||
|
||||
/* requested DPMS state */
|
||||
int dpms;
|
||||
|
||||
void *helper_private;
|
||||
|
||||
uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
|
||||
uint32_t force_encoder_id;
|
||||
struct drm_encoder *encoder; /* currently active encoder */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_mode_set
|
||||
*
|
||||
* Represents a single crtc the connectors that it drives with what mode
|
||||
* and from which framebuffer it scans out from.
|
||||
*
|
||||
* This is used to set modes.
|
||||
*/
|
||||
struct drm_mode_set {
|
||||
// struct list_head head;
|
||||
|
||||
struct drm_framebuffer *fb;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_display_mode *mode;
|
||||
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
struct drm_connector **connectors;
|
||||
size_t num_connectors;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_mode_config_funcs - configure CRTCs for a given screen layout
|
||||
* @resize: adjust CRTCs as necessary for the proposed layout
|
||||
*
|
||||
* Currently only a resize hook is available. DRM will call back into the
|
||||
* driver with a new screen width and height. If the driver can't support
|
||||
* the proposed size, it can return false. Otherwise it should adjust
|
||||
* the CRTC<->connector mappings as needed and update its view of the screen.
|
||||
*/
|
||||
struct drm_mode_config_funcs {
|
||||
struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd);
|
||||
int (*fb_changed)(struct drm_device *dev);
|
||||
};
|
||||
|
||||
struct drm_mode_group {
|
||||
uint32_t num_crtcs;
|
||||
uint32_t num_encoders;
|
||||
uint32_t num_connectors;
|
||||
|
||||
/* list of object IDs for this group */
|
||||
uint32_t *id_list;
|
||||
};
|
||||
|
||||
/**
|
||||
* drm_mode_config - Mode configuration control structure
|
||||
*
|
||||
*/
|
||||
struct drm_mode_config {
|
||||
// struct mutex mutex; /* protects configuration (mode lists etc.) */
|
||||
// struct mutex idr_mutex; /* for IDR management */
|
||||
// struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
|
||||
/* this is limited to one for now */
|
||||
int num_fb;
|
||||
// struct list_head fb_list;
|
||||
int num_connector;
|
||||
// struct list_head connector_list;
|
||||
int num_encoder;
|
||||
// struct list_head encoder_list;
|
||||
|
||||
int num_crtc;
|
||||
// struct list_head crtc_list;
|
||||
|
||||
// struct list_head property_list;
|
||||
|
||||
/* in-kernel framebuffers - hung of filp_head in drm_framebuffer */
|
||||
// struct list_head fb_kernel_list;
|
||||
|
||||
int min_width, min_height;
|
||||
int max_width, max_height;
|
||||
struct drm_mode_config_funcs *funcs;
|
||||
resource_size_t fb_base;
|
||||
|
||||
/* pointers to standard properties */
|
||||
// struct list_head property_blob_list;
|
||||
struct drm_property *edid_property;
|
||||
struct drm_property *dpms_property;
|
||||
|
||||
/* DVI-I properties */
|
||||
struct drm_property *dvi_i_subconnector_property;
|
||||
struct drm_property *dvi_i_select_subconnector_property;
|
||||
|
||||
/* TV properties */
|
||||
struct drm_property *tv_subconnector_property;
|
||||
struct drm_property *tv_select_subconnector_property;
|
||||
struct drm_property *tv_mode_property;
|
||||
struct drm_property *tv_left_margin_property;
|
||||
struct drm_property *tv_right_margin_property;
|
||||
struct drm_property *tv_top_margin_property;
|
||||
struct drm_property *tv_bottom_margin_property;
|
||||
|
||||
/* Optional properties */
|
||||
struct drm_property *scaling_mode_property;
|
||||
struct drm_property *dithering_mode_property;
|
||||
};
|
||||
|
||||
#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
|
||||
#define obj_to_connector(x) container_of(x, struct drm_connector, base)
|
||||
#define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
|
||||
#define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
|
||||
#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
|
||||
#define obj_to_property(x) container_of(x, struct drm_property, base)
|
||||
#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
|
||||
|
||||
|
||||
extern void drm_crtc_init(struct drm_device *dev,
|
||||
struct drm_crtc *crtc,
|
||||
const struct drm_crtc_funcs *funcs);
|
||||
extern void drm_crtc_cleanup(struct drm_crtc *crtc);
|
||||
|
||||
extern void drm_connector_init(struct drm_device *dev,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_connector_funcs *funcs,
|
||||
int connector_type);
|
||||
|
||||
extern void drm_connector_cleanup(struct drm_connector *connector);
|
||||
|
||||
extern void drm_encoder_init(struct drm_device *dev,
|
||||
struct drm_encoder *encoder,
|
||||
const struct drm_encoder_funcs *funcs,
|
||||
int encoder_type);
|
||||
|
||||
extern void drm_encoder_cleanup(struct drm_encoder *encoder);
|
||||
|
||||
extern char *drm_get_connector_name(struct drm_connector *connector);
|
||||
extern char *drm_get_dpms_name(int val);
|
||||
extern char *drm_get_dvi_i_subconnector_name(int val);
|
||||
extern char *drm_get_dvi_i_select_name(int val);
|
||||
extern char *drm_get_tv_subconnector_name(int val);
|
||||
extern char *drm_get_tv_select_name(int val);
|
||||
extern void drm_fb_release(struct drm_file *file_priv);
|
||||
extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
|
||||
//extern struct edid *drm_get_edid(struct drm_connector *connector,
|
||||
// struct i2c_adapter *adapter);
|
||||
//extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
|
||||
// unsigned char *buf, int len);
|
||||
//extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
|
||||
extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
|
||||
extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
|
||||
extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
|
||||
struct drm_display_mode *mode);
|
||||
extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
|
||||
extern void drm_mode_config_init(struct drm_device *dev);
|
||||
extern void drm_mode_config_cleanup(struct drm_device *dev);
|
||||
extern void drm_mode_set_name(struct drm_display_mode *mode);
|
||||
extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
|
||||
extern int drm_mode_width(struct drm_display_mode *mode);
|
||||
extern int drm_mode_height(struct drm_display_mode *mode);
|
||||
|
||||
/* for us by fb module */
|
||||
extern int drm_mode_attachmode_crtc(struct drm_device *dev,
|
||||
struct drm_crtc *crtc,
|
||||
struct drm_display_mode *mode);
|
||||
extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
|
||||
|
||||
extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
|
||||
extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
|
||||
//extern void drm_mode_list_concat(struct list_head *head,
|
||||
// struct list_head *new);
|
||||
//extern void drm_mode_validate_size(struct drm_device *dev,
|
||||
// struct list_head *mode_list,
|
||||
// int maxX, int maxY, int maxPitch);
|
||||
//extern void drm_mode_prune_invalid(struct drm_device *dev,
|
||||
// struct list_head *mode_list, bool verbose);
|
||||
//extern void drm_mode_sort(struct list_head *mode_list);
|
||||
extern int drm_mode_vrefresh(struct drm_display_mode *mode);
|
||||
extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
|
||||
int adjust_flags);
|
||||
extern void drm_mode_connector_list_update(struct drm_connector *connector);
|
||||
//extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
|
||||
// struct edid *edid);
|
||||
extern int drm_connector_property_set_value(struct drm_connector *connector,
|
||||
struct drm_property *property,
|
||||
uint64_t value);
|
||||
extern int drm_connector_property_get_value(struct drm_connector *connector,
|
||||
struct drm_property *property,
|
||||
uint64_t *value);
|
||||
extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
|
||||
extern void drm_framebuffer_set_object(struct drm_device *dev,
|
||||
unsigned long handle);
|
||||
extern int drm_framebuffer_init(struct drm_device *dev,
|
||||
struct drm_framebuffer *fb,
|
||||
const struct drm_framebuffer_funcs *funcs);
|
||||
extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
|
||||
extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
|
||||
extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
|
||||
extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
|
||||
extern bool drm_crtc_in_use(struct drm_crtc *crtc);
|
||||
|
||||
extern int drm_connector_attach_property(struct drm_connector *connector,
|
||||
struct drm_property *property, uint64_t init_val);
|
||||
extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
|
||||
const char *name, int num_values);
|
||||
extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
|
||||
extern int drm_property_add_enum(struct drm_property *property, int index,
|
||||
uint64_t value, const char *name);
|
||||
extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
|
||||
extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
|
||||
char *formats[]);
|
||||
extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
|
||||
extern int drm_mode_create_dithering_property(struct drm_device *dev);
|
||||
extern char *drm_get_encoder_name(struct drm_encoder *encoder);
|
||||
|
||||
extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
|
||||
struct drm_encoder *encoder);
|
||||
extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
|
||||
struct drm_encoder *encoder);
|
||||
extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
|
||||
int gamma_size);
|
||||
extern void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type);
|
||||
/* IOCTLs */
|
||||
extern int drm_mode_getresources(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
|
||||
extern int drm_mode_getcrtc(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_getconnector(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_setcrtc(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_cursor_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_addfb(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_rmfb(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_getfb(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_addmode_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_attachmode_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_detachmode_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
|
||||
extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_getblob_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_hotplug_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_replacefb(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_getencoder(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
|
||||
void *data, struct drm_file *file_priv);
|
||||
//extern bool drm_detect_hdmi_monitor(struct edid *edid);
|
||||
#endif /* __DRM_CRTC_H__ */
|
268
drivers/video/drm/include/drm_mode.h
Normal file
268
drivers/video/drm/include/drm_mode.h
Normal file
@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
|
||||
* Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
|
||||
* Copyright (c) 2008 Red Hat Inc.
|
||||
* Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
|
||||
* Copyright (c) 2007-2008 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _DRM_MODE_H
|
||||
#define _DRM_MODE_H
|
||||
|
||||
//#include <linux/kernel.h>
|
||||
//#include <linux/types.h>
|
||||
|
||||
#define DRM_DISPLAY_INFO_LEN 32
|
||||
#define DRM_CONNECTOR_NAME_LEN 32
|
||||
#define DRM_DISPLAY_MODE_LEN 32
|
||||
#define DRM_PROP_NAME_LEN 32
|
||||
|
||||
#define DRM_MODE_TYPE_BUILTIN (1<<0)
|
||||
#define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN)
|
||||
#define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN)
|
||||
#define DRM_MODE_TYPE_PREFERRED (1<<3)
|
||||
#define DRM_MODE_TYPE_DEFAULT (1<<4)
|
||||
#define DRM_MODE_TYPE_USERDEF (1<<5)
|
||||
#define DRM_MODE_TYPE_DRIVER (1<<6)
|
||||
|
||||
/* Video mode flags */
|
||||
/* bit compatible with the xorg definitions. */
|
||||
#define DRM_MODE_FLAG_PHSYNC (1<<0)
|
||||
#define DRM_MODE_FLAG_NHSYNC (1<<1)
|
||||
#define DRM_MODE_FLAG_PVSYNC (1<<2)
|
||||
#define DRM_MODE_FLAG_NVSYNC (1<<3)
|
||||
#define DRM_MODE_FLAG_INTERLACE (1<<4)
|
||||
#define DRM_MODE_FLAG_DBLSCAN (1<<5)
|
||||
#define DRM_MODE_FLAG_CSYNC (1<<6)
|
||||
#define DRM_MODE_FLAG_PCSYNC (1<<7)
|
||||
#define DRM_MODE_FLAG_NCSYNC (1<<8)
|
||||
#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
|
||||
#define DRM_MODE_FLAG_BCAST (1<<10)
|
||||
#define DRM_MODE_FLAG_PIXMUX (1<<11)
|
||||
#define DRM_MODE_FLAG_DBLCLK (1<<12)
|
||||
#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
|
||||
|
||||
/* DPMS flags */
|
||||
/* bit compatible with the xorg definitions. */
|
||||
#define DRM_MODE_DPMS_ON 0
|
||||
#define DRM_MODE_DPMS_STANDBY 1
|
||||
#define DRM_MODE_DPMS_SUSPEND 2
|
||||
#define DRM_MODE_DPMS_OFF 3
|
||||
|
||||
/* Scaling mode options */
|
||||
#define DRM_MODE_SCALE_NON_GPU 0
|
||||
#define DRM_MODE_SCALE_FULLSCREEN 1
|
||||
#define DRM_MODE_SCALE_NO_SCALE 2
|
||||
#define DRM_MODE_SCALE_ASPECT 3
|
||||
|
||||
/* Dithering mode options */
|
||||
#define DRM_MODE_DITHERING_OFF 0
|
||||
#define DRM_MODE_DITHERING_ON 1
|
||||
|
||||
struct drm_mode_modeinfo {
|
||||
__u32 clock;
|
||||
__u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
|
||||
__u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
|
||||
|
||||
__u32 vrefresh; /* vertical refresh * 1000 */
|
||||
|
||||
__u32 flags;
|
||||
__u32 type;
|
||||
char name[DRM_DISPLAY_MODE_LEN];
|
||||
};
|
||||
|
||||
struct drm_mode_card_res {
|
||||
__u64 fb_id_ptr;
|
||||
__u64 crtc_id_ptr;
|
||||
__u64 connector_id_ptr;
|
||||
__u64 encoder_id_ptr;
|
||||
__u32 count_fbs;
|
||||
__u32 count_crtcs;
|
||||
__u32 count_connectors;
|
||||
__u32 count_encoders;
|
||||
__u32 min_width, max_width;
|
||||
__u32 min_height, max_height;
|
||||
};
|
||||
|
||||
struct drm_mode_crtc {
|
||||
__u64 set_connectors_ptr;
|
||||
__u32 count_connectors;
|
||||
|
||||
__u32 crtc_id; /**< Id */
|
||||
__u32 fb_id; /**< Id of framebuffer */
|
||||
|
||||
__u32 x, y; /**< Position on the frameuffer */
|
||||
|
||||
__u32 gamma_size;
|
||||
__u32 mode_valid;
|
||||
struct drm_mode_modeinfo mode;
|
||||
};
|
||||
|
||||
#define DRM_MODE_ENCODER_NONE 0
|
||||
#define DRM_MODE_ENCODER_DAC 1
|
||||
#define DRM_MODE_ENCODER_TMDS 2
|
||||
#define DRM_MODE_ENCODER_LVDS 3
|
||||
#define DRM_MODE_ENCODER_TVDAC 4
|
||||
|
||||
struct drm_mode_get_encoder {
|
||||
__u32 encoder_id;
|
||||
__u32 encoder_type;
|
||||
|
||||
__u32 crtc_id; /**< Id of crtc */
|
||||
|
||||
__u32 possible_crtcs;
|
||||
__u32 possible_clones;
|
||||
};
|
||||
|
||||
/* This is for connectors with multiple signal types. */
|
||||
/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
|
||||
#define DRM_MODE_SUBCONNECTOR_Automatic 0
|
||||
#define DRM_MODE_SUBCONNECTOR_Unknown 0
|
||||
#define DRM_MODE_SUBCONNECTOR_DVID 3
|
||||
#define DRM_MODE_SUBCONNECTOR_DVIA 4
|
||||
#define DRM_MODE_SUBCONNECTOR_Composite 5
|
||||
#define DRM_MODE_SUBCONNECTOR_SVIDEO 6
|
||||
#define DRM_MODE_SUBCONNECTOR_Component 8
|
||||
|
||||
#define DRM_MODE_CONNECTOR_Unknown 0
|
||||
#define DRM_MODE_CONNECTOR_VGA 1
|
||||
#define DRM_MODE_CONNECTOR_DVII 2
|
||||
#define DRM_MODE_CONNECTOR_DVID 3
|
||||
#define DRM_MODE_CONNECTOR_DVIA 4
|
||||
#define DRM_MODE_CONNECTOR_Composite 5
|
||||
#define DRM_MODE_CONNECTOR_SVIDEO 6
|
||||
#define DRM_MODE_CONNECTOR_LVDS 7
|
||||
#define DRM_MODE_CONNECTOR_Component 8
|
||||
#define DRM_MODE_CONNECTOR_9PinDIN 9
|
||||
#define DRM_MODE_CONNECTOR_DisplayPort 10
|
||||
#define DRM_MODE_CONNECTOR_HDMIA 11
|
||||
#define DRM_MODE_CONNECTOR_HDMIB 12
|
||||
|
||||
struct drm_mode_get_connector {
|
||||
|
||||
__u64 encoders_ptr;
|
||||
__u64 modes_ptr;
|
||||
__u64 props_ptr;
|
||||
__u64 prop_values_ptr;
|
||||
|
||||
__u32 count_modes;
|
||||
__u32 count_props;
|
||||
__u32 count_encoders;
|
||||
|
||||
__u32 encoder_id; /**< Current Encoder */
|
||||
__u32 connector_id; /**< Id */
|
||||
__u32 connector_type;
|
||||
__u32 connector_type_id;
|
||||
|
||||
__u32 connection;
|
||||
__u32 mm_width, mm_height; /**< HxW in millimeters */
|
||||
__u32 subpixel;
|
||||
};
|
||||
|
||||
#define DRM_MODE_PROP_PENDING (1<<0)
|
||||
#define DRM_MODE_PROP_RANGE (1<<1)
|
||||
#define DRM_MODE_PROP_IMMUTABLE (1<<2)
|
||||
#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
|
||||
#define DRM_MODE_PROP_BLOB (1<<4)
|
||||
|
||||
struct drm_mode_property_enum {
|
||||
__u64 value;
|
||||
char name[DRM_PROP_NAME_LEN];
|
||||
};
|
||||
|
||||
struct drm_mode_get_property {
|
||||
__u64 values_ptr; /* values and blob lengths */
|
||||
__u64 enum_blob_ptr; /* enum and blob id ptrs */
|
||||
|
||||
__u32 prop_id;
|
||||
__u32 flags;
|
||||
char name[DRM_PROP_NAME_LEN];
|
||||
|
||||
__u32 count_values;
|
||||
__u32 count_enum_blobs;
|
||||
};
|
||||
|
||||
struct drm_mode_connector_set_property {
|
||||
__u64 value;
|
||||
__u32 prop_id;
|
||||
__u32 connector_id;
|
||||
};
|
||||
|
||||
struct drm_mode_get_blob {
|
||||
__u32 blob_id;
|
||||
__u32 length;
|
||||
__u64 data;
|
||||
};
|
||||
|
||||
struct drm_mode_fb_cmd {
|
||||
__u32 fb_id;
|
||||
__u32 width, height;
|
||||
__u32 pitch;
|
||||
__u32 bpp;
|
||||
__u32 depth;
|
||||
/* driver specific handle */
|
||||
__u32 handle;
|
||||
};
|
||||
|
||||
struct drm_mode_mode_cmd {
|
||||
__u32 connector_id;
|
||||
struct drm_mode_modeinfo mode;
|
||||
};
|
||||
|
||||
#define DRM_MODE_CURSOR_BO (1<<0)
|
||||
#define DRM_MODE_CURSOR_MOVE (1<<1)
|
||||
|
||||
/*
|
||||
* depending on the value in flags diffrent members are used.
|
||||
*
|
||||
* CURSOR_BO uses
|
||||
* crtc
|
||||
* width
|
||||
* height
|
||||
* handle - if 0 turns the cursor of
|
||||
*
|
||||
* CURSOR_MOVE uses
|
||||
* crtc
|
||||
* x
|
||||
* y
|
||||
*/
|
||||
struct drm_mode_cursor {
|
||||
__u32 flags;
|
||||
__u32 crtc_id;
|
||||
__s32 x;
|
||||
__s32 y;
|
||||
__u32 width;
|
||||
__u32 height;
|
||||
/* driver specific handle */
|
||||
__u32 handle;
|
||||
};
|
||||
|
||||
struct drm_mode_crtc_lut {
|
||||
__u32 crtc_id;
|
||||
__u32 gamma_size;
|
||||
|
||||
/* pointers to arrays */
|
||||
__u64 red;
|
||||
__u64 green;
|
||||
__u64 blue;
|
||||
};
|
||||
|
||||
#endif
|
39
drivers/video/drm/include/errno-base.h
Normal file
39
drivers/video/drm/include/errno-base.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef _ASM_GENERIC_ERRNO_BASE_H
|
||||
#define _ASM_GENERIC_ERRNO_BASE_H
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
|
||||
#endif
|
562
drivers/video/drm/include/pci.h
Normal file
562
drivers/video/drm/include/pci.h
Normal file
@ -0,0 +1,562 @@
|
||||
|
||||
#include <types.h>
|
||||
#include <link.h>
|
||||
|
||||
#ifndef __PCI_H__
|
||||
#define __PCI_H__
|
||||
|
||||
#define PCI_ANY_ID (~0)
|
||||
|
||||
|
||||
#define PCI_CLASS_NOT_DEFINED 0x0000
|
||||
#define PCI_CLASS_NOT_DEFINED_VGA 0x0001
|
||||
|
||||
#define PCI_BASE_CLASS_STORAGE 0x01
|
||||
#define PCI_CLASS_STORAGE_SCSI 0x0100
|
||||
#define PCI_CLASS_STORAGE_IDE 0x0101
|
||||
#define PCI_CLASS_STORAGE_FLOPPY 0x0102
|
||||
#define PCI_CLASS_STORAGE_IPI 0x0103
|
||||
#define PCI_CLASS_STORAGE_RAID 0x0104
|
||||
#define PCI_CLASS_STORAGE_SATA 0x0106
|
||||
#define PCI_CLASS_STORAGE_SATA_AHCI 0x010601
|
||||
#define PCI_CLASS_STORAGE_SAS 0x0107
|
||||
#define PCI_CLASS_STORAGE_OTHER 0x0180
|
||||
|
||||
#define PCI_BASE_CLASS_NETWORK 0x02
|
||||
#define PCI_CLASS_NETWORK_ETHERNET 0x0200
|
||||
#define PCI_CLASS_NETWORK_TOKEN_RING 0x0201
|
||||
#define PCI_CLASS_NETWORK_FDDI 0x0202
|
||||
#define PCI_CLASS_NETWORK_ATM 0x0203
|
||||
#define PCI_CLASS_NETWORK_OTHER 0x0280
|
||||
|
||||
#define PCI_BASE_CLASS_DISPLAY 0x03
|
||||
#define PCI_CLASS_DISPLAY_VGA 0x0300
|
||||
#define PCI_CLASS_DISPLAY_XGA 0x0301
|
||||
#define PCI_CLASS_DISPLAY_3D 0x0302
|
||||
#define PCI_CLASS_DISPLAY_OTHER 0x0380
|
||||
|
||||
#define PCI_BASE_CLASS_MULTIMEDIA 0x04
|
||||
#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400
|
||||
#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401
|
||||
#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402
|
||||
#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480
|
||||
|
||||
#define PCI_BASE_CLASS_MEMORY 0x05
|
||||
#define PCI_CLASS_MEMORY_RAM 0x0500
|
||||
#define PCI_CLASS_MEMORY_FLASH 0x0501
|
||||
#define PCI_CLASS_MEMORY_OTHER 0x0580
|
||||
|
||||
#define PCI_BASE_CLASS_BRIDGE 0x06
|
||||
#define PCI_CLASS_BRIDGE_HOST 0x0600
|
||||
#define PCI_CLASS_BRIDGE_ISA 0x0601
|
||||
#define PCI_CLASS_BRIDGE_EISA 0x0602
|
||||
#define PCI_CLASS_BRIDGE_MC 0x0603
|
||||
#define PCI_CLASS_BRIDGE_PCI 0x0604
|
||||
#define PCI_CLASS_BRIDGE_PCMCIA 0x0605
|
||||
#define PCI_CLASS_BRIDGE_NUBUS 0x0606
|
||||
#define PCI_CLASS_BRIDGE_CARDBUS 0x0607
|
||||
#define PCI_CLASS_BRIDGE_RACEWAY 0x0608
|
||||
#define PCI_CLASS_BRIDGE_OTHER 0x0680
|
||||
|
||||
#define PCI_BASE_CLASS_COMMUNICATION 0x07
|
||||
#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700
|
||||
#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701
|
||||
#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702
|
||||
#define PCI_CLASS_COMMUNICATION_MODEM 0x0703
|
||||
#define PCI_CLASS_COMMUNICATION_OTHER 0x0780
|
||||
|
||||
#define PCI_BASE_CLASS_SYSTEM 0x08
|
||||
#define PCI_CLASS_SYSTEM_PIC 0x0800
|
||||
#define PCI_CLASS_SYSTEM_PIC_IOAPIC 0x080010
|
||||
#define PCI_CLASS_SYSTEM_PIC_IOXAPIC 0x080020
|
||||
#define PCI_CLASS_SYSTEM_DMA 0x0801
|
||||
#define PCI_CLASS_SYSTEM_TIMER 0x0802
|
||||
#define PCI_CLASS_SYSTEM_RTC 0x0803
|
||||
#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804
|
||||
#define PCI_CLASS_SYSTEM_SDHCI 0x0805
|
||||
#define PCI_CLASS_SYSTEM_OTHER 0x0880
|
||||
|
||||
#define PCI_BASE_CLASS_INPUT 0x09
|
||||
#define PCI_CLASS_INPUT_KEYBOARD 0x0900
|
||||
#define PCI_CLASS_INPUT_PEN 0x0901
|
||||
#define PCI_CLASS_INPUT_MOUSE 0x0902
|
||||
#define PCI_CLASS_INPUT_SCANNER 0x0903
|
||||
#define PCI_CLASS_INPUT_GAMEPORT 0x0904
|
||||
#define PCI_CLASS_INPUT_OTHER 0x0980
|
||||
|
||||
#define PCI_BASE_CLASS_DOCKING 0x0a
|
||||
#define PCI_CLASS_DOCKING_GENERIC 0x0a00
|
||||
#define PCI_CLASS_DOCKING_OTHER 0x0a80
|
||||
|
||||
#define PCI_BASE_CLASS_PROCESSOR 0x0b
|
||||
#define PCI_CLASS_PROCESSOR_386 0x0b00
|
||||
#define PCI_CLASS_PROCESSOR_486 0x0b01
|
||||
#define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02
|
||||
#define PCI_CLASS_PROCESSOR_ALPHA 0x0b10
|
||||
#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20
|
||||
#define PCI_CLASS_PROCESSOR_MIPS 0x0b30
|
||||
#define PCI_CLASS_PROCESSOR_CO 0x0b40
|
||||
|
||||
#define PCI_BASE_CLASS_SERIAL 0x0c
|
||||
#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00
|
||||
#define PCI_CLASS_SERIAL_FIREWIRE_OHCI 0x0c0010
|
||||
#define PCI_CLASS_SERIAL_ACCESS 0x0c01
|
||||
#define PCI_CLASS_SERIAL_SSA 0x0c02
|
||||
#define PCI_CLASS_SERIAL_USB 0x0c03
|
||||
#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300
|
||||
#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310
|
||||
#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320
|
||||
#define PCI_CLASS_SERIAL_FIBER 0x0c04
|
||||
#define PCI_CLASS_SERIAL_SMBUS 0x0c05
|
||||
|
||||
#define PCI_BASE_CLASS_WIRELESS 0x0d
|
||||
#define PCI_CLASS_WIRELESS_RF_CONTROLLER 0x0d10
|
||||
#define PCI_CLASS_WIRELESS_WHCI 0x0d1010
|
||||
|
||||
#define PCI_BASE_CLASS_INTELLIGENT 0x0e
|
||||
#define PCI_CLASS_INTELLIGENT_I2O 0x0e00
|
||||
|
||||
#define PCI_BASE_CLASS_SATELLITE 0x0f
|
||||
#define PCI_CLASS_SATELLITE_TV 0x0f00
|
||||
#define PCI_CLASS_SATELLITE_AUDIO 0x0f01
|
||||
#define PCI_CLASS_SATELLITE_VOICE 0x0f03
|
||||
#define PCI_CLASS_SATELLITE_DATA 0x0f04
|
||||
|
||||
#define PCI_BASE_CLASS_CRYPT 0x10
|
||||
#define PCI_CLASS_CRYPT_NETWORK 0x1000
|
||||
#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001
|
||||
#define PCI_CLASS_CRYPT_OTHER 0x1080
|
||||
|
||||
#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11
|
||||
#define PCI_CLASS_SP_DPIO 0x1100
|
||||
#define PCI_CLASS_SP_OTHER 0x1180
|
||||
|
||||
#define PCI_CLASS_OTHERS 0xff
|
||||
|
||||
|
||||
/*
|
||||
* Under PCI, each device has 256 bytes of configuration address space,
|
||||
* of which the first 64 bytes are standardized as follows:
|
||||
*/
|
||||
#define PCI_VENDOR_ID 0x000 /* 16 bits */
|
||||
#define PCI_DEVICE_ID 0x002 /* 16 bits */
|
||||
#define PCI_COMMAND 0x004 /* 16 bits */
|
||||
#define PCI_COMMAND_IO 0x001 /* Enable response in I/O space */
|
||||
#define PCI_COMMAND_MEMORY 0x002 /* Enable response in Memory space */
|
||||
#define PCI_COMMAND_MASTER 0x004 /* Enable bus mastering */
|
||||
#define PCI_COMMAND_SPECIAL 0x008 /* Enable response to special cycles */
|
||||
#define PCI_COMMAND_INVALIDATE 0x010 /* Use memory write and invalidate */
|
||||
#define PCI_COMMAND_VGA_PALETTE 0x020 /* Enable palette snooping */
|
||||
#define PCI_COMMAND_PARITY 0x040 /* Enable parity checking */
|
||||
#define PCI_COMMAND_WAIT 0x080 /* Enable address/data stepping */
|
||||
#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
|
||||
#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
|
||||
#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
|
||||
|
||||
#define PCI_STATUS 0x006 /* 16 bits */
|
||||
#define PCI_STATUS_CAP_LIST 0x010 /* Support Capability List */
|
||||
#define PCI_STATUS_66MHZ 0x020 /* Support 66 Mhz PCI 2.1 bus */
|
||||
#define PCI_STATUS_UDF 0x040 /* Support User Definable Features [obsolete] */
|
||||
#define PCI_STATUS_FAST_BACK 0x080 /* Accept fast-back to back */
|
||||
#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
|
||||
#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
|
||||
#define PCI_STATUS_DEVSEL_FAST 0x000
|
||||
#define PCI_STATUS_DEVSEL_MEDIUM 0x200
|
||||
#define PCI_STATUS_DEVSEL_SLOW 0x400
|
||||
#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
|
||||
#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
|
||||
#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
|
||||
#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
|
||||
#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
|
||||
|
||||
#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */
|
||||
#define PCI_REVISION_ID 0x08 /* Revision ID */
|
||||
#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */
|
||||
#define PCI_CLASS_DEVICE 0x0a /* Device class */
|
||||
|
||||
#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */
|
||||
#define PCI_LATENCY_TIMER 0x0d /* 8 bits */
|
||||
#define PCI_HEADER_TYPE 0x0e /* 8 bits */
|
||||
#define PCI_HEADER_TYPE_NORMAL 0
|
||||
#define PCI_HEADER_TYPE_BRIDGE 1
|
||||
#define PCI_HEADER_TYPE_CARDBUS 2
|
||||
|
||||
#define PCI_BIST 0x0f /* 8 bits */
|
||||
#define PCI_BIST_CODE_MASK 0x0f /* Return result */
|
||||
#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */
|
||||
#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */
|
||||
|
||||
/*
|
||||
* Base addresses specify locations in memory or I/O space.
|
||||
* Decoded size can be determined by writing a value of
|
||||
* 0xffffffff to the register, and reading it back. Only
|
||||
* 1 bits are decoded.
|
||||
*/
|
||||
#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */
|
||||
#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */
|
||||
#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
|
||||
#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */
|
||||
#define PCI_BASE_ADDRESS_SPACE_IO 0x01
|
||||
#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
|
||||
#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
|
||||
#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */
|
||||
#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL)
|
||||
#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL)
|
||||
/* bit 1 is reserved if address_space = 1 */
|
||||
|
||||
#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
|
||||
|
||||
/* Header type 0 (normal devices) */
|
||||
#define PCI_CARDBUS_CIS 0x28
|
||||
#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
|
||||
#define PCI_SUBSYSTEM_ID 0x2e
|
||||
#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */
|
||||
#define PCI_ROM_ADDRESS_ENABLE 0x01
|
||||
#define PCI_ROM_ADDRESS_MASK (~0x7ffUL)
|
||||
|
||||
#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
|
||||
#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */
|
||||
|
||||
|
||||
#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40
|
||||
#define PCI_CB_SUBSYSTEM_ID 0x42
|
||||
|
||||
#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
|
||||
#define PCI_CB_CAPABILITY_LIST 0x14
|
||||
/* Capability lists */
|
||||
|
||||
#define PCI_CAP_LIST_ID 0 /* Capability ID */
|
||||
#define PCI_CAP_ID_PM 0x01 /* Power Management */
|
||||
#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
|
||||
#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
|
||||
#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
|
||||
#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
|
||||
#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
|
||||
#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
|
||||
#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
|
||||
#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */
|
||||
#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
|
||||
#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
|
||||
#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
|
||||
#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
|
||||
#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
|
||||
#define PCI_CAP_SIZEOF 4
|
||||
|
||||
|
||||
/* AGP registers */
|
||||
|
||||
#define PCI_AGP_VERSION 2 /* BCD version number */
|
||||
#define PCI_AGP_RFU 3 /* Rest of capability flags */
|
||||
#define PCI_AGP_STATUS 4 /* Status register */
|
||||
#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */
|
||||
#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */
|
||||
#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */
|
||||
#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */
|
||||
#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */
|
||||
#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */
|
||||
#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */
|
||||
#define PCI_AGP_COMMAND 8 /* Control register */
|
||||
#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
|
||||
#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
|
||||
#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
|
||||
#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
|
||||
#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
|
||||
#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
|
||||
#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
|
||||
#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
|
||||
#define PCI_AGP_SIZEOF 12
|
||||
|
||||
|
||||
#define PCI_MAP_REG_START 0x10
|
||||
#define PCI_MAP_REG_END 0x28
|
||||
#define PCI_MAP_ROM_REG 0x30
|
||||
|
||||
#define PCI_MAP_MEMORY 0x00000000
|
||||
#define PCI_MAP_IO 0x00000001
|
||||
|
||||
#define PCI_MAP_MEMORY_TYPE 0x00000007
|
||||
#define PCI_MAP_IO_TYPE 0x00000003
|
||||
|
||||
#define PCI_MAP_MEMORY_TYPE_32BIT 0x00000000
|
||||
#define PCI_MAP_MEMORY_TYPE_32BIT_1M 0x00000002
|
||||
#define PCI_MAP_MEMORY_TYPE_64BIT 0x00000004
|
||||
#define PCI_MAP_MEMORY_TYPE_MASK 0x00000006
|
||||
#define PCI_MAP_MEMORY_CACHABLE 0x00000008
|
||||
#define PCI_MAP_MEMORY_ATTR_MASK 0x0000000e
|
||||
#define PCI_MAP_MEMORY_ADDRESS_MASK 0xfffffff0
|
||||
|
||||
#define PCI_MAP_IO_ATTR_MASK 0x00000003
|
||||
|
||||
|
||||
|
||||
#define PCI_MAP_IS_IO(b) ((b) & PCI_MAP_IO)
|
||||
#define PCI_MAP_IS_MEM(b) (!PCI_MAP_IS_IO(b))
|
||||
|
||||
#define PCI_MAP_IS64BITMEM(b) \
|
||||
(((b) & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_64BIT)
|
||||
|
||||
#define PCIGETMEMORY(b) ((b) & PCI_MAP_MEMORY_ADDRESS_MASK)
|
||||
#define PCIGETMEMORY64HIGH(b) (*((CARD32*)&b + 1))
|
||||
#define PCIGETMEMORY64(b) \
|
||||
(PCIGETMEMORY(b) | ((CARD64)PCIGETMEMORY64HIGH(b) << 32))
|
||||
|
||||
#define PCI_MAP_IO_ADDRESS_MASK 0xfffffffc
|
||||
|
||||
#define PCIGETIO(b) ((b) & PCI_MAP_IO_ADDRESS_MASK)
|
||||
|
||||
#define PCI_MAP_ROM_DECODE_ENABLE 0x00000001
|
||||
#define PCI_MAP_ROM_ADDRESS_MASK 0xfffff800
|
||||
|
||||
#define PCIGETROM(b) ((b) & PCI_MAP_ROM_ADDRESS_MASK)
|
||||
|
||||
|
||||
#ifndef PCI_DOM_MASK
|
||||
# define PCI_DOM_MASK 0x0ffu
|
||||
#endif
|
||||
#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
|
||||
|
||||
#define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \
|
||||
(((d) & 0x00001fu) << 11) | \
|
||||
(((f) & 0x000007u) << 8))
|
||||
|
||||
#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK))
|
||||
#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11)
|
||||
#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
|
||||
#define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00u) >> 8)
|
||||
|
||||
#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
|
||||
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
|
||||
#define PCI_FUNC(devfn) ((devfn) & 0x07)
|
||||
|
||||
|
||||
|
||||
typedef unsigned int PCITAG;
|
||||
|
||||
extern inline PCITAG
|
||||
pciTag(int busnum, int devnum, int funcnum)
|
||||
{
|
||||
return(PCI_MAKE_TAG(busnum,devnum,funcnum));
|
||||
}
|
||||
|
||||
|
||||
struct resource
|
||||
{
|
||||
resource_size_t start;
|
||||
resource_size_t end;
|
||||
// const char *name;
|
||||
unsigned long flags;
|
||||
// struct resource *parent, *sibling, *child;
|
||||
};
|
||||
|
||||
/*
|
||||
* IO resources have these defined flags.
|
||||
*/
|
||||
#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
|
||||
|
||||
#define IORESOURCE_IO 0x00000100 /* Resource type */
|
||||
#define IORESOURCE_MEM 0x00000200
|
||||
#define IORESOURCE_IRQ 0x00000400
|
||||
#define IORESOURCE_DMA 0x00000800
|
||||
|
||||
#define IORESOURCE_PREFETCH 0x00001000 /* No side effects */
|
||||
#define IORESOURCE_READONLY 0x00002000
|
||||
#define IORESOURCE_CACHEABLE 0x00004000
|
||||
#define IORESOURCE_RANGELENGTH 0x00008000
|
||||
#define IORESOURCE_SHADOWABLE 0x00010000
|
||||
#define IORESOURCE_BUS_HAS_VGA 0x00080000
|
||||
|
||||
#define IORESOURCE_DISABLED 0x10000000
|
||||
#define IORESOURCE_UNSET 0x20000000
|
||||
#define IORESOURCE_AUTO 0x40000000
|
||||
#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */
|
||||
|
||||
/* ISA PnP IRQ specific bits (IORESOURCE_BITS) */
|
||||
#define IORESOURCE_IRQ_HIGHEDGE (1<<0)
|
||||
#define IORESOURCE_IRQ_LOWEDGE (1<<1)
|
||||
#define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
|
||||
#define IORESOURCE_IRQ_LOWLEVEL (1<<3)
|
||||
#define IORESOURCE_IRQ_SHAREABLE (1<<4)
|
||||
|
||||
/* ISA PnP DMA specific bits (IORESOURCE_BITS) */
|
||||
#define IORESOURCE_DMA_TYPE_MASK (3<<0)
|
||||
#define IORESOURCE_DMA_8BIT (0<<0)
|
||||
#define IORESOURCE_DMA_8AND16BIT (1<<0)
|
||||
#define IORESOURCE_DMA_16BIT (2<<0)
|
||||
|
||||
#define IORESOURCE_DMA_MASTER (1<<2)
|
||||
#define IORESOURCE_DMA_BYTE (1<<3)
|
||||
#define IORESOURCE_DMA_WORD (1<<4)
|
||||
|
||||
#define IORESOURCE_DMA_SPEED_MASK (3<<6)
|
||||
#define IORESOURCE_DMA_COMPATIBLE (0<<6)
|
||||
#define IORESOURCE_DMA_TYPEA (1<<6)
|
||||
#define IORESOURCE_DMA_TYPEB (2<<6)
|
||||
#define IORESOURCE_DMA_TYPEF (3<<6)
|
||||
|
||||
/* ISA PnP memory I/O specific bits (IORESOURCE_BITS) */
|
||||
#define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */
|
||||
#define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */
|
||||
#define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */
|
||||
#define IORESOURCE_MEM_TYPE_MASK (3<<3)
|
||||
#define IORESOURCE_MEM_8BIT (0<<3)
|
||||
#define IORESOURCE_MEM_16BIT (1<<3)
|
||||
#define IORESOURCE_MEM_8AND16BIT (2<<3)
|
||||
#define IORESOURCE_MEM_32BIT (3<<3)
|
||||
#define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */
|
||||
#define IORESOURCE_MEM_EXPANSIONROM (1<<6)
|
||||
|
||||
/* PCI ROM control bits (IORESOURCE_BITS) */
|
||||
#define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */
|
||||
#define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */
|
||||
#define IORESOURCE_ROM_COPY (1<<2) /* ROM is alloc'd copy, resource field overlaid */
|
||||
#define IORESOURCE_ROM_BIOS_COPY (1<<3) /* ROM is BIOS copy, resource field overlaid */
|
||||
|
||||
/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */
|
||||
#define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */
|
||||
|
||||
|
||||
/*
|
||||
* For PCI devices, the region numbers are assigned this way:
|
||||
*
|
||||
* 0-5 standard PCI regions
|
||||
* 6 expansion ROM
|
||||
* 7-10 bridges: address space assigned to buses behind the bridge
|
||||
*/
|
||||
|
||||
#define PCI_ROM_RESOURCE 6
|
||||
#define PCI_BRIDGE_RESOURCES 7
|
||||
#define PCI_NUM_RESOURCES 11
|
||||
|
||||
#ifndef PCI_BUS_NUM_RESOURCES
|
||||
#define PCI_BUS_NUM_RESOURCES 8
|
||||
#endif
|
||||
|
||||
#define DEVICE_COUNT_RESOURCE 12
|
||||
|
||||
/*
|
||||
* The pci_dev structure is used to describe PCI devices.
|
||||
*/
|
||||
struct pci_dev {
|
||||
// struct list_head bus_list; /* node in per-bus list */
|
||||
// struct pci_bus *bus; /* bus this device is on */
|
||||
// struct pci_bus *subordinate; /* bus this device bridges to */
|
||||
|
||||
// void *sysdata; /* hook for sys-specific extension */
|
||||
// struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */
|
||||
// struct pci_slot *slot; /* Physical slot this device is in */
|
||||
u32_t bus;
|
||||
u32_t devfn; /* encoded device & function index */
|
||||
u16_t vendor;
|
||||
u16_t device;
|
||||
u16_t subsystem_vendor;
|
||||
u16_t subsystem_device;
|
||||
u32_t class; /* 3 bytes: (base,sub,prog-if) */
|
||||
uint8_t revision; /* PCI revision, low byte of class word */
|
||||
uint8_t hdr_type; /* PCI header type (`multi' flag masked out) */
|
||||
uint8_t pcie_type; /* PCI-E device/port type */
|
||||
uint8_t rom_base_reg; /* which config register controls the ROM */
|
||||
uint8_t pin; /* which interrupt pin this device uses */
|
||||
|
||||
// struct pci_driver *driver; /* which driver has allocated this device */
|
||||
uint64_t dma_mask; /* Mask of the bits of bus address this
|
||||
device implements. Normally this is
|
||||
0xffffffff. You only need to change
|
||||
this if your device has broken DMA
|
||||
or supports 64-bit transfers. */
|
||||
|
||||
// struct device_dma_parameters dma_parms;
|
||||
|
||||
// pci_power_t current_state; /* Current operating state. In ACPI-speak,
|
||||
// this is D0-D3, D0 being fully functional,
|
||||
// and D3 being off. */
|
||||
// int pm_cap; /* PM capability offset in the
|
||||
// configuration space */
|
||||
unsigned int pme_support:5; /* Bitmask of states from which PME#
|
||||
can be generated */
|
||||
unsigned int d1_support:1; /* Low power state D1 is supported */
|
||||
unsigned int d2_support:1; /* Low power state D2 is supported */
|
||||
unsigned int no_d1d2:1; /* Only allow D0 and D3 */
|
||||
|
||||
// pci_channel_state_t error_state; /* current connectivity state */
|
||||
// struct device dev; /* Generic device interface */
|
||||
|
||||
// int cfg_size; /* Size of configuration space */
|
||||
|
||||
/*
|
||||
* Instead of touching interrupt line and base address registers
|
||||
* directly, use the values stored here. They might be different!
|
||||
*/
|
||||
unsigned int irq;
|
||||
struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
|
||||
|
||||
/* These fields are used by common fixups */
|
||||
unsigned int transparent:1; /* Transparent PCI bridge */
|
||||
unsigned int multifunction:1;/* Part of multi-function device */
|
||||
/* keep track of device state */
|
||||
unsigned int is_added:1;
|
||||
unsigned int is_busmaster:1; /* device is busmaster */
|
||||
unsigned int no_msi:1; /* device may not use msi */
|
||||
unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
|
||||
unsigned int broken_parity_status:1; /* Device generates false positive parity */
|
||||
unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
|
||||
unsigned int msi_enabled:1;
|
||||
unsigned int msix_enabled:1;
|
||||
unsigned int ari_enabled:1; /* ARI forwarding */
|
||||
unsigned int is_managed:1;
|
||||
unsigned int is_pcie:1;
|
||||
unsigned int state_saved:1;
|
||||
unsigned int is_physfn:1;
|
||||
unsigned int is_virtfn:1;
|
||||
// pci_dev_flags_t dev_flags;
|
||||
// atomic_t enable_cnt; /* pci_enable_device has been called */
|
||||
|
||||
// u32 saved_config_space[16]; /* config space saved at suspend time */
|
||||
// struct hlist_head saved_cap_space;
|
||||
// struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
|
||||
// int rom_attr_enabled; /* has display of the rom attribute been enabled? */
|
||||
// struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
|
||||
// struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
|
||||
};
|
||||
|
||||
#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
|
||||
#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
|
||||
#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
|
||||
#define pci_resource_len(dev,bar) \
|
||||
((pci_resource_start((dev), (bar)) == 0 && \
|
||||
pci_resource_end((dev), (bar)) == \
|
||||
pci_resource_start((dev), (bar))) ? 0 : \
|
||||
\
|
||||
(pci_resource_end((dev), (bar)) - \
|
||||
pci_resource_start((dev), (bar)) + 1))
|
||||
|
||||
struct pci_device_id
|
||||
{
|
||||
u16_t vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
|
||||
u16_t subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
|
||||
u32_t class, class_mask; /* (class,subclass,prog-if) triplet */
|
||||
u32_t driver_data; /* Data private to the driver */
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
link_t link;
|
||||
struct pci_dev pci_dev;
|
||||
}dev_t;
|
||||
|
||||
int enum_pci_devices(void);
|
||||
|
||||
struct pci_device_id*
|
||||
find_pci_device(dev_t* pdev, struct pci_device_id *idlist);
|
||||
|
||||
|
||||
#define pci_name(x) "radeon"
|
||||
|
||||
#endif //__PCI__H__
|
||||
|
||||
|
351
drivers/video/drm/include/syscall.h
Normal file
351
drivers/video/drm/include/syscall.h
Normal file
@ -0,0 +1,351 @@
|
||||
|
||||
#ifndef __SYSCALL_H__
|
||||
#define __SYSCALL_H__
|
||||
|
||||
|
||||
#define OS_BASE 0x80000000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32_t handle;
|
||||
u32_t io_code;
|
||||
void *input;
|
||||
int inp_size;
|
||||
void *output;
|
||||
int out_size;
|
||||
}ioctl_t;
|
||||
|
||||
typedef int (__stdcall *srv_proc_t)(ioctl_t *);
|
||||
|
||||
#define ERR_OK 0
|
||||
#define ERR_PARAM -1
|
||||
|
||||
|
||||
u32_t __stdcall drvEntry(int)__asm__("_drvEntry");
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define STDCALL __attribute__ ((stdcall)) __attribute__ ((dllimport))
|
||||
#define IMPORT __attribute__ ((dllimport))
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define SysMsgBoardStr __SysMsgBoardStr
|
||||
#define PciApi __PciApi
|
||||
//#define RegService __RegService
|
||||
#define CreateObject __CreateObject
|
||||
#define DestroyObject __DestroyObject
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define PG_SW 0x003
|
||||
#define PG_NOCACHE 0x018
|
||||
|
||||
void* STDCALL AllocKernelSpace(size_t size)__asm__("AllocKernelSpace");
|
||||
void* STDCALL KernelAlloc(size_t size)__asm__("KernelAlloc");
|
||||
void* STDCALL KernelFree(void *mem)__asm__("KernelFree");
|
||||
void* STDCALL UserAlloc(size_t size)__asm__("UserAlloc");
|
||||
int STDCALL UserFree(void *mem)__asm__("UserFree");
|
||||
|
||||
addr_t STDCALL AllocPages(count_t count)__asm__("AllocPages");
|
||||
|
||||
void* STDCALL CreateRingBuffer(size_t size, u32_t map)__asm__("CreateRingBuffer");
|
||||
|
||||
u32_t STDCALL RegService(char *name, srv_proc_t proc)__asm__("RegService");
|
||||
|
||||
int STDCALL AttachIntHandler(int irq, void *handler, u32_t access) __asm__("AttachIntHandler");
|
||||
|
||||
|
||||
//void *CreateObject(u32 pid, size_t size);
|
||||
//void *DestroyObject(void *obj);
|
||||
|
||||
addr_t STDCALL MapIoMem(addr_t base, size_t size, u32_t flags)__asm__("MapIoMem");
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void STDCALL SetMouseData(int btn, int x, int y,
|
||||
int z, int h)__asm__("SetMouseData");
|
||||
|
||||
static u32_t PciApi(int cmd);
|
||||
|
||||
u8_t STDCALL PciRead8 (u32_t bus, u32_t devfn, u32_t reg)__asm__("PciRead8");
|
||||
u16_t STDCALL PciRead16(u32_t bus, u32_t devfn, u32_t reg)__asm__("PciRead16");
|
||||
u32_t STDCALL PciRead32(u32_t bus, u32_t devfn, u32_t reg)__asm__("PciRead32");
|
||||
|
||||
u32_t STDCALL PciWrite8 (u32_t bus, u32_t devfn, u32_t reg,u8_t val) __asm__("PciWrite8");
|
||||
u32_t STDCALL PciWrite16(u32_t bus, u32_t devfn, u32_t reg,u16_t val)__asm__("PciWrite16");
|
||||
u32_t STDCALL PciWrite32(u32_t bus, u32_t devfn, u32_t reg,u32_t val)__asm__("PciWrite32");
|
||||
|
||||
#define pciReadByte(tag, reg) \
|
||||
PciRead8(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg))
|
||||
|
||||
#define pciReadWord(tag, reg) \
|
||||
PciRead16(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg))
|
||||
|
||||
#define pciReadLong(tag, reg) \
|
||||
PciRead32(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg))
|
||||
|
||||
#define pciWriteByte(tag, reg, val) \
|
||||
PciWrite8(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg),(val))
|
||||
|
||||
#define pciWriteWord(tag, reg, val) \
|
||||
PciWrite16(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg),(val))
|
||||
|
||||
#define pciWriteLong(tag, reg, val) \
|
||||
PciWrite32(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg),(val))
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int dbg_open(char *path);
|
||||
int dbgprintf(const char* format, ...);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern inline int GetScreenSize()
|
||||
{
|
||||
int retval;
|
||||
|
||||
asm("int $0x40"
|
||||
:"=a"(retval)
|
||||
:"a"(61), "b"(1));
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern inline int GetScreenBpp()
|
||||
{
|
||||
int retval;
|
||||
|
||||
asm("int $0x40"
|
||||
:"=a"(retval)
|
||||
:"a"(61), "b"(2));
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern inline int GetScreenPitch()
|
||||
{
|
||||
int retval;
|
||||
|
||||
asm("int $0x40"
|
||||
:"=a"(retval)
|
||||
:"a"(61), "b"(3));
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern inline u32_t GetPgAddr(void *mem)
|
||||
{
|
||||
u32_t retval;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__GetPgAddr \n\t"
|
||||
:"=eax" (retval)
|
||||
:"a" (mem) );
|
||||
return retval;
|
||||
};
|
||||
|
||||
extern inline void CommitPages(void *mem, u32_t page, u32_t size)
|
||||
{
|
||||
size = (size+4095) & ~4095;
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__CommitPages"
|
||||
::"a" (page), "b"(mem),"c"(size>>12)
|
||||
:"edx" );
|
||||
__asm__ __volatile__ ("":::"eax","ebx","ecx");
|
||||
};
|
||||
|
||||
extern inline void UnmapPages(void *mem, size_t size)
|
||||
{
|
||||
size = (size+4095) & ~4095;
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__UnmapPages"
|
||||
::"a" (mem), "c"(size>>12)
|
||||
:"edx");
|
||||
__asm__ __volatile__ ("":::"eax","ecx");
|
||||
};
|
||||
|
||||
extern inline void usleep(u32_t delay)
|
||||
{
|
||||
if( !delay )
|
||||
delay++;
|
||||
delay*=1000;
|
||||
|
||||
while(delay--)
|
||||
__asm__ __volatile__ (
|
||||
"xorl %%eax, %%eax \n\t"
|
||||
"cpuid \n\t"
|
||||
:::"eax","ebx","ecx","edx");
|
||||
};
|
||||
|
||||
static inline void udelay(u32_t delay)
|
||||
{
|
||||
if(!delay) delay++;
|
||||
delay*=500;
|
||||
|
||||
while(delay--)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"xorl %%eax, %%eax \n\t"
|
||||
"cpuid"
|
||||
:::"eax","ebx","ecx","edx" );
|
||||
}
|
||||
}
|
||||
|
||||
static inline void mdelay(u32_t time)
|
||||
{
|
||||
time /= 10;
|
||||
if(!time) time = 1;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__Delay"
|
||||
::"b" (time));
|
||||
__asm__ __volatile__ (
|
||||
"":::"ebx");
|
||||
|
||||
};
|
||||
|
||||
|
||||
extern inline u32_t __PciApi(int cmd)
|
||||
{
|
||||
u32_t retval;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__PciApi"
|
||||
:"=a" (retval)
|
||||
:"a" (cmd)
|
||||
:"memory");
|
||||
return retval;
|
||||
};
|
||||
|
||||
extern inline void* __CreateObject(u32_t pid, size_t size)
|
||||
{
|
||||
void *retval;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__CreateObject \n\t"
|
||||
:"=a" (retval)
|
||||
:"a" (size),"b"(pid)
|
||||
:"esi","edi", "memory");
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern inline void *__DestroyObject(void *obj)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__DestroyObject"
|
||||
:
|
||||
:"a" (obj)
|
||||
:"ebx","edx","esi","edi", "memory");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
u32 __RegService(char *name, srv_proc_t proc)
|
||||
{
|
||||
u32 retval;
|
||||
|
||||
asm __volatile__
|
||||
(
|
||||
"pushl %%eax \n\t"
|
||||
"pushl %%ebx \n\t"
|
||||
"call *__imp__RegService \n\t"
|
||||
:"=eax" (retval)
|
||||
:"a" (proc), "b" (name)
|
||||
:"memory"
|
||||
);
|
||||
return retval;
|
||||
};
|
||||
*/
|
||||
|
||||
extern inline u32_t safe_cli(void)
|
||||
{
|
||||
u32_t ifl;
|
||||
__asm__ __volatile__ (
|
||||
"pushf\n\t"
|
||||
"popl %0\n\t"
|
||||
"cli\n"
|
||||
: "=r" (ifl));
|
||||
return ifl;
|
||||
}
|
||||
|
||||
extern inline void safe_sti(u32_t ifl)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"pushl %0\n\t"
|
||||
"popf\n"
|
||||
: : "r" (ifl)
|
||||
);
|
||||
}
|
||||
|
||||
extern inline void __clear (void * dst, unsigned len)
|
||||
{
|
||||
u32_t tmp;
|
||||
__asm__ __volatile__ (
|
||||
// "xorl %%eax, %%eax \n\t"
|
||||
"cld \n\t"
|
||||
"rep stosb \n"
|
||||
:"=c"(tmp),"=D"(tmp)
|
||||
:"a"(0),"c"(len),"D"(dst));
|
||||
__asm__ __volatile__ ("":::"ecx","edi");
|
||||
};
|
||||
|
||||
extern inline void out8(const u16_t port, const u8_t val)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
("outb %1, %0\n" : : "dN"(port), "a"(val));
|
||||
}
|
||||
|
||||
extern inline void out16(const u16_t port, const u16_t val)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
("outw %1, %0\n" : : "dN"(port), "a"(val));
|
||||
}
|
||||
|
||||
extern inline void out32(const u16_t port, const u32_t val)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
("outl %1, %0\n" : : "dN"(port), "a"(val));
|
||||
}
|
||||
|
||||
extern inline u8_t in8(const u16_t port)
|
||||
{
|
||||
u8_t tmp;
|
||||
__asm__ __volatile__
|
||||
("inb %1, %0\n" : "=a"(tmp) : "dN"(port));
|
||||
return tmp;
|
||||
};
|
||||
|
||||
extern inline u16_t in16(const u16_t port)
|
||||
{
|
||||
u16_t tmp;
|
||||
__asm__ __volatile__
|
||||
("inw %1, %0\n" : "=a"(tmp) : "dN"(port));
|
||||
return tmp;
|
||||
};
|
||||
|
||||
extern inline u32_t in32(const u16_t port)
|
||||
{
|
||||
u32_t tmp;
|
||||
__asm__ __volatile__
|
||||
("inl %1, %0\n" : "=a"(tmp) : "dN"(port));
|
||||
return tmp;
|
||||
};
|
||||
|
||||
extern inline void delay(int time)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__Delay"
|
||||
::"b" (time));
|
||||
__asm__ __volatile__ (
|
||||
"":::"ebx");
|
||||
|
||||
}
|
||||
|
||||
extern inline void change_task()
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"call *__imp__ChangeTask");
|
||||
}
|
||||
|
||||
int drm_order(unsigned long size);
|
||||
|
||||
#endif
|
199
drivers/video/drm/include/types.h
Normal file
199
drivers/video/drm/include/types.h
Normal file
@ -0,0 +1,199 @@
|
||||
|
||||
#ifndef __TYPES_H__
|
||||
#define __TYPES_H__
|
||||
|
||||
|
||||
typedef int bool;
|
||||
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef unsigned int count_t;
|
||||
typedef unsigned int addr_t;
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
typedef unsigned char __u8;
|
||||
typedef unsigned short __u16;
|
||||
typedef unsigned int __u32;
|
||||
typedef unsigned long long __u64;
|
||||
|
||||
typedef signed char __s8;
|
||||
typedef signed short __s16;
|
||||
typedef signed int __s32;
|
||||
typedef signed long long __s64;
|
||||
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
typedef unsigned char u8_t;
|
||||
typedef unsigned short u16_t;
|
||||
typedef unsigned int u32_t;
|
||||
typedef unsigned long long u64_t;
|
||||
|
||||
#define NULL (void*)0
|
||||
|
||||
typedef uint32_t dma_addr_t;
|
||||
typedef uint32_t resource_size_t;
|
||||
|
||||
#define __user
|
||||
|
||||
#define cpu_to_le16(v16) (v16)
|
||||
#define cpu_to_le32(v32) (v32)
|
||||
#define cpu_to_le64(v64) (v64)
|
||||
#define le16_to_cpu(v16) (v16)
|
||||
#define le32_to_cpu(v32) (v32)
|
||||
#define le64_to_cpu(v64) (v64)
|
||||
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
|
||||
|
||||
|
||||
#define KERN_EMERG "<0>" /* system is unusable */
|
||||
#define KERN_ALERT "<1>" /* action must be taken immediately */
|
||||
#define KERN_CRIT "<2>" /* critical conditions */
|
||||
#define KERN_ERR "<3>" /* error conditions */
|
||||
#define KERN_WARNING "<4>" /* warning conditions */
|
||||
#define KERN_NOTICE "<5>" /* normal but significant condition */
|
||||
#define KERN_INFO "<6>" /* informational */
|
||||
#define KERN_DEBUG "<7>" /* debug-level messages */
|
||||
|
||||
//int printk(const char *fmt, ...);
|
||||
|
||||
#define printk(fmt, arg...) dbgprintf(fmt , ##arg)
|
||||
|
||||
|
||||
#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
|
||||
|
||||
#define DRM_INFO(fmt, arg...) dbgprintf("DRM: "fmt , ##arg)
|
||||
|
||||
#define DRM_DEBUG(fmt, arg...) \
|
||||
printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __func__ , ##arg)
|
||||
|
||||
#define DRM_ERROR(fmt, arg...) \
|
||||
printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __func__ , ##arg)
|
||||
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
|
||||
|
||||
#define __must_be_array(a) \
|
||||
BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef HAVE_ARCH_BUG
|
||||
#define BUG() do { \
|
||||
printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
|
||||
/* panic("BUG!"); */ \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_BUG_ON
|
||||
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define MTRR_TYPE_UNCACHABLE 0
|
||||
#define MTRR_TYPE_WRCOMB 1
|
||||
#define MTRR_TYPE_WRTHROUGH 4
|
||||
#define MTRR_TYPE_WRPROT 5
|
||||
#define MTRR_TYPE_WRBACK 6
|
||||
#define MTRR_NUM_TYPES 7
|
||||
|
||||
int dbgprintf(const char* format, ...);
|
||||
|
||||
#define GFP_KERNEL 0
|
||||
|
||||
//#include <string.h>
|
||||
|
||||
void* memcpy(void *s1, const void *s2, size_t n);
|
||||
void* memset(void *s, int c, size_t n);
|
||||
size_t strlen(const char *s);
|
||||
|
||||
void *malloc(size_t size);
|
||||
|
||||
#define kfree free
|
||||
|
||||
static inline void *kzalloc(size_t size, u32_t flags)
|
||||
{
|
||||
void *ret = malloc(size);
|
||||
memset(ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct drm_gem_object {
|
||||
|
||||
/** Reference count of this object */
|
||||
// struct kref refcount;
|
||||
|
||||
/** Handle count of this object. Each handle also holds a reference */
|
||||
// struct kref handlecount;
|
||||
|
||||
/** Related drm device */
|
||||
// struct drm_device *dev;
|
||||
|
||||
/** File representing the shmem storage */
|
||||
// struct file *filp;
|
||||
|
||||
/* Mapping info for this object */
|
||||
// struct drm_map_list map_list;
|
||||
|
||||
/**
|
||||
* Size of the object, in bytes. Immutable over the object's
|
||||
* lifetime.
|
||||
*/
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* Global name for this object, starts at 1. 0 means unnamed.
|
||||
* Access is covered by the object_name_lock in the related drm_device
|
||||
*/
|
||||
int name;
|
||||
|
||||
/**
|
||||
* Memory domains. These monitor which caches contain read/write data
|
||||
* related to the object. When transitioning from one set of domains
|
||||
* to another, the driver is called to ensure that caches are suitably
|
||||
* flushed and invalidated
|
||||
*/
|
||||
uint32_t read_domains;
|
||||
uint32_t write_domain;
|
||||
|
||||
/**
|
||||
* While validating an exec operation, the
|
||||
* new read/write domain values are computed here.
|
||||
* They will be transferred to the above values
|
||||
* at the point that any cache flushing occurs
|
||||
*/
|
||||
uint32_t pending_read_domains;
|
||||
uint32_t pending_write_domain;
|
||||
|
||||
void *driver_private;
|
||||
};
|
||||
|
||||
struct drm_file;
|
||||
|
||||
#define offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER)
|
||||
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
|
||||
|
||||
|
||||
#define DRM_MEMORYBARRIER() __asm__ __volatile__("lock; addl $0,0(%esp)")
|
||||
|
||||
|
||||
|
||||
#endif //__TYPES_H__
|
578
drivers/video/drm/radeon/ObjectID.h
Normal file
578
drivers/video/drm/radeon/ObjectID.h
Normal file
@ -0,0 +1,578 @@
|
||||
/*
|
||||
* Copyright 2006-2007 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/* based on stg/asic_reg/drivers/inc/asic_reg/ObjectID.h ver 23 */
|
||||
|
||||
#ifndef _OBJECTID_H
|
||||
#define _OBJECTID_H
|
||||
|
||||
#if defined(_X86_)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
/****************************************************/
|
||||
/* Graphics Object Type Definition */
|
||||
/****************************************************/
|
||||
#define GRAPH_OBJECT_TYPE_NONE 0x0
|
||||
#define GRAPH_OBJECT_TYPE_GPU 0x1
|
||||
#define GRAPH_OBJECT_TYPE_ENCODER 0x2
|
||||
#define GRAPH_OBJECT_TYPE_CONNECTOR 0x3
|
||||
#define GRAPH_OBJECT_TYPE_ROUTER 0x4
|
||||
/* deleted */
|
||||
|
||||
/****************************************************/
|
||||
/* Encoder Object ID Definition */
|
||||
/****************************************************/
|
||||
#define ENCODER_OBJECT_ID_NONE 0x00
|
||||
|
||||
/* Radeon Class Display Hardware */
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07
|
||||
|
||||
/* External Third Party Encoders */
|
||||
#define ENCODER_OBJECT_ID_SI170B 0x08
|
||||
#define ENCODER_OBJECT_ID_CH7303 0x09
|
||||
#define ENCODER_OBJECT_ID_CH7301 0x0A
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */
|
||||
#define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C
|
||||
#define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D
|
||||
#define ENCODER_OBJECT_ID_TITFP513 0x0E
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */
|
||||
#define ENCODER_OBJECT_ID_VT1623 0x10
|
||||
#define ENCODER_OBJECT_ID_HDMI_SI1930 0x11
|
||||
#define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12
|
||||
/* Kaleidoscope (KLDSCP) Class Display Hardware (internal) */
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */
|
||||
#define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */
|
||||
#define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19
|
||||
#define ENCODER_OBJECT_ID_VT1625 0x1A
|
||||
#define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B
|
||||
#define ENCODER_OBJECT_ID_DP_AN9801 0x1C
|
||||
#define ENCODER_OBJECT_ID_DP_DP501 0x1D
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY 0x1E
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA 0x1F
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 0x20
|
||||
#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 0x21
|
||||
|
||||
#define ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO 0xFF
|
||||
|
||||
/****************************************************/
|
||||
/* Connector Object ID Definition */
|
||||
/****************************************************/
|
||||
#define CONNECTOR_OBJECT_ID_NONE 0x00
|
||||
#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01
|
||||
#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02
|
||||
#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03
|
||||
#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D 0x04
|
||||
#define CONNECTOR_OBJECT_ID_VGA 0x05
|
||||
#define CONNECTOR_OBJECT_ID_COMPOSITE 0x06
|
||||
#define CONNECTOR_OBJECT_ID_SVIDEO 0x07
|
||||
#define CONNECTOR_OBJECT_ID_YPbPr 0x08
|
||||
#define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09
|
||||
#define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */
|
||||
#define CONNECTOR_OBJECT_ID_SCART 0x0B
|
||||
#define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C
|
||||
#define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D
|
||||
#define CONNECTOR_OBJECT_ID_LVDS 0x0E
|
||||
#define CONNECTOR_OBJECT_ID_7PIN_DIN 0x0F
|
||||
#define CONNECTOR_OBJECT_ID_PCIE_CONNECTOR 0x10
|
||||
#define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11
|
||||
#define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12
|
||||
#define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13
|
||||
|
||||
/* deleted */
|
||||
|
||||
/****************************************************/
|
||||
/* Router Object ID Definition */
|
||||
/****************************************************/
|
||||
#define ROUTER_OBJECT_ID_NONE 0x00
|
||||
#define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01
|
||||
|
||||
/****************************************************/
|
||||
/* Graphics Object ENUM ID Definition */
|
||||
/****************************************************/
|
||||
#define GRAPH_OBJECT_ENUM_ID1 0x01
|
||||
#define GRAPH_OBJECT_ENUM_ID2 0x02
|
||||
#define GRAPH_OBJECT_ENUM_ID3 0x03
|
||||
#define GRAPH_OBJECT_ENUM_ID4 0x04
|
||||
#define GRAPH_OBJECT_ENUM_ID5 0x05
|
||||
#define GRAPH_OBJECT_ENUM_ID6 0x06
|
||||
|
||||
/****************************************************/
|
||||
/* Graphics Object ID Bit definition */
|
||||
/****************************************************/
|
||||
#define OBJECT_ID_MASK 0x00FF
|
||||
#define ENUM_ID_MASK 0x0700
|
||||
#define RESERVED1_ID_MASK 0x0800
|
||||
#define OBJECT_TYPE_MASK 0x7000
|
||||
#define RESERVED2_ID_MASK 0x8000
|
||||
|
||||
#define OBJECT_ID_SHIFT 0x00
|
||||
#define ENUM_ID_SHIFT 0x08
|
||||
#define OBJECT_TYPE_SHIFT 0x0C
|
||||
|
||||
/****************************************************/
|
||||
/* Graphics Object family definition */
|
||||
/****************************************************/
|
||||
#define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) \
|
||||
(GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \
|
||||
GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT)
|
||||
/****************************************************/
|
||||
/* GPU Object ID definition - Shared with BIOS */
|
||||
/****************************************************/
|
||||
#define GPU_ENUM_ID1 (GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT)
|
||||
|
||||
/****************************************************/
|
||||
/* Encoder Object ID definition - Shared with BIOS */
|
||||
/****************************************************/
|
||||
/*
|
||||
#define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101
|
||||
#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102
|
||||
#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103
|
||||
#define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104
|
||||
#define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105
|
||||
#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106
|
||||
#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107
|
||||
#define ENCODER_SIL170B_ENUM_ID1 0x2108
|
||||
#define ENCODER_CH7303_ENUM_ID1 0x2109
|
||||
#define ENCODER_CH7301_ENUM_ID1 0x210A
|
||||
#define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B
|
||||
#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 0x210C
|
||||
#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 0x210D
|
||||
#define ENCODER_TITFP513_ENUM_ID1 0x210E
|
||||
#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 0x210F
|
||||
#define ENCODER_VT1623_ENUM_ID1 0x2110
|
||||
#define ENCODER_HDMI_SI1930_ENUM_ID1 0x2111
|
||||
#define ENCODER_HDMI_INTERNAL_ENUM_ID1 0x2112
|
||||
#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113
|
||||
#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114
|
||||
#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115
|
||||
#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116
|
||||
#define ENCODER_SI178_ENUM_ID1 0x2117
|
||||
#define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118
|
||||
#define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119
|
||||
#define ENCODER_VT1625_ENUM_ID1 0x211A
|
||||
#define ENCODER_HDMI_SI1932_ENUM_ID1 0x211B
|
||||
#define ENCODER_ENCODER_DP_AN9801_ENUM_ID1 0x211C
|
||||
#define ENCODER_DP_DP501_ENUM_ID1 0x211D
|
||||
#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E
|
||||
*/
|
||||
#define ENCODER_INTERNAL_LVDS_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_DAC1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_DAC2_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_SDVOA_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_SIL170B_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_CH7303_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_CH7301_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_DVO1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_TITFP513_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_VT1623_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_HDMI_SI1930_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_HDMI_INTERNAL_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) /* Shared with CV/TV and CRT */
|
||||
|
||||
#define ENCODER_SI178_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_MVPU_FPGA_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_DDI_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_VT1625_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_HDMI_SI1932_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_DP_DP501_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_DP_AN9801_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT)
|
||||
|
||||
#define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT)
|
||||
|
||||
/****************************************************/
|
||||
/* Connector Object ID definition - Shared with BIOS */
|
||||
/****************************************************/
|
||||
/*
|
||||
#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 0x3101
|
||||
#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 0x3102
|
||||
#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 0x3103
|
||||
#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 0x3104
|
||||
#define CONNECTOR_VGA_ENUM_ID1 0x3105
|
||||
#define CONNECTOR_COMPOSITE_ENUM_ID1 0x3106
|
||||
#define CONNECTOR_SVIDEO_ENUM_ID1 0x3107
|
||||
#define CONNECTOR_YPbPr_ENUM_ID1 0x3108
|
||||
#define CONNECTOR_D_CONNECTORE_ENUM_ID1 0x3109
|
||||
#define CONNECTOR_9PIN_DIN_ENUM_ID1 0x310A
|
||||
#define CONNECTOR_SCART_ENUM_ID1 0x310B
|
||||
#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 0x310C
|
||||
#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 0x310D
|
||||
#define CONNECTOR_LVDS_ENUM_ID1 0x310E
|
||||
#define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F
|
||||
#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110
|
||||
*/
|
||||
#define CONNECTOR_LVDS_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_VGA_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_VGA_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_COMPOSITE_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_SVIDEO_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_YPbPr_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_D_CONNECTOR_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_9PIN_DIN_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_SCART_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_7PIN_DIN_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_CROSSFIRE_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_CROSSFIRE_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_HARDCODE_DVI_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_HARDCODE_DVI_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_DISPLAYPORT_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_DISPLAYPORT_ENUM_ID2 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_DISPLAYPORT_ENUM_ID3 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
|
||||
|
||||
#define CONNECTOR_DISPLAYPORT_ENUM_ID4 \
|
||||
(GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\
|
||||
CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
|
||||
|
||||
/****************************************************/
|
||||
/* Router Object ID definition - Shared with BIOS */
|
||||
/****************************************************/
|
||||
#define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 \
|
||||
(GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\
|
||||
GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
|
||||
ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT)
|
||||
|
||||
/* deleted */
|
||||
|
||||
/****************************************************/
|
||||
/* Object Cap definition - Shared with BIOS */
|
||||
/****************************************************/
|
||||
#define GRAPHICS_OBJECT_CAP_I2C 0x00000001L
|
||||
#define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L
|
||||
|
||||
#define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01
|
||||
#define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02
|
||||
#define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03
|
||||
|
||||
#if defined(_X86_)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif /*GRAPHICTYPE */
|
48
drivers/video/drm/radeon/atom-bits.h
Normal file
48
drivers/video/drm/radeon/atom-bits.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author: Stanislaw Skowronek
|
||||
*/
|
||||
|
||||
#ifndef ATOM_BITS_H
|
||||
#define ATOM_BITS_H
|
||||
|
||||
static inline uint8_t get_u8(void *bios, int ptr)
|
||||
{
|
||||
return ((unsigned char *)bios)[ptr];
|
||||
}
|
||||
#define U8(ptr) get_u8(ctx->ctx->bios, (ptr))
|
||||
#define CU8(ptr) get_u8(ctx->bios, (ptr))
|
||||
static inline uint16_t get_u16(void *bios, int ptr)
|
||||
{
|
||||
return get_u8(bios ,ptr)|(((uint16_t)get_u8(bios, ptr+1))<<8);
|
||||
}
|
||||
#define U16(ptr) get_u16(ctx->ctx->bios, (ptr))
|
||||
#define CU16(ptr) get_u16(ctx->bios, (ptr))
|
||||
static inline uint32_t get_u32(void *bios, int ptr)
|
||||
{
|
||||
return get_u16(bios, ptr)|(((uint32_t)get_u16(bios, ptr+2))<<16);
|
||||
}
|
||||
#define U32(ptr) get_u32(ctx->ctx->bios, (ptr))
|
||||
#define CU32(ptr) get_u32(ctx->bios, (ptr))
|
||||
#define CSTR(ptr) (((char *)(ctx->bios))+(ptr))
|
||||
|
||||
#endif
|
100
drivers/video/drm/radeon/atom-names.h
Normal file
100
drivers/video/drm/radeon/atom-names.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author: Stanislaw Skowronek
|
||||
*/
|
||||
|
||||
#ifndef ATOM_NAMES_H
|
||||
#define ATOM_NAMES_H
|
||||
|
||||
#include "atom.h"
|
||||
|
||||
#ifdef ATOM_DEBUG
|
||||
|
||||
#define ATOM_OP_NAMES_CNT 123
|
||||
static char *atom_op_names[ATOM_OP_NAMES_CNT] = {
|
||||
"RESERVED", "MOVE_REG", "MOVE_PS", "MOVE_WS", "MOVE_FB", "MOVE_PLL",
|
||||
"MOVE_MC", "AND_REG", "AND_PS", "AND_WS", "AND_FB", "AND_PLL", "AND_MC",
|
||||
"OR_REG", "OR_PS", "OR_WS", "OR_FB", "OR_PLL", "OR_MC", "SHIFT_LEFT_REG",
|
||||
"SHIFT_LEFT_PS", "SHIFT_LEFT_WS", "SHIFT_LEFT_FB", "SHIFT_LEFT_PLL",
|
||||
"SHIFT_LEFT_MC", "SHIFT_RIGHT_REG", "SHIFT_RIGHT_PS", "SHIFT_RIGHT_WS",
|
||||
"SHIFT_RIGHT_FB", "SHIFT_RIGHT_PLL", "SHIFT_RIGHT_MC", "MUL_REG",
|
||||
"MUL_PS", "MUL_WS", "MUL_FB", "MUL_PLL", "MUL_MC", "DIV_REG", "DIV_PS",
|
||||
"DIV_WS", "DIV_FB", "DIV_PLL", "DIV_MC", "ADD_REG", "ADD_PS", "ADD_WS",
|
||||
"ADD_FB", "ADD_PLL", "ADD_MC", "SUB_REG", "SUB_PS", "SUB_WS", "SUB_FB",
|
||||
"SUB_PLL", "SUB_MC", "SET_ATI_PORT", "SET_PCI_PORT", "SET_SYS_IO_PORT",
|
||||
"SET_REG_BLOCK", "SET_FB_BASE", "COMPARE_REG", "COMPARE_PS",
|
||||
"COMPARE_WS", "COMPARE_FB", "COMPARE_PLL", "COMPARE_MC", "SWITCH",
|
||||
"JUMP", "JUMP_EQUAL", "JUMP_BELOW", "JUMP_ABOVE", "JUMP_BELOW_OR_EQUAL",
|
||||
"JUMP_ABOVE_OR_EQUAL", "JUMP_NOT_EQUAL", "TEST_REG", "TEST_PS", "TEST_WS",
|
||||
"TEST_FB", "TEST_PLL", "TEST_MC", "DELAY_MILLISEC", "DELAY_MICROSEC",
|
||||
"CALL_TABLE", "REPEAT", "CLEAR_REG", "CLEAR_PS", "CLEAR_WS", "CLEAR_FB",
|
||||
"CLEAR_PLL", "CLEAR_MC", "NOP", "EOT", "MASK_REG", "MASK_PS", "MASK_WS",
|
||||
"MASK_FB", "MASK_PLL", "MASK_MC", "POST_CARD", "BEEP", "SAVE_REG",
|
||||
"RESTORE_REG", "SET_DATA_BLOCK", "XOR_REG", "XOR_PS", "XOR_WS", "XOR_FB",
|
||||
"XOR_PLL", "XOR_MC", "SHL_REG", "SHL_PS", "SHL_WS", "SHL_FB", "SHL_PLL",
|
||||
"SHL_MC", "SHR_REG", "SHR_PS", "SHR_WS", "SHR_FB", "SHR_PLL", "SHR_MC",
|
||||
"DEBUG", "CTB_DS",
|
||||
};
|
||||
|
||||
#define ATOM_TABLE_NAMES_CNT 74
|
||||
static char *atom_table_names[ATOM_TABLE_NAMES_CNT] = {
|
||||
"ASIC_Init", "GetDisplaySurfaceSize", "ASIC_RegistersInit",
|
||||
"VRAM_BlockVenderDetection", "SetClocksRatio", "MemoryControllerInit",
|
||||
"GPIO_PinInit", "MemoryParamAdjust", "DVOEncoderControl",
|
||||
"GPIOPinControl", "SetEngineClock", "SetMemoryClock", "SetPixelClock",
|
||||
"DynamicClockGating", "ResetMemoryDLL", "ResetMemoryDevice",
|
||||
"MemoryPLLInit", "EnableMemorySelfRefresh", "AdjustMemoryController",
|
||||
"EnableASIC_StaticPwrMgt", "ASIC_StaticPwrMgtStatusChange",
|
||||
"DAC_LoadDetection", "TMDS2EncoderControl", "LCD1OutputControl",
|
||||
"DAC1EncoderControl", "DAC2EncoderControl", "DVOOutputControl",
|
||||
"CV1OutputControl", "SetCRTC_DPM_State", "TVEncoderControl",
|
||||
"TMDS1EncoderControl", "LVDSEncoderControl", "TV1OutputControl",
|
||||
"EnableScaler", "BlankCRTC", "EnableCRTC", "GetPixelClock",
|
||||
"EnableVGA_Render", "EnableVGA_Access", "SetCRTC_Timing",
|
||||
"SetCRTC_OverScan", "SetCRTC_Replication", "SelectCRTC_Source",
|
||||
"EnableGraphSurfaces", "UpdateCRTC_DoubleBufferRegisters",
|
||||
"LUT_AutoFill", "EnableHW_IconCursor", "GetMemoryClock",
|
||||
"GetEngineClock", "SetCRTC_UsingDTDTiming", "TVBootUpStdPinDetection",
|
||||
"DFP2OutputControl", "VRAM_BlockDetectionByStrap", "MemoryCleanUp",
|
||||
"ReadEDIDFromHWAssistedI2C", "WriteOneByteToHWAssistedI2C",
|
||||
"ReadHWAssistedI2CStatus", "SpeedFanControl", "PowerConnectorDetection",
|
||||
"MC_Synchronization", "ComputeMemoryEnginePLL", "MemoryRefreshConversion",
|
||||
"VRAM_GetCurrentInfoBlock", "DynamicMemorySettings", "MemoryTraining",
|
||||
"EnableLVDS_SS", "DFP1OutputControl", "SetVoltage", "CRT1OutputControl",
|
||||
"CRT2OutputControl", "SetupHWAssistedI2CStatus", "ClockSource",
|
||||
"MemoryDeviceInit", "EnableYUV",
|
||||
};
|
||||
|
||||
#define ATOM_IO_NAMES_CNT 5
|
||||
static char *atom_io_names[ATOM_IO_NAMES_CNT] = {
|
||||
"MM", "PLL", "MC", "PCIE", "PCIE PORT",
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#define ATOM_OP_NAMES_CNT 0
|
||||
#define ATOM_TABLE_NAMES_CNT 0
|
||||
#define ATOM_IO_NAMES_CNT 0
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
42
drivers/video/drm/radeon/atom-types.h
Normal file
42
drivers/video/drm/radeon/atom-types.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author: Dave Airlie
|
||||
*/
|
||||
|
||||
#ifndef ATOM_TYPES_H
|
||||
#define ATOM_TYPES_H
|
||||
|
||||
/* sync atom types to kernel types */
|
||||
|
||||
typedef uint16_t USHORT;
|
||||
typedef uint32_t ULONG;
|
||||
typedef uint8_t UCHAR;
|
||||
|
||||
|
||||
#ifndef ATOM_BIG_ENDIAN
|
||||
#if defined(__BIG_ENDIAN)
|
||||
#define ATOM_BIG_ENDIAN 1
|
||||
#else
|
||||
#define ATOM_BIG_ENDIAN 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
1220
drivers/video/drm/radeon/atom.c
Normal file
1220
drivers/video/drm/radeon/atom.c
Normal file
File diff suppressed because it is too large
Load Diff
149
drivers/video/drm/radeon/atom.h
Normal file
149
drivers/video/drm/radeon/atom.h
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author: Stanislaw Skowronek
|
||||
*/
|
||||
|
||||
#ifndef ATOM_H
|
||||
#define ATOM_H
|
||||
|
||||
#include <types.h>
|
||||
//#include "drmP.h"
|
||||
|
||||
#define ATOM_BIOS_MAGIC 0xAA55
|
||||
#define ATOM_ATI_MAGIC_PTR 0x30
|
||||
#define ATOM_ATI_MAGIC " 761295520"
|
||||
#define ATOM_ROM_TABLE_PTR 0x48
|
||||
|
||||
#define ATOM_ROM_MAGIC "ATOM"
|
||||
#define ATOM_ROM_MAGIC_PTR 4
|
||||
|
||||
#define ATOM_ROM_MSG_PTR 0x10
|
||||
#define ATOM_ROM_CMD_PTR 0x1E
|
||||
#define ATOM_ROM_DATA_PTR 0x20
|
||||
|
||||
#define ATOM_CMD_INIT 0
|
||||
#define ATOM_CMD_SETSCLK 0x0A
|
||||
#define ATOM_CMD_SETMCLK 0x0B
|
||||
#define ATOM_CMD_SETPCLK 0x0C
|
||||
|
||||
#define ATOM_DATA_FWI_PTR 0xC
|
||||
#define ATOM_DATA_IIO_PTR 0x32
|
||||
|
||||
#define ATOM_FWI_DEFSCLK_PTR 8
|
||||
#define ATOM_FWI_DEFMCLK_PTR 0xC
|
||||
#define ATOM_FWI_MAXSCLK_PTR 0x24
|
||||
#define ATOM_FWI_MAXMCLK_PTR 0x28
|
||||
|
||||
#define ATOM_CT_SIZE_PTR 0
|
||||
#define ATOM_CT_WS_PTR 4
|
||||
#define ATOM_CT_PS_PTR 5
|
||||
#define ATOM_CT_PS_MASK 0x7F
|
||||
#define ATOM_CT_CODE_PTR 6
|
||||
|
||||
#define ATOM_OP_CNT 123
|
||||
#define ATOM_OP_EOT 91
|
||||
|
||||
#define ATOM_CASE_MAGIC 0x63
|
||||
#define ATOM_CASE_END 0x5A5A
|
||||
|
||||
#define ATOM_ARG_REG 0
|
||||
#define ATOM_ARG_PS 1
|
||||
#define ATOM_ARG_WS 2
|
||||
#define ATOM_ARG_FB 3
|
||||
#define ATOM_ARG_ID 4
|
||||
#define ATOM_ARG_IMM 5
|
||||
#define ATOM_ARG_PLL 6
|
||||
#define ATOM_ARG_MC 7
|
||||
|
||||
#define ATOM_SRC_DWORD 0
|
||||
#define ATOM_SRC_WORD0 1
|
||||
#define ATOM_SRC_WORD8 2
|
||||
#define ATOM_SRC_WORD16 3
|
||||
#define ATOM_SRC_BYTE0 4
|
||||
#define ATOM_SRC_BYTE8 5
|
||||
#define ATOM_SRC_BYTE16 6
|
||||
#define ATOM_SRC_BYTE24 7
|
||||
|
||||
#define ATOM_WS_QUOTIENT 0x40
|
||||
#define ATOM_WS_REMAINDER 0x41
|
||||
#define ATOM_WS_DATAPTR 0x42
|
||||
#define ATOM_WS_SHIFT 0x43
|
||||
#define ATOM_WS_OR_MASK 0x44
|
||||
#define ATOM_WS_AND_MASK 0x45
|
||||
#define ATOM_WS_FB_WINDOW 0x46
|
||||
#define ATOM_WS_ATTRIBUTES 0x47
|
||||
|
||||
#define ATOM_IIO_NOP 0
|
||||
#define ATOM_IIO_START 1
|
||||
#define ATOM_IIO_READ 2
|
||||
#define ATOM_IIO_WRITE 3
|
||||
#define ATOM_IIO_CLEAR 4
|
||||
#define ATOM_IIO_SET 5
|
||||
#define ATOM_IIO_MOVE_INDEX 6
|
||||
#define ATOM_IIO_MOVE_ATTR 7
|
||||
#define ATOM_IIO_MOVE_DATA 8
|
||||
#define ATOM_IIO_END 9
|
||||
|
||||
#define ATOM_IO_MM 0
|
||||
#define ATOM_IO_PCI 1
|
||||
#define ATOM_IO_SYSIO 2
|
||||
#define ATOM_IO_IIO 0x80
|
||||
|
||||
struct card_info {
|
||||
struct drm_device *dev;
|
||||
void (* reg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */
|
||||
uint32_t (* reg_read)(struct card_info *, uint32_t); /* filled by driver */
|
||||
void (* mc_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */
|
||||
uint32_t (* mc_read)(struct card_info *, uint32_t); /* filled by driver */
|
||||
void (* pll_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */
|
||||
uint32_t (* pll_read)(struct card_info *, uint32_t); /* filled by driver */
|
||||
};
|
||||
|
||||
struct atom_context {
|
||||
struct card_info *card;
|
||||
void *bios;
|
||||
uint32_t cmd_table, data_table;
|
||||
uint16_t *iio;
|
||||
|
||||
uint16_t data_block;
|
||||
uint32_t fb_base;
|
||||
uint32_t divmul[2];
|
||||
uint16_t io_attr;
|
||||
uint16_t reg_block;
|
||||
uint8_t shift;
|
||||
int cs_equal, cs_above;
|
||||
int io_mode;
|
||||
};
|
||||
|
||||
extern int atom_debug;
|
||||
|
||||
struct atom_context *atom_parse(struct card_info *, void *);
|
||||
void atom_execute_table(struct atom_context *, int, uint32_t *);
|
||||
int atom_asic_init(struct atom_context *);
|
||||
void atom_destroy(struct atom_context *);
|
||||
void atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, uint8_t *frev, uint8_t *crev, uint16_t *data_start);
|
||||
void atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t *frev, uint8_t *crev);
|
||||
#include "atom-types.h"
|
||||
#include "atombios.h"
|
||||
#include "ObjectID.h"
|
||||
|
||||
#endif
|
4785
drivers/video/drm/radeon/atombios.h
Normal file
4785
drivers/video/drm/radeon/atombios.h
Normal file
File diff suppressed because it is too large
Load Diff
795
drivers/video/drm/radeon/pci.c
Normal file
795
drivers/video/drm/radeon/pci.c
Normal file
@ -0,0 +1,795 @@
|
||||
|
||||
#include <pci.h>
|
||||
#include <errno-base.h>
|
||||
#include <syscall.h>
|
||||
|
||||
link_t devices;
|
||||
|
||||
static dev_t* pci_scan_device(u32_t bus, int devfn);
|
||||
|
||||
|
||||
/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */
|
||||
#define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */
|
||||
|
||||
#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
|
||||
|
||||
/*
|
||||
* Translate the low bits of the PCI base
|
||||
* to the resource type
|
||||
*/
|
||||
static inline unsigned int pci_calc_resource_flags(unsigned int flags)
|
||||
{
|
||||
if (flags & PCI_BASE_ADDRESS_SPACE_IO)
|
||||
return IORESOURCE_IO;
|
||||
|
||||
if (flags & PCI_BASE_ADDRESS_MEM_PREFETCH)
|
||||
return IORESOURCE_MEM | IORESOURCE_PREFETCH;
|
||||
|
||||
return IORESOURCE_MEM;
|
||||
}
|
||||
|
||||
|
||||
static u32_t pci_size(u32_t base, u32_t maxbase, u32_t mask)
|
||||
{
|
||||
u32_t size = mask & maxbase; /* Find the significant bits */
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
/* Get the lowest of them to find the decode size, and
|
||||
from that the extent. */
|
||||
size = (size & ~(size-1)) - 1;
|
||||
|
||||
/* base == maxbase can be valid only if the BAR has
|
||||
already been programmed with all 1s. */
|
||||
if (base == maxbase && ((base | size) & mask) != mask)
|
||||
return 0;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static u64_t pci_size64(u64_t base, u64_t maxbase, u64_t mask)
|
||||
{
|
||||
u64_t size = mask & maxbase; /* Find the significant bits */
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
/* Get the lowest of them to find the decode size, and
|
||||
from that the extent. */
|
||||
size = (size & ~(size-1)) - 1;
|
||||
|
||||
/* base == maxbase can be valid only if the BAR has
|
||||
already been programmed with all 1s. */
|
||||
if (base == maxbase && ((base | size) & mask) != mask)
|
||||
return 0;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static inline int is_64bit_memory(u32_t mask)
|
||||
{
|
||||
if ((mask & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
|
||||
(PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
|
||||
{
|
||||
u32_t pos, reg, next;
|
||||
u32_t l, sz;
|
||||
struct resource *res;
|
||||
|
||||
for(pos=0; pos < howmany; pos = next)
|
||||
{
|
||||
u64_t l64;
|
||||
u64_t sz64;
|
||||
u32_t raw_sz;
|
||||
|
||||
next = pos + 1;
|
||||
|
||||
res = &dev->resource[pos];
|
||||
|
||||
reg = PCI_BASE_ADDRESS_0 + (pos << 2);
|
||||
l = PciRead32(dev->bus, dev->devfn, reg);
|
||||
PciWrite32(dev->bus, dev->devfn, reg, ~0);
|
||||
sz = PciRead32(dev->bus, dev->devfn, reg);
|
||||
PciWrite32(dev->bus, dev->devfn, reg, l);
|
||||
|
||||
if (!sz || sz == 0xffffffff)
|
||||
continue;
|
||||
|
||||
if (l == 0xffffffff)
|
||||
l = 0;
|
||||
|
||||
raw_sz = sz;
|
||||
if ((l & PCI_BASE_ADDRESS_SPACE) ==
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY)
|
||||
{
|
||||
sz = pci_size(l, sz, (u32_t)PCI_BASE_ADDRESS_MEM_MASK);
|
||||
/*
|
||||
* For 64bit prefetchable memory sz could be 0, if the
|
||||
* real size is bigger than 4G, so we need to check
|
||||
* szhi for that.
|
||||
*/
|
||||
if (!is_64bit_memory(l) && !sz)
|
||||
continue;
|
||||
res->start = l & PCI_BASE_ADDRESS_MEM_MASK;
|
||||
res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK;
|
||||
}
|
||||
else {
|
||||
sz = pci_size(l, sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);
|
||||
if (!sz)
|
||||
continue;
|
||||
res->start = l & PCI_BASE_ADDRESS_IO_MASK;
|
||||
res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK;
|
||||
}
|
||||
res->end = res->start + (unsigned long) sz;
|
||||
res->flags |= pci_calc_resource_flags(l);
|
||||
if (is_64bit_memory(l))
|
||||
{
|
||||
u32_t szhi, lhi;
|
||||
|
||||
lhi = PciRead32(dev->bus, dev->devfn, reg+4);
|
||||
PciWrite32(dev->bus, dev->devfn, reg+4, ~0);
|
||||
szhi = PciRead32(dev->bus, dev->devfn, reg+4);
|
||||
PciWrite32(dev->bus, dev->devfn, reg+4, lhi);
|
||||
sz64 = ((u64_t)szhi << 32) | raw_sz;
|
||||
l64 = ((u64_t)lhi << 32) | l;
|
||||
sz64 = pci_size64(l64, sz64, PCI_BASE_ADDRESS_MEM_MASK);
|
||||
next++;
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
if (!sz64) {
|
||||
res->start = 0;
|
||||
res->end = 0;
|
||||
res->flags = 0;
|
||||
continue;
|
||||
}
|
||||
res->start = l64 & PCI_BASE_ADDRESS_MEM_MASK;
|
||||
res->end = res->start + sz64;
|
||||
#else
|
||||
if (sz64 > 0x100000000ULL) {
|
||||
printk(KERN_ERR "PCI: Unable to handle 64-bit "
|
||||
"BAR for device %s\n", pci_name(dev));
|
||||
res->start = 0;
|
||||
res->flags = 0;
|
||||
}
|
||||
else if (lhi)
|
||||
{
|
||||
/* 64-bit wide address, treat as disabled */
|
||||
PciWrite32(dev->bus, dev->devfn, reg,
|
||||
l & ~(u32_t)PCI_BASE_ADDRESS_MEM_MASK);
|
||||
PciWrite32(dev->bus, dev->devfn, reg+4, 0);
|
||||
res->start = 0;
|
||||
res->end = sz;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if ( rom )
|
||||
{
|
||||
dev->rom_base_reg = rom;
|
||||
res = &dev->resource[PCI_ROM_RESOURCE];
|
||||
|
||||
l = PciRead32(dev->bus, dev->devfn, rom);
|
||||
PciWrite32(dev->bus, dev->devfn, rom, ~PCI_ROM_ADDRESS_ENABLE);
|
||||
sz = PciRead32(dev->bus, dev->devfn, rom);
|
||||
PciWrite32(dev->bus, dev->devfn, rom, l);
|
||||
|
||||
if (l == 0xffffffff)
|
||||
l = 0;
|
||||
|
||||
if (sz && sz != 0xffffffff)
|
||||
{
|
||||
sz = pci_size(l, sz, (u32_t)PCI_ROM_ADDRESS_MASK);
|
||||
|
||||
if (sz)
|
||||
{
|
||||
res->flags = (l & IORESOURCE_ROM_ENABLE) |
|
||||
IORESOURCE_MEM | IORESOURCE_PREFETCH |
|
||||
IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
|
||||
res->start = l & PCI_ROM_ADDRESS_MASK;
|
||||
res->end = res->start + (unsigned long) sz;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void pci_read_irq(struct pci_dev *dev)
|
||||
{
|
||||
u8_t irq;
|
||||
|
||||
irq = PciRead8(dev->bus, dev->devfn, PCI_INTERRUPT_PIN);
|
||||
dev->pin = irq;
|
||||
if (irq)
|
||||
PciRead8(dev->bus, dev->devfn, PCI_INTERRUPT_LINE);
|
||||
dev->irq = irq;
|
||||
};
|
||||
|
||||
|
||||
static int pci_setup_device(struct pci_dev *dev)
|
||||
{
|
||||
u32_t class;
|
||||
|
||||
class = PciRead32(dev->bus, dev->devfn, PCI_CLASS_REVISION);
|
||||
dev->revision = class & 0xff;
|
||||
class >>= 8; /* upper 3 bytes */
|
||||
dev->class = class;
|
||||
|
||||
/* "Unknown power state" */
|
||||
// dev->current_state = PCI_UNKNOWN;
|
||||
|
||||
/* Early fixups, before probing the BARs */
|
||||
// pci_fixup_device(pci_fixup_early, dev);
|
||||
class = dev->class >> 8;
|
||||
|
||||
switch (dev->hdr_type)
|
||||
{
|
||||
case PCI_HEADER_TYPE_NORMAL: /* standard header */
|
||||
if (class == PCI_CLASS_BRIDGE_PCI)
|
||||
goto bad;
|
||||
pci_read_irq(dev);
|
||||
pci_read_bases(dev, 6, PCI_ROM_ADDRESS);
|
||||
dev->subsystem_vendor = PciRead16(dev->bus, dev->devfn,PCI_SUBSYSTEM_VENDOR_ID);
|
||||
dev->subsystem_device = PciRead16(dev->bus, dev->devfn, PCI_SUBSYSTEM_ID);
|
||||
|
||||
/*
|
||||
* Do the ugly legacy mode stuff here rather than broken chip
|
||||
* quirk code. Legacy mode ATA controllers have fixed
|
||||
* addresses. These are not always echoed in BAR0-3, and
|
||||
* BAR0-3 in a few cases contain junk!
|
||||
*/
|
||||
if (class == PCI_CLASS_STORAGE_IDE)
|
||||
{
|
||||
u8_t progif;
|
||||
|
||||
progif = PciRead8(dev->bus, dev->devfn,PCI_CLASS_PROG);
|
||||
if ((progif & 1) == 0)
|
||||
{
|
||||
dev->resource[0].start = 0x1F0;
|
||||
dev->resource[0].end = 0x1F7;
|
||||
dev->resource[0].flags = LEGACY_IO_RESOURCE;
|
||||
dev->resource[1].start = 0x3F6;
|
||||
dev->resource[1].end = 0x3F6;
|
||||
dev->resource[1].flags = LEGACY_IO_RESOURCE;
|
||||
}
|
||||
if ((progif & 4) == 0)
|
||||
{
|
||||
dev->resource[2].start = 0x170;
|
||||
dev->resource[2].end = 0x177;
|
||||
dev->resource[2].flags = LEGACY_IO_RESOURCE;
|
||||
dev->resource[3].start = 0x376;
|
||||
dev->resource[3].end = 0x376;
|
||||
dev->resource[3].flags = LEGACY_IO_RESOURCE;
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case PCI_HEADER_TYPE_BRIDGE: /* bridge header */
|
||||
if (class != PCI_CLASS_BRIDGE_PCI)
|
||||
goto bad;
|
||||
/* The PCI-to-PCI bridge spec requires that subtractive
|
||||
decoding (i.e. transparent) bridge must have programming
|
||||
interface code of 0x01. */
|
||||
pci_read_irq(dev);
|
||||
dev->transparent = ((dev->class & 0xff) == 1);
|
||||
pci_read_bases(dev, 2, PCI_ROM_ADDRESS1);
|
||||
break;
|
||||
|
||||
case PCI_HEADER_TYPE_CARDBUS: /* CardBus bridge header */
|
||||
if (class != PCI_CLASS_BRIDGE_CARDBUS)
|
||||
goto bad;
|
||||
pci_read_irq(dev);
|
||||
pci_read_bases(dev, 1, 0);
|
||||
dev->subsystem_vendor = PciRead16(dev->bus,
|
||||
dev->devfn,
|
||||
PCI_CB_SUBSYSTEM_VENDOR_ID);
|
||||
|
||||
dev->subsystem_device = PciRead16(dev->bus,
|
||||
dev->devfn,
|
||||
PCI_CB_SUBSYSTEM_ID);
|
||||
break;
|
||||
|
||||
default: /* unknown header */
|
||||
printk(KERN_ERR "PCI: device %s has unknown header type %02x, ignoring.\n",
|
||||
pci_name(dev), dev->hdr_type);
|
||||
return -1;
|
||||
|
||||
bad:
|
||||
printk(KERN_ERR "PCI: %s: class %x doesn't match header type %02x. Ignoring class.\n",
|
||||
pci_name(dev), class, dev->hdr_type);
|
||||
dev->class = PCI_CLASS_NOT_DEFINED;
|
||||
}
|
||||
|
||||
/* We found a fine healthy device, go go go... */
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
static dev_t* pci_scan_device(u32_t bus, int devfn)
|
||||
{
|
||||
dev_t *dev;
|
||||
|
||||
u32_t id;
|
||||
u8_t hdr;
|
||||
|
||||
int timeout = 10;
|
||||
|
||||
id = PciRead32(bus,devfn, PCI_VENDOR_ID);
|
||||
|
||||
/* some broken boards return 0 or ~0 if a slot is empty: */
|
||||
if (id == 0xffffffff || id == 0x00000000 ||
|
||||
id == 0x0000ffff || id == 0xffff0000)
|
||||
return NULL;
|
||||
|
||||
while (id == 0xffff0001)
|
||||
{
|
||||
|
||||
delay(timeout/10);
|
||||
timeout *= 2;
|
||||
|
||||
id = PciRead32(bus, devfn, PCI_VENDOR_ID);
|
||||
|
||||
/* Card hasn't responded in 60 seconds? Must be stuck. */
|
||||
if (timeout > 60 * 100)
|
||||
{
|
||||
printk(KERN_WARNING "Device %04x:%02x:%02x.%d not "
|
||||
"responding\n", bus,PCI_SLOT(devfn),PCI_FUNC(devfn));
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
hdr = PciRead8(bus, devfn, PCI_HEADER_TYPE);
|
||||
|
||||
dev = (dev_t*)malloc(sizeof(dev_t));
|
||||
|
||||
link_initialize(&dev->link);
|
||||
|
||||
if(unlikely(dev == NULL))
|
||||
return NULL;
|
||||
|
||||
dev->pci_dev.bus = bus;
|
||||
dev->pci_dev.devfn = devfn;
|
||||
dev->pci_dev.hdr_type = hdr & 0x7f;
|
||||
dev->pci_dev.multifunction = !!(hdr & 0x80);
|
||||
dev->pci_dev.vendor = id & 0xffff;
|
||||
dev->pci_dev.device = (id >> 16) & 0xffff;
|
||||
|
||||
pci_setup_device(&dev->pci_dev);
|
||||
|
||||
return dev;
|
||||
|
||||
};
|
||||
|
||||
int pci_scan_slot(u32_t bus, int devfn)
|
||||
{
|
||||
int func, nr = 0;
|
||||
|
||||
for (func = 0; func < 8; func++, devfn++)
|
||||
{
|
||||
dev_t *dev;
|
||||
|
||||
dev = pci_scan_device(bus, devfn);
|
||||
if( dev )
|
||||
{
|
||||
list_append(&dev->link, &devices);
|
||||
|
||||
nr++;
|
||||
|
||||
/*
|
||||
* If this is a single function device,
|
||||
* don't scan past the first function.
|
||||
*/
|
||||
if (!dev->pci_dev.multifunction)
|
||||
{
|
||||
if (func > 0) {
|
||||
dev->pci_dev.multifunction = 1;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (func == 0)
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
return nr;
|
||||
};
|
||||
|
||||
|
||||
void pci_scan_bus(u32_t bus)
|
||||
{
|
||||
u32_t devfn;
|
||||
dev_t *dev;
|
||||
|
||||
|
||||
for (devfn = 0; devfn < 0x100; devfn += 8)
|
||||
pci_scan_slot(bus, devfn);
|
||||
|
||||
}
|
||||
|
||||
int enum_pci_devices()
|
||||
{
|
||||
dev_t *dev;
|
||||
u32_t last_bus;
|
||||
u32_t bus = 0 , devfn = 0;
|
||||
|
||||
list_initialize(&devices);
|
||||
|
||||
last_bus = PciApi(1);
|
||||
|
||||
|
||||
if( unlikely(last_bus == -1))
|
||||
return -1;
|
||||
|
||||
for(;bus <= last_bus; bus++)
|
||||
pci_scan_bus(bus);
|
||||
|
||||
// for(dev = (dev_t*)devices.next;
|
||||
// &dev->link != &devices;
|
||||
// dev = (dev_t*)dev->link.next)
|
||||
// {
|
||||
// dbgprintf("PCI device %x:%x bus:%x devfn:%x\n",
|
||||
// dev->pci_dev.vendor,
|
||||
// dev->pci_dev.device,
|
||||
// dev->pci_dev.bus,
|
||||
// dev->pci_dev.devfn);
|
||||
//
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* pci_set_power_state - Set the power state of a PCI device
|
||||
* @dev: PCI device to be suspended
|
||||
* @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering
|
||||
*
|
||||
* Transition a device to a new power state, using the Power Management
|
||||
* Capabilities in the device's config space.
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -EINVAL if trying to enter a lower state than we're already in.
|
||||
* 0 if we're already in the requested state.
|
||||
* -EIO if device does not support PCI PM.
|
||||
* 0 if we can successfully change the power state.
|
||||
*/
|
||||
int
|
||||
pci_set_power_state(struct pci_dev *dev, pci_power_t state)
|
||||
{
|
||||
int pm, need_restore = 0;
|
||||
u16 pmcsr, pmc;
|
||||
|
||||
/* bound the state we're entering */
|
||||
if (state > PCI_D3hot)
|
||||
state = PCI_D3hot;
|
||||
|
||||
/*
|
||||
* If the device or the parent bridge can't support PCI PM, ignore
|
||||
* the request if we're doing anything besides putting it into D0
|
||||
* (which would only happen on boot).
|
||||
*/
|
||||
if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev))
|
||||
return 0;
|
||||
|
||||
/* find PCI PM capability in list */
|
||||
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
|
||||
|
||||
/* abort if the device doesn't support PM capabilities */
|
||||
if (!pm)
|
||||
return -EIO;
|
||||
|
||||
/* Validate current state:
|
||||
* Can enter D0 from any state, but if we can only go deeper
|
||||
* to sleep if we're already in a low power state
|
||||
*/
|
||||
if (state != PCI_D0 && dev->current_state > state) {
|
||||
printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n",
|
||||
__FUNCTION__, pci_name(dev), state, dev->current_state);
|
||||
return -EINVAL;
|
||||
} else if (dev->current_state == state)
|
||||
return 0; /* we're already there */
|
||||
|
||||
|
||||
pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
|
||||
if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
|
||||
printk(KERN_DEBUG
|
||||
"PCI: %s has unsupported PM cap regs version (%u)\n",
|
||||
pci_name(dev), pmc & PCI_PM_CAP_VER_MASK);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* check if this device supports the desired state */
|
||||
if (state == PCI_D1 && !(pmc & PCI_PM_CAP_D1))
|
||||
return -EIO;
|
||||
else if (state == PCI_D2 && !(pmc & PCI_PM_CAP_D2))
|
||||
return -EIO;
|
||||
|
||||
pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
|
||||
|
||||
/* If we're (effectively) in D3, force entire word to 0.
|
||||
* This doesn't affect PME_Status, disables PME_En, and
|
||||
* sets PowerState to 0.
|
||||
*/
|
||||
switch (dev->current_state) {
|
||||
case PCI_D0:
|
||||
case PCI_D1:
|
||||
case PCI_D2:
|
||||
pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
|
||||
pmcsr |= state;
|
||||
break;
|
||||
case PCI_UNKNOWN: /* Boot-up */
|
||||
if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
|
||||
&& !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
|
||||
need_restore = 1;
|
||||
/* Fall-through: force to D0 */
|
||||
default:
|
||||
pmcsr = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* enter specified state */
|
||||
pci_write_config_word(dev, pm + PCI_PM_CTRL, pmcsr);
|
||||
|
||||
/* Mandatory power management transition delays */
|
||||
/* see PCI PM 1.1 5.6.1 table 18 */
|
||||
if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
|
||||
msleep(pci_pm_d3_delay);
|
||||
else if (state == PCI_D2 || dev->current_state == PCI_D2)
|
||||
udelay(200);
|
||||
|
||||
/*
|
||||
* Give firmware a chance to be called, such as ACPI _PRx, _PSx
|
||||
* Firmware method after native method ?
|
||||
*/
|
||||
if (platform_pci_set_power_state)
|
||||
platform_pci_set_power_state(dev, state);
|
||||
|
||||
dev->current_state = state;
|
||||
|
||||
/* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT
|
||||
* INTERFACE SPECIFICATION, REV. 1.2", a device transitioning
|
||||
* from D3hot to D0 _may_ perform an internal reset, thereby
|
||||
* going to "D0 Uninitialized" rather than "D0 Initialized".
|
||||
* For example, at least some versions of the 3c905B and the
|
||||
* 3c556B exhibit this behaviour.
|
||||
*
|
||||
* At least some laptop BIOSen (e.g. the Thinkpad T21) leave
|
||||
* devices in a D3hot state at boot. Consequently, we need to
|
||||
* restore at least the BARs so that the device will be
|
||||
* accessible to its driver.
|
||||
*/
|
||||
if (need_restore)
|
||||
pci_restore_bars(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int pcibios_enable_resources(struct pci_dev *dev, int mask)
|
||||
{
|
||||
u16_t cmd, old_cmd;
|
||||
int idx;
|
||||
struct resource *r;
|
||||
|
||||
cmd = PciRead16(dev->bus, dev->devfn, PCI_COMMAND);
|
||||
old_cmd = cmd;
|
||||
for (idx = 0; idx < PCI_NUM_RESOURCES; idx++)
|
||||
{
|
||||
/* Only set up the requested stuff */
|
||||
if (!(mask & (1 << idx)))
|
||||
continue;
|
||||
|
||||
r = &dev->resource[idx];
|
||||
if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
|
||||
continue;
|
||||
if ((idx == PCI_ROM_RESOURCE) &&
|
||||
(!(r->flags & IORESOURCE_ROM_ENABLE)))
|
||||
continue;
|
||||
if (!r->start && r->end) {
|
||||
printk(KERN_ERR "PCI: Device %s not available "
|
||||
"because of resource %d collisions\n",
|
||||
pci_name(dev), idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (r->flags & IORESOURCE_IO)
|
||||
cmd |= PCI_COMMAND_IO;
|
||||
if (r->flags & IORESOURCE_MEM)
|
||||
cmd |= PCI_COMMAND_MEMORY;
|
||||
}
|
||||
if (cmd != old_cmd) {
|
||||
printk("PCI: Enabling device %s (%04x -> %04x)\n",
|
||||
pci_name(dev), old_cmd, cmd);
|
||||
PciWrite16(dev->bus, dev->devfn, PCI_COMMAND, cmd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int pcibios_enable_device(struct pci_dev *dev, int mask)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = pcibios_enable_resources(dev, mask)) < 0)
|
||||
return err;
|
||||
|
||||
// if (!dev->msi_enabled)
|
||||
// return pcibios_enable_irq(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int do_pci_enable_device(struct pci_dev *dev, int bars)
|
||||
{
|
||||
int err;
|
||||
|
||||
// err = pci_set_power_state(dev, PCI_D0);
|
||||
// if (err < 0 && err != -EIO)
|
||||
// return err;
|
||||
err = pcibios_enable_device(dev, bars);
|
||||
// if (err < 0)
|
||||
// return err;
|
||||
// pci_fixup_device(pci_fixup_enable, dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __pci_enable_device_flags(struct pci_dev *dev,
|
||||
resource_size_t flags)
|
||||
{
|
||||
int err;
|
||||
int i, bars = 0;
|
||||
|
||||
// if (atomic_add_return(1, &dev->enable_cnt) > 1)
|
||||
// return 0; /* already enabled */
|
||||
|
||||
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
|
||||
if (dev->resource[i].flags & flags)
|
||||
bars |= (1 << i);
|
||||
|
||||
err = do_pci_enable_device(dev, bars);
|
||||
// if (err < 0)
|
||||
// atomic_dec(&dev->enable_cnt);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pci_enable_device - Initialize device before it's used by a driver.
|
||||
* @dev: PCI device to be initialized
|
||||
*
|
||||
* Initialize device before it's used by a driver. Ask low-level code
|
||||
* to enable I/O and memory. Wake up the device if it was suspended.
|
||||
* Beware, this function can fail.
|
||||
*
|
||||
* Note we don't actually enable the device many times if we call
|
||||
* this function repeatedly (we just increment the count).
|
||||
*/
|
||||
int pci_enable_device(struct pci_dev *dev)
|
||||
{
|
||||
return __pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct pci_device_id* find_pci_device(dev_t* pdev, struct pci_device_id *idlist)
|
||||
{
|
||||
dev_t *dev;
|
||||
struct pci_device_id *ent;
|
||||
|
||||
for(dev = (dev_t*)devices.next;
|
||||
&dev->link != &devices;
|
||||
dev = (dev_t*)dev->link.next)
|
||||
{
|
||||
if( dev->pci_dev.vendor != idlist->vendor )
|
||||
continue;
|
||||
|
||||
for(ent = idlist; ent->vendor != 0; ent++)
|
||||
{
|
||||
if(unlikely(ent->device == dev->pci_dev.device))
|
||||
{
|
||||
pdev->pci_dev = dev->pci_dev;
|
||||
return ent;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return NULL;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* pci_map_rom - map a PCI ROM to kernel space
|
||||
* @pdev: pointer to pci device struct
|
||||
* @size: pointer to receive size of pci window over ROM
|
||||
* @return: kernel virtual pointer to image of ROM
|
||||
*
|
||||
* Map a PCI ROM into kernel space. If ROM is boot video ROM,
|
||||
* the shadow BIOS copy will be returned instead of the
|
||||
* actual ROM.
|
||||
*/
|
||||
|
||||
#define legacyBIOSLocation 0xC0000
|
||||
#define OS_BASE 0x80000000
|
||||
|
||||
void *pci_map_rom(struct pci_dev *pdev, size_t *size)
|
||||
{
|
||||
struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
|
||||
u32_t start;
|
||||
void *rom;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
|
||||
* memory map if the VGA enable bit of the Bridge Control register is
|
||||
* set for embedded VGA.
|
||||
*/
|
||||
if (res->flags & IORESOURCE_ROM_SHADOW) {
|
||||
/* primary video rom always starts here */
|
||||
start = (u32_t)0xC0000;
|
||||
*size = 0x20000; /* cover C000:0 through E000:0 */
|
||||
} else {
|
||||
if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) {
|
||||
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
||||
return (void *)(unsigned long)
|
||||
pci_resource_start(pdev, PCI_ROM_RESOURCE);
|
||||
} else {
|
||||
/* assign the ROM an address if it doesn't have one */
|
||||
//if (res->parent == NULL &&
|
||||
// pci_assign_resource(pdev,PCI_ROM_RESOURCE))
|
||||
// return NULL;
|
||||
start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
|
||||
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
||||
if (*size == 0)
|
||||
return NULL;
|
||||
|
||||
/* Enable ROM space decodes */
|
||||
if (pci_enable_rom(pdev))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
rom = ioremap(start, *size);
|
||||
if (!rom) {
|
||||
/* restore enable if ioremap fails */
|
||||
if (!(res->flags & (IORESOURCE_ROM_ENABLE |
|
||||
IORESOURCE_ROM_SHADOW |
|
||||
IORESOURCE_ROM_COPY)))
|
||||
pci_disable_rom(pdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to find the true size of the ROM since sometimes the PCI window
|
||||
* size is much larger than the actual size of the ROM.
|
||||
* True size is important if the ROM is going to be copied.
|
||||
*/
|
||||
*size = pci_get_rom_size(rom, *size);
|
||||
|
||||
#endif
|
||||
|
||||
unsigned char tmp[32];
|
||||
rom = NULL;
|
||||
|
||||
dbgprintf("Getting BIOS copy from legacy VBIOS location\n");
|
||||
memcpy(tmp,(char*)(OS_BASE+legacyBIOSLocation), 32);
|
||||
*size = tmp[2] * 512;
|
||||
if (*size > 0x10000 )
|
||||
{
|
||||
*size = 0;
|
||||
dbgprintf("Invalid BIOS length field\n");
|
||||
}
|
||||
else
|
||||
rom = (void*)( OS_BASE+legacyBIOSLocation);
|
||||
|
||||
return rom;
|
||||
}
|
||||
|
1394
drivers/video/drm/radeon/r100.c
Normal file
1394
drivers/video/drm/radeon/r100.c
Normal file
File diff suppressed because it is too large
Load Diff
36
drivers/video/drm/radeon/r300.h
Normal file
36
drivers/video/drm/radeon/r300.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
#ifndef R300_H
|
||||
#define R300_H
|
||||
|
||||
struct r300_asic {
|
||||
const unsigned *reg_safe_bm;
|
||||
unsigned reg_safe_bm_size;
|
||||
};
|
||||
|
||||
#endif
|
1782
drivers/video/drm/radeon/r300_reg.h
Normal file
1782
drivers/video/drm/radeon/r300_reg.h
Normal file
File diff suppressed because it is too large
Load Diff
749
drivers/video/drm/radeon/r500_reg.h
Normal file
749
drivers/video/drm/radeon/r500_reg.h
Normal file
@ -0,0 +1,749 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
#ifndef __R500_REG_H__
|
||||
#define __R500_REG_H__
|
||||
|
||||
/* pipe config regs */
|
||||
#define R300_GA_POLY_MODE 0x4288
|
||||
# define R300_FRONT_PTYPE_POINT (0 << 4)
|
||||
# define R300_FRONT_PTYPE_LINE (1 << 4)
|
||||
# define R300_FRONT_PTYPE_TRIANGE (2 << 4)
|
||||
# define R300_BACK_PTYPE_POINT (0 << 7)
|
||||
# define R300_BACK_PTYPE_LINE (1 << 7)
|
||||
# define R300_BACK_PTYPE_TRIANGE (2 << 7)
|
||||
#define R300_GA_ROUND_MODE 0x428c
|
||||
# define R300_GEOMETRY_ROUND_TRUNC (0 << 0)
|
||||
# define R300_GEOMETRY_ROUND_NEAREST (1 << 0)
|
||||
# define R300_COLOR_ROUND_TRUNC (0 << 2)
|
||||
# define R300_COLOR_ROUND_NEAREST (1 << 2)
|
||||
#define R300_GB_MSPOS0 0x4010
|
||||
# define R300_MS_X0_SHIFT 0
|
||||
# define R300_MS_Y0_SHIFT 4
|
||||
# define R300_MS_X1_SHIFT 8
|
||||
# define R300_MS_Y1_SHIFT 12
|
||||
# define R300_MS_X2_SHIFT 16
|
||||
# define R300_MS_Y2_SHIFT 20
|
||||
# define R300_MSBD0_Y_SHIFT 24
|
||||
# define R300_MSBD0_X_SHIFT 28
|
||||
#define R300_GB_MSPOS1 0x4014
|
||||
# define R300_MS_X3_SHIFT 0
|
||||
# define R300_MS_Y3_SHIFT 4
|
||||
# define R300_MS_X4_SHIFT 8
|
||||
# define R300_MS_Y4_SHIFT 12
|
||||
# define R300_MS_X5_SHIFT 16
|
||||
# define R300_MS_Y5_SHIFT 20
|
||||
# define R300_MSBD1_SHIFT 24
|
||||
|
||||
#define R300_GA_ENHANCE 0x4274
|
||||
# define R300_GA_DEADLOCK_CNTL (1 << 0)
|
||||
# define R300_GA_FASTSYNC_CNTL (1 << 1)
|
||||
#define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c
|
||||
# define R300_RB3D_DC_FLUSH (2 << 0)
|
||||
# define R300_RB3D_DC_FREE (2 << 2)
|
||||
# define R300_RB3D_DC_FINISH (1 << 4)
|
||||
#define R300_RB3D_ZCACHE_CTLSTAT 0x4f18
|
||||
# define R300_ZC_FLUSH (1 << 0)
|
||||
# define R300_ZC_FREE (1 << 1)
|
||||
# define R300_ZC_FLUSH_ALL 0x3
|
||||
#define R400_GB_PIPE_SELECT 0x402c
|
||||
#define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */
|
||||
#define R500_SU_REG_DEST 0x42c8
|
||||
#define R300_GB_TILE_CONFIG 0x4018
|
||||
# define R300_ENABLE_TILING (1 << 0)
|
||||
# define R300_PIPE_COUNT_RV350 (0 << 1)
|
||||
# define R300_PIPE_COUNT_R300 (3 << 1)
|
||||
# define R300_PIPE_COUNT_R420_3P (6 << 1)
|
||||
# define R300_PIPE_COUNT_R420 (7 << 1)
|
||||
# define R300_TILE_SIZE_8 (0 << 4)
|
||||
# define R300_TILE_SIZE_16 (1 << 4)
|
||||
# define R300_TILE_SIZE_32 (2 << 4)
|
||||
# define R300_SUBPIXEL_1_12 (0 << 16)
|
||||
# define R300_SUBPIXEL_1_16 (1 << 16)
|
||||
#define R300_DST_PIPE_CONFIG 0x170c
|
||||
# define R300_PIPE_AUTO_CONFIG (1 << 31)
|
||||
#define R300_RB2D_DSTCACHE_MODE 0x3428
|
||||
# define R300_DC_AUTOFLUSH_ENABLE (1 << 8)
|
||||
# define R300_DC_DC_DISABLE_IGNORE_PE (1 << 17)
|
||||
|
||||
#define RADEON_CP_STAT 0x7C0
|
||||
#define RADEON_RBBM_CMDFIFO_ADDR 0xE70
|
||||
#define RADEON_RBBM_CMDFIFO_DATA 0xE74
|
||||
#define RADEON_ISYNC_CNTL 0x1724
|
||||
# define RADEON_ISYNC_ANY2D_IDLE3D (1 << 0)
|
||||
# define RADEON_ISYNC_ANY3D_IDLE2D (1 << 1)
|
||||
# define RADEON_ISYNC_TRIG2D_IDLE3D (1 << 2)
|
||||
# define RADEON_ISYNC_TRIG3D_IDLE2D (1 << 3)
|
||||
# define RADEON_ISYNC_WAIT_IDLEGUI (1 << 4)
|
||||
# define RADEON_ISYNC_CPSCRATCH_IDLEGUI (1 << 5)
|
||||
|
||||
#define RS480_NB_MC_INDEX 0x168
|
||||
# define RS480_NB_MC_IND_WR_EN (1 << 8)
|
||||
#define RS480_NB_MC_DATA 0x16c
|
||||
|
||||
/*
|
||||
* RS690
|
||||
*/
|
||||
#define RS690_MCCFG_FB_LOCATION 0x100
|
||||
#define RS690_MC_FB_START_MASK 0x0000FFFF
|
||||
#define RS690_MC_FB_START_SHIFT 0
|
||||
#define RS690_MC_FB_TOP_MASK 0xFFFF0000
|
||||
#define RS690_MC_FB_TOP_SHIFT 16
|
||||
#define RS690_MCCFG_AGP_LOCATION 0x101
|
||||
#define RS690_MC_AGP_START_MASK 0x0000FFFF
|
||||
#define RS690_MC_AGP_START_SHIFT 0
|
||||
#define RS690_MC_AGP_TOP_MASK 0xFFFF0000
|
||||
#define RS690_MC_AGP_TOP_SHIFT 16
|
||||
#define RS690_MCCFG_AGP_BASE 0x102
|
||||
#define RS690_MCCFG_AGP_BASE_2 0x103
|
||||
#define RS690_MC_INIT_MISC_LAT_TIMER 0x104
|
||||
#define RS690_HDP_FB_LOCATION 0x0134
|
||||
#define RS690_MC_INDEX 0x78
|
||||
# define RS690_MC_INDEX_MASK 0x1ff
|
||||
# define RS690_MC_INDEX_WR_EN (1 << 9)
|
||||
# define RS690_MC_INDEX_WR_ACK 0x7f
|
||||
#define RS690_MC_DATA 0x7c
|
||||
#define RS690_MC_STATUS 0x90
|
||||
#define RS690_MC_STATUS_IDLE (1 << 0)
|
||||
#define RS480_AGP_BASE_2 0x0164
|
||||
#define RS480_MC_MISC_CNTL 0x18
|
||||
# define RS480_DISABLE_GTW (1 << 1)
|
||||
# define RS480_GART_INDEX_REG_EN (1 << 12)
|
||||
# define RS690_BLOCK_GFX_D3_EN (1 << 14)
|
||||
#define RS480_GART_FEATURE_ID 0x2b
|
||||
# define RS480_HANG_EN (1 << 11)
|
||||
# define RS480_TLB_ENABLE (1 << 18)
|
||||
# define RS480_P2P_ENABLE (1 << 19)
|
||||
# define RS480_GTW_LAC_EN (1 << 25)
|
||||
# define RS480_2LEVEL_GART (0 << 30)
|
||||
# define RS480_1LEVEL_GART (1 << 30)
|
||||
# define RS480_PDC_EN (1 << 31)
|
||||
#define RS480_GART_BASE 0x2c
|
||||
#define RS480_GART_CACHE_CNTRL 0x2e
|
||||
# define RS480_GART_CACHE_INVALIDATE (1 << 0) /* wait for it to clear */
|
||||
#define RS480_AGP_ADDRESS_SPACE_SIZE 0x38
|
||||
# define RS480_GART_EN (1 << 0)
|
||||
# define RS480_VA_SIZE_32MB (0 << 1)
|
||||
# define RS480_VA_SIZE_64MB (1 << 1)
|
||||
# define RS480_VA_SIZE_128MB (2 << 1)
|
||||
# define RS480_VA_SIZE_256MB (3 << 1)
|
||||
# define RS480_VA_SIZE_512MB (4 << 1)
|
||||
# define RS480_VA_SIZE_1GB (5 << 1)
|
||||
# define RS480_VA_SIZE_2GB (6 << 1)
|
||||
#define RS480_AGP_MODE_CNTL 0x39
|
||||
# define RS480_POST_GART_Q_SIZE (1 << 18)
|
||||
# define RS480_NONGART_SNOOP (1 << 19)
|
||||
# define RS480_AGP_RD_BUF_SIZE (1 << 20)
|
||||
# define RS480_REQ_TYPE_SNOOP_SHIFT 22
|
||||
# define RS480_REQ_TYPE_SNOOP_MASK 0x3
|
||||
# define RS480_REQ_TYPE_SNOOP_DIS (1 << 24)
|
||||
|
||||
#define RS690_AIC_CTRL_SCRATCH 0x3A
|
||||
# define RS690_DIS_OUT_OF_PCI_GART_ACCESS (1 << 1)
|
||||
|
||||
/*
|
||||
* RS600
|
||||
*/
|
||||
#define RS600_MC_STATUS 0x0
|
||||
#define RS600_MC_STATUS_IDLE (1 << 0)
|
||||
#define RS600_MC_INDEX 0x70
|
||||
# define RS600_MC_ADDR_MASK 0xffff
|
||||
# define RS600_MC_IND_SEQ_RBS_0 (1 << 16)
|
||||
# define RS600_MC_IND_SEQ_RBS_1 (1 << 17)
|
||||
# define RS600_MC_IND_SEQ_RBS_2 (1 << 18)
|
||||
# define RS600_MC_IND_SEQ_RBS_3 (1 << 19)
|
||||
# define RS600_MC_IND_AIC_RBS (1 << 20)
|
||||
# define RS600_MC_IND_CITF_ARB0 (1 << 21)
|
||||
# define RS600_MC_IND_CITF_ARB1 (1 << 22)
|
||||
# define RS600_MC_IND_WR_EN (1 << 23)
|
||||
#define RS600_MC_DATA 0x74
|
||||
#define RS600_MC_STATUS 0x0
|
||||
# define RS600_MC_IDLE (1 << 1)
|
||||
#define RS600_MC_FB_LOCATION 0x4
|
||||
#define RS600_MC_FB_START_MASK 0x0000FFFF
|
||||
#define RS600_MC_FB_START_SHIFT 0
|
||||
#define RS600_MC_FB_TOP_MASK 0xFFFF0000
|
||||
#define RS600_MC_FB_TOP_SHIFT 16
|
||||
#define RS600_MC_AGP_LOCATION 0x5
|
||||
#define RS600_MC_AGP_START_MASK 0x0000FFFF
|
||||
#define RS600_MC_AGP_START_SHIFT 0
|
||||
#define RS600_MC_AGP_TOP_MASK 0xFFFF0000
|
||||
#define RS600_MC_AGP_TOP_SHIFT 16
|
||||
#define RS600_MC_AGP_BASE 0x6
|
||||
#define RS600_MC_AGP_BASE_2 0x7
|
||||
#define RS600_MC_CNTL1 0x9
|
||||
# define RS600_ENABLE_PAGE_TABLES (1 << 26)
|
||||
#define RS600_MC_PT0_CNTL 0x100
|
||||
# define RS600_ENABLE_PT (1 << 0)
|
||||
# define RS600_EFFECTIVE_L2_CACHE_SIZE(x) ((x) << 15)
|
||||
# define RS600_EFFECTIVE_L2_QUEUE_SIZE(x) ((x) << 21)
|
||||
# define RS600_INVALIDATE_ALL_L1_TLBS (1 << 28)
|
||||
# define RS600_INVALIDATE_L2_CACHE (1 << 29)
|
||||
#define RS600_MC_PT0_CONTEXT0_CNTL 0x102
|
||||
# define RS600_ENABLE_PAGE_TABLE (1 << 0)
|
||||
# define RS600_PAGE_TABLE_TYPE_FLAT (0 << 1)
|
||||
#define RS600_MC_PT0_SYSTEM_APERTURE_LOW_ADDR 0x112
|
||||
#define RS600_MC_PT0_SYSTEM_APERTURE_HIGH_ADDR 0x114
|
||||
#define RS600_MC_PT0_CONTEXT0_DEFAULT_READ_ADDR 0x11c
|
||||
#define RS600_MC_PT0_CONTEXT0_FLAT_BASE_ADDR 0x12c
|
||||
#define RS600_MC_PT0_CONTEXT0_FLAT_START_ADDR 0x13c
|
||||
#define RS600_MC_PT0_CONTEXT0_FLAT_END_ADDR 0x14c
|
||||
#define RS600_MC_PT0_CLIENT0_CNTL 0x16c
|
||||
# define RS600_ENABLE_TRANSLATION_MODE_OVERRIDE (1 << 0)
|
||||
# define RS600_TRANSLATION_MODE_OVERRIDE (1 << 1)
|
||||
# define RS600_SYSTEM_ACCESS_MODE_MASK (3 << 8)
|
||||
# define RS600_SYSTEM_ACCESS_MODE_PA_ONLY (0 << 8)
|
||||
# define RS600_SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 8)
|
||||
# define RS600_SYSTEM_ACCESS_MODE_IN_SYS (2 << 8)
|
||||
# define RS600_SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 8)
|
||||
# define RS600_SYSTEM_APERTURE_UNMAPPED_ACCESS_PASSTHROUGH (0 << 10)
|
||||
# define RS600_SYSTEM_APERTURE_UNMAPPED_ACCESS_DEFAULT_PAGE (1 << 10)
|
||||
# define RS600_EFFECTIVE_L1_CACHE_SIZE(x) ((x) << 11)
|
||||
# define RS600_ENABLE_FRAGMENT_PROCESSING (1 << 14)
|
||||
# define RS600_EFFECTIVE_L1_QUEUE_SIZE(x) ((x) << 15)
|
||||
# define RS600_INVALIDATE_L1_TLB (1 << 20)
|
||||
/* rs600/rs690/rs740 */
|
||||
# define RS600_BUS_MASTER_DIS (1 << 14)
|
||||
# define RS600_MSI_REARM (1 << 20)
|
||||
/* see RS400_MSI_REARM in AIC_CNTL for rs480 */
|
||||
|
||||
|
||||
|
||||
#define RV515_MC_FB_LOCATION 0x01
|
||||
#define RV515_MC_FB_START_MASK 0x0000FFFF
|
||||
#define RV515_MC_FB_START_SHIFT 0
|
||||
#define RV515_MC_FB_TOP_MASK 0xFFFF0000
|
||||
#define RV515_MC_FB_TOP_SHIFT 16
|
||||
#define RV515_MC_AGP_LOCATION 0x02
|
||||
#define RV515_MC_AGP_START_MASK 0x0000FFFF
|
||||
#define RV515_MC_AGP_START_SHIFT 0
|
||||
#define RV515_MC_AGP_TOP_MASK 0xFFFF0000
|
||||
#define RV515_MC_AGP_TOP_SHIFT 16
|
||||
#define RV515_MC_AGP_BASE 0x03
|
||||
#define RV515_MC_AGP_BASE_2 0x04
|
||||
|
||||
#define R520_MC_FB_LOCATION 0x04
|
||||
#define R520_MC_FB_START_MASK 0x0000FFFF
|
||||
#define R520_MC_FB_START_SHIFT 0
|
||||
#define R520_MC_FB_TOP_MASK 0xFFFF0000
|
||||
#define R520_MC_FB_TOP_SHIFT 16
|
||||
#define R520_MC_AGP_LOCATION 0x05
|
||||
#define R520_MC_AGP_START_MASK 0x0000FFFF
|
||||
#define R520_MC_AGP_START_SHIFT 0
|
||||
#define R520_MC_AGP_TOP_MASK 0xFFFF0000
|
||||
#define R520_MC_AGP_TOP_SHIFT 16
|
||||
#define R520_MC_AGP_BASE 0x06
|
||||
#define R520_MC_AGP_BASE_2 0x07
|
||||
|
||||
|
||||
#define AVIVO_MC_INDEX 0x0070
|
||||
#define R520_MC_STATUS 0x00
|
||||
#define R520_MC_STATUS_IDLE (1<<1)
|
||||
#define RV515_MC_STATUS 0x08
|
||||
#define RV515_MC_STATUS_IDLE (1<<4)
|
||||
#define RV515_MC_INIT_MISC_LAT_TIMER 0x09
|
||||
#define AVIVO_MC_DATA 0x0074
|
||||
|
||||
#define R520_MC_IND_INDEX 0x70
|
||||
#define R520_MC_IND_WR_EN (1 << 24)
|
||||
#define R520_MC_IND_DATA 0x74
|
||||
|
||||
#define RV515_MC_CNTL 0x5
|
||||
# define RV515_MEM_NUM_CHANNELS_MASK 0x3
|
||||
#define R520_MC_CNTL0 0x8
|
||||
# define R520_MEM_NUM_CHANNELS_MASK (0x3 << 24)
|
||||
# define R520_MEM_NUM_CHANNELS_SHIFT 24
|
||||
# define R520_MC_CHANNEL_SIZE (1 << 23)
|
||||
|
||||
#define AVIVO_CP_DYN_CNTL 0x000f /* PLL */
|
||||
# define AVIVO_CP_FORCEON (1 << 0)
|
||||
#define AVIVO_E2_DYN_CNTL 0x0011 /* PLL */
|
||||
# define AVIVO_E2_FORCEON (1 << 0)
|
||||
#define AVIVO_IDCT_DYN_CNTL 0x0013 /* PLL */
|
||||
# define AVIVO_IDCT_FORCEON (1 << 0)
|
||||
|
||||
#define AVIVO_HDP_FB_LOCATION 0x134
|
||||
|
||||
#define AVIVO_VGA_RENDER_CONTROL 0x0300
|
||||
# define AVIVO_VGA_VSTATUS_CNTL_MASK (3 << 16)
|
||||
#define AVIVO_D1VGA_CONTROL 0x0330
|
||||
# define AVIVO_DVGA_CONTROL_MODE_ENABLE (1<<0)
|
||||
# define AVIVO_DVGA_CONTROL_TIMING_SELECT (1<<8)
|
||||
# define AVIVO_DVGA_CONTROL_SYNC_POLARITY_SELECT (1<<9)
|
||||
# define AVIVO_DVGA_CONTROL_OVERSCAN_TIMING_SELECT (1<<10)
|
||||
# define AVIVO_DVGA_CONTROL_OVERSCAN_COLOR_EN (1<<16)
|
||||
# define AVIVO_DVGA_CONTROL_ROTATE (1<<24)
|
||||
#define AVIVO_D2VGA_CONTROL 0x0338
|
||||
|
||||
#define AVIVO_EXT1_PPLL_REF_DIV_SRC 0x400
|
||||
#define AVIVO_EXT1_PPLL_REF_DIV 0x404
|
||||
#define AVIVO_EXT1_PPLL_UPDATE_LOCK 0x408
|
||||
#define AVIVO_EXT1_PPLL_UPDATE_CNTL 0x40c
|
||||
|
||||
#define AVIVO_EXT2_PPLL_REF_DIV_SRC 0x410
|
||||
#define AVIVO_EXT2_PPLL_REF_DIV 0x414
|
||||
#define AVIVO_EXT2_PPLL_UPDATE_LOCK 0x418
|
||||
#define AVIVO_EXT2_PPLL_UPDATE_CNTL 0x41c
|
||||
|
||||
#define AVIVO_EXT1_PPLL_FB_DIV 0x430
|
||||
#define AVIVO_EXT2_PPLL_FB_DIV 0x434
|
||||
|
||||
#define AVIVO_EXT1_PPLL_POST_DIV_SRC 0x438
|
||||
#define AVIVO_EXT1_PPLL_POST_DIV 0x43c
|
||||
|
||||
#define AVIVO_EXT2_PPLL_POST_DIV_SRC 0x440
|
||||
#define AVIVO_EXT2_PPLL_POST_DIV 0x444
|
||||
|
||||
#define AVIVO_EXT1_PPLL_CNTL 0x448
|
||||
#define AVIVO_EXT2_PPLL_CNTL 0x44c
|
||||
|
||||
#define AVIVO_P1PLL_CNTL 0x450
|
||||
#define AVIVO_P2PLL_CNTL 0x454
|
||||
#define AVIVO_P1PLL_INT_SS_CNTL 0x458
|
||||
#define AVIVO_P2PLL_INT_SS_CNTL 0x45c
|
||||
#define AVIVO_P1PLL_TMDSA_CNTL 0x460
|
||||
#define AVIVO_P2PLL_LVTMA_CNTL 0x464
|
||||
|
||||
#define AVIVO_PCLK_CRTC1_CNTL 0x480
|
||||
#define AVIVO_PCLK_CRTC2_CNTL 0x484
|
||||
|
||||
#define AVIVO_D1CRTC_H_TOTAL 0x6000
|
||||
#define AVIVO_D1CRTC_H_BLANK_START_END 0x6004
|
||||
#define AVIVO_D1CRTC_H_SYNC_A 0x6008
|
||||
#define AVIVO_D1CRTC_H_SYNC_A_CNTL 0x600c
|
||||
#define AVIVO_D1CRTC_H_SYNC_B 0x6010
|
||||
#define AVIVO_D1CRTC_H_SYNC_B_CNTL 0x6014
|
||||
|
||||
#define AVIVO_D1CRTC_V_TOTAL 0x6020
|
||||
#define AVIVO_D1CRTC_V_BLANK_START_END 0x6024
|
||||
#define AVIVO_D1CRTC_V_SYNC_A 0x6028
|
||||
#define AVIVO_D1CRTC_V_SYNC_A_CNTL 0x602c
|
||||
#define AVIVO_D1CRTC_V_SYNC_B 0x6030
|
||||
#define AVIVO_D1CRTC_V_SYNC_B_CNTL 0x6034
|
||||
|
||||
#define AVIVO_D1CRTC_CONTROL 0x6080
|
||||
# define AVIVO_CRTC_EN (1 << 0)
|
||||
#define AVIVO_D1CRTC_BLANK_CONTROL 0x6084
|
||||
#define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088
|
||||
#define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c
|
||||
#define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4
|
||||
|
||||
/* master controls */
|
||||
#define AVIVO_DC_CRTC_MASTER_EN 0x60f8
|
||||
#define AVIVO_DC_CRTC_TV_CONTROL 0x60fc
|
||||
|
||||
#define AVIVO_D1GRPH_ENABLE 0x6100
|
||||
#define AVIVO_D1GRPH_CONTROL 0x6104
|
||||
# define AVIVO_D1GRPH_CONTROL_DEPTH_8BPP (0 << 0)
|
||||
# define AVIVO_D1GRPH_CONTROL_DEPTH_16BPP (1 << 0)
|
||||
# define AVIVO_D1GRPH_CONTROL_DEPTH_32BPP (2 << 0)
|
||||
# define AVIVO_D1GRPH_CONTROL_DEPTH_64BPP (3 << 0)
|
||||
|
||||
# define AVIVO_D1GRPH_CONTROL_8BPP_INDEXED (0 << 8)
|
||||
|
||||
# define AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555 (0 << 8)
|
||||
# define AVIVO_D1GRPH_CONTROL_16BPP_RGB565 (1 << 8)
|
||||
# define AVIVO_D1GRPH_CONTROL_16BPP_ARGB4444 (2 << 8)
|
||||
# define AVIVO_D1GRPH_CONTROL_16BPP_AI88 (3 << 8)
|
||||
# define AVIVO_D1GRPH_CONTROL_16BPP_MONO16 (4 << 8)
|
||||
|
||||
# define AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888 (0 << 8)
|
||||
# define AVIVO_D1GRPH_CONTROL_32BPP_ARGB2101010 (1 << 8)
|
||||
# define AVIVO_D1GRPH_CONTROL_32BPP_DIGITAL (2 << 8)
|
||||
# define AVIVO_D1GRPH_CONTROL_32BPP_8B_ARGB2101010 (3 << 8)
|
||||
|
||||
|
||||
# define AVIVO_D1GRPH_CONTROL_64BPP_ARGB16161616 (0 << 8)
|
||||
|
||||
# define AVIVO_D1GRPH_SWAP_RB (1 << 16)
|
||||
# define AVIVO_D1GRPH_TILED (1 << 20)
|
||||
# define AVIVO_D1GRPH_MACRO_ADDRESS_MODE (1 << 21)
|
||||
|
||||
#define AVIVO_D1GRPH_LUT_SEL 0x6108
|
||||
#define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110
|
||||
#define AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS 0x6118
|
||||
#define AVIVO_D1GRPH_PITCH 0x6120
|
||||
#define AVIVO_D1GRPH_SURFACE_OFFSET_X 0x6124
|
||||
#define AVIVO_D1GRPH_SURFACE_OFFSET_Y 0x6128
|
||||
#define AVIVO_D1GRPH_X_START 0x612c
|
||||
#define AVIVO_D1GRPH_Y_START 0x6130
|
||||
#define AVIVO_D1GRPH_X_END 0x6134
|
||||
#define AVIVO_D1GRPH_Y_END 0x6138
|
||||
#define AVIVO_D1GRPH_UPDATE 0x6144
|
||||
# define AVIVO_D1GRPH_UPDATE_LOCK (1 << 16)
|
||||
#define AVIVO_D1GRPH_FLIP_CONTROL 0x6148
|
||||
|
||||
#define AVIVO_D1CUR_CONTROL 0x6400
|
||||
# define AVIVO_D1CURSOR_EN (1 << 0)
|
||||
# define AVIVO_D1CURSOR_MODE_SHIFT 8
|
||||
# define AVIVO_D1CURSOR_MODE_MASK (3 << 8)
|
||||
# define AVIVO_D1CURSOR_MODE_24BPP 2
|
||||
#define AVIVO_D1CUR_SURFACE_ADDRESS 0x6408
|
||||
#define AVIVO_D1CUR_SIZE 0x6410
|
||||
#define AVIVO_D1CUR_POSITION 0x6414
|
||||
#define AVIVO_D1CUR_HOT_SPOT 0x6418
|
||||
#define AVIVO_D1CUR_UPDATE 0x6424
|
||||
# define AVIVO_D1CURSOR_UPDATE_LOCK (1 << 16)
|
||||
|
||||
#define AVIVO_DC_LUT_RW_SELECT 0x6480
|
||||
#define AVIVO_DC_LUT_RW_MODE 0x6484
|
||||
#define AVIVO_DC_LUT_RW_INDEX 0x6488
|
||||
#define AVIVO_DC_LUT_SEQ_COLOR 0x648c
|
||||
#define AVIVO_DC_LUT_PWL_DATA 0x6490
|
||||
#define AVIVO_DC_LUT_30_COLOR 0x6494
|
||||
#define AVIVO_DC_LUT_READ_PIPE_SELECT 0x6498
|
||||
#define AVIVO_DC_LUT_WRITE_EN_MASK 0x649c
|
||||
#define AVIVO_DC_LUT_AUTOFILL 0x64a0
|
||||
|
||||
#define AVIVO_DC_LUTA_CONTROL 0x64c0
|
||||
#define AVIVO_DC_LUTA_BLACK_OFFSET_BLUE 0x64c4
|
||||
#define AVIVO_DC_LUTA_BLACK_OFFSET_GREEN 0x64c8
|
||||
#define AVIVO_DC_LUTA_BLACK_OFFSET_RED 0x64cc
|
||||
#define AVIVO_DC_LUTA_WHITE_OFFSET_BLUE 0x64d0
|
||||
#define AVIVO_DC_LUTA_WHITE_OFFSET_GREEN 0x64d4
|
||||
#define AVIVO_DC_LUTA_WHITE_OFFSET_RED 0x64d8
|
||||
|
||||
#define AVIVO_DC_LB_MEMORY_SPLIT 0x6520
|
||||
# define AVIVO_DC_LB_MEMORY_SPLIT_MASK 0x3
|
||||
# define AVIVO_DC_LB_MEMORY_SPLIT_SHIFT 0
|
||||
# define AVIVO_DC_LB_MEMORY_SPLIT_D1HALF_D2HALF 0
|
||||
# define AVIVO_DC_LB_MEMORY_SPLIT_D1_3Q_D2_1Q 1
|
||||
# define AVIVO_DC_LB_MEMORY_SPLIT_D1_ONLY 2
|
||||
# define AVIVO_DC_LB_MEMORY_SPLIT_D1_1Q_D2_3Q 3
|
||||
# define AVIVO_DC_LB_MEMORY_SPLIT_SHIFT_MODE (1 << 2)
|
||||
# define AVIVO_DC_LB_DISP1_END_ADR_SHIFT 4
|
||||
# define AVIVO_DC_LB_DISP1_END_ADR_MASK 0x7ff
|
||||
|
||||
#define R500_DxMODE_INT_MASK 0x6540
|
||||
#define R500_D1MODE_INT_MASK (1<<0)
|
||||
#define R500_D2MODE_INT_MASK (1<<8)
|
||||
|
||||
#define AVIVO_D1MODE_DATA_FORMAT 0x6528
|
||||
# define AVIVO_D1MODE_INTERLEAVE_EN (1 << 0)
|
||||
#define AVIVO_D1MODE_DESKTOP_HEIGHT 0x652C
|
||||
#define AVIVO_D1MODE_VIEWPORT_START 0x6580
|
||||
#define AVIVO_D1MODE_VIEWPORT_SIZE 0x6584
|
||||
#define AVIVO_D1MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6588
|
||||
#define AVIVO_D1MODE_EXT_OVERSCAN_TOP_BOTTOM 0x658c
|
||||
|
||||
#define AVIVO_D1SCL_SCALER_ENABLE 0x6590
|
||||
#define AVIVO_D1SCL_SCALER_TAP_CONTROL 0x6594
|
||||
#define AVIVO_D1SCL_UPDATE 0x65cc
|
||||
# define AVIVO_D1SCL_UPDATE_LOCK (1 << 16)
|
||||
|
||||
/* second crtc */
|
||||
#define AVIVO_D2CRTC_H_TOTAL 0x6800
|
||||
#define AVIVO_D2CRTC_H_BLANK_START_END 0x6804
|
||||
#define AVIVO_D2CRTC_H_SYNC_A 0x6808
|
||||
#define AVIVO_D2CRTC_H_SYNC_A_CNTL 0x680c
|
||||
#define AVIVO_D2CRTC_H_SYNC_B 0x6810
|
||||
#define AVIVO_D2CRTC_H_SYNC_B_CNTL 0x6814
|
||||
|
||||
#define AVIVO_D2CRTC_V_TOTAL 0x6820
|
||||
#define AVIVO_D2CRTC_V_BLANK_START_END 0x6824
|
||||
#define AVIVO_D2CRTC_V_SYNC_A 0x6828
|
||||
#define AVIVO_D2CRTC_V_SYNC_A_CNTL 0x682c
|
||||
#define AVIVO_D2CRTC_V_SYNC_B 0x6830
|
||||
#define AVIVO_D2CRTC_V_SYNC_B_CNTL 0x6834
|
||||
|
||||
#define AVIVO_D2CRTC_CONTROL 0x6880
|
||||
#define AVIVO_D2CRTC_BLANK_CONTROL 0x6884
|
||||
#define AVIVO_D2CRTC_INTERLACE_CONTROL 0x6888
|
||||
#define AVIVO_D2CRTC_INTERLACE_STATUS 0x688c
|
||||
#define AVIVO_D2CRTC_STEREO_CONTROL 0x68c4
|
||||
|
||||
#define AVIVO_D2GRPH_ENABLE 0x6900
|
||||
#define AVIVO_D2GRPH_CONTROL 0x6904
|
||||
#define AVIVO_D2GRPH_LUT_SEL 0x6908
|
||||
#define AVIVO_D2GRPH_PRIMARY_SURFACE_ADDRESS 0x6910
|
||||
#define AVIVO_D2GRPH_SECONDARY_SURFACE_ADDRESS 0x6918
|
||||
#define AVIVO_D2GRPH_PITCH 0x6920
|
||||
#define AVIVO_D2GRPH_SURFACE_OFFSET_X 0x6924
|
||||
#define AVIVO_D2GRPH_SURFACE_OFFSET_Y 0x6928
|
||||
#define AVIVO_D2GRPH_X_START 0x692c
|
||||
#define AVIVO_D2GRPH_Y_START 0x6930
|
||||
#define AVIVO_D2GRPH_X_END 0x6934
|
||||
#define AVIVO_D2GRPH_Y_END 0x6938
|
||||
#define AVIVO_D2GRPH_UPDATE 0x6944
|
||||
#define AVIVO_D2GRPH_FLIP_CONTROL 0x6948
|
||||
|
||||
#define AVIVO_D2CUR_CONTROL 0x6c00
|
||||
#define AVIVO_D2CUR_SURFACE_ADDRESS 0x6c08
|
||||
#define AVIVO_D2CUR_SIZE 0x6c10
|
||||
#define AVIVO_D2CUR_POSITION 0x6c14
|
||||
|
||||
#define AVIVO_D2MODE_VIEWPORT_START 0x6d80
|
||||
#define AVIVO_D2MODE_VIEWPORT_SIZE 0x6d84
|
||||
#define AVIVO_D2MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6d88
|
||||
#define AVIVO_D2MODE_EXT_OVERSCAN_TOP_BOTTOM 0x6d8c
|
||||
|
||||
#define AVIVO_D2SCL_SCALER_ENABLE 0x6d90
|
||||
#define AVIVO_D2SCL_SCALER_TAP_CONTROL 0x6d94
|
||||
|
||||
#define AVIVO_DDIA_BIT_DEPTH_CONTROL 0x7214
|
||||
|
||||
#define AVIVO_DACA_ENABLE 0x7800
|
||||
# define AVIVO_DAC_ENABLE (1 << 0)
|
||||
#define AVIVO_DACA_SOURCE_SELECT 0x7804
|
||||
# define AVIVO_DAC_SOURCE_CRTC1 (0 << 0)
|
||||
# define AVIVO_DAC_SOURCE_CRTC2 (1 << 0)
|
||||
# define AVIVO_DAC_SOURCE_TV (2 << 0)
|
||||
|
||||
#define AVIVO_DACA_FORCE_OUTPUT_CNTL 0x783c
|
||||
# define AVIVO_DACA_FORCE_OUTPUT_CNTL_FORCE_DATA_EN (1 << 0)
|
||||
# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_SHIFT (8)
|
||||
# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_BLUE (1 << 0)
|
||||
# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_GREEN (1 << 1)
|
||||
# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_RED (1 << 2)
|
||||
# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_ON_BLANKB_ONLY (1 << 24)
|
||||
#define AVIVO_DACA_POWERDOWN 0x7850
|
||||
# define AVIVO_DACA_POWERDOWN_POWERDOWN (1 << 0)
|
||||
# define AVIVO_DACA_POWERDOWN_BLUE (1 << 8)
|
||||
# define AVIVO_DACA_POWERDOWN_GREEN (1 << 16)
|
||||
# define AVIVO_DACA_POWERDOWN_RED (1 << 24)
|
||||
|
||||
#define AVIVO_DACB_ENABLE 0x7a00
|
||||
#define AVIVO_DACB_SOURCE_SELECT 0x7a04
|
||||
#define AVIVO_DACB_FORCE_OUTPUT_CNTL 0x7a3c
|
||||
# define AVIVO_DACB_FORCE_OUTPUT_CNTL_FORCE_DATA_EN (1 << 0)
|
||||
# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_SHIFT (8)
|
||||
# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_BLUE (1 << 0)
|
||||
# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_GREEN (1 << 1)
|
||||
# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_RED (1 << 2)
|
||||
# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_ON_BLANKB_ONLY (1 << 24)
|
||||
#define AVIVO_DACB_POWERDOWN 0x7a50
|
||||
# define AVIVO_DACB_POWERDOWN_POWERDOWN (1 << 0)
|
||||
# define AVIVO_DACB_POWERDOWN_BLUE (1 << 8)
|
||||
# define AVIVO_DACB_POWERDOWN_GREEN (1 << 16)
|
||||
# define AVIVO_DACB_POWERDOWN_RED
|
||||
|
||||
#define AVIVO_TMDSA_CNTL 0x7880
|
||||
# define AVIVO_TMDSA_CNTL_ENABLE (1 << 0)
|
||||
# define AVIVO_TMDSA_CNTL_HPD_MASK (1 << 4)
|
||||
# define AVIVO_TMDSA_CNTL_HPD_SELECT (1 << 8)
|
||||
# define AVIVO_TMDSA_CNTL_SYNC_PHASE (1 << 12)
|
||||
# define AVIVO_TMDSA_CNTL_PIXEL_ENCODING (1 << 16)
|
||||
# define AVIVO_TMDSA_CNTL_DUAL_LINK_ENABLE (1 << 24)
|
||||
# define AVIVO_TMDSA_CNTL_SWAP (1 << 28)
|
||||
#define AVIVO_TMDSA_SOURCE_SELECT 0x7884
|
||||
/* 78a8 appears to be some kind of (reasonably tolerant) clock?
|
||||
* 78d0 definitely hits the transmitter, definitely clock. */
|
||||
/* MYSTERY1 This appears to control dithering? */
|
||||
#define AVIVO_TMDSA_BIT_DEPTH_CONTROL 0x7894
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TRUNCATE_EN (1 << 0)
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TRUNCATE_DEPTH (1 << 4)
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_SPATIAL_DITHER_EN (1 << 8)
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_SPATIAL_DITHER_DEPTH (1 << 12)
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_EN (1 << 16)
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_DEPTH (1 << 20)
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_LEVEL (1 << 24)
|
||||
# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_RESET (1 << 26)
|
||||
#define AVIVO_TMDSA_DCBALANCER_CONTROL 0x78d0
|
||||
# define AVIVO_TMDSA_DCBALANCER_CONTROL_EN (1 << 0)
|
||||
# define AVIVO_TMDSA_DCBALANCER_CONTROL_TEST_EN (1 << 8)
|
||||
# define AVIVO_TMDSA_DCBALANCER_CONTROL_TEST_IN_SHIFT (16)
|
||||
# define AVIVO_TMDSA_DCBALANCER_CONTROL_FORCE (1 << 24)
|
||||
#define AVIVO_TMDSA_DATA_SYNCHRONIZATION 0x78d8
|
||||
# define AVIVO_TMDSA_DATA_SYNCHRONIZATION_DSYNSEL (1 << 0)
|
||||
# define AVIVO_TMDSA_DATA_SYNCHRONIZATION_PFREQCHG (1 << 8)
|
||||
#define AVIVO_TMDSA_CLOCK_ENABLE 0x7900
|
||||
#define AVIVO_TMDSA_TRANSMITTER_ENABLE 0x7904
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_TX0_ENABLE (1 << 0)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKC0EN (1 << 1)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD00EN (1 << 2)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD01EN (1 << 3)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD02EN (1 << 4)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_TX1_ENABLE (1 << 8)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD10EN (1 << 10)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD11EN (1 << 11)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD12EN (1 << 12)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_TX_ENABLE_HPD_MASK (1 << 16)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKCEN_HPD_MASK (1 << 17)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKDEN_HPD_MASK (1 << 18)
|
||||
|
||||
#define AVIVO_TMDSA_TRANSMITTER_CONTROL 0x7910
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_ENABLE (1 << 0)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_RESET (1 << 1)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_HPD_MASK_SHIFT (2)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_IDSCKSEL (1 << 4)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_BGSLEEP (1 << 5)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_PWRUP_SEQ_EN (1 << 6)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TMCLK (1 << 8)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TMCLK_FROM_PADS (1 << 13)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TDCLK (1 << 14)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TDCLK_FROM_PADS (1 << 15)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_CLK_PATTERN_SHIFT (16)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_BYPASS_PLL (1 << 28)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_USE_CLK_DATA (1 << 29)
|
||||
# define AVIVO_TMDSA_TRANSMITTER_CONTROL_INPUT_TEST_CLK_SEL (1 << 31)
|
||||
|
||||
#define AVIVO_LVTMA_CNTL 0x7a80
|
||||
# define AVIVO_LVTMA_CNTL_ENABLE (1 << 0)
|
||||
# define AVIVO_LVTMA_CNTL_HPD_MASK (1 << 4)
|
||||
# define AVIVO_LVTMA_CNTL_HPD_SELECT (1 << 8)
|
||||
# define AVIVO_LVTMA_CNTL_SYNC_PHASE (1 << 12)
|
||||
# define AVIVO_LVTMA_CNTL_PIXEL_ENCODING (1 << 16)
|
||||
# define AVIVO_LVTMA_CNTL_DUAL_LINK_ENABLE (1 << 24)
|
||||
# define AVIVO_LVTMA_CNTL_SWAP (1 << 28)
|
||||
#define AVIVO_LVTMA_SOURCE_SELECT 0x7a84
|
||||
#define AVIVO_LVTMA_COLOR_FORMAT 0x7a88
|
||||
#define AVIVO_LVTMA_BIT_DEPTH_CONTROL 0x7a94
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TRUNCATE_EN (1 << 0)
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TRUNCATE_DEPTH (1 << 4)
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_SPATIAL_DITHER_EN (1 << 8)
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_SPATIAL_DITHER_DEPTH (1 << 12)
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_EN (1 << 16)
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_DEPTH (1 << 20)
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_LEVEL (1 << 24)
|
||||
# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_RESET (1 << 26)
|
||||
|
||||
|
||||
|
||||
#define AVIVO_LVTMA_DCBALANCER_CONTROL 0x7ad0
|
||||
# define AVIVO_LVTMA_DCBALANCER_CONTROL_EN (1 << 0)
|
||||
# define AVIVO_LVTMA_DCBALANCER_CONTROL_TEST_EN (1 << 8)
|
||||
# define AVIVO_LVTMA_DCBALANCER_CONTROL_TEST_IN_SHIFT (16)
|
||||
# define AVIVO_LVTMA_DCBALANCER_CONTROL_FORCE (1 << 24)
|
||||
|
||||
#define AVIVO_LVTMA_DATA_SYNCHRONIZATION 0x78d8
|
||||
# define AVIVO_LVTMA_DATA_SYNCHRONIZATION_DSYNSEL (1 << 0)
|
||||
# define AVIVO_LVTMA_DATA_SYNCHRONIZATION_PFREQCHG (1 << 8)
|
||||
#define R500_LVTMA_CLOCK_ENABLE 0x7b00
|
||||
#define R600_LVTMA_CLOCK_ENABLE 0x7b04
|
||||
|
||||
#define R500_LVTMA_TRANSMITTER_ENABLE 0x7b04
|
||||
#define R600_LVTMA_TRANSMITTER_ENABLE 0x7b08
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKC0EN (1 << 1)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD00EN (1 << 2)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD01EN (1 << 3)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD02EN (1 << 4)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD03EN (1 << 5)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKC1EN (1 << 9)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD10EN (1 << 10)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD11EN (1 << 11)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD12EN (1 << 12)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKCEN_HPD_MASK (1 << 17)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKDEN_HPD_MASK (1 << 18)
|
||||
|
||||
#define R500_LVTMA_TRANSMITTER_CONTROL 0x7b10
|
||||
#define R600_LVTMA_TRANSMITTER_CONTROL 0x7b14
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_ENABLE (1 << 0)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_RESET (1 << 1)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_HPD_MASK_SHIFT (2)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_IDSCKSEL (1 << 4)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_BGSLEEP (1 << 5)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_PWRUP_SEQ_EN (1 << 6)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TMCLK (1 << 8)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TMCLK_FROM_PADS (1 << 13)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TDCLK (1 << 14)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TDCLK_FROM_PADS (1 << 15)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_CLK_PATTERN_SHIFT (16)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_BYPASS_PLL (1 << 28)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_USE_CLK_DATA (1 << 29)
|
||||
# define AVIVO_LVTMA_TRANSMITTER_CONTROL_INPUT_TEST_CLK_SEL (1 << 31)
|
||||
|
||||
#define R500_LVTMA_PWRSEQ_CNTL 0x7af0
|
||||
#define R600_LVTMA_PWRSEQ_CNTL 0x7af4
|
||||
# define AVIVO_LVTMA_PWRSEQ_EN (1 << 0)
|
||||
# define AVIVO_LVTMA_PWRSEQ_PLL_ENABLE_MASK (1 << 2)
|
||||
# define AVIVO_LVTMA_PWRSEQ_PLL_RESET_MASK (1 << 3)
|
||||
# define AVIVO_LVTMA_PWRSEQ_TARGET_STATE (1 << 4)
|
||||
# define AVIVO_LVTMA_SYNCEN (1 << 8)
|
||||
# define AVIVO_LVTMA_SYNCEN_OVRD (1 << 9)
|
||||
# define AVIVO_LVTMA_SYNCEN_POL (1 << 10)
|
||||
# define AVIVO_LVTMA_DIGON (1 << 16)
|
||||
# define AVIVO_LVTMA_DIGON_OVRD (1 << 17)
|
||||
# define AVIVO_LVTMA_DIGON_POL (1 << 18)
|
||||
# define AVIVO_LVTMA_BLON (1 << 24)
|
||||
# define AVIVO_LVTMA_BLON_OVRD (1 << 25)
|
||||
# define AVIVO_LVTMA_BLON_POL (1 << 26)
|
||||
|
||||
#define R500_LVTMA_PWRSEQ_STATE 0x7af4
|
||||
#define R600_LVTMA_PWRSEQ_STATE 0x7af8
|
||||
# define AVIVO_LVTMA_PWRSEQ_STATE_TARGET_STATE_R (1 << 0)
|
||||
# define AVIVO_LVTMA_PWRSEQ_STATE_DIGON (1 << 1)
|
||||
# define AVIVO_LVTMA_PWRSEQ_STATE_SYNCEN (1 << 2)
|
||||
# define AVIVO_LVTMA_PWRSEQ_STATE_BLON (1 << 3)
|
||||
# define AVIVO_LVTMA_PWRSEQ_STATE_DONE (1 << 4)
|
||||
# define AVIVO_LVTMA_PWRSEQ_STATE_STATUS_SHIFT (8)
|
||||
|
||||
#define AVIVO_LVDS_BACKLIGHT_CNTL 0x7af8
|
||||
# define AVIVO_LVDS_BACKLIGHT_CNTL_EN (1 << 0)
|
||||
# define AVIVO_LVDS_BACKLIGHT_LEVEL_MASK 0x0000ff00
|
||||
# define AVIVO_LVDS_BACKLIGHT_LEVEL_SHIFT 8
|
||||
|
||||
#define AVIVO_DVOA_BIT_DEPTH_CONTROL 0x7988
|
||||
|
||||
#define AVIVO_GPIO_0 0x7e30
|
||||
#define AVIVO_GPIO_1 0x7e40
|
||||
#define AVIVO_GPIO_2 0x7e50
|
||||
#define AVIVO_GPIO_3 0x7e60
|
||||
|
||||
#define AVIVO_DC_GPIO_HPD_Y 0x7e9c
|
||||
|
||||
#define AVIVO_I2C_STATUS 0x7d30
|
||||
# define AVIVO_I2C_STATUS_DONE (1 << 0)
|
||||
# define AVIVO_I2C_STATUS_NACK (1 << 1)
|
||||
# define AVIVO_I2C_STATUS_HALT (1 << 2)
|
||||
# define AVIVO_I2C_STATUS_GO (1 << 3)
|
||||
# define AVIVO_I2C_STATUS_MASK 0x7
|
||||
/* If radeon_mm_i2c is to be believed, this is HALT, NACK, and maybe
|
||||
* DONE? */
|
||||
# define AVIVO_I2C_STATUS_CMD_RESET 0x7
|
||||
# define AVIVO_I2C_STATUS_CMD_WAIT (1 << 3)
|
||||
#define AVIVO_I2C_STOP 0x7d34
|
||||
#define AVIVO_I2C_START_CNTL 0x7d38
|
||||
# define AVIVO_I2C_START (1 << 8)
|
||||
# define AVIVO_I2C_CONNECTOR0 (0 << 16)
|
||||
# define AVIVO_I2C_CONNECTOR1 (1 << 16)
|
||||
#define R520_I2C_START (1<<0)
|
||||
#define R520_I2C_STOP (1<<1)
|
||||
#define R520_I2C_RX (1<<2)
|
||||
#define R520_I2C_EN (1<<8)
|
||||
#define R520_I2C_DDC1 (0<<16)
|
||||
#define R520_I2C_DDC2 (1<<16)
|
||||
#define R520_I2C_DDC3 (2<<16)
|
||||
#define R520_I2C_DDC_MASK (3<<16)
|
||||
#define AVIVO_I2C_CONTROL2 0x7d3c
|
||||
# define AVIVO_I2C_7D3C_SIZE_SHIFT 8
|
||||
# define AVIVO_I2C_7D3C_SIZE_MASK (0xf << 8)
|
||||
#define AVIVO_I2C_CONTROL3 0x7d40
|
||||
/* Reading is done 4 bytes at a time: read the bottom 8 bits from
|
||||
* 7d44, four times in a row.
|
||||
* Writing is a little more complex. First write DATA with
|
||||
* 0xnnnnnnzz, then 0xnnnnnnyy, where nnnnnn is some non-deterministic
|
||||
* magic number, zz is, I think, the slave address, and yy is the byte
|
||||
* you want to write. */
|
||||
#define AVIVO_I2C_DATA 0x7d44
|
||||
#define R520_I2C_ADDR_COUNT_MASK (0x7)
|
||||
#define R520_I2C_DATA_COUNT_SHIFT (8)
|
||||
#define R520_I2C_DATA_COUNT_MASK (0xF00)
|
||||
#define AVIVO_I2C_CNTL 0x7d50
|
||||
# define AVIVO_I2C_EN (1 << 0)
|
||||
# define AVIVO_I2C_RESET (1 << 8)
|
||||
|
||||
#endif
|
239
drivers/video/drm/radeon/r520.c
Normal file
239
drivers/video/drm/radeon/r520.c
Normal file
@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
//#include "drmP.h"
|
||||
#include "radeon_reg.h"
|
||||
#include "radeon.h"
|
||||
|
||||
/* r520,rv530,rv560,rv570,r580 depends on : */
|
||||
void r100_hdp_reset(struct radeon_device *rdev);
|
||||
int rv370_pcie_gart_enable(struct radeon_device *rdev);
|
||||
void rv370_pcie_gart_disable(struct radeon_device *rdev);
|
||||
void r420_pipes_init(struct radeon_device *rdev);
|
||||
void rs600_mc_disable_clients(struct radeon_device *rdev);
|
||||
void rs600_disable_vga(struct radeon_device *rdev);
|
||||
int rv515_debugfs_pipes_info_init(struct radeon_device *rdev);
|
||||
int rv515_debugfs_ga_info_init(struct radeon_device *rdev);
|
||||
|
||||
/* This files gather functions specifics to:
|
||||
* r520,rv530,rv560,rv570,r580
|
||||
*
|
||||
* Some of these functions might be used by newer ASICs.
|
||||
*/
|
||||
void r520_gpu_init(struct radeon_device *rdev);
|
||||
int r520_mc_wait_for_idle(struct radeon_device *rdev);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* MC
|
||||
*/
|
||||
int r520_mc_init(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
int r;
|
||||
|
||||
if (r100_debugfs_rbbm_init(rdev)) {
|
||||
DRM_ERROR("Failed to register debugfs file for RBBM !\n");
|
||||
}
|
||||
if (rv515_debugfs_pipes_info_init(rdev)) {
|
||||
DRM_ERROR("Failed to register debugfs file for pipes !\n");
|
||||
}
|
||||
if (rv515_debugfs_ga_info_init(rdev)) {
|
||||
DRM_ERROR("Failed to register debugfs file for pipes !\n");
|
||||
}
|
||||
|
||||
r520_gpu_init(rdev);
|
||||
rv370_pcie_gart_disable(rdev);
|
||||
|
||||
/* Setup GPU memory space */
|
||||
rdev->mc.vram_location = 0xFFFFFFFFUL;
|
||||
rdev->mc.gtt_location = 0xFFFFFFFFUL;
|
||||
if (rdev->flags & RADEON_IS_AGP) {
|
||||
r = radeon_agp_init(rdev);
|
||||
if (r) {
|
||||
printk(KERN_WARNING "[drm] Disabling AGP\n");
|
||||
rdev->flags &= ~RADEON_IS_AGP;
|
||||
rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
|
||||
} else {
|
||||
rdev->mc.gtt_location = rdev->mc.agp_base;
|
||||
}
|
||||
}
|
||||
r = radeon_mc_setup(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Program GPU memory space */
|
||||
rs600_mc_disable_clients(rdev);
|
||||
if (r520_mc_wait_for_idle(rdev)) {
|
||||
printk(KERN_WARNING "Failed to wait MC idle while "
|
||||
"programming pipes. Bad things might happen.\n");
|
||||
}
|
||||
/* Write VRAM size in case we are limiting it */
|
||||
WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
|
||||
tmp = rdev->mc.vram_location + rdev->mc.vram_size - 1;
|
||||
tmp = REG_SET(R520_MC_FB_TOP, tmp >> 16);
|
||||
tmp |= REG_SET(R520_MC_FB_START, rdev->mc.vram_location >> 16);
|
||||
WREG32_MC(R520_MC_FB_LOCATION, tmp);
|
||||
WREG32(RS690_HDP_FB_LOCATION, rdev->mc.vram_location >> 16);
|
||||
WREG32(0x310, rdev->mc.vram_location);
|
||||
if (rdev->flags & RADEON_IS_AGP) {
|
||||
tmp = rdev->mc.gtt_location + rdev->mc.gtt_size - 1;
|
||||
tmp = REG_SET(R520_MC_AGP_TOP, tmp >> 16);
|
||||
tmp |= REG_SET(R520_MC_AGP_START, rdev->mc.gtt_location >> 16);
|
||||
WREG32_MC(R520_MC_AGP_LOCATION, tmp);
|
||||
WREG32_MC(R520_MC_AGP_BASE, rdev->mc.agp_base);
|
||||
WREG32_MC(R520_MC_AGP_BASE_2, 0);
|
||||
} else {
|
||||
WREG32_MC(R520_MC_AGP_LOCATION, 0x0FFFFFFF);
|
||||
WREG32_MC(R520_MC_AGP_BASE, 0);
|
||||
WREG32_MC(R520_MC_AGP_BASE_2, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void r520_mc_fini(struct radeon_device *rdev)
|
||||
{
|
||||
rv370_pcie_gart_disable(rdev);
|
||||
radeon_gart_table_vram_free(rdev);
|
||||
radeon_gart_fini(rdev);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global GPU functions
|
||||
*/
|
||||
void r520_errata(struct radeon_device *rdev)
|
||||
{
|
||||
rdev->pll_errata = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int r520_mc_wait_for_idle(struct radeon_device *rdev)
|
||||
{
|
||||
unsigned i;
|
||||
uint32_t tmp;
|
||||
|
||||
for (i = 0; i < rdev->usec_timeout; i++) {
|
||||
/* read MC_STATUS */
|
||||
tmp = RREG32_MC(R520_MC_STATUS);
|
||||
if (tmp & R520_MC_STATUS_IDLE) {
|
||||
return 0;
|
||||
}
|
||||
DRM_UDELAY(1);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void r520_gpu_init(struct radeon_device *rdev)
|
||||
{
|
||||
unsigned pipe_select_current, gb_pipe_select, tmp;
|
||||
|
||||
r100_hdp_reset(rdev);
|
||||
rs600_disable_vga(rdev);
|
||||
/*
|
||||
* DST_PIPE_CONFIG 0x170C
|
||||
* GB_TILE_CONFIG 0x4018
|
||||
* GB_FIFO_SIZE 0x4024
|
||||
* GB_PIPE_SELECT 0x402C
|
||||
* GB_PIPE_SELECT2 0x4124
|
||||
* Z_PIPE_SHIFT 0
|
||||
* Z_PIPE_MASK 0x000000003
|
||||
* GB_FIFO_SIZE2 0x4128
|
||||
* SC_SFIFO_SIZE_SHIFT 0
|
||||
* SC_SFIFO_SIZE_MASK 0x000000003
|
||||
* SC_MFIFO_SIZE_SHIFT 2
|
||||
* SC_MFIFO_SIZE_MASK 0x00000000C
|
||||
* FG_SFIFO_SIZE_SHIFT 4
|
||||
* FG_SFIFO_SIZE_MASK 0x000000030
|
||||
* ZB_MFIFO_SIZE_SHIFT 6
|
||||
* ZB_MFIFO_SIZE_MASK 0x0000000C0
|
||||
* GA_ENHANCE 0x4274
|
||||
* SU_REG_DEST 0x42C8
|
||||
*/
|
||||
/* workaround for RV530 */
|
||||
if (rdev->family == CHIP_RV530) {
|
||||
WREG32(0x4124, 1);
|
||||
WREG32(0x4128, 0xFF);
|
||||
}
|
||||
r420_pipes_init(rdev);
|
||||
gb_pipe_select = RREG32(0x402C);
|
||||
tmp = RREG32(0x170C);
|
||||
pipe_select_current = (tmp >> 2) & 3;
|
||||
tmp = (1 << pipe_select_current) |
|
||||
(((gb_pipe_select >> 8) & 0xF) << 4);
|
||||
WREG32_PLL(0x000D, tmp);
|
||||
if (r520_mc_wait_for_idle(rdev)) {
|
||||
printk(KERN_WARNING "Failed to wait MC idle while "
|
||||
"programming pipes. Bad things might happen.\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* VRAM info
|
||||
*/
|
||||
static void r520_vram_get_type(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
rdev->mc.vram_width = 128;
|
||||
rdev->mc.vram_is_ddr = true;
|
||||
tmp = RREG32_MC(R520_MC_CNTL0);
|
||||
switch ((tmp & R520_MEM_NUM_CHANNELS_MASK) >> R520_MEM_NUM_CHANNELS_SHIFT) {
|
||||
case 0:
|
||||
rdev->mc.vram_width = 32;
|
||||
break;
|
||||
case 1:
|
||||
rdev->mc.vram_width = 64;
|
||||
break;
|
||||
case 2:
|
||||
rdev->mc.vram_width = 128;
|
||||
break;
|
||||
case 3:
|
||||
rdev->mc.vram_width = 256;
|
||||
break;
|
||||
default:
|
||||
rdev->mc.vram_width = 128;
|
||||
break;
|
||||
}
|
||||
if (tmp & R520_MC_CHANNEL_SIZE)
|
||||
rdev->mc.vram_width *= 2;
|
||||
}
|
||||
|
||||
void r520_vram_info(struct radeon_device *rdev)
|
||||
{
|
||||
r520_vram_get_type(rdev);
|
||||
rdev->mc.vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
|
||||
|
||||
rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
|
||||
rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
|
||||
}
|
||||
|
114
drivers/video/drm/radeon/r600_reg.h
Normal file
114
drivers/video/drm/radeon/r600_reg.h
Normal file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
#ifndef __R600_REG_H__
|
||||
#define __R600_REG_H__
|
||||
|
||||
#define R600_PCIE_PORT_INDEX 0x0038
|
||||
#define R600_PCIE_PORT_DATA 0x003c
|
||||
|
||||
#define R600_MC_VM_FB_LOCATION 0x2180
|
||||
#define R600_MC_FB_BASE_MASK 0x0000FFFF
|
||||
#define R600_MC_FB_BASE_SHIFT 0
|
||||
#define R600_MC_FB_TOP_MASK 0xFFFF0000
|
||||
#define R600_MC_FB_TOP_SHIFT 16
|
||||
#define R600_MC_VM_AGP_TOP 0x2184
|
||||
#define R600_MC_AGP_TOP_MASK 0x0003FFFF
|
||||
#define R600_MC_AGP_TOP_SHIFT 0
|
||||
#define R600_MC_VM_AGP_BOT 0x2188
|
||||
#define R600_MC_AGP_BOT_MASK 0x0003FFFF
|
||||
#define R600_MC_AGP_BOT_SHIFT 0
|
||||
#define R600_MC_VM_AGP_BASE 0x218c
|
||||
#define R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2190
|
||||
#define R600_LOGICAL_PAGE_NUMBER_MASK 0x000FFFFF
|
||||
#define R600_LOGICAL_PAGE_NUMBER_SHIFT 0
|
||||
#define R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2194
|
||||
#define R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x2198
|
||||
|
||||
#define R700_MC_VM_FB_LOCATION 0x2024
|
||||
#define R700_MC_FB_BASE_MASK 0x0000FFFF
|
||||
#define R700_MC_FB_BASE_SHIFT 0
|
||||
#define R700_MC_FB_TOP_MASK 0xFFFF0000
|
||||
#define R700_MC_FB_TOP_SHIFT 16
|
||||
#define R700_MC_VM_AGP_TOP 0x2028
|
||||
#define R700_MC_AGP_TOP_MASK 0x0003FFFF
|
||||
#define R700_MC_AGP_TOP_SHIFT 0
|
||||
#define R700_MC_VM_AGP_BOT 0x202c
|
||||
#define R700_MC_AGP_BOT_MASK 0x0003FFFF
|
||||
#define R700_MC_AGP_BOT_SHIFT 0
|
||||
#define R700_MC_VM_AGP_BASE 0x2030
|
||||
#define R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034
|
||||
#define R700_LOGICAL_PAGE_NUMBER_MASK 0x000FFFFF
|
||||
#define R700_LOGICAL_PAGE_NUMBER_SHIFT 0
|
||||
#define R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038
|
||||
#define R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203c
|
||||
|
||||
#define R600_RAMCFG 0x2408
|
||||
# define R600_CHANSIZE (1 << 7)
|
||||
# define R600_CHANSIZE_OVERRIDE (1 << 10)
|
||||
|
||||
|
||||
#define R600_GENERAL_PWRMGT 0x618
|
||||
# define R600_OPEN_DRAIN_PADS (1 << 11)
|
||||
|
||||
#define R600_LOWER_GPIO_ENABLE 0x710
|
||||
#define R600_CTXSW_VID_LOWER_GPIO_CNTL 0x718
|
||||
#define R600_HIGH_VID_LOWER_GPIO_CNTL 0x71c
|
||||
#define R600_MEDIUM_VID_LOWER_GPIO_CNTL 0x720
|
||||
#define R600_LOW_VID_LOWER_GPIO_CNTL 0x724
|
||||
|
||||
|
||||
|
||||
#define R600_HDP_NONSURFACE_BASE 0x2c04
|
||||
|
||||
#define R600_BUS_CNTL 0x5420
|
||||
#define R600_CONFIG_CNTL 0x5424
|
||||
#define R600_CONFIG_MEMSIZE 0x5428
|
||||
#define R600_CONFIG_F0_BASE 0x542C
|
||||
#define R600_CONFIG_APER_SIZE 0x5430
|
||||
|
||||
#define R600_ROM_CNTL 0x1600
|
||||
# define R600_SCK_OVERWRITE (1 << 1)
|
||||
# define R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT 28
|
||||
# define R600_SCK_PRESCALE_CRYSTAL_CLK_MASK (0xf << 28)
|
||||
|
||||
#define R600_CG_SPLL_FUNC_CNTL 0x600
|
||||
# define R600_SPLL_BYPASS_EN (1 << 3)
|
||||
#define R600_CG_SPLL_STATUS 0x60c
|
||||
# define R600_SPLL_CHG_STATUS (1 << 1)
|
||||
|
||||
#define R600_BIOS_0_SCRATCH 0x1724
|
||||
#define R600_BIOS_1_SCRATCH 0x1728
|
||||
#define R600_BIOS_2_SCRATCH 0x172c
|
||||
#define R600_BIOS_3_SCRATCH 0x1730
|
||||
#define R600_BIOS_4_SCRATCH 0x1734
|
||||
#define R600_BIOS_5_SCRATCH 0x1738
|
||||
#define R600_BIOS_6_SCRATCH 0x173c
|
||||
#define R600_BIOS_7_SCRATCH 0x1740
|
||||
|
||||
|
||||
#endif
|
1217
drivers/video/drm/radeon/radeon.h
Normal file
1217
drivers/video/drm/radeon/radeon.h
Normal file
File diff suppressed because it is too large
Load Diff
435
drivers/video/drm/radeon/radeon_asic.h
Normal file
435
drivers/video/drm/radeon/radeon_asic.h
Normal file
@ -0,0 +1,435 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
#ifndef __RADEON_ASIC_H__
|
||||
#define __RADEON_ASIC_H__
|
||||
|
||||
/*
|
||||
* common functions
|
||||
*/
|
||||
void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock);
|
||||
void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable);
|
||||
|
||||
void radeon_atom_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock);
|
||||
void radeon_atom_set_memory_clock(struct radeon_device *rdev, uint32_t mem_clock);
|
||||
void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable);
|
||||
|
||||
/*
|
||||
* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280
|
||||
*/
|
||||
int r100_init(struct radeon_device *rdev);
|
||||
uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
void r100_errata(struct radeon_device *rdev);
|
||||
void r100_vram_info(struct radeon_device *rdev);
|
||||
int r100_gpu_reset(struct radeon_device *rdev);
|
||||
int r100_mc_init(struct radeon_device *rdev);
|
||||
void r100_mc_fini(struct radeon_device *rdev);
|
||||
int r100_wb_init(struct radeon_device *rdev);
|
||||
void r100_wb_fini(struct radeon_device *rdev);
|
||||
int r100_gart_enable(struct radeon_device *rdev);
|
||||
void r100_pci_gart_disable(struct radeon_device *rdev);
|
||||
void r100_pci_gart_tlb_flush(struct radeon_device *rdev);
|
||||
int r100_pci_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr);
|
||||
int r100_cp_init(struct radeon_device *rdev, unsigned ring_size);
|
||||
void r100_cp_fini(struct radeon_device *rdev);
|
||||
void r100_cp_disable(struct radeon_device *rdev);
|
||||
void r100_ring_start(struct radeon_device *rdev);
|
||||
int r100_irq_set(struct radeon_device *rdev);
|
||||
int r100_irq_process(struct radeon_device *rdev);
|
||||
//void r100_fence_ring_emit(struct radeon_device *rdev,
|
||||
// struct radeon_fence *fence);
|
||||
//int r100_cs_parse(struct radeon_cs_parser *p);
|
||||
void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
uint32_t r100_pll_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
//int r100_copy_blit(struct radeon_device *rdev,
|
||||
// uint64_t src_offset,
|
||||
// uint64_t dst_offset,
|
||||
// unsigned num_pages,
|
||||
// struct radeon_fence *fence);
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
static struct radeon_asic r100_asic = {
|
||||
.init = &r100_init,
|
||||
.errata = &r100_errata,
|
||||
.vram_info = &r100_vram_info,
|
||||
.gpu_reset = &r100_gpu_reset,
|
||||
.mc_init = &r100_mc_init,
|
||||
.mc_fini = &r100_mc_fini,
|
||||
.wb_init = &r100_wb_init,
|
||||
.wb_fini = &r100_wb_fini,
|
||||
.gart_enable = &r100_gart_enable,
|
||||
.gart_disable = &r100_pci_gart_disable,
|
||||
.gart_tlb_flush = &r100_pci_gart_tlb_flush,
|
||||
.gart_set_page = &r100_pci_gart_set_page,
|
||||
.cp_init = &r100_cp_init,
|
||||
.cp_fini = &r100_cp_fini,
|
||||
.cp_disable = &r100_cp_disable,
|
||||
.ring_start = &r100_ring_start,
|
||||
.irq_set = &r100_irq_set,
|
||||
.irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r100_fence_ring_emit,
|
||||
// .cs_parse = &r100_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = NULL,
|
||||
// .copy = &r100_copy_blit,
|
||||
.set_engine_clock = &radeon_legacy_set_engine_clock,
|
||||
.set_memory_clock = NULL,
|
||||
.set_pcie_lanes = NULL,
|
||||
.set_clock_gating = &radeon_legacy_set_clock_gating,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* r300,r350,rv350,rv380
|
||||
*/
|
||||
int r300_init(struct radeon_device *rdev);
|
||||
void r300_errata(struct radeon_device *rdev);
|
||||
void r300_vram_info(struct radeon_device *rdev);
|
||||
int r300_gpu_reset(struct radeon_device *rdev);
|
||||
int r300_mc_init(struct radeon_device *rdev);
|
||||
void r300_mc_fini(struct radeon_device *rdev);
|
||||
void r300_ring_start(struct radeon_device *rdev);
|
||||
//void r300_fence_ring_emit(struct radeon_device *rdev,
|
||||
// struct radeon_fence *fence);
|
||||
//int r300_cs_parse(struct radeon_cs_parser *p);
|
||||
int r300_gart_enable(struct radeon_device *rdev);
|
||||
void rv370_pcie_gart_disable(struct radeon_device *rdev);
|
||||
void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev);
|
||||
int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr);
|
||||
uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes);
|
||||
//int r300_copy_dma(struct radeon_device *rdev,
|
||||
// uint64_t src_offset,
|
||||
// uint64_t dst_offset,
|
||||
// unsigned num_pages,
|
||||
// struct radeon_fence *fence);
|
||||
|
||||
|
||||
static struct radeon_asic r300_asic = {
|
||||
.init = &r300_init,
|
||||
.errata = &r300_errata,
|
||||
.vram_info = &r300_vram_info,
|
||||
.gpu_reset = &r300_gpu_reset,
|
||||
.mc_init = &r300_mc_init,
|
||||
.mc_fini = &r300_mc_fini,
|
||||
.wb_init = &r100_wb_init,
|
||||
.wb_fini = &r100_wb_fini,
|
||||
.gart_enable = &r300_gart_enable,
|
||||
.gart_disable = &r100_pci_gart_disable,
|
||||
.gart_tlb_flush = &r100_pci_gart_tlb_flush,
|
||||
.gart_set_page = &r100_pci_gart_set_page,
|
||||
.cp_init = &r100_cp_init,
|
||||
.cp_fini = &r100_cp_fini,
|
||||
.cp_disable = &r100_cp_disable,
|
||||
.ring_start = &r300_ring_start,
|
||||
.irq_set = &r100_irq_set,
|
||||
.irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r300_fence_ring_emit,
|
||||
// .cs_parse = &r300_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = &r300_copy_dma,
|
||||
// .copy = &r100_copy_blit,
|
||||
.set_engine_clock = &radeon_legacy_set_engine_clock,
|
||||
.set_memory_clock = NULL,
|
||||
.set_pcie_lanes = &rv370_set_pcie_lanes,
|
||||
.set_clock_gating = &radeon_legacy_set_clock_gating,
|
||||
};
|
||||
|
||||
/*
|
||||
* r420,r423,rv410
|
||||
*/
|
||||
void r420_errata(struct radeon_device *rdev);
|
||||
void r420_vram_info(struct radeon_device *rdev);
|
||||
int r420_mc_init(struct radeon_device *rdev);
|
||||
void r420_mc_fini(struct radeon_device *rdev);
|
||||
static struct radeon_asic r420_asic = {
|
||||
.init = &r300_init,
|
||||
.errata = &r420_errata,
|
||||
.vram_info = &r420_vram_info,
|
||||
.gpu_reset = &r300_gpu_reset,
|
||||
.mc_init = &r420_mc_init,
|
||||
.mc_fini = &r420_mc_fini,
|
||||
.wb_init = &r100_wb_init,
|
||||
.wb_fini = &r100_wb_fini,
|
||||
.gart_enable = &r300_gart_enable,
|
||||
.gart_disable = &rv370_pcie_gart_disable,
|
||||
.gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
|
||||
.gart_set_page = &rv370_pcie_gart_set_page,
|
||||
.cp_init = &r100_cp_init,
|
||||
.cp_fini = &r100_cp_fini,
|
||||
.cp_disable = &r100_cp_disable,
|
||||
.ring_start = &r300_ring_start,
|
||||
.irq_set = &r100_irq_set,
|
||||
.irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r300_fence_ring_emit,
|
||||
// .cs_parse = &r300_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = &r300_copy_dma,
|
||||
// .copy = &r100_copy_blit,
|
||||
.set_engine_clock = &radeon_atom_set_engine_clock,
|
||||
.set_memory_clock = &radeon_atom_set_memory_clock,
|
||||
.set_pcie_lanes = &rv370_set_pcie_lanes,
|
||||
.set_clock_gating = &radeon_atom_set_clock_gating,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* rs400,rs480
|
||||
*/
|
||||
void rs400_errata(struct radeon_device *rdev);
|
||||
void rs400_vram_info(struct radeon_device *rdev);
|
||||
int rs400_mc_init(struct radeon_device *rdev);
|
||||
void rs400_mc_fini(struct radeon_device *rdev);
|
||||
int rs400_gart_enable(struct radeon_device *rdev);
|
||||
void rs400_gart_disable(struct radeon_device *rdev);
|
||||
void rs400_gart_tlb_flush(struct radeon_device *rdev);
|
||||
int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr);
|
||||
uint32_t rs400_mc_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
static struct radeon_asic rs400_asic = {
|
||||
.init = &r300_init,
|
||||
.errata = &rs400_errata,
|
||||
.vram_info = &rs400_vram_info,
|
||||
.gpu_reset = &r300_gpu_reset,
|
||||
.mc_init = &rs400_mc_init,
|
||||
.mc_fini = &rs400_mc_fini,
|
||||
.wb_init = &r100_wb_init,
|
||||
.wb_fini = &r100_wb_fini,
|
||||
.gart_enable = &rs400_gart_enable,
|
||||
.gart_disable = &rs400_gart_disable,
|
||||
.gart_tlb_flush = &rs400_gart_tlb_flush,
|
||||
.gart_set_page = &rs400_gart_set_page,
|
||||
.cp_init = &r100_cp_init,
|
||||
.cp_fini = &r100_cp_fini,
|
||||
.cp_disable = &r100_cp_disable,
|
||||
.ring_start = &r300_ring_start,
|
||||
.irq_set = &r100_irq_set,
|
||||
.irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r300_fence_ring_emit,
|
||||
// .cs_parse = &r300_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = &r300_copy_dma,
|
||||
// .copy = &r100_copy_blit,
|
||||
.set_engine_clock = &radeon_legacy_set_engine_clock,
|
||||
.set_memory_clock = NULL,
|
||||
.set_pcie_lanes = NULL,
|
||||
.set_clock_gating = &radeon_legacy_set_clock_gating,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* rs600.
|
||||
*/
|
||||
void rs600_errata(struct radeon_device *rdev);
|
||||
void rs600_vram_info(struct radeon_device *rdev);
|
||||
int rs600_mc_init(struct radeon_device *rdev);
|
||||
void rs600_mc_fini(struct radeon_device *rdev);
|
||||
int rs600_irq_set(struct radeon_device *rdev);
|
||||
int rs600_gart_enable(struct radeon_device *rdev);
|
||||
void rs600_gart_disable(struct radeon_device *rdev);
|
||||
void rs600_gart_tlb_flush(struct radeon_device *rdev);
|
||||
int rs600_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr);
|
||||
uint32_t rs600_mc_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
static struct radeon_asic rs600_asic = {
|
||||
.init = &r300_init,
|
||||
.errata = &rs600_errata,
|
||||
.vram_info = &rs600_vram_info,
|
||||
.gpu_reset = &r300_gpu_reset,
|
||||
.mc_init = &rs600_mc_init,
|
||||
.mc_fini = &rs600_mc_fini,
|
||||
.wb_init = &r100_wb_init,
|
||||
.wb_fini = &r100_wb_fini,
|
||||
.gart_enable = &rs600_gart_enable,
|
||||
.gart_disable = &rs600_gart_disable,
|
||||
.gart_tlb_flush = &rs600_gart_tlb_flush,
|
||||
.gart_set_page = &rs600_gart_set_page,
|
||||
.cp_init = &r100_cp_init,
|
||||
.cp_fini = &r100_cp_fini,
|
||||
.cp_disable = &r100_cp_disable,
|
||||
.ring_start = &r300_ring_start,
|
||||
.irq_set = &rs600_irq_set,
|
||||
.irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r300_fence_ring_emit,
|
||||
// .cs_parse = &r300_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = &r300_copy_dma,
|
||||
// .copy = &r100_copy_blit,
|
||||
.set_engine_clock = &radeon_atom_set_engine_clock,
|
||||
.set_memory_clock = &radeon_atom_set_memory_clock,
|
||||
.set_pcie_lanes = NULL,
|
||||
.set_clock_gating = &radeon_atom_set_clock_gating,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* rs690,rs740
|
||||
*/
|
||||
void rs690_errata(struct radeon_device *rdev);
|
||||
void rs690_vram_info(struct radeon_device *rdev);
|
||||
int rs690_mc_init(struct radeon_device *rdev);
|
||||
void rs690_mc_fini(struct radeon_device *rdev);
|
||||
uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
static struct radeon_asic rs690_asic = {
|
||||
.init = &r300_init,
|
||||
.errata = &rs690_errata,
|
||||
.vram_info = &rs690_vram_info,
|
||||
.gpu_reset = &r300_gpu_reset,
|
||||
.mc_init = &rs690_mc_init,
|
||||
.mc_fini = &rs690_mc_fini,
|
||||
.wb_init = &r100_wb_init,
|
||||
.wb_fini = &r100_wb_fini,
|
||||
.gart_enable = &rs400_gart_enable,
|
||||
.gart_disable = &rs400_gart_disable,
|
||||
.gart_tlb_flush = &rs400_gart_tlb_flush,
|
||||
.gart_set_page = &rs400_gart_set_page,
|
||||
.cp_init = &r100_cp_init,
|
||||
.cp_fini = &r100_cp_fini,
|
||||
.cp_disable = &r100_cp_disable,
|
||||
.ring_start = &r300_ring_start,
|
||||
.irq_set = &rs600_irq_set,
|
||||
.irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r300_fence_ring_emit,
|
||||
// .cs_parse = &r300_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = &r300_copy_dma,
|
||||
// .copy = &r300_copy_dma,
|
||||
.set_engine_clock = &radeon_atom_set_engine_clock,
|
||||
.set_memory_clock = &radeon_atom_set_memory_clock,
|
||||
.set_pcie_lanes = NULL,
|
||||
.set_clock_gating = &radeon_atom_set_clock_gating,
|
||||
};
|
||||
|
||||
#endif
|
||||
/*
|
||||
* rv515
|
||||
*/
|
||||
int rv515_init(struct radeon_device *rdev);
|
||||
void rv515_errata(struct radeon_device *rdev);
|
||||
void rv515_vram_info(struct radeon_device *rdev);
|
||||
int rv515_gpu_reset(struct radeon_device *rdev);
|
||||
int rv515_mc_init(struct radeon_device *rdev);
|
||||
void rv515_mc_fini(struct radeon_device *rdev);
|
||||
uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
void rv515_ring_start(struct radeon_device *rdev);
|
||||
uint32_t rv515_pcie_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void rv515_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
|
||||
/*
|
||||
static struct radeon_asic rv515_asic = {
|
||||
.init = &rv515_init,
|
||||
.errata = &rv515_errata,
|
||||
.vram_info = &rv515_vram_info,
|
||||
.gpu_reset = &rv515_gpu_reset,
|
||||
.mc_init = &rv515_mc_init,
|
||||
.mc_fini = &rv515_mc_fini,
|
||||
.wb_init = &r100_wb_init,
|
||||
.wb_fini = &r100_wb_fini,
|
||||
.gart_enable = &r300_gart_enable,
|
||||
.gart_disable = &rv370_pcie_gart_disable,
|
||||
.gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
|
||||
.gart_set_page = &rv370_pcie_gart_set_page,
|
||||
.cp_init = &r100_cp_init,
|
||||
.cp_fini = &r100_cp_fini,
|
||||
.cp_disable = &r100_cp_disable,
|
||||
.ring_start = &rv515_ring_start,
|
||||
.irq_set = &r100_irq_set,
|
||||
.irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r300_fence_ring_emit,
|
||||
// .cs_parse = &r300_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = &r300_copy_dma,
|
||||
// .copy = &r100_copy_blit,
|
||||
.set_engine_clock = &radeon_atom_set_engine_clock,
|
||||
.set_memory_clock = &radeon_atom_set_memory_clock,
|
||||
.set_pcie_lanes = &rv370_set_pcie_lanes,
|
||||
.set_clock_gating = &radeon_atom_set_clock_gating,
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int r300_gart_enable(struct radeon_device *rdev);
|
||||
void rv370_pcie_gart_disable(struct radeon_device *rdev);
|
||||
void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev);
|
||||
int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr);
|
||||
uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes);
|
||||
|
||||
|
||||
/*
|
||||
* r520,rv530,rv560,rv570,r580
|
||||
*/
|
||||
void r520_errata(struct radeon_device *rdev);
|
||||
void r520_vram_info(struct radeon_device *rdev);
|
||||
int r520_mc_init(struct radeon_device *rdev);
|
||||
void r520_mc_fini(struct radeon_device *rdev);
|
||||
|
||||
static struct radeon_asic r520_asic = {
|
||||
.init = &rv515_init,
|
||||
.errata = &r520_errata,
|
||||
.vram_info = &r520_vram_info,
|
||||
.gpu_reset = &rv515_gpu_reset,
|
||||
// .mc_init = &r520_mc_init,
|
||||
// .mc_fini = &r520_mc_fini,
|
||||
// .wb_init = &r100_wb_init,
|
||||
// .wb_fini = &r100_wb_fini,
|
||||
// .gart_enable = &r300_gart_enable,
|
||||
// .gart_disable = &rv370_pcie_gart_disable,
|
||||
// .gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
|
||||
// .gart_set_page = &rv370_pcie_gart_set_page,
|
||||
// .cp_init = &r100_cp_init,
|
||||
// .cp_fini = &r100_cp_fini,
|
||||
// .cp_disable = &r100_cp_disable,
|
||||
// .ring_start = &rv515_ring_start,
|
||||
// .irq_set = &r100_irq_set,
|
||||
// .irq_process = &r100_irq_process,
|
||||
// .fence_ring_emit = &r300_fence_ring_emit,
|
||||
// .cs_parse = &r300_cs_parse,
|
||||
// .copy_blit = &r100_copy_blit,
|
||||
// .copy_dma = &r300_copy_dma,
|
||||
// .copy = &r100_copy_blit,
|
||||
// .set_engine_clock = &radeon_atom_set_engine_clock,
|
||||
// .set_memory_clock = &radeon_atom_set_memory_clock,
|
||||
// .set_pcie_lanes = &rv370_set_pcie_lanes,
|
||||
// .set_clock_gating = &radeon_atom_set_clock_gating,
|
||||
};
|
||||
|
||||
/*
|
||||
* r600,rv610,rv630,rv620,rv635,rv670,rs780,rv770,rv730,rv710
|
||||
*/
|
||||
uint32_t r600_pciep_rreg(struct radeon_device *rdev, uint32_t reg);
|
||||
void r600_pciep_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
|
||||
|
||||
#endif
|
1298
drivers/video/drm/radeon/radeon_atombios.c
Normal file
1298
drivers/video/drm/radeon/radeon_atombios.c
Normal file
File diff suppressed because it is too large
Load Diff
397
drivers/video/drm/radeon/radeon_bios.c
Normal file
397
drivers/video/drm/radeon/radeon_bios.c
Normal file
@ -0,0 +1,397 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
//#include "drmP.h"
|
||||
#include "radeon_reg.h"
|
||||
#include "radeon.h"
|
||||
#include "atom.h"
|
||||
|
||||
/*
|
||||
* BIOS.
|
||||
*/
|
||||
static bool radeon_read_bios(struct radeon_device *rdev)
|
||||
{
|
||||
uint8_t *bios;
|
||||
size_t size;
|
||||
|
||||
rdev->bios = NULL;
|
||||
bios = pci_map_rom(rdev->pdev, &size);
|
||||
if (!bios) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
|
||||
// pci_unmap_rom(rdev->pdev, bios);
|
||||
return false;
|
||||
}
|
||||
rdev->bios = malloc(size);
|
||||
if (rdev->bios == NULL) {
|
||||
// pci_unmap_rom(rdev->pdev, bios);
|
||||
return false;
|
||||
}
|
||||
memcpy(rdev->bios, bios, size);
|
||||
// pci_unmap_rom(rdev->pdev, bios);
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
static bool r700_read_disabled_bios(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t viph_control;
|
||||
uint32_t bus_cntl;
|
||||
uint32_t d1vga_control;
|
||||
uint32_t d2vga_control;
|
||||
uint32_t vga_render_control;
|
||||
uint32_t rom_cntl;
|
||||
uint32_t cg_spll_func_cntl = 0;
|
||||
uint32_t cg_spll_status;
|
||||
bool r;
|
||||
|
||||
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
||||
bus_cntl = RREG32(RADEON_BUS_CNTL);
|
||||
d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
|
||||
d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
|
||||
vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
|
||||
rom_cntl = RREG32(R600_ROM_CNTL);
|
||||
|
||||
/* disable VIP */
|
||||
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
||||
/* enable the rom */
|
||||
WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM));
|
||||
/* Disable VGA mode */
|
||||
WREG32(AVIVO_D1VGA_CONTROL,
|
||||
(d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
||||
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
||||
WREG32(AVIVO_D2VGA_CONTROL,
|
||||
(d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
||||
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
||||
WREG32(AVIVO_VGA_RENDER_CONTROL,
|
||||
(vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
|
||||
|
||||
if (rdev->family == CHIP_RV730) {
|
||||
cg_spll_func_cntl = RREG32(R600_CG_SPLL_FUNC_CNTL);
|
||||
|
||||
/* enable bypass mode */
|
||||
WREG32(R600_CG_SPLL_FUNC_CNTL, (cg_spll_func_cntl |
|
||||
R600_SPLL_BYPASS_EN));
|
||||
|
||||
/* wait for SPLL_CHG_STATUS to change to 1 */
|
||||
cg_spll_status = 0;
|
||||
while (!(cg_spll_status & R600_SPLL_CHG_STATUS))
|
||||
cg_spll_status = RREG32(R600_CG_SPLL_STATUS);
|
||||
|
||||
WREG32(R600_ROM_CNTL, (rom_cntl & ~R600_SCK_OVERWRITE));
|
||||
} else
|
||||
WREG32(R600_ROM_CNTL, (rom_cntl | R600_SCK_OVERWRITE));
|
||||
|
||||
r = radeon_read_bios(rdev);
|
||||
|
||||
/* restore regs */
|
||||
if (rdev->family == CHIP_RV730) {
|
||||
WREG32(R600_CG_SPLL_FUNC_CNTL, cg_spll_func_cntl);
|
||||
|
||||
/* wait for SPLL_CHG_STATUS to change to 1 */
|
||||
cg_spll_status = 0;
|
||||
while (!(cg_spll_status & R600_SPLL_CHG_STATUS))
|
||||
cg_spll_status = RREG32(R600_CG_SPLL_STATUS);
|
||||
}
|
||||
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
||||
WREG32(RADEON_BUS_CNTL, bus_cntl);
|
||||
WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
|
||||
WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
|
||||
WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
|
||||
WREG32(R600_ROM_CNTL, rom_cntl);
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool r600_read_disabled_bios(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t viph_control;
|
||||
uint32_t bus_cntl;
|
||||
uint32_t d1vga_control;
|
||||
uint32_t d2vga_control;
|
||||
uint32_t vga_render_control;
|
||||
uint32_t rom_cntl;
|
||||
uint32_t general_pwrmgt;
|
||||
uint32_t low_vid_lower_gpio_cntl;
|
||||
uint32_t medium_vid_lower_gpio_cntl;
|
||||
uint32_t high_vid_lower_gpio_cntl;
|
||||
uint32_t ctxsw_vid_lower_gpio_cntl;
|
||||
uint32_t lower_gpio_enable;
|
||||
bool r;
|
||||
|
||||
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
||||
bus_cntl = RREG32(RADEON_BUS_CNTL);
|
||||
d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
|
||||
d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
|
||||
vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
|
||||
rom_cntl = RREG32(R600_ROM_CNTL);
|
||||
general_pwrmgt = RREG32(R600_GENERAL_PWRMGT);
|
||||
low_vid_lower_gpio_cntl = RREG32(R600_LOW_VID_LOWER_GPIO_CNTL);
|
||||
medium_vid_lower_gpio_cntl = RREG32(R600_MEDIUM_VID_LOWER_GPIO_CNTL);
|
||||
high_vid_lower_gpio_cntl = RREG32(R600_HIGH_VID_LOWER_GPIO_CNTL);
|
||||
ctxsw_vid_lower_gpio_cntl = RREG32(R600_CTXSW_VID_LOWER_GPIO_CNTL);
|
||||
lower_gpio_enable = RREG32(R600_LOWER_GPIO_ENABLE);
|
||||
|
||||
/* disable VIP */
|
||||
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
||||
/* enable the rom */
|
||||
WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM));
|
||||
/* Disable VGA mode */
|
||||
WREG32(AVIVO_D1VGA_CONTROL,
|
||||
(d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
||||
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
||||
WREG32(AVIVO_D2VGA_CONTROL,
|
||||
(d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
||||
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
||||
WREG32(AVIVO_VGA_RENDER_CONTROL,
|
||||
(vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
|
||||
|
||||
WREG32(R600_ROM_CNTL,
|
||||
((rom_cntl & ~R600_SCK_PRESCALE_CRYSTAL_CLK_MASK) |
|
||||
(1 << R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT) |
|
||||
R600_SCK_OVERWRITE));
|
||||
|
||||
WREG32(R600_GENERAL_PWRMGT, (general_pwrmgt & ~R600_OPEN_DRAIN_PADS));
|
||||
WREG32(R600_LOW_VID_LOWER_GPIO_CNTL,
|
||||
(low_vid_lower_gpio_cntl & ~0x400));
|
||||
WREG32(R600_MEDIUM_VID_LOWER_GPIO_CNTL,
|
||||
(medium_vid_lower_gpio_cntl & ~0x400));
|
||||
WREG32(R600_HIGH_VID_LOWER_GPIO_CNTL,
|
||||
(high_vid_lower_gpio_cntl & ~0x400));
|
||||
WREG32(R600_CTXSW_VID_LOWER_GPIO_CNTL,
|
||||
(ctxsw_vid_lower_gpio_cntl & ~0x400));
|
||||
WREG32(R600_LOWER_GPIO_ENABLE, (lower_gpio_enable | 0x400));
|
||||
|
||||
r = radeon_read_bios(rdev);
|
||||
|
||||
/* restore regs */
|
||||
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
||||
WREG32(RADEON_BUS_CNTL, bus_cntl);
|
||||
WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
|
||||
WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
|
||||
WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
|
||||
WREG32(R600_ROM_CNTL, rom_cntl);
|
||||
WREG32(R600_GENERAL_PWRMGT, general_pwrmgt);
|
||||
WREG32(R600_LOW_VID_LOWER_GPIO_CNTL, low_vid_lower_gpio_cntl);
|
||||
WREG32(R600_MEDIUM_VID_LOWER_GPIO_CNTL, medium_vid_lower_gpio_cntl);
|
||||
WREG32(R600_HIGH_VID_LOWER_GPIO_CNTL, high_vid_lower_gpio_cntl);
|
||||
WREG32(R600_CTXSW_VID_LOWER_GPIO_CNTL, ctxsw_vid_lower_gpio_cntl);
|
||||
WREG32(R600_LOWER_GPIO_ENABLE, lower_gpio_enable);
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool avivo_read_disabled_bios(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t seprom_cntl1;
|
||||
uint32_t viph_control;
|
||||
uint32_t bus_cntl;
|
||||
uint32_t d1vga_control;
|
||||
uint32_t d2vga_control;
|
||||
uint32_t vga_render_control;
|
||||
uint32_t gpiopad_a;
|
||||
uint32_t gpiopad_en;
|
||||
uint32_t gpiopad_mask;
|
||||
bool r;
|
||||
|
||||
seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1);
|
||||
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
||||
bus_cntl = RREG32(RADEON_BUS_CNTL);
|
||||
d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
|
||||
d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
|
||||
vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
|
||||
gpiopad_a = RREG32(RADEON_GPIOPAD_A);
|
||||
gpiopad_en = RREG32(RADEON_GPIOPAD_EN);
|
||||
gpiopad_mask = RREG32(RADEON_GPIOPAD_MASK);
|
||||
|
||||
WREG32(RADEON_SEPROM_CNTL1,
|
||||
((seprom_cntl1 & ~RADEON_SCK_PRESCALE_MASK) |
|
||||
(0xc << RADEON_SCK_PRESCALE_SHIFT)));
|
||||
WREG32(RADEON_GPIOPAD_A, 0);
|
||||
WREG32(RADEON_GPIOPAD_EN, 0);
|
||||
WREG32(RADEON_GPIOPAD_MASK, 0);
|
||||
|
||||
/* disable VIP */
|
||||
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
||||
|
||||
/* enable the rom */
|
||||
WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM));
|
||||
|
||||
/* Disable VGA mode */
|
||||
WREG32(AVIVO_D1VGA_CONTROL,
|
||||
(d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
||||
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
||||
WREG32(AVIVO_D2VGA_CONTROL,
|
||||
(d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
||||
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
||||
WREG32(AVIVO_VGA_RENDER_CONTROL,
|
||||
(vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
|
||||
|
||||
r = radeon_read_bios(rdev);
|
||||
|
||||
/* restore regs */
|
||||
WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1);
|
||||
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
||||
WREG32(RADEON_BUS_CNTL, bus_cntl);
|
||||
WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
|
||||
WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
|
||||
WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
|
||||
WREG32(RADEON_GPIOPAD_A, gpiopad_a);
|
||||
WREG32(RADEON_GPIOPAD_EN, gpiopad_en);
|
||||
WREG32(RADEON_GPIOPAD_MASK, gpiopad_mask);
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool legacy_read_disabled_bios(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t seprom_cntl1;
|
||||
uint32_t viph_control;
|
||||
uint32_t bus_cntl;
|
||||
uint32_t crtc_gen_cntl;
|
||||
uint32_t crtc2_gen_cntl;
|
||||
uint32_t crtc_ext_cntl;
|
||||
uint32_t fp2_gen_cntl;
|
||||
bool r;
|
||||
|
||||
seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1);
|
||||
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
||||
bus_cntl = RREG32(RADEON_BUS_CNTL);
|
||||
crtc_gen_cntl = RREG32(RADEON_CRTC_GEN_CNTL);
|
||||
crtc2_gen_cntl = 0;
|
||||
crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
|
||||
fp2_gen_cntl = 0;
|
||||
|
||||
if (rdev->ddev->pci_device == PCI_DEVICE_ID_ATI_RADEON_QY) {
|
||||
fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL);
|
||||
}
|
||||
|
||||
if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
|
||||
crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
|
||||
}
|
||||
|
||||
WREG32(RADEON_SEPROM_CNTL1,
|
||||
((seprom_cntl1 & ~RADEON_SCK_PRESCALE_MASK) |
|
||||
(0xc << RADEON_SCK_PRESCALE_SHIFT)));
|
||||
|
||||
/* disable VIP */
|
||||
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
||||
|
||||
/* enable the rom */
|
||||
WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM));
|
||||
|
||||
/* Turn off mem requests and CRTC for both controllers */
|
||||
WREG32(RADEON_CRTC_GEN_CNTL,
|
||||
((crtc_gen_cntl & ~RADEON_CRTC_EN) |
|
||||
(RADEON_CRTC_DISP_REQ_EN_B |
|
||||
RADEON_CRTC_EXT_DISP_EN)));
|
||||
if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
|
||||
WREG32(RADEON_CRTC2_GEN_CNTL,
|
||||
((crtc2_gen_cntl & ~RADEON_CRTC2_EN) |
|
||||
RADEON_CRTC2_DISP_REQ_EN_B));
|
||||
}
|
||||
/* Turn off CRTC */
|
||||
WREG32(RADEON_CRTC_EXT_CNTL,
|
||||
((crtc_ext_cntl & ~RADEON_CRTC_CRT_ON) |
|
||||
(RADEON_CRTC_SYNC_TRISTAT |
|
||||
RADEON_CRTC_DISPLAY_DIS)));
|
||||
|
||||
if (rdev->ddev->pci_device == PCI_DEVICE_ID_ATI_RADEON_QY) {
|
||||
WREG32(RADEON_FP2_GEN_CNTL, (fp2_gen_cntl & ~RADEON_FP2_ON));
|
||||
}
|
||||
|
||||
r = radeon_read_bios(rdev);
|
||||
|
||||
/* restore regs */
|
||||
WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1);
|
||||
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
||||
WREG32(RADEON_BUS_CNTL, bus_cntl);
|
||||
WREG32(RADEON_CRTC_GEN_CNTL, crtc_gen_cntl);
|
||||
if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
|
||||
WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
|
||||
}
|
||||
WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
|
||||
if (rdev->ddev->pci_device == PCI_DEVICE_ID_ATI_RADEON_QY) {
|
||||
WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool radeon_read_disabled_bios(struct radeon_device *rdev)
|
||||
{
|
||||
if (rdev->family >= CHIP_RV770)
|
||||
return r700_read_disabled_bios(rdev);
|
||||
else if (rdev->family >= CHIP_R600)
|
||||
return r600_read_disabled_bios(rdev);
|
||||
else if (rdev->family >= CHIP_RS600)
|
||||
return avivo_read_disabled_bios(rdev);
|
||||
else
|
||||
return legacy_read_disabled_bios(rdev);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
bool radeon_get_bios(struct radeon_device *rdev)
|
||||
{
|
||||
bool r;
|
||||
uint16_t tmp;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
r = radeon_read_bios(rdev);
|
||||
// if (r == false) {
|
||||
// r = radeon_read_disabled_bios(rdev);
|
||||
// }
|
||||
if (r == false || rdev->bios == NULL) {
|
||||
DRM_ERROR("Unable to locate a BIOS ROM\n");
|
||||
rdev->bios = NULL;
|
||||
return false;
|
||||
}
|
||||
if (rdev->bios[0] != 0x55 || rdev->bios[1] != 0xaa) {
|
||||
goto free_bios;
|
||||
}
|
||||
|
||||
rdev->bios_header_start = RBIOS16(0x48);
|
||||
if (!rdev->bios_header_start) {
|
||||
goto free_bios;
|
||||
}
|
||||
tmp = rdev->bios_header_start + 4;
|
||||
if (!memcmp(rdev->bios + tmp, "ATOM", 4) ||
|
||||
!memcmp(rdev->bios + tmp, "MOTA", 4)) {
|
||||
rdev->is_atom_bios = true;
|
||||
} else {
|
||||
rdev->is_atom_bios = false;
|
||||
}
|
||||
|
||||
dbgprintf("%sBIOS detected\n", rdev->is_atom_bios ? "ATOM" : "COM");
|
||||
return true;
|
||||
free_bios:
|
||||
kfree(rdev->bios);
|
||||
rdev->bios = NULL;
|
||||
return false;
|
||||
}
|
833
drivers/video/drm/radeon/radeon_clocks.c
Normal file
833
drivers/video/drm/radeon/radeon_clocks.c
Normal file
@ -0,0 +1,833 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
//#include "drmP.h"
|
||||
#include "radeon_drm.h"
|
||||
#include "radeon_reg.h"
|
||||
#include "radeon.h"
|
||||
#include "atom.h"
|
||||
|
||||
/* 10 khz */
|
||||
static uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev)
|
||||
{
|
||||
struct radeon_pll *spll = &rdev->clock.spll;
|
||||
uint32_t fb_div, ref_div, post_div, sclk;
|
||||
|
||||
fb_div = RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV);
|
||||
fb_div = (fb_div >> RADEON_SPLL_FB_DIV_SHIFT) & RADEON_SPLL_FB_DIV_MASK;
|
||||
fb_div <<= 1;
|
||||
fb_div *= spll->reference_freq;
|
||||
|
||||
ref_div =
|
||||
RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) & RADEON_M_SPLL_REF_DIV_MASK;
|
||||
sclk = fb_div / ref_div;
|
||||
|
||||
post_div = RREG32_PLL(RADEON_SCLK_CNTL) & RADEON_SCLK_SRC_SEL_MASK;
|
||||
if (post_div == 2)
|
||||
sclk >>= 1;
|
||||
else if (post_div == 3)
|
||||
sclk >>= 2;
|
||||
else if (post_div == 4)
|
||||
sclk >>= 4;
|
||||
|
||||
return sclk;
|
||||
}
|
||||
|
||||
/* 10 khz */
|
||||
static uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev)
|
||||
{
|
||||
struct radeon_pll *mpll = &rdev->clock.mpll;
|
||||
uint32_t fb_div, ref_div, post_div, mclk;
|
||||
|
||||
fb_div = RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV);
|
||||
fb_div = (fb_div >> RADEON_MPLL_FB_DIV_SHIFT) & RADEON_MPLL_FB_DIV_MASK;
|
||||
fb_div <<= 1;
|
||||
fb_div *= mpll->reference_freq;
|
||||
|
||||
ref_div =
|
||||
RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) & RADEON_M_SPLL_REF_DIV_MASK;
|
||||
mclk = fb_div / ref_div;
|
||||
|
||||
post_div = RREG32_PLL(RADEON_MCLK_CNTL) & 0x7;
|
||||
if (post_div == 2)
|
||||
mclk >>= 1;
|
||||
else if (post_div == 3)
|
||||
mclk >>= 2;
|
||||
else if (post_div == 4)
|
||||
mclk >>= 4;
|
||||
|
||||
return mclk;
|
||||
}
|
||||
|
||||
void radeon_get_clock_info(struct drm_device *dev)
|
||||
{
|
||||
struct radeon_device *rdev = dev->dev_private;
|
||||
struct radeon_pll *p1pll = &rdev->clock.p1pll;
|
||||
struct radeon_pll *p2pll = &rdev->clock.p2pll;
|
||||
struct radeon_pll *spll = &rdev->clock.spll;
|
||||
struct radeon_pll *mpll = &rdev->clock.mpll;
|
||||
int ret;
|
||||
|
||||
if (rdev->is_atom_bios)
|
||||
ret = radeon_atom_get_clock_info(dev);
|
||||
// else
|
||||
// ret = radeon_combios_get_clock_info(dev);
|
||||
|
||||
if (ret) {
|
||||
if (p1pll->reference_div < 2)
|
||||
p1pll->reference_div = 12;
|
||||
if (p2pll->reference_div < 2)
|
||||
p2pll->reference_div = 12;
|
||||
if (spll->reference_div < 2)
|
||||
spll->reference_div =
|
||||
RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) &
|
||||
RADEON_M_SPLL_REF_DIV_MASK;
|
||||
if (mpll->reference_div < 2)
|
||||
mpll->reference_div = spll->reference_div;
|
||||
} else {
|
||||
if (ASIC_IS_AVIVO(rdev)) {
|
||||
/* TODO FALLBACK */
|
||||
} else {
|
||||
DRM_INFO("Using generic clock info\n");
|
||||
|
||||
if (rdev->flags & RADEON_IS_IGP) {
|
||||
p1pll->reference_freq = 1432;
|
||||
p2pll->reference_freq = 1432;
|
||||
spll->reference_freq = 1432;
|
||||
mpll->reference_freq = 1432;
|
||||
} else {
|
||||
p1pll->reference_freq = 2700;
|
||||
p2pll->reference_freq = 2700;
|
||||
spll->reference_freq = 2700;
|
||||
mpll->reference_freq = 2700;
|
||||
}
|
||||
p1pll->reference_div =
|
||||
RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff;
|
||||
if (p1pll->reference_div < 2)
|
||||
p1pll->reference_div = 12;
|
||||
p2pll->reference_div = p1pll->reference_div;
|
||||
|
||||
if (rdev->family >= CHIP_R420) {
|
||||
p1pll->pll_in_min = 100;
|
||||
p1pll->pll_in_max = 1350;
|
||||
p1pll->pll_out_min = 20000;
|
||||
p1pll->pll_out_max = 50000;
|
||||
p2pll->pll_in_min = 100;
|
||||
p2pll->pll_in_max = 1350;
|
||||
p2pll->pll_out_min = 20000;
|
||||
p2pll->pll_out_max = 50000;
|
||||
} else {
|
||||
p1pll->pll_in_min = 40;
|
||||
p1pll->pll_in_max = 500;
|
||||
p1pll->pll_out_min = 12500;
|
||||
p1pll->pll_out_max = 35000;
|
||||
p2pll->pll_in_min = 40;
|
||||
p2pll->pll_in_max = 500;
|
||||
p2pll->pll_out_min = 12500;
|
||||
p2pll->pll_out_max = 35000;
|
||||
}
|
||||
|
||||
spll->reference_div =
|
||||
RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) &
|
||||
RADEON_M_SPLL_REF_DIV_MASK;
|
||||
mpll->reference_div = spll->reference_div;
|
||||
rdev->clock.default_sclk =
|
||||
radeon_legacy_get_engine_clock(rdev);
|
||||
rdev->clock.default_mclk =
|
||||
radeon_legacy_get_memory_clock(rdev);
|
||||
}
|
||||
}
|
||||
|
||||
/* pixel clocks */
|
||||
if (ASIC_IS_AVIVO(rdev)) {
|
||||
p1pll->min_post_div = 2;
|
||||
p1pll->max_post_div = 0x7f;
|
||||
p1pll->min_frac_feedback_div = 0;
|
||||
p1pll->max_frac_feedback_div = 9;
|
||||
p2pll->min_post_div = 2;
|
||||
p2pll->max_post_div = 0x7f;
|
||||
p2pll->min_frac_feedback_div = 0;
|
||||
p2pll->max_frac_feedback_div = 9;
|
||||
} else {
|
||||
p1pll->min_post_div = 1;
|
||||
p1pll->max_post_div = 16;
|
||||
p1pll->min_frac_feedback_div = 0;
|
||||
p1pll->max_frac_feedback_div = 0;
|
||||
p2pll->min_post_div = 1;
|
||||
p2pll->max_post_div = 12;
|
||||
p2pll->min_frac_feedback_div = 0;
|
||||
p2pll->max_frac_feedback_div = 0;
|
||||
}
|
||||
|
||||
p1pll->min_ref_div = 2;
|
||||
p1pll->max_ref_div = 0x3ff;
|
||||
p1pll->min_feedback_div = 4;
|
||||
p1pll->max_feedback_div = 0x7ff;
|
||||
p1pll->best_vco = 0;
|
||||
|
||||
p2pll->min_ref_div = 2;
|
||||
p2pll->max_ref_div = 0x3ff;
|
||||
p2pll->min_feedback_div = 4;
|
||||
p2pll->max_feedback_div = 0x7ff;
|
||||
p2pll->best_vco = 0;
|
||||
|
||||
/* system clock */
|
||||
spll->min_post_div = 1;
|
||||
spll->max_post_div = 1;
|
||||
spll->min_ref_div = 2;
|
||||
spll->max_ref_div = 0xff;
|
||||
spll->min_feedback_div = 4;
|
||||
spll->max_feedback_div = 0xff;
|
||||
spll->best_vco = 0;
|
||||
|
||||
/* memory clock */
|
||||
mpll->min_post_div = 1;
|
||||
mpll->max_post_div = 1;
|
||||
mpll->min_ref_div = 2;
|
||||
mpll->max_ref_div = 0xff;
|
||||
mpll->min_feedback_div = 4;
|
||||
mpll->max_feedback_div = 0xff;
|
||||
mpll->best_vco = 0;
|
||||
|
||||
}
|
||||
|
||||
/* 10 khz */
|
||||
static uint32_t calc_eng_mem_clock(struct radeon_device *rdev,
|
||||
uint32_t req_clock,
|
||||
int *fb_div, int *post_div)
|
||||
{
|
||||
struct radeon_pll *spll = &rdev->clock.spll;
|
||||
int ref_div = spll->reference_div;
|
||||
|
||||
if (!ref_div)
|
||||
ref_div =
|
||||
RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) &
|
||||
RADEON_M_SPLL_REF_DIV_MASK;
|
||||
|
||||
if (req_clock < 15000) {
|
||||
*post_div = 8;
|
||||
req_clock *= 8;
|
||||
} else if (req_clock < 30000) {
|
||||
*post_div = 4;
|
||||
req_clock *= 4;
|
||||
} else if (req_clock < 60000) {
|
||||
*post_div = 2;
|
||||
req_clock *= 2;
|
||||
} else
|
||||
*post_div = 1;
|
||||
|
||||
req_clock *= ref_div;
|
||||
req_clock += spll->reference_freq;
|
||||
req_clock /= (2 * spll->reference_freq);
|
||||
|
||||
*fb_div = req_clock & 0xff;
|
||||
|
||||
req_clock = (req_clock & 0xffff) << 1;
|
||||
req_clock *= spll->reference_freq;
|
||||
req_clock /= ref_div;
|
||||
req_clock /= *post_div;
|
||||
|
||||
return req_clock;
|
||||
}
|
||||
|
||||
/* 10 khz */
|
||||
void radeon_legacy_set_engine_clock(struct radeon_device *rdev,
|
||||
uint32_t eng_clock)
|
||||
{
|
||||
uint32_t tmp;
|
||||
int fb_div, post_div;
|
||||
|
||||
/* XXX: wait for idle */
|
||||
|
||||
eng_clock = calc_eng_mem_clock(rdev, eng_clock, &fb_div, &post_div);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL);
|
||||
tmp &= ~RADEON_DONT_USE_XTALIN;
|
||||
WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp &= ~RADEON_SCLK_SRC_SEL_MASK;
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
udelay(10);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SPLL_CNTL);
|
||||
tmp |= RADEON_SPLL_SLEEP;
|
||||
WREG32_PLL(RADEON_SPLL_CNTL, tmp);
|
||||
|
||||
udelay(2);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SPLL_CNTL);
|
||||
tmp |= RADEON_SPLL_RESET;
|
||||
WREG32_PLL(RADEON_SPLL_CNTL, tmp);
|
||||
|
||||
udelay(200);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV);
|
||||
tmp &= ~(RADEON_SPLL_FB_DIV_MASK << RADEON_SPLL_FB_DIV_SHIFT);
|
||||
tmp |= (fb_div & RADEON_SPLL_FB_DIV_MASK) << RADEON_SPLL_FB_DIV_SHIFT;
|
||||
WREG32_PLL(RADEON_M_SPLL_REF_FB_DIV, tmp);
|
||||
|
||||
/* XXX: verify on different asics */
|
||||
tmp = RREG32_PLL(RADEON_SPLL_CNTL);
|
||||
tmp &= ~RADEON_SPLL_PVG_MASK;
|
||||
if ((eng_clock * post_div) >= 90000)
|
||||
tmp |= (0x7 << RADEON_SPLL_PVG_SHIFT);
|
||||
else
|
||||
tmp |= (0x4 << RADEON_SPLL_PVG_SHIFT);
|
||||
WREG32_PLL(RADEON_SPLL_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SPLL_CNTL);
|
||||
tmp &= ~RADEON_SPLL_SLEEP;
|
||||
WREG32_PLL(RADEON_SPLL_CNTL, tmp);
|
||||
|
||||
udelay(2);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SPLL_CNTL);
|
||||
tmp &= ~RADEON_SPLL_RESET;
|
||||
WREG32_PLL(RADEON_SPLL_CNTL, tmp);
|
||||
|
||||
udelay(200);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp &= ~RADEON_SCLK_SRC_SEL_MASK;
|
||||
switch (post_div) {
|
||||
case 1:
|
||||
default:
|
||||
tmp |= 1;
|
||||
break;
|
||||
case 2:
|
||||
tmp |= 2;
|
||||
break;
|
||||
case 4:
|
||||
tmp |= 3;
|
||||
break;
|
||||
case 8:
|
||||
tmp |= 4;
|
||||
break;
|
||||
}
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
udelay(20);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL);
|
||||
tmp |= RADEON_DONT_USE_XTALIN;
|
||||
WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp);
|
||||
|
||||
udelay(10);
|
||||
}
|
||||
|
||||
void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
if (enable) {
|
||||
if (rdev->flags & RADEON_SINGLE_CRTC) {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
if ((RREG32(RADEON_CONFIG_CNTL) &
|
||||
RADEON_CFG_ATI_REV_ID_MASK) >
|
||||
RADEON_CFG_ATI_REV_A13) {
|
||||
tmp &=
|
||||
~(RADEON_SCLK_FORCE_CP |
|
||||
RADEON_SCLK_FORCE_RB);
|
||||
}
|
||||
tmp &=
|
||||
~(RADEON_SCLK_FORCE_HDP | RADEON_SCLK_FORCE_DISP1 |
|
||||
RADEON_SCLK_FORCE_TOP | RADEON_SCLK_FORCE_SE |
|
||||
RADEON_SCLK_FORCE_IDCT | RADEON_SCLK_FORCE_RE |
|
||||
RADEON_SCLK_FORCE_PB | RADEON_SCLK_FORCE_TAM |
|
||||
RADEON_SCLK_FORCE_TDM);
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
} else if (ASIC_IS_R300(rdev)) {
|
||||
if ((rdev->family == CHIP_RS400) ||
|
||||
(rdev->family == CHIP_RS480)) {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp &=
|
||||
~(RADEON_SCLK_FORCE_DISP2 |
|
||||
RADEON_SCLK_FORCE_CP |
|
||||
RADEON_SCLK_FORCE_HDP |
|
||||
RADEON_SCLK_FORCE_DISP1 |
|
||||
RADEON_SCLK_FORCE_TOP |
|
||||
RADEON_SCLK_FORCE_E2 | R300_SCLK_FORCE_VAP
|
||||
| RADEON_SCLK_FORCE_IDCT |
|
||||
RADEON_SCLK_FORCE_VIP | R300_SCLK_FORCE_SR
|
||||
| R300_SCLK_FORCE_PX | R300_SCLK_FORCE_TX
|
||||
| R300_SCLK_FORCE_US |
|
||||
RADEON_SCLK_FORCE_TV_SCLK |
|
||||
R300_SCLK_FORCE_SU |
|
||||
RADEON_SCLK_FORCE_OV0);
|
||||
tmp |= RADEON_DYN_STOP_LAT_MASK;
|
||||
tmp |=
|
||||
RADEON_SCLK_FORCE_TOP |
|
||||
RADEON_SCLK_FORCE_VIP;
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL);
|
||||
tmp &= ~RADEON_SCLK_MORE_FORCEON;
|
||||
tmp |= RADEON_SCLK_MORE_MAX_DYN_STOP_LAT;
|
||||
WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
|
||||
tmp |= (RADEON_PIXCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DAC_ALWAYS_ONb);
|
||||
WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL);
|
||||
tmp |= (RADEON_PIX2CLK_ALWAYS_ONb |
|
||||
RADEON_PIX2CLK_DAC_ALWAYS_ONb |
|
||||
RADEON_DISP_TVOUT_PIXCLK_TV_ALWAYS_ONb |
|
||||
R300_DVOCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_BLEND_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_GV_ALWAYS_ONb |
|
||||
R300_PIXCLK_DVO_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_LVDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_TMDS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TRANS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TVO_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb);
|
||||
WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
|
||||
} else if (rdev->family >= CHIP_RV350) {
|
||||
tmp = RREG32_PLL(R300_SCLK_CNTL2);
|
||||
tmp &= ~(R300_SCLK_FORCE_TCL |
|
||||
R300_SCLK_FORCE_GA |
|
||||
R300_SCLK_FORCE_CBA);
|
||||
tmp |= (R300_SCLK_TCL_MAX_DYN_STOP_LAT |
|
||||
R300_SCLK_GA_MAX_DYN_STOP_LAT |
|
||||
R300_SCLK_CBA_MAX_DYN_STOP_LAT);
|
||||
WREG32_PLL(R300_SCLK_CNTL2, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp &=
|
||||
~(RADEON_SCLK_FORCE_DISP2 |
|
||||
RADEON_SCLK_FORCE_CP |
|
||||
RADEON_SCLK_FORCE_HDP |
|
||||
RADEON_SCLK_FORCE_DISP1 |
|
||||
RADEON_SCLK_FORCE_TOP |
|
||||
RADEON_SCLK_FORCE_E2 | R300_SCLK_FORCE_VAP
|
||||
| RADEON_SCLK_FORCE_IDCT |
|
||||
RADEON_SCLK_FORCE_VIP | R300_SCLK_FORCE_SR
|
||||
| R300_SCLK_FORCE_PX | R300_SCLK_FORCE_TX
|
||||
| R300_SCLK_FORCE_US |
|
||||
RADEON_SCLK_FORCE_TV_SCLK |
|
||||
R300_SCLK_FORCE_SU |
|
||||
RADEON_SCLK_FORCE_OV0);
|
||||
tmp |= RADEON_DYN_STOP_LAT_MASK;
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL);
|
||||
tmp &= ~RADEON_SCLK_MORE_FORCEON;
|
||||
tmp |= RADEON_SCLK_MORE_MAX_DYN_STOP_LAT;
|
||||
WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
|
||||
tmp |= (RADEON_PIXCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DAC_ALWAYS_ONb);
|
||||
WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL);
|
||||
tmp |= (RADEON_PIX2CLK_ALWAYS_ONb |
|
||||
RADEON_PIX2CLK_DAC_ALWAYS_ONb |
|
||||
RADEON_DISP_TVOUT_PIXCLK_TV_ALWAYS_ONb |
|
||||
R300_DVOCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_BLEND_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_GV_ALWAYS_ONb |
|
||||
R300_PIXCLK_DVO_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_LVDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_TMDS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TRANS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TVO_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb);
|
||||
WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_MCLK_MISC);
|
||||
tmp |= (RADEON_MC_MCLK_DYN_ENABLE |
|
||||
RADEON_IO_MCLK_DYN_ENABLE);
|
||||
WREG32_PLL(RADEON_MCLK_MISC, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_MCLK_CNTL);
|
||||
tmp |= (RADEON_FORCEON_MCLKA |
|
||||
RADEON_FORCEON_MCLKB);
|
||||
|
||||
tmp &= ~(RADEON_FORCEON_YCLKA |
|
||||
RADEON_FORCEON_YCLKB |
|
||||
RADEON_FORCEON_MC);
|
||||
|
||||
/* Some releases of vbios have set DISABLE_MC_MCLKA
|
||||
and DISABLE_MC_MCLKB bits in the vbios table. Setting these
|
||||
bits will cause H/W hang when reading video memory with dynamic clocking
|
||||
enabled. */
|
||||
if ((tmp & R300_DISABLE_MC_MCLKA) &&
|
||||
(tmp & R300_DISABLE_MC_MCLKB)) {
|
||||
/* If both bits are set, then check the active channels */
|
||||
tmp = RREG32_PLL(RADEON_MCLK_CNTL);
|
||||
if (rdev->mc.vram_width == 64) {
|
||||
if (RREG32(RADEON_MEM_CNTL) &
|
||||
R300_MEM_USE_CD_CH_ONLY)
|
||||
tmp &=
|
||||
~R300_DISABLE_MC_MCLKB;
|
||||
else
|
||||
tmp &=
|
||||
~R300_DISABLE_MC_MCLKA;
|
||||
} else {
|
||||
tmp &= ~(R300_DISABLE_MC_MCLKA |
|
||||
R300_DISABLE_MC_MCLKB);
|
||||
}
|
||||
}
|
||||
|
||||
WREG32_PLL(RADEON_MCLK_CNTL, tmp);
|
||||
} else {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp &= ~(R300_SCLK_FORCE_VAP);
|
||||
tmp |= RADEON_SCLK_FORCE_CP;
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
udelay(15000);
|
||||
|
||||
tmp = RREG32_PLL(R300_SCLK_CNTL2);
|
||||
tmp &= ~(R300_SCLK_FORCE_TCL |
|
||||
R300_SCLK_FORCE_GA |
|
||||
R300_SCLK_FORCE_CBA);
|
||||
WREG32_PLL(R300_SCLK_CNTL2, tmp);
|
||||
}
|
||||
} else {
|
||||
tmp = RREG32_PLL(RADEON_CLK_PWRMGT_CNTL);
|
||||
|
||||
tmp &= ~(RADEON_ACTIVE_HILO_LAT_MASK |
|
||||
RADEON_DISP_DYN_STOP_LAT_MASK |
|
||||
RADEON_DYN_STOP_MODE_MASK);
|
||||
|
||||
tmp |= (RADEON_ENGIN_DYNCLK_MODE |
|
||||
(0x01 << RADEON_ACTIVE_HILO_LAT_SHIFT));
|
||||
WREG32_PLL(RADEON_CLK_PWRMGT_CNTL, tmp);
|
||||
udelay(15000);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL);
|
||||
tmp |= RADEON_SCLK_DYN_START_CNTL;
|
||||
WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp);
|
||||
udelay(15000);
|
||||
|
||||
/* When DRI is enabled, setting DYN_STOP_LAT to zero can cause some R200
|
||||
to lockup randomly, leave them as set by BIOS.
|
||||
*/
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
/*tmp &= RADEON_SCLK_SRC_SEL_MASK; */
|
||||
tmp &= ~RADEON_SCLK_FORCEON_MASK;
|
||||
|
||||
/*RAGE_6::A11 A12 A12N1 A13, RV250::A11 A12, R300 */
|
||||
if (((rdev->family == CHIP_RV250) &&
|
||||
((RREG32(RADEON_CONFIG_CNTL) &
|
||||
RADEON_CFG_ATI_REV_ID_MASK) <
|
||||
RADEON_CFG_ATI_REV_A13))
|
||||
|| ((rdev->family == CHIP_RV100)
|
||||
&&
|
||||
((RREG32(RADEON_CONFIG_CNTL) &
|
||||
RADEON_CFG_ATI_REV_ID_MASK) <=
|
||||
RADEON_CFG_ATI_REV_A13))) {
|
||||
tmp |= RADEON_SCLK_FORCE_CP;
|
||||
tmp |= RADEON_SCLK_FORCE_VIP;
|
||||
}
|
||||
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
if ((rdev->family == CHIP_RV200) ||
|
||||
(rdev->family == CHIP_RV250) ||
|
||||
(rdev->family == CHIP_RV280)) {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL);
|
||||
tmp &= ~RADEON_SCLK_MORE_FORCEON;
|
||||
|
||||
/* RV200::A11 A12 RV250::A11 A12 */
|
||||
if (((rdev->family == CHIP_RV200) ||
|
||||
(rdev->family == CHIP_RV250)) &&
|
||||
((RREG32(RADEON_CONFIG_CNTL) &
|
||||
RADEON_CFG_ATI_REV_ID_MASK) <
|
||||
RADEON_CFG_ATI_REV_A13)) {
|
||||
tmp |= RADEON_SCLK_MORE_FORCEON;
|
||||
}
|
||||
WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp);
|
||||
udelay(15000);
|
||||
}
|
||||
|
||||
/* RV200::A11 A12, RV250::A11 A12 */
|
||||
if (((rdev->family == CHIP_RV200) ||
|
||||
(rdev->family == CHIP_RV250)) &&
|
||||
((RREG32(RADEON_CONFIG_CNTL) &
|
||||
RADEON_CFG_ATI_REV_ID_MASK) <
|
||||
RADEON_CFG_ATI_REV_A13)) {
|
||||
tmp = RREG32_PLL(RADEON_PLL_PWRMGT_CNTL);
|
||||
tmp |= RADEON_TCL_BYPASS_DISABLE;
|
||||
WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp);
|
||||
}
|
||||
udelay(15000);
|
||||
|
||||
/*enable dynamic mode for display clocks (PIXCLK and PIX2CLK) */
|
||||
tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL);
|
||||
tmp |= (RADEON_PIX2CLK_ALWAYS_ONb |
|
||||
RADEON_PIX2CLK_DAC_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_BLEND_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_GV_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DIG_TMDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_LVDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_TMDS_ALWAYS_ONb);
|
||||
|
||||
WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
|
||||
udelay(15000);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
|
||||
tmp |= (RADEON_PIXCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DAC_ALWAYS_ONb);
|
||||
|
||||
WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp);
|
||||
udelay(15000);
|
||||
}
|
||||
} else {
|
||||
/* Turn everything OFF (ForceON to everything) */
|
||||
if (rdev->flags & RADEON_SINGLE_CRTC) {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp |= (RADEON_SCLK_FORCE_CP | RADEON_SCLK_FORCE_HDP |
|
||||
RADEON_SCLK_FORCE_DISP1 | RADEON_SCLK_FORCE_TOP
|
||||
| RADEON_SCLK_FORCE_E2 | RADEON_SCLK_FORCE_SE |
|
||||
RADEON_SCLK_FORCE_IDCT | RADEON_SCLK_FORCE_VIP |
|
||||
RADEON_SCLK_FORCE_RE | RADEON_SCLK_FORCE_PB |
|
||||
RADEON_SCLK_FORCE_TAM | RADEON_SCLK_FORCE_TDM |
|
||||
RADEON_SCLK_FORCE_RB);
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
} else if ((rdev->family == CHIP_RS400) ||
|
||||
(rdev->family == CHIP_RS480)) {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp |= (RADEON_SCLK_FORCE_DISP2 | RADEON_SCLK_FORCE_CP |
|
||||
RADEON_SCLK_FORCE_HDP | RADEON_SCLK_FORCE_DISP1
|
||||
| RADEON_SCLK_FORCE_TOP | RADEON_SCLK_FORCE_E2 |
|
||||
R300_SCLK_FORCE_VAP | RADEON_SCLK_FORCE_IDCT |
|
||||
RADEON_SCLK_FORCE_VIP | R300_SCLK_FORCE_SR |
|
||||
R300_SCLK_FORCE_PX | R300_SCLK_FORCE_TX |
|
||||
R300_SCLK_FORCE_US | RADEON_SCLK_FORCE_TV_SCLK |
|
||||
R300_SCLK_FORCE_SU | RADEON_SCLK_FORCE_OV0);
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL);
|
||||
tmp |= RADEON_SCLK_MORE_FORCEON;
|
||||
WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
|
||||
tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DAC_ALWAYS_ONb |
|
||||
R300_DISP_DAC_PIXCLK_DAC_BLANK_OFF);
|
||||
WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL);
|
||||
tmp &= ~(RADEON_PIX2CLK_ALWAYS_ONb |
|
||||
RADEON_PIX2CLK_DAC_ALWAYS_ONb |
|
||||
RADEON_DISP_TVOUT_PIXCLK_TV_ALWAYS_ONb |
|
||||
R300_DVOCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_BLEND_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_GV_ALWAYS_ONb |
|
||||
R300_PIXCLK_DVO_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_LVDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_TMDS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TRANS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TVO_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb |
|
||||
R300_DISP_DAC_PIXCLK_DAC2_BLANK_OFF);
|
||||
WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
|
||||
} else if (rdev->family >= CHIP_RV350) {
|
||||
/* for RV350/M10, no delays are required. */
|
||||
tmp = RREG32_PLL(R300_SCLK_CNTL2);
|
||||
tmp |= (R300_SCLK_FORCE_TCL |
|
||||
R300_SCLK_FORCE_GA | R300_SCLK_FORCE_CBA);
|
||||
WREG32_PLL(R300_SCLK_CNTL2, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp |= (RADEON_SCLK_FORCE_DISP2 | RADEON_SCLK_FORCE_CP |
|
||||
RADEON_SCLK_FORCE_HDP | RADEON_SCLK_FORCE_DISP1
|
||||
| RADEON_SCLK_FORCE_TOP | RADEON_SCLK_FORCE_E2 |
|
||||
R300_SCLK_FORCE_VAP | RADEON_SCLK_FORCE_IDCT |
|
||||
RADEON_SCLK_FORCE_VIP | R300_SCLK_FORCE_SR |
|
||||
R300_SCLK_FORCE_PX | R300_SCLK_FORCE_TX |
|
||||
R300_SCLK_FORCE_US | RADEON_SCLK_FORCE_TV_SCLK |
|
||||
R300_SCLK_FORCE_SU | RADEON_SCLK_FORCE_OV0);
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL);
|
||||
tmp |= RADEON_SCLK_MORE_FORCEON;
|
||||
WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_MCLK_CNTL);
|
||||
tmp |= (RADEON_FORCEON_MCLKA |
|
||||
RADEON_FORCEON_MCLKB |
|
||||
RADEON_FORCEON_YCLKA |
|
||||
RADEON_FORCEON_YCLKB | RADEON_FORCEON_MC);
|
||||
WREG32_PLL(RADEON_MCLK_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
|
||||
tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DAC_ALWAYS_ONb |
|
||||
R300_DISP_DAC_PIXCLK_DAC_BLANK_OFF);
|
||||
WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL);
|
||||
tmp &= ~(RADEON_PIX2CLK_ALWAYS_ONb |
|
||||
RADEON_PIX2CLK_DAC_ALWAYS_ONb |
|
||||
RADEON_DISP_TVOUT_PIXCLK_TV_ALWAYS_ONb |
|
||||
R300_DVOCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_BLEND_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_GV_ALWAYS_ONb |
|
||||
R300_PIXCLK_DVO_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_LVDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_TMDS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TRANS_ALWAYS_ONb |
|
||||
R300_PIXCLK_TVO_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb |
|
||||
R300_P2G2CLK_ALWAYS_ONb |
|
||||
R300_DISP_DAC_PIXCLK_DAC2_BLANK_OFF);
|
||||
WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
|
||||
} else {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
tmp |= (RADEON_SCLK_FORCE_CP | RADEON_SCLK_FORCE_E2);
|
||||
tmp |= RADEON_SCLK_FORCE_SE;
|
||||
|
||||
if (rdev->flags & RADEON_SINGLE_CRTC) {
|
||||
tmp |= (RADEON_SCLK_FORCE_RB |
|
||||
RADEON_SCLK_FORCE_TDM |
|
||||
RADEON_SCLK_FORCE_TAM |
|
||||
RADEON_SCLK_FORCE_PB |
|
||||
RADEON_SCLK_FORCE_RE |
|
||||
RADEON_SCLK_FORCE_VIP |
|
||||
RADEON_SCLK_FORCE_IDCT |
|
||||
RADEON_SCLK_FORCE_TOP |
|
||||
RADEON_SCLK_FORCE_DISP1 |
|
||||
RADEON_SCLK_FORCE_DISP2 |
|
||||
RADEON_SCLK_FORCE_HDP);
|
||||
} else if ((rdev->family == CHIP_R300) ||
|
||||
(rdev->family == CHIP_R350)) {
|
||||
tmp |= (RADEON_SCLK_FORCE_HDP |
|
||||
RADEON_SCLK_FORCE_DISP1 |
|
||||
RADEON_SCLK_FORCE_DISP2 |
|
||||
RADEON_SCLK_FORCE_TOP |
|
||||
RADEON_SCLK_FORCE_IDCT |
|
||||
RADEON_SCLK_FORCE_VIP);
|
||||
}
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
|
||||
udelay(16000);
|
||||
|
||||
if ((rdev->family == CHIP_R300) ||
|
||||
(rdev->family == CHIP_R350)) {
|
||||
tmp = RREG32_PLL(R300_SCLK_CNTL2);
|
||||
tmp |= (R300_SCLK_FORCE_TCL |
|
||||
R300_SCLK_FORCE_GA |
|
||||
R300_SCLK_FORCE_CBA);
|
||||
WREG32_PLL(R300_SCLK_CNTL2, tmp);
|
||||
udelay(16000);
|
||||
}
|
||||
|
||||
if (rdev->flags & RADEON_IS_IGP) {
|
||||
tmp = RREG32_PLL(RADEON_MCLK_CNTL);
|
||||
tmp &= ~(RADEON_FORCEON_MCLKA |
|
||||
RADEON_FORCEON_YCLKA);
|
||||
WREG32_PLL(RADEON_MCLK_CNTL, tmp);
|
||||
udelay(16000);
|
||||
}
|
||||
|
||||
if ((rdev->family == CHIP_RV200) ||
|
||||
(rdev->family == CHIP_RV250) ||
|
||||
(rdev->family == CHIP_RV280)) {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL);
|
||||
tmp |= RADEON_SCLK_MORE_FORCEON;
|
||||
WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp);
|
||||
udelay(16000);
|
||||
}
|
||||
|
||||
tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL);
|
||||
tmp &= ~(RADEON_PIX2CLK_ALWAYS_ONb |
|
||||
RADEON_PIX2CLK_DAC_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_BLEND_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_GV_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DIG_TMDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_LVDS_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_TMDS_ALWAYS_ONb);
|
||||
|
||||
WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
|
||||
udelay(16000);
|
||||
|
||||
tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
|
||||
tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb |
|
||||
RADEON_PIXCLK_DAC_ALWAYS_ONb);
|
||||
WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void radeon_apply_clock_quirks(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
/* XXX make sure engine is idle */
|
||||
|
||||
if (rdev->family < CHIP_RS600) {
|
||||
tmp = RREG32_PLL(RADEON_SCLK_CNTL);
|
||||
if (ASIC_IS_R300(rdev) || ASIC_IS_RV100(rdev))
|
||||
tmp |= RADEON_SCLK_FORCE_CP | RADEON_SCLK_FORCE_VIP;
|
||||
if ((rdev->family == CHIP_RV250)
|
||||
|| (rdev->family == CHIP_RV280))
|
||||
tmp |=
|
||||
RADEON_SCLK_FORCE_DISP1 | RADEON_SCLK_FORCE_DISP2;
|
||||
if ((rdev->family == CHIP_RV350)
|
||||
|| (rdev->family == CHIP_RV380))
|
||||
tmp |= R300_SCLK_FORCE_VAP;
|
||||
if (rdev->family == CHIP_R420)
|
||||
tmp |= R300_SCLK_FORCE_PX | R300_SCLK_FORCE_TX;
|
||||
WREG32_PLL(RADEON_SCLK_CNTL, tmp);
|
||||
} else if (rdev->family < CHIP_R600) {
|
||||
tmp = RREG32_PLL(AVIVO_CP_DYN_CNTL);
|
||||
tmp |= AVIVO_CP_FORCEON;
|
||||
WREG32_PLL(AVIVO_CP_DYN_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(AVIVO_E2_DYN_CNTL);
|
||||
tmp |= AVIVO_E2_FORCEON;
|
||||
WREG32_PLL(AVIVO_E2_DYN_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_PLL(AVIVO_IDCT_DYN_CNTL);
|
||||
tmp |= AVIVO_IDCT_FORCEON;
|
||||
WREG32_PLL(AVIVO_IDCT_DYN_CNTL, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
int radeon_static_clocks_init(struct drm_device *dev)
|
||||
{
|
||||
struct radeon_device *rdev = dev->dev_private;
|
||||
|
||||
/* XXX make sure engine is idle */
|
||||
|
||||
if (radeon_dynclks != -1) {
|
||||
if (radeon_dynclks)
|
||||
radeon_set_clock_gating(rdev, 1);
|
||||
}
|
||||
radeon_apply_clock_quirks(rdev);
|
||||
return 0;
|
||||
}
|
899
drivers/video/drm/radeon/radeon_device.c
Normal file
899
drivers/video/drm/radeon/radeon_device.c
Normal file
@ -0,0 +1,899 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
//#include <linux/console.h>
|
||||
//#include <drm/drmP.h>
|
||||
//#include <drm/drm_crtc_helper.h>
|
||||
#include "radeon_drm.h"
|
||||
#include "radeon_reg.h"
|
||||
#include "radeon.h"
|
||||
#include "radeon_asic.h"
|
||||
#include "atom.h"
|
||||
|
||||
#include <syscall.h>
|
||||
|
||||
int radeon_dynclks = -1;
|
||||
int radeon_agpmode = -1;
|
||||
int radeon_gart_size = 512; /* default gart size */
|
||||
|
||||
|
||||
/*
|
||||
* Clear GPU surface registers.
|
||||
*/
|
||||
static void radeon_surface_init(struct radeon_device *rdev)
|
||||
{
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
/* FIXME: check this out */
|
||||
if (rdev->family < CHIP_R600) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
WREG32(RADEON_SURFACE0_INFO +
|
||||
i * (RADEON_SURFACE1_INFO - RADEON_SURFACE0_INFO),
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* GPU scratch registers helpers function.
|
||||
*/
|
||||
static void radeon_scratch_init(struct radeon_device *rdev)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* FIXME: check this out */
|
||||
if (rdev->family < CHIP_R300) {
|
||||
rdev->scratch.num_reg = 5;
|
||||
} else {
|
||||
rdev->scratch.num_reg = 7;
|
||||
}
|
||||
for (i = 0; i < rdev->scratch.num_reg; i++) {
|
||||
rdev->scratch.free[i] = true;
|
||||
rdev->scratch.reg[i] = RADEON_SCRATCH_REG0 + (i * 4);
|
||||
}
|
||||
}
|
||||
|
||||
int radeon_scratch_get(struct radeon_device *rdev, uint32_t *reg)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rdev->scratch.num_reg; i++) {
|
||||
if (rdev->scratch.free[i]) {
|
||||
rdev->scratch.free[i] = false;
|
||||
*reg = rdev->scratch.reg[i];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rdev->scratch.num_reg; i++) {
|
||||
if (rdev->scratch.reg[i] == reg) {
|
||||
rdev->scratch.free[i] = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* MC common functions
|
||||
*/
|
||||
int radeon_mc_setup(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
/* Some chips have an "issue" with the memory controller, the
|
||||
* location must be aligned to the size. We just align it down,
|
||||
* too bad if we walk over the top of system memory, we don't
|
||||
* use DMA without a remapped anyway.
|
||||
* Affected chips are rv280, all r3xx, and all r4xx, but not IGP
|
||||
*/
|
||||
/* FGLRX seems to setup like this, VRAM a 0, then GART.
|
||||
*/
|
||||
/*
|
||||
* Note: from R6xx the address space is 40bits but here we only
|
||||
* use 32bits (still have to see a card which would exhaust 4G
|
||||
* address space).
|
||||
*/
|
||||
if (rdev->mc.vram_location != 0xFFFFFFFFUL) {
|
||||
/* vram location was already setup try to put gtt after
|
||||
* if it fits */
|
||||
tmp = rdev->mc.vram_location + rdev->mc.vram_size;
|
||||
tmp = (tmp + rdev->mc.gtt_size - 1) & ~(rdev->mc.gtt_size - 1);
|
||||
if ((0xFFFFFFFFUL - tmp) >= rdev->mc.gtt_size) {
|
||||
rdev->mc.gtt_location = tmp;
|
||||
} else {
|
||||
if (rdev->mc.gtt_size >= rdev->mc.vram_location) {
|
||||
printk(KERN_ERR "[drm] GTT too big to fit "
|
||||
"before or after vram location.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
rdev->mc.gtt_location = 0;
|
||||
}
|
||||
} else if (rdev->mc.gtt_location != 0xFFFFFFFFUL) {
|
||||
/* gtt location was already setup try to put vram before
|
||||
* if it fits */
|
||||
if (rdev->mc.vram_size < rdev->mc.gtt_location) {
|
||||
rdev->mc.vram_location = 0;
|
||||
} else {
|
||||
tmp = rdev->mc.gtt_location + rdev->mc.gtt_size;
|
||||
tmp += (rdev->mc.vram_size - 1);
|
||||
tmp &= ~(rdev->mc.vram_size - 1);
|
||||
if ((0xFFFFFFFFUL - tmp) >= rdev->mc.vram_size) {
|
||||
rdev->mc.vram_location = tmp;
|
||||
} else {
|
||||
printk(KERN_ERR "[drm] vram too big to fit "
|
||||
"before or after GTT location.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rdev->mc.vram_location = 0;
|
||||
rdev->mc.gtt_location = rdev->mc.vram_size;
|
||||
}
|
||||
DRM_INFO("radeon: VRAM %uM\n", rdev->mc.vram_size >> 20);
|
||||
DRM_INFO("radeon: VRAM from 0x%08X to 0x%08X\n",
|
||||
rdev->mc.vram_location,
|
||||
rdev->mc.vram_location + rdev->mc.vram_size - 1);
|
||||
DRM_INFO("radeon: GTT %uM\n", rdev->mc.gtt_size >> 20);
|
||||
DRM_INFO("radeon: GTT from 0x%08X to 0x%08X\n",
|
||||
rdev->mc.gtt_location,
|
||||
rdev->mc.gtt_location + rdev->mc.gtt_size - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GPU helpers function.
|
||||
*/
|
||||
static bool radeon_card_posted(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
/* first check CRTCs */
|
||||
if (ASIC_IS_AVIVO(rdev)) {
|
||||
reg = RREG32(AVIVO_D1CRTC_CONTROL) |
|
||||
RREG32(AVIVO_D2CRTC_CONTROL);
|
||||
if (reg & AVIVO_CRTC_EN) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
reg = RREG32(RADEON_CRTC_GEN_CNTL) |
|
||||
RREG32(RADEON_CRTC2_GEN_CNTL);
|
||||
if (reg & RADEON_CRTC_EN) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* then check MEM_SIZE, in case the crtcs are off */
|
||||
if (rdev->family >= CHIP_R600)
|
||||
reg = RREG32(R600_CONFIG_MEMSIZE);
|
||||
else
|
||||
reg = RREG32(RADEON_CONFIG_MEMSIZE);
|
||||
|
||||
if (reg)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Registers accessors functions.
|
||||
*/
|
||||
uint32_t radeon_invalid_rreg(struct radeon_device *rdev, uint32_t reg)
|
||||
{
|
||||
DRM_ERROR("Invalid callback to read register 0x%04X\n", reg);
|
||||
BUG_ON(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
|
||||
{
|
||||
DRM_ERROR("Invalid callback to write register 0x%04X with 0x%08X\n",
|
||||
reg, v);
|
||||
BUG_ON(1);
|
||||
}
|
||||
|
||||
|
||||
void radeon_register_accessor_init(struct radeon_device *rdev)
|
||||
{
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
rdev->mm_rreg = &r100_mm_rreg;
|
||||
rdev->mm_wreg = &r100_mm_wreg;
|
||||
rdev->mc_rreg = &radeon_invalid_rreg;
|
||||
rdev->mc_wreg = &radeon_invalid_wreg;
|
||||
rdev->pll_rreg = &radeon_invalid_rreg;
|
||||
rdev->pll_wreg = &radeon_invalid_wreg;
|
||||
rdev->pcie_rreg = &radeon_invalid_rreg;
|
||||
rdev->pcie_wreg = &radeon_invalid_wreg;
|
||||
rdev->pciep_rreg = &radeon_invalid_rreg;
|
||||
rdev->pciep_wreg = &radeon_invalid_wreg;
|
||||
|
||||
/* Don't change order as we are overridding accessor. */
|
||||
if (rdev->family < CHIP_RV515) {
|
||||
// rdev->pcie_rreg = &rv370_pcie_rreg;
|
||||
// rdev->pcie_wreg = &rv370_pcie_wreg;
|
||||
}
|
||||
if (rdev->family >= CHIP_RV515) {
|
||||
// rdev->pcie_rreg = &rv515_pcie_rreg;
|
||||
// rdev->pcie_wreg = &rv515_pcie_wreg;
|
||||
}
|
||||
/* FIXME: not sure here */
|
||||
if (rdev->family <= CHIP_R580) {
|
||||
// rdev->pll_rreg = &r100_pll_rreg;
|
||||
// rdev->pll_wreg = &r100_pll_wreg;
|
||||
}
|
||||
if (rdev->family >= CHIP_RV515) {
|
||||
rdev->mc_rreg = &rv515_mc_rreg;
|
||||
rdev->mc_wreg = &rv515_mc_wreg;
|
||||
}
|
||||
if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) {
|
||||
// rdev->mc_rreg = &rs400_mc_rreg;
|
||||
// rdev->mc_wreg = &rs400_mc_wreg;
|
||||
}
|
||||
if (rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) {
|
||||
// rdev->mc_rreg = &rs690_mc_rreg;
|
||||
// rdev->mc_wreg = &rs690_mc_wreg;
|
||||
}
|
||||
if (rdev->family == CHIP_RS600) {
|
||||
// rdev->mc_rreg = &rs600_mc_rreg;
|
||||
// rdev->mc_wreg = &rs600_mc_wreg;
|
||||
}
|
||||
if (rdev->family >= CHIP_R600) {
|
||||
// rdev->pciep_rreg = &r600_pciep_rreg;
|
||||
// rdev->pciep_wreg = &r600_pciep_wreg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ASIC
|
||||
*/
|
||||
int radeon_asic_init(struct radeon_device *rdev)
|
||||
{
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
radeon_register_accessor_init(rdev);
|
||||
switch (rdev->family) {
|
||||
case CHIP_R100:
|
||||
case CHIP_RV100:
|
||||
case CHIP_RS100:
|
||||
case CHIP_RV200:
|
||||
case CHIP_RS200:
|
||||
case CHIP_R200:
|
||||
case CHIP_RV250:
|
||||
case CHIP_RS300:
|
||||
case CHIP_RV280:
|
||||
// rdev->asic = &r100_asic;
|
||||
break;
|
||||
case CHIP_R300:
|
||||
case CHIP_R350:
|
||||
case CHIP_RV350:
|
||||
case CHIP_RV380:
|
||||
// rdev->asic = &r300_asic;
|
||||
break;
|
||||
case CHIP_R420:
|
||||
case CHIP_R423:
|
||||
case CHIP_RV410:
|
||||
// rdev->asic = &r420_asic;
|
||||
break;
|
||||
case CHIP_RS400:
|
||||
case CHIP_RS480:
|
||||
// rdev->asic = &rs400_asic;
|
||||
break;
|
||||
case CHIP_RS600:
|
||||
// rdev->asic = &rs600_asic;
|
||||
break;
|
||||
case CHIP_RS690:
|
||||
case CHIP_RS740:
|
||||
// rdev->asic = &rs690_asic;
|
||||
break;
|
||||
case CHIP_RV515:
|
||||
// rdev->asic = &rv515_asic;
|
||||
break;
|
||||
case CHIP_R520:
|
||||
case CHIP_RV530:
|
||||
case CHIP_RV560:
|
||||
case CHIP_RV570:
|
||||
case CHIP_R580:
|
||||
rdev->asic = &r520_asic;
|
||||
break;
|
||||
case CHIP_R600:
|
||||
case CHIP_RV610:
|
||||
case CHIP_RV630:
|
||||
case CHIP_RV620:
|
||||
case CHIP_RV635:
|
||||
case CHIP_RV670:
|
||||
case CHIP_RS780:
|
||||
case CHIP_RV770:
|
||||
case CHIP_RV730:
|
||||
case CHIP_RV710:
|
||||
default:
|
||||
/* FIXME: not supported yet */
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Wrapper around modesetting bits.
|
||||
*/
|
||||
int radeon_clocks_init(struct radeon_device *rdev)
|
||||
{
|
||||
int r;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
radeon_get_clock_info(rdev->ddev);
|
||||
r = radeon_static_clocks_init(rdev->ddev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
DRM_INFO("Clocks initialized !\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void radeon_clocks_fini(struct radeon_device *rdev)
|
||||
{
|
||||
}
|
||||
|
||||
/* ATOM accessor methods */
|
||||
static uint32_t cail_pll_read(struct card_info *info, uint32_t reg)
|
||||
{
|
||||
struct radeon_device *rdev = info->dev->dev_private;
|
||||
uint32_t r;
|
||||
|
||||
r = rdev->pll_rreg(rdev, reg);
|
||||
return r;
|
||||
}
|
||||
|
||||
static void cail_pll_write(struct card_info *info, uint32_t reg, uint32_t val)
|
||||
{
|
||||
struct radeon_device *rdev = info->dev->dev_private;
|
||||
|
||||
rdev->pll_wreg(rdev, reg, val);
|
||||
}
|
||||
|
||||
static uint32_t cail_mc_read(struct card_info *info, uint32_t reg)
|
||||
{
|
||||
struct radeon_device *rdev = info->dev->dev_private;
|
||||
uint32_t r;
|
||||
|
||||
r = rdev->mc_rreg(rdev, reg);
|
||||
return r;
|
||||
}
|
||||
|
||||
static void cail_mc_write(struct card_info *info, uint32_t reg, uint32_t val)
|
||||
{
|
||||
struct radeon_device *rdev = info->dev->dev_private;
|
||||
|
||||
rdev->mc_wreg(rdev, reg, val);
|
||||
}
|
||||
|
||||
static void cail_reg_write(struct card_info *info, uint32_t reg, uint32_t val)
|
||||
{
|
||||
struct radeon_device *rdev = info->dev->dev_private;
|
||||
|
||||
WREG32(reg*4, val);
|
||||
}
|
||||
|
||||
static uint32_t cail_reg_read(struct card_info *info, uint32_t reg)
|
||||
{
|
||||
struct radeon_device *rdev = info->dev->dev_private;
|
||||
uint32_t r;
|
||||
|
||||
r = RREG32(reg*4);
|
||||
return r;
|
||||
}
|
||||
|
||||
static struct card_info atom_card_info = {
|
||||
.dev = NULL,
|
||||
.reg_read = cail_reg_read,
|
||||
.reg_write = cail_reg_write,
|
||||
.mc_read = cail_mc_read,
|
||||
.mc_write = cail_mc_write,
|
||||
.pll_read = cail_pll_read,
|
||||
.pll_write = cail_pll_write,
|
||||
};
|
||||
|
||||
int radeon_atombios_init(struct radeon_device *rdev)
|
||||
{
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
atom_card_info.dev = rdev->ddev;
|
||||
rdev->mode_info.atom_context = atom_parse(&atom_card_info, rdev->bios);
|
||||
radeon_atom_initialize_bios_scratch_regs(rdev->ddev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void radeon_atombios_fini(struct radeon_device *rdev)
|
||||
{
|
||||
free(rdev->mode_info.atom_context);
|
||||
}
|
||||
|
||||
int radeon_combios_init(struct radeon_device *rdev)
|
||||
{
|
||||
// radeon_combios_initialize_bios_scratch_regs(rdev->ddev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void radeon_combios_fini(struct radeon_device *rdev)
|
||||
{
|
||||
}
|
||||
|
||||
int radeon_modeset_init(struct radeon_device *rdev);
|
||||
void radeon_modeset_fini(struct radeon_device *rdev);
|
||||
|
||||
|
||||
/*
|
||||
* Radeon device.
|
||||
*/
|
||||
int radeon_device_init(struct radeon_device *rdev,
|
||||
struct drm_device *ddev,
|
||||
struct pci_dev *pdev,
|
||||
uint32_t flags)
|
||||
{
|
||||
int r, ret = -1;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
DRM_INFO("radeon: Initializing kernel modesetting.\n");
|
||||
rdev->shutdown = false;
|
||||
rdev->ddev = ddev;
|
||||
rdev->pdev = pdev;
|
||||
rdev->flags = flags;
|
||||
rdev->family = flags & RADEON_FAMILY_MASK;
|
||||
rdev->is_atom_bios = false;
|
||||
rdev->usec_timeout = RADEON_MAX_USEC_TIMEOUT;
|
||||
rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
|
||||
rdev->gpu_lockup = false;
|
||||
/* mutex initialization are all done here so we
|
||||
* can recall function without having locking issues */
|
||||
// mutex_init(&rdev->cs_mutex);
|
||||
// mutex_init(&rdev->ib_pool.mutex);
|
||||
// mutex_init(&rdev->cp.mutex);
|
||||
// rwlock_init(&rdev->fence_drv.lock);
|
||||
|
||||
if (radeon_agpmode == -1) {
|
||||
rdev->flags &= ~RADEON_IS_AGP;
|
||||
if (rdev->family > CHIP_RV515 ||
|
||||
rdev->family == CHIP_RV380 ||
|
||||
rdev->family == CHIP_RV410 ||
|
||||
rdev->family == CHIP_R423) {
|
||||
DRM_INFO("Forcing AGP to PCIE mode\n");
|
||||
rdev->flags |= RADEON_IS_PCIE;
|
||||
} else {
|
||||
DRM_INFO("Forcing AGP to PCI mode\n");
|
||||
rdev->flags |= RADEON_IS_PCI;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set asic functions */
|
||||
r = radeon_asic_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
// r = radeon_init(rdev);
|
||||
|
||||
r = rdev->asic->init(rdev);
|
||||
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Report DMA addressing limitation */
|
||||
// r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(32));
|
||||
// if (r) {
|
||||
// printk(KERN_WARNING "radeon: No suitable DMA available.\n");
|
||||
// }
|
||||
|
||||
/* Registers mapping */
|
||||
/* TODO: block userspace mapping of io register */
|
||||
rdev->rmmio_base = pci_resource_start(rdev->pdev, 2);
|
||||
|
||||
rdev->rmmio_size = pci_resource_len(rdev->pdev, 2);
|
||||
|
||||
rdev->rmmio = (void*)MapIoMem(rdev->rmmio_base, rdev->rmmio_size,
|
||||
PG_SW+PG_NOCACHE);
|
||||
|
||||
if (rdev->rmmio == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)rdev->rmmio_base);
|
||||
DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size);
|
||||
|
||||
/* Setup errata flags */
|
||||
radeon_errata(rdev);
|
||||
/* Initialize scratch registers */
|
||||
radeon_scratch_init(rdev);
|
||||
/* Initialize surface registers */
|
||||
radeon_surface_init(rdev);
|
||||
|
||||
/* TODO: disable VGA need to use VGA request */
|
||||
/* BIOS*/
|
||||
if (!radeon_get_bios(rdev)) {
|
||||
if (ASIC_IS_AVIVO(rdev))
|
||||
return -EINVAL;
|
||||
}
|
||||
if (rdev->is_atom_bios) {
|
||||
r = radeon_atombios_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
} else {
|
||||
r = radeon_combios_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Reset gpu before posting otherwise ATOM will enter infinite loop */
|
||||
if (radeon_gpu_reset(rdev)) {
|
||||
/* FIXME: what do we want to do here ? */
|
||||
}
|
||||
|
||||
/* check if cards are posted or not */
|
||||
if (!radeon_card_posted(rdev) && rdev->bios) {
|
||||
DRM_INFO("GPU not posted. posting now...\n");
|
||||
if (rdev->is_atom_bios) {
|
||||
atom_asic_init(rdev->mode_info.atom_context);
|
||||
} else {
|
||||
// radeon_combios_asic_init(rdev->ddev);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get vram informations */
|
||||
radeon_vram_info(rdev);
|
||||
/* Device is severly broken if aper size > vram size.
|
||||
* for RN50/M6/M7 - Novell bug 204882 ?
|
||||
*/
|
||||
if (rdev->mc.vram_size < rdev->mc.aper_size) {
|
||||
rdev->mc.aper_size = rdev->mc.vram_size;
|
||||
}
|
||||
/* Add an MTRR for the VRAM */
|
||||
// rdev->mc.vram_mtrr = mtrr_add(rdev->mc.aper_base, rdev->mc.aper_size,
|
||||
// MTRR_TYPE_WRCOMB, 1);
|
||||
DRM_INFO("Detected VRAM RAM=%uM, BAR=%uM\n",
|
||||
rdev->mc.vram_size >> 20,
|
||||
(unsigned)rdev->mc.aper_size >> 20);
|
||||
DRM_INFO("RAM width %dbits %cDR\n",
|
||||
rdev->mc.vram_width, rdev->mc.vram_is_ddr ? 'D' : 'S');
|
||||
|
||||
/* Initialize clocks */
|
||||
r = radeon_clocks_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* Initialize memory controller (also test AGP) */
|
||||
r = radeon_mc_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
/* Fence driver */
|
||||
r = radeon_fence_driver_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
r = radeon_irq_kms_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
/* Memory manager */
|
||||
r = radeon_object_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
/* Initialize GART (initialize after TTM so we can allocate
|
||||
* memory through TTM but finalize after TTM) */
|
||||
r = radeon_gart_enable(rdev);
|
||||
if (!r) {
|
||||
r = radeon_gem_init(rdev);
|
||||
}
|
||||
|
||||
/* 1M ring buffer */
|
||||
if (!r) {
|
||||
r = radeon_cp_init(rdev, 1024 * 1024);
|
||||
}
|
||||
if (!r) {
|
||||
r = radeon_wb_init(rdev);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failled initializing WB (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if (!r) {
|
||||
r = radeon_ib_pool_init(rdev);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failled initializing IB pool (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if (!r) {
|
||||
r = radeon_ib_test(rdev);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failled testing IB (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
ret = r;
|
||||
r = radeon_modeset_init(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
if (rdev->fbdev_rfb && rdev->fbdev_rfb->obj) {
|
||||
rdev->fbdev_robj = rdev->fbdev_rfb->obj->driver_private;
|
||||
}
|
||||
if (!ret) {
|
||||
DRM_INFO("radeon: kernel modesetting successfully initialized.\n");
|
||||
}
|
||||
// if (radeon_benchmarking) {
|
||||
// radeon_benchmark(rdev);
|
||||
// }
|
||||
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct pci_device_id pciidlist[] = {
|
||||
radeon_PCI_IDS
|
||||
};
|
||||
|
||||
|
||||
u32_t __stdcall drvEntry(int action)
|
||||
{
|
||||
struct pci_device_id *ent;
|
||||
|
||||
dev_t device;
|
||||
int err;
|
||||
u32_t retval = 0;
|
||||
|
||||
if(action != 1)
|
||||
return 0;
|
||||
|
||||
if(!dbg_open("/rd/1/drivers/atikms.log"))
|
||||
{
|
||||
printf("Can't open /rd/1/drivers/ati2d.log\nExit\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum_pci_devices();
|
||||
|
||||
ent = find_pci_device(&device, pciidlist);
|
||||
|
||||
if( unlikely(ent == NULL) )
|
||||
{
|
||||
dbgprintf("device not found\n");
|
||||
return 0;
|
||||
};
|
||||
|
||||
dbgprintf("device %x:%x\n", device.pci_dev.vendor,
|
||||
device.pci_dev.device);
|
||||
|
||||
err = drm_get_dev(&device.pci_dev, ent);
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
/*
|
||||
static struct drm_driver kms_driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
|
||||
DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM,
|
||||
.dev_priv_size = 0,
|
||||
.load = radeon_driver_load_kms,
|
||||
.firstopen = radeon_driver_firstopen_kms,
|
||||
.open = radeon_driver_open_kms,
|
||||
.preclose = radeon_driver_preclose_kms,
|
||||
.postclose = radeon_driver_postclose_kms,
|
||||
.lastclose = radeon_driver_lastclose_kms,
|
||||
.unload = radeon_driver_unload_kms,
|
||||
.suspend = radeon_suspend_kms,
|
||||
.resume = radeon_resume_kms,
|
||||
.get_vblank_counter = radeon_get_vblank_counter_kms,
|
||||
.enable_vblank = radeon_enable_vblank_kms,
|
||||
.disable_vblank = radeon_disable_vblank_kms,
|
||||
.master_create = radeon_master_create_kms,
|
||||
.master_destroy = radeon_master_destroy_kms,
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
.debugfs_init = radeon_debugfs_init,
|
||||
.debugfs_cleanup = radeon_debugfs_cleanup,
|
||||
#endif
|
||||
.irq_preinstall = radeon_driver_irq_preinstall_kms,
|
||||
.irq_postinstall = radeon_driver_irq_postinstall_kms,
|
||||
.irq_uninstall = radeon_driver_irq_uninstall_kms,
|
||||
.irq_handler = radeon_driver_irq_handler_kms,
|
||||
.reclaim_buffers = drm_core_reclaim_buffers,
|
||||
.get_map_ofs = drm_core_get_map_ofs,
|
||||
.get_reg_ofs = drm_core_get_reg_ofs,
|
||||
.ioctls = radeon_ioctls_kms,
|
||||
.gem_init_object = radeon_gem_object_init,
|
||||
.gem_free_object = radeon_gem_object_free,
|
||||
.dma_ioctl = radeon_dma_ioctl_kms,
|
||||
.fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
.release = drm_release,
|
||||
.ioctl = drm_ioctl,
|
||||
.mmap = radeon_mmap,
|
||||
.poll = drm_poll,
|
||||
.fasync = drm_fasync,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = NULL,
|
||||
#endif
|
||||
},
|
||||
|
||||
.pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.id_table = pciidlist,
|
||||
.probe = radeon_pci_probe,
|
||||
.remove = radeon_pci_remove,
|
||||
.suspend = radeon_pci_suspend,
|
||||
.resume = radeon_pci_resume,
|
||||
},
|
||||
|
||||
.name = DRIVER_NAME,
|
||||
.desc = DRIVER_DESC,
|
||||
.date = DRIVER_DATE,
|
||||
.major = KMS_DRIVER_MAJOR,
|
||||
.minor = KMS_DRIVER_MINOR,
|
||||
.patchlevel = KMS_DRIVER_PATCHLEVEL,
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Driver load/unload
|
||||
*/
|
||||
int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
|
||||
{
|
||||
struct radeon_device *rdev;
|
||||
int r;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
rdev = malloc(sizeof(struct radeon_device));
|
||||
if (rdev == NULL) {
|
||||
return -ENOMEM;
|
||||
};
|
||||
|
||||
dev->dev_private = (void *)rdev;
|
||||
|
||||
/* update BUS flag */
|
||||
// if (drm_device_is_agp(dev)) {
|
||||
flags |= RADEON_IS_AGP;
|
||||
// } else if (drm_device_is_pcie(dev)) {
|
||||
// flags |= RADEON_IS_PCIE;
|
||||
// } else {
|
||||
// flags |= RADEON_IS_PCI;
|
||||
// }
|
||||
|
||||
r = radeon_device_init(rdev, dev, dev->pdev, flags);
|
||||
if (r) {
|
||||
dbgprintf("Failed to initialize Radeon, disabling IOCTL\n");
|
||||
// radeon_device_fini(rdev);
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
{
|
||||
struct drm_device *dev;
|
||||
int ret;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
dev = malloc(sizeof(*dev));
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
// ret = pci_enable_device(pdev);
|
||||
// if (ret)
|
||||
// goto err_g1;
|
||||
|
||||
// pci_set_master(pdev);
|
||||
|
||||
// if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
|
||||
// printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
|
||||
// goto err_g2;
|
||||
// }
|
||||
|
||||
dev->pdev = pdev;
|
||||
dev->pci_device = pdev->device;
|
||||
dev->pci_vendor = pdev->vendor;
|
||||
|
||||
// if (drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
// pci_set_drvdata(pdev, dev);
|
||||
// ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
|
||||
// if (ret)
|
||||
// goto err_g2;
|
||||
// }
|
||||
|
||||
// if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY)))
|
||||
// goto err_g3;
|
||||
|
||||
// if (dev->driver->load) {
|
||||
// ret = dev->driver->load(dev, ent->driver_data);
|
||||
// if (ret)
|
||||
// goto err_g4;
|
||||
// }
|
||||
|
||||
ret = radeon_driver_load_kms(dev, ent->driver_data );
|
||||
if (ret)
|
||||
goto err_g4;
|
||||
|
||||
// list_add_tail(&dev->driver_item, &driver->device_list);
|
||||
|
||||
// DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
|
||||
// driver->name, driver->major, driver->minor, driver->patchlevel,
|
||||
// driver->date, pci_name(pdev), dev->primary->index);
|
||||
|
||||
return 0;
|
||||
|
||||
err_g4:
|
||||
// drm_put_minor(&dev->primary);
|
||||
//err_g3:
|
||||
// if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
// drm_put_minor(&dev->control);
|
||||
//err_g2:
|
||||
// pci_disable_device(pdev);
|
||||
//err_g1:
|
||||
free(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
resource_size_t drm_get_resource_start(struct drm_device *dev, unsigned int resource)
|
||||
{
|
||||
return pci_resource_start(dev->pdev, resource);
|
||||
}
|
||||
|
||||
resource_size_t drm_get_resource_len(struct drm_device *dev, unsigned int resource)
|
||||
{
|
||||
return pci_resource_len(dev->pdev, resource);
|
||||
}
|
||||
|
884
drivers/video/drm/radeon/radeon_drm.h
Normal file
884
drivers/video/drm/radeon/radeon_drm.h
Normal file
@ -0,0 +1,884 @@
|
||||
/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*-
|
||||
*
|
||||
* Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Fremont, California.
|
||||
* Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
*/
|
||||
|
||||
#ifndef __RADEON_DRM_H__
|
||||
#define __RADEON_DRM_H__
|
||||
|
||||
#include "types.h"
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the X server file (radeon_sarea.h)
|
||||
*/
|
||||
#ifndef __RADEON_SAREA_DEFINES__
|
||||
#define __RADEON_SAREA_DEFINES__
|
||||
|
||||
/* Old style state flags, required for sarea interface (1.1 and 1.2
|
||||
* clears) and 1.2 drm_vertex2 ioctl.
|
||||
*/
|
||||
#define RADEON_UPLOAD_CONTEXT 0x00000001
|
||||
#define RADEON_UPLOAD_VERTFMT 0x00000002
|
||||
#define RADEON_UPLOAD_LINE 0x00000004
|
||||
#define RADEON_UPLOAD_BUMPMAP 0x00000008
|
||||
#define RADEON_UPLOAD_MASKS 0x00000010
|
||||
#define RADEON_UPLOAD_VIEWPORT 0x00000020
|
||||
#define RADEON_UPLOAD_SETUP 0x00000040
|
||||
#define RADEON_UPLOAD_TCL 0x00000080
|
||||
#define RADEON_UPLOAD_MISC 0x00000100
|
||||
#define RADEON_UPLOAD_TEX0 0x00000200
|
||||
#define RADEON_UPLOAD_TEX1 0x00000400
|
||||
#define RADEON_UPLOAD_TEX2 0x00000800
|
||||
#define RADEON_UPLOAD_TEX0IMAGES 0x00001000
|
||||
#define RADEON_UPLOAD_TEX1IMAGES 0x00002000
|
||||
#define RADEON_UPLOAD_TEX2IMAGES 0x00004000
|
||||
#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */
|
||||
#define RADEON_REQUIRE_QUIESCENCE 0x00010000
|
||||
#define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */
|
||||
#define RADEON_UPLOAD_ALL 0x003effff
|
||||
#define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff
|
||||
|
||||
/* New style per-packet identifiers for use in cmd_buffer ioctl with
|
||||
* the RADEON_EMIT_PACKET command. Comments relate new packets to old
|
||||
* state bits and the packet size:
|
||||
*/
|
||||
#define RADEON_EMIT_PP_MISC 0 /* context/7 */
|
||||
#define RADEON_EMIT_PP_CNTL 1 /* context/3 */
|
||||
#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */
|
||||
#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */
|
||||
#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */
|
||||
#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */
|
||||
#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */
|
||||
#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */
|
||||
#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */
|
||||
#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */
|
||||
#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */
|
||||
#define RADEON_EMIT_RE_MISC 11 /* misc/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */
|
||||
#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */
|
||||
#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */
|
||||
#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */
|
||||
#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */
|
||||
#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */
|
||||
#define R200_EMIT_TFACTOR_0 30 /* tf/7 */
|
||||
#define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */
|
||||
#define R200_EMIT_VAP_CTL 32 /* vap/1 */
|
||||
#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */
|
||||
#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */
|
||||
#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */
|
||||
#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */
|
||||
#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */
|
||||
#define R200_EMIT_VTE_CNTL 48 /* vte/1 */
|
||||
#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */
|
||||
#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */
|
||||
#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */
|
||||
#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */
|
||||
#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */
|
||||
#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */
|
||||
#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */
|
||||
#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */
|
||||
#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */
|
||||
#define R200_EMIT_PP_CUBIC_FACES_0 61
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_0 62
|
||||
#define R200_EMIT_PP_CUBIC_FACES_1 63
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_1 64
|
||||
#define R200_EMIT_PP_CUBIC_FACES_2 65
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_2 66
|
||||
#define R200_EMIT_PP_CUBIC_FACES_3 67
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_3 68
|
||||
#define R200_EMIT_PP_CUBIC_FACES_4 69
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_4 70
|
||||
#define R200_EMIT_PP_CUBIC_FACES_5 71
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_5 72
|
||||
#define RADEON_EMIT_PP_TEX_SIZE_0 73
|
||||
#define RADEON_EMIT_PP_TEX_SIZE_1 74
|
||||
#define RADEON_EMIT_PP_TEX_SIZE_2 75
|
||||
#define R200_EMIT_RB3D_BLENDCOLOR 76
|
||||
#define R200_EMIT_TCL_POINT_SPRITE_CNTL 77
|
||||
#define RADEON_EMIT_PP_CUBIC_FACES_0 78
|
||||
#define RADEON_EMIT_PP_CUBIC_OFFSETS_T0 79
|
||||
#define RADEON_EMIT_PP_CUBIC_FACES_1 80
|
||||
#define RADEON_EMIT_PP_CUBIC_OFFSETS_T1 81
|
||||
#define RADEON_EMIT_PP_CUBIC_FACES_2 82
|
||||
#define RADEON_EMIT_PP_CUBIC_OFFSETS_T2 83
|
||||
#define R200_EMIT_PP_TRI_PERF_CNTL 84
|
||||
#define R200_EMIT_PP_AFS_0 85
|
||||
#define R200_EMIT_PP_AFS_1 86
|
||||
#define R200_EMIT_ATF_TFACTOR 87
|
||||
#define R200_EMIT_PP_TXCTLALL_0 88
|
||||
#define R200_EMIT_PP_TXCTLALL_1 89
|
||||
#define R200_EMIT_PP_TXCTLALL_2 90
|
||||
#define R200_EMIT_PP_TXCTLALL_3 91
|
||||
#define R200_EMIT_PP_TXCTLALL_4 92
|
||||
#define R200_EMIT_PP_TXCTLALL_5 93
|
||||
#define R200_EMIT_VAP_PVS_CNTL 94
|
||||
#define RADEON_MAX_STATE_PACKETS 95
|
||||
|
||||
/* Commands understood by cmd_buffer ioctl. More can be added but
|
||||
* obviously these can't be removed or changed:
|
||||
*/
|
||||
#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */
|
||||
#define RADEON_CMD_SCALARS 2 /* emit scalar data */
|
||||
#define RADEON_CMD_VECTORS 3 /* emit vector data */
|
||||
#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */
|
||||
#define RADEON_CMD_PACKET3 5 /* emit hw packet */
|
||||
#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */
|
||||
#define RADEON_CMD_SCALARS2 7 /* r200 stopgap */
|
||||
#define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note:
|
||||
* doesn't make the cpu wait, just
|
||||
* the graphics hardware */
|
||||
#define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
struct {
|
||||
unsigned char cmd_type, pad0, pad1, pad2;
|
||||
} header;
|
||||
struct {
|
||||
unsigned char cmd_type, packet_id, pad0, pad1;
|
||||
} packet;
|
||||
struct {
|
||||
unsigned char cmd_type, offset, stride, count;
|
||||
} scalars;
|
||||
struct {
|
||||
unsigned char cmd_type, offset, stride, count;
|
||||
} vectors;
|
||||
struct {
|
||||
unsigned char cmd_type, addr_lo, addr_hi, count;
|
||||
} veclinear;
|
||||
struct {
|
||||
unsigned char cmd_type, buf_idx, pad0, pad1;
|
||||
} dma;
|
||||
struct {
|
||||
unsigned char cmd_type, flags, pad0, pad1;
|
||||
} wait;
|
||||
} drm_radeon_cmd_header_t;
|
||||
|
||||
#define RADEON_WAIT_2D 0x1
|
||||
#define RADEON_WAIT_3D 0x2
|
||||
|
||||
/* Allowed parameters for R300_CMD_PACKET3
|
||||
*/
|
||||
#define R300_CMD_PACKET3_CLEAR 0
|
||||
#define R300_CMD_PACKET3_RAW 1
|
||||
|
||||
/* Commands understood by cmd_buffer ioctl for R300.
|
||||
* The interface has not been stabilized, so some of these may be removed
|
||||
* and eventually reordered before stabilization.
|
||||
*/
|
||||
#define R300_CMD_PACKET0 1
|
||||
#define R300_CMD_VPU 2 /* emit vertex program upload */
|
||||
#define R300_CMD_PACKET3 3 /* emit a packet3 */
|
||||
#define R300_CMD_END3D 4 /* emit sequence ending 3d rendering */
|
||||
#define R300_CMD_CP_DELAY 5
|
||||
#define R300_CMD_DMA_DISCARD 6
|
||||
#define R300_CMD_WAIT 7
|
||||
# define R300_WAIT_2D 0x1
|
||||
# define R300_WAIT_3D 0x2
|
||||
/* these two defines are DOING IT WRONG - however
|
||||
* we have userspace which relies on using these.
|
||||
* The wait interface is backwards compat new
|
||||
* code should use the NEW_WAIT defines below
|
||||
* THESE ARE NOT BIT FIELDS
|
||||
*/
|
||||
# define R300_WAIT_2D_CLEAN 0x3
|
||||
# define R300_WAIT_3D_CLEAN 0x4
|
||||
|
||||
# define R300_NEW_WAIT_2D_3D 0x3
|
||||
# define R300_NEW_WAIT_2D_2D_CLEAN 0x4
|
||||
# define R300_NEW_WAIT_3D_3D_CLEAN 0x6
|
||||
# define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8
|
||||
|
||||
#define R300_CMD_SCRATCH 8
|
||||
#define R300_CMD_R500FP 9
|
||||
|
||||
typedef union {
|
||||
unsigned int u;
|
||||
struct {
|
||||
unsigned char cmd_type, pad0, pad1, pad2;
|
||||
} header;
|
||||
struct {
|
||||
unsigned char cmd_type, count, reglo, reghi;
|
||||
} packet0;
|
||||
struct {
|
||||
unsigned char cmd_type, count, adrlo, adrhi;
|
||||
} vpu;
|
||||
struct {
|
||||
unsigned char cmd_type, packet, pad0, pad1;
|
||||
} packet3;
|
||||
struct {
|
||||
unsigned char cmd_type, packet;
|
||||
unsigned short count; /* amount of packet2 to emit */
|
||||
} delay;
|
||||
struct {
|
||||
unsigned char cmd_type, buf_idx, pad0, pad1;
|
||||
} dma;
|
||||
struct {
|
||||
unsigned char cmd_type, flags, pad0, pad1;
|
||||
} wait;
|
||||
struct {
|
||||
unsigned char cmd_type, reg, n_bufs, flags;
|
||||
} scratch;
|
||||
struct {
|
||||
unsigned char cmd_type, count, adrlo, adrhi_flags;
|
||||
} r500fp;
|
||||
} drm_r300_cmd_header_t;
|
||||
|
||||
#define RADEON_FRONT 0x1
|
||||
#define RADEON_BACK 0x2
|
||||
#define RADEON_DEPTH 0x4
|
||||
#define RADEON_STENCIL 0x8
|
||||
#define RADEON_CLEAR_FASTZ 0x80000000
|
||||
#define RADEON_USE_HIERZ 0x40000000
|
||||
#define RADEON_USE_COMP_ZBUF 0x20000000
|
||||
|
||||
#define R500FP_CONSTANT_TYPE (1 << 1)
|
||||
#define R500FP_CONSTANT_CLAMP (1 << 2)
|
||||
|
||||
/* Primitive types
|
||||
*/
|
||||
#define RADEON_POINTS 0x1
|
||||
#define RADEON_LINES 0x2
|
||||
#define RADEON_LINE_STRIP 0x3
|
||||
#define RADEON_TRIANGLES 0x4
|
||||
#define RADEON_TRIANGLE_FAN 0x5
|
||||
#define RADEON_TRIANGLE_STRIP 0x6
|
||||
|
||||
/* Vertex/indirect buffer size
|
||||
*/
|
||||
#define RADEON_BUFFER_SIZE 65536
|
||||
|
||||
/* Byte offsets for indirect buffer data
|
||||
*/
|
||||
#define RADEON_INDEX_PRIM_OFFSET 20
|
||||
|
||||
#define RADEON_SCRATCH_REG_OFFSET 32
|
||||
|
||||
#define R600_SCRATCH_REG_OFFSET 256
|
||||
|
||||
#define RADEON_NR_SAREA_CLIPRECTS 12
|
||||
|
||||
/* There are 2 heaps (local/GART). Each region within a heap is a
|
||||
* minimum of 64k, and there are at most 64 of them per heap.
|
||||
*/
|
||||
#define RADEON_LOCAL_TEX_HEAP 0
|
||||
#define RADEON_GART_TEX_HEAP 1
|
||||
#define RADEON_NR_TEX_HEAPS 2
|
||||
#define RADEON_NR_TEX_REGIONS 64
|
||||
#define RADEON_LOG_TEX_GRANULARITY 16
|
||||
|
||||
#define RADEON_MAX_TEXTURE_LEVELS 12
|
||||
#define RADEON_MAX_TEXTURE_UNITS 3
|
||||
|
||||
#define RADEON_MAX_SURFACES 8
|
||||
|
||||
/* Blits have strict offset rules. All blit offset must be aligned on
|
||||
* a 1K-byte boundary.
|
||||
*/
|
||||
#define RADEON_OFFSET_SHIFT 10
|
||||
#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT)
|
||||
#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1)
|
||||
|
||||
#endif /* __RADEON_SAREA_DEFINES__ */
|
||||
|
||||
typedef struct {
|
||||
unsigned int red;
|
||||
unsigned int green;
|
||||
unsigned int blue;
|
||||
unsigned int alpha;
|
||||
} radeon_color_regs_t;
|
||||
|
||||
typedef struct {
|
||||
/* Context state */
|
||||
unsigned int pp_misc; /* 0x1c14 */
|
||||
unsigned int pp_fog_color;
|
||||
unsigned int re_solid_color;
|
||||
unsigned int rb3d_blendcntl;
|
||||
unsigned int rb3d_depthoffset;
|
||||
unsigned int rb3d_depthpitch;
|
||||
unsigned int rb3d_zstencilcntl;
|
||||
|
||||
unsigned int pp_cntl; /* 0x1c38 */
|
||||
unsigned int rb3d_cntl;
|
||||
unsigned int rb3d_coloroffset;
|
||||
unsigned int re_width_height;
|
||||
unsigned int rb3d_colorpitch;
|
||||
unsigned int se_cntl;
|
||||
|
||||
/* Vertex format state */
|
||||
unsigned int se_coord_fmt; /* 0x1c50 */
|
||||
|
||||
/* Line state */
|
||||
unsigned int re_line_pattern; /* 0x1cd0 */
|
||||
unsigned int re_line_state;
|
||||
|
||||
unsigned int se_line_width; /* 0x1db8 */
|
||||
|
||||
/* Bumpmap state */
|
||||
unsigned int pp_lum_matrix; /* 0x1d00 */
|
||||
|
||||
unsigned int pp_rot_matrix_0; /* 0x1d58 */
|
||||
unsigned int pp_rot_matrix_1;
|
||||
|
||||
/* Mask state */
|
||||
unsigned int rb3d_stencilrefmask; /* 0x1d7c */
|
||||
unsigned int rb3d_ropcntl;
|
||||
unsigned int rb3d_planemask;
|
||||
|
||||
/* Viewport state */
|
||||
unsigned int se_vport_xscale; /* 0x1d98 */
|
||||
unsigned int se_vport_xoffset;
|
||||
unsigned int se_vport_yscale;
|
||||
unsigned int se_vport_yoffset;
|
||||
unsigned int se_vport_zscale;
|
||||
unsigned int se_vport_zoffset;
|
||||
|
||||
/* Setup state */
|
||||
unsigned int se_cntl_status; /* 0x2140 */
|
||||
|
||||
/* Misc state */
|
||||
unsigned int re_top_left; /* 0x26c0 */
|
||||
unsigned int re_misc;
|
||||
} drm_radeon_context_regs_t;
|
||||
|
||||
typedef struct {
|
||||
/* Zbias state */
|
||||
unsigned int se_zbias_factor; /* 0x1dac */
|
||||
unsigned int se_zbias_constant;
|
||||
} drm_radeon_context2_regs_t;
|
||||
|
||||
/* Setup registers for each texture unit
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int pp_txfilter;
|
||||
unsigned int pp_txformat;
|
||||
unsigned int pp_txoffset;
|
||||
unsigned int pp_txcblend;
|
||||
unsigned int pp_txablend;
|
||||
unsigned int pp_tfactor;
|
||||
unsigned int pp_border_color;
|
||||
} drm_radeon_texture_regs_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int start;
|
||||
unsigned int finish;
|
||||
unsigned int prim:8;
|
||||
unsigned int stateidx:8;
|
||||
unsigned int numverts:16; /* overloaded as offset/64 for elt prims */
|
||||
unsigned int vc_format; /* vertex format */
|
||||
} drm_radeon_prim_t;
|
||||
|
||||
typedef struct {
|
||||
drm_radeon_context_regs_t context;
|
||||
drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS];
|
||||
drm_radeon_context2_regs_t context2;
|
||||
unsigned int dirty;
|
||||
} drm_radeon_state_t;
|
||||
|
||||
typedef struct {
|
||||
/* The channel for communication of state information to the
|
||||
* kernel on firing a vertex buffer with either of the
|
||||
* obsoleted vertex/index ioctls.
|
||||
*/
|
||||
drm_radeon_context_regs_t context_state;
|
||||
drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS];
|
||||
unsigned int dirty;
|
||||
unsigned int vertsize;
|
||||
unsigned int vc_format;
|
||||
|
||||
/* The current cliprects, or a subset thereof.
|
||||
*/
|
||||
// struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS];
|
||||
unsigned int nbox;
|
||||
|
||||
/* Counters for client-side throttling of rendering clients.
|
||||
*/
|
||||
unsigned int last_frame;
|
||||
unsigned int last_dispatch;
|
||||
unsigned int last_clear;
|
||||
|
||||
// struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS +
|
||||
// 1];
|
||||
unsigned int tex_age[RADEON_NR_TEX_HEAPS];
|
||||
int ctx_owner;
|
||||
int pfState; /* number of 3d windows (0,1,2ormore) */
|
||||
int pfCurrentPage; /* which buffer is being displayed? */
|
||||
int crtc2_base; /* CRTC2 frame offset */
|
||||
int tiling_enabled; /* set by drm, read by 2d + 3d clients */
|
||||
} drm_radeon_sarea_t;
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the Xserver file (xf86drmRadeon.h)
|
||||
*
|
||||
* KW: actually it's illegal to change any of this (backwards compatibility).
|
||||
*/
|
||||
|
||||
/* Radeon specific ioctls
|
||||
* The device specific ioctl range is 0x40 to 0x79.
|
||||
*/
|
||||
#define DRM_RADEON_CP_INIT 0x00
|
||||
#define DRM_RADEON_CP_START 0x01
|
||||
#define DRM_RADEON_CP_STOP 0x02
|
||||
#define DRM_RADEON_CP_RESET 0x03
|
||||
#define DRM_RADEON_CP_IDLE 0x04
|
||||
#define DRM_RADEON_RESET 0x05
|
||||
#define DRM_RADEON_FULLSCREEN 0x06
|
||||
#define DRM_RADEON_SWAP 0x07
|
||||
#define DRM_RADEON_CLEAR 0x08
|
||||
#define DRM_RADEON_VERTEX 0x09
|
||||
#define DRM_RADEON_INDICES 0x0A
|
||||
#define DRM_RADEON_NOT_USED
|
||||
#define DRM_RADEON_STIPPLE 0x0C
|
||||
#define DRM_RADEON_INDIRECT 0x0D
|
||||
#define DRM_RADEON_TEXTURE 0x0E
|
||||
#define DRM_RADEON_VERTEX2 0x0F
|
||||
#define DRM_RADEON_CMDBUF 0x10
|
||||
#define DRM_RADEON_GETPARAM 0x11
|
||||
#define DRM_RADEON_FLIP 0x12
|
||||
#define DRM_RADEON_ALLOC 0x13
|
||||
#define DRM_RADEON_FREE 0x14
|
||||
#define DRM_RADEON_INIT_HEAP 0x15
|
||||
#define DRM_RADEON_IRQ_EMIT 0x16
|
||||
#define DRM_RADEON_IRQ_WAIT 0x17
|
||||
#define DRM_RADEON_CP_RESUME 0x18
|
||||
#define DRM_RADEON_SETPARAM 0x19
|
||||
#define DRM_RADEON_SURF_ALLOC 0x1a
|
||||
#define DRM_RADEON_SURF_FREE 0x1b
|
||||
/* KMS ioctl */
|
||||
#define DRM_RADEON_GEM_INFO 0x1c
|
||||
#define DRM_RADEON_GEM_CREATE 0x1d
|
||||
#define DRM_RADEON_GEM_MMAP 0x1e
|
||||
#define DRM_RADEON_GEM_PREAD 0x21
|
||||
#define DRM_RADEON_GEM_PWRITE 0x22
|
||||
#define DRM_RADEON_GEM_SET_DOMAIN 0x23
|
||||
#define DRM_RADEON_GEM_WAIT_IDLE 0x24
|
||||
#define DRM_RADEON_CS 0x26
|
||||
#define DRM_RADEON_INFO 0x27
|
||||
|
||||
#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
|
||||
#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
|
||||
#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)
|
||||
#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET)
|
||||
#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE)
|
||||
#define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET)
|
||||
#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t)
|
||||
#define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP)
|
||||
#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t)
|
||||
#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t)
|
||||
#define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t)
|
||||
#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t)
|
||||
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t)
|
||||
#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t)
|
||||
#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t)
|
||||
#define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t)
|
||||
#define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t)
|
||||
#define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP)
|
||||
#define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t)
|
||||
#define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t)
|
||||
#define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t)
|
||||
#define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t)
|
||||
#define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t)
|
||||
#define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME)
|
||||
#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
|
||||
#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
|
||||
#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
|
||||
/* KMS */
|
||||
#define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info)
|
||||
#define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create)
|
||||
#define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap)
|
||||
#define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread)
|
||||
#define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite)
|
||||
#define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain)
|
||||
#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
|
||||
#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
|
||||
#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
|
||||
|
||||
|
||||
typedef struct drm_radeon_init {
|
||||
enum {
|
||||
RADEON_INIT_CP = 0x01,
|
||||
RADEON_CLEANUP_CP = 0x02,
|
||||
RADEON_INIT_R200_CP = 0x03,
|
||||
RADEON_INIT_R300_CP = 0x04,
|
||||
RADEON_INIT_R600_CP = 0x05
|
||||
} func;
|
||||
unsigned long sarea_priv_offset;
|
||||
int is_pci;
|
||||
int cp_mode;
|
||||
int gart_size;
|
||||
int ring_size;
|
||||
int usec_timeout;
|
||||
|
||||
unsigned int fb_bpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_bpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
|
||||
unsigned long fb_offset;
|
||||
unsigned long mmio_offset;
|
||||
unsigned long ring_offset;
|
||||
unsigned long ring_rptr_offset;
|
||||
unsigned long buffers_offset;
|
||||
unsigned long gart_textures_offset;
|
||||
} drm_radeon_init_t;
|
||||
|
||||
typedef struct drm_radeon_cp_stop {
|
||||
int flush;
|
||||
int idle;
|
||||
} drm_radeon_cp_stop_t;
|
||||
|
||||
typedef struct drm_radeon_fullscreen {
|
||||
enum {
|
||||
RADEON_INIT_FULLSCREEN = 0x01,
|
||||
RADEON_CLEANUP_FULLSCREEN = 0x02
|
||||
} func;
|
||||
} drm_radeon_fullscreen_t;
|
||||
|
||||
#define CLEAR_X1 0
|
||||
#define CLEAR_Y1 1
|
||||
#define CLEAR_X2 2
|
||||
#define CLEAR_Y2 3
|
||||
#define CLEAR_DEPTH 4
|
||||
|
||||
typedef union drm_radeon_clear_rect {
|
||||
float f[5];
|
||||
unsigned int ui[5];
|
||||
} drm_radeon_clear_rect_t;
|
||||
|
||||
typedef struct drm_radeon_clear {
|
||||
unsigned int flags;
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_depth;
|
||||
unsigned int color_mask;
|
||||
unsigned int depth_mask; /* misnamed field: should be stencil */
|
||||
// drm_radeon_clear_rect_t __user *depth_boxes;
|
||||
} drm_radeon_clear_t;
|
||||
|
||||
typedef struct drm_radeon_vertex {
|
||||
int prim;
|
||||
int idx; /* Index of vertex buffer */
|
||||
int count; /* Number of vertices in buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
} drm_radeon_vertex_t;
|
||||
|
||||
typedef struct drm_radeon_indices {
|
||||
int prim;
|
||||
int idx;
|
||||
int start;
|
||||
int end;
|
||||
int discard; /* Client finished with buffer? */
|
||||
} drm_radeon_indices_t;
|
||||
|
||||
/* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices
|
||||
* - allows multiple primitives and state changes in a single ioctl
|
||||
* - supports driver change to emit native primitives
|
||||
*/
|
||||
typedef struct drm_radeon_vertex2 {
|
||||
int idx; /* Index of vertex buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
int nr_states;
|
||||
// drm_radeon_state_t __user *state;
|
||||
int nr_prims;
|
||||
// drm_radeon_prim_t __user *prim;
|
||||
} drm_radeon_vertex2_t;
|
||||
|
||||
/* v1.3 - obsoletes drm_radeon_vertex2
|
||||
* - allows arbitarily large cliprect list
|
||||
* - allows updating of tcl packet, vector and scalar state
|
||||
* - allows memory-efficient description of state updates
|
||||
* - allows state to be emitted without a primitive
|
||||
* (for clears, ctx switches)
|
||||
* - allows more than one dma buffer to be referenced per ioctl
|
||||
* - supports tcl driver
|
||||
* - may be extended in future versions with new cmd types, packets
|
||||
*/
|
||||
typedef struct drm_radeon_cmd_buffer {
|
||||
int bufsz;
|
||||
char __user *buf;
|
||||
int nbox;
|
||||
struct drm_clip_rect __user *boxes;
|
||||
} drm_radeon_cmd_buffer_t;
|
||||
|
||||
typedef struct drm_radeon_tex_image {
|
||||
unsigned int x, y; /* Blit coordinates */
|
||||
unsigned int width, height;
|
||||
const void __user *data;
|
||||
} drm_radeon_tex_image_t;
|
||||
|
||||
typedef struct drm_radeon_texture {
|
||||
unsigned int offset;
|
||||
int pitch;
|
||||
int format;
|
||||
int width; /* Texture image coordinates */
|
||||
int height;
|
||||
drm_radeon_tex_image_t __user *image;
|
||||
} drm_radeon_texture_t;
|
||||
|
||||
typedef struct drm_radeon_stipple {
|
||||
unsigned int __user *mask;
|
||||
} drm_radeon_stipple_t;
|
||||
|
||||
typedef struct drm_radeon_indirect {
|
||||
int idx;
|
||||
int start;
|
||||
int end;
|
||||
int discard;
|
||||
} drm_radeon_indirect_t;
|
||||
|
||||
/* enum for card type parameters */
|
||||
#define RADEON_CARD_PCI 0
|
||||
#define RADEON_CARD_AGP 1
|
||||
#define RADEON_CARD_PCIE 2
|
||||
|
||||
/* 1.3: An ioctl to get parameters that aren't available to the 3d
|
||||
* client any other way.
|
||||
*/
|
||||
#define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */
|
||||
#define RADEON_PARAM_LAST_FRAME 2
|
||||
#define RADEON_PARAM_LAST_DISPATCH 3
|
||||
#define RADEON_PARAM_LAST_CLEAR 4
|
||||
/* Added with DRM version 1.6. */
|
||||
#define RADEON_PARAM_IRQ_NR 5
|
||||
#define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */
|
||||
/* Added with DRM version 1.8. */
|
||||
#define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */
|
||||
#define RADEON_PARAM_STATUS_HANDLE 8
|
||||
#define RADEON_PARAM_SAREA_HANDLE 9
|
||||
#define RADEON_PARAM_GART_TEX_HANDLE 10
|
||||
#define RADEON_PARAM_SCRATCH_OFFSET 11
|
||||
#define RADEON_PARAM_CARD_TYPE 12
|
||||
#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
|
||||
#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
|
||||
#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
|
||||
#define RADEON_PARAM_DEVICE_ID 16
|
||||
|
||||
typedef struct drm_radeon_getparam {
|
||||
int param;
|
||||
void __user *value;
|
||||
} drm_radeon_getparam_t;
|
||||
|
||||
/* 1.6: Set up a memory manager for regions of shared memory:
|
||||
*/
|
||||
#define RADEON_MEM_REGION_GART 1
|
||||
#define RADEON_MEM_REGION_FB 2
|
||||
|
||||
typedef struct drm_radeon_mem_alloc {
|
||||
int region;
|
||||
int alignment;
|
||||
int size;
|
||||
int __user *region_offset; /* offset from start of fb or GART */
|
||||
} drm_radeon_mem_alloc_t;
|
||||
|
||||
typedef struct drm_radeon_mem_free {
|
||||
int region;
|
||||
int region_offset;
|
||||
} drm_radeon_mem_free_t;
|
||||
|
||||
typedef struct drm_radeon_mem_init_heap {
|
||||
int region;
|
||||
int size;
|
||||
int start;
|
||||
} drm_radeon_mem_init_heap_t;
|
||||
|
||||
/* 1.6: Userspace can request & wait on irq's:
|
||||
*/
|
||||
typedef struct drm_radeon_irq_emit {
|
||||
int __user *irq_seq;
|
||||
} drm_radeon_irq_emit_t;
|
||||
|
||||
typedef struct drm_radeon_irq_wait {
|
||||
int irq_seq;
|
||||
} drm_radeon_irq_wait_t;
|
||||
|
||||
/* 1.10: Clients tell the DRM where they think the framebuffer is located in
|
||||
* the card's address space, via a new generic ioctl to set parameters
|
||||
*/
|
||||
|
||||
typedef struct drm_radeon_setparam {
|
||||
unsigned int param;
|
||||
__s64 value;
|
||||
} drm_radeon_setparam_t;
|
||||
|
||||
#define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */
|
||||
#define RADEON_SETPARAM_SWITCH_TILING 2 /* enable/disable color tiling */
|
||||
#define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */
|
||||
#define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */
|
||||
#define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */
|
||||
#define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */
|
||||
/* 1.14: Clients can allocate/free a surface
|
||||
*/
|
||||
typedef struct drm_radeon_surface_alloc {
|
||||
unsigned int address;
|
||||
unsigned int size;
|
||||
unsigned int flags;
|
||||
} drm_radeon_surface_alloc_t;
|
||||
|
||||
typedef struct drm_radeon_surface_free {
|
||||
unsigned int address;
|
||||
} drm_radeon_surface_free_t;
|
||||
|
||||
#define DRM_RADEON_VBLANK_CRTC1 1
|
||||
#define DRM_RADEON_VBLANK_CRTC2 2
|
||||
|
||||
/*
|
||||
* Kernel modesetting world below.
|
||||
*/
|
||||
#define RADEON_GEM_DOMAIN_CPU 0x1
|
||||
#define RADEON_GEM_DOMAIN_GTT 0x2
|
||||
#define RADEON_GEM_DOMAIN_VRAM 0x4
|
||||
|
||||
struct drm_radeon_gem_info {
|
||||
uint64_t gart_size;
|
||||
uint64_t vram_size;
|
||||
uint64_t vram_visible;
|
||||
};
|
||||
|
||||
#define RADEON_GEM_NO_BACKING_STORE 1
|
||||
|
||||
struct drm_radeon_gem_create {
|
||||
uint64_t size;
|
||||
uint64_t alignment;
|
||||
uint32_t handle;
|
||||
uint32_t initial_domain;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_mmap {
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
uint64_t addr_ptr;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_set_domain {
|
||||
uint32_t handle;
|
||||
uint32_t read_domains;
|
||||
uint32_t write_domain;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_wait_idle {
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_busy {
|
||||
uint32_t handle;
|
||||
uint32_t busy;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_pread {
|
||||
/** Handle for the object being read. */
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
/** Offset into the object to read from */
|
||||
uint64_t offset;
|
||||
/** Length of data to read */
|
||||
uint64_t size;
|
||||
/** Pointer to write the data into. */
|
||||
/* void *, but pointers are not 32/64 compatible */
|
||||
uint64_t data_ptr;
|
||||
};
|
||||
|
||||
struct drm_radeon_gem_pwrite {
|
||||
/** Handle for the object being written to. */
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
/** Offset into the object to write to */
|
||||
uint64_t offset;
|
||||
/** Length of data to write */
|
||||
uint64_t size;
|
||||
/** Pointer to read the data from. */
|
||||
/* void *, but pointers are not 32/64 compatible */
|
||||
uint64_t data_ptr;
|
||||
};
|
||||
|
||||
#define RADEON_CHUNK_ID_RELOCS 0x01
|
||||
#define RADEON_CHUNK_ID_IB 0x02
|
||||
|
||||
struct drm_radeon_cs_chunk {
|
||||
uint32_t chunk_id;
|
||||
uint32_t length_dw;
|
||||
uint64_t chunk_data;
|
||||
};
|
||||
|
||||
struct drm_radeon_cs_reloc {
|
||||
uint32_t handle;
|
||||
uint32_t read_domains;
|
||||
uint32_t write_domain;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct drm_radeon_cs {
|
||||
uint32_t num_chunks;
|
||||
uint32_t cs_id;
|
||||
/* this points to uint64_t * which point to cs chunks */
|
||||
uint64_t chunks;
|
||||
/* updates to the limits after this CS ioctl */
|
||||
uint64_t gart_limit;
|
||||
uint64_t vram_limit;
|
||||
};
|
||||
|
||||
#define RADEON_INFO_DEVICE_ID 0x00
|
||||
#define RADEON_INFO_NUM_GB_PIPES 0x01
|
||||
|
||||
struct drm_radeon_info {
|
||||
uint32_t request;
|
||||
uint32_t pad;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
#endif
|
1844
drivers/video/drm/radeon/radeon_microcode.h
Normal file
1844
drivers/video/drm/radeon/radeon_microcode.h
Normal file
File diff suppressed because it is too large
Load Diff
400
drivers/video/drm/radeon/radeon_mode.h
Normal file
400
drivers/video/drm/radeon/radeon_mode.h
Normal file
@ -0,0 +1,400 @@
|
||||
/*
|
||||
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
|
||||
* VA Linux Systems Inc., Fremont, California.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Original Authors:
|
||||
* Kevin E. Martin, Rickard E. Faith, Alan Hourihane
|
||||
*
|
||||
* Kernel port Author: Dave Airlie
|
||||
*/
|
||||
|
||||
#ifndef RADEON_MODE_H
|
||||
#define RADEON_MODE_H
|
||||
|
||||
#include "drm_mode.h"
|
||||
#include "drm_crtc.h"
|
||||
|
||||
//#include <drm_edid.h>
|
||||
//#include <linux/i2c.h>
|
||||
//#include <linux/i2c-id.h>
|
||||
//#include <linux/i2c-algo-bit.h>
|
||||
|
||||
#define to_radeon_crtc(x) container_of(x, struct radeon_crtc, base)
|
||||
#define to_radeon_connector(x) container_of(x, struct radeon_connector, base)
|
||||
#define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base)
|
||||
#define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base)
|
||||
|
||||
enum radeon_connector_type {
|
||||
CONNECTOR_NONE,
|
||||
CONNECTOR_VGA,
|
||||
CONNECTOR_DVI_I,
|
||||
CONNECTOR_DVI_D,
|
||||
CONNECTOR_DVI_A,
|
||||
CONNECTOR_STV,
|
||||
CONNECTOR_CTV,
|
||||
CONNECTOR_LVDS,
|
||||
CONNECTOR_DIGITAL,
|
||||
CONNECTOR_SCART,
|
||||
CONNECTOR_HDMI_TYPE_A,
|
||||
CONNECTOR_HDMI_TYPE_B,
|
||||
CONNECTOR_0XC,
|
||||
CONNECTOR_0XD,
|
||||
CONNECTOR_DIN,
|
||||
CONNECTOR_DISPLAY_PORT,
|
||||
CONNECTOR_UNSUPPORTED
|
||||
};
|
||||
|
||||
enum radeon_dvi_type {
|
||||
DVI_AUTO,
|
||||
DVI_DIGITAL,
|
||||
DVI_ANALOG
|
||||
};
|
||||
|
||||
enum radeon_rmx_type {
|
||||
RMX_OFF,
|
||||
RMX_FULL,
|
||||
RMX_CENTER,
|
||||
RMX_ASPECT
|
||||
};
|
||||
|
||||
enum radeon_tv_std {
|
||||
TV_STD_NTSC,
|
||||
TV_STD_PAL,
|
||||
TV_STD_PAL_M,
|
||||
TV_STD_PAL_60,
|
||||
TV_STD_NTSC_J,
|
||||
TV_STD_SCART_PAL,
|
||||
TV_STD_SECAM,
|
||||
TV_STD_PAL_CN,
|
||||
};
|
||||
|
||||
struct radeon_i2c_bus_rec {
|
||||
bool valid;
|
||||
uint32_t mask_clk_reg;
|
||||
uint32_t mask_data_reg;
|
||||
uint32_t a_clk_reg;
|
||||
uint32_t a_data_reg;
|
||||
uint32_t put_clk_reg;
|
||||
uint32_t put_data_reg;
|
||||
uint32_t get_clk_reg;
|
||||
uint32_t get_data_reg;
|
||||
uint32_t mask_clk_mask;
|
||||
uint32_t mask_data_mask;
|
||||
uint32_t put_clk_mask;
|
||||
uint32_t put_data_mask;
|
||||
uint32_t get_clk_mask;
|
||||
uint32_t get_data_mask;
|
||||
uint32_t a_clk_mask;
|
||||
uint32_t a_data_mask;
|
||||
};
|
||||
|
||||
struct radeon_tmds_pll {
|
||||
uint32_t freq;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
#define RADEON_MAX_BIOS_CONNECTOR 16
|
||||
|
||||
#define RADEON_PLL_USE_BIOS_DIVS (1 << 0)
|
||||
#define RADEON_PLL_NO_ODD_POST_DIV (1 << 1)
|
||||
#define RADEON_PLL_USE_REF_DIV (1 << 2)
|
||||
#define RADEON_PLL_LEGACY (1 << 3)
|
||||
#define RADEON_PLL_PREFER_LOW_REF_DIV (1 << 4)
|
||||
#define RADEON_PLL_PREFER_HIGH_REF_DIV (1 << 5)
|
||||
#define RADEON_PLL_PREFER_LOW_FB_DIV (1 << 6)
|
||||
#define RADEON_PLL_PREFER_HIGH_FB_DIV (1 << 7)
|
||||
#define RADEON_PLL_PREFER_LOW_POST_DIV (1 << 8)
|
||||
#define RADEON_PLL_PREFER_HIGH_POST_DIV (1 << 9)
|
||||
#define RADEON_PLL_USE_FRAC_FB_DIV (1 << 10)
|
||||
|
||||
struct radeon_pll {
|
||||
uint16_t reference_freq;
|
||||
uint16_t reference_div;
|
||||
uint32_t pll_in_min;
|
||||
uint32_t pll_in_max;
|
||||
uint32_t pll_out_min;
|
||||
uint32_t pll_out_max;
|
||||
uint16_t xclk;
|
||||
|
||||
uint32_t min_ref_div;
|
||||
uint32_t max_ref_div;
|
||||
uint32_t min_post_div;
|
||||
uint32_t max_post_div;
|
||||
uint32_t min_feedback_div;
|
||||
uint32_t max_feedback_div;
|
||||
uint32_t min_frac_feedback_div;
|
||||
uint32_t max_frac_feedback_div;
|
||||
uint32_t best_vco;
|
||||
};
|
||||
|
||||
struct radeon_i2c_chan {
|
||||
struct drm_device *dev;
|
||||
// struct i2c_adapter adapter;
|
||||
// struct i2c_algo_bit_data algo;
|
||||
struct radeon_i2c_bus_rec rec;
|
||||
};
|
||||
|
||||
/* mostly for macs, but really any system without connector tables */
|
||||
enum radeon_connector_table {
|
||||
CT_NONE,
|
||||
CT_GENERIC,
|
||||
CT_IBOOK,
|
||||
CT_POWERBOOK_EXTERNAL,
|
||||
CT_POWERBOOK_INTERNAL,
|
||||
CT_POWERBOOK_VGA,
|
||||
CT_MINI_EXTERNAL,
|
||||
CT_MINI_INTERNAL,
|
||||
CT_IMAC_G5_ISIGHT,
|
||||
CT_EMAC,
|
||||
};
|
||||
|
||||
struct radeon_mode_info {
|
||||
struct atom_context *atom_context;
|
||||
enum radeon_connector_table connector_table;
|
||||
bool mode_config_initialized;
|
||||
};
|
||||
|
||||
struct radeon_crtc {
|
||||
// struct drm_crtc base;
|
||||
int crtc_id;
|
||||
u16_t lut_r[256], lut_g[256], lut_b[256];
|
||||
bool enabled;
|
||||
bool can_tile;
|
||||
uint32_t crtc_offset;
|
||||
struct radeon_framebuffer *fbdev_fb;
|
||||
// struct drm_mode_set mode_set;
|
||||
// struct drm_gem_object *cursor_bo;
|
||||
uint64_t cursor_addr;
|
||||
int cursor_width;
|
||||
int cursor_height;
|
||||
};
|
||||
|
||||
#define RADEON_USE_RMX 1
|
||||
|
||||
struct radeon_native_mode {
|
||||
/* preferred mode */
|
||||
uint32_t panel_xres, panel_yres;
|
||||
uint32_t hoverplus, hsync_width;
|
||||
uint32_t hblank;
|
||||
uint32_t voverplus, vsync_width;
|
||||
uint32_t vblank;
|
||||
uint32_t dotclock;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct radeon_encoder_primary_dac {
|
||||
/* legacy primary dac */
|
||||
uint32_t ps2_pdac_adj;
|
||||
};
|
||||
|
||||
struct radeon_encoder_lvds {
|
||||
/* legacy lvds */
|
||||
uint16_t panel_vcc_delay;
|
||||
uint8_t panel_pwr_delay;
|
||||
uint8_t panel_digon_delay;
|
||||
uint8_t panel_blon_delay;
|
||||
uint16_t panel_ref_divider;
|
||||
uint8_t panel_post_divider;
|
||||
uint16_t panel_fb_divider;
|
||||
bool use_bios_dividers;
|
||||
uint32_t lvds_gen_cntl;
|
||||
/* panel mode */
|
||||
struct radeon_native_mode native_mode;
|
||||
};
|
||||
|
||||
struct radeon_encoder_tv_dac {
|
||||
/* legacy tv dac */
|
||||
uint32_t ps2_tvdac_adj;
|
||||
uint32_t ntsc_tvdac_adj;
|
||||
uint32_t pal_tvdac_adj;
|
||||
|
||||
enum radeon_tv_std tv_std;
|
||||
};
|
||||
|
||||
struct radeon_encoder_int_tmds {
|
||||
/* legacy int tmds */
|
||||
struct radeon_tmds_pll tmds_pll[4];
|
||||
};
|
||||
|
||||
struct radeon_encoder_atom_dig {
|
||||
/* atom dig */
|
||||
bool coherent_mode;
|
||||
int dig_block;
|
||||
/* atom lvds */
|
||||
uint32_t lvds_misc;
|
||||
uint16_t panel_pwr_delay;
|
||||
/* panel mode */
|
||||
struct radeon_native_mode native_mode;
|
||||
};
|
||||
|
||||
struct radeon_encoder {
|
||||
struct drm_encoder base;
|
||||
uint32_t encoder_id;
|
||||
uint32_t devices;
|
||||
uint32_t flags;
|
||||
uint32_t pixel_clock;
|
||||
enum radeon_rmx_type rmx_type;
|
||||
struct radeon_native_mode native_mode;
|
||||
void *enc_priv;
|
||||
};
|
||||
|
||||
struct radeon_connector_atom_dig {
|
||||
uint32_t igp_lane_info;
|
||||
bool linkb;
|
||||
};
|
||||
|
||||
struct radeon_connector {
|
||||
struct drm_connector base;
|
||||
uint32_t connector_id;
|
||||
uint32_t devices;
|
||||
struct radeon_i2c_chan *ddc_bus;
|
||||
int use_digital;
|
||||
void *con_priv;
|
||||
};
|
||||
|
||||
struct radeon_framebuffer {
|
||||
// struct drm_framebuffer base;
|
||||
// struct drm_gem_object *obj;
|
||||
};
|
||||
|
||||
extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
|
||||
struct radeon_i2c_bus_rec *rec,
|
||||
const char *name);
|
||||
extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c);
|
||||
extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector);
|
||||
extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector);
|
||||
|
||||
//extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector);
|
||||
|
||||
extern void radeon_compute_pll(struct radeon_pll *pll,
|
||||
uint64_t freq,
|
||||
uint32_t *dot_clock_p,
|
||||
uint32_t *fb_div_p,
|
||||
uint32_t *frac_fb_div_p,
|
||||
uint32_t *ref_div_p,
|
||||
uint32_t *post_div_p,
|
||||
int flags);
|
||||
|
||||
struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index);
|
||||
struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv);
|
||||
struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv);
|
||||
struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index);
|
||||
struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index);
|
||||
extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action);
|
||||
extern int atombios_get_encoder_mode(struct drm_encoder *encoder);
|
||||
|
||||
/*
|
||||
extern void radeon_crtc_load_lut(struct drm_crtc *crtc);
|
||||
extern int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
|
||||
struct drm_framebuffer *old_fb);
|
||||
extern int atombios_crtc_mode_set(struct drm_crtc *crtc,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode,
|
||||
int x, int y,
|
||||
struct drm_framebuffer *old_fb);
|
||||
extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode);
|
||||
|
||||
extern int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
|
||||
struct drm_framebuffer *old_fb);
|
||||
extern void radeon_legacy_atom_set_surface(struct drm_crtc *crtc);
|
||||
|
||||
extern int radeon_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t handle,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
extern int radeon_crtc_cursor_move(struct drm_crtc *crtc,
|
||||
int x, int y);
|
||||
|
||||
extern bool radeon_atom_get_clock_info(struct drm_device *dev);
|
||||
extern bool radeon_combios_get_clock_info(struct drm_device *dev);
|
||||
extern struct radeon_encoder_atom_dig *
|
||||
radeon_atombios_get_lvds_info(struct radeon_encoder *encoder);
|
||||
extern struct radeon_encoder_int_tmds *
|
||||
radeon_atombios_get_tmds_info(struct radeon_encoder *encoder);
|
||||
extern struct radeon_encoder_primary_dac *
|
||||
radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder);
|
||||
extern struct radeon_encoder_tv_dac *
|
||||
radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder);
|
||||
extern struct radeon_encoder_lvds *
|
||||
radeon_combios_get_lvds_info(struct radeon_encoder *encoder);
|
||||
extern struct radeon_encoder_int_tmds *
|
||||
radeon_combios_get_tmds_info(struct radeon_encoder *encoder);
|
||||
extern void radeon_combios_get_ext_tmds_info(struct radeon_encoder *encoder);
|
||||
extern struct radeon_encoder_tv_dac *
|
||||
radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder);
|
||||
extern struct radeon_encoder_primary_dac *
|
||||
radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder);
|
||||
extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock);
|
||||
extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev);
|
||||
extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock);
|
||||
extern void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev);
|
||||
extern void
|
||||
radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc);
|
||||
extern void
|
||||
radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on);
|
||||
extern void
|
||||
radeon_combios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc);
|
||||
extern void
|
||||
radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on);
|
||||
extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
|
||||
u16 blue, int regno);
|
||||
struct drm_framebuffer *radeon_framebuffer_create(struct drm_device *dev,
|
||||
struct drm_mode_fb_cmd *mode_cmd,
|
||||
struct drm_gem_object *obj);
|
||||
|
||||
int radeonfb_probe(struct drm_device *dev);
|
||||
|
||||
int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
|
||||
bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev);
|
||||
bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev);
|
||||
void radeon_atombios_init_crtc(struct drm_device *dev,
|
||||
struct radeon_crtc *radeon_crtc);
|
||||
void radeon_legacy_init_crtc(struct drm_device *dev,
|
||||
struct radeon_crtc *radeon_crtc);
|
||||
void radeon_i2c_do_lock(struct radeon_connector *radeon_connector, int lock_state);
|
||||
|
||||
void radeon_get_clock_info(struct drm_device *dev);
|
||||
|
||||
extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev);
|
||||
extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev);
|
||||
|
||||
void radeon_rmx_mode_fixup(struct drm_encoder *encoder,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode);
|
||||
void radeon_enc_destroy(struct drm_encoder *encoder);
|
||||
void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj);
|
||||
void radeon_combios_asic_init(struct drm_device *dev);
|
||||
extern int radeon_static_clocks_init(struct drm_device *dev);
|
||||
void radeon_init_disp_bw_legacy(struct drm_device *dev,
|
||||
struct drm_display_mode *mode1,
|
||||
uint32_t pixel_bytes1,
|
||||
struct drm_display_mode *mode2,
|
||||
uint32_t pixel_bytes2);
|
||||
void radeon_init_disp_bw_avivo(struct drm_device *dev,
|
||||
struct drm_display_mode *mode1,
|
||||
uint32_t pixel_bytes1,
|
||||
struct drm_display_mode *mode2,
|
||||
uint32_t pixel_bytes2);
|
||||
void radeon_init_disp_bandwidth(struct drm_device *dev);
|
||||
*/
|
||||
#endif
|
3571
drivers/video/drm/radeon/radeon_reg.h
Normal file
3571
drivers/video/drm/radeon/radeon_reg.h
Normal file
File diff suppressed because it is too large
Load Diff
517
drivers/video/drm/radeon/radeon_ring.c
Normal file
517
drivers/video/drm/radeon/radeon_ring.c
Normal file
@ -0,0 +1,517 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
//#include <linux/seq_file.h>
|
||||
//#include "drmP.h"
|
||||
#include "radeon_drm.h"
|
||||
#include "radeon_reg.h"
|
||||
#include "radeon.h"
|
||||
#include "atom.h"
|
||||
|
||||
#if 0
|
||||
int radeon_debugfs_ib_init(struct radeon_device *rdev);
|
||||
|
||||
/*
|
||||
* IB.
|
||||
*/
|
||||
int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib)
|
||||
{
|
||||
struct radeon_fence *fence;
|
||||
struct radeon_ib *nib;
|
||||
unsigned long i;
|
||||
int r = 0;
|
||||
|
||||
*ib = NULL;
|
||||
r = radeon_fence_create(rdev, &fence);
|
||||
if (r) {
|
||||
DRM_ERROR("failed to create fence for new IB\n");
|
||||
return r;
|
||||
}
|
||||
mutex_lock(&rdev->ib_pool.mutex);
|
||||
i = find_first_zero_bit(rdev->ib_pool.alloc_bm, RADEON_IB_POOL_SIZE);
|
||||
if (i < RADEON_IB_POOL_SIZE) {
|
||||
set_bit(i, rdev->ib_pool.alloc_bm);
|
||||
rdev->ib_pool.ibs[i].length_dw = 0;
|
||||
*ib = &rdev->ib_pool.ibs[i];
|
||||
goto out;
|
||||
}
|
||||
if (list_empty(&rdev->ib_pool.scheduled_ibs)) {
|
||||
/* we go do nothings here */
|
||||
DRM_ERROR("all IB allocated none scheduled.\n");
|
||||
r = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
/* get the first ib on the scheduled list */
|
||||
nib = list_entry(rdev->ib_pool.scheduled_ibs.next,
|
||||
struct radeon_ib, list);
|
||||
if (nib->fence == NULL) {
|
||||
/* we go do nothings here */
|
||||
DRM_ERROR("IB %lu scheduled without a fence.\n", nib->idx);
|
||||
r = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
r = radeon_fence_wait(nib->fence, false);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: IB(%lu:0x%016lX:%u)\n", nib->idx,
|
||||
(unsigned long)nib->gpu_addr, nib->length_dw);
|
||||
DRM_ERROR("radeon: GPU lockup detected, fail to get a IB\n");
|
||||
goto out;
|
||||
}
|
||||
radeon_fence_unref(&nib->fence);
|
||||
nib->length_dw = 0;
|
||||
list_del(&nib->list);
|
||||
INIT_LIST_HEAD(&nib->list);
|
||||
*ib = nib;
|
||||
out:
|
||||
mutex_unlock(&rdev->ib_pool.mutex);
|
||||
if (r) {
|
||||
radeon_fence_unref(&fence);
|
||||
} else {
|
||||
(*ib)->fence = fence;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib)
|
||||
{
|
||||
struct radeon_ib *tmp = *ib;
|
||||
|
||||
*ib = NULL;
|
||||
if (tmp == NULL) {
|
||||
return;
|
||||
}
|
||||
mutex_lock(&rdev->ib_pool.mutex);
|
||||
if (!list_empty(&tmp->list) && !radeon_fence_signaled(tmp->fence)) {
|
||||
/* IB is scheduled & not signaled don't do anythings */
|
||||
mutex_unlock(&rdev->ib_pool.mutex);
|
||||
return;
|
||||
}
|
||||
list_del(&tmp->list);
|
||||
INIT_LIST_HEAD(&tmp->list);
|
||||
if (tmp->fence) {
|
||||
radeon_fence_unref(&tmp->fence);
|
||||
}
|
||||
tmp->length_dw = 0;
|
||||
clear_bit(tmp->idx, rdev->ib_pool.alloc_bm);
|
||||
mutex_unlock(&rdev->ib_pool.mutex);
|
||||
}
|
||||
|
||||
static void radeon_ib_align(struct radeon_device *rdev, struct radeon_ib *ib)
|
||||
{
|
||||
while ((ib->length_dw & rdev->cp.align_mask)) {
|
||||
ib->ptr[ib->length_dw++] = PACKET2(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void radeon_ib_cpu_flush(struct radeon_device *rdev,
|
||||
struct radeon_ib *ib)
|
||||
{
|
||||
unsigned long tmp;
|
||||
unsigned i;
|
||||
|
||||
/* To force CPU cache flush ugly but seems reliable */
|
||||
for (i = 0; i < ib->length_dw; i += (rdev->cp.align_mask + 1)) {
|
||||
tmp = readl(&ib->ptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
mutex_lock(&rdev->ib_pool.mutex);
|
||||
radeon_ib_align(rdev, ib);
|
||||
radeon_ib_cpu_flush(rdev, ib);
|
||||
if (!ib->length_dw || !rdev->cp.ready) {
|
||||
/* TODO: Nothings in the ib we should report. */
|
||||
mutex_unlock(&rdev->ib_pool.mutex);
|
||||
DRM_ERROR("radeon: couldn't schedule IB(%lu).\n", ib->idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
/* 64 dwords should be enought for fence too */
|
||||
r = radeon_ring_lock(rdev, 64);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: scheduling IB failled (%d).\n", r);
|
||||
mutex_unlock(&rdev->ib_pool.mutex);
|
||||
return r;
|
||||
}
|
||||
radeon_ring_write(rdev, PACKET0(RADEON_CP_IB_BASE, 1));
|
||||
radeon_ring_write(rdev, ib->gpu_addr);
|
||||
radeon_ring_write(rdev, ib->length_dw);
|
||||
radeon_fence_emit(rdev, ib->fence);
|
||||
radeon_ring_unlock_commit(rdev);
|
||||
list_add_tail(&ib->list, &rdev->ib_pool.scheduled_ibs);
|
||||
mutex_unlock(&rdev->ib_pool.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int radeon_ib_pool_init(struct radeon_device *rdev)
|
||||
{
|
||||
void *ptr;
|
||||
uint64_t gpu_addr;
|
||||
int i;
|
||||
int r = 0;
|
||||
|
||||
/* Allocate 1M object buffer */
|
||||
INIT_LIST_HEAD(&rdev->ib_pool.scheduled_ibs);
|
||||
r = radeon_object_create(rdev, NULL, RADEON_IB_POOL_SIZE*64*1024,
|
||||
true, RADEON_GEM_DOMAIN_GTT,
|
||||
false, &rdev->ib_pool.robj);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failed to ib pool (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
r = radeon_object_pin(rdev->ib_pool.robj, RADEON_GEM_DOMAIN_GTT, &gpu_addr);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failed to pin ib pool (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
r = radeon_object_kmap(rdev->ib_pool.robj, &ptr);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failed to map ib poll (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
for (i = 0; i < RADEON_IB_POOL_SIZE; i++) {
|
||||
unsigned offset;
|
||||
|
||||
offset = i * 64 * 1024;
|
||||
rdev->ib_pool.ibs[i].gpu_addr = gpu_addr + offset;
|
||||
rdev->ib_pool.ibs[i].ptr = ptr + offset;
|
||||
rdev->ib_pool.ibs[i].idx = i;
|
||||
rdev->ib_pool.ibs[i].length_dw = 0;
|
||||
INIT_LIST_HEAD(&rdev->ib_pool.ibs[i].list);
|
||||
}
|
||||
bitmap_zero(rdev->ib_pool.alloc_bm, RADEON_IB_POOL_SIZE);
|
||||
rdev->ib_pool.ready = true;
|
||||
DRM_INFO("radeon: ib pool ready.\n");
|
||||
if (radeon_debugfs_ib_init(rdev)) {
|
||||
DRM_ERROR("Failed to register debugfs file for IB !\n");
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void radeon_ib_pool_fini(struct radeon_device *rdev)
|
||||
{
|
||||
if (!rdev->ib_pool.ready) {
|
||||
return;
|
||||
}
|
||||
mutex_lock(&rdev->ib_pool.mutex);
|
||||
bitmap_zero(rdev->ib_pool.alloc_bm, RADEON_IB_POOL_SIZE);
|
||||
if (rdev->ib_pool.robj) {
|
||||
radeon_object_kunmap(rdev->ib_pool.robj);
|
||||
radeon_object_unref(&rdev->ib_pool.robj);
|
||||
rdev->ib_pool.robj = NULL;
|
||||
}
|
||||
mutex_unlock(&rdev->ib_pool.mutex);
|
||||
}
|
||||
|
||||
int radeon_ib_test(struct radeon_device *rdev)
|
||||
{
|
||||
struct radeon_ib *ib;
|
||||
uint32_t scratch;
|
||||
uint32_t tmp = 0;
|
||||
unsigned i;
|
||||
int r;
|
||||
|
||||
r = radeon_scratch_get(rdev, &scratch);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failed to get scratch reg (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
WREG32(scratch, 0xCAFEDEAD);
|
||||
r = radeon_ib_get(rdev, &ib);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
ib->ptr[0] = PACKET0(scratch, 0);
|
||||
ib->ptr[1] = 0xDEADBEEF;
|
||||
ib->ptr[2] = PACKET2(0);
|
||||
ib->ptr[3] = PACKET2(0);
|
||||
ib->ptr[4] = PACKET2(0);
|
||||
ib->ptr[5] = PACKET2(0);
|
||||
ib->ptr[6] = PACKET2(0);
|
||||
ib->ptr[7] = PACKET2(0);
|
||||
ib->length_dw = 8;
|
||||
r = radeon_ib_schedule(rdev, ib);
|
||||
if (r) {
|
||||
radeon_scratch_free(rdev, scratch);
|
||||
radeon_ib_free(rdev, &ib);
|
||||
return r;
|
||||
}
|
||||
r = radeon_fence_wait(ib->fence, false);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
for (i = 0; i < rdev->usec_timeout; i++) {
|
||||
tmp = RREG32(scratch);
|
||||
if (tmp == 0xDEADBEEF) {
|
||||
break;
|
||||
}
|
||||
DRM_UDELAY(1);
|
||||
}
|
||||
if (i < rdev->usec_timeout) {
|
||||
DRM_INFO("ib test succeeded in %u usecs\n", i);
|
||||
} else {
|
||||
DRM_ERROR("radeon: ib test failed (sracth(0x%04X)=0x%08X)\n",
|
||||
scratch, tmp);
|
||||
r = -EINVAL;
|
||||
}
|
||||
radeon_scratch_free(rdev, scratch);
|
||||
radeon_ib_free(rdev, &ib);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Ring.
|
||||
*/
|
||||
void radeon_ring_free_size(struct radeon_device *rdev)
|
||||
{
|
||||
rdev->cp.rptr = RREG32(RADEON_CP_RB_RPTR);
|
||||
/* This works because ring_size is a power of 2 */
|
||||
rdev->cp.ring_free_dw = (rdev->cp.rptr + (rdev->cp.ring_size / 4));
|
||||
rdev->cp.ring_free_dw -= rdev->cp.wptr;
|
||||
rdev->cp.ring_free_dw &= rdev->cp.ptr_mask;
|
||||
if (!rdev->cp.ring_free_dw) {
|
||||
rdev->cp.ring_free_dw = rdev->cp.ring_size / 4;
|
||||
}
|
||||
}
|
||||
|
||||
int radeon_ring_lock(struct radeon_device *rdev, unsigned ndw)
|
||||
{
|
||||
int r;
|
||||
|
||||
/* Align requested size with padding so unlock_commit can
|
||||
* pad safely */
|
||||
ndw = (ndw + rdev->cp.align_mask) & ~rdev->cp.align_mask;
|
||||
// mutex_lock(&rdev->cp.mutex);
|
||||
while (ndw > (rdev->cp.ring_free_dw - 1)) {
|
||||
radeon_ring_free_size(rdev);
|
||||
if (ndw < rdev->cp.ring_free_dw) {
|
||||
break;
|
||||
}
|
||||
delay(1);
|
||||
|
||||
// r = radeon_fence_wait_next(rdev);
|
||||
// if (r) {
|
||||
// mutex_unlock(&rdev->cp.mutex);
|
||||
// return r;
|
||||
// }
|
||||
}
|
||||
rdev->cp.count_dw = ndw;
|
||||
rdev->cp.wptr_old = rdev->cp.wptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void radeon_ring_unlock_commit(struct radeon_device *rdev)
|
||||
{
|
||||
unsigned count_dw_pad;
|
||||
unsigned i;
|
||||
|
||||
/* We pad to match fetch size */
|
||||
count_dw_pad = (rdev->cp.align_mask + 1) -
|
||||
(rdev->cp.wptr & rdev->cp.align_mask);
|
||||
for (i = 0; i < count_dw_pad; i++) {
|
||||
radeon_ring_write(rdev, PACKET2(0));
|
||||
}
|
||||
DRM_MEMORYBARRIER();
|
||||
WREG32(RADEON_CP_RB_WPTR, rdev->cp.wptr);
|
||||
(void)RREG32(RADEON_CP_RB_WPTR);
|
||||
// mutex_unlock(&rdev->cp.mutex);
|
||||
}
|
||||
|
||||
void radeon_ring_unlock_undo(struct radeon_device *rdev)
|
||||
{
|
||||
rdev->cp.wptr = rdev->cp.wptr_old;
|
||||
// mutex_unlock(&rdev->cp.mutex);
|
||||
}
|
||||
|
||||
|
||||
int radeon_ring_test(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t scratch;
|
||||
uint32_t tmp = 0;
|
||||
unsigned i;
|
||||
int r;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
r = radeon_scratch_get(rdev, &scratch);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: cp failed to get scratch reg (%d).\n", r);
|
||||
return r;
|
||||
}
|
||||
WREG32(scratch, 0xCAFEDEAD);
|
||||
r = radeon_ring_lock(rdev, 2);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r);
|
||||
radeon_scratch_free(rdev, scratch);
|
||||
return r;
|
||||
}
|
||||
radeon_ring_write(rdev, PACKET0(scratch, 0));
|
||||
radeon_ring_write(rdev, 0xDEADBEEF);
|
||||
radeon_ring_unlock_commit(rdev);
|
||||
for (i = 0; i < rdev->usec_timeout; i++) {
|
||||
tmp = RREG32(scratch);
|
||||
if (tmp == 0xDEADBEEF) {
|
||||
break;
|
||||
}
|
||||
DRM_UDELAY(1);
|
||||
}
|
||||
if (i < rdev->usec_timeout) {
|
||||
DRM_INFO("ring test succeeded in %d usecs\n", i);
|
||||
} else {
|
||||
DRM_ERROR("radeon: ring test failed (sracth(0x%04X)=0x%08X)\n",
|
||||
scratch, tmp);
|
||||
r = -EINVAL;
|
||||
}
|
||||
radeon_scratch_free(rdev, scratch);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
int radeon_ring_init(struct radeon_device *rdev, unsigned ring_size)
|
||||
{
|
||||
int r;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
rdev->cp.ring_size = ring_size;
|
||||
|
||||
#if 0
|
||||
/* Allocate ring buffer */
|
||||
if (rdev->cp.ring_obj == NULL) {
|
||||
r = radeon_object_create(rdev, NULL, rdev->cp.ring_size,
|
||||
true,
|
||||
RADEON_GEM_DOMAIN_GTT,
|
||||
false,
|
||||
&rdev->cp.ring_obj);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failed to create ring buffer (%d).\n", r);
|
||||
// mutex_unlock(&rdev->cp.mutex);
|
||||
return r;
|
||||
}
|
||||
r = radeon_object_pin(rdev->cp.ring_obj,
|
||||
RADEON_GEM_DOMAIN_GTT,
|
||||
&rdev->cp.gpu_addr);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failed to pin ring buffer (%d).\n", r);
|
||||
// mutex_unlock(&rdev->cp.mutex);
|
||||
return r;
|
||||
}
|
||||
r = radeon_object_kmap(rdev->cp.ring_obj,
|
||||
(void **)&rdev->cp.ring);
|
||||
if (r) {
|
||||
DRM_ERROR("radeon: failed to map ring buffer (%d).\n", r);
|
||||
// mutex_unlock(&rdev->cp.mutex);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rdev->cp.ring = CreateRingBuffer( ring_size, PG_SW);
|
||||
rdev->cp.gpu_addr = GetPgAddr(rdev->cp.ring);
|
||||
rdev->cp.ptr_mask = (rdev->cp.ring_size / 4) - 1;
|
||||
rdev->cp.ring_free_dw = rdev->cp.ring_size / 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void radeon_ring_fini(struct radeon_device *rdev)
|
||||
{
|
||||
// mutex_lock(&rdev->cp.mutex);
|
||||
if (rdev->cp.ring_obj) {
|
||||
// radeon_object_kunmap(rdev->cp.ring_obj);
|
||||
// radeon_object_unpin(rdev->cp.ring_obj);
|
||||
// radeon_object_unref(&rdev->cp.ring_obj);
|
||||
rdev->cp.ring = NULL;
|
||||
rdev->cp.ring_obj = NULL;
|
||||
}
|
||||
// mutex_unlock(&rdev->cp.mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Debugfs info
|
||||
*/
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
static int radeon_debugfs_ib_info(struct seq_file *m, void *data)
|
||||
{
|
||||
struct drm_info_node *node = (struct drm_info_node *) m->private;
|
||||
struct radeon_ib *ib = node->info_ent->data;
|
||||
unsigned i;
|
||||
|
||||
if (ib == NULL) {
|
||||
return 0;
|
||||
}
|
||||
seq_printf(m, "IB %04lu\n", ib->idx);
|
||||
seq_printf(m, "IB fence %p\n", ib->fence);
|
||||
seq_printf(m, "IB size %05u dwords\n", ib->length_dw);
|
||||
for (i = 0; i < ib->length_dw; i++) {
|
||||
seq_printf(m, "[%05u]=0x%08X\n", i, ib->ptr[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct drm_info_list radeon_debugfs_ib_list[RADEON_IB_POOL_SIZE];
|
||||
static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32];
|
||||
#endif
|
||||
|
||||
int radeon_debugfs_ib_init(struct radeon_device *rdev)
|
||||
{
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < RADEON_IB_POOL_SIZE; i++) {
|
||||
sprintf(radeon_debugfs_ib_names[i], "radeon_ib_%04u", i);
|
||||
radeon_debugfs_ib_list[i].name = radeon_debugfs_ib_names[i];
|
||||
radeon_debugfs_ib_list[i].show = &radeon_debugfs_ib_info;
|
||||
radeon_debugfs_ib_list[i].driver_features = 0;
|
||||
radeon_debugfs_ib_list[i].data = &rdev->ib_pool.ibs[i];
|
||||
}
|
||||
return radeon_debugfs_add_files(rdev, radeon_debugfs_ib_list,
|
||||
RADEON_IB_POOL_SIZE);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int drm_order(unsigned long size)
|
||||
{
|
||||
int order;
|
||||
unsigned long tmp;
|
||||
|
||||
for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) ;
|
||||
|
||||
if (size & (size - 1))
|
||||
++order;
|
||||
|
||||
return order;
|
||||
}
|
||||
|
574
drivers/video/drm/radeon/rv515.c
Normal file
574
drivers/video/drm/radeon/rv515.c
Normal file
@ -0,0 +1,574 @@
|
||||
/*
|
||||
* Copyright 2008 Advanced Micro Devices, Inc.
|
||||
* Copyright 2008 Red Hat Inc.
|
||||
* Copyright 2009 Jerome Glisse.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie
|
||||
* Alex Deucher
|
||||
* Jerome Glisse
|
||||
*/
|
||||
//#include <linux/seq_file.h>
|
||||
//#include "drmP.h"
|
||||
#include "radeon_reg.h"
|
||||
#include "radeon.h"
|
||||
|
||||
/* rv515 depends on : */
|
||||
void r100_hdp_reset(struct radeon_device *rdev);
|
||||
int r100_cp_reset(struct radeon_device *rdev);
|
||||
int r100_rb2d_reset(struct radeon_device *rdev);
|
||||
int r100_gui_wait_for_idle(struct radeon_device *rdev);
|
||||
int r100_cp_init(struct radeon_device *rdev, unsigned ring_size);
|
||||
int rv370_pcie_gart_enable(struct radeon_device *rdev);
|
||||
void rv370_pcie_gart_disable(struct radeon_device *rdev);
|
||||
void r420_pipes_init(struct radeon_device *rdev);
|
||||
void rs600_mc_disable_clients(struct radeon_device *rdev);
|
||||
void rs600_disable_vga(struct radeon_device *rdev);
|
||||
|
||||
/* This files gather functions specifics to:
|
||||
* rv515
|
||||
*
|
||||
* Some of these functions might be used by newer ASICs.
|
||||
*/
|
||||
int rv515_debugfs_pipes_info_init(struct radeon_device *rdev);
|
||||
int rv515_debugfs_ga_info_init(struct radeon_device *rdev);
|
||||
void rv515_gpu_init(struct radeon_device *rdev);
|
||||
int rv515_mc_wait_for_idle(struct radeon_device *rdev);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* MC
|
||||
*/
|
||||
int rv515_mc_init(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
int r;
|
||||
|
||||
if (r100_debugfs_rbbm_init(rdev)) {
|
||||
DRM_ERROR("Failed to register debugfs file for RBBM !\n");
|
||||
}
|
||||
if (rv515_debugfs_pipes_info_init(rdev)) {
|
||||
DRM_ERROR("Failed to register debugfs file for pipes !\n");
|
||||
}
|
||||
if (rv515_debugfs_ga_info_init(rdev)) {
|
||||
DRM_ERROR("Failed to register debugfs file for pipes !\n");
|
||||
}
|
||||
|
||||
rv515_gpu_init(rdev);
|
||||
rv370_pcie_gart_disable(rdev);
|
||||
|
||||
/* Setup GPU memory space */
|
||||
rdev->mc.vram_location = 0xFFFFFFFFUL;
|
||||
rdev->mc.gtt_location = 0xFFFFFFFFUL;
|
||||
if (rdev->flags & RADEON_IS_AGP) {
|
||||
r = radeon_agp_init(rdev);
|
||||
if (r) {
|
||||
printk(KERN_WARNING "[drm] Disabling AGP\n");
|
||||
rdev->flags &= ~RADEON_IS_AGP;
|
||||
rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
|
||||
} else {
|
||||
rdev->mc.gtt_location = rdev->mc.agp_base;
|
||||
}
|
||||
}
|
||||
r = radeon_mc_setup(rdev);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Program GPU memory space */
|
||||
rs600_mc_disable_clients(rdev);
|
||||
if (rv515_mc_wait_for_idle(rdev)) {
|
||||
printk(KERN_WARNING "Failed to wait MC idle while "
|
||||
"programming pipes. Bad things might happen.\n");
|
||||
}
|
||||
/* Write VRAM size in case we are limiting it */
|
||||
WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
|
||||
tmp = REG_SET(RV515_MC_FB_START, rdev->mc.vram_location >> 16);
|
||||
WREG32(0x134, tmp);
|
||||
tmp = rdev->mc.vram_location + rdev->mc.vram_size - 1;
|
||||
tmp = REG_SET(RV515_MC_FB_TOP, tmp >> 16);
|
||||
tmp |= REG_SET(RV515_MC_FB_START, rdev->mc.vram_location >> 16);
|
||||
WREG32_MC(RV515_MC_FB_LOCATION, tmp);
|
||||
WREG32(RS690_HDP_FB_LOCATION, rdev->mc.vram_location >> 16);
|
||||
WREG32(0x310, rdev->mc.vram_location);
|
||||
if (rdev->flags & RADEON_IS_AGP) {
|
||||
tmp = rdev->mc.gtt_location + rdev->mc.gtt_size - 1;
|
||||
tmp = REG_SET(RV515_MC_AGP_TOP, tmp >> 16);
|
||||
tmp |= REG_SET(RV515_MC_AGP_START, rdev->mc.gtt_location >> 16);
|
||||
WREG32_MC(RV515_MC_AGP_LOCATION, tmp);
|
||||
WREG32_MC(RV515_MC_AGP_BASE, rdev->mc.agp_base);
|
||||
WREG32_MC(RV515_MC_AGP_BASE_2, 0);
|
||||
} else {
|
||||
WREG32_MC(RV515_MC_AGP_LOCATION, 0x0FFFFFFF);
|
||||
WREG32_MC(RV515_MC_AGP_BASE, 0);
|
||||
WREG32_MC(RV515_MC_AGP_BASE_2, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rv515_mc_fini(struct radeon_device *rdev)
|
||||
{
|
||||
rv370_pcie_gart_disable(rdev);
|
||||
radeon_gart_table_vram_free(rdev);
|
||||
radeon_gart_fini(rdev);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Global GPU functions
|
||||
*/
|
||||
void rv515_ring_start(struct radeon_device *rdev)
|
||||
{
|
||||
unsigned gb_tile_config;
|
||||
int r;
|
||||
|
||||
/* Sub pixel 1/12 so we can have 4K rendering according to doc */
|
||||
gb_tile_config = R300_ENABLE_TILING | R300_TILE_SIZE_16;
|
||||
switch (rdev->num_gb_pipes) {
|
||||
case 2:
|
||||
gb_tile_config |= R300_PIPE_COUNT_R300;
|
||||
break;
|
||||
case 3:
|
||||
gb_tile_config |= R300_PIPE_COUNT_R420_3P;
|
||||
break;
|
||||
case 4:
|
||||
gb_tile_config |= R300_PIPE_COUNT_R420;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
gb_tile_config |= R300_PIPE_COUNT_RV350;
|
||||
break;
|
||||
}
|
||||
|
||||
r = radeon_ring_lock(rdev, 64);
|
||||
if (r) {
|
||||
return;
|
||||
}
|
||||
radeon_ring_write(rdev, PACKET0(RADEON_ISYNC_CNTL, 0));
|
||||
radeon_ring_write(rdev,
|
||||
RADEON_ISYNC_ANY2D_IDLE3D |
|
||||
RADEON_ISYNC_ANY3D_IDLE2D |
|
||||
RADEON_ISYNC_WAIT_IDLEGUI |
|
||||
RADEON_ISYNC_CPSCRATCH_IDLEGUI);
|
||||
radeon_ring_write(rdev, PACKET0(R300_GB_TILE_CONFIG, 0));
|
||||
radeon_ring_write(rdev, gb_tile_config);
|
||||
radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0));
|
||||
radeon_ring_write(rdev,
|
||||
RADEON_WAIT_2D_IDLECLEAN |
|
||||
RADEON_WAIT_3D_IDLECLEAN);
|
||||
radeon_ring_write(rdev, PACKET0(0x170C, 0));
|
||||
radeon_ring_write(rdev, 1 << 31);
|
||||
radeon_ring_write(rdev, PACKET0(R300_GB_SELECT, 0));
|
||||
radeon_ring_write(rdev, 0);
|
||||
radeon_ring_write(rdev, PACKET0(R300_GB_ENABLE, 0));
|
||||
radeon_ring_write(rdev, 0);
|
||||
radeon_ring_write(rdev, PACKET0(0x42C8, 0));
|
||||
radeon_ring_write(rdev, (1 << rdev->num_gb_pipes) - 1);
|
||||
radeon_ring_write(rdev, PACKET0(R500_VAP_INDEX_OFFSET, 0));
|
||||
radeon_ring_write(rdev, 0);
|
||||
radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
|
||||
radeon_ring_write(rdev, R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE);
|
||||
radeon_ring_write(rdev, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
|
||||
radeon_ring_write(rdev, R300_ZC_FLUSH | R300_ZC_FREE);
|
||||
radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0));
|
||||
radeon_ring_write(rdev,
|
||||
RADEON_WAIT_2D_IDLECLEAN |
|
||||
RADEON_WAIT_3D_IDLECLEAN);
|
||||
radeon_ring_write(rdev, PACKET0(R300_GB_AA_CONFIG, 0));
|
||||
radeon_ring_write(rdev, 0);
|
||||
radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
|
||||
radeon_ring_write(rdev, R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE);
|
||||
radeon_ring_write(rdev, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
|
||||
radeon_ring_write(rdev, R300_ZC_FLUSH | R300_ZC_FREE);
|
||||
radeon_ring_write(rdev, PACKET0(R300_GB_MSPOS0, 0));
|
||||
radeon_ring_write(rdev,
|
||||
((6 << R300_MS_X0_SHIFT) |
|
||||
(6 << R300_MS_Y0_SHIFT) |
|
||||
(6 << R300_MS_X1_SHIFT) |
|
||||
(6 << R300_MS_Y1_SHIFT) |
|
||||
(6 << R300_MS_X2_SHIFT) |
|
||||
(6 << R300_MS_Y2_SHIFT) |
|
||||
(6 << R300_MSBD0_Y_SHIFT) |
|
||||
(6 << R300_MSBD0_X_SHIFT)));
|
||||
radeon_ring_write(rdev, PACKET0(R300_GB_MSPOS1, 0));
|
||||
radeon_ring_write(rdev,
|
||||
((6 << R300_MS_X3_SHIFT) |
|
||||
(6 << R300_MS_Y3_SHIFT) |
|
||||
(6 << R300_MS_X4_SHIFT) |
|
||||
(6 << R300_MS_Y4_SHIFT) |
|
||||
(6 << R300_MS_X5_SHIFT) |
|
||||
(6 << R300_MS_Y5_SHIFT) |
|
||||
(6 << R300_MSBD1_SHIFT)));
|
||||
radeon_ring_write(rdev, PACKET0(R300_GA_ENHANCE, 0));
|
||||
radeon_ring_write(rdev, R300_GA_DEADLOCK_CNTL | R300_GA_FASTSYNC_CNTL);
|
||||
radeon_ring_write(rdev, PACKET0(R300_GA_POLY_MODE, 0));
|
||||
radeon_ring_write(rdev,
|
||||
R300_FRONT_PTYPE_TRIANGE | R300_BACK_PTYPE_TRIANGE);
|
||||
radeon_ring_write(rdev, PACKET0(R300_GA_ROUND_MODE, 0));
|
||||
radeon_ring_write(rdev,
|
||||
R300_GEOMETRY_ROUND_NEAREST |
|
||||
R300_COLOR_ROUND_NEAREST);
|
||||
radeon_ring_write(rdev, PACKET0(0x20C8, 0));
|
||||
radeon_ring_write(rdev, 0);
|
||||
radeon_ring_unlock_commit(rdev);
|
||||
}
|
||||
|
||||
void rv515_errata(struct radeon_device *rdev)
|
||||
{
|
||||
rdev->pll_errata = 0;
|
||||
}
|
||||
|
||||
int rv515_mc_wait_for_idle(struct radeon_device *rdev)
|
||||
{
|
||||
unsigned i;
|
||||
uint32_t tmp;
|
||||
|
||||
for (i = 0; i < rdev->usec_timeout; i++) {
|
||||
/* read MC_STATUS */
|
||||
tmp = RREG32_MC(RV515_MC_STATUS);
|
||||
if (tmp & RV515_MC_STATUS_IDLE) {
|
||||
return 0;
|
||||
}
|
||||
DRM_UDELAY(1);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void rv515_gpu_init(struct radeon_device *rdev)
|
||||
{
|
||||
unsigned pipe_select_current, gb_pipe_select, tmp;
|
||||
|
||||
r100_hdp_reset(rdev);
|
||||
r100_rb2d_reset(rdev);
|
||||
|
||||
if (r100_gui_wait_for_idle(rdev)) {
|
||||
printk(KERN_WARNING "Failed to wait GUI idle while "
|
||||
"reseting GPU. Bad things might happen.\n");
|
||||
}
|
||||
|
||||
rs600_disable_vga(rdev);
|
||||
|
||||
r420_pipes_init(rdev);
|
||||
gb_pipe_select = RREG32(0x402C);
|
||||
tmp = RREG32(0x170C);
|
||||
pipe_select_current = (tmp >> 2) & 3;
|
||||
tmp = (1 << pipe_select_current) |
|
||||
(((gb_pipe_select >> 8) & 0xF) << 4);
|
||||
WREG32_PLL(0x000D, tmp);
|
||||
if (r100_gui_wait_for_idle(rdev)) {
|
||||
printk(KERN_WARNING "Failed to wait GUI idle while "
|
||||
"reseting GPU. Bad things might happen.\n");
|
||||
}
|
||||
if (rv515_mc_wait_for_idle(rdev)) {
|
||||
printk(KERN_WARNING "Failed to wait MC idle while "
|
||||
"programming pipes. Bad things might happen.\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int rv515_ga_reset(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
bool reinit_cp;
|
||||
int i;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
reinit_cp = rdev->cp.ready;
|
||||
rdev->cp.ready = false;
|
||||
for (i = 0; i < rdev->usec_timeout; i++) {
|
||||
WREG32(RADEON_CP_CSQ_MODE, 0);
|
||||
WREG32(RADEON_CP_CSQ_CNTL, 0);
|
||||
WREG32(RADEON_RBBM_SOFT_RESET, 0x32005);
|
||||
(void)RREG32(RADEON_RBBM_SOFT_RESET);
|
||||
udelay(200);
|
||||
WREG32(RADEON_RBBM_SOFT_RESET, 0);
|
||||
/* Wait to prevent race in RBBM_STATUS */
|
||||
mdelay(1);
|
||||
tmp = RREG32(RADEON_RBBM_STATUS);
|
||||
if (tmp & ((1 << 20) | (1 << 26))) {
|
||||
DRM_ERROR("VAP & CP still busy (RBBM_STATUS=0x%08X)\n", tmp);
|
||||
/* GA still busy soft reset it */
|
||||
WREG32(0x429C, 0x200);
|
||||
WREG32(R300_VAP_PVS_STATE_FLUSH_REG, 0);
|
||||
WREG32(0x43E0, 0);
|
||||
WREG32(0x43E4, 0);
|
||||
WREG32(0x24AC, 0);
|
||||
}
|
||||
/* Wait to prevent race in RBBM_STATUS */
|
||||
mdelay(1);
|
||||
tmp = RREG32(RADEON_RBBM_STATUS);
|
||||
if (!(tmp & ((1 << 20) | (1 << 26)))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < rdev->usec_timeout; i++) {
|
||||
tmp = RREG32(RADEON_RBBM_STATUS);
|
||||
if (!(tmp & ((1 << 20) | (1 << 26)))) {
|
||||
DRM_INFO("GA reset succeed (RBBM_STATUS=0x%08X)\n",
|
||||
tmp);
|
||||
DRM_INFO("GA_IDLE=0x%08X\n", RREG32(0x425C));
|
||||
DRM_INFO("RB3D_RESET_STATUS=0x%08X\n", RREG32(0x46f0));
|
||||
DRM_INFO("ISYNC_CNTL=0x%08X\n", RREG32(0x1724));
|
||||
if (reinit_cp) {
|
||||
return r100_cp_init(rdev, rdev->cp.ring_size);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
DRM_UDELAY(1);
|
||||
}
|
||||
tmp = RREG32(RADEON_RBBM_STATUS);
|
||||
DRM_ERROR("Failed to reset GA ! (RBBM_STATUS=0x%08X)\n", tmp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int rv515_gpu_reset(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
/* reset order likely matter */
|
||||
status = RREG32(RADEON_RBBM_STATUS);
|
||||
/* reset HDP */
|
||||
r100_hdp_reset(rdev);
|
||||
/* reset rb2d */
|
||||
if (status & ((1 << 17) | (1 << 18) | (1 << 27))) {
|
||||
r100_rb2d_reset(rdev);
|
||||
}
|
||||
/* reset GA */
|
||||
if (status & ((1 << 20) | (1 << 26))) {
|
||||
rv515_ga_reset(rdev);
|
||||
}
|
||||
/* reset CP */
|
||||
status = RREG32(RADEON_RBBM_STATUS);
|
||||
if (status & (1 << 16)) {
|
||||
r100_cp_reset(rdev);
|
||||
}
|
||||
/* Check if GPU is idle */
|
||||
status = RREG32(RADEON_RBBM_STATUS);
|
||||
if (status & (1 << 31)) {
|
||||
DRM_ERROR("Failed to reset GPU (RBBM_STATUS=0x%08X)\n", status);
|
||||
return -1;
|
||||
}
|
||||
DRM_INFO("GPU reset succeed (RBBM_STATUS=0x%08X)\n", status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
* VRAM info
|
||||
*/
|
||||
static void rv515_vram_get_type(struct radeon_device *rdev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
rdev->mc.vram_width = 128;
|
||||
rdev->mc.vram_is_ddr = true;
|
||||
tmp = RREG32_MC(RV515_MC_CNTL);
|
||||
tmp &= RV515_MEM_NUM_CHANNELS_MASK;
|
||||
switch (tmp) {
|
||||
case 0:
|
||||
rdev->mc.vram_width = 64;
|
||||
break;
|
||||
case 1:
|
||||
rdev->mc.vram_width = 128;
|
||||
break;
|
||||
default:
|
||||
rdev->mc.vram_width = 128;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rv515_vram_info(struct radeon_device *rdev)
|
||||
{
|
||||
rv515_vram_get_type(rdev);
|
||||
rdev->mc.vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
|
||||
|
||||
rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
|
||||
rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Indirect registers accessor
|
||||
*/
|
||||
uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg)
|
||||
{
|
||||
uint32_t r;
|
||||
|
||||
WREG32(R520_MC_IND_INDEX, 0x7f0000 | (reg & 0xffff));
|
||||
r = RREG32(R520_MC_IND_DATA);
|
||||
WREG32(R520_MC_IND_INDEX, 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
|
||||
{
|
||||
WREG32(R520_MC_IND_INDEX, 0xff0000 | ((reg) & 0xffff));
|
||||
WREG32(R520_MC_IND_DATA, (v));
|
||||
WREG32(R520_MC_IND_INDEX, 0);
|
||||
}
|
||||
|
||||
uint32_t rv515_pcie_rreg(struct radeon_device *rdev, uint32_t reg)
|
||||
{
|
||||
uint32_t r;
|
||||
|
||||
WREG32(RADEON_PCIE_INDEX, ((reg) & 0x7ff));
|
||||
(void)RREG32(RADEON_PCIE_INDEX);
|
||||
r = RREG32(RADEON_PCIE_DATA);
|
||||
return r;
|
||||
}
|
||||
|
||||
void rv515_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
|
||||
{
|
||||
WREG32(RADEON_PCIE_INDEX, ((reg) & 0x7ff));
|
||||
(void)RREG32(RADEON_PCIE_INDEX);
|
||||
WREG32(RADEON_PCIE_DATA, (v));
|
||||
(void)RREG32(RADEON_PCIE_DATA);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Debugfs info
|
||||
*/
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
static int rv515_debugfs_pipes_info(struct seq_file *m, void *data)
|
||||
{
|
||||
struct drm_info_node *node = (struct drm_info_node *) m->private;
|
||||
struct drm_device *dev = node->minor->dev;
|
||||
struct radeon_device *rdev = dev->dev_private;
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = RREG32(R400_GB_PIPE_SELECT);
|
||||
seq_printf(m, "GB_PIPE_SELECT 0x%08x\n", tmp);
|
||||
tmp = RREG32(R500_SU_REG_DEST);
|
||||
seq_printf(m, "SU_REG_DEST 0x%08x\n", tmp);
|
||||
tmp = RREG32(R300_GB_TILE_CONFIG);
|
||||
seq_printf(m, "GB_TILE_CONFIG 0x%08x\n", tmp);
|
||||
tmp = RREG32(R300_DST_PIPE_CONFIG);
|
||||
seq_printf(m, "DST_PIPE_CONFIG 0x%08x\n", tmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rv515_debugfs_ga_info(struct seq_file *m, void *data)
|
||||
{
|
||||
struct drm_info_node *node = (struct drm_info_node *) m->private;
|
||||
struct drm_device *dev = node->minor->dev;
|
||||
struct radeon_device *rdev = dev->dev_private;
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = RREG32(0x2140);
|
||||
seq_printf(m, "VAP_CNTL_STATUS 0x%08x\n", tmp);
|
||||
radeon_gpu_reset(rdev);
|
||||
tmp = RREG32(0x425C);
|
||||
seq_printf(m, "GA_IDLE 0x%08x\n", tmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct drm_info_list rv515_pipes_info_list[] = {
|
||||
{"rv515_pipes_info", rv515_debugfs_pipes_info, 0, NULL},
|
||||
};
|
||||
|
||||
static struct drm_info_list rv515_ga_info_list[] = {
|
||||
{"rv515_ga_info", rv515_debugfs_ga_info, 0, NULL},
|
||||
};
|
||||
#endif
|
||||
|
||||
int rv515_debugfs_pipes_info_init(struct radeon_device *rdev)
|
||||
{
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
return radeon_debugfs_add_files(rdev, rv515_pipes_info_list, 1);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int rv515_debugfs_ga_info_init(struct radeon_device *rdev)
|
||||
{
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
return radeon_debugfs_add_files(rdev, rv515_ga_info_list, 1);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Asic initialization
|
||||
*/
|
||||
static const unsigned r500_reg_safe_bm[159] = {
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFBF, 0xFFFFFFFF, 0xFFFFFFBF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
|
||||
0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
|
||||
0xF0000038, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x1FFFFC78, 0xFFFFE000, 0xFFFFFFFE, 0xFFFFFFFF,
|
||||
0x38CF8F50, 0xFFF88082, 0xFF0000FC, 0xFAE009FF,
|
||||
0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
|
||||
0xFFFF8CFC, 0xFFFFC1FF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF80FFFF,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x0003FC01, 0x3FFFFCF8, 0xFE800B19,
|
||||
};
|
||||
|
||||
|
||||
|
||||
int rv515_init(struct radeon_device *rdev)
|
||||
{
|
||||
dbgprintf("%s\n\r",__FUNCTION__);
|
||||
|
||||
rdev->config.r300.reg_safe_bm = r500_reg_safe_bm;
|
||||
rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r500_reg_safe_bm);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user