Allow building as a module.

This commit is contained in:
jmcneill 2008-05-18 19:53:22 +00:00
parent 3a717a15fc
commit a8685978bd
3 changed files with 33 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: drmP.h,v 1.24 2008/05/18 02:45:17 bjs Exp $ */
/* $NetBSD: drmP.h,v 1.25 2008/05/18 19:53:22 jmcneill Exp $ */
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
@ -47,7 +47,9 @@ typedef struct drm_device drm_device_t;
typedef struct drm_file drm_file_t;
#if defined(__FreeBSD__) || defined(__NetBSD__)
#if defined(_KERNEL_OPT)
#include <opt_drm.h>
#endif
#ifdef DRM_DEBUG
#undef DRM_DEBUG
#define DRM_DEBUG_DEFAULT_ON 1
@ -137,7 +139,9 @@ typedef struct drm_file drm_file_t;
#include "drm_atomic.h"
#if defined(__FreeBSD__) || defined(__NetBSD__)
#if defined(_KERNEL_OPT)
#include <opt_drm.h>
#endif
#ifdef DRM_DEBUG
#undef DRM_DEBUG
#define DRM_DEBUG_DEFAULT_ON 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: drm_drv.c,v 1.13 2008/05/18 02:45:17 bjs Exp $ */
/* $NetBSD: drm_drv.c,v 1.14 2008/05/18 19:53:22 jmcneill Exp $ */
/* drm_drv.h -- Generic driver template -*- linux-c -*-
* Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
@ -34,11 +34,13 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.13 2008/05/18 02:45:17 bjs Exp $");
__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.14 2008/05/18 19:53:22 jmcneill Exp $");
/*
__FBSDID("$FreeBSD: src/sys/dev/drm/drm_drv.c,v 1.6 2006/09/07 23:04:47 anholt Exp $");
*/
#include <sys/module.h>
#include "drmP.h"
#include "drm.h"
#include "drm_sarea.h"
@ -815,3 +817,21 @@ int drm_ioctl(DRM_CDEV kdev, u_long cmd, void *data, int flags,
return DRM_ERR(retcode);
}
MODULE(MODULE_CLASS_MISC, drm, NULL);
static int
drm_modcmd(modcmd_t cmd, void *arg)
{
int bmajor = -1, cmajor = -1;
switch (cmd) {
case MODULE_CMD_INIT:
return devsw_attach("drm", NULL, &bmajor, &drm_cdevsw, &cmajor);
case MODULE_CMD_FINI:
devsw_detach(NULL, &drm_cdevsw);
return 0;
default:
return ENOTTY;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: drm_memory.c,v 1.10 2008/05/06 01:45:47 bjs Exp $ */
/* $NetBSD: drm_memory.c,v 1.11 2008/05/18 19:53:22 jmcneill Exp $ */
/* drm_memory.h -- Memory management wrappers for DRM -*- linux-c -*-
* Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: drm_memory.c,v 1.10 2008/05/06 01:45:47 bjs Exp $");
__KERNEL_RCSID(0, "$NetBSD: drm_memory.c,v 1.11 2008/05/18 19:53:22 jmcneill Exp $");
/*
__FBSDID("$FreeBSD: src/sys/dev/drm/drm_memory.c,v 1.2 2005/11/28 23:13:52 anholt Exp $");
*/
@ -44,7 +44,11 @@ __FBSDID("$FreeBSD: src/sys/dev/drm/drm_memory.c,v 1.2 2005/11/28 23:13:52 anhol
#ifdef DRM_NO_AGP
#define NAGP_I810 0
#else
#if defined(_KERNEL_OPT)
#include "agp_i810.h"
#else
#define NAGP_I810 1 /* XXX */
#endif
#if NAGP_I810 > 0 /* XXX hack to borrow agp's register mapping */
#include <dev/pci/agpvar.h>
#endif