blob: 4502e3448403a57f34d73e979046014f70daf4fd [file] [log] [blame]
Jordan Crousef6145c32008-03-19 23:56:58 +00001/*
Jordan Crousef6145c32008-03-19 23:56:58 +00002 *
3 * Copyright (C) 2008 Advanced Micro Devices, Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
Uwe Hermannfad8c2b2008-04-11 18:01:50 +000029#ifndef _COREBOOT_TABLES_H
30#define _COREBOOT_TABLES_H
Jordan Crousef6145c32008-03-19 23:56:58 +000031
32#include <arch/types.h>
Gabe Black54c800a2012-08-28 16:31:09 -070033#include <ipchksum.h>
Nico Huber14adb7e2020-07-18 14:23:41 +020034#include <stdint.h>
Jordan Crousef6145c32008-03-19 23:56:58 +000035
Patrick Georgi5326ad72019-05-23 12:41:44 +020036enum {
37 CB_TAG_UNUSED = 0x0000,
38 CB_TAG_MEMORY = 0x0001,
39 CB_TAG_HWRPB = 0x0002,
40 CB_TAG_MAINBOARD = 0x0003,
41 CB_TAG_VERSION = 0x0004,
42 CB_TAG_EXTRA_VERSION = 0x0005,
43 CB_TAG_BUILD = 0x0006,
44 CB_TAG_COMPILE_TIME = 0x0007,
45 CB_TAG_COMPILE_BY = 0x0008,
46 CB_TAG_COMPILE_HOST = 0x0009,
47 CB_TAG_COMPILE_DOMAIN = 0x000a,
48 CB_TAG_COMPILER = 0x000b,
49 CB_TAG_LINKER = 0x000c,
50 CB_TAG_ASSEMBLER = 0x000d,
51 CB_TAG_SERIAL = 0x000f,
52 CB_TAG_CONSOLE = 0x0010,
53 CB_TAG_FORWARD = 0x0011,
54 CB_TAG_FRAMEBUFFER = 0x0012,
55 CB_TAG_GPIO = 0x0013,
56 CB_TAG_TIMESTAMPS = 0x0016,
57 CB_TAG_CBMEM_CONSOLE = 0x0017,
58 CB_TAG_MRC_CACHE = 0x0018,
59 CB_TAG_VBNV = 0x0019,
Joel Kitching452aaae2019-06-16 17:29:52 +080060 CB_TAG_VBOOT_HANDOFF = 0x0020, /* deprecated */
Patrick Georgi5326ad72019-05-23 12:41:44 +020061 CB_TAG_X86_ROM_MTRR = 0x0021,
62 CB_TAG_DMA = 0x0022,
63 CB_TAG_RAM_OOPS = 0x0023,
64 CB_TAG_ACPI_GNVS = 0x0024,
65 CB_TAG_BOARD_ID = 0x0025,
Patrick Georgid0bd5442019-05-23 12:41:44 +020066 CB_TAG_VERSION_TIMESTAMP = 0x0026,
Patrick Georgi5326ad72019-05-23 12:41:44 +020067 CB_TAG_WIFI_CALIBRATION = 0x0027,
68 CB_TAG_RAM_CODE = 0x0028,
69 CB_TAG_SPI_FLASH = 0x0029,
70 CB_TAG_SERIALNO = 0x002a,
71 CB_TAG_MTC = 0x002b,
72 CB_TAG_VPD = 0x002c,
73 CB_TAG_SKU_ID = 0x002d,
74 CB_TAG_BOOT_MEDIA_PARAMS = 0x0030,
Patrick Georgid0bd5442019-05-23 12:41:44 +020075 CB_TAG_CBMEM_ENTRY = 0x0031,
Patrick Georgi5326ad72019-05-23 12:41:44 +020076 CB_TAG_TSC_INFO = 0x0032,
77 CB_TAG_MAC_ADDRS = 0x0033,
78 CB_TAG_VBOOT_WORKBUF = 0x0034,
79 CB_TAG_MMC_INFO = 0x0035,
Patrick Georgid0bd5442019-05-23 12:41:44 +020080 CB_TAG_TCPA_LOG = 0x0036,
Furquan Shaikh3d4923d2019-09-27 00:02:25 -070081 CB_TAG_FMAP = 0x0037,
Patrick Rudolphbc744f52020-04-17 16:16:49 +020082 CB_TAG_SMMSTOREV2 = 0x0039,
Tim Wawrzynczake1a7a262020-10-09 17:07:45 -060083 CB_TAG_BOARD_CONFIG = 0x0040,
Furquan Shaikhbda86bd2021-06-17 22:14:13 -070084 CB_TAG_ACPI_CNVS = 0x0041,
Nick Vaccaroa62b4182021-10-01 13:12:59 -070085 CB_TAG_TYPE_C_INFO = 0x0042,
Arthur Heymanscddba452022-03-03 22:59:23 +010086 CB_TAG_ACPI_RSDP = 0x0043,
Jianjun Wangd16c2aa2022-03-31 15:34:34 +080087 CB_TAG_PCIE = 0x0044,
Patrick Georgi5326ad72019-05-23 12:41:44 +020088 CB_TAG_CMOS_OPTION_TABLE = 0x00c8,
89 CB_TAG_OPTION = 0x00c9,
90 CB_TAG_OPTION_ENUM = 0x00ca,
91 CB_TAG_OPTION_DEFAULTS = 0x00cb,
92 CB_TAG_OPTION_CHECKSUM = 0x00cc,
93};
94
Jianjun Wangb2537bd2022-04-08 16:57:28 +080095typedef __aligned(4) uint64_t cb_uint64_t;
Jordan Crousef6145c32008-03-19 23:56:58 +000096
97struct cb_header {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +000098 u8 signature[4];
99 u32 header_bytes;
100 u32 header_checksum;
101 u32 table_bytes;
102 u32 table_checksum;
103 u32 table_entries;
Jordan Crousef6145c32008-03-19 23:56:58 +0000104};
105
106struct cb_record {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000107 u32 tag;
108 u32 size;
Jordan Crousef6145c32008-03-19 23:56:58 +0000109};
110
Jordan Crousef6145c32008-03-19 23:56:58 +0000111struct cb_memory_range {
Jianjun Wangb2537bd2022-04-08 16:57:28 +0800112 cb_uint64_t start;
113 cb_uint64_t size;
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000114 u32 type;
Jordan Crousef6145c32008-03-19 23:56:58 +0000115};
116
Stefan Reinauerd1bc3312011-06-22 16:39:19 -0700117#define CB_MEM_RAM 1
118#define CB_MEM_RESERVED 2
119#define CB_MEM_ACPI 3
120#define CB_MEM_NVS 4
121#define CB_MEM_UNUSABLE 5
122#define CB_MEM_VENDOR_RSVD 6
123#define CB_MEM_TABLE 16
Jordan Crousef6145c32008-03-19 23:56:58 +0000124
125struct cb_memory {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000126 u32 tag;
127 u32 size;
Elyes Haouasa434f482023-07-30 17:31:15 +0200128 struct cb_memory_range map[];
Jordan Crousef6145c32008-03-19 23:56:58 +0000129};
130
Jordan Crousef6145c32008-03-19 23:56:58 +0000131struct cb_hwrpb {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000132 u32 tag;
133 u32 size;
134 u64 hwrpb;
Jordan Crousef6145c32008-03-19 23:56:58 +0000135};
136
Jordan Crousef6145c32008-03-19 23:56:58 +0000137struct cb_mainboard {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000138 u32 tag;
139 u32 size;
140 u8 vendor_idx;
141 u8 part_number_idx;
Elyes Haouasa434f482023-07-30 17:31:15 +0200142 u8 strings[];
Jordan Crousef6145c32008-03-19 23:56:58 +0000143};
144
Nick Vaccaro15066ba2021-10-01 13:15:26 -0700145enum type_c_orientation {
146 TYPEC_ORIENTATION_NONE,
147 TYPEC_ORIENTATION_NORMAL,
148 TYPEC_ORIENTATION_REVERSE,
149};
150
Nick Vaccaroa62b4182021-10-01 13:12:59 -0700151struct type_c_port_info {
152 /*
153 * usb2_port_number and usb3_port_number are expected to be
154 * the port numbers as seen by the USB controller in the SoC.
155 */
156 uint8_t usb2_port_number;
157 uint8_t usb3_port_number;
158
159 /*
160 * Valid sbu_orientation and data_orientation values will be of
161 * type enum type_c_orienation.
162 */
163 uint8_t sbu_orientation;
164 uint8_t data_orientation;
165};
166
167struct type_c_info {
168 u32 port_count;
Elyes Haouasa434f482023-07-30 17:31:15 +0200169 struct type_c_port_info port_info[];
Nick Vaccaroa62b4182021-10-01 13:12:59 -0700170};
171
Jordan Crousef6145c32008-03-19 23:56:58 +0000172struct cb_string {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000173 u32 tag;
174 u32 size;
Elyes Haouasa434f482023-07-30 17:31:15 +0200175 u8 string[];
Jordan Crousef6145c32008-03-19 23:56:58 +0000176};
177
Jordan Crousef6145c32008-03-19 23:56:58 +0000178struct cb_serial {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000179 u32 tag;
180 u32 size;
Stefan Reinauerd1bc3312011-06-22 16:39:19 -0700181#define CB_SERIAL_TYPE_IO_MAPPED 1
182#define CB_SERIAL_TYPE_MEMORY_MAPPED 2
183 u32 type;
184 u32 baseaddr;
185 u32 baud;
Vadim Bendebury6cc5e522015-01-09 16:54:19 -0800186 u32 regwidth;
Lee Leahyf92a98c2016-05-04 11:59:19 -0700187
188 /* Crystal or input frequency to the chip containing the UART.
189 * Provide the board specific details to allow the payload to
190 * initialize the chip containing the UART and make independent
191 * decisions as to which dividers to select and their values
192 * to eventually arrive at the desired console baud-rate. */
193 u32 input_hertz;
Jordan Crousef6145c32008-03-19 23:56:58 +0000194};
195
Jordan Crousef6145c32008-03-19 23:56:58 +0000196struct cb_console {
Uwe Hermannfad8c2b2008-04-11 18:01:50 +0000197 u32 tag;
198 u32 size;
199 u16 type;
Jordan Crousef6145c32008-03-19 23:56:58 +0000200};
201
202#define CB_TAG_CONSOLE_SERIAL8250 0
Stefan Reinauerabc0c852010-11-22 08:09:50 +0000203#define CB_TAG_CONSOLE_VGA 1 // OBSOLETE
204#define CB_TAG_CONSOLE_BTEXT 2 // OBSOLETE
Stefan Reinauer5ae31752013-06-19 13:47:46 -0700205#define CB_TAG_CONSOLE_LOGBUF 3 // OBSOLETE
Stefan Reinauerabc0c852010-11-22 08:09:50 +0000206#define CB_TAG_CONSOLE_SROM 4 // OBSOLETE
Jordan Crousef6145c32008-03-19 23:56:58 +0000207#define CB_TAG_CONSOLE_EHCI 5
208
Stefan Reinauer5f7d5062009-03-17 16:41:01 +0000209struct cb_forward {
210 u32 tag;
211 u32 size;
212 u64 forward;
213};
214
Nicolas Boichat564720f2019-08-06 08:23:54 +0800215/* Panel orientation, matches drm_connector.h in the Linux kernel. */
216enum cb_fb_orientation {
217 CB_FB_ORIENTATION_NORMAL = 0,
218 CB_FB_ORIENTATION_BOTTOM_UP = 1,
219 CB_FB_ORIENTATION_LEFT_UP = 2,
220 CB_FB_ORIENTATION_RIGHT_UP = 3,
221};
222
Stefan Reinauerb7002542010-03-25 18:56:26 +0000223struct cb_framebuffer {
224 u32 tag;
225 u32 size;
226
227 u64 physical_address;
228 u32 x_resolution;
229 u32 y_resolution;
230 u32 bytes_per_line;
231 u8 bits_per_pixel;
Stefan Tauner3509ad32013-06-25 19:25:46 +0200232 u8 red_mask_pos;
Stefan Reinauerb7002542010-03-25 18:56:26 +0000233 u8 red_mask_size;
234 u8 green_mask_pos;
235 u8 green_mask_size;
236 u8 blue_mask_pos;
237 u8 blue_mask_size;
238 u8 reserved_mask_pos;
239 u8 reserved_mask_size;
Nicolas Boichat564720f2019-08-06 08:23:54 +0800240 u8 orientation;
Stefan Reinauerb7002542010-03-25 18:56:26 +0000241};
242
Gabe Black025667f2012-10-01 17:54:03 -0700243#define CB_GPIO_ACTIVE_LOW 0
244#define CB_GPIO_ACTIVE_HIGH 1
245#define CB_GPIO_MAX_NAME_LENGTH 16
Gabe Blackd3890cc2012-03-11 01:57:53 -0800246struct cb_gpio {
247 u32 port;
248 u32 polarity;
249 u32 value;
Gabe Black025667f2012-10-01 17:54:03 -0700250 u8 name[CB_GPIO_MAX_NAME_LENGTH];
Gabe Blackd3890cc2012-03-11 01:57:53 -0800251};
252
253struct cb_gpios {
254 u32 tag;
255 u32 size;
256
257 u32 count;
Elyes Haouasa434f482023-07-30 17:31:15 +0200258 struct cb_gpio gpios[];
Gabe Blackd3890cc2012-03-11 01:57:53 -0800259};
260
Jianjun Wangd16c2aa2022-03-31 15:34:34 +0800261struct cb_pcie {
262 uint32_t tag;
263 uint32_t size;
264 cb_uint64_t ctrl_base; /* Base address of PCIe controller */
265};
266
Julius Werner1f5487a2013-08-27 15:38:54 -0700267struct lb_range {
Gabe Blackd3890cc2012-03-11 01:57:53 -0800268 uint32_t tag;
Julius Werner1f5487a2013-08-27 15:38:54 -0700269 uint32_t size;
Jianjun Wangb2537bd2022-04-08 16:57:28 +0800270 cb_uint64_t range_start;
Julius Werner1f5487a2013-08-27 15:38:54 -0700271 uint32_t range_size;
Gabe Blackd3890cc2012-03-11 01:57:53 -0800272};
273
Gabe Blackd3890cc2012-03-11 01:57:53 -0800274struct cb_cbmem_tab {
275 uint32_t tag;
276 uint32_t size;
Jianjun Wangb2537bd2022-04-08 16:57:28 +0800277 cb_uint64_t cbmem_tab;
Gabe Blackd3890cc2012-03-11 01:57:53 -0800278};
279
Aaron Durbina09760e2013-03-26 13:34:37 -0500280struct cb_x86_rom_mtrr {
281 uint32_t tag;
282 uint32_t size;
283 /* The variable range MTRR index covering the ROM. If one wants to
284 * enable caching the ROM, the variable MTRR needs to be set to
285 * write-protect. To disable the caching after enabling set the
286 * type to uncacheable. */
287 uint32_t index;
288};
289
Furquan Shaikh493937e2020-11-25 17:15:09 -0800290/* Memory map windows to translate addresses between SPI flash space and host address space. */
291struct flash_mmap_window {
292 uint32_t flash_base;
293 uint32_t host_base;
294 uint32_t size;
295};
296
Dan Ehrenberg6addd402015-01-08 10:29:19 -0800297struct cb_spi_flash {
298 uint32_t tag;
299 uint32_t size;
300 uint32_t flash_size;
301 uint32_t sector_size;
302 uint32_t erase_cmd;
Furquan Shaikh493937e2020-11-25 17:15:09 -0800303 /*
304 * Number of mmap windows used by the platform to decode addresses between SPI flash
305 * space and host address space. This determines the number of entries in mmap_table.
306 */
307 uint32_t mmap_count;
Elyes Haouasa434f482023-07-30 17:31:15 +0200308 struct flash_mmap_window mmap_table[];
Dan Ehrenberg6addd402015-01-08 10:29:19 -0800309};
310
Patrick Georgif61b35d2015-07-14 17:15:24 +0100311struct cb_boot_media_params {
312 uint32_t tag;
313 uint32_t size;
314 /* offsets are relative to start of boot media */
Jianjun Wangb2537bd2022-04-08 16:57:28 +0800315 cb_uint64_t fmap_offset;
316 cb_uint64_t cbfs_offset;
317 cb_uint64_t cbfs_size;
318 cb_uint64_t boot_media_size;
Patrick Georgif61b35d2015-07-14 17:15:24 +0100319};
320
Jakub Czapiga2f236c22021-11-10 14:04:43 +0000321
322struct cb_cbmem_entry {
323 uint32_t tag;
324 uint32_t size;
325
Jianjun Wangb2537bd2022-04-08 16:57:28 +0800326 cb_uint64_t address;
Jakub Czapiga2f236c22021-11-10 14:04:43 +0000327 uint32_t entry_size;
328 uint32_t id;
329};
330
Aaron Durbin152e5a02016-02-10 11:01:49 -0600331struct cb_tsc_info {
332 uint32_t tag;
333 uint32_t size;
334
335 uint32_t freq_khz;
336};
337
Ronald G. Minnich8db7f8b2017-10-29 03:20:40 -0700338struct mac_address {
339 uint8_t mac_addr[6];
340 uint8_t pad[2]; /* Pad it to 8 bytes to keep it simple. */
341};
342
343struct cb_macs {
344 uint32_t tag;
345 uint32_t size;
346 uint32_t count;
Elyes Haouasa434f482023-07-30 17:31:15 +0200347 struct mac_address mac_addrs[];
Ronald G. Minnich8db7f8b2017-10-29 03:20:40 -0700348};
349
Bora Guvendikddf2bc52018-03-30 16:03:32 -0700350struct cb_mmc_info {
351 uint32_t tag;
352 uint32_t size;
353 /*
354 * Passes the early mmc status to payload to indicate if firmware
355 * successfully sent CMD0, CMD1 to the card or not. In case of
356 * success, the payload can skip the first step of the initialization
357 * sequence which is to send CMD0, and instead start by sending CMD1
358 * as described in Jedec Standard JESD83-B1 section 6.4.3.
359 * passes 1 on success
360 */
361 int32_t early_cmd1_status;
362};
363
Tim Wawrzynczake1a7a262020-10-09 17:07:45 -0600364struct cb_board_config {
365 uint32_t tag;
366 uint32_t size;
367
Jianjun Wangb2537bd2022-04-08 16:57:28 +0800368 cb_uint64_t fw_config;
Tim Wawrzynczake1a7a262020-10-09 17:07:45 -0600369 uint32_t board_id;
370 uint32_t ram_code;
371 uint32_t sku_id;
372};
373
Stephen Barberda262a632015-03-11 15:48:08 -0700374#define CB_MAX_SERIALNO_LENGTH 32
375
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000376struct cb_cmos_option_table {
377 u32 tag;
378 u32 size;
379 u32 header_length;
380};
381
Gabe Blackd94512e2012-10-01 18:05:50 -0700382#define CB_CMOS_MAX_NAME_LENGTH 32
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000383struct cb_cmos_entries {
384 u32 tag;
385 u32 size;
386 u32 bit;
387 u32 length;
388 u32 config;
389 u32 config_id;
Gabe Blackd94512e2012-10-01 18:05:50 -0700390 u8 name[CB_CMOS_MAX_NAME_LENGTH];
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000391};
392
Gabe Blackd94512e2012-10-01 18:05:50 -0700393#define CB_CMOS_MAX_TEXT_LENGTH 32
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000394struct cb_cmos_enums {
395 u32 tag;
396 u32 size;
397 u32 config_id;
398 u32 value;
Gabe Blackd94512e2012-10-01 18:05:50 -0700399 u8 text[CB_CMOS_MAX_TEXT_LENGTH];
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000400};
401
Gabe Blackd94512e2012-10-01 18:05:50 -0700402#define CB_CMOS_IMAGE_BUFFER_SIZE 128
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000403struct cb_cmos_defaults {
404 u32 tag;
405 u32 size;
406 u32 name_length;
Gabe Blackd94512e2012-10-01 18:05:50 -0700407 u8 name[CB_CMOS_MAX_NAME_LENGTH];
408 u8 default_set[CB_CMOS_IMAGE_BUFFER_SIZE];
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000409};
410
Gabe Blackd94512e2012-10-01 18:05:50 -0700411#define CB_CHECKSUM_NONE 0
412#define CB_CHECKSUM_PCBIOS 1
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +0000413struct cb_cmos_checksum {
414 u32 tag;
415 u32 size;
416 u32 range_start;
417 u32 range_end;
418 u32 location;
419 u32 type;
420};
Jordan Crousef6145c32008-03-19 23:56:58 +0000421
Arthur Heymanscddba452022-03-03 22:59:23 +0100422/*
423 * Handoff the ACPI RSDP
424 */
425struct cb_acpi_rsdp {
426 uint32_t tag;
427 uint32_t size;
Jianjun Wangb2537bd2022-04-08 16:57:28 +0800428 cb_uint64_t rsdp_pointer; /* Address of the ACPI RSDP */
Arthur Heymanscddba452022-03-03 22:59:23 +0100429};
430
431
Philip Prindeville46404d72011-12-23 17:09:02 -0700432/* Helpful inlines */
433
Philip Prindevillefe2f6b02011-12-23 17:22:05 -0700434static inline u16 cb_checksum(const void *ptr, unsigned len)
435{
436 return ipchksum(ptr, len);
437}
438
Philip Prindeville9a7c2462011-12-24 22:12:37 -0700439static inline const char *cb_mb_vendor_string(const struct cb_mainboard *cbm)
440{
441 return (char *)(cbm->strings + cbm->vendor_idx);
442}
443
444static inline const char *cb_mb_part_string(const struct cb_mainboard *cbm)
445{
446 return (char *)(cbm->strings + cbm->part_number_idx);
447}
448
Jordan Crousef6145c32008-03-19 23:56:58 +0000449/* Helpful macros */
450
451#define MEM_RANGE_COUNT(_rec) \
Uwe Hermann6a441bf2008-03-20 19:54:59 +0000452 (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0]))
Jordan Crousef6145c32008-03-19 23:56:58 +0000453
454#define MEM_RANGE_PTR(_rec, _idx) \
Philip Prindeville7d95b3e2011-12-23 17:53:26 -0700455 (void *)(((u8 *) (_rec)) + sizeof(*(_rec)) \
456 + (sizeof((_rec)->map[0]) * (_idx)))
Jordan Crousef6145c32008-03-19 23:56:58 +0000457
Jordan Crousef6145c32008-03-19 23:56:58 +0000458#endif