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 #define NO_QEMU_PROTOS
23 #include "../../include/hw/nvram/fw_cfg.h"
25 #define BIOS_CFG_IOPORT_CFG 0x510
26 #define BIOS_CFG_IOPORT_DATA 0x511
28 /* Break the translation block flow so -d cpu shows us values */
34 * Read a variable from the fw_cfg device.
40 mov $BIOS_CFG_IOPORT_CFG
, %dx
42 mov $BIOS_CFG_IOPORT_DATA
, %dx
53 #define read_fw_blob_pre(var) \
54 read_fw var ## _SIZE; \
56 mov $var ## _DATA, %ax; \
57 mov $BIOS_CFG_IOPORT_CFG, %edx; \
59 mov $BIOS_CFG_IOPORT_DATA, %dx; \
63 * Read a blob from the fw_cfg device.
64 * Requires _ADDR, _SIZE and _DATA values for the parameter.
66 * Clobbers: %eax, %edx, %es, %ecx, %edi
68 #define read_fw_blob(var) \
69 read_fw var ## _ADDR; \
71 read_fw_blob_pre(var); \
72 /* old as(1) doesn't like this insn so emit the bytes instead: \
73 rep insb (%dx), %es:(%edi); \
78 * Read a blob from the fw_cfg device in forced addr32 mode.
79 * Requires _ADDR, _SIZE and _DATA values for the parameter.
81 * Clobbers: %eax, %edx, %es, %ecx, %edi
83 #define read_fw_blob_addr32(var) \
84 read_fw var ## _ADDR; \
86 read_fw_blob_pre(var); \
87 /* old as(1) doesn't like this insn so emit the bytes instead: \
88 addr32 rep insb (%dx), %es:(%edi); \
93 * Read a blob from the fw_cfg device in forced addr32 mode, address is in %edi.
94 * Requires _SIZE and _DATA values for the parameter.
96 * Clobbers: %eax, %edx, %edi, %es, %ecx
98 #define read_fw_blob_addr32_edi(var) \
99 read_fw_blob_pre(var); \
100 /* old as(1) doesn't like this insn so emit the bytes instead: \
101 addr32 rep insb (%dx), %es:(%edi); \
105 #define OPTION_ROM_START \
111 .byte (_end - _start) / 512;
113 #define BOOT_ROM_START \
122 .byte ( _pnph_len / 16 ); \
127 .short _manufacturer; \
135 .equ _pnph_len, . - _pnph; \
141 #define OPTION_ROM_END \
146 #define BOOT_ROM_END \
150 .asciz BOOT_ROM_PRODUCT; \