Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/nor Size of erase block is 128 bytes when sector den...



details:   https://anonhg.NetBSD.org/src/rev/dbae218525a6
branches:  trunk
changeset: 340613:dbae218525a6
user:      phx <phx%NetBSD.org@localhost>
date:      Fri Sep 18 21:30:02 2015 +0000

description:
Size of erase block is 128 bytes when sector density (z) is zero.

diffstat:

 sys/dev/nor/cfi.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 872ecc73d3be -r dbae218525a6 sys/dev/nor/cfi.c
--- a/sys/dev/nor/cfi.c Fri Sep 18 17:21:43 2015 +0000
+++ b/sys/dev/nor/cfi.c Fri Sep 18 21:30:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cfi.c,v 1.7 2011/12/17 19:42:41 phx Exp $      */
+/*     $NetBSD: cfi.c,v 1.8 2015/09/18 21:30:02 phx Exp $      */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_cfi.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cfi.c,v 1.7 2011/12/17 19:42:41 phx Exp $"); 
+__KERNEL_RCSID(0, "$NetBSD: cfi.c,v 1.8 2015/09/18 21:30:02 phx Exp $"); 
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -476,7 +476,8 @@
         */
        chip->nc_num_luns = 1;
        chip->nc_lun_blocks = cfi->cfi_qry_data.erase_blk_info[0].y + 1;
-       chip->nc_block_size = cfi->cfi_qry_data.erase_blk_info[0].z * 256;
+       chip->nc_block_size = cfi->cfi_qry_data.erase_blk_info[0].z ?
+           cfi->cfi_qry_data.erase_blk_info[0].z * 256 : 128;
 
        switch (cfi->cfi_qry_data.id_pri) {
        case 0x0002:
@@ -880,7 +881,8 @@
        aprint_normal_dev(self, "%d Erase Block Region(s)\n",
                qryp->erase_blk_regions);
        for (u_int r=0; r < qryp->erase_blk_regions; r++) {
-               size_t sz = qryp->erase_blk_info[r].z * 256;
+               size_t sz = qryp->erase_blk_info[r].z ?
+                   qryp->erase_blk_info[r].z * 256 : 128;
                format_bytes(pbuf, sizeof(pbuf), sz);
                aprint_normal("    %d: %d blocks, size %s\n", r,
                        qryp->erase_blk_info[r].y + 1, pbuf);



Home | Main Index | Thread Index | Old Index