blob: ba54206ccf4633d3b1a183a40f46f501901ab62c [file] [log] [blame]
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +00001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2009 Carl-Daniel Hailfinger
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <stdint.h>
22#include <string.h>
23#include <stdlib.h>
24#include <fcntl.h>
25#include <sys/types.h>
26#include <sys/stat.h>
27#include <errno.h>
28#include <pci/pci.h>
29#include "flash.h"
30
31int dummy_init(void)
32{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000033 printf_debug("%s\n", __func__);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000034 return 0;
35}
36
37int dummy_shutdown(void)
38{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000039 printf_debug("%s\n", __func__);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000040 return 0;
41}
42
Carl-Daniel Hailfinger1455b2b2009-05-11 14:13:25 +000043void *dummy_map(const char *descr, unsigned long phys_addr, size_t len)
44{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000045 printf_debug("%s: Mapping %s, 0x%lx bytes at 0x%08lx\n",
Carl-Daniel Hailfinger1455b2b2009-05-11 14:13:25 +000046 __func__, descr, (unsigned long)len, phys_addr);
47 return (void *)phys_addr;
48}
49
50void dummy_unmap(void *virt_addr, size_t len)
51{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000052 printf_debug("%s: Unmapping 0x%lx bytes at %p\n",
Carl-Daniel Hailfinger1455b2b2009-05-11 14:13:25 +000053 __func__, (unsigned long)len, virt_addr);
54}
55
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000056void dummy_chip_writeb(uint8_t val, volatile void *addr)
57{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000058 printf_debug("%s: addr=%p, val=0x%02x\n", __func__, addr, val);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000059}
60
61void dummy_chip_writew(uint16_t val, volatile void *addr)
62{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000063 printf_debug("%s: addr=%p, val=0x%04x\n", __func__, addr, val);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000064}
65
66void dummy_chip_writel(uint32_t val, volatile void *addr)
67{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000068 printf_debug("%s: addr=%p, val=0x%08x\n", __func__, addr, val);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000069}
70
71uint8_t dummy_chip_readb(const volatile void *addr)
72{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000073 printf_debug("%s: addr=%p, returning 0xff\n", __func__, addr);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000074 return 0xff;
75}
76
77uint16_t dummy_chip_readw(const volatile void *addr)
78{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000079 printf_debug("%s: addr=%p, returning 0xffff\n", __func__, addr);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000080 return 0xffff;
81}
82
83uint32_t dummy_chip_readl(const volatile void *addr)
84{
Carl-Daniel Hailfinger1e334e62009-05-11 15:46:43 +000085 printf_debug("%s: addr=%p, returning 0xffffffff\n", __func__, addr);
Carl-Daniel Hailfingerc3129202009-05-09 00:54:55 +000086 return 0xffffffff;
87}
88