Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hp300/dev Use proper integer types for HP-IB xfer p...



details:   https://anonhg.NetBSD.org/src/rev/4eba4b689daf
branches:  trunk
changeset: 372427:4eba4b689daf
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Nov 25 13:02:51 2022 +0000

description:
Use proper integer types for HP-IB xfer parameters.

No visible regression on 425t and HPDisk.

diffstat:

 sys/arch/hp300/dev/rd.c    |  40 +++++++++++-----------
 sys/arch/hp300/dev/rdreg.h |  80 +++++++++++++++++++++++-----------------------
 2 files changed, 60 insertions(+), 60 deletions(-)

diffs (236 lines):

diff -r d2cfdab460d8 -r 4eba4b689daf sys/arch/hp300/dev/rd.c
--- a/sys/arch/hp300/dev/rd.c   Fri Nov 25 12:35:44 2022 +0000
+++ b/sys/arch/hp300/dev/rd.c   Fri Nov 25 13:02:51 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rd.c,v 1.112 2022/11/23 18:53:22 tsutsui Exp $ */
+/*     $NetBSD: rd.c,v 1.113 2022/11/25 13:02:51 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.112 2022/11/23 18:53:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.113 2022/11/25 13:02:51 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -562,7 +562,7 @@
 rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha)
 {
        struct cs80_describe desc;
-       u_char stat, cmd[3];
+       uint8_t stat, cmd[3];
        char name[7];
        int i, id, n, ctlr, slave;
 
@@ -717,7 +717,7 @@
        struct rd_ssmcmd ssmc;
        struct rd_srcmd src;
        struct rd_clearcmd clear;
-       u_char stat;
+       uint8_t stat;
 
        clear.c_unit = C_SUNIT(punit);
        clear.c_cmd = C_CLEAR;
@@ -1032,7 +1032,7 @@
         */
 #ifdef DEBUG
        if (rddebug & RDB_ERROR)
-               printf("%s: rdstart: cmd %x adr %lx blk %lld len %d ecnt %d\n",
+               printf("%s: rdstart: cmd %x adr %x blk %lld len %d ecnt %d\n",
                    device_xname(sc->sc_dev),
                    sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr,
                    bp->b_blkno, sc->sc_resid, sc->sc_errcnt);
@@ -1042,7 +1042,7 @@
        rdreset(sc);
        if (sc->sc_errcnt++ < RDRETRY)
                goto again;
-       printf("%s: rdstart err: cmd 0x%x sect %ld blk %" PRId64 " len %d\n",
+       printf("%s: rdstart err: cmd 0x%x sect %u blk %" PRId64 " len %d\n",
            device_xname(sc->sc_dev), sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr,
            bp->b_blkno, sc->sc_resid);
        bp->b_error = EIO;
@@ -1083,7 +1083,7 @@
        struct rd_softc *sc = arg;
        int unit = device_unit(sc->sc_dev);
        struct buf *bp = bufq_peek(sc->sc_tab);
-       u_char stat = 13;       /* in case hpibrecv fails */
+       uint8_t stat = 13;      /* in case hpibrecv fails */
        int rv, restart, ctlr, slave;
 
        ctlr = device_unit(device_parent(sc->sc_dev));
@@ -1150,7 +1150,7 @@
 rdstatus(struct rd_softc *sc)
 {
        int c, s;
-       u_char stat;
+       uint8_t stat;
        int rv;
 
        c = device_unit(device_parent(sc->sc_dev));
@@ -1284,17 +1284,17 @@
                rdprinterr("access", sp->c_aef, err_access);
                rdprinterr("info", sp->c_ief, err_info);
                printf("    block: %lld, P1-P10: ", hwbn);
-               printf("0x%x", *(u_int *)&sp->c_raw[0]);
-               printf("0x%x", *(u_int *)&sp->c_raw[4]);
-               printf("0x%x\n", *(u_short *)&sp->c_raw[8]);
+               printf("0x%x", *(uint32_t *)&sp->c_raw[0]);
+               printf("0x%x", *(uint32_t *)&sp->c_raw[4]);
+               printf("0x%x\n", *(uint16_t *)&sp->c_raw[8]);
                /* command */
                printf("    ioc: ");
-               printf("0x%x", *(u_int *)&sc->sc_ioc.c_pad);
-               printf("0x%x", *(u_short *)&sc->sc_ioc.c_hiaddr);
-               printf("0x%x", *(u_int *)&sc->sc_ioc.c_addr);
-               printf("0x%x", *(u_short *)&sc->sc_ioc.c_nop2);
-               printf("0x%x", *(u_int *)&sc->sc_ioc.c_len);
-               printf("0x%x\n", *(u_short *)&sc->sc_ioc.c_cmd);
+               printf("0x%x", *(uint32_t *)&sc->sc_ioc.c_pad);
+               printf("0x%x", *(uint16_t *)&sc->sc_ioc.c_hiaddr);
+               printf("0x%x", *(uint32_t *)&sc->sc_ioc.c_addr);
+               printf("0x%x", *(uint16_t *)&sc->sc_ioc.c_nop2);
+               printf("0x%x", *(uint32_t *)&sc->sc_ioc.c_len);
+               printf("0x%x\n", *(uint16_t *)&sc->sc_ioc.c_cmd);
                return 1;
        }
 #endif
@@ -1302,9 +1302,9 @@
            (sp->c_vu>>4)&0xF, sp->c_vu&0xF,
            sp->c_ref, sp->c_fef, sp->c_aef, sp->c_ief);
        printf("P1-P10: ");
-       printf("0x%x", *(u_int *)&sp->c_raw[0]);
-       printf("0x%x", *(u_int *)&sp->c_raw[4]);
-       printf("0x%x\n", *(u_short *)&sp->c_raw[8]);
+       printf("0x%x", *(uint32_t *)&sp->c_raw[0]);
+       printf("0x%x", *(uint32_t *)&sp->c_raw[4]);
+       printf("0x%x\n", *(uint16_t *)&sp->c_raw[8]);
        return 1;
 }
 
