Commit 5abd9ccc authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft-2.6:
  ibft: Use IBFT_SIGN instead of open-coding the search string.
  ibft: convert iscsi_ibft module to iscsi boot lib
  ibft: separate ibft parsing from sysfs interface
  ibft: For UEFI machines actually do scan ACPI for iBFT.
  ibft: Update iBFT handling for v1.03 of the spec.
parents d5fc1d51 57a5f3c9
......@@ -122,8 +122,17 @@ config ISCSI_IBFT_FIND
is necessary for iSCSI Boot Firmware Table Attributes module to work
properly.
config ISCSI_BOOT_SYSFS
tristate "iSCSI Boot Sysfs Interface"
default n
help
This option enables support for exposing iSCSI boot information
via sysfs to userspace. If you wish to export this information,
say Y. Otherwise, say N.
config ISCSI_IBFT
tristate "iSCSI Boot Firmware Table Attributes module"
select ISCSI_BOOT_SYSFS
depends on ISCSI_IBFT_FIND
default n
help
......
......@@ -10,4 +10,5 @@ obj-$(CONFIG_DCDBAS) += dcdbas.o
obj-$(CONFIG_DMIID) += dmi-id.o
obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o
obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o
obj-$(CONFIG_ISCSI_BOOT_SYSFS) += iscsi_boot_sysfs.o
obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
This diff is collapsed.
This diff is collapsed.
/*
* Copyright 2007 Red Hat, Inc.
* Copyright 2007-2010 Red Hat, Inc.
* by Peter Jones <pjones@redhat.com>
* Copyright 2007 IBM, Inc.
* by Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
......@@ -22,6 +22,7 @@
#include <linux/blkdev.h>
#include <linux/ctype.h>
#include <linux/device.h>
#include <linux/efi.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/limits.h>
......@@ -30,13 +31,15 @@
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/acpi.h>
#include <linux/iscsi_ibft.h>
#include <asm/mmzone.h>
/*
* Physical location of iSCSI Boot Format Table.
*/
struct ibft_table_header *ibft_addr;
struct acpi_table_ibft *ibft_addr;
EXPORT_SYMBOL_GPL(ibft_addr);
#define IBFT_SIGN "iBFT"
......@@ -46,19 +49,20 @@ EXPORT_SYMBOL_GPL(ibft_addr);
#define VGA_MEM 0xA0000 /* VGA buffer */
#define VGA_SIZE 0x20000 /* 128kB */
#ifdef CONFIG_ACPI
static int __init acpi_find_ibft(struct acpi_table_header *header)
{
ibft_addr = (struct acpi_table_ibft *)header;
return 0;
}
#endif /* CONFIG_ACPI */
/*
* Routine used to find the iSCSI Boot Format Table. The logical
* kernel address is set in the ibft_addr global variable.
*/
unsigned long __init find_ibft_region(unsigned long *sizep)
static int __init find_ibft_in_mem(void)
{
unsigned long pos;
unsigned int len = 0;
void *virt;
ibft_addr = NULL;
for (pos = IBFT_START; pos < IBFT_END; pos += 16) {
/* The table can't be inside the VGA BIOS reserved space,
* so skip that area */
......@@ -72,14 +76,42 @@ unsigned long __init find_ibft_region(unsigned long *sizep)
/* if the length of the table extends past 1M,
* the table cannot be valid. */
if (pos + len <= (IBFT_END-1)) {
ibft_addr = (struct ibft_table_header *)virt;
ibft_addr = (struct acpi_table_ibft *)virt;
break;
}
}
}
return len;
}
/*
* Routine used to find the iSCSI Boot Format Table. The logical
* kernel address is set in the ibft_addr global variable.
*/
unsigned long __init find_ibft_region(unsigned long *sizep)
{
ibft_addr = NULL;
#ifdef CONFIG_ACPI
/*
* One spec says "IBFT", the other says "iBFT". We have to check
* for both.
*/
if (!ibft_addr)
acpi_table_parse(ACPI_SIG_IBFT, acpi_find_ibft);
if (!ibft_addr)
acpi_table_parse(IBFT_SIGN, acpi_find_ibft);
#endif /* CONFIG_ACPI */
/* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will
* only use ACPI for this */
if (!ibft_addr && !efi_enabled)
find_ibft_in_mem();
if (ibft_addr) {
*sizep = PAGE_ALIGN(len);
return pos;
*sizep = PAGE_ALIGN(ibft_addr->header.length);
return (u64)isa_virt_to_bus(ibft_addr);
}
*sizep = 0;
......
/*
* Export the iSCSI boot info to userland via sysfs.
*
* Copyright (C) 2010 Red Hat, Inc. All rights reserved.
* Copyright (C) 2010 Mike Christie
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License v2.0 as published by
* the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _ISCSI_BOOT_SYSFS_
#define _ISCSI_BOOT_SYSFS_
/*
* The text attributes names for each of the kobjects.
*/
enum iscsi_boot_eth_properties_enum {
ISCSI_BOOT_ETH_INDEX,
ISCSI_BOOT_ETH_FLAGS,
ISCSI_BOOT_ETH_IP_ADDR,
ISCSI_BOOT_ETH_SUBNET_MASK,
ISCSI_BOOT_ETH_ORIGIN,
ISCSI_BOOT_ETH_GATEWAY,
ISCSI_BOOT_ETH_PRIMARY_DNS,
ISCSI_BOOT_ETH_SECONDARY_DNS,
ISCSI_BOOT_ETH_DHCP,
ISCSI_BOOT_ETH_VLAN,
ISCSI_BOOT_ETH_MAC,
/* eth_pci_bdf - this is replaced by link to the device itself. */
ISCSI_BOOT_ETH_HOSTNAME,
ISCSI_BOOT_ETH_END_MARKER,
};
enum iscsi_boot_tgt_properties_enum {
ISCSI_BOOT_TGT_INDEX,
ISCSI_BOOT_TGT_FLAGS,
ISCSI_BOOT_TGT_IP_ADDR,
ISCSI_BOOT_TGT_PORT,
ISCSI_BOOT_TGT_LUN,
ISCSI_BOOT_TGT_CHAP_TYPE,
ISCSI_BOOT_TGT_NIC_ASSOC,
ISCSI_BOOT_TGT_NAME,
ISCSI_BOOT_TGT_CHAP_NAME,
ISCSI_BOOT_TGT_CHAP_SECRET,
ISCSI_BOOT_TGT_REV_CHAP_NAME,
ISCSI_BOOT_TGT_REV_CHAP_SECRET,
ISCSI_BOOT_TGT_END_MARKER,
};
enum iscsi_boot_initiator_properties_enum {
ISCSI_BOOT_INI_INDEX,
ISCSI_BOOT_INI_FLAGS,
ISCSI_BOOT_INI_ISNS_SERVER,
ISCSI_BOOT_INI_SLP_SERVER,
ISCSI_BOOT_INI_PRI_RADIUS_SERVER,
ISCSI_BOOT_INI_SEC_RADIUS_SERVER,
ISCSI_BOOT_INI_INITIATOR_NAME,
ISCSI_BOOT_INI_END_MARKER,
};
struct attribute_group;
struct iscsi_boot_kobj {
struct kobject kobj;
struct attribute_group *attr_group;
struct list_head list;
/*
* Pointer to store driver specific info. If set this will
* be freed for the LLD when the kobj release function is called.
*/
void *data;
/*
* Driver specific show function.
*
* The enum of the type. This can be any value of the above
* properties.
*/
ssize_t (*show) (void *data, int type, char *buf);
/*
* Drivers specific visibility function.
* The function should return if they the attr should be readable
* writable or should not be shown.
*
* The enum of the type. This can be any value of the above
* properties.
*/
mode_t (*is_visible) (void *data, int type);
};
struct iscsi_boot_kset {
struct list_head kobj_list;
struct kset *kset;
};
struct iscsi_boot_kobj *
iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
void *data,
ssize_t (*show) (void *data, int type, char *buf),
mode_t (*is_visible) (void *data, int type));
struct iscsi_boot_kobj *
iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
void *data,
ssize_t (*show) (void *data, int type, char *buf),
mode_t (*is_visible) (void *data, int type));
struct iscsi_boot_kobj *
iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
void *data,
ssize_t (*show) (void *data, int type, char *buf),
mode_t (*is_visible) (void *data, int type));
struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset);
#endif
......@@ -21,21 +21,13 @@
#ifndef ISCSI_IBFT_H
#define ISCSI_IBFT_H
struct ibft_table_header {
char signature[4];
u32 length;
u8 revision;
u8 checksum;
char oem_id[6];
char oem_table_id[8];
char reserved[24];
} __attribute__((__packed__));
#include <acpi/acpi.h>
/*
* Logical location of iSCSI Boot Format Table.
* If the value is NULL there is no iBFT on the machine.
*/
extern struct ibft_table_header *ibft_addr;
extern struct acpi_table_ibft *ibft_addr;
/*
* Routine used to find and reserve the iSCSI Boot Format Table. The
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment