Code changes for clarity

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Code changes for clarity

johnc
(Not sure if this belongs in tech@ or misc@)

What is the thinking around non-functional code changes that just
improve clarity without functionality changes?  I can imagine bad
experiences with that, but there is certainly room for improvement.

For instance, in the wsdisplay_emulops structure, there are:

int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);

And at the end of the structure is this comment, showing that at
least someone (other than me) was confused by it:
        /* XXX need a free_attr() ??? */

I would suggest that alloc_attr should be renamed to pack_attr, but
there are 84 matches on alloc_attr across 39 unique files.

Similarly, I am taking notes as I read the code, and adding a few
comments in various files and functions could help other people get
up to speed much faster in the future, but I am hesitant to submit
patches. I am hoping to write a decent article about my explorations,
but inline comments are more durable documentation.


Reply | Threaded
Open this post in threaded view
|

Re: Code changes for clarity

Jonathan Gray-11
On Sat, May 16, 2020 at 12:13:37PM -0700, [hidden email] wrote:
> (Not sure if this belongs in tech@ or misc@)

I think tech@ is fine for discussion of code.

>
> What is the thinking around non-functional code changes that just
> improve clarity without functionality changes?  I can imagine bad
> experiences with that, but there is certainly room for improvement.

Split out from any functional changes I don't see a problem.

>
> For instance, in the wsdisplay_emulops structure, there are:
>
> int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
> void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
>
> And at the end of the structure is this comment, showing that at
> least someone (other than me) was confused by it:
> /* XXX need a free_attr() ??? */
>
> I would suggest that alloc_attr should be renamed to pack_attr, but
> there are 84 matches on alloc_attr across 39 unique files.

While alloc_attr() predates unpack_attr() I agree that pack_attr()
would be a better name.  And yes it seems quite a few drivers
across multiple architectures would need to be changed.

>
> Similarly, I am taking notes as I read the code, and adding a few
> comments in various files and functions could help other people get
> up to speed much faster in the future, but I am hesitant to submit
> patches. I am hoping to write a decent article about my explorations,
> but inline comments are more durable documentation.

Comments here sound like a good thing.  wscons originated in NetBSD and
many of the people who have hacked on it in OpenBSD over the years are
no longer around.

Reply | Threaded
Open this post in threaded view
|

Re: Code changes for clarity

Jonathan Gray-11
On Sun, May 17, 2020 at 02:20:08PM +1000, Jonathan Gray wrote:

> On Sat, May 16, 2020 at 12:13:37PM -0700, [hidden email] wrote:
> > (Not sure if this belongs in tech@ or misc@)
>
> I think tech@ is fine for discussion of code.
>
> >
> > What is the thinking around non-functional code changes that just
> > improve clarity without functionality changes?  I can imagine bad
> > experiences with that, but there is certainly room for improvement.
>
> Split out from any functional changes I don't see a problem.
>
> >
> > For instance, in the wsdisplay_emulops structure, there are:
> >
> > int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
> > void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
> >
> > And at the end of the structure is this comment, showing that at
> > least someone (other than me) was confused by it:
> > /* XXX need a free_attr() ??? */
> >
> > I would suggest that alloc_attr should be renamed to pack_attr, but
> > there are 84 matches on alloc_attr across 39 unique files.
>
> While alloc_attr() predates unpack_attr() I agree that pack_attr()
> would be a better name.  And yes it seems quite a few drivers
> across multiple architectures would need to be changed.

here is a rename diff

It is clear that alpha tc fbs are not built as we don't have
dev/rcons/raster.h etc in the tree.

diff --git sys/arch/alpha/tc/cfb.c sys/arch/alpha/tc/cfb.c
index e2b9e7bff7a..64b1f3f32f9 100644
--- sys/arch/alpha/tc/cfb.c
+++ sys/arch/alpha/tc/cfb.c
@@ -77,7 +77,7 @@ struct wsdisplay_emulops cfb_emulfuncs = {
  rcons_erasecols,
  rcons_copyrows,
  rcons_eraserows,
- rcons_alloc_attr
+ rcons_pack_attr
 };
 
 struct wsscreen_descr cfb_stdscreen = {
@@ -341,7 +341,7 @@ cfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
  *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
  *curxp = 0;
  *curyp = 0;
- rcons_alloc_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
+ rcons_pack_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
  *attrp = defattr;
  sc->nscreens++;
  return(0);
@@ -381,7 +381,7 @@ cfb_cnattach(addr)
 
  cfb_getdevconfig(addr, dcp);
 
- rcons_alloc_attr(&dcp->dc_rcons, 0, 0, 0, &defattr);
+ rcons_pack_attr(&dcp->dc_rcons, 0, 0, 0, &defattr);
 
  wsdisplay_cnattach(&cfb_stdscreen, &dcp->dc_rcons,
  0,0, defattr;);
diff --git sys/arch/alpha/tc/sfb.c sys/arch/alpha/tc/sfb.c
index 81b80e09ee8..b491b03d30f 100644
--- sys/arch/alpha/tc/sfb.c
+++ sys/arch/alpha/tc/sfb.c
@@ -77,7 +77,7 @@ struct wsdisplay_emulops sfb_emulfuncs = {
         rcons_erasecols,
         rcons_copyrows,
         rcons_eraserows,
-        rcons_alloc_attr
+        rcons_pack_attr
 };
 
 struct wsscreen_descr sfb_stdscreen = {
@@ -374,7 +374,7 @@ sfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
         *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
         *curxp = 0;
         *curyp = 0;
- rcons_alloc_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
+ rcons_pack_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
  *attrp = defattr;
  sc->nscreens++;
         return (0);
@@ -415,7 +415,7 @@ sfb_cnattach(addr)
 
         sfb_getdevconfig(addr, dcp);
 
- rcons_alloc_attr(&dcp->dc_rcons, 0, 0, 0, &defattr);
+ rcons_pack_attr(&dcp->dc_rcons, 0, 0, 0, &defattr);
 
         wsdisplay_cnattach(&sfb_stdscreen, &dcp->dc_rcons,
                            0, 0, defattr);
diff --git sys/arch/amd64/amd64/efifb.c sys/arch/amd64/amd64/efifb.c
index 69d6a01bad4..eb62ae07137 100644
--- sys/arch/amd64/amd64/efifb.c
+++ sys/arch/amd64/amd64/efifb.c
@@ -222,7 +222,7 @@ efifb_attach(struct device *parent, struct device *self, void *aux)
 
  rasops_init(ri, efifb_std_descr.nrows, efifb_std_descr.ncols);
 
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&efifb_std_descr, ri->ri_active, ccol, crow,
     defattr);
  }
@@ -445,7 +445,7 @@ efifb_cnattach_common(void)
  efifb_std_descr.fontheight = ri->ri_font->fontheight;
  efifb_std_descr.capabilities = ri->ri_caps;
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&efifb_std_descr, ri, 0, 0, defattr);
 }
 
diff --git sys/arch/armv7/exynos/exdisplay.c sys/arch/armv7/exynos/exdisplay.c
index a80171fcc2b..41390aeb864 100644
--- sys/arch/armv7/exynos/exdisplay.c
+++ sys/arch/armv7/exynos/exdisplay.c
@@ -152,7 +152,7 @@ exdisplay_attach(struct device *parent, struct device *self, void *args)
  ri->ri_bits = (u_char *)sc->sc_fbioh;
  exdisplay_setup_rasops(ri, &exdisplay_stdscreen);
 
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&exdisplay_stdscreen, ri->ri_active,
     0, 0, defattr);
  }
@@ -184,7 +184,7 @@ exdisplay_cnattach(bus_space_tag_t iot, bus_addr_t iobase, size_t size)
  exdisplay_setup_rasops(ri, descr);
 
  /* assumes 16 bpp */
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
 
  wsdisplay_cnattach(descr, ri, ri->ri_ccol, ri->ri_crow, defattr);
 
diff --git sys/arch/armv7/omap/omdisplay.c sys/arch/armv7/omap/omdisplay.c
index 7935b36ce19..01aa0dc4700 100644
--- sys/arch/armv7/omap/omdisplay.c
+++ sys/arch/armv7/omap/omdisplay.c
@@ -1170,7 +1170,7 @@ omdisplay_alloc_screen(void *v, const struct wsscreen_descr *_type,
  omdisplay_setup_rasops(sc, ri);
 
  /* assumes 16 bpp */
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, attrp);
 
  *cookiep = ri;
  *curxp = 0;
diff --git sys/arch/loongson/dev/radeonfb.c sys/arch/loongson/dev/radeonfb.c
index 294910452b6..f8e14f2f742 100644
--- sys/arch/loongson/dev/radeonfb.c
+++ sys/arch/loongson/dev/radeonfb.c
@@ -263,7 +263,7 @@ radeonfb_alloc_screen(void *v, const struct wsscreen_descr *type,
 
  *cookiep = ri;
  *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, attrp);
  sc->sc_nscr++;
 
  return 0;
@@ -722,7 +722,7 @@ radeonfb_cnattach(bus_space_tag_t memt, bus_space_tag_t iot, pcitag_t tag,
  return rc;
 
  ri = &radeonfbcn.ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&radeonfbcn.wsd, ri, 0, 0, defattr);
 
  return 0;
diff --git sys/arch/loongson/dev/sisfb.c sys/arch/loongson/dev/sisfb.c
index 4268ea1d8dc..a8b31f6272e 100644
--- sys/arch/loongson/dev/sisfb.c
+++ sys/arch/loongson/dev/sisfb.c
@@ -278,7 +278,7 @@ sisfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
 
  *cookiep = ri;
  *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, attrp);
  sc->sc_nscr++;
 
  return 0;
@@ -652,7 +652,7 @@ sisfb_cnattach(bus_space_tag_t memt, bus_space_tag_t iot, pcitag_t tag,
  return rc;
 
  ri = &sisfbcn.ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&sisfbcn.wsd, ri, 0, 0, defattr);
 
  return 0;
diff --git sys/arch/loongson/dev/smfb.c sys/arch/loongson/dev/smfb.c
index cc104bdc234..ff4044864a8 100644
--- sys/arch/loongson/dev/smfb.c
+++ sys/arch/loongson/dev/smfb.c
@@ -251,7 +251,7 @@ smfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
 
  *cookiep = ri;
  *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, attrp);
  sc->sc_nscr++;
 
  return 0;
@@ -721,7 +721,7 @@ smfb_cnattach(bus_space_tag_t memt, bus_space_tag_t iot, pcitag_t tag,
  return rc;
 
  ri = &smfbcn.ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&smfbcn.wsd, ri, 0, 0, defattr);
 
  return 0;
diff --git sys/arch/luna88k/dev/lunafb.c sys/arch/luna88k/dev/lunafb.c
index 80d39488b9c..926caa96a14 100644
--- sys/arch/luna88k/dev/lunafb.c
+++ sys/arch/luna88k/dev/lunafb.c
@@ -221,7 +221,7 @@ omfb_cnattach(void)
  long defattr;
 
  omfb_getdevconfig(OMFB_FB_WADDR, dc);
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&omfb_stdscreen, ri, 0, 0, defattr);
  omfb_console = 1;
  return (0);
@@ -480,7 +480,7 @@ omfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
  *cookiep = ri;
  *curxp = 0;
  *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, attrp);
  sc->nscreens++;
  return (0);
 }
diff --git sys/arch/luna88k/dev/omrasops.c sys/arch/luna88k/dev/omrasops.c
index 5c7cb6f2b15..2e6c5214f97 100644
--- sys/arch/luna88k/dev/omrasops.c
+++ sys/arch/luna88k/dev/omrasops.c
@@ -74,7 +74,7 @@ int om4_windowmove(struct rasops_info *, u_int16_t, u_int16_t, u_int16_t,
  u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
 
 /* MI function in src/sys/dev/rasops/rasops.c */
-int     rasops_alloc_cattr(void *, int, int, int, long *);
+int     rasops_pack_cattr(void *, int, int, int, long *);
 
 static int (*om_windowmove)(struct rasops_info *, u_int16_t, u_int16_t,
  u_int16_t, u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
@@ -534,8 +534,8 @@ setup_omrasops4(struct rasops_info *ri)
  = WSSCREEN_HILIT | WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
  /*
  * Since we set ri->ri_depth == 1, rasops_init() set
- * rasops_alloc_mattr for us.  But we use the color version,
- * rasops_alloc_cattr, on 4bpp/8bpp frame buffer.
+ * rasops_pack_mattr for us.  But we use the color version,
+ * rasops_pack_cattr, on 4bpp/8bpp frame buffer.
  */
- ri->ri_ops.alloc_attr = rasops_alloc_cattr;
+ ri->ri_ops.pack_attr = rasops_pack_cattr;
 }
diff --git sys/arch/macppc/macppc/ofw_machdep.c sys/arch/macppc/macppc/ofw_machdep.c
index ed9232f80c8..76e6c136630 100644
--- sys/arch/macppc/macppc/ofw_machdep.c
+++ sys/arch/macppc/macppc/ofw_machdep.c
@@ -511,7 +511,7 @@ of_display_console(void)
  fb->ofw_wsd.fontheight = ri->ri_font->fontheight;
 #endif
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&fb->ofw_wsd, ri, 0, 0, defattr);
 }
 #endif
diff --git sys/arch/macppc/pci/vgafb.c sys/arch/macppc/pci/vgafb.c
index 1e9def6fcca..73a8e90b6c9 100644
--- sys/arch/macppc/pci/vgafb.c
+++ sys/arch/macppc/pci/vgafb.c
@@ -196,7 +196,7 @@ vgafb_console_init(struct vgafb_softc *sc)
  sc->sc_wsd.fontwidth = ri->ri_font->fontwidth;
  sc->sc_wsd.fontheight = ri->ri_font->fontheight;
 
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&sc->sc_wsd, ri->ri_active, ri->ri_ccol, ri->ri_crow,
     defattr);
 
diff --git sys/arch/sgi/dev/gbe.c sys/arch/sgi/dev/gbe.c
index fb862387e9c..2b45b927725 100644
--- sys/arch/sgi/dev/gbe.c
+++ sys/arch/sgi/dev/gbe.c
@@ -401,7 +401,7 @@ gbe_attach(struct device *parent, struct device *self, void *aux)
 
  /* Attach as console if necessary. */
  if (strncmp(bios_console, "video", 5) == 0) {
- screen->ri.ri_ops.alloc_attr(&screen->ri, 0, 0, 0, &attr);
+ screen->ri.ri_ops.pack_attr(&screen->ri, 0, 0, 0, &attr);
  wsdisplay_cnattach(&gbe_stdscreen, &screen->ri, 0, 0, attr);
  gsc->console = 1;
  }
@@ -964,7 +964,7 @@ gbe_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
  *curyp = 0;
 
  /* Correct screen attributes. */
- screen->ri.ri_ops.alloc_attr(&screen->ri, 0, 0, 0, attrp);
+ screen->ri.ri_ops.pack_attr(&screen->ri, 0, 0, 0, attrp);
 
  return (0);
 }
@@ -1402,7 +1402,7 @@ gbe_cnattach(bus_space_tag_t iot, bus_addr_t addr)
  /*
  * Attach wsdisplay.
  */
- gbe_consdata.ri.ri_ops.alloc_attr(&gbe_consdata.ri, 0, 0, 0, &attr);
+ gbe_consdata.ri.ri_ops.pack_attr(&gbe_consdata.ri, 0, 0, 0, &attr);
  wsdisplay_cnattach(&gbe_stdscreen, &gbe_consdata.ri, 0, 0, attr);
  gbe_console = 1;
 
diff --git sys/arch/sgi/dev/impact.c sys/arch/sgi/dev/impact.c
index 7c181e267e6..85ce81e2006 100644
--- sys/arch/sgi/dev/impact.c
+++ sys/arch/sgi/dev/impact.c
@@ -448,7 +448,7 @@ impact_alloc_screen(void *v, const struct wsscreen_descr *type,
  *cookiep = ri;
  *curxp = 0;
  *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &scr->defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &scr->defattr);
  *attrp = scr->defattr;
 
  return 0;
@@ -769,7 +769,7 @@ impact_cnattach_common(bus_space_tag_t iot, bus_space_handle_t ioh, int has_hq4)
  if (rc != 0)
  return rc;
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &scr->defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &scr->defattr);
  wsdisplay_cnattach(&scr->wsd, ri, 0, 0, scr->defattr);
 
  return 0;
diff --git sys/arch/sgi/gio/grtwo.c sys/arch/sgi/gio/grtwo.c
index 85065c79453..ce87c4ce1f3 100644
--- sys/arch/sgi/gio/grtwo.c
+++ sys/arch/sgi/gio/grtwo.c
@@ -469,7 +469,7 @@ grtwo_cnattach(struct gio_attach_args *ga)
  if (rc != 0)
  return rc;
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  cell = grtwo_console_bs;
  for (i = ri->ri_cols * ri->ri_rows; i != 0; i--, cell++)
  cell->attr = defattr;
@@ -828,7 +828,7 @@ grtwo_alloc_screen(void *v, const struct wsscreen_descr * type, void **cookiep,
 
  *cookiep = ri;
  *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &dc->dc_defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &dc->dc_defattr);
  *attrp = dc->dc_defattr;
 
  cell = dc->dc_bs;
diff --git sys/arch/sgi/gio/light.c sys/arch/sgi/gio/light.c
index 39a77a58fe6..6e9ecd17423 100644
--- sys/arch/sgi/gio/light.c
+++ sys/arch/sgi/gio/light.c
@@ -447,7 +447,7 @@ light_cnattach(struct gio_attach_args *ga)
  light_attach_common(&light_console_dc, ga);
  light_init_screen(&light_console_dc);
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&light_console_dc.dc_wsd, ri, 0, 0, defattr);
 
  return 0;
@@ -743,7 +743,7 @@ light_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
 
  *cookiep = ri;
  *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &dc->dc_defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &dc->dc_defattr);
  *attrp = dc->dc_defattr;
 
  return 0;
diff --git sys/arch/sgi/gio/newport.c sys/arch/sgi/gio/newport.c
index 97e0f43597e..e8e30f14197 100644
--- sys/arch/sgi/gio/newport.c
+++ sys/arch/sgi/gio/newport.c
@@ -588,7 +588,7 @@ newport_cnattach(struct gio_attach_args *ga)
  if (rc != 0)
  return rc;
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&newport_console_dc.dc_wsd, ri, 0, 0, defattr);
 
  return 0;
@@ -823,7 +823,7 @@ newport_alloc_screen(void *v, const struct wsscreen_descr *type,
 
  *cookiep = ri;
  *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &dc->dc_defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &dc->dc_defattr);
  *attrp = dc->dc_defattr;
 
  return 0;
