Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77145f1c authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau: port remainder of drm code, and rip out compat layer



v2: Ben Skeggs <bskeggs@redhat.com>
- fill in nouveau_pm.dev to prevent oops
- fix ppc issues (build + OF shadow)

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 2094dd82
Loading
Loading
Loading
Loading
+11 −36
Original line number Diff line number Diff line
@@ -145,47 +145,17 @@ nouveau-y += core/engine/software/nv50.o
nouveau-y += core/engine/software/nvc0.o
nouveau-y += core/engine/vp/nv84.o

# drm/compat - will go away
nouveau-y += nouveau_compat.o nouveau_revcompat.o

# drm/core
nouveau-y += nouveau_drm.o nouveau_chan.o nouveau_dma.o nouveau_fence.o
nouveau-y += nouveau_agp.o
nouveau-y += nouveau_irq.o nouveau_vga.o nouveau_agp.o
nouveau-y += nouveau_ttm.o nouveau_sgdma.o nouveau_bo.o nouveau_gem.o

nouveau-y += nouveau_abi16.o
nouveau-y += nouveau_prime.o nouveau_abi16.o
nouveau-y += nv04_fence.o nv10_fence.o nv50_fence.o nv84_fence.o nvc0_fence.o

# drm/kms/common
nouveau-y += nouveau_fbcon.o

# drm/kms/nv04:nv50
nouveau-y += nv04_fbcon.o

# drm/kms/nv50:nvd9
nouveau-y += nv50_fbcon.o nvc0_fbcon.o

# drm/kms/nvd9-

# other random bits
nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o
nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o

##
## unported bits below
##

# drm/core
nouveau-y += nouveau_drv.o nouveau_state.o nouveau_irq.o
nouveau-y += nouveau_prime.o

# drm/kms/bios
nouveau-y += nouveau_bios.o

# drm/kms/common
nouveau-y += nouveau_display.o nouveau_connector.o
nouveau-y += nouveau_hdmi.o nouveau_dp.o
# drm/kms
nouveau-y += nouveau_bios.o nouveau_fbcon.o nouveau_display.o
nouveau-y += nouveau_connector.o nouveau_hdmi.o nouveau_dp.o
nouveau-y += nv04_fbcon.o nv50_fbcon.o nvc0_fbcon.o

# drm/kms/nv04:nv50
nouveau-y += nouveau_hw.o nouveau_calc.o
@@ -202,4 +172,9 @@ nouveau-y += nouveau_pm.o nouveau_volt.o nouveau_perf.o nouveau_temp.o
nouveau-y += nv04_pm.o nv40_pm.o nv50_pm.o nva3_pm.o nvc0_pm.o
nouveau-y += nouveau_mem.o

# other random bits
nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o
nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o

obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
+2 −2
Original line number Diff line number Diff line
@@ -20,8 +20,8 @@ void nouveau_timer_alarm(void *, u32 nsec, struct nouveau_alarm *);
	nouveau_timer_wait_eq((o), NV_WAIT_DEFAULT, (a), (m), (v))
#define nv_wait_ne(o,a,m,v)                                                    \
	nouveau_timer_wait_ne((o), NV_WAIT_DEFAULT, (a), (m), (v))
#define nv_wait_cb(o,a,m,v)                                                    \
	nouveau_timer_wait_cb((o), NV_WAIT_DEFAULT, (a), (m), (v))
#define nv_wait_cb(o,c,d)                                                      \
	nouveau_timer_wait_cb((o), NV_WAIT_DEFAULT, (c), (d))

struct nouveau_timer {
	struct nouveau_subdev base;
+29 −1
Original line number Diff line number Diff line
@@ -56,6 +56,31 @@ nvbios_findstr(const u8 *data, int size, const char *str, int len)
	return 0;
}

#if defined(__powerpc__)
static void
nouveau_bios_shadow_of(struct nouveau_bios *bios)
{
	struct pci_dev *pdev = nv_device(bios)->pdev;
	struct device_node *dn;
	const u32 *data;
	int size, i;

	dn = pci_device_to_OF_node(pdev);
	if (!dn) {
		nv_info(bios, "Unable to get the OF node\n");
		return;
	}

	data = of_get_property(dn, "NVDA,BMP", &size);
	if (data) {
		bios->size = size;
		bios->data = kmalloc(bios->size, GFP_KERNEL);
		if (bios->data)
			memcpy(bios->data, data, size);
	}
}
#endif

