2 * Common Option ROM Functions
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Copyright Novell Inc, 2009
18 * Authors: Alexander Graf <agraf@suse.de>
22 #include "../../include/hw/nvram/fw_cfg_keys.h"
24 #define BIOS_CFG_IOPORT_CFG 0x510
25 #define BIOS_CFG_IOPORT_DATA 0x511
27 /* Break the translation block flow so -d cpu shows us values */
33 * Read a variable from the fw_cfg device.
39 mov $BIOS_CFG_IOPORT_CFG
, %dx
41 mov $BIOS_CFG_IOPORT_DATA
, %dx
52 #define read_fw_blob_pre(var) \
53 read_fw var ## _SIZE; \
55 mov $var ## _DATA, %ax; \
56 mov $BIOS_CFG_IOPORT_CFG, %edx; \
58 mov $BIOS_CFG_IOPORT_DATA, %dx; \
62 * Read a blob from the fw_cfg device.
63 * Requires _ADDR, _SIZE and _DATA values for the parameter.
65 * Clobbers: %eax, %edx, %es, %ecx, %edi
67 #define read_fw_blob(var) \
68 read_fw var ## _ADDR; \
70 read_fw_blob_pre(var); \
71 /* old as(1) doesn't like this insn so emit the bytes instead: \
72 rep insb (%dx), %es:(%edi); \
77 * Read a blob from the fw_cfg device in forced addr32 mode.
78 * Requires _ADDR, _SIZE and _DATA values for the parameter.
80 * Clobbers: %eax, %edx, %es, %ecx, %edi
82 #define read_fw_blob_addr32(var) \
83 read_fw var ## _ADDR; \
85 read_fw_blob_pre(var); \
86 /* old as(1) doesn't like this insn so emit the bytes instead: \
87 addr32 rep insb (%dx), %es:(%edi); \
92 * Read a blob from the fw_cfg device in forced addr32 mode, address is in %edi.
93 * Requires _SIZE and _DATA values for the parameter.
95 * Clobbers: %eax, %edx, %edi, %es, %ecx
97 #define read_fw_blob_addr32_edi(var) \
98 read_fw_blob_pre(var); \
99 /* old as(1) doesn't like this insn so emit the bytes instead: \
100 addr32 rep insb (%dx), %es:(%edi); \
104 #define OPTION_ROM_START \
110 .byte (_end - _start) / 512;
112 #define BOOT_ROM_START \
121 .byte ( _pnph_len / 16 ); \
126 .short _manufacturer; \
134 .equ _pnph_len, . - _pnph; \
140 #define OPTION_ROM_END \
145 #define BOOT_ROM_END \
149 .asciz BOOT_ROM_PRODUCT; \