diff --git sys/arch/sgi/xbow/odyssey.c sys/arch/sgi/xbow/odyssey.c
index 64c46aee053..7c566c452ab 100644
--- sys/arch/sgi/xbow/odyssey.c
+++ sys/arch/sgi/xbow/odyssey.c
@@ -672,7 +672,7 @@ odyssey_alloc_screen(void *v, const struct wsscreen_descr *type,
  *curyp = 0;
 
  /* Correct screen attributes. */
- screen->ri.ri_ops.alloc_attr(&screen->ri, 0, 0, 0, attrp);
+ screen->ri.ri_ops.pack_attr(&screen->ri, 0, 0, 0, attrp);
  screen->attr = *attrp;
 
  return (0);
@@ -1135,7 +1135,7 @@ odyssey_cnattach()
  /*
  * Attach wsdisplay.
  */
- screen->ri.ri_ops.alloc_attr(&screen->ri, 0, 0, 0, &screen->attr);
+ screen->ri.ri_ops.pack_attr(&screen->ri, 0, 0, 0, &screen->attr);
  wsdisplay_cnattach(&odyssey_stdscreen, &screen->ri, 0, 0, screen->attr);
 
  return 0;
diff --git sys/arch/sparc64/dev/creator.c sys/arch/sparc64/dev/creator.c
index 8edeb55c36c..08e72e0ab75 100644
--- sys/arch/sparc64/dev/creator.c
+++ sys/arch/sparc64/dev/creator.c
@@ -248,7 +248,7 @@ creator_ioctl(v, cmd, data, flags, p)
  creator_ras_init(sc);
 
  /* Clear screen. */
- ri->ri_ops.alloc_attr(ri,
+ ri->ri_ops.pack_attr(ri,
     WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, &attr);
  ri->ri_ops.eraserows(ri, 0, ri->ri_rows, attr);
  }
diff --git sys/arch/sparc64/dev/fb.c sys/arch/sparc64/dev/fb.c
index 4cc28492c86..c7e69ab8ca3 100644
--- sys/arch/sparc64/dev/fb.c
+++ sys/arch/sparc64/dev/fb.c
@@ -363,10 +363,10 @@ fbwscons_console_init(struct sunfb *sf, int row)
  cookie = ri;
 
  if (ISSET(ri->ri_caps, WSSCREEN_WSCOLORS))
- ri->ri_ops.alloc_attr(cookie,
+ ri->ri_ops.pack_attr(cookie,
     WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, &defattr);
  else
- ri->ri_ops.alloc_attr(cookie, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(cookie, 0, 0, 0, &defattr);
 
  fb_initwsd(sf);
  wsdisplay_cnattach(&sf->sf_wsd, cookie,
@@ -462,10 +462,10 @@ fb_alloc_screen(void *v, const struct wsscreen_descr *type,
  *curyp = 0;
  *curxp = 0;
  if (ISSET(ri->ri_caps, WSSCREEN_WSCOLORS))
- ri->ri_ops.alloc_attr(cookie,
+ ri->ri_ops.pack_attr(cookie,
     WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp);
  else
- ri->ri_ops.alloc_attr(cookie, 0, 0, 0, attrp);
+ ri->ri_ops.pack_attr(cookie, 0, 0, 0, attrp);
  sf->sf_nscreens++;
  return (0);
 }
diff --git sys/dev/fdt/rkdrm.c sys/dev/fdt/rkdrm.c
index edaec683e4c..cd62c82790c 100644
--- sys/dev/fdt/rkdrm.c
+++ sys/dev/fdt/rkdrm.c
@@ -522,7 +522,7 @@ rkdrm_attachhook(struct device *dev)
  rkdrm_stdscreen.fontheight = ri->ri_font->fontheight;
 
  if (console) {
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&rkdrm_stdscreen, ri->ri_active,
     ri->ri_ccol, ri->ri_crow, defattr);
  }
diff --git sys/dev/fdt/simplefb.c sys/dev/fdt/simplefb.c
index 5f911d74a45..8e6380f9ed0 100644
--- sys/dev/fdt/simplefb.c
+++ sys/dev/fdt/simplefb.c
@@ -177,7 +177,7 @@ simplefb_attach(struct device *parent, struct device *self, void *aux)
  sc->sc_wsl.screens = (const struct wsscreen_descr **)sc->sc_scrlist;
 
  if (console) {
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&sc->sc_wsd, ri->ri_active,
     simplefb_ri.ri_ccol, simplefb_ri.ri_crow, defattr);
  }
@@ -343,7 +343,7 @@ simplefb_init_cons(bus_space_tag_t iot)
  simplefb_wsd.fontwidth = ri->ri_font->fontwidth;
  simplefb_wsd.fontheight = ri->ri_font->fontheight;
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&simplefb_wsd, ri, 0, 0, defattr);
 
 #if NUKBD > 0
diff --git sys/dev/ic/sti.c sys/dev/ic/sti.c
index 8be71bcdfa2..16a4188460c 100644
--- sys/dev/ic/sti.c
+++ sys/dev/ic/sti.c
@@ -53,7 +53,7 @@ struct cfdriver sti_cd = {
  NULL, "sti", DV_DULL
 };
 
-int sti_alloc_attr(void *, int, int, int, long *);
+int sti_pack_attr(void *, int, int, int, long *);
 int sti_copycols(void *, int, int, int, int);
 int sti_copyrows(void *, int, int, int);
 int sti_cursor(void *, int, int, int);
@@ -71,7 +71,7 @@ struct wsdisplay_emulops sti_emulops = {
  .erasecols = sti_erasecols,
  .copyrows = sti_copyrows,
  .eraserows = sti_eraserows,
- .alloc_attr = sti_alloc_attr,
+ .pack_attr = sti_pack_attr,
  .unpack_attr = sti_unpack_attr
 };
 
@@ -772,7 +772,7 @@ sti_end_attach_screen(struct sti_softc *sc, struct sti_screen *scr, int console)
  if (console && !ISSET(sc->sc_flags, STI_ATTACHED)) {
  long defattr;
 
- sti_alloc_attr(scr, 0, 0, 0, &defattr);
+ sti_pack_attr(scr, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&scr->scr_wsd, scr,
     0, scr->scr_wsd.nrows - 1, defattr);
  sc->sc_flags |= STI_ATTACHED;
@@ -1205,7 +1205,7 @@ sti_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
  *cookiep = scr;
  *cxp = 0;
  *cyp = 0;
- sti_alloc_attr(scr, 0, 0, 0, defattr);
+ sti_pack_attr(scr, 0, 0, 0, defattr);
  scr->scr_nscreens++;
  return 0;
 }
@@ -1419,7 +1419,7 @@ sti_eraserows(void *v, int srcrow, int nrows, long attr)
 }
 
 int
-sti_alloc_attr(void *v, int fg, int bg, int flags, long *pattr)
+sti_pack_attr(void *v, int fg, int bg, int flags, long *pattr)
 {
 #if 0
  struct sti_screen *scr = (struct sti_screen *)v;
diff --git sys/dev/ic/vga.c sys/dev/ic/vga.c
index cf8bfbab7a8..1d3546b6d30 100644
--- sys/dev/ic/vga.c
+++ sys/dev/ic/vga.c
@@ -113,7 +113,7 @@ void vga_pick_monitor_type(struct vga_config *);
 
 int vga_mapchar(void *, int, unsigned int *);
 int vga_putchar(void *, int, int, u_int, long);
-int vga_alloc_attr(void *, int, int, int, long *);
+int vga_pack_attr(void *, int, int, int, long *);
 int vga_copyrows(void *, int, int, int);
 void vga_unpack_attr(void *, long, int *, int *, int *);
 
@@ -125,7 +125,7 @@ static const struct wsdisplay_emulops vga_emulops = {
  pcdisplay_erasecols,
  vga_copyrows,
  pcdisplay_eraserows,
- vga_alloc_attr,
+ vga_pack_attr,
  vga_unpack_attr
 };
 
@@ -439,11 +439,11 @@ vga_init_screen(struct vga_config *vc, struct vgascreen *scr,
  /*
  * DEC firmware uses a blue background.
  */
- res = vga_alloc_attr(scr, WSCOL_WHITE, WSCOL_BLUE,
+ res = vga_pack_attr(scr, WSCOL_WHITE, WSCOL_BLUE,
      WSATTR_WSCOLORS, attrp);
  else
 #endif
- res = vga_alloc_attr(scr, 0, 0, 0, attrp);
+ res = vga_pack_attr(scr, 0, 0, 0, attrp);
 #ifdef DIAGNOSTIC
  if (res)
  panic("vga_init_screen: attribute botch");
@@ -985,7 +985,7 @@ vga_scrollback(void *v, void *cookie, int lines)
 }
 
 int
-vga_alloc_attr(void *id, int fg, int bg, int flags, long *attrp)
+vga_pack_attr(void *id, int fg, int bg, int flags, long *attrp)
 {
  struct vgascreen *scr = id;
  struct vga_config *vc = scr->cfg;
diff --git sys/dev/isa/pcdisplay.c sys/dev/isa/pcdisplay.c
index 8b581588ecb..bd766fbe30f 100644
--- sys/dev/isa/pcdisplay.c
+++ sys/dev/isa/pcdisplay.c
@@ -70,7 +70,7 @@ static int pcdisplay_probe_mono(bus_space_tag_t, bus_space_tag_t);
 static void pcdisplay_init(struct pcdisplay_config *,
      bus_space_tag_t, bus_space_tag_t,
      int);
-static int pcdisplay_alloc_attr(void *, int, int, int, long *);
+static int pcdisplay_pack_attr(void *, int, int, int, long *);
 static void pcdisplay_unpack_attr(void *, long, int *, int *, int *);
 
 struct cfattach pcdisplay_ca = {
@@ -85,7 +85,7 @@ const struct wsdisplay_emulops pcdisplay_emulops = {
  pcdisplay_erasecols,
  pcdisplay_copyrows,
  pcdisplay_eraserows,
- pcdisplay_alloc_attr,
+ pcdisplay_pack_attr,
  pcdisplay_unpack_attr
 };
 
@@ -375,7 +375,7 @@ pcdisplay_show_screen(void *v, void *cookie, int waitok,
 }
 
 static int
-pcdisplay_alloc_attr(void *id, int fg, int bg, int flags, long *attrp)
+pcdisplay_pack_attr(void *id, int fg, int bg, int flags, long *attrp)
 {
  if (flags & WSATTR_REVERSE)
  *attrp = FG_BLACK | BG_LIGHTGREY;
diff --git sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
index 619e8289840..4d76c319407 100644
--- sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
+++ sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
@@ -1828,7 +1828,7 @@ amdgpu_attachhook(struct device *self)
  if (adev->console) {
  long defattr;
 
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&amdgpu_stdscreen, ri->ri_active,
     ri->ri_ccol, ri->ri_crow, defattr);
  }
diff --git sys/dev/pci/drm/i915/i915_drv.c sys/dev/pci/drm/i915/i915_drv.c
index 78e503090c3..c245e7e058c 100644
--- sys/dev/pci/drm/i915/i915_drv.c
+++ sys/dev/pci/drm/i915/i915_drv.c
@@ -3667,7 +3667,7 @@ inteldrm_attachhook(struct device *self)
  if (ri->ri_flg & (RI_ROTATE_CW | RI_ROTATE_CCW))
  memset(ri->ri_bits, 0, ri->ri_height * ri->ri_stride);
 
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&inteldrm_stdscreen, ri->ri_active,
     0, 0, defattr);
  }
diff --git sys/dev/pci/drm/radeon/radeon_kms.c sys/dev/pci/drm/radeon/radeon_kms.c
index 9d2fd579380..c942930d6d8 100644
--- sys/dev/pci/drm/radeon/radeon_kms.c
+++ sys/dev/pci/drm/radeon/radeon_kms.c
@@ -797,7 +797,7 @@ radeondrm_attachhook(struct device *self)
  if (rdev->console) {
  long defattr;
 
- ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
+ ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&radeondrm_stdscreen, ri->ri_active,
     ri->ri_ccol, ri->ri_crow, defattr);
  }
diff --git sys/dev/pci/tga.c sys/dev/pci/tga.c
index 94bad789fe5..0fb9d10a4bb 100644
--- sys/dev/pci/tga.c
+++ sys/dev/pci/tga.c
@@ -742,7 +742,7 @@ tga_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
  *cookiep = &sc->sc_dc->dc_rinfo; /* one and only for now */
  *curxp = 0;
  *curyp = 0;
- sc->sc_dc->dc_rinfo.ri_ops.alloc_attr(&sc->sc_dc->dc_rinfo,
+ sc->sc_dc->dc_rinfo.ri_ops.pack_attr(&sc->sc_dc->dc_rinfo,
  0, 0, 0, &defattr);
  *attrp = defattr;
  sc->nscreens++;
@@ -871,7 +871,7 @@ tga_cnattach(iot, memt, pc, bus, device, function)
  tga_bt463_rd);
  }
  }
- dcp->dc_rinfo.ri_ops.alloc_attr(&dcp->dc_rinfo, 0, 0, 0, &defattr);
+ dcp->dc_rinfo.ri_ops.pack_attr(&dcp->dc_rinfo, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&tga_stdscreen, &dcp->dc_rinfo, 0, 0, defattr);
 
  return(0);
diff --git sys/dev/pcmcia/cfxga.c sys/dev/pcmcia/cfxga.c
index 318710d9c14..221dd3e0211 100644
--- sys/dev/pcmcia/cfxga.c
+++ sys/dev/pcmcia/cfxga.c
@@ -536,7 +536,7 @@ cfxga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
  LIST_INSERT_HEAD(&sc->sc_scr, scr, scr_link);
  sc->sc_nscreens++;
 
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
+ ri->ri_ops.pack_attr(ri, 0, 0, 0, attrp);
 
  *cookiep = ri;
  *curxp = *curyp = 0;
diff --git sys/dev/rasops/rasops.c sys/dev/rasops/rasops.c
index 6bb38705211..9bc3f1748c6 100644
--- sys/dev/rasops/rasops.c
+++ sys/dev/rasops/rasops.c
@@ -151,8 +151,8 @@ int rasops_copycols(void *, int, int, int, int);
 int rasops_copyrows(void *, int, int, int);
 int rasops_mapchar(void *, int, u_int *);
 int rasops_cursor(void *, int, int, int);
-int rasops_alloc_cattr(void *, int, int, int, long *);
-int rasops_alloc_mattr(void *, int, int, int, long *);
+int rasops_pack_cattr(void *, int, int, int, long *);
+int rasops_pack_mattr(void *, int, int, int, long *);
 int rasops_do_cursor(struct rasops_info *);
 void rasops_init_devcmap(struct rasops_info *);
 void rasops_unpack_attr(void *, long, int *, int *, int *);
@@ -187,7 +187,7 @@ int rasops_vcons_copycols(void *, int, int, int, int);
 int rasops_vcons_erasecols(void *, int, int, int, long);
 int rasops_vcons_copyrows(void *, int, int, int);
 int rasops_vcons_eraserows(void *, int, int, long);
-int rasops_vcons_alloc_attr(void *, int, int, int, long *);
+int rasops_vcons_pack_attr(void *, int, int, int, long *);
 void rasops_vcons_unpack_attr(void *, long, int *, int *, int *);
 
 int rasops_wronly_putchar(void *, int, int, u_int, long);
@@ -283,7 +283,7 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
  ri->ri_erasecols = ri->ri_ops.erasecols;
  ri->ri_copyrows = ri->ri_ops.copyrows;
  ri->ri_eraserows = ri->ri_ops.eraserows;
