2 * This file is part of the coreboot project.
4 * Copyright (C) 2000 AG Electronics Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
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.
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
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <console/console.h>
25 static flash_device *first_flash = 0;
27 int register_flash_device (const flash_fn * fn, char *tag, void *data)
29 flash_device *device = malloc (sizeof (flash_device));
37 if ((result = fn->identify(device)) != 0)
39 printk_info("Registered flash %s\n", result);
40 device->next = first_flash;
43 return result ? 0 : -1;
48 flash_device *find_flash_device(const char *name)
50 int len = strlen(name);
56 for (flash = first_flash; flash; flash = flash->next)
57 if (strlen(flash->tag) == len && memcmp(name, flash->tag, len) == 0)
60 printk_info ("No flash %s registered\n", name);