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 FW_CFG_KERNEL_ADDR 0x07
23 #define FW_CFG_KERNEL_SIZE 0x08
24 #define FW_CFG_KERNEL_CMDLINE 0x09
25 #define FW_CFG_INITRD_ADDR 0x0a
26 #define FW_CFG_INITRD_SIZE 0x0b
27 #define FW_CFG_KERNEL_ENTRY 0x10
28 #define FW_CFG_KERNEL_DATA 0x11
29 #define FW_CFG_INITRD_DATA 0x12
30 #define FW_CFG_CMDLINE_ADDR 0x13
31 #define FW_CFG_CMDLINE_SIZE 0x14
32 #define FW_CFG_CMDLINE_DATA 0x15
33 #define FW_CFG_SETUP_ADDR 0x16
34 #define FW_CFG_SETUP_SIZE 0x17
35 #define FW_CFG_SETUP_DATA 0x18
37 #define BIOS_CFG_IOPORT_CFG 0x510
38 #define BIOS_CFG_IOPORT_DATA 0x511
40 /* Break the translation block flow so -d cpu shows us values */
46 * Read a variable from the fw_cfg device.
52 mov $BIOS_CFG_IOPORT_CFG
, %dx
54 mov $BIOS_CFG_IOPORT_DATA
, %dx
65 #define read_fw_blob_pre(var) \
66 read_fw var ## _SIZE; \
68 mov $var ## _DATA, %ax; \
69 mov $BIOS_CFG_IOPORT_CFG, %edx; \
71 mov $BIOS_CFG_IOPORT_DATA, %dx; \
75 * Read a blob from the fw_cfg device.
76 * Requires _ADDR, _SIZE and _DATA values for the parameter.
78 * Clobbers: %eax, %edx, %es, %ecx, %edi
80 #define read_fw_blob(var) \
81 read_fw var ## _ADDR; \
83 read_fw_blob_pre(var); \
84 /* old as(1) doesn't like this insn so emit the bytes instead: \
85 rep insb (%dx), %es:(%edi); \
90 * Read a blob from the fw_cfg device in forced addr32 mode.
91 * Requires _ADDR, _SIZE and _DATA values for the parameter.
93 * Clobbers: %eax, %edx, %es, %ecx, %edi
95 #define read_fw_blob_addr32(var) \
96 read_fw var ## _ADDR; \
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); \
105 * Read a blob from the fw_cfg device in forced addr32 mode, address is in %edi.
106 * Requires _SIZE and _DATA values for the parameter.
108 * Clobbers: %eax, %edx, %edi, %es, %ecx
110 #define read_fw_blob_addr32_edi(var) \
111 read_fw_blob_pre(var); \
112 /* old as(1) doesn't like this insn so emit the bytes instead: \
113 addr32 rep insb (%dx), %es:(%edi); \
117 #define OPTION_ROM_START \
123 .byte (_end - _start) / 512;
125 #define BOOT_ROM_START \
134 .byte ( _pnph_len / 16 ); \
139 .short _manufacturer; \
147 .equ _pnph_len, . - _pnph; \
153 #define OPTION_ROM_END \
158 #define BOOT_ROM_END \
162 .asciz BOOT_ROM_PRODUCT; \