-/* $OpenBSD: simplefb.c,v 1.4 2018/07/31 17:25:55 fcambus Exp $ */
+/* $OpenBSD: simplefb.c,v 1.5 2018/08/27 09:30:07 kettenis Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
*
{
struct fdt_attach_args *faa = aux;
+ /* Don't attach if another driver already claimed our framebuffer. */
+ if (faa->fa_nreg > 0 && rasops_check_framebuffer(faa->fa_reg[0].addr))
+ return 0;
+
return OF_is_compatible(faa->fa_node, "simple-framebuffer");
}
pcireg_t type;
int i;
uint8_t rmmio_bar;
+ paddr_t fb_aper;
#if !defined(__sparc64__)
pcireg_t addr, mask;
int s;
}
#endif
+ fb_aper = bus_space_mmap(rdev->memt, rdev->fb_aper_offset, 0, 0, 0);
+ if (fb_aper != -1)
+ rasops_claim_framebuffer(fb_aper, rdev->fb_aper_size, self);
+
rdev->shutdown = true;
config_mountroot(self, radeondrm_attachhook);
}
-/* $OpenBSD: rasops.c,v 1.55 2018/08/25 12:23:45 kettenis Exp $ */
+/* $OpenBSD: rasops.c,v 1.56 2018/08/27 09:30:07 kettenis Exp $ */
/* $NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $ */
/*-
if (scr->rs_crow != -1 && scr->rs_visibleoffset == scr->rs_dispoffset)
rasops_cursor(ri, 1, scr->rs_crow, scr->rs_ccol);
}
+
+struct rasops_framebuffer {
+ SLIST_ENTRY(rasops_framebuffer) rf_list;
+ paddr_t rf_base;
+ psize_t rf_size;
+ struct device *rf_dev;
+};
+
+SLIST_HEAD(, rasops_framebuffer) rasops_framebuffers =
+ SLIST_HEAD_INITIALIZER(&rasops_framebuffers);
+
+void
+rasops_claim_framebuffer(paddr_t base, psize_t size, struct device *dev)
+{
+ struct rasops_framebuffer *rf;
+
+ rf = malloc(sizeof(*rf), M_DEVBUF, M_WAITOK);
+ rf->rf_base = base;
+ rf->rf_size = size;
+ rf->rf_dev = dev;
+
+ SLIST_INSERT_HEAD(&rasops_framebuffers, rf, rf_list);
+}
+
+int
+rasops_check_framebuffer(paddr_t base)
+{
+ struct rasops_framebuffer *rf;
+
+ SLIST_FOREACH(rf, &rasops_framebuffers, rf_list) {
+ if (base >= rf->rf_base && base < rf->rf_base + rf->rf_size)
+ return 1;
+ }
+
+ return 0;
+}
-/* $OpenBSD: rasops.h,v 1.22 2018/04/27 21:36:12 jcs Exp $ */
+/* $OpenBSD: rasops.h,v 1.23 2018/08/27 09:30:07 kettenis Exp $ */
/* $NetBSD: rasops.h,v 1.13 2000/06/13 13:36:54 ad Exp $ */
/*-
int rasops_list_font(void *, struct wsdisplay_font *);
int rasops_getchar(void *, int, int, struct wsdisplay_charcell *);
void rasops_scrollback(void *, void *, int);
+void rasops_claim_framebuffer(paddr_t, psize_t, struct device *);
+int rasops_check_framebuffer(paddr_t);
extern const u_char rasops_isgray[16];
extern const u_char rasops_cmap[256*3];