diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-08-28 12:48:15 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-08-28 12:48:15 +0000 |
commit | f7cf4d10949f12edbb81d9835b916e5b64a064a4 (patch) | |
tree | 6e8add779a9b52ef82d5b39264f95b539f1a29f0 /sys/dev/ic | |
parent | e141fb7001e71fe81f6968549e363c111add17b2 (diff) |
ansify function definitions, and constify a few arrays while there.
no functional change.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/com.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/pcdisplay_chars.c | 13 | ||||
-rw-r--r-- | sys/dev/ic/pcdisplay_subr.c | 46 | ||||
-rw-r--r-- | sys/dev/ic/pcdisplayvar.h | 16 | ||||
-rw-r--r-- | sys/dev/ic/pckbc.c | 146 | ||||
-rw-r--r-- | sys/dev/ic/vga.c | 143 | ||||
-rw-r--r-- | sys/dev/ic/vga_subr.c | 27 | ||||
-rw-r--r-- | sys/dev/ic/vgavar.h | 35 |
8 files changed, 119 insertions, 315 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 5024189d2e7..e8f51ee8dc8 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.144 2010/08/07 15:50:23 kettenis Exp $ */ +/* $OpenBSD: com.c,v 1.145 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -1553,8 +1553,7 @@ void com_fifo_probe(struct com_softc *); #if defined(COM_CONSOLE) || defined(KGDB) void -com_enable_debugport(sc) - struct com_softc *sc; +com_enable_debugport(struct com_softc *sc) { int s; @@ -1576,8 +1575,7 @@ com_enable_debugport(sc) #endif /* COM_CONSOLE || KGDB */ void -com_attach_subr(sc) - struct com_softc *sc; +com_attach_subr(struct com_softc *sc) { bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; diff --git a/sys/dev/ic/pcdisplay_chars.c b/sys/dev/ic/pcdisplay_chars.c index 153b2a83b5a..2e0c19c4cc4 100644 --- a/sys/dev/ic/pcdisplay_chars.c +++ b/sys/dev/ic/pcdisplay_chars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcdisplay_chars.c,v 1.4 2004/04/02 04:39:50 deraadt Exp $ */ +/* $OpenBSD: pcdisplay_chars.c,v 1.5 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: pcdisplay_chars.c,v 1.5 2000/06/08 07:01:19 cgd Exp $ */ /* @@ -40,7 +40,7 @@ #define CONTROL 1 /* XXX smiley */ #define NOTPRINTABLE 4 /* diamond XXX watch out - not in ISO part! */ -static u_char isomappings[128] = { +static const u_char isomappings[128] = { CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, CONTROL, @@ -143,7 +143,7 @@ static u_char isomappings[128] = { 0x98, /* 0x00ff LATIN SMALL LETTER Y WITH DIAERESIS */ }; -static struct { +static const struct { u_int16_t uni; u_char ibm; } unimappings[] = { @@ -257,7 +257,7 @@ static struct { {0x266b, 0x0e}, /* BEAMED EIGHTH NOTES */ }; -static struct { +static const struct { u_int16_t uni; u_char ibm; int quality; @@ -326,10 +326,7 @@ static struct { }; int -pcdisplay_mapchar(id, uni, index) - void *id; - int uni; - unsigned int *index; +pcdisplay_mapchar(void *id, int uni, unsigned int *index) { u_int i; diff --git a/sys/dev/ic/pcdisplay_subr.c b/sys/dev/ic/pcdisplay_subr.c index 4b8ad5f68cd..d743fcaac7d 100644 --- a/sys/dev/ic/pcdisplay_subr.c +++ b/sys/dev/ic/pcdisplay_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcdisplay_subr.c,v 1.8 2009/09/05 14:09:35 miod Exp $ */ +/* $OpenBSD: pcdisplay_subr.c,v 1.9 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: pcdisplay_subr.c,v 1.16 2000/06/08 07:01:19 cgd Exp $ */ /* @@ -41,8 +41,7 @@ #include <dev/wscons/wsdisplayvar.h> void -pcdisplay_cursor_reset(scr) - struct pcdisplayscreen *scr; +pcdisplay_cursor_reset(struct pcdisplayscreen *scr) { #ifdef PCDISPLAY_SOFTCURSOR pcdisplay_6845_write(scr->hdl, curstart, 0x10); @@ -51,9 +50,7 @@ pcdisplay_cursor_reset(scr) } void -pcdisplay_cursor_init(scr, existing) - struct pcdisplayscreen *scr; - int existing; +pcdisplay_cursor_init(struct pcdisplayscreen *scr, int existing) { #ifdef PCDISPLAY_SOFTCURSOR bus_space_tag_t memt; @@ -84,9 +81,7 @@ pcdisplay_cursor_init(scr, existing) } int -pcdisplay_cursor(id, on, row, col) - void *id; - int on, row, col; +pcdisplay_cursor(void *id, int on, int row, int col) { #ifdef PCDISPLAY_SOFTCURSOR struct pcdisplayscreen *scr = id; @@ -146,9 +141,7 @@ pcdisplay_cursor(id, on, row, col) #if 0 unsigned int -pcdisplay_mapchar_simple(id, uni) - void *id; - int uni; +pcdisplay_mapchar_simple(void *id, int uni) { if (uni < 128) return (uni); @@ -158,11 +151,7 @@ pcdisplay_mapchar_simple(id, uni) #endif int -pcdisplay_putchar(id, row, col, c, attr) - void *id; - int row, col; - u_int c; - long attr; +pcdisplay_putchar(void *id, int row, int col, u_int c, long attr) { struct pcdisplayscreen *scr = id; bus_space_tag_t memt = scr->hdl->ph_memt; @@ -181,10 +170,7 @@ pcdisplay_putchar(id, row, col, c, attr) } int -pcdisplay_getchar(id, row, col, cell) - void *id; - int row, col; - struct wsdisplay_charcell *cell; +pcdisplay_getchar(void *id, int row, int col, struct wsdisplay_charcell *cell) { struct pcdisplayscreen *scr = id; bus_space_tag_t memt = scr->hdl->ph_memt; @@ -208,9 +194,7 @@ pcdisplay_getchar(id, row, col, cell) } int -pcdisplay_copycols(id, row, srccol, dstcol, ncols) - void *id; - int row, srccol, dstcol, ncols; +pcdisplay_copycols(void *id, int row, int srccol, int dstcol, int ncols) { struct pcdisplayscreen *scr = id; bus_space_tag_t memt = scr->hdl->ph_memt; @@ -233,10 +217,7 @@ pcdisplay_copycols(id, row, srccol, dstcol, ncols) } int -pcdisplay_erasecols(id, row, startcol, ncols, fillattr) - void *id; - int row, startcol, ncols; - long fillattr; +pcdisplay_erasecols(void *id, int row, int startcol, int ncols, long fillattr) { struct pcdisplayscreen *scr = id; bus_space_tag_t memt = scr->hdl->ph_memt; @@ -260,9 +241,7 @@ pcdisplay_erasecols(id, row, startcol, ncols, fillattr) } int -pcdisplay_copyrows(id, srcrow, dstrow, nrows) - void *id; - int srcrow, dstrow, nrows; +pcdisplay_copyrows(void *id, int srcrow, int dstrow, int nrows) { struct pcdisplayscreen *scr = id; bus_space_tag_t memt = scr->hdl->ph_memt; @@ -286,10 +265,7 @@ pcdisplay_copyrows(id, srcrow, dstrow, nrows) } int -pcdisplay_eraserows(id, startrow, nrows, fillattr) - void *id; - int startrow, nrows; - long fillattr; +pcdisplay_eraserows(void *id, int startrow, int nrows, long fillattr) { struct pcdisplayscreen *scr = id; bus_space_tag_t memt = scr->hdl->ph_memt; diff --git a/sys/dev/ic/pcdisplayvar.h b/sys/dev/ic/pcdisplayvar.h index e888919a04b..53ef95da600 100644 --- a/sys/dev/ic/pcdisplayvar.h +++ b/sys/dev/ic/pcdisplayvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcdisplayvar.h,v 1.10 2009/09/05 14:09:35 miod Exp $ */ +/* $OpenBSD: pcdisplayvar.h,v 1.11 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: pcdisplayvar.h,v 1.8 2000/01/25 02:44:03 ad Exp $ */ /* @@ -50,23 +50,19 @@ struct pcdisplay_handle { bus_space_handle_t ph_ioh_6845, ph_memh; }; -static inline u_int8_t _pcdisplay_6845_read(struct pcdisplay_handle *, - int); +static inline u_int8_t _pcdisplay_6845_read(struct pcdisplay_handle *, int); static inline void _pcdisplay_6845_write(struct pcdisplay_handle *, int, u_int8_t); -static inline u_int8_t _pcdisplay_6845_read(ph, reg) - struct pcdisplay_handle *ph; - int reg; +static inline u_int8_t +_pcdisplay_6845_read(struct pcdisplay_handle *ph, int reg) { bus_space_write_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_INDEX, reg); return (bus_space_read_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_DATA)); } -static inline void _pcdisplay_6845_write(ph, reg, val) - struct pcdisplay_handle *ph; - int reg; - u_int8_t val; +static inline void +_pcdisplay_6845_write(struct pcdisplay_handle *ph, int reg, u_int8_t val) { bus_space_write_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_INDEX, reg); bus_space_write_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_DATA, val); diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index 7247e30fbb4..dd4a9fe6dd5 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc.c,v 1.25 2010/08/08 13:50:24 miod Exp $ */ +/* $OpenBSD: pckbc.c,v 1.26 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */ /* @@ -108,9 +108,7 @@ const char *pckbc_slot_names[] = { "kbd", "aux" }; #define KBD_DELAY DELAY(8) static inline int -pckbc_wait_output(iot, ioh_c) - bus_space_tag_t iot; - bus_space_handle_t ioh_c; +pckbc_wait_output(bus_space_tag_t iot, bus_space_handle_t ioh_c) { u_int i; @@ -123,10 +121,7 @@ pckbc_wait_output(iot, ioh_c) } int -pckbc_send_cmd(iot, ioh_c, val) - bus_space_tag_t iot; - bus_space_handle_t ioh_c; - u_char val; +pckbc_send_cmd(bus_space_tag_t iot, bus_space_handle_t ioh_c, u_char val) { if (!pckbc_wait_output(iot, ioh_c)) return (0); @@ -135,11 +130,8 @@ pckbc_send_cmd(iot, ioh_c, val) } int -pckbc_poll_data1(iot, ioh_d, ioh_c, slot, checkaux) - bus_space_tag_t iot; - bus_space_handle_t ioh_d, ioh_c; - pckbc_slot_t slot; - int checkaux; +pckbc_poll_data1(bus_space_tag_t iot, bus_space_handle_t ioh_d, + bus_space_handle_t ioh_c, pckbc_slot_t slot, int checkaux) { int i; u_char stat; @@ -177,8 +169,7 @@ pckbc_poll_data1(iot, ioh_d, ioh_c, slot, checkaux) * Get the current command byte. */ static int -pckbc_get8042cmd(t) - struct pckbc_internal *t; +pckbc_get8042cmd(struct pckbc_internal *t) { bus_space_tag_t iot = t->t_iot; bus_space_handle_t ioh_d = t->t_ioh_d; @@ -199,8 +190,7 @@ pckbc_get8042cmd(t) * Pass command byte to keyboard controller (8042). */ static int -pckbc_put8042cmd(t) - struct pckbc_internal *t; +pckbc_put8042cmd(struct pckbc_internal *t) { bus_space_tag_t iot = t->t_iot; bus_space_handle_t ioh_d = t->t_ioh_d; @@ -215,10 +205,7 @@ pckbc_put8042cmd(t) } static int -pckbc_send_devcmd(t, slot, val) - struct pckbc_internal *t; - pckbc_slot_t slot; - u_char val; +pckbc_send_devcmd(struct pckbc_internal *t, pckbc_slot_t slot, u_char val) { bus_space_tag_t iot = t->t_iot; bus_space_handle_t ioh_d = t->t_ioh_d; @@ -235,9 +222,7 @@ pckbc_send_devcmd(t, slot, val) } int -pckbc_is_console(iot, addr) - bus_space_tag_t iot; - bus_addr_t addr; +pckbc_is_console(bus_space_tag_t iot, bus_addr_t addr) { if (pckbc_console && !pckbc_console_attached && pckbc_consdata.t_iot == iot && @@ -247,10 +232,7 @@ pckbc_is_console(iot, addr) } int -pckbc_submatch_locators(parent, match, aux) - struct device *parent; - void *match; - void *aux; +pckbc_submatch_locators(struct device *parent, void *match, void *aux) { struct cfdata *cf = match; struct pckbc_attach_args *pa = aux; @@ -262,10 +244,7 @@ pckbc_submatch_locators(parent, match, aux) } int -pckbc_submatch(parent, match, aux) - struct device *parent; - void *match; - void *aux; +pckbc_submatch(struct device *parent, void *match, void *aux) { struct cfdata *cf = match; @@ -275,10 +254,7 @@ pckbc_submatch(parent, match, aux) } int -pckbc_attach_slot(sc, slot, force) - struct pckbc_softc *sc; - pckbc_slot_t slot; - int force; +pckbc_attach_slot(struct pckbc_softc *sc, pckbc_slot_t slot, int force) { struct pckbc_internal *t = sc->id; struct pckbc_attach_args pa; @@ -300,9 +276,7 @@ pckbc_attach_slot(sc, slot, force) } void -pckbc_attach(sc, flags) - struct pckbc_softc *sc; - int flags; +pckbc_attach(struct pckbc_softc *sc, int flags) { struct pckbc_internal *t; bus_space_tag_t iot; @@ -458,9 +432,7 @@ nomouse: } int -pckbcprint(aux, pnp) - void *aux; - const char *pnp; +pckbcprint(void *aux, const char *pnp) { struct pckbc_attach_args *pa = aux; @@ -470,8 +442,7 @@ pckbcprint(aux, pnp) } void -pckbc_init_slotdata(q) - struct pckbc_slotdata *q; +pckbc_init_slotdata(struct pckbc_slotdata *q) { int i; TAILQ_INIT(&q->cmdqueue); @@ -484,9 +455,7 @@ pckbc_init_slotdata(q) } void -pckbc_flush(self, slot) - pckbc_tag_t self; - pckbc_slot_t slot; +pckbc_flush(pckbc_tag_t self, pckbc_slot_t slot) { struct pckbc_internal *t = self; @@ -495,9 +464,7 @@ pckbc_flush(self, slot) } int -pckbc_poll_data(self, slot) - pckbc_tag_t self; - pckbc_slot_t slot; +pckbc_poll_data(pckbc_tag_t self, pckbc_slot_t slot) { struct pckbc_internal *t = self; struct pckbc_slotdata *q = t->t_slotdata[slot]; @@ -519,10 +486,7 @@ pckbc_poll_data(self, slot) * return nonzero on success */ int -pckbc_xt_translation(self, slot, on) - pckbc_tag_t self; - pckbc_slot_t slot; - int on; +pckbc_xt_translation(pckbc_tag_t self, pckbc_slot_t slot, int on) { struct pckbc_internal *t = self; int ison; @@ -565,10 +529,7 @@ static struct pckbc_portcmd { }; void -pckbc_slot_enable(self, slot, on) - pckbc_tag_t self; - pckbc_slot_t slot; - int on; +pckbc_slot_enable(pckbc_tag_t self, pckbc_slot_t slot, int on) { struct pckbc_internal *t = (struct pckbc_internal *)self; struct pckbc_portcmd *cmd; @@ -588,10 +549,7 @@ pckbc_slot_enable(self, slot, on) } void -pckbc_set_poll(self, slot, on) - pckbc_tag_t self; - pckbc_slot_t slot; - int on; +pckbc_set_poll(pckbc_tag_t self, pckbc_slot_t slot, int on) { struct pckbc_internal *t = (struct pckbc_internal *)self; @@ -619,10 +577,8 @@ pckbc_set_poll(self, slot, on) * to be called at spltty() */ static void -pckbc_poll_cmd1(t, slot, cmd) - struct pckbc_internal *t; - pckbc_slot_t slot; - struct pckbc_devcmd *cmd; +pckbc_poll_cmd1(struct pckbc_internal *t, pckbc_slot_t slot, + struct pckbc_devcmd *cmd) { bus_space_tag_t iot = t->t_iot; bus_space_handle_t ioh_d = t->t_ioh_d; @@ -701,13 +657,8 @@ pckbc_poll_cmd1(t, slot, cmd) /* for use in autoconfiguration */ int -pckbc_poll_cmd(self, slot, cmd, len, responselen, respbuf, slow) - pckbc_tag_t self; - pckbc_slot_t slot; - u_char *cmd; - int len, responselen; - u_char *respbuf; - int slow; +pckbc_poll_cmd(pckbc_tag_t self, pckbc_slot_t slot, u_char *cmd, int len, + int responselen, u_char *respbuf, int slow) { struct pckbc_devcmd nc; @@ -732,8 +683,7 @@ pckbc_poll_cmd(self, slot, cmd, len, responselen, respbuf, slow) * Clean up a command queue, throw away everything. */ void -pckbc_cleanqueue(q) - struct pckbc_slotdata *q; +pckbc_cleanqueue(struct pckbc_slotdata *q) { struct pckbc_devcmd *cmd; #ifdef PCKBCDEBUG @@ -757,8 +707,7 @@ pckbc_cleanqueue(q) * XXX could be less invasive. */ void -pckbc_cleanup(self) - void *self; +pckbc_cleanup(void *self) { struct pckbc_internal *t = self; int s; @@ -807,9 +756,7 @@ pckbc_reset(struct pckbc_softc *sc) * to be called at spltty() */ void -pckbc_start(t, slot) - struct pckbc_internal *t; - pckbc_slot_t slot; +pckbc_start(struct pckbc_internal *t, pckbc_slot_t slot) { struct pckbc_slotdata *q = t->t_slotdata[slot]; struct pckbc_devcmd *cmd = TAILQ_FIRST(&q->cmdqueue); @@ -846,10 +793,7 @@ pckbc_start(t, slot) * to be called at spltty() */ int -pckbc_cmdresponse(t, slot, data) - struct pckbc_internal *t; - pckbc_slot_t slot; - u_char data; +pckbc_cmdresponse(struct pckbc_internal *t, pckbc_slot_t slot, u_char data) { struct pckbc_slotdata *q = t->t_slotdata[slot]; struct pckbc_devcmd *cmd = TAILQ_FIRST(&q->cmdqueue); @@ -908,12 +852,8 @@ restart: * Put command into the device's command queue, return zero or errno. */ int -pckbc_enqueue_cmd(self, slot, cmd, len, responselen, sync, respbuf) - pckbc_tag_t self; - pckbc_slot_t slot; - u_char *cmd; - int len, responselen, sync; - u_char *respbuf; +pckbc_enqueue_cmd(pckbc_tag_t self, pckbc_slot_t slot, u_char *cmd, int len, + int responselen, int sync, u_char *respbuf) { struct pckbc_internal *t = self; struct pckbc_slotdata *q = t->t_slotdata[slot]; @@ -978,12 +918,8 @@ pckbc_enqueue_cmd(self, slot, cmd, len, responselen, sync, respbuf) } void -pckbc_set_inputhandler(self, slot, func, arg, name) - pckbc_tag_t self; - pckbc_slot_t slot; - pckbc_inputfcn func; - void *arg; - char *name; +pckbc_set_inputhandler(pckbc_tag_t self, pckbc_slot_t slot, pckbc_inputfcn func, + void *arg, char *name) { struct pckbc_internal *t = (struct pckbc_internal *)self; struct pckbc_softc *sc = t->t_sc; @@ -1002,8 +938,7 @@ pckbc_set_inputhandler(self, slot, func, arg, name) } void -pckbc_poll(v) - void *v; +pckbc_poll(void *v) { struct pckbc_internal *t = v; int s; @@ -1015,8 +950,7 @@ pckbc_poll(v) } int -pckbcintr(vsc) - void *vsc; +pckbcintr(void *vsc) { struct pckbc_softc *sc = (struct pckbc_softc *)vsc; @@ -1024,9 +958,7 @@ pckbcintr(vsc) } int -pckbcintr_internal(t, sc) - struct pckbc_internal *t; - struct pckbc_softc *sc; +pckbcintr_internal(struct pckbc_internal *t, struct pckbc_softc *sc) { u_char stat; pckbc_slot_t slot; @@ -1081,12 +1013,8 @@ pckbcintr_internal(t, sc) } int -pckbc_cnattach(iot, addr, cmd_offset, slot, flags) - bus_space_tag_t iot; - bus_addr_t addr; - bus_size_t cmd_offset; - pckbc_slot_t slot; - int flags; +pckbc_cnattach(bus_space_tag_t iot, bus_addr_t addr, bus_size_t cmd_offset, + pckbc_slot_t slot, int flags) { bus_space_handle_t ioh_d, ioh_c; int res = 0; diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index af6374c1cf1..b71a16c5fcc 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga.c,v 1.53 2010/08/08 17:21:05 miod Exp $ */ +/* $OpenBSD: vga.c,v 1.54 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */ /*- @@ -270,8 +270,7 @@ const struct wsdisplay_accessops vga_accessops = { * and attachment. */ int -vga_common_probe(iot, memt) - bus_space_tag_t iot, memt; +vga_common_probe(bus_space_tag_t iot, bus_space_tag_t memt) { bus_space_handle_t ioh_vga, ioh_6845, memh; u_int8_t regval; @@ -346,10 +345,8 @@ bad: f->encoding == WSDISPLAY_FONTENC_ISO) int -vga_selectfont(vc, scr, name1, name2) - struct vga_config *vc; - struct vgascreen *scr; - const char *name1, *name2; /* NULL: take first found */ +vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1, + const char *name2) /* NULL: take first found */ { const struct wsscreen_descr *type = scr->pcs.type; struct vgafont *f1, *f2; @@ -400,12 +397,8 @@ vga_selectfont(vc, scr, name1, name2) } void -vga_init_screen(vc, scr, type, existing, attrp) - struct vga_config *vc; - struct vgascreen *scr; - const struct wsscreen_descr *type; - int existing; - long *attrp; +vga_init_screen(struct vga_config *vc, struct vgascreen *scr, + const struct wsscreen_descr *type, int existing, long *attrp) { int cpos; int res; @@ -473,9 +466,7 @@ vga_init_screen(vc, scr, type, existing, attrp) } void -vga_init(vc, iot, memt) - struct vga_config *vc; - bus_space_tag_t iot, memt; +vga_init(struct vga_config *vc, bus_space_tag_t iot, bus_space_tag_t memt) { struct vga_handle *vh = &vc->hdl; u_int8_t mor; @@ -518,20 +509,15 @@ vga_init(vc, iot, memt) } struct vga_config * -vga_common_attach(self, iot, memt, type) - struct device *self; - bus_space_tag_t iot, memt; - int type; +vga_common_attach(struct device *self, bus_space_tag_t iot, + bus_space_tag_t memt, int type) { return vga_extended_attach(self, iot, memt, type, NULL); } struct vga_config * -vga_extended_attach(self, iot, memt, type, map) - struct device *self; - bus_space_tag_t iot, memt; - int type; - paddr_t (*map)(void *, off_t, int); +vga_extended_attach(struct device *self, bus_space_tag_t iot, + bus_space_tag_t memt, int type, paddr_t (*map)(void *, off_t, int)) { int console; struct vga_config *vc; @@ -577,9 +563,7 @@ displaysubmatch(struct device *parent, void *match, void *aux) } int -vga_cnattach(iot, memt, type, check) - bus_space_tag_t iot, memt; - int type, check; +vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check) { long defattr; const struct wsscreen_descr *scr; @@ -606,9 +590,7 @@ vga_cnattach(iot, memt, type, check) } int -vga_is_console(iot, type) - bus_space_tag_t iot; - int type; +vga_is_console(bus_space_tag_t iot, int type) { if (vgaconsole && !vga_console_attached && @@ -619,12 +601,7 @@ vga_is_console(iot, type) } int -vga_ioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +vga_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) { struct vga_config *vc = v; int mode; @@ -669,26 +646,19 @@ vga_ioctl(v, cmd, data, flag, p) } paddr_t -vga_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +vga_mmap(void *v, off_t offset, int prot) { struct vga_config *vc = v; if (vc->vc_mmap != NULL) return (*vc->vc_mmap)(v, offset, prot); - return -1; + return (paddr_t)-1; } int -vga_alloc_screen(v, type, cookiep, curxp, curyp, defattrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *defattrp; +vga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, + int *curxp, int *curyp, long *defattrp) { struct vga_config *vc = v; struct vgascreen *scr; @@ -726,9 +696,7 @@ vga_alloc_screen(v, type, cookiep, curxp, curyp, defattrp) } void -vga_free_screen(v, cookie) - void *v; - void *cookie; +vga_free_screen(void *v, void *cookie) { struct vgascreen *vs = cookie; struct vga_config *vc = vs->cfg; @@ -756,9 +724,7 @@ vga_free_screen(v, cookie) } void -vga_setfont(vc, scr) - struct vga_config *vc; - struct vgascreen *scr; +vga_setfont(struct vga_config *vc, struct vgascreen *scr) { int fontslot1, fontslot2; @@ -773,12 +739,8 @@ vga_setfont(vc, scr) } int -vga_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; +vga_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), + void *cbarg) { struct vgascreen *scr = cookie, *oldscr; struct vga_config *vc = scr->cfg; @@ -803,8 +765,7 @@ vga_show_screen(v, cookie, waitok, cb, cbarg) } void -vga_doswitch(vc) - struct vga_config *vc; +vga_doswitch(struct vga_config *vc) { struct vgascreen *scr, *oldscr; struct vga_handle *vh = &vc->hdl; @@ -876,10 +837,7 @@ vga_doswitch(vc) } int -vga_load_font(v, cookie, data) - void *v; - void *cookie; - struct wsdisplay_font *data; +vga_load_font(void *v, void *cookie, struct wsdisplay_font *data) { struct vga_config *vc = v; struct vgascreen *scr = cookie; @@ -947,10 +905,7 @@ vga_load_font(v, cookie, data) } void -vga_scrollback(v, cookie, lines) - void *v; - void *cookie; - int lines; +vga_scrollback(void *v, void *cookie, int lines) { struct vga_config *vc = v; struct vgascreen *scr = cookie; @@ -992,11 +947,7 @@ vga_scrollback(v, cookie, lines) } int -vga_alloc_attr(id, fg, bg, flags, attrp) - void *id; - int fg, bg; - int flags; - long *attrp; +vga_alloc_attr(void *id, int fg, int bg, int flags, long *attrp) { struct vgascreen *scr = id; struct vga_config *vc = scr->cfg; @@ -1028,10 +979,7 @@ vga_alloc_attr(id, fg, bg, flags, attrp) } void -vga_unpack_attr(id, attr, fg, bg, ul) - void *id; - long attr; - int *fg, *bg, *ul; +vga_unpack_attr(void *id, long attr, int *fg, int *bg, int *ul) { struct vgascreen *scr = id; struct vga_config *vc = scr->cfg; @@ -1052,9 +1000,7 @@ vga_unpack_attr(id, attr, fg, bg, ul) } int -vga_copyrows(id, srcrow, dstrow, nrows) - void *id; - int srcrow, dstrow, nrows; +vga_copyrows(void *id, int srcrow, int dstrow, int nrows) { struct vgascreen *scr = id; bus_space_tag_t memt = scr->pcs.hdl->ph_memt; @@ -1114,7 +1060,7 @@ vga_copyrows(id, srcrow, dstrow, nrows) #ifdef WSCONS_SUPPORT_PCVTFONTS #define NOTYET 0xffff -static u_int16_t pcvt_unichars[0xa0] = { +static const u_int16_t pcvt_unichars[0xa0] = { /* 0 */ _e006U, NOTYET, NOTYET, NOTYET, NOTYET, NOTYET, NOTYET, NOTYET, NOTYET, @@ -1231,9 +1177,7 @@ static u_int16_t pcvt_unichars[0xa0] = { int vga_pcvt_mapchar(int, unsigned int *); int -vga_pcvt_mapchar(uni, index) - int uni; - unsigned int *index; +vga_pcvt_mapchar(int uni, unsigned int *index) { int i; @@ -1251,11 +1195,7 @@ vga_pcvt_mapchar(uni, index) int _vga_mapchar(void *, struct vgafont *, int, unsigned int *); int -_vga_mapchar(id, font, uni, index) - void *id; - struct vgafont *font; - int uni; - unsigned int *index; +_vga_mapchar(void *id, struct vgafont *font, int uni, unsigned int *index) { switch (font->encoding) { @@ -1284,10 +1224,7 @@ _vga_mapchar(id, font, uni, index) } int -vga_mapchar(id, uni, index) - void *id; - int uni; - unsigned int *index; +vga_mapchar(void *id, int uni, unsigned int *index) { struct vgascreen *scr = id; unsigned int idx1, idx2; @@ -1311,12 +1248,7 @@ vga_mapchar(id, uni, index) } int -vga_putchar(c, row, col, uc, attr) - void *c; - int row; - int col; - u_int uc; - long attr; +vga_putchar(void *c, int row, int col, u_int uc, long attr) { struct vgascreen *scr = c; @@ -1327,9 +1259,7 @@ vga_putchar(c, row, col, uc, attr) } void -vga_burner(v, on, flags) - void *v; - u_int on, flags; +vga_burner(void *v, u_int on, u_int flags) { struct vga_config *vc = v; struct vga_handle *vh = &vc->hdl; @@ -1356,10 +1286,7 @@ vga_burner(v, on, flags) } int -vga_getchar(c, row, col, cell) - void *c; - int row, col; - struct wsdisplay_charcell *cell; +vga_getchar(void *c, int row, int col, struct wsdisplay_charcell *cell) { struct vga_config *vc = c; diff --git a/sys/dev/ic/vga_subr.c b/sys/dev/ic/vga_subr.c index bff1afc56da..1cec569f1b5 100644 --- a/sys/dev/ic/vga_subr.c +++ b/sys/dev/ic/vga_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga_subr.c,v 1.3 2004/04/02 04:39:50 deraadt Exp $ */ +/* $OpenBSD: vga_subr.c,v 1.4 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: vga_subr.c,v 1.6 2000/01/25 02:44:03 ad Exp $ */ /* @@ -44,8 +44,7 @@ static void fontram(struct vga_handle *); static void textram(struct vga_handle *); static void -fontram(vh) - struct vga_handle *vh; +fontram(struct vga_handle *vh) { /* program sequencer to access character generator */ @@ -62,8 +61,7 @@ fontram(vh) } static void -textram(vh) - struct vga_handle *vh; +textram(struct vga_handle *vh) { /* program sequencer to access video ram */ @@ -81,11 +79,8 @@ textram(vh) } void -vga_loadchars(vh, fontset, first, num, lpc, data) - struct vga_handle *vh; - int fontset, first, num; - int lpc; - char *data; +vga_loadchars(struct vga_handle *vh, int fontset, int first, int num, int lpc, + char *data) { int offset, i, j, s; @@ -106,16 +101,14 @@ vga_loadchars(vh, fontset, first, num, lpc, data) } void -vga_setfontset(vh, fontset1, fontset2) - struct vga_handle *vh; - int fontset1, fontset2; +vga_setfontset(struct vga_handle *vh, int fontset1, int fontset2) { u_int8_t cmap; - static u_int8_t cmaptaba[] = { + static const u_int8_t cmaptaba[] = { 0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13 }; - static u_int8_t cmaptabb[] = { + static const u_int8_t cmaptabb[] = { 0x00, 0x20, 0x04, 0x24, 0x08, 0x28, 0x0c, 0x2c }; @@ -127,9 +120,7 @@ vga_setfontset(vh, fontset1, fontset2) } void -vga_setscreentype(vh, type) - struct vga_handle *vh; - const struct wsscreen_descr *type; +vga_setscreentype(struct vga_handle *vh, const struct wsscreen_descr *type) { vga_6845_write(vh, maxrow, type->fontheight - 1); diff --git a/sys/dev/ic/vgavar.h b/sys/dev/ic/vgavar.h index fd36b95ba49..6c770aabb06 100644 --- a/sys/dev/ic/vgavar.h +++ b/sys/dev/ic/vgavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vgavar.h,v 1.10 2010/08/08 17:21:05 miod Exp $ */ +/* $OpenBSD: vgavar.h,v 1.11 2010/08/28 12:48:14 miod Exp $ */ /* $NetBSD: vgavar.h,v 1.4 2000/06/17 07:11:50 soda Exp $ */ /* @@ -91,9 +91,8 @@ static inline void _vga_gdc_write(struct vga_handle *, int, u_int8_t); #define vga_enable(vh) \ vga_raw_write(vh, 0, 0x20); -static inline u_int8_t _vga_attr_read(vh, reg) - struct vga_handle *vh; - int reg; +static inline u_int8_t +_vga_attr_read(struct vga_handle *vh, int reg) { u_int8_t res; @@ -111,10 +110,8 @@ static inline u_int8_t _vga_attr_read(vh, reg) return (res); } -static inline void _vga_attr_write(vh, reg, val) - struct vga_handle *vh; - int reg; - u_int8_t val; +static inline void +_vga_attr_write(struct vga_handle *vh, int reg, u_int8_t val) { /* reset state */ (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10); @@ -128,35 +125,29 @@ static inline void _vga_attr_write(vh, reg, val) vga_enable(vh); } -static inline u_int8_t _vga_ts_read(vh, reg) - struct vga_handle *vh; - int reg; +static inline u_int8_t +_vga_ts_read(struct vga_handle *vh, int reg) { vga_raw_write(vh, VGA_TS_INDEX, reg); return (vga_raw_read(vh, VGA_TS_DATA)); } -static inline void _vga_ts_write(vh, reg, val) - struct vga_handle *vh; - int reg; - u_int8_t val; +static inline void +_vga_ts_write(struct vga_handle *vh, int reg, u_int8_t val) { vga_raw_write(vh, VGA_TS_INDEX, reg); vga_raw_write(vh, VGA_TS_DATA, val); } -static inline u_int8_t _vga_gdc_read(vh, reg) - struct vga_handle *vh; - int reg; +static inline u_int8_t +_vga_gdc_read(struct vga_handle *vh, int reg) { vga_raw_write(vh, VGA_GDC_INDEX, reg); return (vga_raw_read(vh, VGA_GDC_DATA)); } -static inline void _vga_gdc_write(vh, reg, val) - struct vga_handle *vh; - int reg; - u_int8_t val; +static inline void +_vga_gdc_write(struct vga_handle *vh, int reg, u_int8_t val) { vga_raw_write(vh, VGA_GDC_INDEX, reg); vga_raw_write(vh, VGA_GDC_DATA, val); |