return 0;
}
-int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags)
+int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags,
+ const struct mgag200_device_info *info)
{
struct drm_device *dev = &mdev->base;
u8 crtcext3, misc;
int ret;
mdev->flags = flags;
+ mdev->info = info;
mdev->type = type;
ret = drmm_mutex_init(dev, &mdev->rmmio_lock);
#define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B)
+struct mgag200_device_info {
+};
+
+#define MGAG200_DEVICE_INFO_INIT() \
+ { \
+ }
+
struct mga_device {
struct drm_device base;
unsigned long flags;
+ const struct mgag200_device_info *info;
+
struct resource *rmmio_res;
void __iomem *rmmio;
struct mutex rmmio_lock; /* Protects access to rmmio */
resource_size_t mgag200_probe_vram(void __iomem *mem, resource_size_t size);
resource_size_t mgag200_device_probe_vram(struct mga_device *mdev);
int mgag200_device_preinit(struct mga_device *mdev);
-int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags);
+int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags,
+ const struct mgag200_device_info *info);
/* mgag200_<device type>.c */
struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
* DRM Device
*/
+static const struct mgag200_device_info mgag200_g200_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
static void mgag200_g200_interpret_bios(struct mgag200_g200_device *g200,
const unsigned char *bios, size_t size)
{
mgag200_g200_init_refclk(g200);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200_device_info);
if (ret)
return ERR_PTR(ret);
* DRM device
*/
+static const struct mgag200_device_info mgag200_g200eh_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
enum mga_type type, unsigned long flags)
{
if (ret)
return ERR_PTR(ret);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200eh_device_info);
if (ret)
return ERR_PTR(ret);
* DRM device
*/
+static const struct mgag200_device_info mgag200_g200eh3_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,
const struct drm_driver *drv,
enum mga_type type, unsigned long flags)
if (ret)
return ERR_PTR(ret);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200eh3_device_info);
if (ret)
return ERR_PTR(ret);
* DRM device
*/
+static const struct mgag200_device_info mgag200_g200er_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
enum mga_type type, unsigned long flags)
{
if (ret)
return ERR_PTR(ret);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200er_device_info);
if (ret)
return ERR_PTR(ret);
* DRM device
*/
+static const struct mgag200_device_info mgag200_g200ev_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
enum mga_type type, unsigned long flags)
{
if (ret)
return ERR_PTR(ret);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200ev_device_info);
if (ret)
return ERR_PTR(ret);
* DRM device
*/
+static const struct mgag200_device_info mgag200_g200ew3_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
static resource_size_t mgag200_g200ew3_device_probe_vram(struct mga_device *mdev)
{
resource_size_t vram_size = resource_size(mdev->vram_res);
if (ret)
return ERR_PTR(ret);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200ew3_device_info);
if (ret)
return ERR_PTR(ret);
* DRM device
*/
+static const struct mgag200_device_info mgag200_g200se_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
static void mgag200_g200se_init_unique_id(struct mgag200_g200se_device *g200se)
{
struct mga_device *mdev = &g200se->base;
mgag200_g200se_init_unique_id(g200se);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200se_device_info);
if (ret)
return ERR_PTR(ret);
* DRM device
*/
+static const struct mgag200_device_info mgag200_g200wb_device_info =
+ MGAG200_DEVICE_INFO_INIT();
+
struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
enum mga_type type, unsigned long flags)
{
if (ret)
return ERR_PTR(ret);
- ret = mgag200_device_init(mdev, type, flags);
+ ret = mgag200_device_init(mdev, type, flags, &mgag200_g200wb_device_info);
if (ret)
return ERR_PTR(ret);