Gabe Black | 396b072 | 2013-09-26 16:22:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Aaron Durbin | c6588c5 | 2015-05-15 13:15:34 -0500 | [diff] [blame^] | 4 | * Copyright 2015 Google Inc. |
Gabe Black | 396b072 | 2013-09-26 16:22:09 -0700 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 17 | * Foundation, Inc. |
Gabe Black | 396b072 | 2013-09-26 16:22:09 -0700 | [diff] [blame] | 18 | */ |
| 19 | |
Aaron Durbin | c6588c5 | 2015-05-15 13:15:34 -0500 | [diff] [blame^] | 20 | #include <boot_device.h> |
Gabe Black | 396b072 | 2013-09-26 16:22:09 -0700 | [diff] [blame] | 21 | |
Aaron Durbin | c6588c5 | 2015-05-15 13:15:34 -0500 | [diff] [blame^] | 22 | /* The ROM is memory mapped just below 4GiB. Form a pointer for the base. */ |
| 23 | #define rom_base ((void *)(uintptr_t)(-(int32_t)CONFIG_ROM_SIZE)) |
Gabe Black | 396b072 | 2013-09-26 16:22:09 -0700 | [diff] [blame] | 24 | |
Aaron Durbin | c6588c5 | 2015-05-15 13:15:34 -0500 | [diff] [blame^] | 25 | static const struct mem_region_device boot_dev = |
| 26 | MEM_REGION_DEV_INIT(rom_base, CONFIG_ROM_SIZE); |
| 27 | |
| 28 | const struct region_device *boot_device_ro(void) |
Gabe Black | 396b072 | 2013-09-26 16:22:09 -0700 | [diff] [blame] | 29 | { |
Aaron Durbin | c6588c5 | 2015-05-15 13:15:34 -0500 | [diff] [blame^] | 30 | return &boot_dev.rdev; |
Gabe Black | 396b072 | 2013-09-26 16:22:09 -0700 | [diff] [blame] | 31 | } |