summaryrefslogtreecommitdiff
path: root/lib/vbexport/boot_device_ide.c
blob: 7e8ee922b43f11a2c72d7ea01ca145955029cac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 */

#include <common.h>
#include <ide.h>

#include "boot_device.h"

#include <vboot_api.h>

static int boot_device_ide_start(uint32_t disk_flags)
{
	/* We expect to have at least one IDE device */
	return 1;
}

static int boot_device_ide_scan(block_dev_desc_t **desc, int max_devs,
			 uint32_t disk_flags)
{
	int index, found;

	for (index = found = 0; index < max_devs; index++) {
		block_dev_desc_t *ide;

		ide = ide_get_dev(index);
		if (!ide)
			continue;

		desc[found++] = ide;
	}
	return found;
}

static struct boot_interface ide_interface = {
	.name = "ide",
	.type = IF_TYPE_IDE,
	.start = boot_device_ide_start,
	.scan = boot_device_ide_scan,
};

int boot_device_ide_probe(void)
{
	return boot_device_register_interface(&ide_interface);
}