- ri->ri_alloc_attr = ri->ri_ops.alloc_attr;
+ ri->ri_pack_attr = ri->ri_ops.pack_attr;
 
  if (ri->ri_flg & RI_VCONS) {
  void *cookie;
@@ -304,7 +304,7 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
  ri->ri_ops.erasecols = rasops_vcons_erasecols;
  ri->ri_ops.copyrows = rasops_vcons_copyrows;
  ri->ri_ops.eraserows = rasops_vcons_eraserows;
- ri->ri_ops.alloc_attr = rasops_vcons_alloc_attr;
+ ri->ri_ops.pack_attr = rasops_vcons_pack_attr;
  ri->ri_ops.unpack_attr = rasops_vcons_unpack_attr;
  ri->ri_do_cursor = rasops_wronly_do_cursor;
  } else if ((ri->ri_flg & RI_WRONLY) && ri->ri_bs != NULL) {
@@ -319,7 +319,7 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
  ri->ri_do_cursor = rasops_wronly_do_cursor;
 
  if (ri->ri_flg & RI_CLEAR) {
- ri->ri_alloc_attr(ri, 0, 0, 0, &attr);
+ ri->ri_pack_attr(ri, 0, 0, 0, &attr);
  for (i = 0; i < ri->ri_rows * ri->ri_cols; i++) {
  ri->ri_bs[i].uc = ' ';
  ri->ri_bs[i].attr = attr;
@@ -446,10 +446,10 @@ rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols)
  ri->ri_updatecursor = NULL;
 
  if (ri->ri_depth < 8 || (ri->ri_flg & RI_FORCEMONO) != 0) {
- ri->ri_ops.alloc_attr = rasops_alloc_mattr;
+ ri->ri_ops.pack_attr = rasops_pack_mattr;
  ri->ri_caps = WSSCREEN_UNDERLINE | WSSCREEN_REVERSE;
  } else {
- ri->ri_ops.alloc_attr = rasops_alloc_cattr;
+ ri->ri_ops.pack_attr = rasops_pack_cattr;
  ri->ri_caps = WSSCREEN_UNDERLINE | WSSCREEN_HILIT |
     WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
  }
@@ -548,10 +548,10 @@ rasops_mapchar(void *cookie, int c, u_int *cp)
 }
 
 /*
- * Allocate a color attribute.
+ * Pack a color attribute.
  */
 int
-rasops_alloc_cattr(void *cookie, int fg, int bg, int flg, long *attr)
+rasops_pack_cattr(void *cookie, int fg, int bg, int flg, long *attr)
 {
  int swap;
 
@@ -589,10 +589,10 @@ rasops_alloc_cattr(void *cookie, int fg, int bg, int flg, long *attr)
 }
 
 /*
- * Allocate a mono attribute.
+ * Pack a mono attribute.
  */
 int
-rasops_alloc_mattr(void *cookie, int fg, int bg, int flg, long *attr)
+rasops_pack_mattr(void *cookie, int fg, int bg, int flg, long *attr)
 {
  int swap;
 
@@ -1423,7 +1423,7 @@ rasops_alloc_screen(void *v, void **cookiep,
  *cookiep = scr;
  *curxp = 0;
  *curyp = 0;
- ri->ri_alloc_attr(ri, 0, 0, 0, attrp);
+ ri->ri_pack_attr(ri, 0, 0, 0, attrp);
 
  scr->rs_ri = ri;
  scr->rs_visible = (ri->ri_nscreens == 0);
@@ -1678,11 +1678,11 @@ rasops_vcons_eraserows(void *cookie, int row, int num, long attr)
 }
 
 int
-rasops_vcons_alloc_attr(void *cookie, int fg, int bg, int flg, long *attr)
+rasops_vcons_pack_attr(void *cookie, int fg, int bg, int flg, long *attr)
 {
  struct rasops_screen *scr = cookie;
 
- return scr->rs_ri->ri_alloc_attr(scr->rs_ri, fg, bg, flg, attr);
+ return scr->rs_ri->ri_pack_attr(scr->rs_ri, fg, bg, flg, attr);
 }
 
 void
diff --git sys/dev/rasops/rasops.h sys/dev/rasops/rasops.h
index 89de261be89..a363ae800a2 100644
--- sys/dev/rasops/rasops.h
+++ sys/dev/rasops/rasops.h
@@ -135,7 +135,7 @@ struct rasops_info {
  int (*ri_erasecols)(void *, int, int, int, long);
  int (*ri_copyrows)(void *, int, int, int);
  int (*ri_eraserows)(void *, int, int, long);
- int (*ri_alloc_attr)(void *, int, int, int, long *);
+ int (*ri_pack_attr)(void *, int, int, int, long *);
 };
 
 #define DELTA(p, d, cast) ((p) = (cast)((caddr_t)(p) + (d)))
diff --git sys/dev/usb/udl.c sys/dev/usb/udl.c
index 7c59abc1382..95af7210b7b 100644
--- sys/dev/usb/udl.c
+++ sys/dev/usb/udl.c
@@ -627,7 +627,7 @@ udl_alloc_screen(void *v, const struct wsscreen_descr *type,
  sc->sc_ri.ri_ops.putchar = udl_putchar;
  sc->sc_ri.ri_do_cursor = udl_do_cursor;
 
- sc->sc_ri.ri_ops.alloc_attr(&sc->sc_ri, 0, 0, 0, attrp);
+ sc->sc_ri.ri_ops.pack_attr(&sc->sc_ri, 0, 0, 0, attrp);
 
  udl_stdscreen.nrows = sc->sc_ri.ri_rows;
  udl_stdscreen.ncols = sc->sc_ri.ri_cols;
diff --git sys/dev/wscons/wsdisplay.c sys/dev/wscons/wsdisplay.c
index 7433d3a0ff4..983d4c967fa 100644
--- sys/dev/wscons/wsdisplay.c
+++ sys/dev/wscons/wsdisplay.c
@@ -2692,7 +2692,7 @@ inverse_char(struct wsscreen *scr, u_int pos)
  } else if (dconf->scrdata->capabilities & WSSCREEN_REVERSE) {
  flags |= WSATTR_REVERSE;
  }
- if ((*dconf->emulops->alloc_attr)(dconf->emulcookie, fg, bg, flags |
+ if ((*dconf->emulops->pack_attr)(dconf->emulcookie, fg, bg, flags |
     (ul ? WSATTR_UNDERLINE : 0), &attr) == 0) {
  cell.attr = attr;
  PUTCHAR(dconf, pos, cell.uc, cell.attr);
diff --git sys/dev/wscons/wsdisplayvar.h sys/dev/wscons/wsdisplayvar.h
index 170180a7363..9465f7af345 100644
--- sys/dev/wscons/wsdisplayvar.h
+++ sys/dev/wscons/wsdisplayvar.h
@@ -79,7 +79,7 @@ struct wsdisplay_emulops {
  int (*erasecols)(void *c, int row, int startcol, int ncols, long);
  int (*copyrows)(void *c, int srcrow, int dstrow, int nrows);
  int (*eraserows)(void *c, int row, int nrows, long attr);
- int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
+ int (*pack_attr)(void *c, int fg, int bg, int flags, long *attrp);
  void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
 /* fg / bg values. Made identical to ANSI terminal color codes. */
 #define WSCOL_BLACK 0
@@ -96,7 +96,6 @@ struct wsdisplay_emulops {
 #define WSATTR_BLINK 4
 #define WSATTR_UNDERLINE 8
 #define WSATTR_WSCOLORS 16
- /* XXX need a free_attr() ??? */
 };
 
 #define WSSCREEN_NAME_SIZE 16
diff --git sys/dev/wscons/wsemul_sun.c sys/dev/wscons/wsemul_sun.c
index 4d2f02d046a..d511a8dac24 100644
--- sys/dev/wscons/wsemul_sun.c
+++ sys/dev/wscons/wsemul_sun.c
@@ -213,12 +213,12 @@ wsemul_sun_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
 #define WS_KERNEL_MONOATTR 0
 #endif
  if (type->capabilities & WSSCREEN_WSCOLORS)
- res = (*edp->emulops->alloc_attr)(cookie,
+ res = (*edp->emulops->pack_attr)(cookie,
     WS_KERNEL_FG, WS_KERNEL_BG,
     WS_KERNEL_COLATTR | WSATTR_WSCOLORS,
     &edp->kernattr);
  else
- res = (*edp->emulops->alloc_attr)(cookie, 0, 0,
+ res = (*edp->emulops->pack_attr)(cookie, 0, 0,
     WS_KERNEL_MONOATTR,
     &edp->kernattr);
  if (res)
@@ -899,7 +899,7 @@ wsemul_sun_selectattribute(struct wsemul_sun_emuldata *edp, int flags,
  flags |= WSATTR_WSCOLORS;
  }
 
- error = (*edp->emulops->alloc_attr)(edp->emulcookie, fgcol, bgcol,
+ error = (*edp->emulops->pack_attr)(edp->emulcookie, fgcol, bgcol,
     flags & WSATTR_WSCOLORS, bkgdattr);
  if (error)
  return (error);
@@ -936,7 +936,7 @@ wsemul_sun_selectattribute(struct wsemul_sun_emuldata *edp, int flags,
  flags |= WSATTR_WSCOLORS;
  }
  }
- error = (*edp->emulops->alloc_attr)(edp->emulcookie, fgcol, bgcol,
+ error = (*edp->emulops->pack_attr)(edp->emulcookie, fgcol, bgcol,
     flags, attr);
  if (error)
  return (error);
diff --git sys/dev/wscons/wsemul_vt100.c sys/dev/wscons/wsemul_vt100.c
index 7c032293bb8..b07b2ec2e75 100644
--- sys/dev/wscons/wsemul_vt100.c
+++ sys/dev/wscons/wsemul_vt100.c
@@ -177,11 +177,11 @@ wsemul_vt100_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
 #define WS_KERNEL_MONOATTR 0
 #endif
  if (type->capabilities & WSSCREEN_WSCOLORS)
- res = (*edp->emulops->alloc_attr)(cookie,
+ res = (*edp->emulops->pack_attr)(cookie,
     WS_KERNEL_FG, WS_KERNEL_BG,
     WS_KERNEL_COLATTR | WSATTR_WSCOLORS, &edp->kernattr);
  else
- res = (*edp->emulops->alloc_attr)(cookie, 0, 0,
+ res = (*edp->emulops->pack_attr)(cookie, 0, 0,
     WS_KERNEL_MONOATTR, &edp->kernattr);
  if (res)
  edp->kernattr = defattr;
diff --git sys/dev/wscons/wsemul_vt100_subr.c sys/dev/wscons/wsemul_vt100_subr.c
index bcde0e6f6c9..97208d64645 100644
--- sys/dev/wscons/wsemul_vt100_subr.c
+++ sys/dev/wscons/wsemul_vt100_subr.c
@@ -712,7 +712,7 @@ vt100_selectattribute(struct wsemul_vt100_emuldata *edp, int flags, int fgcol,
  printf("colors ignored (impossible)\n");
 #endif
  }
- error = (*edp->emulops->alloc_attr)(edp->emulcookie, fgcol, bgcol,
+ error = (*edp->emulops->pack_attr)(edp->emulcookie, fgcol, bgcol,
     flags & WSATTR_WSCOLORS, bkgdattr);
  if (error)
  return (error);
@@ -764,7 +764,7 @@ vt100_selectattribute(struct wsemul_vt100_emuldata *edp, int flags, int fgcol,
 #endif
  }
  }
- error = (*edp->emulops->alloc_attr)(edp->emulcookie, fgcol, bgcol,
+ error = (*edp->emulops->pack_attr)(edp->emulcookie, fgcol, bgcol,
     flags, attr);
  if (error)
  return (error);

Reply | Threaded
Open this post in threaded view
|

Re: Code changes for clarity

Miod Vallat
In reply to this post by johnc

> For instance, in the wsdisplay_emulops structure, there are:
>
> int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
> void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
>
> And at the end of the structure is this comment, showing that at
> least someone (other than me) was confused by it:
> /* XXX need a free_attr() ??? */

`alloc_attr' was named that way because there was a theoretical
possibility that drivers would actually need to allocate storage for
attribute-related information (which is why attributes are longs rather
than uint32_t). A `free_attr' routine would then make sense, except that
there is no clear lifetime for attributes (e.g. the kernel messages
attribute has to survive free_screen).

Since in practice, no driver actually allocates anything and all
attributes fit in either 8 bits (vga text mode) or 32 bits (rasops), it
would make sense to rename this function to `compute_attr' or
`pack_attr' and narrow the attribute type from `long' to `uint32_t'.

$.02

Miod

Reply | Threaded
Open this post in threaded view
|

Re: Code changes for clarity

Jonathan Gray-11
On Mon, May 18, 2020 at 07:49:11AM -0000, Miod Vallat wrote:

>
> > For instance, in the wsdisplay_emulops structure, there are:
> >
> > int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
> > void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
> >
> > And at the end of the structure is this comment, showing that at
> > least someone (other than me) was confused by it:
> > /* XXX need a free_attr() ??? */
>
> `alloc_attr' was named that way because there was a theoretical
> possibility that drivers would actually need to allocate storage for
> attribute-related information (which is why attributes are longs rather
> than uint32_t). A `free_attr' routine would then make sense, except that
> there is no clear lifetime for attributes (e.g. the kernel messages
> attribute has to survive free_screen).
>
> Since in practice, no driver actually allocates anything and all
> attributes fit in either 8 bits (vga text mode) or 32 bits (rasops), it
> would make sense to rename this function to `compute_attr' or
> `pack_attr' and narrow the attribute type from `long' to `uint32_t'.
>
> $.02
>
> Miod

here is a type change diff against a tree with the pack_attr rename

builds on amd64, i386 and sparc64

diff --git sys/arch/alpha/tc/cfb.c sys/arch/alpha/tc/cfb.c
index 64b1f3f32f9..9b623b19dd6 100644
--- sys/arch/alpha/tc/cfb.c
+++ sys/arch/alpha/tc/cfb.c
@@ -101,7 +101,7 @@ paddr_t cfbmmap(void *, off_t, int);
 
 int cfbintr(void *);
 static int      cfb_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 static void     cfb_free_screen(void *, void *);
 static int      cfb_show_screen(void *, void *, int,
     void (*) (void *, int, int), void *);
@@ -330,10 +330,10 @@ cfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
  const struct wsscreen_descr *type;
  void **cookiep;
  int *curxp, *curyp;
- long *attrp;
+ uint32_t *attrp;
 {
  struct cfb_softc *sc = v;
- long defattr;
+ uint32_t defattr;
 
  if (sc->nscreens > 0)
  return (ENOMEM);
@@ -377,7 +377,7 @@ cfb_cnattach(addr)
  tc_addr_t addr;
 {
  struct cfb_devconfig *dc = &cfb_console_dc;
- long defattr;
+ uint32_t defattr;
 
  cfb_getdevconfig(addr, dcp);
 
diff --git sys/arch/alpha/tc/sfb.c sys/arch/alpha/tc/sfb.c
index b491b03d30f..08f8779aea2 100644
--- sys/arch/alpha/tc/sfb.c
+++ sys/arch/alpha/tc/sfb.c
@@ -99,7 +99,7 @@ int sfbioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t sfbmmap(void *, off_t, int);
 
 static int      sfb_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 static void     sfb_free_screen(void *, void *);
 static int      sfb_show_screen(void *, void *, int,
     void (*) (void *, int, int), void *);
@@ -363,10 +363,10 @@ sfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
         const struct wsscreen_descr *type;
         void **cookiep;
         int *curxp, *curyp;
- long *attrp;
+ uint32_t *attrp;
 {
         struct sfb_softc *sc = v;
- long defattr;
+ uint32_t defattr;
 
         if (sc->nscreens > 0)
                 return (ENOMEM);
@@ -411,7 +411,7 @@ sfb_cnattach(addr)
         tc_addr_t addr;
 {
         struct sfb_devconfig *dcp = &sfb_console_dc;
- long defattr;
+ uint32_t defattr;
 
         sfb_getdevconfig(addr, dcp);
 
diff --git sys/arch/amd64/amd64/efifb.c sys/arch/amd64/amd64/efifb.c
index eb62ae07137..2dca5e0205d 100644
--- sys/arch/amd64/amd64/efifb.c
+++ sys/arch/amd64/amd64/efifb.c
@@ -96,7 +96,7 @@ void efifb_rasops_preinit(struct efifb *);
 int efifb_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t efifb_mmap(void *, off_t, int);
 int efifb_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void efifb_free_screen(void *, void *);
 int efifb_show_screen(void *, void *, int, void (*cb) (void *, int, int),
     void *);
@@ -211,7 +211,7 @@ efifb_attach(struct device *parent, struct device *self, void *aux)
  printf(": %dx%d, %dbpp\n", ri->ri_width, ri->ri_height, ri->ri_depth);
 
  if (console) {
- long defattr = 0;
+ uint32_t defattr = 0;
 
  ccol = ri->ri_ccol;
  crow = ri->ri_crow;
@@ -346,7 +346,7 @@ efifb_mmap(void *v, off_t off, int prot)
 
 int
 efifb_alloc_screen(void *v, const struct wsscreen_descr *descr,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct efifb_softc *sc = v;
  struct rasops_info *ri = &sc->sc_fb->rinfo;
@@ -430,7 +430,7 @@ efifb_cnattach_common(void)
 {
  struct efifb *fb = &efifb_console;
  struct rasops_info *ri = &fb->rinfo;
- long defattr = 0;
+ uint32_t defattr = 0;
 
  ri->ri_bits = (u_char *)efifb_early_map(fb->paddr);
 
diff --git sys/arch/armv7/exynos/exdisplay.c sys/arch/armv7/exynos/exdisplay.c
index 41390aeb864..d088f9f4b7e 100644
--- sys/arch/armv7/exynos/exdisplay.c
+++ sys/arch/armv7/exynos/exdisplay.c
@@ -66,7 +66,7 @@ struct cfdriver exdisplay_cd = {
 int exdisplay_wsioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t exdisplay_wsmmap(void *, off_t, int);
 int exdisplay_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void exdisplay_free_screen(void *, void *);
 int exdisplay_show_screen(void *, void *, int,
     void (*)(void *, int, int), void *);
@@ -147,7 +147,7 @@ exdisplay_attach(struct device *parent, struct device *self, void *args)
 #if notyet
  /* FIXME: Set up framebuffer instead of re-using. */
  if (!fdt_find_compatible("simple-framebuffer")) {
- long defattr;
+ uint32_t defattr;
 
  ri->ri_bits = (u_char *)sc->sc_fbioh;
  exdisplay_setup_rasops(ri, &exdisplay_stdscreen);
@@ -176,7 +176,7 @@ exdisplay_cnattach(bus_space_tag_t iot, bus_addr_t iobase, size_t size)
 {
  struct wsscreen_descr *descr = &exdisplay_stdscreen;
  struct rasops_info *ri = &exdisplay_ri;
- long defattr;
+ uint32_t defattr;
 
  if (bus_space_map(iot, iobase, size, 0, (bus_space_handle_t *)&ri->ri_bits))
  return ENOMEM;
@@ -238,7 +238,7 @@ exdisplay_wsmmap(void *v, off_t off, int prot)
 
 int
 exdisplay_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct exdisplay_softc *sc = v;
  struct rasops_info *ri = sc->ro;
diff --git sys/arch/armv7/omap/amdisplay.c sys/arch/armv7/omap/amdisplay.c
index 4332de22801..da980fe7048 100644
--- sys/arch/armv7/omap/amdisplay.c
+++ sys/arch/armv7/omap/amdisplay.c
@@ -99,7 +99,7 @@ int amdisplay_intr(void *);
 int amdisplay_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t amdisplay_mmap(void *, off_t, int);
 int amdisplay_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 
 int amdisplay_setup_dma(struct amdisplay_softc *);
 void amdisplay_conf_crt_timings(struct amdisplay_softc *);
@@ -644,7 +644,7 @@ amdisplay_mmap(void *sconf, off_t off, int prot)
 
 int
 amdisplay_alloc_screen(void *sconf, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  return rasops_alloc_screen(sconf, cookiep, curxp, curyp, attrp);
 }
diff --git sys/arch/armv7/omap/omdisplay.c sys/arch/armv7/omap/omdisplay.c
index 01aa0dc4700..0895c79c89f 100644
--- sys/arch/armv7/omap/omdisplay.c
+++ sys/arch/armv7/omap/omdisplay.c
@@ -443,7 +443,7 @@ void omdisplay_initialize(struct omdisplay_softc *sc,
 void omdisplay_setup_rasops(struct omdisplay_softc *sc,
     struct rasops_info *rinfo);
 int omdisplay_alloc_screen(void *v, const struct wsscreen_descr *_type,
-    void **cookiep, int *curxp, int *curyp, long *attrp);
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp);
 int omdisplay_new_screen(struct omdisplay_softc *sc,
     struct omdisplay_screen *scr, int depth);
 paddr_t omdisplay_mmap(void *v, off_t offset, int prot);
@@ -1142,7 +1142,7 @@ omdisplay_setup_rasops(struct omdisplay_softc *sc, struct rasops_info *rinfo)
 
 int
 omdisplay_alloc_screen(void *v, const struct wsscreen_descr *_type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct omdisplay_softc *sc = v;
  struct omdisplay_screen *scr;
diff --git sys/arch/loongson/dev/radeonfb.c sys/arch/loongson/dev/radeonfb.c
index f8e14f2f742..4d06df25878 100644
--- sys/arch/loongson/dev/radeonfb.c
+++ sys/arch/loongson/dev/radeonfb.c
@@ -123,7 +123,7 @@ struct radeonfb_softc {
 };
 
 int radeonfb_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void radeonfb_free_screen(void *, void *);
 int radeonfb_ioctl(void *, u_long, caddr_t, int, struct proc *);
 int radeonfb_list_font(void *, struct wsdisplay_font *);
@@ -154,9 +154,9 @@ struct cfdriver radeonfb_cd = {
 };
 
 int radeonfb_copycols(void *, int, int, int, int);
-int radeonfb_erasecols(void *, int, int, int, long);
+int radeonfb_erasecols(void *, int, int, int, uint32_t);
 int radeonfb_copyrows(void *, int, int, int);
-int radeonfb_eraserows(void *, int, int, long);
+int radeonfb_eraserows(void *, int, int, uint32_t);
 
 int radeonfb_setup(struct radeonfb *);
 void radeonfb_wait_fifo(struct radeonfb *, int);
@@ -253,7 +253,7 @@ radeonfb_attach(struct device *parent, struct device *self, void *aux)
 
 int
 radeonfb_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct radeonfb_softc *sc = (struct radeonfb_softc *)v;
  struct rasops_info *ri = &sc->sc_fb->ri;
@@ -433,7 +433,7 @@ radeonfb_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-radeonfb_erasecols(void *cookie, int row, int col, int num, long attr)
+radeonfb_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct radeonfb *fb = ri->ri_hw;
@@ -468,7 +468,7 @@ radeonfb_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-radeonfb_eraserows(void *cookie, int row, int num, long attr)
+radeonfb_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct radeonfb *fb = ri->ri_hw;
@@ -686,7 +686,7 @@ int
 radeonfb_cnattach(bus_space_tag_t memt, bus_space_tag_t iot, pcitag_t tag,
     pcireg_t id)
 {
- long defattr;
+ uint32_t defattr;
  struct rasops_info *ri;
  pcireg_t bar;
  int rc;
diff --git sys/arch/loongson/dev/sisfb.c sys/arch/loongson/dev/sisfb.c
index a8b31f6272e..e5b41668c3d 100644
--- sys/arch/loongson/dev/sisfb.c
+++ sys/arch/loongson/dev/sisfb.c
@@ -84,7 +84,7 @@ struct cfdriver sisfb_cd = {
 };
 
 int sisfb_alloc_screen(void *, const struct wsscreen_descr *, void **, int *,
-    int *, long *);
+    int *, uint32_t *);
 void sisfb_free_screen(void *, void *);
 int sisfb_ioctl(void *, u_long, caddr_t, int, struct proc *);
 int sisfb_list_font(void *, struct wsdisplay_font *);
@@ -268,7 +268,7 @@ fail1:
 
 int
 sisfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct sisfb_softc *sc = (struct sisfb_softc *)v;
  struct rasops_info *ri = &sc->sc_fb->ri;
@@ -607,7 +607,7 @@ int
 sisfb_cnattach(bus_space_tag_t memt, bus_space_tag_t iot, pcitag_t tag,
     pcireg_t id)
 {
- long defattr;
+ uint32_t defattr;
  struct rasops_info *ri;
  pcireg_t bar;
  int rc;
diff --git sys/arch/loongson/dev/smfb.c sys/arch/loongson/dev/smfb.c
index ff4044864a8..3aa11b62ef9 100644
--- sys/arch/loongson/dev/smfb.c
+++ sys/arch/loongson/dev/smfb.c
@@ -108,7 +108,7 @@ struct cfdriver smfb_cd = {
 };
 
 int smfb_alloc_screen(void *, const struct wsscreen_descr *, void **, int *,
-    int *, long *);
+    int *, uint32_t *);
 void smfb_burner(void *, uint, uint);
 void smfb_free_screen(void *, void *);
 int smfb_ioctl(void *, u_long, caddr_t, int, struct proc *);
@@ -137,8 +137,8 @@ void smfb_fillrect(struct smfb *, int, int, int, int, int);
 int smfb_copyrows(void *, int, int, int);
 int smfb_copycols(void *, int, int, int, int);
 int smfb_do_cursor(struct rasops_info *);
-int smfb_erasecols(void *, int, int, int, long);
-int smfb_eraserows(void *, int, int, long);
+int smfb_erasecols(void *, int, int, int, uint32_t);
+int smfb_eraserows(void *, int, int, uint32_t);
 int smfb_wait(struct smfb *);
 
 void smfb_wait_panel_vsync(struct smfb *, int);
@@ -241,7 +241,7 @@ smfb_attach_common(struct smfb_softc *sc, int is5xx, bus_space_tag_t memt,
 
 int
 smfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct smfb_softc *sc = (struct smfb_softc *)v;
  struct rasops_info *ri = &sc->sc_fb->ri;
@@ -560,7 +560,7 @@ smfb_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-smfb_erasecols(void *cookie, int row, int col, int num, long attr)
+smfb_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct smfb *fb = ri->ri_hw;
@@ -580,7 +580,7 @@ smfb_erasecols(void *cookie, int row, int col, int num, long attr)
 }
 
 int
-smfb_eraserows(void *cookie, int row, int num, long attr)
+smfb_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct smfb *fb = ri->ri_hw;
@@ -676,7 +676,7 @@ int
 smfb_cnattach(bus_space_tag_t memt, bus_space_tag_t iot, pcitag_t tag,
     pcireg_t id)
 {
- long defattr;
+ uint32_t defattr;
  struct rasops_info *ri;
  bus_space_handle_t fbh, mmioh;
  pcireg_t bar;
diff --git sys/arch/luna88k/dev/lunafb.c sys/arch/luna88k/dev/lunafb.c
index 926caa96a14..f892c1abc55 100644
--- sys/arch/luna88k/dev/lunafb.c
+++ sys/arch/luna88k/dev/lunafb.c
@@ -111,8 +111,8 @@ void omfb_getdevconfig(paddr_t, struct om_hwdevconfig *);
 /* in omrasops.c */
 int om_copycols(void *, int, int, int, int);
 int om_copyrows(void *, int, int, int num);
-int om_erasecols(void *, int, int, int, long);
-int om_eraserows(void *, int, int, long);
+int om_erasecols(void *, int, int, int, uint32_t);
+int om_eraserows(void *, int, int, uint32_t);
 void setup_omrasops1(struct rasops_info *);
 void setup_omrasops4(struct rasops_info *);
 
@@ -131,7 +131,7 @@ const struct wsscreen_list omfb_screenlist = {
 int omfbioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t omfbmmap(void *, off_t, int);
 int omfb_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void omfb_free_screen(void *, void *);
 int omfb_show_screen(void *, void *, int, void (*) (void *, int, int),
     void *);
@@ -218,7 +218,7 @@ omfb_cnattach(void)
 {
  struct om_hwdevconfig *dc = &omfb_console_dc;
  struct rasops_info *ri = &dc->dc_ri;
- long defattr;
+ uint32_t defattr;
 
  omfb_getdevconfig(OMFB_FB_WADDR, dc);
  ri->ri_ops.pack_attr(ri, 0, 0, 0, &defattr);
@@ -469,7 +469,7 @@ omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
 
 int
 omfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct omfb_softc *sc = v;
  struct rasops_info *ri = &sc->sc_dc->dc_ri;
diff --git sys/arch/luna88k/dev/omrasops.c sys/arch/luna88k/dev/omrasops.c
index 2e6c5214f97..ff300ac2522 100644
--- sys/arch/luna88k/dev/omrasops.c
+++ sys/arch/luna88k/dev/omrasops.c
@@ -56,12 +56,12 @@
 /* wscons emulator operations */
 int om_copycols(void *, int, int, int, int);
 int om_copyrows(void *, int, int, int num);
-int om_erasecols(void *, int, int, int, long);
-int om_eraserows(void *, int, int, long);
+int om_erasecols(void *, int, int, int, uint32_t);
+int om_eraserows(void *, int, int, uint32_t);
 int om1_cursor(void *, int, int, int);
-int om1_putchar(void *, int, int, u_int, long);
+int om1_putchar(void *, int, int, u_int, uint32_t);
 int om4_cursor(void *, int, int, int);
-int om4_putchar(void *, int, int, u_int, long);
+int om4_putchar(void *, int, int, u_int, uint32_t);
 
 /* depth-depended setup functions */
 void setup_omrasops1(struct rasops_info *);
@@ -74,7 +74,7 @@ int om4_windowmove(struct rasops_info *, u_int16_t, u_int16_t, u_int16_t,
  u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
 
 /* MI function in src/sys/dev/rasops/rasops.c */
-int     rasops_pack_cattr(void *, int, int, int, long *);
+int     rasops_pack_cattr(void *, int, int, int, uint32_t *);
 
 static int (*om_windowmove)(struct rasops_info *, u_int16_t, u_int16_t,
  u_int16_t, u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
@@ -92,7 +92,7 @@ extern struct wsscreen_descr omfb_stdscreen;
  * - 1bpp version -
  */
 int
-om1_putchar(void *cookie, int row, int startcol, u_int uc, long attr)
+om1_putchar(void *cookie, int row, int startcol, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  u_int8_t *p;
@@ -157,7 +157,7 @@ om1_putchar(void *cookie, int row, int startcol, u_int uc, long attr)
  * - 4bpp version -
  */
 int
-om4_putchar(void *cookie, int row, int startcol, u_int uc, long attr)
+om4_putchar(void *cookie, int row, int startcol, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  u_int8_t *p;
@@ -287,7 +287,7 @@ om4_putchar(void *cookie, int row, int startcol, u_int uc, long attr)
 }
 
 int
-om_erasecols(void *cookie, int row, int col, int num, long attr)
+om_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  int fg, bg;
@@ -311,7 +311,7 @@ om_erasecols(void *cookie, int row, int col, int num, long attr)
 }
 
 int
-om_eraserows(void *cookie, int row, int num, long attr)
+om_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  int fg, bg;
diff --git sys/arch/macppc/macppc/ofw_machdep.c sys/arch/macppc/macppc/ofw_machdep.c
index 76e6c136630..44ddaa93312 100644
--- sys/arch/macppc/macppc/ofw_machdep.c
+++ sys/arch/macppc/macppc/ofw_machdep.c
@@ -486,7 +486,7 @@ of_display_console(void)
 {
  struct ofwfb *fb = &ofwfb;
  struct rasops_info *ri = &fb->ofw_ri;
- long defattr;
+ uint32_t defattr;
 
  ri->ri_width = cons_width;
  ri->ri_height = cons_height;
diff --git sys/arch/macppc/pci/vgafb.c sys/arch/macppc/pci/vgafb.c
index 73a8e90b6c9..69929b52a81 100644
--- sys/arch/macppc/pci/vgafb.c
+++ sys/arch/macppc/pci/vgafb.c
@@ -66,7 +66,7 @@ struct vgafb_softc {
 int vgafb_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t vgafb_mmap(void *, off_t, int);
 int vgafb_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void vgafb_free_screen(void *, void *);
 int vgafb_show_screen(void *, void *, int, void (*cb)(void *, int, int),
     void *);
@@ -179,7 +179,7 @@ int
 vgafb_console_init(struct vgafb_softc *sc)
 {
  struct rasops_info *ri = &sc->sc_ri;
- long defattr;
+ uint32_t defattr;
 
  ri->ri_flg = RI_CENTER | RI_VCONS | RI_WRONLY;
  ri->ri_hw = sc;
@@ -452,7 +452,7 @@ vgafb_burn(void *v, u_int on, u_int flags)
 
 int
 vgafb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct vgafb_softc *sc = v;
  struct rasops_info *ri = &sc->sc_ri;
diff --git sys/arch/sgi/dev/gbe.c sys/arch/sgi/dev/gbe.c
index 2b45b927725..8146cb20225 100644
--- sys/arch/sgi/dev/gbe.c
+++ sys/arch/sgi/dev/gbe.c
@@ -124,7 +124,7 @@ void gbe_loadcmap(struct gbe_screen *, u_int, u_int);
 int gbe_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t gbe_mmap(void *, off_t, int);
 int gbe_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void gbe_free_screen(void *, void *);
 int gbe_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
@@ -138,11 +138,11 @@ void gbe_rop(struct gbe_softc *, int, int, int, int, int);
 void gbe_copyrect(struct gbe_softc *, int, int, int, int, int, int, int);
 void gbe_fillrect(struct gbe_softc *, int, int, int, int, int);
 int gbe_do_cursor(struct rasops_info *);
-int gbe_putchar(void *, int, int, u_int, long);
+int gbe_putchar(void *, int, int, u_int, uint32_t);
 int gbe_copycols(void *, int, int, int, int);
-int gbe_erasecols(void *, int, int, int, long);
+int gbe_erasecols(void *, int, int, int, uint32_t);
 int gbe_copyrows(void *, int, int, int);
-int gbe_eraserows(void *, int, int, long);
+int gbe_eraserows(void *, int, int, uint32_t);
 
 static struct gbe_screen gbe_consdata;
 static int gbe_console;
@@ -209,7 +209,7 @@ gbe_attach(struct device *parent, struct device *self, void *aux)
  int fb_nsegs;
  int ro_nsegs;
  uint32_t val;
- long attr;
+ uint32_t attr;
 
  printf(": ");
 
@@ -945,7 +945,7 @@ gbe_mmap(void *v, off_t offset, int protection)
 
 int
 gbe_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct gbe_screen *screen = (struct gbe_screen *)v;
  struct gbe_softc *gsc = (struct gbe_softc *)screen->sc;
@@ -1191,7 +1191,7 @@ gbe_do_cursor(struct rasops_info *ri)
 }
 
 int
-gbe_putchar(void *cookie, int row, int col, u_int uc, long attr)
+gbe_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct gbe_softc *gsc = ri->ri_hw;
@@ -1234,7 +1234,7 @@ gbe_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-gbe_erasecols(void *cookie, int row, int col, int num, long attr)
+gbe_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct gbe_softc *sc = ri->ri_hw;
@@ -1269,7 +1269,7 @@ gbe_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-gbe_eraserows(void *cookie, int row, int num, long attr)
+gbe_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct gbe_softc *sc = ri->ri_hw;
@@ -1326,7 +1326,7 @@ gbe_cnattach(bus_space_tag_t iot, bus_addr_t addr)
  uint32_t val;
  paddr_t pa;
  vaddr_t va;
- long attr;
+ uint32_t attr;
 
  /*
  * Setup GBE for use as early console.
diff --git sys/arch/sgi/dev/impact.c sys/arch/sgi/dev/impact.c
index 85ce81e2006..7be47869995 100644
--- sys/arch/sgi/dev/impact.c
+++ sys/arch/sgi/dev/impact.c
@@ -71,7 +71,7 @@ struct cfdriver impact_cd = {
 
 struct impact_screen {
  struct rasops_info ri;
- long defattr;
+ uint32_t defattr;
  struct wsdisplay_charcell *bs;
 
  struct impact_softc *sc;
@@ -101,11 +101,11 @@ int impact_init_screen(struct impact_screen *);
 void impact_rop(struct impact_screen *, int, int, int, int, int, u_int);
 void impact_fillrect(struct impact_screen *, int, int, int, int, u_int);
 int impact_do_cursor(struct rasops_info *);
-int impact_putchar(void *, int, int, u_int, long);
+int impact_putchar(void *, int, int, u_int, uint32_t);
 int impact_copycols(void *, int, int, int, int);
-int impact_erasecols(void *, int, int, int, long);
+int impact_erasecols(void *, int, int, int, uint32_t);
 int impact_copyrows(void *, int, int, int);
-int impact_eraserows(void *, int, int, long);
+int impact_eraserows(void *, int, int, uint32_t);
 
 /*
  * Interfaces for wscons.
@@ -113,7 +113,7 @@ int impact_eraserows(void *, int, int, long);
 int impact_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t impact_mmap(void *, off_t, int);
 int impact_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void impact_free_screen(void *, void *);
 int impact_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
@@ -433,7 +433,7 @@ impact_mmap(void *v, off_t offset, int prot)
 
 int
 impact_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct impact_screen *scr = (struct impact_screen *)v;
  struct rasops_info *ri = &scr->ri;
@@ -537,7 +537,7 @@ impact_do_cursor(struct rasops_info *ri)
 }
 
 int
-impact_putchar(void *cookie, int row, int col, u_int uc, long attr)
+impact_putchar(void *cookie, int row, int col, u_int uc, uint32_tattr)
 {
  struct rasops_info *ri = cookie;
  struct impact_screen *scr = ri->ri_hw;
@@ -660,7 +660,7 @@ impact_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-impact_erasecols(void *cookie, int row, int col, int num, long attr)
+impact_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct impact_screen *scr = ri->ri_hw;
@@ -709,7 +709,7 @@ impact_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-impact_eraserows(void *cookie, int row, int num, long attr)
+impact_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct impact_screen *scr = ri->ri_hw;
diff --git sys/arch/sgi/gio/grtwo.c sys/arch/sgi/gio/grtwo.c
index ce87c4ce1f3..35d1fb1066e 100644
--- sys/arch/sgi/gio/grtwo.c
+++ sys/arch/sgi/gio/grtwo.c
@@ -94,7 +94,7 @@ struct grtwo_softc {
 
 struct grtwo_devconfig {
  struct rasops_info dc_ri;
- long dc_defattr;
+ uint32_t dc_defattr;
  struct wsdisplay_charcell *dc_bs;
 
  uint32_t dc_addr;
@@ -131,7 +131,7 @@ const struct cfattach grtwo_ca = {
 int grtwo_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t grtwo_mmap(void *, off_t, int);
 int grtwo_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void grtwo_free_screen(void *, void *);
 int grtwo_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
@@ -151,11 +151,11 @@ static struct wsdisplay_accessops grtwo_accessops = {
 };
 
 int grtwo_cursor(void *, int, int, int);
-int grtwo_putchar(void *, int, int, u_int, long);
+int grtwo_putchar(void *, int, int, u_int, uint32_t);
 int grtwo_copycols(void *, int, int, int, int);
-int grtwo_erasecols(void *, int, int, int, long);
+int grtwo_erasecols(void *, int, int, int, uint32_t);
 int grtwo_copyrows(void *, int, int, int);
-int grtwo_eraserows(void *, int, int, long);
+int grtwo_eraserows(void *, int, int, uint32_t);
 
 void grtwo_wait_gfifo(struct grtwo_devconfig *);
 static __inline__
@@ -457,7 +457,7 @@ grtwo_cnattach(struct gio_attach_args *ga)
 {
  struct rasops_info *ri = &grtwo_console_dc.dc_ri;
  struct wsdisplay_charcell *cell;
- long defattr;
+ uint32_t defattr;
  int rc;
  int i;
 
@@ -562,7 +562,7 @@ grtwo_cursor(void *c, int on, int row, int col)
 }
 
 int
-grtwo_putchar(void *c, int row, int col, u_int ch, long attr)
+grtwo_putchar(void *c, int row, int col, u_int ch, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct grtwo_devconfig *dc = ri->ri_hw;
@@ -709,7 +709,7 @@ grtwo_copycols(void *c, int row, int src, int dst, int ncol)
 }
 
 int
-grtwo_erasecols(void *c, int row, int startcol, int ncol, long attr)
+grtwo_erasecols(void *c, int row, int startcol, int ncol, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct grtwo_devconfig *dc = ri->ri_hw;
@@ -773,7 +773,7 @@ grtwo_copyrows(void *c, int src, int dst, int nrow)
 }
 
 int
-grtwo_eraserows(void *c, int startrow, int nrow, long attr)
+grtwo_eraserows(void *c, int startrow, int nrow, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct grtwo_devconfig *dc = ri->ri_hw;
@@ -813,7 +813,7 @@ grtwo_eraserows(void *c, int startrow, int nrow, long attr)
 
 int
 grtwo_alloc_screen(void *v, const struct wsscreen_descr * type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct grtwo_devconfig *dc = v;
  struct rasops_info *ri = &dc->dc_ri;
diff --git sys/arch/sgi/gio/light.c sys/arch/sgi/gio/light.c
index 6e9ecd17423..f55eec32cac 100644
--- sys/arch/sgi/gio/light.c
+++ sys/arch/sgi/gio/light.c
@@ -88,7 +88,7 @@ struct light_softc {
 
 struct light_devconfig {
  struct rasops_info dc_ri;
- long dc_defattr;
+ uint32_t dc_defattr;
 
  uint32_t dc_addr;
  bus_space_tag_t dc_st;
@@ -122,7 +122,7 @@ const struct cfattach light_ca = {
 int light_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t light_mmap(void *, off_t, int);
 int light_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void light_free_screen(void *, void *);
 int light_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
@@ -142,11 +142,11 @@ struct wsdisplay_accessops light_accessops = {
 };
 
 int light_do_cursor(struct rasops_info *);
-int light_putchar(void *, int, int, u_int, long);
+int light_putchar(void *, int, int, u_int, uint32_t);
 int light_copycols(void *, int, int, int, int);
-int light_erasecols(void *, int, int, int, long);
+int light_erasecols(void *, int, int, int, uint32_t);
 int light_copyrows(void *, int, int, int);
-int light_eraserows(void *, int, int, long);
+int light_eraserows(void *, int, int, uint32_t);
 
 static __inline__
 uint32_t rex_read(struct light_devconfig *, uint32_t, uint32_t);
@@ -442,7 +442,7 @@ int
 light_cnattach(struct gio_attach_args *ga)
 {
  struct rasops_info *ri = &light_console_dc.dc_ri;
- long defattr;
+ uint32_t defattr;
 
  light_attach_common(&light_console_dc, ga);
  light_init_screen(&light_console_dc);
@@ -524,7 +524,7 @@ light_do_cursor(struct rasops_info *ri)
 }
 
 int
-light_putchar(void *c, int row, int col, u_int ch, long attr)
+light_putchar(void *c, int row, int col, u_int ch, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct light_devconfig *dc = ri->ri_hw;
@@ -614,7 +614,7 @@ light_copycols(void *c, int row, int srccol, int dstcol, int ncols)
 
 /* erase a set of columns in the same line */
 int
-light_erasecols(void *c, int row, int startcol, int ncols, long attr)
+light_erasecols(void *c, int row, int startcol, int ncols, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct light_devconfig *dc = ri->ri_hw;
@@ -657,7 +657,7 @@ light_copyrows(void *c, int srcrow, int dstrow, int nrows)
 
 /* erase a set of complete rows */
 int
-light_eraserows(void *c, int row, int nrows, long attr)
+light_eraserows(void *c, int row, int nrows, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct light_devconfig *dc = ri->ri_hw;
@@ -730,7 +730,7 @@ light_mmap(void *v, off_t off, int prot)
 
 int
 light_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct light_devconfig *dc = v;
  struct rasops_info *ri = &dc->dc_ri;
diff --git sys/arch/sgi/gio/newport.c sys/arch/sgi/gio/newport.c
index e8e30f14197..1fcb78404aa 100644
--- sys/arch/sgi/gio/newport.c
+++ sys/arch/sgi/gio/newport.c
@@ -76,7 +76,7 @@ struct newport_softc {
 
 struct newport_devconfig {
  struct rasops_info dc_ri;
- long dc_defattr;
+ uint32_t dc_defattr;
 
  uint32_t dc_addr;
  bus_space_tag_t dc_st;
@@ -113,7 +113,7 @@ const struct cfattach newport_ca = {
 int newport_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t newport_mmap(void *, off_t, int);
 int newport_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void newport_free_screen(void *, void *);
 int newport_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
@@ -131,11 +131,11 @@ struct wsdisplay_accessops newport_accessops = {
 };
 
 int newport_do_cursor(struct rasops_info *);
-int newport_putchar(void *, int, int, u_int, long);
+int newport_putchar(void *, int, int, u_int, uint32_t);
 int newport_copycols(void *, int, int, int, int);
-int newport_erasecols(void *, int, int, int, long);
+int newport_erasecols(void *, int, int, int, uint32_t);
 int newport_copyrows(void *, int, int, int);
-int newport_eraserows(void *, int, int, long);
+int newport_eraserows(void *, int, int, uint32_t);
 
 static __inline__
 void rex3_write(struct newport_devconfig *, bus_size_t, uint32_t);
@@ -580,7 +580,7 @@ int
 newport_cnattach(struct gio_attach_args *ga)
 {
  struct rasops_info *ri = &newport_console_dc.dc_ri;
- long defattr;
+ uint32_t defattr;
  int rc;
 
  newport_attach_common(&newport_console_dc, ga);
@@ -665,7 +665,7 @@ newport_do_cursor(struct rasops_info *ri)
 }
 
 int
-newport_putchar(void *c, int row, int col, u_int ch, long attr)
+newport_putchar(void *c, int row, int col, u_int ch, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct newport_devconfig *dc = ri->ri_hw;
@@ -749,7 +749,7 @@ newport_copycols(void *c, int row, int srccol, int dstcol, int ncols)
 }
 
 int
-newport_erasecols(void *c, int row, int startcol, int ncols, long attr)
+newport_erasecols(void *c, int row, int startcol, int ncols, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct newport_devconfig *dc = ri->ri_hw;
@@ -786,7 +786,7 @@ newport_copyrows(void *c, int srcrow, int dstrow, int nrows)
 }
 
 int
-newport_eraserows(void *c, int startrow, int nrows, long attr)
+newport_eraserows(void *c, int startrow, int nrows, uint32_t attr)
 {
  struct rasops_info *ri = c;
  struct newport_devconfig *dc = ri->ri_hw;
@@ -810,7 +810,7 @@ newport_eraserows(void *c, int startrow, int nrows, long attr)
 
 int
 newport_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct newport_devconfig *dc = v;
  struct rasops_info *ri = &dc->dc_ri;
diff --git sys/arch/sgi/xbow/odyssey.c sys/arch/sgi/xbow/odyssey.c
index 7c566c452ab..16ec942ae8e 100644
--- sys/arch/sgi/xbow/odyssey.c
+++ sys/arch/sgi/xbow/odyssey.c
@@ -63,7 +63,7 @@ struct odyssey_screen {
 
  struct rasops_info ri; /* Screen raster display info. */
  struct odyssey_cmap cmap; /* Display colour map. */
- long attr; /* Rasops attributes. */
+ uint32_t attr; /* Rasops attributes. */
 
  int width; /* Width in pixels. */
  int height; /* Height in pixels. */
@@ -109,11 +109,11 @@ void odyssey_rop(struct odyssey_softc *, int, int, int, int, int, int);
 void odyssey_copyrect(struct odyssey_softc *, int, int, int, int, int, int);
 void odyssey_fillrect(struct odyssey_softc *, int, int, int, int, u_int);
 int odyssey_do_cursor(struct rasops_info *);
-int odyssey_putchar(void *, int, int, u_int, long);
+int odyssey_putchar(void *, int, int, u_int, uint32_t);
 int odyssey_copycols(void *, int, int, int, int);
-int odyssey_erasecols(void *, int, int, int, long);
+int odyssey_erasecols(void *, int, int, int, uint32_t);
 int odyssey_copyrows(void *, int, int, int);
-int odyssey_eraserows(void *, int, int, long);
+int odyssey_eraserows(void *, int, int, uint32_t);
 
 u_int32_t ieee754_sp(uint);
 
@@ -123,7 +123,7 @@ u_int32_t ieee754_sp(uint);
 int odyssey_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t odyssey_mmap(void *, off_t, int);
 int odyssey_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void odyssey_free_screen(void *, void *);
 int odyssey_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
@@ -653,7 +653,7 @@ odyssey_mmap(void *v, off_t offset, int protection)
 
 int
 odyssey_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct odyssey_screen *screen = (struct odyssey_screen *)v;
  struct odyssey_softc *sc = (struct odyssey_softc *)screen->sc;
@@ -802,7 +802,7 @@ odyssey_do_cursor(struct rasops_info *ri)
 }
 
 int
-odyssey_putchar(void *cookie, int row, int col, u_int uc, long attr)
+odyssey_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct odyssey_softc *sc = ri->ri_hw;
@@ -970,7 +970,7 @@ odyssey_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-odyssey_erasecols(void *cookie, int row, int col, int num, long attr)
+odyssey_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct odyssey_softc *sc = ri->ri_hw;
@@ -1022,7 +1022,7 @@ odyssey_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-odyssey_eraserows(void *cookie, int row, int num, long attr)
+odyssey_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct odyssey_softc *sc = ri->ri_hw;
diff --git sys/arch/sparc64/dev/creator.c sys/arch/sparc64/dev/creator.c
index 08e72e0ab75..54053f378fa 100644
--- sys/arch/sparc64/dev/creator.c
+++ sys/arch/sparc64/dev/creator.c
@@ -54,8 +54,8 @@ void creator_ras_fifo_wait(struct creator_softc *, int);
 void creator_ras_wait(struct creator_softc *);
 void creator_ras_init(struct creator_softc *);
 int creator_ras_copyrows(void *, int, int, int);
-int creator_ras_erasecols(void *, int, int, int, long int);
-int creator_ras_eraserows(void *, int, int, long int);
+int creator_ras_erasecols(void *, int, int, int, uint32_t);
+int creator_ras_eraserows(void *, int, int, uint32_t);
 void creator_ras_fill(struct creator_softc *);
 void creator_ras_setfg(struct creator_softc *, int32_t);
 
@@ -241,7 +241,7 @@ creator_ioctl(v, cmd, data, flags, p)
  sc->sc_mode = *(u_int *)data;
  if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
  struct rasops_info *ri = &sc->sc_sunfb.sf_ro;
- long attr;
+ uint32_t attr;
 
  if ((sc->sc_sunfb.sf_dev.dv_cfdata->cf_flags &
     CREATOR_CFFLAG_NOACCEL) == 0)
@@ -594,7 +594,7 @@ int
 creator_ras_eraserows(cookie, row, n, attr)
  void *cookie;
  int row, n;
- long int attr;
+ uint32_t attr;
 {
  struct rasops_info *ri = cookie;
  struct creator_softc *sc = ri->ri_hw;
@@ -634,7 +634,7 @@ int
 creator_ras_erasecols(cookie, row, col, n, attr)
  void *cookie;
  int row, col, n;
- long int attr;
+ uint32_t attr;
 {
  struct rasops_info *ri = cookie;
  struct creator_softc *sc = ri->ri_hw;
diff --git sys/arch/sparc64/dev/fb.c sys/arch/sparc64/dev/fb.c
index c7e69ab8ca3..26156fc3f44 100644
--- sys/arch/sparc64/dev/fb.c
+++ sys/arch/sparc64/dev/fb.c
@@ -118,7 +118,7 @@ void fb_initwsd(struct sunfb *);
 void fb_updatecursor(struct rasops_info *);
 
 int fb_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void fb_free_screen(void *, void *);
 int fb_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
@@ -311,7 +311,7 @@ fbwscons_console_init(struct sunfb *sf, int row)
 {
  struct rasops_info *ri = &sf->sf_ro;
  void *cookie;
- long defattr;
+ uint32_t defattr;
 
  if (romgetcursoraddr(&sf->sf_crowp, &sf->sf_ccolp))
  sf->sf_ccolp = sf->sf_crowp = NULL;
@@ -444,7 +444,7 @@ fbwscons_attach(struct sunfb *sf, struct wsdisplay_accessops *op, int isconsole)
  */
 int
 fb_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct sunfb *sf = v;
  struct rasops_info *ri = &sf->sf_ro;
diff --git sys/arch/sparc64/dev/gfxp.c sys/arch/sparc64/dev/gfxp.c
index e7bdae44f0e..0aa21086983 100644
--- sys/arch/sparc64/dev/gfxp.c
+++ sys/arch/sparc64/dev/gfxp.c
@@ -148,9 +148,9 @@ int gfxp_putcmap(struct gfxp_softc *, struct wsdisplay_cmap *);
 void gfxp_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
 
 int gfxp_copycols(void *, int, int, int, int);
-int gfxp_erasecols(void *, int, int, int, long);
+int gfxp_erasecols(void *, int, int, int, uint32_t);
 int gfxp_copyrows(void *, int, int, int);
-int gfxp_eraserows(void *, int, int, long);
+int gfxp_eraserows(void *, int, int, uint32_t);
 
 void gfxp_init(struct gfxp_softc *);
 void gfxp_reinit(struct gfxp_softc *);
@@ -467,7 +467,7 @@ gfxp_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-gfxp_erasecols(void *cookie, int row, int col, int num, long attr)
+gfxp_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct gfxp_softc *sc = ri->ri_hw;
@@ -502,7 +502,7 @@ gfxp_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-gfxp_eraserows(void *cookie, int row, int num, long attr)
+gfxp_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct gfxp_softc *sc = ri->ri_hw;
diff --git sys/arch/sparc64/dev/ifb.c sys/arch/sparc64/dev/ifb.c
index 029aa20965c..ae818774d5e 100644
--- sys/arch/sparc64/dev/ifb.c
+++ sys/arch/sparc64/dev/ifb.c
@@ -331,18 +331,18 @@ void ifb_rop_ifb(void *, int, int, int, int, int, int, uint32_t, int32_t);
 void ifb_rop_jfb(void *, int, int, int, int, int, int, uint32_t, int32_t);
 int ifb_rop_wait(struct ifb_softc *);
 
-int ifb_putchar_dumb(void *, int, int, u_int, long);
+int ifb_putchar_dumb(void *, int, int, u_int, uint32_t);
 int ifb_copycols_dumb(void *, int, int, int, int);
-int ifb_erasecols_dumb(void *, int, int, int, long);
+int ifb_erasecols_dumb(void *, int, int, int, uint32_t);
 int ifb_copyrows_dumb(void *, int, int, int);
-int ifb_eraserows_dumb(void *, int, int, long);
+int ifb_eraserows_dumb(void *, int, int, uint32_t);
 int ifb_do_cursor_dumb(struct rasops_info *);
 
-int ifb_putchar(void *, int, int, u_int, long);
+int ifb_putchar(void *, int, int, u_int, uint32_t);
 int ifb_copycols(void *, int, int, int, int);
-int ifb_erasecols(void *, int, int, int, long);
+int ifb_erasecols(void *, int, int, int, uint32_t);
 int ifb_copyrows(void *, int, int, int);
-int ifb_eraserows(void *, int, int, long);
+int ifb_eraserows(void *, int, int, uint32_t);
 int ifb_do_cursor(struct rasops_info *);
 
 int
@@ -843,7 +843,7 @@ ifb_mapregs(struct ifb_softc *sc, struct pci_attach_args *pa)
  */
 
 int
-ifb_putchar_dumb(void *cookie, int row, int col, u_int uc, long attr)
+ifb_putchar_dumb(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct ifb_softc *sc = ri->ri_hw;
@@ -871,7 +871,7 @@ ifb_copycols_dumb(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-ifb_erasecols_dumb(void *cookie, int row, int col, int num, long attr)
+ifb_erasecols_dumb(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct ifb_softc *sc = ri->ri_hw;
@@ -899,7 +899,7 @@ ifb_copyrows_dumb(void *cookie, int src, int dst, int num)
 }
 
 int
-ifb_eraserows_dumb(void *cookie, int row, int num, long attr)
+ifb_eraserows_dumb(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct ifb_softc *sc = ri->ri_hw;
@@ -1016,7 +1016,7 @@ ifb_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-ifb_erasecols(void *cookie, int row, int col, int num, long attr)
+ifb_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct ifb_softc *sc = ri->ri_hw;
@@ -1051,7 +1051,7 @@ ifb_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-ifb_eraserows(void *cookie, int row, int num, long attr)
+ifb_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct ifb_softc *sc = ri->ri_hw;
diff --git sys/arch/sparc64/dev/machfb.c sys/arch/sparc64/dev/machfb.c
index 967c634fc2f..1bc3b610ef4 100644
--- sys/arch/sparc64/dev/machfb.c
+++ sys/arch/sparc64/dev/machfb.c
@@ -215,9 +215,9 @@ int machfb_putcmap(struct machfb_softc *, struct wsdisplay_cmap *);
 void machfb_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
 
 int machfb_copycols(void *, int, int, int, int);
-int machfb_erasecols(void *, int, int, int, long);
+int machfb_erasecols(void *, int, int, int, uint32_t);
 int machfb_copyrows(void *, int, int, int);
-int machfb_eraserows(void *, int, int, long);
+int machfb_eraserows(void *, int, int, uint32_t);
 
 void machfb_init(struct machfb_softc *);
 int machfb_wait_fifo(struct machfb_softc *, int);
@@ -528,7 +528,7 @@ machfb_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-machfb_erasecols(void *cookie, int row, int col, int num, long attr)
+machfb_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct machfb_softc *sc = ri->ri_hw;
@@ -563,7 +563,7 @@ machfb_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-machfb_eraserows(void *cookie, int row, int num, long attr)
+machfb_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct machfb_softc *sc = ri->ri_hw;
diff --git sys/arch/sparc64/dev/pcons.c sys/arch/sparc64/dev/pcons.c
index 5f33896ba8f..ac2624f80a2 100644
--- sys/arch/sparc64/dev/pcons.c
+++ sys/arch/sparc64/dev/pcons.c
@@ -552,13 +552,13 @@ cn_get_magic(char *magic, int maglen) {
 #if NWSDISPLAY > 0
 
 int pcons_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void pcons_cursor(void *, int, int, int);
 void pcons_free_screen(void *, void *);
 int pcons_ioctl(void *, u_long, caddr_t, int, struct proc *);
 int pcons_mapchar(void *, int, unsigned int *);
 paddr_t pcons_mmap(void *, off_t, int);
-int pcons_putchar(void *, int, int, u_int, long);
+int pcons_putchar(void *, int, int, u_int, uint32_t);
 int pcons_show_screen(void *, void *, int, void (*)(void *, int, int),
     void *);
 
@@ -590,7 +590,7 @@ struct wsdisplay_accessops pcons_accessops = {
 
 int
 pcons_alloc_screen(void *v, const struct wsscreen_descr *typ, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct pconssoftc *sc = v;
  int *rowp, *colp;
@@ -664,7 +664,7 @@ pcons_mapchar(void *v, int uc, unsigned int *idx)
 }
 
 int
-pcons_putchar(void *v, int row, int col, u_int uc, long attr)
+pcons_putchar(void *v, int row, int col, u_int uc, uint32_t attr)
 {
  u_char buf[1];
  int s;
diff --git sys/arch/sparc64/dev/radeonfb.c sys/arch/sparc64/dev/radeonfb.c
index 1f9d6d58e63..f0468e24691 100644
--- sys/arch/sparc64/dev/radeonfb.c
+++ sys/arch/sparc64/dev/radeonfb.c
@@ -142,9 +142,9 @@ int radeonfb_putcmap(struct radeonfb_softc *, struct wsdisplay_cmap *);
 void radeonfb_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
 
 int radeonfb_copycols(void *, int, int, int, int);
-int radeonfb_erasecols(void *, int, int, int, long);
+int radeonfb_erasecols(void *, int, int, int, uint32_t);
 int radeonfb_copyrows(void *, int, int, int);
-int radeonfb_eraserows(void *, int, int, long);
+int radeonfb_eraserows(void *, int, int, uint32_t);
 
 void radeonfb_init(struct radeonfb_softc *);
 void radeonfb_wait_fifo(struct radeonfb_softc *, int);
@@ -467,7 +467,7 @@ radeonfb_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-radeonfb_erasecols(void *cookie, int row, int col, int num, long attr)
+radeonfb_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct radeonfb_softc *sc = ri->ri_hw;
@@ -502,7 +502,7 @@ radeonfb_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-radeonfb_eraserows(void *cookie, int row, int num, long attr)
+radeonfb_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct radeonfb_softc *sc = ri->ri_hw;
diff --git sys/arch/sparc64/dev/raptor.c sys/arch/sparc64/dev/raptor.c
index fe8acb4d724..db396c96a16 100644
--- sys/arch/sparc64/dev/raptor.c
+++ sys/arch/sparc64/dev/raptor.c
@@ -154,9 +154,9 @@ int raptor_putcmap(struct raptor_softc *, struct wsdisplay_cmap *);
 void raptor_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
 
 int raptor_copycols(void *, int, int, int, int);
-int raptor_erasecols(void *, int, int, int, long);
+int raptor_erasecols(void *, int, int, int, uint32_t);
 int raptor_copyrows(void *, int, int, int);
-int raptor_eraserows(void *, int, int, long);
+int raptor_eraserows(void *, int, int, uint32_t);
 
 void raptor_init(struct raptor_softc *);
 int raptor_wait(struct raptor_softc *);
@@ -439,7 +439,7 @@ raptor_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-raptor_erasecols(void *cookie, int row, int col, int num, long attr)
+raptor_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct raptor_softc *sc = ri->ri_hw;
@@ -474,7 +474,7 @@ raptor_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-raptor_eraserows(void *cookie, int row, int num, long attr)
+raptor_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct raptor_softc *sc = ri->ri_hw;
diff --git sys/dev/fdt/rkdrm.c sys/dev/fdt/rkdrm.c
index cd62c82790c..073c43b192a 100644
--- sys/dev/fdt/rkdrm.c
+++ sys/dev/fdt/rkdrm.c
@@ -268,7 +268,7 @@ void rkdrm_burner(void *, u_int, u_int);
 int rkdrm_wsioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t rkdrm_wsmmap(void *, off_t, int);
 int rkdrm_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void rkdrm_free_screen(void *, void *);
 int rkdrm_show_screen(void *, void *, int,
     void (*)(void *, int, int), void *);
@@ -363,7 +363,7 @@ rkdrm_wsmmap(void *v, off_t off, int prot)
 
 int
 rkdrm_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  return rasops_alloc_screen(v, cookiep, curxp, curyp, attrp);
 }
@@ -438,7 +438,7 @@ rkdrm_attachhook(struct device *dev)
  uint32_t *ports;
  int i, portslen, nports;
  int console = 0;
- long defattr;
+ uint32_t defattr;
  int error;
 
  if (sc->sc_node == stdout_node)
diff --git sys/dev/fdt/simplefb.c sys/dev/fdt/simplefb.c
index 8e6380f9ed0..8461d5cd530 100644
--- sys/dev/fdt/simplefb.c
+++ sys/dev/fdt/simplefb.c
@@ -92,7 +92,7 @@ const char *simplefb_init(int, struct rasops_info *);
 int simplefb_wsioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t simplefb_wsmmap(void *, off_t, int);
 int simplefb_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 
 struct wsdisplay_accessops simplefb_accessops = {
  .ioctl = simplefb_wsioctl,
@@ -130,7 +130,7 @@ simplefb_attach(struct device *parent, struct device *self, void *aux)
  struct wsemuldisplaydev_attach_args waa;
  const char *format;
  int console = 0;
- long defattr;
+ uint32_t defattr;
 
  format = simplefb_init(faa->fa_node, ri);
  if (format) {
@@ -297,7 +297,7 @@ simplefb_wsmmap(void *v, off_t off, int prot)
 
 int
 simplefb_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  return rasops_alloc_screen(v, cookiep, curxp, curyp, attrp);
 }
@@ -315,7 +315,7 @@ simplefb_init_cons(bus_space_tag_t iot)
  bus_space_handle_t ioh;
  struct fdt_reg reg;
  void *node;
- long defattr = 0;
+ uint32_t defattr = 0;
 
  node = fdt_find_cons("simple-framebuffer");
  if (node == NULL)
diff --git sys/dev/fdt/ssdfb.c sys/dev/fdt/ssdfb.c
index 105592d6194..98b6a0eca6f 100644
--- sys/dev/fdt/ssdfb.c
+++ sys/dev/fdt/ssdfb.c
@@ -129,18 +129,18 @@ void ssdfb_set_range(struct ssdfb_softc *, uint8_t, uint8_t,
 int ssdfb_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t ssdfb_mmap(void *, off_t, int);
 int ssdfb_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void ssdfb_free_screen(void *, void *);
 int ssdfb_show_screen(void *, void *, int, void (*cb) (void *, int, int),
     void *);
 int ssdfb_list_font(void *, struct wsdisplay_font *);
 int ssdfb_load_font(void *, void *, struct wsdisplay_font *);
 
-int ssdfb_putchar(void *, int, int, u_int, long);
+int ssdfb_putchar(void *, int, int, u_int, uint32_t);
 int ssdfb_copycols(void *, int, int, int, int);
-int ssdfb_erasecols(void *, int, int, int, long);
+int ssdfb_erasecols(void *, int, int, int, uint32_t);
 int ssdfb_copyrows(void *, int, int, int);
-int ssdfb_eraserows(void *, int, int, long);
+int ssdfb_eraserows(void *, int, int, uint32_t);
 int ssdfb_do_cursor(struct rasops_info *);
 
 struct cfattach ssdfb_i2c_ca = {
@@ -696,7 +696,7 @@ ssdfb_mmap(void *v, off_t off, int prot)
 
 int
 ssdfb_alloc_screen(void *v, const struct wsscreen_descr *descr,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct ssdfb_softc *sc = v;
  struct rasops_info *ri = &sc->sc_rinfo;
@@ -742,7 +742,7 @@ ssdfb_list_font(void *v, struct wsdisplay_font *font)
 }
 
 int
-ssdfb_putchar(void *cookie, int row, int col, u_int uc, long attr)
+ssdfb_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = (struct rasops_info *)cookie;
  struct ssdfb_softc *sc = ri->ri_hw;
@@ -772,7 +772,7 @@ ssdfb_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-ssdfb_erasecols(void *cookie, int row, int col, int num, long attr)
+ssdfb_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = (struct rasops_info *)cookie;
  struct ssdfb_softc *sc = ri->ri_hw;
@@ -800,7 +800,7 @@ ssdfb_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-ssdfb_eraserows(void *cookie, int row, int num, long attr)
+ssdfb_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = (struct rasops_info *)cookie;
  struct ssdfb_softc *sc = ri->ri_hw;
diff --git sys/dev/ic/pcdisplay_subr.c sys/dev/ic/pcdisplay_subr.c
index 8cd65fb2649..5a31b6d6837 100644
--- sys/dev/ic/pcdisplay_subr.c
+++ sys/dev/ic/pcdisplay_subr.c
@@ -145,7 +145,7 @@ done:
 }
 
 int
-pcdisplay_putchar(void *id, int row, int col, u_int c, long attr)
+pcdisplay_putchar(void *id, int row, int col, u_int c, uint32_t attr)
 {
  struct pcdisplayscreen *scr = id;
  bus_space_tag_t memt = scr->hdl->ph_memt;
@@ -220,7 +220,7 @@ pcdisplay_copycols(void *id, int row, int srccol, int dstcol, int ncols)
 }
 
 int
-pcdisplay_erasecols(void *id, int row, int startcol, int ncols, long fillattr)
+pcdisplay_erasecols(void *id, int row, int startcol, int ncols, uint32_t fillattr)
 {
  struct pcdisplayscreen *scr = id;
  bus_space_tag_t memt = scr->hdl->ph_memt;
@@ -273,7 +273,7 @@ pcdisplay_copyrows(void *id, int srcrow, int dstrow, int nrows)
 }
 
 int
-pcdisplay_eraserows(void *id, int startrow, int nrows, long fillattr)
+pcdisplay_eraserows(void *id, int startrow, int nrows, uint32_t fillattr)
 {
  struct pcdisplayscreen *scr = id;
  bus_space_tag_t memt = scr->hdl->ph_memt;
diff --git sys/dev/ic/pcdisplayvar.h sys/dev/ic/pcdisplayvar.h
index c2d0b091163..77209e6a3a9 100644
--- sys/dev/ic/pcdisplayvar.h
+++ sys/dev/ic/pcdisplayvar.h
@@ -77,10 +77,10 @@ void pcdisplay_cursor_init(struct pcdisplayscreen *, int);
 void pcdisplay_cursor_reset(struct pcdisplayscreen *);
 int pcdisplay_cursor(void *, int, int, int);
 int pcdisplay_mapchar(void *, int, unsigned int *);
-int pcdisplay_putchar(void *, int, int, u_int, long);
+int pcdisplay_putchar(void *, int, int, u_int, uint32_t);
 struct wsdisplay_charcell;
 int pcdisplay_getchar(void *, int, int, struct wsdisplay_charcell *);
 int pcdisplay_copycols(void *, int, int, int,int);
-int pcdisplay_erasecols(void *, int, int, int, long);
+int pcdisplay_erasecols(void *, int, int, int, uint32_t);
 int pcdisplay_copyrows(void *, int, int, int);
-int pcdisplay_eraserows(void *, int, int, long);
+int pcdisplay_eraserows(void *, int, int, uint32_t);
diff --git sys/dev/ic/sti.c sys/dev/ic/sti.c
index 16a4188460c..3ed88ba7bff 100644
--- sys/dev/ic/sti.c
+++ sys/dev/ic/sti.c
@@ -53,15 +53,15 @@ struct cfdriver sti_cd = {
  NULL, "sti", DV_DULL
 };
 
-int sti_pack_attr(void *, int, int, int, long *);
+int sti_pack_attr(void *, int, int, int, uint32_t *);
 int sti_copycols(void *, int, int, int, int);
 int sti_copyrows(void *, int, int, int);
 int sti_cursor(void *, int, int, int);
-int sti_erasecols(void *, int, int, int, long);
-int sti_eraserows(void *, int, int, long);
+int sti_erasecols(void *, int, int, int, uint32_t);
+int sti_eraserows(void *, int, int, uint32_t);
 int sti_mapchar(void *, int, u_int *);
-int sti_putchar(void *, int, int, u_int, long);
-void sti_unpack_attr(void *, long, int *, int *, int *);
+int sti_putchar(void *, int, int, u_int, uint32_t);
+void sti_unpack_attr(void *, uint32_t, int *, int *, int *);
 
 struct wsdisplay_emulops sti_emulops = {
  .cursor = sti_cursor,
@@ -76,7 +76,7 @@ struct wsdisplay_emulops sti_emulops = {
 };
 
 int sti_alloc_screen(void *, const struct wsscreen_descr *, void **, int *,
-    int *, long *);
+    int *, uint32_t *);
 void sti_free_screen(void *, void *);
 int sti_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t sti_mmap(void *, off_t, int);
@@ -770,7 +770,7 @@ sti_end_attach_screen(struct sti_softc *sc, struct sti_screen *scr, int console)
 
  /* attach as console if required */
  if (console && !ISSET(sc->sc_flags, STI_ATTACHED)) {
- long defattr;
+ uint32_t defattr;
 
  sti_pack_attr(scr, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&scr->scr_wsd, scr,
@@ -1195,7 +1195,7 @@ sti_mmap(void *v, off_t offset, int prot)
 
 int
 sti_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *cxp, int *cyp, long *defattr)
+    int *cxp, int *cyp, uint32_t *defattr)
 {
  struct sti_screen *scr = (struct sti_screen *)v;
 
@@ -1304,7 +1304,7 @@ sti_mapchar(void *v, int uni, u_int *index)
 }
 
 int
-sti_putchar(void *v, int row, int col, u_int uc, long attr)
+sti_putchar(void *v, int row, int col, u_int uc, uint32_t attr)
 {
  struct sti_screen *scr = (struct sti_screen *)v;
  struct sti_rom *rom = scr->scr_rom;
@@ -1381,7 +1381,7 @@ sti_copycols(void *v, int row, int srccol, int dstcol, int ncols)
 }
 
 int
-sti_erasecols(void *v, int row, int startcol, int ncols, long attr)
+sti_erasecols(void *v, int row, int startcol, int ncols, uint32_t attr)
 {
  struct sti_screen *scr = (struct sti_screen *)v;
  struct sti_font *fp = &scr->scr_curfont;
@@ -1407,7 +1407,7 @@ sti_copyrows(void *v, int srcrow, int dstrow, int nrows)
 }
 
 int
-sti_eraserows(void *v, int srcrow, int nrows, long attr)
+sti_eraserows(void *v, int srcrow, int nrows, uint32_t attr)
 {
  struct sti_screen *scr = (struct sti_screen *)v;
  struct sti_font *fp = &scr->scr_curfont;
@@ -1419,7 +1419,7 @@ sti_eraserows(void *v, int srcrow, int nrows, long attr)
 }
 
 int
-sti_pack_attr(void *v, int fg, int bg, int flags, long *pattr)
+sti_pack_attr(void *v, int fg, int bg, int flags, uint32_t *pattr)
 {
 #if 0
  struct sti_screen *scr = (struct sti_screen *)v;
@@ -1430,7 +1430,7 @@ sti_pack_attr(void *v, int fg, int bg, int flags, long *pattr)
 }
 
 void
-sti_unpack_attr(void *v, long attr, int *fg, int *bg, int *ul)
+sti_unpack_attr(void *v, uint32_t attr, int *fg, int *bg, int *ul)
 {
 #if 0
  struct sti_screen *scr = (struct sti_screen *)v;
diff --git sys/dev/ic/vga.c sys/dev/ic/vga.c
index 1d3546b6d30..387662f0ef9 100644
--- sys/dev/ic/vga.c
+++ sys/dev/ic/vga.c
@@ -106,16 +106,16 @@ struct vga_config vga_console_vc;
 int vga_selectfont(struct vga_config *, struct vgascreen *,
     const char *, const char *);
 void vga_init_screen(struct vga_config *, struct vgascreen *,
-    const struct wsscreen_descr *, int, long *);
+    const struct wsscreen_descr *, int, uint32_t *);
 void vga_init(struct vga_config *, bus_space_tag_t, bus_space_tag_t);
 void vga_setfont(struct vga_config *, struct vgascreen *);
 void vga_pick_monitor_type(struct vga_config *);
 
 int vga_mapchar(void *, int, unsigned int *);
-int vga_putchar(void *, int, int, u_int, long);
-int vga_pack_attr(void *, int, int, int, long *);
+int vga_putchar(void *, int, int, u_int, uint32_t);
+int vga_pack_attr(void *, int, int, int, uint32_t *);
 int vga_copyrows(void *, int, int, int);
-void vga_unpack_attr(void *, long, int *, int *, int *);
+void vga_unpack_attr(void *, uint32_t, int *, int *, int *);
 
 static const struct wsdisplay_emulops vga_emulops = {
  pcdisplay_cursor,
@@ -244,7 +244,7 @@ const struct wsscreen_list vga_screenlist = {
 int vga_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t vga_mmap(void *, off_t, int);
 int vga_alloc_screen(void *, const struct wsscreen_descr *,
- void **, int *, int *, long *);
+ void **, int *, int *, uint32_t *);
 void vga_free_screen(void *, void *);
 int vga_show_screen(void *, void *, int,
  void (*) (void *, int, int), void *);
@@ -396,7 +396,7 @@ vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1,
 
 void
 vga_init_screen(struct vga_config *vc, struct vgascreen *scr,
-    const struct wsscreen_descr *type, int existing, long *attrp)
+    const struct wsscreen_descr *type, int existing, uint32_t *attrp)
 {
  int cpos;
  int res;
@@ -573,7 +573,7 @@ vga_extended_attach(struct device *self, bus_space_tag_t iot,
 int
 vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
 {
- long defattr;
+ uint32_t defattr;
  const struct wsscreen_descr *scr;
 
  if (check && !vga_common_probe(iot, memt))
@@ -668,7 +668,7 @@ vga_mmap(void *v, off_t offset, int prot)
 
 int
 vga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *defattrp)
+    int *curxp, int *curyp, uint32_t *defattrp)
 {
  struct vga_config *vc = v;
  struct vgascreen *scr;
@@ -985,7 +985,7 @@ vga_scrollback(void *v, void *cookie, int lines)
 }
 
 int
-vga_pack_attr(void *id, int fg, int bg, int flags, long *attrp)
+vga_pack_attr(void *id, int fg, int bg, int flags, uint32_t *attrp)
 {
  struct vgascreen *scr = id;
  struct vga_config *vc = scr->cfg;
@@ -1017,7 +1017,7 @@ vga_pack_attr(void *id, int fg, int bg, int flags, long *attrp)
 }
 
 void
-vga_unpack_attr(void *id, long attr, int *fg, int *bg, int *ul)
+vga_unpack_attr(void *id, uint32_t attr, int *fg, int *bg, int *ul)
 {
  struct vgascreen *scr = id;
  struct vga_config *vc = scr->cfg;
@@ -1150,7 +1150,7 @@ vga_mapchar(void *id, int uni, unsigned int *index)
 }
 
 int
-vga_putchar(void *c, int row, int col, u_int uc, long attr)
+vga_putchar(void *c, int row, int col, u_int uc, uint32_t attr)
 {
  struct vgascreen *scr = c;
  int rc;
diff --git sys/dev/isa/pcdisplay.c sys/dev/isa/pcdisplay.c
index bd766fbe30f..53d2b0a56dc 100644
--- sys/dev/isa/pcdisplay.c
+++ sys/dev/isa/pcdisplay.c
@@ -70,8 +70,8 @@ static int pcdisplay_probe_mono(bus_space_tag_t, bus_space_tag_t);
 static void pcdisplay_init(struct pcdisplay_config *,
      bus_space_tag_t, bus_space_tag_t,
      int);
-static int pcdisplay_pack_attr(void *, int, int, int, long *);
-static void pcdisplay_unpack_attr(void *, long, int *, int *, int *);
+static int pcdisplay_pack_attr(void *, int, int, int, uint32_t *);
+static void pcdisplay_unpack_attr(void *, uint32_t, int *, int *, int *);
 
 struct cfattach pcdisplay_ca = {
  sizeof(struct pcdisplay_softc), pcdisplay_match, pcdisplay_attach,
@@ -108,7 +108,7 @@ const struct wsscreen_list pcdisplay_screenlist = {
 static int pcdisplay_ioctl(void *, u_long, caddr_t, int, struct proc *);
 static paddr_t pcdisplay_mmap(void *, off_t, int);
 static int pcdisplay_alloc_screen(void *, const struct wsscreen_descr *,
-       void **, int *, int *, long *);
+       void **, int *, int *, uint32_t *);
 static void pcdisplay_free_screen(void *, void *);
 static int pcdisplay_show_screen(void *, void *, int,
  void (*) (void *, int, int), void *);
@@ -335,7 +335,7 @@ pcdisplay_mmap(void *v, off_t offset, int prot)
 
 static int
 pcdisplay_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *defattrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *defattrp)
 {
  struct pcdisplay_softc *sc = v;
 
@@ -375,7 +375,7 @@ pcdisplay_show_screen(void *v, void *cookie, int waitok,
 }
 
 static int
-pcdisplay_pack_attr(void *id, int fg, int bg, int flags, long *attrp)
+pcdisplay_pack_attr(void *id, int fg, int bg, int flags, uint32_t *attrp)
 {
  if (flags & WSATTR_REVERSE)
  *attrp = FG_BLACK | BG_LIGHTGREY;
@@ -385,7 +385,7 @@ pcdisplay_pack_attr(void *id, int fg, int bg, int flags, long *attrp)
 }
 
 static void
-pcdisplay_unpack_attr(void *id, long attr, int *fg, int *bg, int *ul)
+pcdisplay_unpack_attr(void *id, uint32_t attr, int *fg, int *bg, int *ul)
 {
  if (attr == (FG_BLACK | BG_LIGHTGREY)) {
  *fg = WSCOL_BLACK;
diff --git sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
index 4d76c319407..45f454cbb1b 100644
--- sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
+++ sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
@@ -1590,7 +1590,7 @@ void amdgpu_burner(void *, u_int, u_int);
 int amdgpu_wsioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t amdgpu_wsmmap(void *, off_t, int);
 int amdgpu_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void amdgpu_free_screen(void *, void *);
 int amdgpu_show_screen(void *, void *, int,
     void (*)(void *, int, int), void *);
@@ -1684,7 +1684,7 @@ amdgpu_wsmmap(void *v, off_t off, int prot)
 
 int
 amdgpu_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  return rasops_alloc_screen(v, cookiep, curxp, curyp, attrp);
 }
@@ -1826,7 +1826,7 @@ amdgpu_attachhook(struct device *self)
  aa.defaultscreens = 0;
 
  if (adev->console) {
- long defattr;
+ uint32_t defattr;
 
  ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&amdgpu_stdscreen, ri->ri_active,
diff --git sys/dev/pci/drm/i915/i915_drv.c sys/dev/pci/drm/i915/i915_drv.c
index c245e7e058c..c01597699f8 100644
--- sys/dev/pci/drm/i915/i915_drv.c
+++ sys/dev/pci/drm/i915/i915_drv.c
@@ -3160,7 +3160,7 @@ intagp_print(void *vaa, const char *pnp)
 int inteldrm_wsioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t inteldrm_wsmmap(void *, off_t, int);
 int inteldrm_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void inteldrm_free_screen(void *, void *);
 int inteldrm_show_screen(void *, void *, int,
     void (*)(void *, int, int), void *);
@@ -3267,7 +3267,7 @@ inteldrm_wsmmap(void *v, off_t off, int prot)
 
 int
 inteldrm_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct inteldrm_softc *dev_priv = v;
  struct rasops_info *ri = &dev_priv->ro;
@@ -3658,7 +3658,7 @@ inteldrm_attachhook(struct device *self)
  aa.defaultscreens = 0;
 
  if (dev_priv->console) {
- long defattr;
+ uint32_t defattr;
 
  /*
  * Clear the entire screen if we're doing rotation to
diff --git sys/dev/pci/drm/radeon/radeon_kms.c sys/dev/pci/drm/radeon/radeon_kms.c
index c942930d6d8..f782bd71183 100644
--- sys/dev/pci/drm/radeon/radeon_kms.c
+++ sys/dev/pci/drm/radeon/radeon_kms.c
@@ -173,7 +173,7 @@ void radeondrm_burner(void *, u_int, u_int);
 int radeondrm_wsioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t radeondrm_wsmmap(void *, off_t, int);
 int radeondrm_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void radeondrm_free_screen(void *, void *);
 int radeondrm_show_screen(void *, void *, int,
     void (*)(void *, int, int), void *);
@@ -244,7 +244,7 @@ radeondrm_wsmmap(void *v, off_t off, int prot)
 
 int
 radeondrm_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  return rasops_alloc_screen(v, cookiep, curxp, curyp, attrp);
 }
@@ -795,7 +795,7 @@ radeondrm_attachhook(struct device *self)
  aa.defaultscreens = 0;
 
  if (rdev->console) {
- long defattr;
+ uint32_t defattr;
 
  ri->ri_ops.pack_attr(ri->ri_active, 0, 0, 0, &defattr);
  wsdisplay_cnattach(&radeondrm_stdscreen, ri->ri_active,
diff --git sys/dev/pci/tga.c sys/dev/pci/tga.c
index 0fb9d10a4bb..c18ffdddb64 100644
--- sys/dev/pci/tga.c
+++ sys/dev/pci/tga.c
@@ -89,7 +89,7 @@ struct tga_devconfig tga_console_dc;
 int tga_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t tga_mmap(void *, off_t, int);
 int tga_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void tga_free_screen(void *, void *);
 int tga_show_screen(void *, void *, int,
    void (*) (void *, int, int), void *);
@@ -99,9 +99,9 @@ void tga_burner(void *, u_int, u_int);
 
 int tga_copyrows(void *, int, int, int);
 int tga_copycols(void *, int, int, int, int);
-int tga_eraserows(void *, int, int, long);
-int tga_erasecols(void *, int, int, int, long);
-int tga_putchar(void *c, int row, int col, u_int uc, long attr);
+int tga_eraserows(void *, int, int, uint32_t);
+int tga_erasecols(void *, int, int, int, uint32_t);
+int tga_putchar(void *c, int row, int col, u_int uc, uint32_t attr);
 
 int tga_rop(struct rasops_info *, int, int, int, int,
  struct rasops_info *, int, int);
@@ -731,10 +731,10 @@ tga_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
  const struct wsscreen_descr *type;
  void **cookiep;
  int *curxp, *curyp;
- long *attrp;
+ uint32_t *attrp;
 {
  struct tga_softc *sc = v;
- long defattr;
+ uint32_t defattr;
 
  if (sc->nscreens > 0)
  return (ENOMEM);
@@ -837,7 +837,7 @@ tga_cnattach(iot, memt, pc, bus, device, function)
  int bus, device, function;
 {
  struct tga_devconfig *dcp = &tga_console_dc;
- long defattr;
+ uint32_t defattr;
 
  tga_getdevconfig(memt, pc,
     pci_make_tag(pc, bus, device, function), dcp);
@@ -1312,7 +1312,7 @@ tga_putchar(c, row, col, uc, attr)
  void *c;
  int row, col;
  u_int uc;
- long attr;
+ uint32_t attr;
 {
  struct rasops_info *ri = c;
  struct tga_devconfig *dc = ri->ri_hw;
@@ -1379,7 +1379,7 @@ int
 tga_eraserows(c, row, num, attr)
  void *c;
  int row, num;
- long attr;
+ uint32_t attr;
 {
  struct rasops_info *ri = c;
  struct tga_devconfig *dc = ri->ri_hw;
@@ -1436,7 +1436,7 @@ int
 tga_erasecols (c, row, col, num, attr)
  void *c;
  int row, col, num;
- long attr;
+ uint32_t attr;
 {
  struct rasops_info *ri = c;
  struct tga_devconfig *dc = ri->ri_hw;
diff --git sys/dev/pcmcia/cfxga.c sys/dev/pcmcia/cfxga.c
index 221dd3e0211..cafef1f0f99 100644
--- sys/dev/pcmcia/cfxga.c
+++ sys/dev/pcmcia/cfxga.c
@@ -109,7 +109,7 @@ struct cfdriver cfxga_cd = {
 };
 
 int cfxga_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
+    int *, int *, uint32_t *);
 void cfxga_burner(void *, u_int, u_int);
 void cfxga_free_screen(void *, void *);
 int cfxga_ioctl(void *, u_long, caddr_t, int, struct proc *);
@@ -144,14 +144,14 @@ struct cfxga_screen {
 int cfxga_copycols(void *, int, int, int, int);
 int cfxga_copyrows(void *, int, int, int);
 int cfxga_do_cursor(struct rasops_info *);
-int cfxga_erasecols(void *, int, int, int, long);
-int cfxga_eraserows(void *, int, int, long);
-int cfxga_putchar(void *, int, int, u_int, long);
+int cfxga_erasecols(void *, int, int, int, uint32_t);
+int cfxga_eraserows(void *, int, int, uint32_t);
+int cfxga_putchar(void *, int, int, u_int, uint32_t);
 
 int cfxga_install_function(struct pcmcia_function *);
 void cfxga_remove_function(struct pcmcia_function *);
 
-int cfxga_expand_char(struct cfxga_screen *, u_int, int, int, long);
+int cfxga_expand_char(struct cfxga_screen *, u_int, int, int, uint32_t);
 int cfxga_repaint_screen(struct cfxga_screen *);
 void cfxga_reset_video(struct cfxga_softc *);
 void cfxga_reset_and_repaint(struct cfxga_softc *);
@@ -430,7 +430,7 @@ cfxga_detach(struct device *dev, int flags)
 
 int
 cfxga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct cfxga_softc *sc = v;
  struct cfxga_screen *scr;
@@ -862,7 +862,8 @@ cfxga_synchronize(struct cfxga_softc *sc)
  * Display a character.
  */
 int
-cfxga_expand_char(struct cfxga_screen *scr, u_int uc, int x, int y, long attr)
+cfxga_expand_char(struct cfxga_screen *scr, u_int uc, int x, int y,
+    uint32_t attr)
 {
  struct cfxga_softc *sc = scr->scr_sc;
  struct rasops_info *ri = &scr->scr_ri;
@@ -1133,7 +1134,7 @@ cfxga_do_cursor(struct rasops_info *ri)
 }
 
 int
-cfxga_erasecols(void *cookie, int row, int col, int num, long attr)
+cfxga_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct cfxga_screen *scr = ri->ri_hw;
@@ -1158,7 +1159,7 @@ cfxga_erasecols(void *cookie, int row, int col, int num, long attr)
 }
 
 int
-cfxga_eraserows(void *cookie, int row, int num, long attr)
+cfxga_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct cfxga_screen *scr = ri->ri_hw;
@@ -1187,7 +1188,7 @@ cfxga_eraserows(void *cookie, int row, int num, long attr)
 }
 
 int
-cfxga_putchar(void *cookie, int row, int col, u_int uc, long attr)
+cfxga_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct cfxga_screen *scr = ri->ri_hw;
diff --git sys/dev/rasops/rasops.c sys/dev/rasops/rasops.c
index 9bc3f1748c6..9fc43a917a3 100644
--- sys/dev/rasops/rasops.c
+++ sys/dev/rasops/rasops.c
@@ -138,7 +138,7 @@ struct rasops_screen {
  int rs_visible;
  int rs_crow;
  int rs_ccol;
- long rs_defattr;
+ uint32_t rs_defattr;
 
  int rs_sbscreens;
 #define RS_SCROLLBACK_SCREENS 5
@@ -151,11 +151,11 @@ int rasops_copycols(void *, int, int, int, int);
 int rasops_copyrows(void *, int, int, int);
 int rasops_mapchar(void *, int, u_int *);
 int rasops_cursor(void *, int, int, int);
-int rasops_pack_cattr(void *, int, int, int, long *);
-int rasops_pack_mattr(void *, int, int, int, long *);
+int rasops_pack_cattr(void *, int, int, int, uint32_t *);
+int rasops_pack_mattr(void *, int, int, int, uint32_t *);
 int rasops_do_cursor(struct rasops_info *);
 void rasops_init_devcmap(struct rasops_info *);
-void rasops_unpack_attr(void *, long, int *, int *, int *);
+void rasops_unpack_attr(void *, uint32_t, int *, int *, int *);
 #if NRASOPS_BSWAP > 0
 static void slow_bcopy(void *, void *, size_t);
 #endif
@@ -163,9 +163,9 @@ static void slow_bcopy(void *, void *, size_t);
 void rasops_copychar(void *, int, int, int, int);
 int rasops_copycols_rotated(void *, int, int, int, int);
 int rasops_copyrows_rotated(void *, int, int, int);
-int rasops_erasecols_rotated(void *, int, int, int, long);
-int rasops_eraserows_rotated(void *, int, int, long);
-int rasops_putchar_rotated(void *, int, int, u_int, long);
+int rasops_erasecols_rotated(void *, int, int, int, uint32_t);
+int rasops_eraserows_rotated(void *, int, int, uint32_t);
+int rasops_putchar_rotated(void *, int, int, u_int, uint32_t);
 void rasops_rotate_font(int *, int);
 
 /*
@@ -182,19 +182,19 @@ struct rotatedfont {
 void rasops_doswitch(void *);
 int rasops_vcons_cursor(void *, int, int, int);
 int rasops_vcons_mapchar(void *, int, u_int *);
-int rasops_vcons_putchar(void *, int, int, u_int, long);
+int rasops_vcons_putchar(void *, int, int, u_int, uint32_t);
 int rasops_vcons_copycols(void *, int, int, int, int);
-int rasops_vcons_erasecols(void *, int, int, int, long);
+int rasops_vcons_erasecols(void *, int, int, int, uint32_t);
 int rasops_vcons_copyrows(void *, int, int, int);
-int rasops_vcons_eraserows(void *, int, int, long);
-int rasops_vcons_pack_attr(void *, int, int, int, long *);
-void rasops_vcons_unpack_attr(void *, long, int *, int *, int *);
+int rasops_vcons_eraserows(void *, int, int, uint32_t);
+int rasops_vcons_pack_attr(void *, int, int, int, uint32_t *);
+void rasops_vcons_unpack_attr(void *, uint32_t, int *, int *, int *);
 
-int rasops_wronly_putchar(void *, int, int, u_int, long);
+int rasops_wronly_putchar(void *, int, int, u_int, uint32_t);
 int rasops_wronly_copycols(void *, int, int, int, int);
-int rasops_wronly_erasecols(void *, int, int, int, long);
+int rasops_wronly_erasecols(void *, int, int, int, uint32_t);
 int rasops_wronly_copyrows(void *, int, int, int);
-int rasops_wronly_eraserows(void *, int, int, long);
+int rasops_wronly_eraserows(void *, int, int, uint32_t);
 int rasops_wronly_do_cursor(struct rasops_info *);
 
 int rasops_add_font(struct rasops_info *, struct wsdisplay_font *);
@@ -288,7 +288,7 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
  if (ri->ri_flg & RI_VCONS) {
  void *cookie;
  int curx, cury;
- long attr;
+ uint32_t attr;
 
  if (rasops_alloc_screen(ri, &cookie, &curx, &cury, &attr))
  return (-1);
@@ -308,7 +308,7 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
  ri->ri_ops.unpack_attr = rasops_vcons_unpack_attr;
  ri->ri_do_cursor = rasops_wronly_do_cursor;
  } else if ((ri->ri_flg & RI_WRONLY) && ri->ri_bs != NULL) {
- long attr;
+ uint32_t attr;
  int i;
 
  ri->ri_ops.putchar = rasops_wronly_putchar;
@@ -551,7 +551,7 @@ rasops_mapchar(void *cookie, int c, u_int *cp)
  * Pack a color attribute.
  */
 int
-rasops_pack_cattr(void *cookie, int fg, int bg, int flg, long *attr)
+rasops_pack_cattr(void *cookie, int fg, int bg, int flg, uint32_t *attr)
 {
  int swap;
 
@@ -592,7 +592,7 @@ rasops_pack_cattr(void *cookie, int fg, int bg, int flg, long *attr)
  * Pack a mono attribute.
  */
 int
-rasops_pack_mattr(void *cookie, int fg, int bg, int flg, long *attr)
+rasops_pack_mattr(void *cookie, int fg, int bg, int flg, uint32_t *attr)
 {
  int swap;
 
@@ -897,7 +897,7 @@ rasops_init_devcmap(struct rasops_info *ri)
  * Unpack a rasops attribute
  */
 void
-rasops_unpack_attr(void *cookie, long attr, int *fg, int *bg, int *underline)
+rasops_unpack_attr(void *cookie, uint32_t attr, int *fg, int *bg, int *underline)
 {
  *fg = ((u_int)attr >> 24) & 0xf;
  *bg = ((u_int)attr >> 16) & 0xf;
@@ -909,7 +909,7 @@ rasops_unpack_attr(void *cookie, long attr, int *fg, int *bg, int *underline)
  * Erase rows
  */
 int
-rasops_eraserows(void *cookie, int row, int num, long attr)
+rasops_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri;
  int np, nw, cnt, delta;
@@ -1057,7 +1057,7 @@ rasops_do_cursor(struct rasops_info *ri)
  * Erase columns.
  */
 int
-rasops_erasecols(void *cookie, int row, int col, int num, long attr)
+rasops_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  int n8, height, cnt, slop1, slop2, clr;
  struct rasops_info *ri;
@@ -1258,7 +1258,7 @@ rasops_copychar(void *cookie, int srcrow, int dstrow, int srccol, int dstcol)
 }
 
 int
-rasops_putchar_rotated(void *cookie, int row, int col, u_int uc, long attr)
+rasops_putchar_rotated(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  u_char *rp;
@@ -1297,7 +1297,7 @@ rasops_putchar_rotated(void *cookie, int row, int col, u_int uc, long attr)
 }
 
 int
-rasops_erasecols_rotated(void *cookie, int row, int col, int num, long attr)
+rasops_erasecols_rotated(void *cookie, int row, int col, int num, uint32_t attr)
 {
  int i;
  int rc;
@@ -1352,7 +1352,7 @@ rasops_copycols_rotated(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-rasops_eraserows_rotated(void *cookie, int row, int num, long attr)
+rasops_eraserows_rotated(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri;
  int col, rn;
@@ -1399,7 +1399,7 @@ slow_bcopy(void *s, void *d, size_t len)
 
 int
 rasops_alloc_screen(void *v, void **cookiep,
-    int *curxp, int *curyp, long *attrp)
+    int *curxp, int *curyp, uint32_t *attrp)
 {
  struct rasops_info *ri = v;
  struct rasops_screen *scr;
@@ -1553,7 +1553,7 @@ rasops_vcons_mapchar(void *cookie, int c, u_int *cp)
 }
 
 int
-rasops_vcons_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops_vcons_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_screen *scr = cookie;
  int off = row * scr->rs_ri->ri_cols + col + scr->rs_dispoffset;
@@ -1601,7 +1601,7 @@ rasops_vcons_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-rasops_vcons_erasecols(void *cookie, int row, int col, int num, long attr)
+rasops_vcons_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_screen *scr = cookie;
  int cols = scr->rs_ri->ri_cols;
@@ -1658,7 +1658,7 @@ rasops_vcons_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-rasops_vcons_eraserows(void *cookie, int row, int num, long attr)
+rasops_vcons_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_screen *scr = cookie;
  int cols = scr->rs_ri->ri_cols;
@@ -1678,7 +1678,7 @@ rasops_vcons_eraserows(void *cookie, int row, int num, long attr)
 }
 
 int
-rasops_vcons_pack_attr(void *cookie, int fg, int bg, int flg, long *attr)
+rasops_vcons_pack_attr(void *cookie, int fg, int bg, int flg, uint32_t *attr)
 {
  struct rasops_screen *scr = cookie;
 
@@ -1686,7 +1686,7 @@ rasops_vcons_pack_attr(void *cookie, int fg, int bg, int flg, long *attr)
 }
 
 void
-rasops_vcons_unpack_attr(void *cookie, long attr, int *fg, int *bg,
+rasops_vcons_unpack_attr(void *cookie, uint32_t attr, int *fg, int *bg,
     int *underline)
 {
  struct rasops_screen *scr = cookie;
@@ -1695,7 +1695,7 @@ rasops_vcons_unpack_attr(void *cookie, long attr, int *fg, int *bg,
 }
 
 int
-rasops_wronly_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops_wronly_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  int off = row * ri->ri_cols + col;
@@ -1729,7 +1729,7 @@ rasops_wronly_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-rasops_wronly_erasecols(void *cookie, int row, int col, int num, long attr)
+rasops_wronly_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  int cols = ri->ri_cols;
@@ -1770,7 +1770,7 @@ rasops_wronly_copyrows(void *cookie, int src, int dst, int num)
 }
 
 int
-rasops_wronly_eraserows(void *cookie, int row, int num, long attr)
+rasops_wronly_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  int cols = ri->ri_cols;
@@ -1791,7 +1791,7 @@ rasops_wronly_do_cursor(struct rasops_info *ri)
 {
  int off = ri->ri_crow * ri->ri_cols + ri->ri_ccol;
  u_int uc;
- long attr;
+ uint32_t attr;
  int fg, bg;
 
  uc = ri->ri_bs[off].uc;
diff --git sys/dev/rasops/rasops.h sys/dev/rasops/rasops.h
index a363ae800a2..1b14ee2158b 100644
--- sys/dev/rasops/rasops.h
+++ sys/dev/rasops/rasops.h
@@ -130,12 +130,12 @@ struct rasops_info {
  void *ri_switchcookie;
  struct task ri_switchtask;
 
- int (*ri_putchar)(void *, int, int, u_int, long);
+ int (*ri_putchar)(void *, int, int, u_int, uint32_t);
  int (*ri_copycols)(void *, int, int, int, int);
- int (*ri_erasecols)(void *, int, int, int, long);
+ int (*ri_erasecols)(void *, int, int, int, uint32_t);
  int (*ri_copyrows)(void *, int, int, int);
- int (*ri_eraserows)(void *, int, int, long);
- int (*ri_pack_attr)(void *, int, int, int, long *);
+ int (*ri_eraserows)(void *, int, int, uint32_t);
+ int (*ri_pack_attr)(void *, int, int, int, uint32_t *);
 };
 
 #define DELTA(p, d, cast) ((p) = (cast)((caddr_t)(p) + (d)))
@@ -168,10 +168,10 @@ void rasops32_init(struct rasops_info *);
 /* rasops.c */
 int rasops_init(struct rasops_info *, int, int);
 int rasops_reconfig(struct rasops_info *, int, int);
-int rasops_eraserows(void *, int, int, long);
-int rasops_erasecols(void *, int, int, int, long);
+int rasops_eraserows(void *, int, int, uint32_t);
+int rasops_erasecols(void *, int, int, int, uint32_t);
 
-int rasops_alloc_screen(void *, void **, int *, int *, long *);
+int rasops_alloc_screen(void *, void **, int *, int *, uint32_t *);
 void rasops_free_screen(void *, void *);
 int rasops_show_screen(void *, void *, int,
     void (*)(void *, int, int), void *);
diff --git sys/dev/rasops/rasops1.c sys/dev/rasops/rasops1.c
index ce5a1ce73b9..a5d0428a5ca 100644
--- sys/dev/rasops/rasops1.c
+++ sys/dev/rasops/rasops1.c
@@ -41,12 +41,12 @@
 #include <dev/rasops/rasops_masks.h>
 
 int rasops1_copycols(void *, int, int, int, int);
-int rasops1_erasecols(void *, int, int, int, long);
+int rasops1_erasecols(void *, int, int, int, uint32_t);
 int rasops1_do_cursor(struct rasops_info *);
-int rasops1_putchar(void *, int, int col, u_int, long);
+int rasops1_putchar(void *, int, int col, u_int, uint32_t);
 #ifndef RASOPS_SMALL
-int rasops1_putchar8(void *, int, int col, u_int, long);
-int rasops1_putchar16(void *, int, int col, u_int, long);
+int rasops1_putchar8(void *, int, int col, u_int, uint32_t);
+int rasops1_putchar16(void *, int, int col, u_int, uint32_t);
 #endif
 
 /*
@@ -82,7 +82,7 @@ rasops1_init(struct rasops_info *ri)
  * Paint a single character. This is the generic version, this is ugly.
  */
 int
-rasops1_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops1_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  u_int fs, rs, fb, bg, fg, lmask, rmask;
  u_int32_t height, width;
@@ -228,7 +228,7 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, long attr)
  * Paint a single character. This is for 8-pixel wide fonts.
  */
 int
-rasops1_putchar8(void *cookie, int row, int col, u_int uc, long attr)
+rasops1_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  int height, fs, rs, bg, fg;
  struct rasops_info *ri;
@@ -291,7 +291,7 @@ rasops1_putchar8(void *cookie, int row, int col, u_int uc, long attr)
  * Paint a single character. This is for 16-pixel wide fonts.
  */
 int
-rasops1_putchar16(void *cookie, int row, int col, u_int uc, long attr)
+rasops1_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  int height, fs, rs, bg, fg;
  struct rasops_info *ri;
diff --git sys/dev/rasops/rasops15.c sys/dev/rasops/rasops15.c
index 800dfdc57e5..6ec4751ab79 100644
--- sys/dev/rasops/rasops15.c
+++ sys/dev/rasops/rasops15.c
@@ -38,18 +38,18 @@
 #include <dev/wscons/wsconsio.h>
 #include <dev/rasops/rasops.h>
 
-int rasops15_putchar(void *, int, int, u_int, long attr);
+int rasops15_putchar(void *, int, int, u_int, uint32_t attr);
 #ifndef RASOPS_SMALL
-int rasops15_putchar8(void *, int, int, u_int, long attr);
-int rasops15_putchar12(void *, int, int, u_int, long attr);
-int rasops15_putchar16(void *, int, int, u_int, long attr);
-void rasops15_makestamp(struct rasops_info *, long);
+int rasops15_putchar8(void *, int, int, u_int, uint32_t attr);
+int rasops15_putchar12(void *, int, int, u_int, uint32_t attr);
+int rasops15_putchar16(void *, int, int, u_int, uint32_t attr);
+void rasops15_makestamp(struct rasops_info *, uint32_t);
 
 /*
  * (2x2)x1 stamp for optimized character blitting
  */
 static int32_t stamp[32];
-static long stamp_attr;
+static uint32_t stamp_attr;
 static int stamp_mutex; /* XXX see note in readme */
 #endif
 
@@ -105,7 +105,7 @@ rasops15_init(struct rasops_info *ri)
  * Paint a single character.
  */
 int
-rasops15_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops15_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  int fb, width, height, cnt, clr[2];
  struct rasops_info *ri;
@@ -177,7 +177,7 @@ rasops15_putchar(void *cookie, int row, int col, u_int uc, long attr)
  * Recompute the (2x2)x1 blitting stamp.
  */
 void
-rasops15_makestamp(struct rasops_info *ri, long attr)
+rasops15_makestamp(struct rasops_info *ri, uint32_t attr)
 {
  int32_t fg, bg;
  int i;
@@ -205,7 +205,7 @@ rasops15_makestamp(struct rasops_info *ri, long attr)
  * Paint a single character. This is for 8-pixel wide fonts.
  */
 int
-rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
+rasops15_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, so, fs;
@@ -281,7 +281,7 @@ rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
  * Paint a single character. This is for 12-pixel wide fonts.
  */
 int
-rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
+rasops15_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, so, fs;
@@ -361,7 +361,7 @@ rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
  * Paint a single character. This is for 16-pixel wide fonts.
  */
 int
-rasops15_putchar16(void *cookie, int row, int col, u_int uc, long attr)
+rasops15_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, so, fs;
diff --git sys/dev/rasops/rasops24.c sys/dev/rasops/rasops24.c
index 086b5af329e..28144a152fb 100644
--- sys/dev/rasops/rasops24.c
+++ sys/dev/rasops/rasops24.c
@@ -39,18 +39,18 @@
 #include <dev/wscons/wsconsio.h>
 #include <dev/rasops/rasops.h>
 
-int rasops24_putchar(void *, int, int, u_int, long attr);
+int rasops24_putchar(void *, int, int, u_int, uint32_t attr);
 #ifndef RASOPS_SMALL
-int rasops24_putchar8(void *, int, int, u_int, long attr);
-int rasops24_putchar12(void *, int, int, u_int, long attr);
-int rasops24_putchar16(void *, int, int, u_int, long attr);
-void rasops24_makestamp(struct rasops_info *, long);
+int rasops24_putchar8(void *, int, int, u_int, uint32_t attr);
+int rasops24_putchar12(void *, int, int, u_int, uint32_t attr);
+int rasops24_putchar16(void *, int, int, u_int, uint32_t attr);
+void rasops24_makestamp(struct rasops_info *, uint32_t);
 
 /*
  * 4x1 stamp for optimized character blitting
  */
 static int32_t stamp[64];
-static long stamp_attr;
+static uint32_t stamp_attr;
 static int stamp_mutex; /* XXX see note in readme */
 #endif
 
@@ -106,7 +106,7 @@ rasops24_init(struct rasops_info *ri)
  * XXX this bites - we should use masks.
  */
 int
-rasops24_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops24_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  int fb, width, height, cnt, clr[2];
  struct rasops_info *ri;
@@ -185,7 +185,7 @@ rasops24_putchar(void *cookie, int row, int col, u_int uc, long attr)
  * Recompute the blitting stamp.
  */
 void
-rasops24_makestamp(struct rasops_info *ri, long attr)
+rasops24_makestamp(struct rasops_info *ri, uint32_t attr)
 {
  u_int fg, bg, c1, c2, c3, c4;
  int i;
@@ -226,7 +226,7 @@ rasops24_makestamp(struct rasops_info *ri, long attr)
  * Put a single character. This is for 8-pixel wide fonts.
  */
 int
-rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
+rasops24_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, so, fs;
@@ -304,7 +304,7 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
  * Put a single character. This is for 12-pixel wide fonts.
  */
 int
-rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
+rasops24_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, so, fs;
@@ -389,7 +389,7 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
  * Put a single character. This is for 16-pixel wide fonts.
  */
 int
-rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr)
+rasops24_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, so, fs;
diff --git sys/dev/rasops/rasops32.c sys/dev/rasops/rasops32.c
index e02436da554..b0adbbae616 100644
--- sys/dev/rasops/rasops32.c
+++ sys/dev/rasops/rasops32.c
@@ -38,7 +38,7 @@
 #include <dev/wscons/wsconsio.h>
 #include <dev/rasops/rasops.h>
 
-int rasops32_putchar(void *, int, int, u_int, long);
+int rasops32_putchar(void *, int, int, u_int, uint32_t);
 
 /*
  * Initialize a 'rasops_info' descriptor for this depth.
@@ -63,7 +63,7 @@ rasops32_init(struct rasops_info *ri)
  * Paint a single character.
  */
 int
-rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops32_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  int width, height, cnt, fs, fb, clr[2];
  struct rasops_info *ri;
diff --git sys/dev/rasops/rasops4.c sys/dev/rasops/rasops4.c
index a510ebd0345..a61edab39e7 100644
--- sys/dev/rasops/rasops4.c
+++ sys/dev/rasops/rasops4.c
@@ -41,20 +41,20 @@
 #include <dev/rasops/rasops_masks.h>
 
 int rasops4_copycols(void *, int, int, int, int);
-int rasops4_erasecols(void *, int, int, int, long);
+int rasops4_erasecols(void *, int, int, int, uint32_t);
 int rasops4_do_cursor(struct rasops_info *);
-int rasops4_putchar(void *, int, int col, u_int, long);
+int rasops4_putchar(void *, int, int col, u_int, uint32_t);
 #ifndef RASOPS_SMALL
-int rasops4_putchar8(void *, int, int col, u_int, long);
-int rasops4_putchar12(void *, int, int col, u_int, long);
-int rasops4_putchar16(void *, int, int col, u_int, long);
-void rasops4_makestamp(struct rasops_info *, long);
+int rasops4_putchar8(void *, int, int col, u_int, uint32_t);
+int rasops4_putchar12(void *, int, int col, u_int, uint32_t);
+int rasops4_putchar16(void *, int, int col, u_int, uint32_t);
+void rasops4_makestamp(struct rasops_info *, uint32_t);
 
 /*
  * 4x1 stamp for optimized character blitting
  */
 static u_int16_t stamp[16];
-static long stamp_attr;
+static uint32_t stamp_attr;
 static int stamp_mutex; /* XXX see note in README */
 #endif
 
@@ -96,7 +96,7 @@ rasops4_init(struct rasops_info *ri)
  * Paint a single character. This is the generic version, this is ugly.
  */
 int
-rasops4_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops4_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  int height, width, fs, rs, fb, bg, fg, lmask, rmask;
  struct rasops_info *ri;
@@ -209,7 +209,7 @@ rasops4_putchar(void *cookie, int row, int col, u_int uc, long attr)
  * Put a single character. This is the generic version.
  */
 int
-rasops4_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops4_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
 
  /* XXX punt */
@@ -221,7 +221,7 @@ rasops4_putchar(void *cookie, int row, int col, u_int uc, long attr)
  * Recompute the blitting stamp.
  */
 void
-rasops4_makestamp(struct rasops_info *ri, long attr)
+rasops4_makestamp(struct rasops_info *ri, uint32_t attr)
 {
  int i, fg, bg;
 
@@ -248,7 +248,7 @@ rasops4_makestamp(struct rasops_info *ri, long attr)
  * Put a single character. This is for 8-pixel wide fonts.
  */
 int
-rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
+rasops4_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, fs, rs;
@@ -320,7 +320,7 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
  * Put a single character. This is for 12-pixel wide fonts.
  */
 int
-rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
+rasops4_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, fs, rs;
@@ -395,7 +395,7 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
  * Put a single character. This is for 16-pixel wide fonts.
  */
 int
-rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
+rasops4_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, fs, rs;
diff --git sys/dev/rasops/rasops8.c sys/dev/rasops/rasops8.c
index c7905ccc68d..d09a891c0b0 100644
--- sys/dev/rasops/rasops8.c
+++ sys/dev/rasops/rasops8.c
@@ -38,18 +38,18 @@
 #include <dev/wscons/wsconsio.h>
 #include <dev/rasops/rasops.h>
 
-int rasops8_putchar(void *, int, int, u_int, long attr);
+int rasops8_putchar(void *, int, int, u_int, uint32_t attr);
 #ifndef RASOPS_SMALL
-int rasops8_putchar8(void *, int, int, u_int, long attr);
-int rasops8_putchar12(void *, int, int, u_int, long attr);
-int rasops8_putchar16(void *, int, int, u_int, long attr);
-void rasops8_makestamp(struct rasops_info *ri, long);
+int rasops8_putchar8(void *, int, int, u_int, uint32_t attr);
+int rasops8_putchar12(void *, int, int, u_int, uint32_t attr);
+int rasops8_putchar16(void *, int, int, u_int, uint32_t attr);
+void rasops8_makestamp(struct rasops_info *ri, uint32_t);
 
 /*
  * 4x1 stamp for optimized character blitting
  */
 static int32_t stamp[16];
-static long stamp_attr;
+static uint32_t stamp_attr;
 static int stamp_mutex; /* XXX see note in README */
 #endif
 
@@ -93,7 +93,7 @@ rasops8_init(struct rasops_info *ri)
  * Put a single character.
  */
 int
-rasops8_putchar(void *cookie, int row, int col, u_int uc, long attr)
+rasops8_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  int width, height, cnt, fs, fb;
  u_char *dp, *rp, *fr, clr[2];
@@ -162,7 +162,7 @@ rasops8_putchar(void *cookie, int row, int col, u_int uc, long attr)
  * Recompute the 4x1 blitting stamp.
  */
 void
-rasops8_makestamp(struct rasops_info *ri, long attr)
+rasops8_makestamp(struct rasops_info *ri, uint32_t attr)
 {
  int32_t fg, bg;
  int i;
@@ -194,7 +194,7 @@ rasops8_makestamp(struct rasops_info *ri, long attr)
  * Put a single character. This is for 8-pixel wide fonts.
  */
 int
-rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
+rasops8_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, fs;
@@ -262,7 +262,7 @@ rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
  * Put a single character. This is for 12-pixel wide fonts.
  */
 int
-rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
+rasops8_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, fs;
@@ -333,7 +333,7 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
  * Put a single character. This is for 16-pixel wide fonts.
  */
 int
-rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
+rasops8_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  int height, fs;
diff --git sys/dev/rasops/rasops_bitops.h sys/dev/rasops/rasops_bitops.h
index f8194b98961..e4180232a3c 100644
--- sys/dev/rasops/rasops_bitops.h
+++ sys/dev/rasops/rasops_bitops.h
@@ -37,7 +37,7 @@
  * Erase columns.
  */
 int
-NAME(erasecols)(void *cookie, int row, int col, int num, long attr)
+NAME(erasecols)(void *cookie, int row, int col, int num, uint32_t attr)
 {
  int lmask, rmask, lclr, rclr, clr;
  struct rasops_info *ri;
diff --git sys/dev/sbus/cgsix.c sys/dev/sbus/cgsix.c
index bb5db224d79..d8828357810 100644
--- sys/dev/sbus/cgsix.c
+++ sys/dev/sbus/cgsix.c
@@ -67,8 +67,8 @@ int cgsix_intr(void *);
 void cgsix_ras_init(struct cgsix_softc *);
 int cgsix_ras_copyrows(void *, int, int, int);
 int cgsix_ras_copycols(void *, int, int, int, int);
-int cgsix_ras_erasecols(void *, int, int, int, long int);
-int cgsix_ras_eraserows(void *, int, int, long int);
+int cgsix_ras_erasecols(void *, int, int, int, uint32_t);
+int cgsix_ras_eraserows(void *, int, int, uint32_t);
 int cgsix_ras_do_cursor(struct rasops_info *);
 int cgsix_setcursor(struct cgsix_softc *, struct wsdisplay_cursor *);
 int cgsix_updatecursor(struct cgsix_softc *, u_int);
@@ -892,7 +892,7 @@ cgsix_ras_copycols(void *cookie, int row, int src, int dst, int n)
 }
 
 int
-cgsix_ras_erasecols(void *cookie, int row, int col, int n, long int attr)
+cgsix_ras_erasecols(void *cookie, int row, int col, int n, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct cgsix_softc *sc = ri->ri_hw;
@@ -936,7 +936,7 @@ cgsix_ras_erasecols(void *cookie, int row, int col, int n, long int attr)
 }
 
 int
-cgsix_ras_eraserows(void *cookie, int row, int n, long int attr)
+cgsix_ras_eraserows(void *cookie, int row, int n, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct cgsix_softc *sc = ri->ri_hw;
diff --git sys/dev/sbus/mgx.c sys/dev/sbus/mgx.c
index 5ddecb7775a..9d299748173 100644
--- sys/dev/sbus/mgx.c
+++ sys/dev/sbus/mgx.c
@@ -146,8 +146,8 @@ void mgx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
 int mgx_ras_copycols(void *, int, int, int, int);
 int mgx_ras_copyrows(void *, int, int, int);
 int mgx_ras_do_cursor(struct rasops_info *);
-int mgx_ras_erasecols(void *, int, int, int, long int);
-int mgx_ras_eraserows(void *, int, int, long int);
+int mgx_ras_erasecols(void *, int, int, int, uint32_t);
+int mgx_ras_eraserows(void *, int, int, uint32_t);
 void mgx_ras_init(struct mgx_softc *, uint);
 
 uint8_t mgx_read_1(vaddr_t, uint);
@@ -705,7 +705,7 @@ mgx_ras_copyrows(void *v, int src, int dst, int n)
 }
 
 int
-mgx_ras_erasecols(void *v, int row, int col, int n, long int attr)
+mgx_ras_erasecols(void *v, int row, int col, int n, uint32_t attr)
 {
  struct rasops_info *ri = v;
  struct mgx_softc *sc = ri->ri_hw;
@@ -735,7 +735,7 @@ mgx_ras_erasecols(void *v, int row, int col, int n, long int attr)
 }
 
 int
-mgx_ras_eraserows(void *v, int row, int n, long int attr)
+mgx_ras_eraserows(void *v, int row, int n, uint32_t attr)
 {
  struct rasops_info *ri = v;
  struct mgx_softc *sc = ri->ri_hw;
diff --git sys/dev/sbus/zx.c sys/dev/sbus/zx.c
index 629fa74c866..e3cb0c5a2bc 100644
--- sys/dev/sbus/zx.c
+++ sys/dev/sbus/zx.c
@@ -150,15 +150,15 @@ int zx_putcmap(struct zx_softc *);
 void zx_copyrect(struct rasops_info *, int, int, int, int, int, int);
 int zx_cross_loadwid(struct zx_softc *, u_int, u_int, u_int);
 int zx_cross_wait(struct zx_softc *);
-void zx_fillrect(struct rasops_info *, int, int, int, int, long, int);
+void zx_fillrect(struct rasops_info *, int, int, int, int, uint32_t, int);
 int zx_intr(void *);
 void zx_prom(void *);
 
-int zx_putchar(void *, int, int, u_int, long);
+int zx_putchar(void *, int, int, u_int, uint32_t);
 int zx_copycols(void *, int, int, int, int);
-int zx_erasecols(void *, int, int, int, long);
+int zx_erasecols(void *, int, int, int, uint32_t);
 int zx_copyrows(void *, int, int, int);
-int zx_eraserows(void *, int, int, long);
+int zx_eraserows(void *, int, int, uint32_t);
 int zx_do_cursor(struct rasops_info *);
 
 struct cfattach zx_ca = {
@@ -564,7 +564,7 @@ zx_burner(void *v, u_int on, u_int flags)
 }
 
 void
-zx_fillrect(struct rasops_info *ri, int x, int y, int w, int h, long attr,
+zx_fillrect(struct rasops_info *ri, int x, int y, int w, int h, uint32_t attr,
     int rop)
 {
  struct zx_softc *sc;
@@ -641,7 +641,7 @@ zx_do_cursor(struct rasops_info *ri)
 }
 
 int
-zx_erasecols(void *cookie, int row, int col, int num, long attr)
+zx_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri;
 
@@ -653,7 +653,7 @@ zx_erasecols(void *cookie, int row, int col, int num, long attr)
 }
 
 int
-zx_eraserows(void *cookie, int row, int num, long attr)
+zx_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri;
  struct zx_softc *sc;
@@ -709,7 +709,7 @@ zx_copycols(void *cookie, int row, int src, int dst, int num)
 }
 
 int
-zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
+zx_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri;
  struct zx_softc *sc;
diff --git sys/dev/usb/udl.c sys/dev/usb/udl.c
index 95af7210b7b..022561ee094 100644
--- sys/dev/usb/udl.c
+++ sys/dev/usb/udl.c
@@ -79,7 +79,7 @@ int udl_activate(struct device *, int);
 int udl_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t udl_mmap(void *, off_t, int);
 int udl_alloc_screen(void *, const struct wsscreen_descr *,
-    void **, int *, int *, long *);
+    void **, int *, int *, uint32_t *);
 void udl_free_screen(void *, void *);
 int udl_show_screen(void *, void *, int,
     void (*)(void *, int, int), void *);
@@ -89,9 +89,9 @@ void udl_burner(void *, u_int, u_int);
 
 int udl_copycols(void *, int, int, int, int);
 int udl_copyrows(void *, int, int, int);
-int udl_erasecols(void *, int, int, int, long);
-int udl_eraserows(void *, int, int, long);
-int udl_putchar(void *, int, int, u_int, long);
+int udl_erasecols(void *, int, int, int, uint32_t);
+int udl_eraserows(void *, int, int, uint32_t);
+int udl_putchar(void *, int, int, u_int, uint32_t);
 int udl_do_cursor(struct rasops_info *);
 int udl_draw_char(struct udl_softc *, uint16_t, uint16_t, u_int,
     uint32_t, uint32_t);
@@ -587,7 +587,7 @@ udl_mmap(void *v, off_t off, int prot)
 
 int
 udl_alloc_screen(void *v, const struct wsscreen_descr *type,
-    void **cookiep, int *curxp, int *curyp, long *attrp)
+    void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
 {
  struct udl_softc *sc = v;
  struct wsdisplay_font *font;
@@ -825,7 +825,7 @@ fail:
 }
 
 int
-udl_erasecols(void *cookie, int row, int col, int num, long attr)
+udl_erasecols(void *cookie, int row, int col, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct udl_softc *sc = ri->ri_hw;
@@ -868,7 +868,7 @@ fail:
 }
 
 int
-udl_eraserows(void *cookie, int row, int num, long attr)
+udl_eraserows(void *cookie, int row, int num, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct udl_softc *sc;
@@ -910,7 +910,7 @@ fail:
 }
 
 int
-udl_putchar(void *cookie, int row, int col, u_int uc, long attr)
+udl_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr)
 {
  struct rasops_info *ri = cookie;
  struct udl_softc *sc = ri->ri_hw;
diff --git sys/dev/wscons/wsdisplay.c sys/dev/wscons/wsdisplay.c
index 983d4c967fa..60889963dc2 100644
--- sys/dev/wscons/wsdisplay.c
+++ sys/dev/wscons/wsdisplay.c
@@ -133,7 +133,7 @@ struct wsscreen {
 };
 
 struct wsscreen *wsscreen_attach(struct wsdisplay_softc *, int, const char *,
-    const struct wsscreen_descr *, void *, int, int, long);
+    const struct wsscreen_descr *, void *, int, int, uint32_t);
 void wsscreen_detach(struct wsscreen *);
 int wsdisplay_addscreen(struct wsdisplay_softc *, int, const char *,
     const char *);
@@ -267,7 +267,7 @@ int wsdisplay_clearonclose;
 struct wsscreen *
 wsscreen_attach(struct wsdisplay_softc *sc, int console, const char *emul,
     const struct wsscreen_descr *type, void *cookie, int ccol, int crow,
-    long defattr)
+    uint32_t defattr)
 {
  struct wsscreen_internal *dconf;
  struct wsscreen *scr;
@@ -368,7 +368,7 @@ wsdisplay_addscreen(struct wsdisplay_softc *sc, int idx,
  int error;
  void *cookie;
  int ccol, crow;
- long defattr;
+ uint32_t defattr;
  struct wsscreen *scr;
  int s;
 
@@ -803,7 +803,7 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
 
 void
 wsdisplay_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
-    int crow, long defattr)
+    int crow, uint32_t defattr)
 {
  const struct wsemul_ops *wsemul;
  const struct wsdisplay_emulops *emulops;
@@ -2671,7 +2671,7 @@ inverse_char(struct wsscreen *scr, u_int pos)
  int fg, bg, ul;
  int flags;
  int tmp;
- long attr;
+ uint32_t attr;
 
  GETCHAR(scr, pos, &cell);
 
diff --git sys/dev/wscons/wsdisplayvar.h sys/dev/wscons/wsdisplayvar.h
index 9465f7af345..af8ae0cec76 100644
--- sys/dev/wscons/wsdisplayvar.h
+++ sys/dev/wscons/wsdisplayvar.h
@@ -73,14 +73,17 @@ struct device;
 struct wsdisplay_emulops {
  int (*cursor)(void *c, int on, int row, int col);
  int (*mapchar)(void *, int, unsigned int *);
- int (*putchar)(void *c, int row, int col, u_int uc, long attr);
+ int (*putchar)(void *c, int row, int col, u_int uc, uint32_t attr);
  int (*copycols)(void *c, int row, int srccol, int dstcol,
     int ncols);
- int (*erasecols)(void *c, int row, int startcol, int ncols, long);
+ int (*erasecols)(void *c, int row, int startcol, int ncols,
+    uint32_t);
  int (*copyrows)(void *c, int srcrow, int dstrow, int nrows);
- int (*eraserows)(void *c, int row, int nrows, long attr);
- int (*pack_attr)(void *c, int fg, int bg, int flags, long *attrp);
- void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
+ int (*eraserows)(void *c, int row, int nrows, uint32_t attr);
+ int (*pack_attr)(void *c, int fg, int bg, int flags,
+    uint32_t *attrp);
+ void (*unpack_attr)(void *c, uint32_t attr, int *fg, int *bg,
+    int *ul);
 /* fg / bg values. Made identical to ANSI terminal color codes. */
 #define WSCOL_BLACK 0
 #define WSCOL_RED 1
@@ -117,8 +120,8 @@ struct wsscreen_descr {
  * Character cell description (for emulation mode).
  */
 struct wsdisplay_charcell {
- u_int uc;
- long attr;
+ u_int uc;
+ uint32_t attr;
 };
 
 struct wsdisplay_font;
@@ -134,7 +137,7 @@ struct wsdisplay_accessops {
     struct proc *p);
  paddr_t (*mmap)(void *v, off_t off, int prot);
  int (*alloc_screen)(void *, const struct wsscreen_descr *,
-     void **, int *, int *, long *);
+     void **, int *, int *, uint32_t *);
  void (*free_screen)(void *, void *);
  int (*show_screen)(void *, void *, int,
        void (*) (void *, int, int), void *);
@@ -188,7 +191,7 @@ struct wscons_syncops {
  * Autoconfiguration helper functions.
  */
 void wsdisplay_cnattach(const struct wsscreen_descr *, void *,
- int, int, long);
+ int, int, uint32_t);
 int wsemuldisplaydevprint(void *, const char *);
 int wsemuldisplaydevsubmatch(struct device *, void *, void *);
 
diff --git sys/dev/wscons/wsemul_dumb.c sys/dev/wscons/wsemul_dumb.c
index 32224025b84..23b06458d01 100644
--- sys/dev/wscons/wsemul_dumb.c
+++ sys/dev/wscons/wsemul_dumb.c
@@ -43,9 +43,9 @@
 #include <dev/wscons/ascii.h>
 
 void *wsemul_dumb_cnattach(const struct wsscreen_descr *, void *,
-   int, int, long);
+   int, int, uint32_t);
 void *wsemul_dumb_attach(int, const struct wsscreen_descr *,
- void *, int, int, void *, long);
+ void *, int, int, void *, uint32_t);
 u_int wsemul_dumb_output(void *, const u_char *, u_int, int);
 int wsemul_dumb_translate(void *, kbd_t, keysym_t, const u_char **);
 void wsemul_dumb_detach(void *, u_int *, u_int *);
@@ -68,14 +68,14 @@ struct wsemul_dumb_emuldata {
  void *cbcookie;
  int crippled;
  u_int nrows, ncols, crow, ccol;
- long defattr;
+ uint32_t defattr;
 };
 
 struct wsemul_dumb_emuldata wsemul_dumb_console_emuldata;
 
 void *
 wsemul_dumb_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
-    int crow, long defattr)
+    int crow, uint32_t defattr)
 {
  struct wsemul_dumb_emuldata *edp;
  const struct wsdisplay_emulops *emulops;
@@ -100,7 +100,7 @@ wsemul_dumb_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
 
 void *
 wsemul_dumb_attach(int console, const struct wsscreen_descr *type, void *cookie,
-    int ccol, int crow, void *cbcookie, long defattr)
+    int ccol, int crow, void *cbcookie, uint32_t defattr)
 {
  struct wsemul_dumb_emuldata *edp;
 
diff --git sys/dev/wscons/wsemul_sun.c sys/dev/wscons/wsemul_sun.c
index d511a8dac24..8fab89bc221 100644
--- sys/dev/wscons/wsemul_sun.c
+++ sys/dev/wscons/wsemul_sun.c
@@ -68,9 +68,9 @@
 #include <dev/wscons/ascii.h>
 
 void *wsemul_sun_cnattach(const struct wsscreen_descr *, void *,
-    int, int, long);
+    int, int, uint32_t);
 void *wsemul_sun_attach(int, const struct wsscreen_descr *,
-    void *, int, int, void *, long);
+    void *, int, int, void *, uint32_t);
 u_int wsemul_sun_output(void *, const u_char *, u_int, int);
 int wsemul_sun_translate(void *, kbd_t, keysym_t, const u_char **);
 void wsemul_sun_detach(void *, u_int *, u_int *);
@@ -102,7 +102,7 @@ struct wsemul_sun_emuldata {
  void *cbcookie;
  int scrcapabilities;
  u_int nrows, ncols, crow, ccol;
- long defattr; /* default attribute (rendition) */
+ uint32_t defattr; /* default attribute (rendition) */
 
  u_int state; /* processing state */
  u_int flags;
@@ -110,8 +110,8 @@ struct wsemul_sun_emuldata {
  int nargs; /* number of args */
 
  u_int scrolldist; /* distance to scroll */
- long curattr, bkgdattr; /* currently used attribute */
- long kernattr; /* attribute for kernel output */
+ uint32_t curattr, bkgdattr; /* currently used attribute */
+ uint32_t kernattr; /* attribute for kernel output */
  int attrflags, fgcol, bgcol; /* properties of curattr */
 
  struct wsemul_inputstate instate; /* userland input state */
@@ -129,7 +129,7 @@ struct wsemul_sun_emuldata {
 };
 
 void wsemul_sun_init(struct wsemul_sun_emuldata *,
-    const struct wsscreen_descr *, void *, int, int, long);
+    const struct wsscreen_descr *, void *, int, int, uint32_t);
 int wsemul_sun_jump_scroll(struct wsemul_sun_emuldata *, const u_char *,
     u_int, int);
 void wsemul_sun_reset(struct wsemul_sun_emuldata *);
@@ -146,7 +146,7 @@ int wsemul_sun_output_percent(struct wsemul_sun_emuldata *,
 int wsemul_sun_control(struct wsemul_sun_emuldata *,
     struct wsemul_inputstate *);
 int wsemul_sun_selectattribute(struct wsemul_sun_emuldata *, int, int, int,
-    long *, long *);
+    uint32_t *, uint32_t *);
 int wsemul_sun_scrollup(struct wsemul_sun_emuldata *, u_int);
 
 struct wsemul_sun_emuldata wsemul_sun_console_emuldata;
@@ -161,7 +161,7 @@ struct wsemul_sun_emuldata wsemul_sun_console_emuldata;
 void
 wsemul_sun_init(struct wsemul_sun_emuldata *edp,
     const struct wsscreen_descr *type, void *cookie, int ccol, int crow,
-    long defattr)
+    uint32_t defattr)
 {
  edp->emulops = type->textops;
  edp->emulcookie = cookie;
@@ -192,7 +192,7 @@ wsemul_sun_reset(struct wsemul_sun_emuldata *edp)
 
 void *
 wsemul_sun_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
-    int crow, long defattr)
+    int crow, uint32_t defattr)
 {
  struct wsemul_sun_emuldata *edp;
  int res;
@@ -236,7 +236,7 @@ wsemul_sun_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
 
 void *
 wsemul_sun_attach(int console, const struct wsscreen_descr *type, void *cookie,
-    int ccol, int crow, void *cbcookie, long defattr)
+    int ccol, int crow, void *cbcookie, uint32_t defattr)
 {
  struct wsemul_sun_emuldata *edp;
 
@@ -402,7 +402,7 @@ wsemul_sun_control(struct wsemul_sun_emuldata *edp,
 {
  u_int n, src, dst;
  int flags, fgcol, bgcol;
- long attr, bkgdattr;
+ uint32_t attr, bkgdattr;
  int rc = 0;
 
  switch (instate->inchar) {
@@ -884,7 +884,7 @@ wsemul_sun_jump_scroll(struct wsemul_sun_emuldata *edp, const u_char *data,
  */
 int
 wsemul_sun_selectattribute(struct wsemul_sun_emuldata *edp, int flags,
-    int fgcol, int bgcol, long *attr, long *bkgdattr)
+    int fgcol, int bgcol, uint32_t *attr, uint32_t *bkgdattr)
 {
  int error;
 
diff --git sys/dev/wscons/wsemul_vt100.c sys/dev/wscons/wsemul_vt100.c
index b07b2ec2e75..3a86c90c302 100644
--- sys/dev/wscons/wsemul_vt100.c
+++ sys/dev/wscons/wsemul_vt100.c
@@ -57,9 +57,9 @@
 #include <dev/wscons/ascii.h>
 
 void *wsemul_vt100_cnattach(const struct wsscreen_descr *, void *,
-  int, int, long);
+  int, int, uint32_t);
 void *wsemul_vt100_attach(int, const struct wsscreen_descr *,
-  void *, int, int, void *, long);
+  void *, int, int, void *, uint32_t);
 u_int wsemul_vt100_output(void *, const u_char *, u_int, int);
 void wsemul_vt100_detach(void *, u_int *, u_int *);
 void wsemul_vt100_resetop(void *, enum wsemul_resetops);
@@ -77,7 +77,7 @@ const struct wsemul_ops wsemul_vt100_ops = {
 struct wsemul_vt100_emuldata wsemul_vt100_console_emuldata;
 
 void wsemul_vt100_init(struct wsemul_vt100_emuldata *,
-    const struct wsscreen_descr *, void *, int, int, long);
+    const struct wsscreen_descr *, void *, int, int, uint32_t);
 int wsemul_vt100_jump_scroll(struct wsemul_vt100_emuldata *,
     const u_char *, u_int, int);
 int wsemul_vt100_output_normal(struct wsemul_vt100_emuldata *,
@@ -137,7 +137,7 @@ vt100_handler *vt100_output[] = {
 void
 wsemul_vt100_init(struct wsemul_vt100_emuldata *edp,
     const struct wsscreen_descr *type, void *cookie, int ccol, int crow,
-    long defattr)
+    uint32_t defattr)
 {
  edp->emulops = type->textops;
  edp->emulcookie = cookie;
@@ -152,7 +152,7 @@ wsemul_vt100_init(struct wsemul_vt100_emuldata *edp,
 
 void *
 wsemul_vt100_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
-    int crow, long defattr)
+    int crow, uint32_t defattr)
 {
  struct wsemul_vt100_emuldata *edp;
  int res;
@@ -198,7 +198,7 @@ wsemul_vt100_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
 
 void *
 wsemul_vt100_attach(int console, const struct wsscreen_descr *type,
-    void *cookie, int ccol, int crow, void *cbcookie, long defattr)
+    void *cookie, int ccol, int crow, void *cbcookie, uint32_t defattr)
 {
  struct wsemul_vt100_emuldata *edp;
 
diff --git sys/dev/wscons/wsemul_vt100_subr.c sys/dev/wscons/wsemul_vt100_subr.c
index 97208d64645..394ac6f8e99 100644
--- sys/dev/wscons/wsemul_vt100_subr.c
+++ sys/dev/wscons/wsemul_vt100_subr.c
@@ -37,7 +37,7 @@
 #include <dev/wscons/wsemul_vt100var.h>
 
 int vt100_selectattribute(struct wsemul_vt100_emuldata *, int, int, int,
-    long *, long *);
+    uint32_t *, uint32_t *);
 int vt100_ansimode(struct wsemul_vt100_emuldata *, int, int);
 int vt100_decmode(struct wsemul_vt100_emuldata *, int, int);
 #define VTMODE_SET 33
@@ -218,7 +218,7 @@ wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *edp,
     struct wsemul_inputstate *instate)
 {
  int n, help, flags, fgcol, bgcol;
- long attr, bkgdattr;
+ uint32_t attr, bkgdattr;
  u_char c;
  int rc = 0;
 
@@ -701,7 +701,7 @@ wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *edp,
  */
 int
 vt100_selectattribute(struct wsemul_vt100_emuldata *edp, int flags, int fgcol,
-    int bgcol, long *attr, long *bkgdattr)
+    int bgcol, uint32_t *attr, uint32_t *bkgdattr)
 {
  int error;
 
diff --git sys/dev/wscons/wsemul_vt100var.h sys/dev/wscons/wsemul_vt100var.h
index 460913387c5..cc65342cdf2 100644
--- sys/dev/wscons/wsemul_vt100var.h
+++ sys/dev/wscons/wsemul_vt100var.h
@@ -35,9 +35,9 @@ struct wsemul_vt100_emuldata {
  void *emulcookie;
  int scrcapabilities;
  u_int nrows, ncols, crow, ccol;
- long defattr; /* default attribute */
+ uint32_t defattr; /* default attribute */
 
- long kernattr; /* attribute for kernel output */
+ uint32_t kernattr; /* attribute for kernel output */
  void *cbcookie;
 #ifdef DIAGNOSTIC
  int console;
@@ -55,7 +55,7 @@ struct wsemul_vt100_emuldata {
 #define VTFL_NATCHARSET 0x080 /* national replacement charset mode */
 #define VTFL_SAVEDCURS 0x100 /* we have a saved cursor state */
 #define VTFL_UTF8 0x200 /* utf-8 character set */
- long curattr, bkgdattr; /* currently used attribute */
+ uint32_t curattr, bkgdattr; /* currently used attribute */
  int attrflags, fgcol, bgcol; /* properties of curattr */
  u_int scrreg_startrow;
  u_int scrreg_nrows;
@@ -84,7 +84,7 @@ struct wsemul_vt100_emuldata {
 #define DCSTYPE_TABRESTORE 1 /* DCS2$t */
 
  u_int savedcursor_row, savedcursor_col;
- long savedattr, savedbkgdattr;
+ uint32_t savedattr, savedbkgdattr;
  int savedattrflags, savedfgcol, savedbgcol;
  int savedchartab0, savedchartab1;
  u_int *savedchartab_G[4];
diff --git sys/dev/wscons/wsemulvar.h sys/dev/wscons/wsemulvar.h
index 3d10583ebca..a576fac1bdc 100644
--- sys/dev/wscons/wsemulvar.h
+++ sys/dev/wscons/wsemulvar.h
@@ -64,9 +64,9 @@ struct wsemul_ops {
  char name[WSEMUL_NAME_SIZE];
 
  void *(*cnattach)(const struct wsscreen_descr *, void *,
-  int, int, long);
+  int, int, uint32_t);
  void *(*attach)(int, const struct wsscreen_descr *, void *,
- int, int, void *, long);
+ int, int, void *, uint32_t);
  u_int (*output)(void *, const u_char *, u_int, int);
  int (*translate)(void *, kbd_t, keysym_t, const u_char **);
  void (*detach)(void *, u_int *, u_int *);