static void
nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
{
@@ -221,7 +246,7 @@ nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
}

struct methods {
	const char desc[8];
	const char desc[16];
	void (*shadow)(struct nouveau_bios *);
	const bool rw;
	int score;
@@ -233,6 +258,9 @@ static int
nouveau_bios_shadow(struct nouveau_bios *bios)
{
	struct methods shadow_methods[] = {
#if defined(__powerpc__)
		{ "OpenFirmware", nouveau_bios_shadow_of, true, 0, 0, NULL },
#endif
		{ "PRAMIN", nouveau_bios_shadow_pramin, true, 0, 0, NULL },
		{ "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL },
		{ "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL },
+8 −8
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ static const struct backlight_ops nv40_bl_ops = {
static int
nv40_backlight_init(struct drm_connector *connector)
{
	struct nouveau_drm *drm = nouveau_newpriv(connector->dev);
	struct nouveau_drm *drm = nouveau_drm(connector->dev);
	struct nouveau_device *device = nv_device(drm->device);
	struct backlight_properties props;
	struct backlight_device *bd;
@@ -95,7 +95,7 @@ static int
nv50_get_intensity(struct backlight_device *bd)
{
	struct nouveau_encoder *nv_encoder = bl_get_data(bd);
	struct nouveau_drm *drm = nouveau_newpriv(nv_encoder->base.base.dev);
	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
	struct nouveau_device *device = nv_device(drm->device);
	int or = nv_encoder->or;
	u32 div = 1025;
@@ -110,7 +110,7 @@ static int
nv50_set_intensity(struct backlight_device *bd)
{
	struct nouveau_encoder *nv_encoder = bl_get_data(bd);
	struct nouveau_drm *drm = nouveau_newpriv(nv_encoder->base.base.dev);
	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
	struct nouveau_device *device = nv_device(drm->device);
	int or = nv_encoder->or;
	u32 div = 1025;
@@ -131,7 +131,7 @@ static int
nva3_get_intensity(struct backlight_device *bd)
{
	struct nouveau_encoder *nv_encoder = bl_get_data(bd);
	struct nouveau_drm *drm = nouveau_newpriv(nv_encoder->base.base.dev);
	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
	struct nouveau_device *device = nv_device(drm->device);
	int or = nv_encoder->or;
	u32 div, val;
@@ -149,7 +149,7 @@ static int
nva3_set_intensity(struct backlight_device *bd)
{
	struct nouveau_encoder *nv_encoder = bl_get_data(bd);
	struct nouveau_drm *drm = nouveau_newpriv(nv_encoder->base.base.dev);
	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
	struct nouveau_device *device = nv_device(drm->device);
	int or = nv_encoder->or;
	u32 div, val;
@@ -175,7 +175,7 @@ static const struct backlight_ops nva3_bl_ops = {
static int
nv50_backlight_init(struct drm_connector *connector)
{
	struct nouveau_drm *drm = nouveau_newpriv(connector->dev);
	struct nouveau_drm *drm = nouveau_drm(connector->dev);
	struct nouveau_device *device = nv_device(drm->device);
	struct nouveau_encoder *nv_encoder;
	struct backlight_properties props;
@@ -216,7 +216,7 @@ nv50_backlight_init(struct drm_connector *connector)
int
nouveau_backlight_init(struct drm_device *dev)
{
	struct nouveau_drm *drm = nouveau_newpriv(dev);
	struct nouveau_drm *drm = nouveau_drm(dev);
	struct nouveau_device *device = nv_device(drm->device);
	struct drm_connector *connector;

@@ -250,7 +250,7 @@ nouveau_backlight_init(struct drm_device *dev)
void
nouveau_backlight_exit(struct drm_device *dev)
{
	struct nouveau_drm *drm = nouveau_newpriv(dev);
	struct nouveau_drm *drm = nouveau_drm(dev);

	if (drm->backlight) {
		backlight_device_unregister(drm->backlight);
+149 −121

File changed.

Preview size limit exceeded, changes collapsed.

Loading