| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: flashio.h,v 1.1 2011/02/26 18:07:32 ahoka Exp $ */ | | 1 | /* $NetBSD: flashio.h,v 1.2 2011/04/04 16:26:09 ahoka Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2011 Department of Software Engineering, | | 4 | * Copyright (c) 2011 Department of Software Engineering, |
5 | * University of Szeged, Hungary | | 5 | * University of Szeged, Hungary |
6 | * Copyright (c) 2011 Adam Hoka <ahoka@NetBSD.org> | | 6 | * Copyright (c) 2011 Adam Hoka <ahoka@NetBSD.org> |
7 | * Copyright (c) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> | | 7 | * Copyright (c) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
10 | * This code is derived from software contributed to The NetBSD Foundation | | 10 | * This code is derived from software contributed to The NetBSD Foundation |
11 | * by the Department of Software Engineering, University of Szeged, Hungary | | 11 | * by the Department of Software Engineering, University of Szeged, Hungary |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -49,53 +49,54 @@ enum { | | | @@ -49,53 +49,54 @@ enum { |
49 | FLASH_ERASE_DONE = 0x0, | | 49 | FLASH_ERASE_DONE = 0x0, |
50 | FLASH_ERASE_FAILED = 0x1 | | 50 | FLASH_ERASE_FAILED = 0x1 |
51 | }; | | 51 | }; |
52 | | | 52 | |
53 | enum { | | 53 | enum { |
54 | FLASH_TYPE_UNKNOWN = 0x0, | | 54 | FLASH_TYPE_UNKNOWN = 0x0, |
55 | FLASH_TYPE_NOR = 0x1, | | 55 | FLASH_TYPE_NOR = 0x1, |
56 | FLASH_TYPE_NAND = 0x2 | | 56 | FLASH_TYPE_NAND = 0x2 |
57 | }; | | 57 | }; |
58 | | | 58 | |
59 | /* public userspace API */ | | 59 | /* public userspace API */ |
60 | | | 60 | |
61 | /* common integer type to address flash */ | | 61 | /* common integer type to address flash */ |
62 | typedef int64_t flash_addr_t; | | 62 | typedef int64_t flash_off_t; |
| | | 63 | typedef uint64_t flash_size_t; |
63 | | | 64 | |
64 | /** | | 65 | /** |
65 | * struct erase_params - for ioctl erase call | | 66 | * struct erase_params - for ioctl erase call |
66 | * @addr: start address of the erase | | 67 | * @addr: start address of the erase |
67 | * @len: length of the erase | | 68 | * @len: length of the erase |
68 | */ | | 69 | */ |
69 | struct flash_erase_params { | | 70 | struct flash_erase_params { |
70 | flash_addr_t ep_addr; | | 71 | flash_off_t ep_addr; |
71 | flash_addr_t ep_len; | | 72 | flash_off_t ep_len; |
72 | }; | | 73 | }; |
73 | | | 74 | |
74 | struct flash_badblock_params { | | 75 | struct flash_badblock_params { |
75 | flash_addr_t bbp_addr; | | 76 | flash_off_t bbp_addr; |
76 | bool bbp_isbad; | | 77 | bool bbp_isbad; |
77 | }; | | 78 | }; |
78 | | | 79 | |
79 | struct flash_info_params { | | 80 | struct flash_info_params { |
80 | flash_addr_t ip_flash_size; | | 81 | flash_off_t ip_flash_size; |
81 | size_t ip_page_size; | | 82 | size_t ip_page_size; |
82 | size_t ip_erase_size; | | 83 | size_t ip_erase_size; |
83 | uint8_t ip_flash_type; | | 84 | uint8_t ip_flash_type; |
84 | }; | | 85 | }; |
85 | | | 86 | |
86 | struct flash_dump_params { | | 87 | struct flash_dump_params { |
87 | flash_addr_t dp_block; | | 88 | flash_off_t dp_block; |
88 | flash_addr_t dp_len; | | 89 | flash_off_t dp_len; |
89 | uint8_t *dp_buf; | | 90 | uint8_t *dp_buf; |
90 | }; | | 91 | }; |
91 | | | 92 | |
92 | enum { | | 93 | enum { |
93 | FLASH_IOCTL_ERASE_BLOCK, | | 94 | FLASH_IOCTL_ERASE_BLOCK, |
94 | FLASH_IOCTL_DUMP, | | 95 | FLASH_IOCTL_DUMP, |
95 | FLASH_IOCTL_GET_INFO, | | 96 | FLASH_IOCTL_GET_INFO, |
96 | FLASH_IOCTL_BLOCK_ISBAD, | | 97 | FLASH_IOCTL_BLOCK_ISBAD, |
97 | FLASH_IOCTL_BLOCK_MARKBAD | | 98 | FLASH_IOCTL_BLOCK_MARKBAD |
98 | }; | | 99 | }; |
99 | | | 100 | |
100 | #define FLASH_ERASE_BLOCK \ | | 101 | #define FLASH_ERASE_BLOCK \ |
101 | _IOW('&', FLASH_IOCTL_ERASE_BLOCK, struct flash_erase_params) | | 102 | _IOW('&', FLASH_IOCTL_ERASE_BLOCK, struct flash_erase_params) |