summaryrefslogtreecommitdiffstats
path: root/arch/x86/boards/x86_generic/disk_bios_drive.c
blob: c8e9ae85232a7f2a2e5c4528370f0b2f96d6b259 (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
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix

/**
 * @file
 * @brief Generic PC support for the BIOS disk interface
 */

#include <common.h>
#include <driver.h>
#include <init.h>
#include <linux/err.h>
#include "envsector.h"

static int bios_disk_init(void)
{
	struct cdev *cdev;

	add_generic_device("biosdrive", DEVICE_ID_DYNAMIC, NULL, 0, 0,
			   IORESOURCE_MEM, NULL);

	if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) {
		cdev = devfs_add_partition("biosdisk0",
				pers_env_storage * 512,
				(unsigned)pers_env_size * 512,
				DEVFS_PARTITION_FIXED, "env0");
		printf("Partition: %ld\n", IS_ERR(cdev) ? PTR_ERR(cdev) : 0);
	} else
		printf("No persistent storage defined\n");

	return 0;
}
device_initcall(bios_disk_init);