Module Name: src Committed By: ahoka Date: Fri Nov 2 17:14:41 UTC 2012
Modified Files: src/sys/dev/nand: nand.c nand.h nand_micron.c Log Message: No longer use size_t in the chip structure. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/nand/nand.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/nand/nand.h cvs rdiff -u -r1.6 -r1.7 src/sys/dev/nand/nand_micron.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/nand/nand.c diff -u src/sys/dev/nand/nand.c:1.18 src/sys/dev/nand/nand.c:1.19 --- src/sys/dev/nand/nand.c:1.18 Wed Oct 31 18:58:08 2012 +++ src/sys/dev/nand/nand.c Fri Nov 2 17:14:41 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nand.c,v 1.18 2012/10/31 18:58:08 riz Exp $ */ +/* $NetBSD: nand.c,v 1.19 2012/11/02 17:14:41 ahoka Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -34,7 +34,7 @@ /* Common driver for NAND chips implementing the ONFI 2.2 specification */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.18 2012/10/31 18:58:08 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.19 2012/11/02 17:14:41 ahoka Exp $"); #include "locators.h" @@ -402,13 +402,13 @@ nand_scan_media(device_t self, struct na #endif aprint_normal_dev(self, - "page size: %zu bytes, spare size: %zu bytes, " - "block size: %zu bytes\n", + "page size: %" PRIu32 " bytes, spare size: %" PRIu32 " bytes, " + "block size: %" PRIu32 " bytes\n", chip->nc_page_size, chip->nc_spare_size, chip->nc_block_size); aprint_normal_dev(self, "LUN size: %" PRIu32 " blocks, LUNs: %" PRIu8 - ", total storage size: %zu MB\n", + ", total storage size: %" PRIu64 " MB\n", chip->nc_lun_blocks, chip->nc_num_luns, chip->nc_size / 1024 / 1024); @@ -441,7 +441,7 @@ nand_scan_media(device_t self, struct na ecc->necc_offset = 80; break; default: - panic("OOB size %zu is unexpected", chip->nc_spare_size); + panic("OOB size %" PRIu32 " is unexpected", chip->nc_spare_size); } ecc->necc_steps = chip->nc_page_size / ecc->necc_block_size; @@ -597,7 +597,7 @@ nand_address_column(device_t self, size_ struct nand_chip *chip = &sc->sc_chip; uint8_t i; - DPRINTF(("addressing row: 0x%jx column: %zu\n", + DPRINTF(("addressing row: 0x%jx column: %" PRIu32 "\n", (uintmax_t )row, column)); /* XXX TODO */ @@ -727,18 +727,18 @@ nand_default_read_page(device_t self, si case NAND_ECC_CORRECTED: aprint_error_dev(self, "data corrected with ECC at page offset 0x%jx " - "block %zu\n", (uintmax_t)offset, b); + "block %" PRIu32 "\n", (uintmax_t)offset, b); break; case NAND_ECC_TWOBIT: aprint_error_dev(self, "uncorrectable ECC error at page offset 0x%jx " - "block %zu\n", (uintmax_t)offset, b); + "block %" PRIu32 "\n", (uintmax_t)offset, b); return EIO; break; case NAND_ECC_INVALID: aprint_error_dev(self, "invalid ECC in oob at page offset 0x%jx " - "block %zu\n", (uintmax_t)offset, b); + "block %" PRIu32 "\n", (uintmax_t)offset, b); return EIO; break; default: @@ -1153,8 +1153,8 @@ nand_flash_write_unaligned(device_t self } else { /* XXX debug */ if (left > chip->nc_page_size) { - printf("left: %zu, i: %d, count: %zu\n", - (size_t )left, i, count); + printf("left: %" PRIu32 ", i: %d, count: %" PRIu32 "\n", + left, i, count); } KASSERT(left > chip->nc_page_size); @@ -1232,7 +1232,7 @@ nand_flash_write(device_t self, flash_of } out: mutex_exit(&sc->sc_device_lock); - DPRINTF(("page programming: retlen: %zu, len: %zu\n", *retlen, len)); + DPRINTF(("page programming: retlen: %" PRIu32 ", len: %" PRIu32 "\n", *retlen, len)); return error; } @@ -1324,11 +1324,11 @@ nand_flash_read(device_t self, flash_off *retlen = 0; - DPRINTF(("nand_flash_read: off: 0x%jx, len: %zu\n", + DPRINTF(("nand_flash_read: off: 0x%jx, len: %" PRIu32 "\n", (uintmax_t)offset, len)); if (__predict_false((offset + len) > chip->nc_size)) { - DPRINTF(("nand_flash_read: read (off: 0x%jx, len: %zu)," + DPRINTF(("nand_flash_read: read (off: 0x%jx, len: %" PRIu32 ")," " is over device size (%ju)\n", (uintmax_t)offset, len, (uintmax_t)chip->nc_size)); return EINVAL; Index: src/sys/dev/nand/nand.h diff -u src/sys/dev/nand/nand.h:1.14 src/sys/dev/nand/nand.h:1.15 --- src/sys/dev/nand/nand.h:1.14 Wed Oct 31 18:58:08 2012 +++ src/sys/dev/nand/nand.h Fri Nov 2 17:14:41 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nand.h,v 1.14 2012/10/31 18:58:08 riz Exp $ */ +/* $NetBSD: nand.h,v 1.15 2012/11/02 17:14:41 ahoka Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -110,19 +110,19 @@ struct nand_chip { struct nand_ecc *nc_ecc; /* ecc information */ uint8_t *nc_oob_cache; /* buffer for oob cache */ uint8_t *nc_page_cache; /* buffer for page cache */ - uint8_t *nc_ecc_cache; - size_t nc_size; /* storage size in bytes */ - size_t nc_page_size; /* page size in bytes */ - size_t nc_block_pages; /* block size in pages */ - size_t nc_block_size; /* block size in bytes */ - size_t nc_spare_size; /* spare (oob) size in bytes */ + uint8_t *nc_ecc_cache; /* buffer for ecc */ + uint64_t nc_size; /* storage size in bytes */ + uint32_t nc_page_size; /* page size in bytes */ + uint32_t nc_block_pages; /* block size in pages */ + uint32_t nc_block_size; /* block size in bytes */ + uint32_t nc_spare_size; /* spare (oob) size in bytes */ uint32_t nc_lun_blocks; /* LUN size in blocks */ uint32_t nc_flags; /* bitfield flags */ uint32_t nc_quirks; /* bitfield quirks */ - unsigned int nc_page_shift; /* page shift for page alignment */ - unsigned int nc_page_mask; /* page mask for page alignment */ - unsigned int nc_block_shift; /* write shift */ - unsigned int nc_block_mask; /* write mask */ + uint32_t nc_page_shift; /* page shift for page alignment */ + uint32_t nc_page_mask; /* page mask for page alignment */ + uint32_t nc_block_shift; /* write shift */ + uint32_t nc_block_mask; /* write mask */ uint8_t nc_num_luns; /* number of LUNs */ uint8_t nc_manf_id; /* manufacturer id */ uint8_t nc_dev_id; /* device id */ Index: src/sys/dev/nand/nand_micron.c diff -u src/sys/dev/nand/nand_micron.c:1.6 src/sys/dev/nand/nand_micron.c:1.7 --- src/sys/dev/nand/nand_micron.c:1.6 Fri Jul 15 19:19:57 2011 +++ src/sys/dev/nand/nand_micron.c Fri Nov 2 17:14:41 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nand_micron.c,v 1.6 2011/07/15 19:19:57 cliff Exp $ */ +/* $NetBSD: nand_micron.c,v 1.7 2012/11/02 17:14:41 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nand_micron.c,v 1.6 2011/07/15 19:19:57 cliff Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nand_micron.c,v 1.7 2012/11/02 17:14:41 ahoka Exp $"); #include "nand.h" #include "onfi.h" @@ -159,7 +159,7 @@ mt29fxgx_parameters(device_t self, struc chip->nc_size = MT29FxG_PAGESIZE * MT29FxG_BLOCK_PAGES * dp->lun_blocks * dp->num_luns; - aprint_normal_dev(self, "%s %s, size %zuMB\n", + aprint_normal_dev(self, "%s %s, size %" PRIu64 "MB\n", vendor, dp->name, chip->nc_size >> 20); return 0;