diff -r d2cfdab460d8 -r 4eba4b689daf sys/arch/hp300/dev/rdreg.h
--- a/sys/arch/hp300/dev/rdreg.h        Fri Nov 25 12:35:44 2022 +0000
+++ b/sys/arch/hp300/dev/rdreg.h        Fri Nov 25 13:02:51 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rdreg.h,v 1.19 2022/11/21 16:22:37 tsutsui Exp $       */
+/*     $NetBSD: rdreg.h,v 1.20 2022/11/25 13:02:51 tsutsui Exp $       */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,42 +39,42 @@
  */
 
 struct rd_iocmd {
-       char    c_pad;
-       char    c_unit;
-       char    c_volume;
-       char    c_saddr;
-       short   c_hiaddr;
-       long    c_addr;
-       char    c_nop2;
-       char    c_slen;
-       long    c_len;
-       char    c_cmd;
-       char    c_pad2;
+       uint8_t         c_pad;
+       uint8_t         c_unit;
+       uint8_t         c_volume;
+       uint8_t         c_saddr;
+       uint16_t        c_hiaddr;
+       uint32_t        c_addr;
+       uint8_t         c_nop2;
+       uint8_t         c_slen;
+       uint32_t        c_len;
+       uint8_t         c_cmd;
+       uint8_t         c_pad2;
 } __attribute__((__packed__));
 
 struct rd_rscmd {
-       char    c_unit;
-       char    c_sram;
-       char    c_ram;
-       char    c_cmd;
+       uint8_t         c_unit;
+       uint8_t         c_sram;
+       uint8_t         c_ram;
+       uint8_t         c_cmd;
 } __attribute__((__packed__));
 
 struct rd_stat {
-       char    c_vu;
-       char    c_pend;
-       short   c_ref;
-       short   c_fef;
-       short   c_aef;
-       short   c_ief;
+       uint8_t         c_vu;
+       uint8_t         c_pend;
+       uint16_t        c_ref;
+       uint16_t        c_fef;
+       uint16_t        c_aef;
+       uint16_t        c_ief;
        union {
-               char cu_raw[10];
+               uint8_t cu_raw[10];
                struct {
-                       short   cu_msw;
-                       long    cu_lsl;
+                       uint16_t        cu_msw;
+                       uint32_t        cu_lsl;
                } cu_sva;
                struct {
-                       long    cu_cyhd;
-                       short   cu_sect;
+                       uint32_t        cu_cyhd;
+                       uint16_t        cu_sect;
                } cu_tva;
        } c_pf;
 } __attribute__((__packed__));
@@ -83,24 +83,24 @@
 #define        c_tva   c_pf.cu_tva
 
 struct rd_ssmcmd {
-       char    c_unit;
-       char    c_cmd;
-       short   c_refm;
-       short   c_fefm;
-       short   c_aefm;
-       short   c_iefm;
+       uint8_t         c_unit;
+       uint8_t         c_cmd;
+       uint16_t        c_refm;
+       uint16_t        c_fefm;
+       uint16_t        c_aefm;
+       uint16_t        c_iefm;
 } __attribute__((__packed__));
 
 struct rd_srcmd {
-       char    c_unit;
-       char    c_nop;
-       char    c_cmd;
-       char    c_param;
+       uint8_t         c_unit;
+       uint8_t         c_nop;
+       uint8_t         c_cmd;
+       uint8_t         c_param;
 } __attribute__((__packed__));
 
 struct rd_clearcmd {
-       char    c_unit;
-       char    c_cmd;
+       uint8_t         c_unit;
+       uint8_t         c_cmd;
 } __attribute__((__packed__));
 
 /* HW ids */
@@ -313,7 +313,7 @@
 #define        RDSTOB(x)       ((x) >> (DEV_BSHIFT-8))
 
 /* extract cyl/head/sect info from three-vector address */
-#define        RDCYL(tva)      ((u_long)(tva).cu_cyhd >> 8)
+#define        RDCYL(tva)      ((uint32_t)(tva).cu_cyhd >> 8)
 #define        RDHEAD(tva)     ((tva).cu_cyhd & 0xFF)
 #define        RDSECT(tva)     ((tva).cu_sect)
 



Home | Main Index | Thread Index | Old Index