Netdev List
 help / color / mirror / Atom feed
* [PATCH 4/4] net: Add ->neigh_lookup() operation to dst_ops
From: David Miller @ 2011-07-18  8:25 UTC (permalink / raw)
  To: netdev


In the future dst entries will be neigh-less.  In that environment we
need to have an easy transition point for current users of
dst->neighbour outside of the packet output fast path.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/arp.h         |    9 ---------
 include/net/dst.h         |    5 +++++
 include/net/dst_ops.h     |    1 +
 net/bridge/br_netfilter.c |    6 ++++++
 net/decnet/dn_route.c     |    7 +++++++
 net/ipv4/route.c          |   26 +++++++++++++++++++-------
 net/ipv6/route.c          |    7 +++++++
 net/xfrm/xfrm_policy.c    |    7 +++++++
 8 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/include/net/arp.h b/include/net/arp.h
index 5e669e6..4979af8 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -38,15 +38,6 @@ static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, str
 	return n;
 }
 
-static inline struct neighbour *ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, const __be32 *pkey)
-{
-	struct neighbour *n = __ipv4_neigh_lookup(tbl, dev,
-						  *(__force u32 *)pkey);
-	if (n)
-		return n;
-	return neigh_create(tbl, pkey, dev);
-}
-
 extern void	arp_init(void);
 extern int	arp_find(unsigned char *haddr, struct sk_buff *skb);
 extern int	arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
diff --git a/include/net/dst.h b/include/net/dst.h
index 8147206..29e2557 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -387,6 +387,11 @@ static inline void dst_confirm(struct dst_entry *dst)
 	}
 }
 
+static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
+{
+	return dst->ops->neigh_lookup(dst, daddr);
+}
+
 static inline void dst_link_failure(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb_dst(skb);
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index dc07463..9adb998 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -26,6 +26,7 @@ struct dst_ops {
 	void			(*link_failure)(struct sk_buff *);
 	void			(*update_pmtu)(struct dst_entry *dst, u32 mtu);
 	int			(*local_out)(struct sk_buff *skb);
+	struct neighbour *	(*neigh_lookup)(const struct dst_entry *dst, const void *daddr);
 
 	struct kmem_cache	*kmem_cachep;
 
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index b1a5f97..d6ec372 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -109,11 +109,17 @@ static u32 *fake_cow_metrics(struct dst_entry *dst, unsigned long old)
 	return NULL;
 }
 
+static struct neighbour *fake_neigh_lookup(const struct dst_entry *dst, const void *daddr)
+{
+	return NULL;
+}
+
 static struct dst_ops fake_dst_ops = {
 	.family =		AF_INET,
 	.protocol =		cpu_to_be16(ETH_P_IP),
 	.update_pmtu =		fake_update_pmtu,
 	.cow_metrics =		fake_cow_metrics,
+	.neigh_lookup =		fake_neigh_lookup,
 };
 
 /*
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 9bd45fc..43450c1 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -116,6 +116,7 @@ static void dn_dst_destroy(struct dst_entry *);
 static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
 static void dn_dst_link_failure(struct sk_buff *);
 static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu);
+static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr);
 static int dn_route_input(struct sk_buff *);
 static void dn_run_flush(unsigned long dummy);
 
@@ -139,6 +140,7 @@ static struct dst_ops dn_dst_ops = {
 	.negative_advice =	dn_dst_negative_advice,
 	.link_failure =		dn_dst_link_failure,
 	.update_pmtu =		dn_dst_update_pmtu,
+	.neigh_lookup =		dn_dst_neigh_lookup,
 };
 
 static void dn_dst_destroy(struct dst_entry *dst)
@@ -827,6 +829,11 @@ static unsigned int dn_dst_default_mtu(const struct dst_entry *dst)
 	return dst->dev->mtu;
 }
 
+static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
+{
+	return __neigh_lookup_errno(&dn_neigh_table, daddr, dst->dev);
+}
+
 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
 {
 	struct dn_fib_info *fi = res->fi;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1d4cd3b..3313730 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -185,6 +185,8 @@ static u32 *ipv4_cow_metrics(struct dst_entry *dst, unsigned long old)
 	return p;
 }
 
+static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const void *daddr);
+
 static struct dst_ops ipv4_dst_ops = {
 	.family =		AF_INET,
 	.protocol =		cpu_to_be16(ETH_P_IP),
@@ -199,6 +201,7 @@ static struct dst_ops ipv4_dst_ops = {
 	.link_failure =		ipv4_link_failure,
 	.update_pmtu =		ip_rt_update_pmtu,
 	.local_out =		__ip_local_out,
+	.neigh_lookup =		ipv4_neigh_lookup,
 };
 
 #define ECN_OR_COST(class)	TC_PRIO_##class
@@ -1008,22 +1011,30 @@ static int slow_chain_length(const struct rtable *head)
 	return length >> FRACT_BITS;
 }
 
-static int rt_bind_neighbour(struct rtable *rt)
+static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const void *daddr)
 {
-	static const __be32 inaddr_any = 0;
-	struct net_device *dev = rt->dst.dev;
 	struct neigh_table *tbl = &arp_tbl;
-	const __be32 *nexthop;
+	static const __be32 inaddr_any = 0;
+	struct net_device *dev = dst->dev;
+	const __be32 *pkey = daddr;
 	struct neighbour *n;
 
 #if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
 	if (dev->type == ARPHRD_ATM)
 		tbl = clip_tbl_hook;
 #endif
-	nexthop = &rt->rt_gateway;
 	if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))
-		nexthop = &inaddr_any;
-	n = ipv4_neigh_lookup(tbl, dev, nexthop);
+		pkey = &inaddr_any;
+
+	n = __ipv4_neigh_lookup(tbl, dev, *(__force u32 *)pkey);
+	if (n)
+		return n;
+	return neigh_create(tbl, pkey, dev);
+}
+
+static int rt_bind_neighbour(struct rtable *rt)
+{
+	struct neighbour *n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway);
 	if (IS_ERR(n))
 		return PTR_ERR(n);
 	dst_set_neighbour(&rt->dst, n);
@@ -2734,6 +2745,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
 	.default_advmss		=	ipv4_default_advmss,
 	.update_pmtu		=	ipv4_rt_blackhole_update_pmtu,
 	.cow_metrics		=	ipv4_rt_blackhole_cow_metrics,
+	.neigh_lookup		=	ipv4_neigh_lookup,
 };
 
 struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2998cb5..ddef80f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -127,6 +127,11 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
 	return p;
 }
 
+static struct neighbour *ip6_neigh_lookup(const struct dst_entry *dst, const void *daddr)
+{
+	return __neigh_lookup_errno(&nd_tbl, daddr, dst->dev);
+}
+
 static struct dst_ops ip6_dst_ops_template = {
 	.family			=	AF_INET6,
 	.protocol		=	cpu_to_be16(ETH_P_IPV6),
@@ -142,6 +147,7 @@ static struct dst_ops ip6_dst_ops_template = {
 	.link_failure		=	ip6_link_failure,
 	.update_pmtu		=	ip6_rt_update_pmtu,
 	.local_out		=	__ip6_local_out,
+	.neigh_lookup		=	ip6_neigh_lookup,
 };
 
 static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst)
@@ -168,6 +174,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
 	.default_advmss		=	ip6_default_advmss,
 	.update_pmtu		=	ip6_rt_blackhole_update_pmtu,
 	.cow_metrics		=	ip6_rt_blackhole_cow_metrics,
+	.neigh_lookup		=	ip6_neigh_lookup,
 };
 
 static const u32 ip6_template_metrics[RTAX_MAX] = {
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 7803eb6..94fdcc7 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2385,6 +2385,11 @@ static unsigned int xfrm_default_mtu(const struct dst_entry *dst)
 	return dst_mtu(dst->path);
 }
 
+static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr)
+{
+	return dst_neigh_lookup(dst->path, daddr);
+}
+
 int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
 {
 	struct net *net;
@@ -2410,6 +2415,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
 			dst_ops->negative_advice = xfrm_negative_advice;
 		if (likely(dst_ops->link_failure == NULL))
 			dst_ops->link_failure = xfrm_link_failure;
+		if (likely(dst_ops->neigh_lookup == NULL))
+			dst_ops->neigh_lookup = xfrm_neigh_lookup;
 		if (likely(afinfo->garbage_collect == NULL))
 			afinfo->garbage_collect = __xfrm_garbage_collect;
 		xfrm_policy_afinfo[afinfo->family] = afinfo;
-- 
1.7.6


^ permalink raw reply related

* [PATCH 43/45] bna: Dropped BUG_ONs and Rx id init fix
From: Rasesh Mody @ 2011-07-18  8:23 UTC (permalink / raw)
  To: davem, netdev; +Cc: adapter_linux_open_src_team, dradovan, Rasesh Mody
In-Reply-To: <1310977385-5268-1-git-send-email-rmody@brocade.com>

Change details:
 - Removed some BUG_ONs and comments addition/cleanup
 - Initializing rx_id to 0 for bnad_cleanup_rx
 - Releasing all the locks while doing free_netdev
 - Counting the Rx buffer allocation failures in bnad_alloc_n_post_rxbufs()

Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
 drivers/net/bna/bna_hw.h |    1 +
 drivers/net/bna/bnad.c   |   32 ++++++++++++++++++++------------
 drivers/net/bna/bnad.h   |   15 ++++++++-------
 3 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/bna/bna_hw.h b/drivers/net/bna/bna_hw.h
index 80b21ee..552e8b1 100644
--- a/drivers/net/bna/bna_hw.h
+++ b/drivers/net/bna/bna_hw.h
@@ -99,6 +99,7 @@
 	(_bna)->bits.error_status_bits = (__HFN_INT_ERR_MASK);		\
 	(_bna)->bits.error_mask_bits = (__HFN_INT_ERR_MASK);		\
 	(_bna)->bits.halt_status_bits = __HFN_INT_LL_HALT;		\
+	(_bna)->bits.halt_mask_bits = __HFN_INT_LL_HALT;		\
 }
 
 #define ct2_reg_addr_init(_bna, _pcidev)				\
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index 6128045..68cd328 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -408,6 +408,7 @@ bnad_alloc_n_post_rxbufs(struct bnad *bnad, struct bna_rcb *rcb)
 						rcb->rxq->buffer_size);
 		if (unlikely(!skb)) {
 			BNAD_UPDATE_CTR(bnad, rxbuf_alloc_failed);
+			rcb->rxq->rxbuf_alloc_failed++;
 			goto finishing;
 		}
 		unmap_array[unmap_prod].skb = skb;
@@ -1913,6 +1914,7 @@ bnad_cleanup_rx(struct bnad *bnad, u32 rx_id)
 	spin_unlock_irqrestore(&bnad->bna_lock, flags);
 
 	rx_info->rx = NULL;
+	rx_info->rx_id = 0;
 
 	bnad_rx_res_free(bnad, res_info);
 }
@@ -1968,8 +1970,10 @@ bnad_setup_rx(struct bnad *bnad, u32 rx_id)
 	rx = bna_rx_create(&bnad->bna, bnad, rx_config, &rx_cbfn, res_info,
 			rx_info);
 	spin_unlock_irqrestore(&bnad->bna_lock, flags);
-	if (!rx)
+	if (!rx) {
+		err = -ENOMEM;
 		goto err_return;
+	}
 	rx_info->rx = rx;
 
 	/*
@@ -2102,8 +2106,6 @@ bnad_restore_vlans(struct bnad *bnad, u32 rx_id)
 	if (!bnad->vlan_grp)
 		return;
 
-	BUG_ON(!(VLAN_N_VID == (BFI_ENET_VLAN_ID_MAX + 1)));
-
 	for (vlan_id = 0; vlan_id < VLAN_N_VID; vlan_id++) {
 		if (!vlan_group_get_device(bnad->vlan_grp, vlan_id))
 			continue;
@@ -2214,9 +2216,6 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb)
 {
 	int err;
 
-	/* SKB_GSO_TCPV4 and SKB_GSO_TCPV6 is defined since 2.6.18. */
-	BUG_ON(!(skb_shinfo(skb)->gso_type == SKB_GSO_TCPV4 ||
-		   skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6));
 	if (skb_header_cloned(skb)) {
 		err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
 		if (err) {
@@ -2243,7 +2242,6 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb)
 	} else {
 		struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 
-		BUG_ON(!(skb->protocol == htons(ETH_P_IPV6)));
 		ipv6h->payload_len = 0;
 		tcp_hdr(skb)->check =
 			~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, 0,
@@ -2583,7 +2581,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 	unmap_q = tcb->unmap_q;
 	/*
 	 * Takes care of the Tx that is scheduled between clearing the flag
-	 * and the netif_stop_all_queue() call.
+	 * and the netif_tx_stop_all_queues() call.
 	 */
 	BNAD_DROP_AND_RETURN_IF(!test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags),
 				tx_skb_stopping);
@@ -2631,7 +2629,6 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 
 	txq_prod = tcb->producer_index;
 	BNA_TXQ_QPGE_PTR_GET(txq_prod, tcb->sw_qpt, txqent, wi_range);
-	BUG_ON(!(wi_range <= tcb->q_depth));
 	txqent->hdr.wi.reserved = 0;
 	txqent->hdr.wi.num_vectors = vectors;
 
@@ -2947,7 +2944,7 @@ unlock:
  * conf_lock cannot be used since this call may be made
  * in a non-blocking context.
  */
-static int
+int
 bnad_set_mac_address(struct net_device *netdev, void *mac_addr)
 {
 	int err;
@@ -3069,6 +3066,12 @@ bnad_netpoll(struct net_device *netdev)
 		bnad_isr(bnad->pcidev->irq, netdev);
 		bna_intx_enable(&bnad->bna, curr_mask);
 	} else {
+		/*
+		 * Tx processing may happen in sending context, so no need
+		 * to explicitly process completions here
+		 */
+
+		/* Rx processing */
 		for (i = 0; i < bnad->num_rx; i++) {
 			rx_info = &bnad->rx_info[i];
 			if (!rx_info->rx)
@@ -3262,7 +3265,7 @@ static int __devinit
 bnad_pci_probe(struct pci_dev *pdev,
 		const struct pci_device_id *pcidev_id)
 {
-	bool	using_dac = false;
+	bool	using_dac;
 	int	err;
 	struct bnad *bnad;
 	struct bna *bna;
@@ -3385,6 +3388,11 @@ bnad_pci_probe(struct pci_dev *pdev,
 			bna_num_rxp_set(bna, BNAD_NUM_RXP + 1))
 			err = -EIO;
 	}
+	spin_unlock_irqrestore(&bnad->bna_lock, flags);
+	if (err)
+		goto disable_ioceth;
+
+	spin_lock_irqsave(&bnad->bna_lock, flags);
 	bna_mod_res_req(&bnad->bna, &bnad->mod_res_info[0]);
 	spin_unlock_irqrestore(&bnad->bna_lock, flags);
 
@@ -3436,9 +3444,9 @@ drv_uninit:
 	bnad_uninit(bnad);
 pci_uninit:
 	bnad_pci_uninit(pdev);
+free_netdev:
 	mutex_unlock(&bnad->conf_mutex);
 	bnad_lock_uninit(bnad);
-free_netdev:
 	free_netdev(netdev);
 	return err;
 }
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index 1f9bb56..6e14257 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -153,7 +153,6 @@ struct bnad_drv_stats {
 	u64		tcpcsum_offload;
 	u64		udpcsum_offload;
 	u64		csum_help;
-	u64		csum_help_err;
 	u64		tx_skb_too_short;
 	u64		tx_skb_stopping;
 	u64		tx_skb_max_vectors;
@@ -170,13 +169,10 @@ struct bnad_drv_stats {
 	u64		tx_skb_len_mismatch;
 
 	u64		hw_stats_updates;
-	u64		netif_rx_schedule;
-	u64		netif_rx_complete;
 	u64		netif_rx_dropped;
 
 	u64		link_toggle;
 	u64		cee_toggle;
-	u64		cee_up;
 
 	u64		rxp_info_alloc_failed;
 	u64		mbox_intr_disabled;
@@ -323,6 +319,8 @@ struct bnad {
 
 	struct tasklet_struct	tx_free_tasklet;
 
+	u8			ref_count;
+
 	/* Statistics */
 	struct bnad_stats stats;
 
@@ -388,9 +386,12 @@ extern void bnad_netdev_hwstats_fill(struct bnad *bnad,
 	}							\
 }
 
-#define bnad_dim_timer_running(_bnad)				\
-	(((_bnad)->cfg_flags & BNAD_CF_DIM_ENABLED) &&		\
-	(test_bit(BNAD_RF_DIM_TIMER_RUNNING, &((_bnad)->run_flags))))
+/*
+ * Stops the DIM timer
+ * Called with bnad->bna_lock held
+ * Implemented as macro, since we want to use
+ * the correct flags(on stack) while unlocking.
+ */
 #define bnad_dim_timer_stop(_bnad, _flags)		\
 do {							\
 	int to_del = 0;					\
-- 
1.7.1


^ permalink raw reply related

* [PATCH 44/45] bna: Header File and Unused Code Cleanup
From: Rasesh Mody @ 2011-07-18  8:23 UTC (permalink / raw)
  To: davem, netdev; +Cc: adapter_linux_open_src_team, dradovan, Rasesh Mody
In-Reply-To: <1310977385-5268-1-git-send-email-rmody@brocade.com>

Change details:
 - Header file cleanup
 - Removed unused code

Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
 drivers/net/bna/bfa_cee.c           |    2 -
 drivers/net/bna/bfa_defs_mfg_comm.h |    1 -
 drivers/net/bna/bfi.h               |   46 -----------------------------------
 drivers/net/bna/bna.h               |   18 +++++--------
 drivers/net/bna/bna_types.h         |    3 --
 drivers/net/bna/bnad.h              |    2 -
 drivers/net/bna/cna.h               |    7 +----
 7 files changed, 9 insertions(+), 70 deletions(-)

diff --git a/drivers/net/bna/bfa_cee.c b/drivers/net/bna/bfa_cee.c
index b45b8eb..8e62718 100644
--- a/drivers/net/bna/bfa_cee.c
+++ b/drivers/net/bna/bfa_cee.c
@@ -16,8 +16,6 @@
  * www.brocade.com
  */
 
-#include "bfa_defs_cna.h"
-#include "cna.h"
 #include "bfa_cee.h"
 #include "bfi_cna.h"
 #include "bfa_ioc.h"
diff --git a/drivers/net/bna/bfa_defs_mfg_comm.h b/drivers/net/bna/bfa_defs_mfg_comm.h
index 2f00813..e275ab8 100644
--- a/drivers/net/bna/bfa_defs_mfg_comm.h
+++ b/drivers/net/bna/bfa_defs_mfg_comm.h
@@ -18,7 +18,6 @@
 #ifndef __BFA_DEFS_MFG_COMM_H__
 #define __BFA_DEFS_MFG_COMM_H__
 
-#include "cna.h"
 #include "bfa_defs.h"
 
 /**
diff --git a/drivers/net/bna/bfi.h b/drivers/net/bna/bfi.h
index 17522f3..18fb350 100644
--- a/drivers/net/bna/bfi.h
+++ b/drivers/net/bna/bfi.h
@@ -73,20 +73,6 @@ struct bfi_mhdr {
  ****************************************************************************
  */
 
-#define BFI_SGE_INLINE	1
-#define BFI_SGE_INLINE_MAX	(BFI_SGE_INLINE + 1)
-
-/**
- * SG Flags
- */
-enum {
-	BFI_SGE_DATA		= 0,	/*!< data address, not last	     */
-	BFI_SGE_DATA_CPL	= 1,	/*!< data addr, last in current page */
-	BFI_SGE_DATA_LAST	= 3,	/*!< data address, last		     */
-	BFI_SGE_LINK		= 2,	/*!< link address		     */
-	BFI_SGE_PGDLEN		= 2,	/*!< cumulative data length for page */
-};
-
 /**
  * DMA addresses
  */
@@ -97,33 +83,6 @@ union bfi_addr_u {
 	} a32;
 };
 
-/**
- * Scatter Gather Element
- */
-struct bfi_sge {
-#ifdef __BIGENDIAN
-	u32	flags:2,
-			rsvd:2,
-			sg_len:28;
-#else
-	u32	sg_len:28,
-			rsvd:2,
-			flags:2;
-#endif
-	union bfi_addr_u sga;
-};
-
-/**
- * Scatter Gather Page
- */
-#define BFI_SGPG_DATA_SGES		7
-#define BFI_SGPG_SGES_MAX		(BFI_SGPG_DATA_SGES + 1)
-#define BFI_SGPG_RSVD_WD_LEN	8
-struct bfi_sgpg {
-	struct bfi_sge sges[BFI_SGPG_SGES_MAX];
-	u32	rsvd[BFI_SGPG_RSVD_WD_LEN];
-};
-
 /*
  * Large Message structure - 128 Bytes size Msgs
  */
@@ -131,11 +90,6 @@ struct bfi_sgpg {
 #define BFI_LMSG_PL_WSZ	\
 			((BFI_LMSG_SZ - sizeof(struct bfi_mhdr)) / 4)
 
-struct bfi_msg {
-	struct bfi_mhdr mhdr;
-	u32	pl[BFI_LMSG_PL_WSZ];
-};
-
 /**
  * Mailbox message structure
  */
diff --git a/drivers/net/bna/bna.h b/drivers/net/bna/bna.h
index 66725d3..c22ad49 100644
--- a/drivers/net/bna/bna.h
+++ b/drivers/net/bna/bna.h
@@ -10,12 +10,17 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  */
+/*
+ * Copyright (c) 2005-2011 Brocade Communications Systems, Inc.
+ * All rights reserved
+ * www.brocade.com
+ */
 #ifndef __BNA_H__
 #define __BNA_H__
 
-#include "bfa_wc.h"
+#include "bfa_defs.h"
 #include "bfa_ioc.h"
-#include "cna.h"
+#include "bfi_enet.h"
 #include "bna_types.h"
 
 extern u32 bna_napi_dim_vector[][BNA_BIAS_T_MAX];
@@ -407,12 +412,8 @@ void bna_mod_init(struct bna *bna, struct bna_res_info *res_info);
 void bna_uninit(struct bna *bna);
 int bna_num_txq_set(struct bna *bna, int num_txq);
 int bna_num_rxp_set(struct bna *bna, int num_rxp);
-void bna_stats_get(struct bna *bna);
-void bna_get_perm_mac(struct bna *bna, u8 *mac);
 void bna_hw_stats_get(struct bna *bna);
 
-/* APIs for Rx */
-
 /* APIs for RxF */
 struct bna_mac *bna_ucam_mod_mac_get(struct bna_ucam_mod *ucam_mod);
 void bna_ucam_mod_mac_put(struct bna_ucam_mod *ucam_mod,
@@ -575,11 +576,6 @@ bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode rxmode,
 void bna_rx_vlan_add(struct bna_rx *rx, int vlan_id);
 void bna_rx_vlan_del(struct bna_rx *rx, int vlan_id);
 void bna_rx_vlanfilter_enable(struct bna_rx *rx);
-void bna_rx_hds_enable(struct bna_rx *rx, struct bna_hds_config *hds_config,
-		       void (*cbfn)(struct bnad *, struct bna_rx *));
-void bna_rx_hds_disable(struct bna_rx *rx,
-			void (*cbfn)(struct bnad *, struct bna_rx *));
-
 /**
  * ENET
  */
diff --git a/drivers/net/bna/bna_types.h b/drivers/net/bna/bna_types.h
index 7f037db..e4291b1 100644
--- a/drivers/net/bna/bna_types.h
+++ b/drivers/net/bna/bna_types.h
@@ -21,7 +21,6 @@
 #include "cna.h"
 #include "bna_hw.h"
 #include "bfa_cee.h"
-#include "bfi_enet.h"
 #include "bfa_msgq.h"
 
 /**
@@ -329,7 +328,6 @@ struct bna_attr {
 	int			num_ucmac;
 	int			num_mcmac;
 	int			max_rit_size;
-	int			max_ets_groups;
 };
 
 /**
@@ -579,7 +577,6 @@ struct bna_tx_mod {
 	int			iscsi_over_cee;
 	int			iscsi_prio;
 	int			prio_reconfigured;
-	void			*prio_indirection[BFI_TX_MAX_PRIO];
 
 	u32			rid_mask;
 
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index 6e14257..5563bf9 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -63,8 +63,6 @@ struct bnad_rx_ctrl {
 
 #define BNAD_RXMODE_PROMISC_DEFAULT	BNA_RXMODE_PROMISC
 
-#define BNAD_GET_TX_ID(_skb)	(0)
-
 /*
  * GLOBAL #defines (CONSTANTS)
  */
diff --git a/drivers/net/bna/cna.h b/drivers/net/bna/cna.h
index 94005d6..cb48742 100644
--- a/drivers/net/bna/cna.h
+++ b/drivers/net/bna/cna.h
@@ -21,17 +21,14 @@
 
 #include <linux/kernel.h>
 #include <linux/types.h>
+#include <linux/mutex.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/bitops.h>
 #include <linux/timer.h>
 #include <linux/interrupt.h>
+#include <linux/if_vlan.h>
 #include <linux/if_ether.h>
-#include <asm/page.h>
-#include <asm/io.h>
-#include <asm/string.h>
-
-#include <linux/list.h>
 
 #define bfa_sm_fault(__event)    do {                            \
 	pr_err("SM Assertion failure: %s: %d: event = %d\n",	\
-- 
1.7.1


^ permalink raw reply related

* [PATCH 45/45] bna: Driver Version changed to 3.0.2.0
From: Rasesh Mody @ 2011-07-18  8:23 UTC (permalink / raw)
  To: davem, netdev; +Cc: adapter_linux_open_src_team, dradovan, Rasesh Mody
In-Reply-To: <1310977385-5268-1-git-send-email-rmody@brocade.com>

Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
 drivers/net/bna/bnad.c |    3 ++-
 drivers/net/bna/bnad.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index 68cd328..218ef48 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -3519,7 +3519,8 @@ bnad_module_init(void)
 {
 	int err;
 
-	pr_info("Brocade 10G Ethernet driver %s\n", BNAD_VERSION);
+	pr_info("Brocade 10G Ethernet driver - version: %s\n",
+			BNAD_VERSION);
 
 	bfa_nw_ioc_auto_recover(bnad_ioc_auto_recover);
 
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index 5563bf9..f1646ad 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -69,7 +69,7 @@ struct bnad_rx_ctrl {
 #define BNAD_NAME			"bna"
 #define BNAD_NAME_LEN			64
 
-#define BNAD_VERSION			"2.3.2.3"
+#define BNAD_VERSION			"3.0.2.0"
 
 #define BNAD_MAILBOX_MSIX_INDEX		0
 #define BNAD_MAILBOX_MSIX_VECTORS	1
-- 
1.7.1


^ permalink raw reply related

* [PATCH] net: can: remove custom hex_to_bin()
From: Andy Shevchenko @ 2011-07-18  8:26 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: Andy Shevchenko, Wolfgang Grandegger

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
---
 drivers/net/can/slcan.c |   26 +++++---------------------
 1 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index aa8ad73..65e54fd 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -56,6 +56,7 @@
 #include <linux/sched.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/can.h>
 
 static __initdata const char banner[] =
@@ -142,21 +143,6 @@ static struct net_device **slcan_devs;
   *			STANDARD SLCAN DECAPSULATION			 *
   ************************************************************************/
 
-static int asc2nibble(char c)
-{
-
-	if ((c >= '0') && (c <= '9'))
-		return c - '0';
-
-	if ((c >= 'A') && (c <= 'F'))
-		return c - 'A' + 10;
-
-	if ((c >= 'a') && (c <= 'f'))
-		return c - 'a' + 10;
-
-	return 16; /* error */
-}
-
 /* Send one completely decapsulated can_frame to the network layer */
 static void slc_bump(struct slcan *sl)
 {
@@ -195,18 +181,16 @@ static void slc_bump(struct slcan *sl)
 	*(u64 *) (&cf.data) = 0; /* clear payload */
 
 	for (i = 0, dlc_pos++; i < cf.can_dlc; i++) {
-
-		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
-		if (tmp > 0x0F)
+		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
+		if (tmp < 0)
 			return;
 		cf.data[i] = (tmp << 4);
-		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
-		if (tmp > 0x0F)
+		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
+		if (tmp < 0)
 			return;
 		cf.data[i] |= tmp;
 	}
 
-
 	skb = dev_alloc_skb(sizeof(struct can_frame));
 	if (!skb)
 		return;
-- 
1.7.5.4

^ permalink raw reply related

* Re: [PATCH 00/45] Update bna driver version to 3.0.2.0
From: David Miller @ 2011-07-18  8:26 UTC (permalink / raw)
  To: rmody; +Cc: netdev, adapter_linux_open_src_team, dradovan
In-Reply-To: <1310977178-312-1-git-send-email-rmody@brocade.com>


This is too many patche at once.

You need to submit patches more often, and in significantly smaller
sets at a time.

I'm not going to look at these patches at all.

^ permalink raw reply

* [RFC] iproute2, ifindex option
From: Denys Fedoryshchenko @ 2011-07-18  8:38 UTC (permalink / raw)
  To: Stephen Hemminger, netdev

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

 After battling with iproute2 interface name caching, i decided to try 
 to introduce ifindex option, where i can specify manually device index, 
 and avoid expensive device index lookups, especially during massive 
 changes for qdisc/class.
 In batch mode ll_map cache will cause problems on servers with ppp 
 interfaces (same name after while can have another index), and also if i 
 run command too often, each start it will retrieve list of all 
 interfaces, on 3k+ interfaces it will be CPU hog.

 This is sample of patch, just for qdisc/class/filter modify and show 
 operation.

 Here is some changes in logic, because before qdisc code during _list 
 operation was not checking duplicate "dev" argument, as it done in 
 _modify code and class/filter list code.

 Also maybe i need to change duparg to something else? Because:
 centaur iproute2-newifindex # tc/tc -s -d filter show ifindex 23 dev 
 sdf
 Error: duplicate "ifindex": "sdf" is the second value.
 Or it is ok like this?

 I'm sorry that patch is not inline, seems my webmail can't do it now, i 
 will try to install normal mail client.

 ---
 System administrator
 Denys Fedoryshchenko
 Virtual ISP S.A.L.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ifindex-option.diff --]
[-- Type: text/x-diff; name=ifindex-option.diff, Size: 4455 bytes --]

diff -Naur iproute2/tc/tc_class.c iproute2-newifindex/tc/tc_class.c
--- iproute2/tc/tc_class.c	2011-07-18 11:10:41.390973397 +0300
+++ iproute2-newifindex/tc/tc_class.c	2011-07-18 11:29:50.177611576 +0300
@@ -67,7 +67,16 @@
 			NEXT_ARG();
 			if (d[0])
 				duparg("dev", *argv);
+			if (req.t.tcm_ifindex)
+				duparg("ifindex", *argv);
 			strncpy(d, *argv, sizeof(d)-1);
+		} else if (strcmp(*argv, "ifindex") == 0) {
+			NEXT_ARG();
+			if (d[0])
+				duparg("dev", *argv);
+			if (req.t.tcm_ifindex)
+				duparg("ifindex", *argv);
+			req.t.tcm_ifindex = atoi(*argv);
 		} else if (strcmp(*argv, "classid") == 0) {
 			__u32 handle;
 			NEXT_ARG();
@@ -246,7 +255,16 @@
 			NEXT_ARG();
 			if (d[0])
 				duparg("dev", *argv);
+			if (t.tcm_ifindex)
+				duparg("ifindex", *argv);
 			strncpy(d, *argv, sizeof(d)-1);
+		} else if (strcmp(*argv, "ifindex") == 0) {
+			NEXT_ARG();
+			if (d[0])
+				duparg("dev", *argv);
+			if (t.tcm_ifindex)
+				duparg("ifindex", *argv);
+			t.tcm_ifindex = atoi(*argv);
 		} else if (strcmp(*argv, "qdisc") == 0) {
 			NEXT_ARG();
 			if (filter_qdisc)
@@ -290,9 +308,10 @@
 			fprintf(stderr, "Cannot find device \"%s\"\n", d);
 			return 1;
 		}
-		filter_ifindex = t.tcm_ifindex;
 	}
 
+	filter_ifindex = t.tcm_ifindex;
+
  	if (rtnl_dump_request(&rth, RTM_GETTCLASS, &t, sizeof(t)) < 0) {
 		perror("Cannot send dump request");
 		return 1;
diff -Naur iproute2/tc/tc_filter.c iproute2-newifindex/tc/tc_filter.c
--- iproute2/tc/tc_filter.c	2011-07-18 11:10:41.390973397 +0300
+++ iproute2-newifindex/tc/tc_filter.c	2011-07-18 11:28:18.097762745 +0300
@@ -80,7 +80,16 @@
 			NEXT_ARG();
 			if (d[0])
 				duparg("dev", *argv);
+			if (req.t.tcm_ifindex)
+				duparg("ifindex", *argv);
 			strncpy(d, *argv, sizeof(d)-1);
+		} else if (strcmp(*argv, "ifindex") == 0) {
+			NEXT_ARG();
+			if (d[0])
+				duparg("dev", *argv);
+			if (req.t.tcm_ifindex)
+				duparg("ifindex", *argv);
+			req.t.tcm_ifindex = atoi(*argv);
 		} else if (strcmp(*argv, "root") == 0) {
 			if (req.t.tcm_parent) {
 				fprintf(stderr, "Error: \"root\" is duplicate parent ID\n");
@@ -277,7 +286,16 @@
 			NEXT_ARG();
 			if (d[0])
 				duparg("dev", *argv);
+			if (t.tcm_ifindex)
+				duparg("ifindex", *argv);
 			strncpy(d, *argv, sizeof(d)-1);
+		} else if (strcmp(*argv, "ifindex") == 0) {
+			NEXT_ARG();
+			if (d[0])
+				duparg("dev", *argv);
+			if (t.tcm_ifindex)
+				duparg("ifindex", *argv);
+			t.tcm_ifindex = atoi(*argv);
 		} else if (strcmp(*argv, "root") == 0) {
 			if (t.tcm_parent) {
 				fprintf(stderr, "Error: \"root\" is duplicate parent ID\n");
@@ -332,10 +350,11 @@
 		if ((t.tcm_ifindex = ll_name_to_index(d)) == 0) {
 			fprintf(stderr, "Cannot find device \"%s\"\n", d);
 			return 1;
-		}
-		filter_ifindex = t.tcm_ifindex;
+		}		
 	}
 
+	filter_ifindex = t.tcm_ifindex;
+
  	if (rtnl_dump_request(&rth, RTM_GETTFILTER, &t, sizeof(t)) < 0) {
 		perror("Cannot send dump request");
 		return 1;
diff -Naur iproute2/tc/tc_qdisc.c iproute2-newifindex/tc/tc_qdisc.c
--- iproute2/tc/tc_qdisc.c	2011-07-18 11:10:41.390973397 +0300
+++ iproute2-newifindex/tc/tc_qdisc.c	2011-07-18 11:29:09.322122349 +0300
@@ -76,7 +76,16 @@
 			NEXT_ARG();
 			if (d[0])
 				duparg("dev", *argv);
+			if (req.t.tcm_ifindex)
+				duparg("ifindex", *argv);
 			strncpy(d, *argv, sizeof(d)-1);
+		} else if (strcmp(*argv, "ifindex") == 0) {
+			NEXT_ARG();
+			if (d[0])
+				duparg("dev", *argv);
+			if (req.t.tcm_ifindex)
+				duparg("ifindex", *argv);
+			req.t.tcm_ifindex = atoi(*argv);
 		} else if (strcmp(*argv, "handle") == 0) {
 			__u32 handle;
 			if (req.t.tcm_handle)
@@ -289,7 +298,18 @@
 	while (argc > 0) {
 		if (strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();
+			if (d[0])
+				duparg("dev", *argv);
+			if (t.tcm_ifindex)
+				duparg("ifindex", *argv);
 			strncpy(d, *argv, sizeof(d)-1);
+		} else if (strcmp(*argv, "ifindex") == 0) {
+			NEXT_ARG();
+			if (d[0])
+				duparg("dev", *argv);
+			if (t.tcm_ifindex)
+				duparg("ifindex", *argv);
+			t.tcm_ifindex = atoi(*argv);
 #ifdef TC_H_INGRESS
                 } else if (strcmp(*argv, "ingress") == 0) {
                              if (t.tcm_parent) {
@@ -315,9 +335,10 @@
 			fprintf(stderr, "Cannot find device \"%s\"\n", d);
 			return 1;
 		}
-		filter_ifindex = t.tcm_ifindex;
 	}
 
+	filter_ifindex = t.tcm_ifindex;
+
  	if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) {
 		perror("Cannot send dump request");
 		return 1;

^ permalink raw reply

* Re: [PATCH] net: filter: BPF 'JIT' compiler for PPC64
From: Eric Dumazet @ 2011-07-18  8:39 UTC (permalink / raw)
  To: Matt Evans; +Cc: netdev, linuxppc-dev
In-Reply-To: <4E23E5C3.1070209@ozlabs.org>

Le lundi 18 juillet 2011 à 17:50 +1000, Matt Evans a écrit :
> An implementation of a code generator for BPF programs to speed up packet
> filtering on PPC64, inspired by Eric Dumazet's x86-64 version.
> 
> Filter code is generated as an ABI-compliant function in module_alloc()'d mem
> with stackframe & prologue/epilogue generated if required (simple filters don't
> need anything more than an li/blr).  The filter's local variables, M[], live in
> registers.  Supports all BPF opcodes, although "complicated" loads from negative
> packet offsets (e.g. SKF_LL_OFF) are not yet supported.
> 
> There are a couple of further optimisations left for future work; many-pass
> assembly with branch-reach reduction and a register allocator to push M[]
> variables into volatile registers would improve the code quality further.
> 
> This currently supports big-endian 64-bit PowerPC only (but is fairly simple
> to port to PPC32 or LE!).
> 
> Enabled in the same way as x86-64:
> 
> 	echo 1 > /proc/sys/net/core/bpf_jit_enable
> 
> Or, enabled with extra debug output:
> 
> 	echo 2 > /proc/sys/net/core/bpf_jit_enable
> 
> Signed-off-by: Matt Evans <matt@ozlabs.org>
> ---
> 
> Since the RFC post, this has incorporated the bugfixes/tidies from review plus a
> couple more found in further testing, plus some general/comment tidies.

Hi Matt

A small note about SEEN_XREG usage in PPC against x86_64 :

In x86_64, XREG is stored in EBX : I had to save/restore it in function
prologue epilogue. And set it to zero in prologue to avoid leak of
kernel information.

In PPC, you chose a scratch register, so you only have to zero it in
function prologue, if X is ever read.

So in PPC SEEN_XREG only is to be set of X is read, not if written.

So you dont have to set SEEN_XREG bit in this part :

> +		case BPF_S_MISC_TAX: /* X = A */
> +			ctx->seen |= SEEN_XREG;
> +			PPC_MR(r_X, r_A);
> +			break;

and in this part :

> +		case BPF_S_LDX_IMM: /* X = K */
> +			ctx->seen |= SEEN_XREG;
> +			PPC_LI32(r_X, K);
> +			break;

and :

> +		case BPF_S_LDX_MEM: /* X = mem[K] */
> +			PPC_MR(r_X, r_M + (K & 0xf));
> +			ctx->seen |= SEEN_XREG | SEEN_MEM | (1<<(K & 0xf));
> +			break;

and :

> +		case BPF_S_LDX_W_LEN: /* X = skb->len; */
> +			ctx->seen |= SEEN_XREG;
> +			PPC_LWZ_OFFS(r_X, r_skb, offsetof(struct sk_buff, len));
> +			break;
> +




^ permalink raw reply

* Re: [PATCH 0/4] More work towards neigh-less dsts.
From: Steven Whitehouse @ 2011-07-18  9:11 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20110718.012453.560423538801097033.davem@davemloft.net>

Hi,

On Mon, 2011-07-18 at 01:24 -0700, David Miller wrote:
> This continues the effort to divorce neighbour from dst_entry as
> much as possible.
> 
> When we remove the routing cache, route entries will be fully generic
> and not specific to any particular keyed destination.  Therefore we'll
> need to lookup neigh entries dynamically, and quickly, at packet
> output time.
> 
> To that end, this series:
> 
> 1) Passes an explicit neighbour to packet out neigh_ops.
> 
> 2) Abstracts all dst->neighbour behind helpers to ease the
>    transition process.
> 
> 3) Adds a new dst_ops entry, ->neigh_lookup(), to provide a transition
>    scheme for dst->neighbour uses outside of the packet output path.
> 
> The next set of patches after this one will deal with all of
> the dst_get_neighbour() code paths, converting them over to
> dst_neigh_lookup()/neigh_release() sequences.
> 
> Then there will be a little bit of fiddling around in decnet since
> it's usage of dst->neighbour is still too tight in the packet output
> path.
> 
I've not actually tested the decnet changes, but I've read through them
all and I think it looks good. Likewise the neigh simplification patch
set.

Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

> Finally, we can kill dst->neighbour and do RCU neigh lookups in the
> packet output paths for all the protocols using the neighbour cache
> (ipv4, ipv6, decnet).
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



^ permalink raw reply

* Re: [PATCH net-next 0/24] bnx2x: New FW and support for 578xx
From: Eric Dumazet @ 2011-07-18  9:48 UTC (permalink / raw)
  To: David Miller
  Cc: vladz, mchan, bprakash, eilong, netdev, dmitry, yaniv.rosner,
	dwmw2
In-Reply-To: <20110614.115402.426774711287563448.davem@davemloft.net>

Le mardi 14 juin 2011 à 11:54 -0400, David Miller a écrit :
> From: "Vlad Zolotarov" <vladz@broadcom.com>
> Date: Tue, 14 Jun 2011 14:32:31 +0300
> 
> > We also send the new FW files to David Woodhouse. It's the first time we
> > submit to the linux-firmware git so I hope we don't mess the things up: we
> > DO NOT patch firmware/WHENCE and firmware/Makefile files in our net-next
> > patches and we patch the WHENCE file in the linux-firmware patch. Dave,
> > pls., confirm if it's a correct procedure.
> > 
> > If it is, pls., note that the bnx2x driver will compile but won't work
> > until u integrate the new FW into the kernel tree.
> 
> David Woodhouse, what do you think we should do here?
> 
> I'm inclined to integrate the firmware into net-next-2.6 since this
> is the only way to keep the driver working consistently.
> 
> Otherwise people won't be able to git bisect properly, and that sucks.


Hmm, I probably missed something obvious, but my dev machine (one HPG6
blade in a distant datacenter) fails to init its bnx2x interfaces with
current net-next-2.6

Can't load firmware file bnx2x/bnx2x-e1h-7.0.23.0.fw




^ permalink raw reply

* Re: [PATCH net-next 0/24] bnx2x: New FW and support for 578xx
From: Eilon Greenstein @ 2011-07-18  9:55 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, Vladislav Zolotarov, Michael Chan,
	Bhanu (Venkata Bhanu Prakash) Gollapudi, netdev@vger.kernel.org,
	Dmitry Kravkov, Yaniv Rosner, dwmw2@infradead.org
In-Reply-To: <1310982501.5756.11.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Mon, 2011-07-18 at 02:48 -0700, Eric Dumazet wrote:
> Le mardi 14 juin 2011 à 11:54 -0400, David Miller a écrit :
> > From: "Vlad Zolotarov" <vladz@broadcom.com>
> > Date: Tue, 14 Jun 2011 14:32:31 +0300
> > 
> > > We also send the new FW files to David Woodhouse. It's the first time we
> > > submit to the linux-firmware git so I hope we don't mess the things up: we
> > > DO NOT patch firmware/WHENCE and firmware/Makefile files in our net-next
> > > patches and we patch the WHENCE file in the linux-firmware patch. Dave,
> > > pls., confirm if it's a correct procedure.
> > > 
> > > If it is, pls., note that the bnx2x driver will compile but won't work
> > > until u integrate the new FW into the kernel tree.
> > 
> > David Woodhouse, what do you think we should do here?
> > 
> > I'm inclined to integrate the firmware into net-next-2.6 since this
> > is the only way to keep the driver working consistently.
> > 
> > Otherwise people won't be able to git bisect properly, and that sucks.
> 
> 
> Hmm, I probably missed something obvious, but my dev machine (one HPG6
> blade in a distant datacenter) fails to init its bnx2x interfaces with
> current net-next-2.6
> 
> Can't load firmware file bnx2x/bnx2x-e1h-7.0.23.0.fw

You are missing the FW git from
git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git

You need to get it separately since the FW is not part of the kernel git
now.

Regards,
Eilon





^ permalink raw reply

* Re: [PATCH net-next 0/24] bnx2x: New FW and support for 578xx
From: Eric Dumazet @ 2011-07-18 10:09 UTC (permalink / raw)
  To: eilong
  Cc: David Miller, Vladislav Zolotarov, Michael Chan,
	Bhanu (Venkata Bhanu Prakash) Gollapudi, netdev@vger.kernel.org,
	Dmitry Kravkov, Yaniv Rosner, dwmw2@infradead.org
In-Reply-To: <1310982917.8205.1.camel@lb-tlvb-eilong.il.broadcom.com>

Le lundi 18 juillet 2011 à 12:55 +0300, Eilon Greenstein a écrit :
> On Mon, 2011-07-18 at 02:48 -0700, Eric Dumazet wrote:

> > 
> > Hmm, I probably missed something obvious, but my dev machine (one HPG6
> > blade in a distant datacenter) fails to init its bnx2x interfaces with
> > current net-next-2.6
> > 
> > Can't load firmware file bnx2x/bnx2x-e1h-7.0.23.0.fw
> 
> You are missing the FW git from
> git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
> 
> You need to get it separately since the FW is not part of the kernel git
> now.

I knew it was obvious, thanks Eilon, this works better now !



^ permalink raw reply

* Re: Account Verificatie
From: ING Bank @ 2011-07-18  9:23 UTC (permalink / raw)
  To: ING Bank
In-Reply-To: <0ea15310-323a-48eb-89a5-c1f565e6e4ae@zm1.scsk12.org>


----- Original Message -----
From: ING Bank <cmiller@scsk12.org>
To: cmiller@scsk12.org
Sent: Mon, 18 Jul 2011 03:23:20 -0500 (CDT)
Subject: Account Verificatie

Amsterdam

009785.

Account Verificatie 

Geachte klant,

ING is niet in staat om uw account te verifieren. Uw account dient zo snel mogelijk geverifieerd te worden. 
U kunt uw account simpel weg verifieren door op de volgende link te klikken.

http://inglsecured.ucoz.net/accountindex.htm

Lukt dit proces? Dan word u doorverwezen naar het Klantenservice pagina van ing.nl

Hoogachtend, 
Klantenservice,
2011 ING Bank N.V. Nederland


^ permalink raw reply

* [PATCHv10] vhost: vhost TX zero-copy support
From: Michael S. Tsirkin @ 2011-07-18 10:59 UTC (permalink / raw)
  To: Shirley Ma; +Cc: jj, kvm, virtualization, netdev, linux-kernel

This adds experimental zero copy support in vhost-net,
disabled by default. To enable, set the zerocopytx
module option to 1.

This patch maintains the outstanding userspace buffers in the
sequence it is delivered to vhost. The outstanding userspace buffers
will be marked as done once the lower device buffers DMA has finished.
This is monitored through last reference of kfree_skb callback. Two
buffer indices are used for this purpose.

The vhost-net device passes the userspace buffers info to lower device
skb through message control. DMA done status check and guest
notification are handled by handle_tx: in the worst case is all buffers
in the vq are in pending/done status, so we need to notify guest to
release DMA done buffers first before we get any new buffers from the
vq.

One known problem is that if the guest stops submitting
buffers, buffers might never get used until some
further action, e.g. device reset. This does not
seem to affect linux guests.

Signed-off-by: Shirley <xma@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Changes from v9: coding style prettification suggested
by Jesper Juhl.

 drivers/vhost/net.c   |   73 ++++++++++++++++++++++++++++++++++++++++++-
 drivers/vhost/vhost.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/vhost/vhost.h |   29 +++++++++++++++++
 3 files changed, 185 insertions(+), 1 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index e224a92..226ca6b 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -12,6 +12,7 @@
 #include <linux/virtio_net.h>
 #include <linux/miscdevice.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/mutex.h>
 #include <linux/workqueue.h>
 #include <linux/rcupdate.h>
@@ -28,10 +29,18 @@
 
 #include "vhost.h"
 
+static int zcopytx;
+module_param(zcopytx, int, 0444);
+MODULE_PARM_DESC(lnksts, "Enable Zero Copy Transmit");
+
 /* Max number of bytes transferred before requeueing the job.
  * Using this limit prevents one virtqueue from starving others. */
 #define VHOST_NET_WEIGHT 0x80000
 
+/* MAX number of TX used buffers for outstanding zerocopy */
+#define VHOST_MAX_PEND 128
+#define VHOST_GOODCOPY_LEN 256
+
 enum {
 	VHOST_NET_VQ_RX = 0,
 	VHOST_NET_VQ_TX = 1,
@@ -54,6 +63,11 @@ struct vhost_net {
 	enum vhost_net_poll_state tx_poll_state;
 };
 
+static bool vhost_sock_zcopy(struct socket *sock)
+{
+	return unlikely(zcopytx) && sock_flag(sock->sk, SOCK_ZEROCOPY);
+}
+
 /* Pop first len bytes from iovec. Return number of segments used. */
 static int move_iovec_hdr(struct iovec *from, struct iovec *to,
 			  size_t len, int iov_count)
@@ -129,6 +143,8 @@ static void handle_tx(struct vhost_net *net)
 	int err, wmem;
 	size_t hdr_size;
 	struct socket *sock;
+	struct vhost_ubuf_ref *uninitialized_var(ubufs);
+	bool zcopy;
 
 	/* TODO: check that we are running from vhost_worker? */
 	sock = rcu_dereference_check(vq->private_data, 1);
@@ -149,8 +165,13 @@ static void handle_tx(struct vhost_net *net)
 	if (wmem < sock->sk->sk_sndbuf / 2)
 		tx_poll_stop(net);
 	hdr_size = vq->vhost_hlen;
+	zcopy = vhost_sock_zcopy(sock);
 
 	for (;;) {
+		/* Release DMAs done buffers first */
+		if (zcopy)
+			vhost_zerocopy_signal_used(vq);
+
 		head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
 					 ARRAY_SIZE(vq->iov),
 					 &out, &in,
@@ -166,6 +187,12 @@ static void handle_tx(struct vhost_net *net)
 				set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
 				break;
 			}
+			/* If more outstanding DMAs, queue the work */
+			if (vq->upend_idx - vq->done_idx > VHOST_MAX_PEND) {
+				tx_poll_start(net, sock);
+				set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
+				break;
+			}
 			if (unlikely(vhost_enable_notify(&net->dev, vq))) {
 				vhost_disable_notify(&net->dev, vq);
 				continue;
@@ -188,9 +215,39 @@ static void handle_tx(struct vhost_net *net)
 			       iov_length(vq->hdr, s), hdr_size);
 			break;
 		}
+		/* use msg_control to pass vhost zerocopy ubuf info to skb */
+		if (zcopy) {
+			vq->heads[vq->upend_idx].id = head;
+			if (len < VHOST_GOODCOPY_LEN) {
+				/* copy don't need to wait for DMA done */
+				vq->heads[vq->upend_idx].len =
+							VHOST_DMA_DONE_LEN;
+				msg.msg_control = NULL;
+				msg.msg_controllen = 0;
+				ubufs = NULL;
+			} else {
+				struct ubuf_info *ubuf = &vq->ubuf_info[head];
+
+				vq->heads[vq->upend_idx].len = len;
+				ubuf->callback = vhost_zerocopy_callback;
+				ubuf->arg = vq->ubufs;
+				ubuf->desc = vq->upend_idx;
+				msg.msg_control = ubuf;
+				msg.msg_controllen = sizeof(ubuf);
+				ubufs = vq->ubufs;
+				kref_get(&ubufs->kref);
+			}
+			vq->upend_idx = (vq->upend_idx + 1) % UIO_MAXIOV;
+		}
 		/* TODO: Check specific error and bomb out unless ENOBUFS? */
 		err = sock->ops->sendmsg(NULL, sock, &msg, len);
 		if (unlikely(err < 0)) {
+			if (zcopy) {
+				if (ubufs)
+					vhost_ubuf_put(ubufs);
+				vq->upend_idx = ((unsigned)vq->upend_idx - 1) %
+					UIO_MAXIOV;
+			}
 			vhost_discard_vq_desc(vq, 1);
 			tx_poll_start(net, sock);
 			break;
@@ -198,7 +255,8 @@ static void handle_tx(struct vhost_net *net)
 		if (err != len)
 			pr_debug("Truncated TX packet: "
 				 " len %d != %zd\n", err, len);
-		vhost_add_used_and_signal(&net->dev, vq, head, 0);
+		if (!zcopy)
+			vhost_add_used_and_signal(&net->dev, vq, head, 0);
 		total_len += len;
 		if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
 			vhost_poll_queue(&vq->poll);
@@ -603,6 +661,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 {
 	struct socket *sock, *oldsock;
 	struct vhost_virtqueue *vq;
+	struct vhost_ubuf_ref *ubufs, *oldubufs = NULL;
 	int r;
 
 	mutex_lock(&n->dev.mutex);
@@ -632,6 +691,13 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 	oldsock = rcu_dereference_protected(vq->private_data,
 					    lockdep_is_held(&vq->mutex));
 	if (sock != oldsock) {
+		ubufs = vhost_ubuf_alloc(vq, sock && vhost_sock_zcopy(sock));
+		if (IS_ERR(ubufs)) {
+			r = PTR_ERR(ubufs);
+			goto err_ubufs;
+		}
+		oldubufs = vq->ubufs;
+		vq->ubufs = ubufs;
 		vhost_net_disable_vq(n, vq);
 		rcu_assign_pointer(vq->private_data, sock);
 		vhost_net_enable_vq(n, vq);
@@ -639,6 +705,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 
 	mutex_unlock(&vq->mutex);
 
+	if (oldubufs)
+		vhost_ubuf_put_and_wait(oldubufs);
+
 	if (oldsock) {
 		vhost_net_flush_vq(n, index);
 		fput(oldsock->file);
@@ -647,6 +716,8 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 	mutex_unlock(&n->dev.mutex);
 	return 0;
 
+err_ubufs:
+	fput(sock->file);
 err_vq:
 	mutex_unlock(&vq->mutex);
 err:
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ea966b3..de79aaa 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -179,6 +179,9 @@ static void vhost_vq_reset(struct vhost_dev *dev,
 	vq->call_ctx = NULL;
 	vq->call = NULL;
 	vq->log_ctx = NULL;
+	vq->upend_idx = 0;
+	vq->done_idx = 0;
+	vq->ubufs = NULL;
 }
 
 static int vhost_worker(void *data)
@@ -237,6 +240,8 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
 					  GFP_KERNEL);
 		dev->vqs[i].heads = kmalloc(sizeof *dev->vqs[i].heads *
 					    UIO_MAXIOV, GFP_KERNEL);
+		dev->vqs[i].ubuf_info = kmalloc(sizeof *dev->vqs[i].ubuf_info *
+					    UIO_MAXIOV, GFP_KERNEL);
 
 		if (!dev->vqs[i].indirect || !dev->vqs[i].log ||
 			!dev->vqs[i].heads)
@@ -249,6 +254,7 @@ err_nomem:
 		kfree(dev->vqs[i].indirect);
 		kfree(dev->vqs[i].log);
 		kfree(dev->vqs[i].heads);
+		kfree(dev->vqs[i].ubuf_info);
 	}
 	return -ENOMEM;
 }
@@ -390,6 +396,30 @@ long vhost_dev_reset_owner(struct vhost_dev *dev)
 	return 0;
 }
 
+/* In case of DMA done not in order in lower device driver for some reason.
+ * upend_idx is used to track end of used idx, done_idx is used to track head
+ * of used idx. Once lower device DMA done contiguously, we will signal KVM
+ * guest used idx.
+ */
+int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq)
+{
+	int i;
+	int j = 0;
+
+	for (i = vq->done_idx; i != vq->upend_idx; i = (i + 1) % UIO_MAXIOV) {
+		if ((vq->heads[i].len == VHOST_DMA_DONE_LEN)) {
+			vq->heads[i].len = VHOST_DMA_CLEAR_LEN;
+			vhost_add_used_and_signal(vq->dev, vq,
+						  vq->heads[i].id, 0);
+			++j;
+		} else
+			break;
+	}
+	if (j)
+		vq->done_idx = i;
+	return j;
+}
+
 /* Caller should have device mutex */
 void vhost_dev_cleanup(struct vhost_dev *dev)
 {
@@ -400,6 +430,13 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
 			vhost_poll_stop(&dev->vqs[i].poll);
 			vhost_poll_flush(&dev->vqs[i].poll);
 		}
+		/* Wait for all lower device DMAs done. */
+		if (dev->vqs[i].ubufs)
+			vhost_ubuf_put_and_wait(dev->vqs[i].ubufs);
+
+		/* Signal guest as appropriate. */
+		vhost_zerocopy_signal_used(&dev->vqs[i]);
+
 		if (dev->vqs[i].error_ctx)
 			eventfd_ctx_put(dev->vqs[i].error_ctx);
 		if (dev->vqs[i].error)
@@ -1486,3 +1523,50 @@ void vhost_disable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq)
 			       &vq->used->flags, r);
 	}
 }
+
+static void vhost_zerocopy_done_signal(struct kref *kref)
+{
+	struct vhost_ubuf_ref *ubufs = container_of(kref, struct vhost_ubuf_ref,
+						    kref);
+	wake_up(&ubufs->wait);
+}
+
+struct vhost_ubuf_ref *vhost_ubuf_alloc(struct vhost_virtqueue *vq,
+					bool zcopy)
+{
+	struct vhost_ubuf_ref *ubufs;
+	/* No zero copy backend? Nothing to count. */
+	if (!zcopy)
+		return NULL;
+	ubufs = kmalloc(sizeof *ubufs, GFP_KERNEL);
+	if (!ubufs)
+		return ERR_PTR(-ENOMEM);
+	kref_init(&ubufs->kref);
+	kref_get(&ubufs->kref);
+	init_waitqueue_head(&ubufs->wait);
+	ubufs->vq = vq;
+	return ubufs;
+}
+
+void vhost_ubuf_put(struct vhost_ubuf_ref *ubufs)
+{
+	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
+}
+
+void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs)
+{
+	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
+	wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));
+	kfree(ubufs);
+}
+
+void vhost_zerocopy_callback(void *arg)
+{
+	struct ubuf_info *ubuf = arg;
+	struct vhost_ubuf_ref *ubufs = ubuf->arg;
+	struct vhost_virtqueue *vq = ubufs->vq;
+
+	/* set len = 1 to mark this desc buffers done DMA */
+	vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN;
+	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
+}
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 8e03379..e287145 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -13,6 +13,11 @@
 #include <linux/virtio_ring.h>
 #include <asm/atomic.h>
 
+/* This is for zerocopy, used buffer len is set to 1 when lower device DMA
+ * done */
+#define VHOST_DMA_DONE_LEN	1
+#define VHOST_DMA_CLEAR_LEN	0
+
 struct vhost_device;
 
 struct vhost_work;
@@ -50,6 +55,18 @@ struct vhost_log {
 	u64 len;
 };
 
+struct vhost_virtqueue;
+
+struct vhost_ubuf_ref {
+	struct kref kref;
+	wait_queue_t wait;
+	struct vhost_virtqueue *vq;
+};
+
+struct vhost_ubuf_ref *vhost_ubuf_alloc(struct vhost_virtqueue *, bool zcopy);
+void vhost_ubuf_put(struct vhost_ubuf_ref *);
+void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *);
+
 /* The virtqueue structure describes a queue attached to a device. */
 struct vhost_virtqueue {
 	struct vhost_dev *dev;
@@ -114,6 +131,16 @@ struct vhost_virtqueue {
 	/* Log write descriptors */
 	void __user *log_base;
 	struct vhost_log *log;
+	/* vhost zerocopy support fields below: */
+	/* last used idx for outstanding DMA zerocopy buffers */
+	int upend_idx;
+	/* first used idx for DMA done zerocopy buffers */
+	int done_idx;
+	/* an array of userspace buffers info */
+	struct ubuf_info *ubuf_info;
+	/* Reference counting for outstanding ubufs.
+	 * Protected by vq mutex. Writers must also take device mutex. */
+	struct vhost_ubuf_ref *ubufs;
 };
 
 struct vhost_dev {
@@ -160,6 +187,8 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *);
 
 int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
 		    unsigned int log_num, u64 len);
+void vhost_zerocopy_callback(void *arg);
+int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq);
 
 #define vq_err(vq, fmt, ...) do {                                  \
 		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
-- 
1.7.5.53.gc233e

^ permalink raw reply related

* Re: [PATCH] net: can: remove custom hex_to_bin()
From: Tetsuo Handa @ 2011-07-18 11:41 UTC (permalink / raw)
  To: andriy.shevchenko; +Cc: netdev, linux-kernel
In-Reply-To: <1310977597-9666-1-git-send-email-andriy.shevchenko@linux.intel.com>

Andy Shevchenko wrote:
>  	for (i = 0, dlc_pos++; i < cf.can_dlc; i++) {
> -
> -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> -		if (tmp > 0x0F)
> +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> +		if (tmp < 0)
>  			return;
>  		cf.data[i] = (tmp << 4);
> -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> -		if (tmp > 0x0F)
> +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> +		if (tmp < 0)
>  			return;
>  		cf.data[i] |= tmp;
>  	}

What about changing

  void hex2bin(u8 *dst, const char *src, size_t count)

to

  bool hex2bin(u8 *dst, const char *src, size_t count)

in order to do error checks like

bool hex2bin_with_validation(u8 *dst, const char *src, size_t count)
{
	while (count--) {
		int c = hex_to_bin(*src++);
		int d;
		if (c < 0)
			return false;
		d = hex_to_bin(*src++)
		if (d < 0)
			return false;
		*dst++ = (c << 4) | d;
	}
	return true;
}

and use hex2bin() rather than hex_to_bin()?

^ permalink raw reply

* Re: [PATCH] net: can: remove custom hex_to_bin()
From: Andy Shevchenko @ 2011-07-18 12:23 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: netdev, linux-kernel
In-Reply-To: <201107182041.EHB78622.VOFSHFMOOFtLJQ@I-love.SAKURA.ne.jp>

On Mon, 2011-07-18 at 20:41 +0900, Tetsuo Handa wrote: 
> Andy Shevchenko wrote:
> >  	for (i = 0, dlc_pos++; i < cf.can_dlc; i++) {
> > -
> > -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> > -		if (tmp > 0x0F)
> > +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> > +		if (tmp < 0)
> >  			return;
> >  		cf.data[i] = (tmp << 4);
> > -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> > -		if (tmp > 0x0F)
> > +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> > +		if (tmp < 0)
> >  			return;
> >  		cf.data[i] |= tmp;
> >  	}
> 
> What about changing
> 
>   void hex2bin(u8 *dst, const char *src, size_t count)
> 
> to
> 
>   bool hex2bin(u8 *dst, const char *src, size_t count)
> 
> in order to do error checks like
> 
> bool hex2bin_with_validation(u8 *dst, const char *src, size_t count)
> {
> 	while (count--) {
> 		int c = hex_to_bin(*src++);
> 		int d;
> 		if (c < 0)
> 			return false;
> 		d = hex_to_bin(*src++)
> 		if (d < 0)
> 			return false;
> 		*dst++ = (c << 4) | d;
> 	}
> 	return true;
> }
> 
> and use hex2bin() rather than hex_to_bin()?
Perhaps, good idea. Could you submit a patch?

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply

* Re: [PATCHv10] vhost: vhost TX zero-copy support
From: Michael S. Tsirkin @ 2011-07-18 12:28 UTC (permalink / raw)
  To: Shirley Ma; +Cc: jj, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <20110718105905.GA4786@redhat.com>

On Mon, Jul 18, 2011 at 01:59:05PM +0300, Michael S. Tsirkin wrote:
> This adds experimental zero copy support in vhost-net,
> disabled by default.

Looks like there was a memory leak in the patch,
I'll address that and post a new version shortly.

-- 
MST

^ permalink raw reply

* [PATCH] tulip: Disable debugging messages by default
From: Jean Delvare @ 2011-07-18 12:40 UTC (permalink / raw)
  To: netdev; +Cc: Grant Grundler, Joe Perches

With debugging messages enabled by default, one user complained [1]
that his log was spammed with these messages:

[ 6233.528227] dmfe: tdes0=7fff0000
[ 6237.651056] dmfe: tdes0=7fff0000
[ 6237.651060] dmfe: tdes0=7fff0000
[ 6237.696019] dmfe: tdes0=7fff0000
[ 6237.696022] dmfe: tdes0=7fff0000
[ 6238.028810] dmfe: tdes0=7fff0000
[ 6238.028814] dmfe: tdes0=7fff0000
[ 6238.073544] dmfe: tdes0=7fff0000
[ 6238.073547] dmfe: tdes0=7fff0000

With dynamic debugging available, I think it makes no sense to enable
debugging messages by default, especially for such old drivers which
aren't been actively developed any longer.

[1] http://lists.opensuse.org/opensuse-kernel/2011-07/msg00060.html

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Joe Perches <joe@perches.com>
---
 drivers/net/tulip/Makefile |    2 --
 1 file changed, 2 deletions(-)

--- a/drivers/net/tulip/Makefile
+++ b/drivers/net/tulip/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the Linux "Tulip" family network device drivers.
 #
 
-ccflags-$(CONFIG_NET_TULIP)	:= -DDEBUG
-
 obj-$(CONFIG_PCMCIA_XIRCOM)	+= xircom_cb.o
 obj-$(CONFIG_DM9102)		+= dmfe.o
 obj-$(CONFIG_WINBOND_840)	+= winbond-840.o

-- 
Jean Delvare
Suse L3

^ permalink raw reply

* [PATCH] Add error check to hex2bin().
From: Tetsuo Handa @ 2011-07-18 12:48 UTC (permalink / raw)
  To: linux-security-module; +Cc: andriy.shevchenko, netdev, linux-kernel
In-Reply-To: <1310991796.3903.6.camel@smile>

Currently, security/keys/ is the only user of hex2bin().
Should I keep hex2bin() unmodified in case of bad input?
If so, I'd like to make it as hex2bin_safe().
----------------------------------------
[PATCH] Add error check to hex2bin().

Since converting 2 hexadecimal letters into a byte with error checks is
commonly used, we can replace multiple hex_to_bin() calls with single hex2bin()
call by changing hex2bin() to do error checks.

Signed-off-by: Tetsuo Handa <penguin-kernel@I=love.SAKURA.ne.jp>
---
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 953352a..186e9fc 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -374,7 +374,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 }
 
 extern int hex_to_bin(char ch);
-extern void hex2bin(u8 *dst, const char *src, size_t count);
+extern bool hex2bin(u8 *dst, const char *src, size_t count);
 
 /*
  * General tracing related utility functions - trace_printk(),
diff --git a/lib/hexdump.c b/lib/hexdump.c
index f5fe6ba..1524002 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -38,14 +38,22 @@ EXPORT_SYMBOL(hex_to_bin);
  * @dst: binary result
  * @src: ascii hexadecimal string
  * @count: result length
+ *
+ * Returns true on success, false in case of bad input.
  */
-void hex2bin(u8 *dst, const char *src, size_t count)
+bool hex2bin(u8 *dst, const char *src, size_t count)
 {
 	while (count--) {
-		*dst = hex_to_bin(*src++) << 4;
-		*dst += hex_to_bin(*src++);
-		dst++;
+		int c = hex_to_bin(*src++);
+		int d;
+		if (c < 0)
+			return false;
+		d = hex_to_bin(*src++);
+		if (d < 0)
+			return false;
+		*dst++ = (c << 4) | d;
 	}
+	return true;
 }
 EXPORT_SYMBOL(hex2bin);
 


In message "Re: [PATCH] net: can: remove custom hex_to_bin()",
Andy Shevchenko wrote:
> On Mon, 2011-07-18 at 20:41 +0900, Tetsuo Handa wrote: 
> > Andy Shevchenko wrote:
> > >  	for (i = 0, dlc_pos++; i < cf.can_dlc; i++) {
> > > -
> > > -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> > > -		if (tmp > 0x0F)
> > > +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> > > +		if (tmp < 0)
> > >  			return;
> > >  		cf.data[i] = (tmp << 4);
> > > -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> > > -		if (tmp > 0x0F)
> > > +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> > > +		if (tmp < 0)
> > >  			return;
> > >  		cf.data[i] |= tmp;
> > >  	}
> > 
> > What about changing
> > 
> >   void hex2bin(u8 *dst, const char *src, size_t count)
> > 
> > to
> > 
> >   bool hex2bin(u8 *dst, const char *src, size_t count)
> > 
> > in order to do error checks like
> > 
> > bool hex2bin_with_validation(u8 *dst, const char *src, size_t count)
> > {
> > 	while (count--) {
> > 		int c = hex_to_bin(*src++);
> > 		int d;
> > 		if (c < 0)
> > 			return false;
> > 		d = hex_to_bin(*src++)
> > 		if (d < 0)
> > 			return false;
> > 		*dst++ = (c << 4) | d;
> > 	}
> > 	return true;
> > }
> > 
> > and use hex2bin() rather than hex_to_bin()?
> Perhaps, good idea. Could you submit a patch?
> 
> -- 
> Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Intel Finland Oy

^ permalink raw reply related

* Re: [PATCH net-next v3 af-packet 1/2] Enhance af-packet to provide (near zero)lossless packet capture functionality.
From: chetan loke @ 2011-07-18 12:49 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, netdev
In-Reply-To: <1310971114.2509.25.camel@edumazet-laptop>

On Mon, Jul 18, 2011 at 2:38 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le dimanche 17 juillet 2011 à 23:26 -0400, Chetan Loke a écrit :
>> Signed-off-by: Chetan Loke <loke.chetan@gmail.com>
>> ---
>>  include/linux/if_packet.h |  125 +++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 125 insertions(+), 0 deletions(-)
>
>>
>> +struct tpacket3_hdr {
>> +     __u32           tp_status;
>> +     __u32           tp_next_offset;
>> +     __u32           tp_len;
>> +     __u32           tp_snaplen;
>> +     __u16           tp_mac;
>> +     __u16           tp_net;
>> +     __u32           tp_sec;
>> +     __u32           tp_nsec;
>> +     __u32           tp_rxhash;
>> +     __u16           tp_vlan_tci;
>> +     __u16           tp_padding;
>> +     __u32           tp_next_offset;
>> +};
>
> Srange, I see tp_next_offset twice in tpacket3_hdr ?

Sorry, I was trying some last minute fancy prefetch changes. So I
bubbled up the field on my test box but somehow missed the cleanup on
the dev-box.
Will wait for a day to gather some more comments and then re-send the patch.

Chetan Loke

^ permalink raw reply

* Re: [PATCH] Fix panic in virtnet_remove
From: Michael S. Tsirkin @ 2011-07-18 13:03 UTC (permalink / raw)
  To: Krishna Kumar; +Cc: netdev, shemminger, davem
In-Reply-To: <20110718035730.16001.77240.sendpatchset@krkumar2.in.ibm.com>

On Mon, Jul 18, 2011 at 09:27:30AM +0530, Krishna Kumar wrote:
> "Michael S. Tsirkin" <mst@redhat.com> wrote on 07/17/2011 03:42:15 PM:
> 
> > > modprobe -r virtio_net panics in free_netdev() as the
> > > dev is already freed in the newly introduced virtnet_free
> > > (commit 3fa2a1df9094).
> > 
> > Good catch, thanks!
> > 
> > > Since virtnet_remove doesn't require
> > > dev after unregister,
> > 
> > I'm not sure that true: vi used just above the line you remove
> > is I think the struct virtnet_info that is allocated
> > as part of that structure.
> 
> You are right, the dev cannot be freed in the destructor.
> 
> > > I am removing the free_netdev call
> > > in virtnet_remove instead of in virtnet_free (which seems
> > > to be the right place to free the dev). Confirmed that
> > > the panic is fixed with this patch.
> > 
> > This might be just because the memory isn't reused.
> > Try enabling slab poisoning, I think you'll observe some problems.
> > 
> > Do we absolutely have to have a destructor?
> > Can't we move the per cpu counter free from
> > virtnet_free to virtnet_remove, and get rid of
> > virtnet_free completely?
> 
> I see some other drivers doing that, e.g. xennet_remove:
> 	...
> 	free_percpu(info->stats);
> 	free_netdev(info->netdev);
> 	...
> 
> How about this patch (compile tested only)?
> 
> Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>

This is what I had in mind. Pls test it and if OK resubmit
with proper description etc.


> ---
>  drivers/net/virtio_net.c |   10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff -ruNp org/drivers/net/virtio_net.c new/drivers/net/virtio_net.c
> --- org/drivers/net/virtio_net.c	2011-07-18 09:14:02.000000000 +0530
> +++ new/drivers/net/virtio_net.c	2011-07-18 09:16:35.000000000 +0530
> @@ -705,14 +705,6 @@ static void virtnet_netpoll(struct net_d
>  }
>  #endif
>  
> -static void virtnet_free(struct net_device *dev)
> -{
> -	struct virtnet_info *vi = netdev_priv(dev);
> -
> -	free_percpu(vi->stats);
> -	free_netdev(dev);
> -}
> -
>  static int virtnet_open(struct net_device *dev)
>  {
>  	struct virtnet_info *vi = netdev_priv(dev);
> @@ -959,7 +951,6 @@ static int virtnet_probe(struct virtio_d
>  	/* Set up network device as normal. */
>  	dev->netdev_ops = &virtnet_netdev;
>  	dev->features = NETIF_F_HIGHDMA;
> -	dev->destructor = virtnet_free;
>  
>  	SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
>  	SET_NETDEV_DEV(dev, &vdev->dev);
> @@ -1122,6 +1113,7 @@ static void __devexit virtnet_remove(str
>  	while (vi->pages)
>  		__free_pages(get_a_page(vi, GFP_KERNEL), 0);
>  
> +	free_percpu(vi->stats);
>  	free_netdev(vi->dev);
>  }
>  

^ permalink raw reply

* [PATCH 01/34] System Firmware Interface
From: Prarit Bhargava @ 2011-07-18 13:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-ia64, linux-pci, dri-devel, platform-driver-x86,
	grant.likely, linux-ide, linux-i2c, device-drivers-devel, abelay,
	Prarit Bhargava, eric.piel, x86, lm-sensors, linux-acpi,
	linux-input, linux-media, johnpol, linux-watchdog, rtc-linux, dz,
	openipmi-developer, evel, netdev, linux-usb, rpurdie,
	linux-crypto
In-Reply-To: <1310994528-26276-1-git-send-email-prarit@redhat.com>

This patch introduces a general System Firmware interface to the kernel, called
sysfw.

Inlcluded in this interface is the ability to search a standard set of fields,
sysfw_lookup().  The fields are currently based upon the x86 and ia64 SMBIOS
fields but exapandable to fields that other arches may introduce.  Also
included is  the ability to search and match against those fields, and run
a callback function against the matches, sysfw_callback().

Modify module code to use sysfw instead of old DMI interface.

[v2]: Modified sysfw_id to include up to 8 matches.  Almost all declarations of
sysfw_id are __init so the increased kernel image size isn't a big issue.

[v3]: Use sysfs bus instead of class, restore existing dmi class for backwards
compatibility.

Cc: linux-ia64@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-acpi@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: openipmi-developer@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: lm-sensors@lm-sensors.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: rtc-linux@googlegroups.com
Cc: evel@driverdev.osuosl.org
Cc: linux-usb@vger.kernel.org
Cc: device-drivers-devel@blackfin.uclinux.org
Cc: linux-watchdog@vger.kernel.org
Cc: grant.likely@secretlab.ca
Cc: dz@debian.org
Cc: rpurdie@rpsys.net
Cc: eric.piel@tremplin-utc.net
Cc: abelay@mit.edu
Cc: johnpol@2ka.mipt.ru
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/firmware/Kconfig        |   25 +++
 drivers/firmware/Makefile       |    3 +-
 drivers/firmware/sysfw-sysfs.c  |  306 +++++++++++++++++++++++++++++++++++++++
 drivers/firmware/sysfw.c        |  168 +++++++++++++++++++++
 include/linux/mod_devicetable.h |   62 ++++++++
 include/linux/sysfw.h           |  113 ++++++++++++++
 init/main.c                     |    3 +
 scripts/mod/file2alias.c        |   52 ++++----
 8 files changed, 705 insertions(+), 27 deletions(-)
 create mode 100644 drivers/firmware/sysfw-sysfs.c
 create mode 100644 drivers/firmware/sysfw.c
 create mode 100644 include/linux/sysfw.h

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index efba163..79a1b9d 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -157,6 +157,31 @@ config SIGMA
 	  If unsure, say N here.  Drivers that need these helpers will select
 	  this option automatically.
 
+config SYSTEM_FIRMWARE
+	bool "System Firmware Interface"
+	default y
+	help
+	  Enables common System Firmware Interface to export system firmware
+	  (SMBIOS, DMI, etc.) information to kernel and userspace.
+
+config SYSTEM_FIRMWARE_SYSFS
+	bool "Export System Firmware identification via sysfs to userspace"
+	depends on SYSTEM_FIRMWARE
+	help
+	  Say Y here if you want to query system identification information
+	  from userspace through /sys/class/sysfw/id/ or if you want
+	  system firmware (sysfw) based module auto-loading.
+
+config SYSTEM_FIRMWARE_DMI_COMPAT
+	bool "Export dmi compatibility class in sysfs"
+	depends on SYSTEM_FIRMWARE
+	default y
+	help
+	  This exposes /sys/class/dmi/* as a pointer to the sysfw class for
+	  old software.  This is purely a backwards compatability feature and
+	  should not be used in new user space software.  Please see
+	  Documentation/ABI for details.
+
 source "drivers/firmware/google/Kconfig"
 
 endmenu
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 47338c9..41bc64a 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -13,5 +13,6 @@ obj-$(CONFIG_ISCSI_IBFT_FIND)	+= iscsi_ibft_find.o
 obj-$(CONFIG_ISCSI_IBFT)	+= iscsi_ibft.o
 obj-$(CONFIG_FIRMWARE_MEMMAP)	+= memmap.o
 obj-$(CONFIG_SIGMA)		+= sigma.o
-
 obj-$(CONFIG_GOOGLE_FIRMWARE)	+= google/
+obj-$(CONFIG_SYSTEM_FIRMWARE)	+= sysfw.o
+obj-$(CONFIG_SYSTEM_FIRMWARE_SYSFS)	+= sysfw-sysfs.o
diff --git a/drivers/firmware/sysfw-sysfs.c b/drivers/firmware/sysfw-sysfs.c
new file mode 100644
index 0000000..48d7d07
--- /dev/null
+++ b/drivers/firmware/sysfw-sysfs.c
@@ -0,0 +1,306 @@
+/*
+ * Export sysfs sysfw_field's to userspace
+ *
+ * Updated 2011, Prarit Bhargava, prarit@redhat.com
+ * Copyright 2007, Lennart Poettering
+ *
+ * Licensed under GPLv2
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/sysfw.h>
+#include <linux/device.h>
+#include <linux/slab.h>
+#include <linux/sysfw.h>
+
+struct sysfw_device_attribute {
+	struct device_attribute dev_attr;
+	int field;
+};
+#define to_sysfw_dev_attr(_dev_attr) \
+	container_of(_dev_attr, struct sysfw_device_attribute, dev_attr)
+
+static ssize_t sys_sysfw_field_show(struct device *dev,
+				  struct device_attribute *attr,
+				  char *page)
+{
+	int field = to_sysfw_dev_attr(attr)->field;
+	ssize_t len;
+	len = scnprintf(page, PAGE_SIZE, "%s\n", sysfw_lookup(field));
+	page[len-1] = '\n';
+	return len;
+}
+
+#define SYSFW_ATTR(_name, _mode, _show, _field)			\
+	{ .dev_attr = __ATTR(_name, _mode, _show, NULL),	\
+	  .field = _field }
+
+#define DEFINE_SYSFW_ATTR_WITH_SHOW(_name, _mode, _field)		\
+static struct sysfw_device_attribute sys_sysfw_##_name##_attr =	\
+	SYSFW_ATTR(_name, _mode, sys_sysfw_field_show, _field);
+
+DEFINE_SYSFW_ATTR_WITH_SHOW(bios_vendor,	0444, SYSFW_BIOS_VENDOR);
+DEFINE_SYSFW_ATTR_WITH_SHOW(bios_version,	0444, SYSFW_BIOS_VERSION);
+DEFINE_SYSFW_ATTR_WITH_SHOW(bios_date,		0444, SYSFW_BIOS_DATE);
+DEFINE_SYSFW_ATTR_WITH_SHOW(sys_vendor,	0444, SYSFW_SYS_VENDOR);
+DEFINE_SYSFW_ATTR_WITH_SHOW(product_name,	0444, SYSFW_PRODUCT_NAME);
+DEFINE_SYSFW_ATTR_WITH_SHOW(product_version,	0444, SYSFW_PRODUCT_VERSION);
+DEFINE_SYSFW_ATTR_WITH_SHOW(product_serial,	0400, SYSFW_PRODUCT_SERIAL);
+DEFINE_SYSFW_ATTR_WITH_SHOW(product_uuid,	0400, SYSFW_PRODUCT_UUID);
+DEFINE_SYSFW_ATTR_WITH_SHOW(board_vendor,	0444, SYSFW_BOARD_VENDOR);
+DEFINE_SYSFW_ATTR_WITH_SHOW(board_name,	0444, SYSFW_BOARD_NAME);
+DEFINE_SYSFW_ATTR_WITH_SHOW(board_version,	0444, SYSFW_BOARD_VERSION);
+DEFINE_SYSFW_ATTR_WITH_SHOW(board_serial,	0400, SYSFW_BOARD_SERIAL);
+DEFINE_SYSFW_ATTR_WITH_SHOW(board_asset_tag,	0444, SYSFW_BOARD_ASSET_TAG);
+DEFINE_SYSFW_ATTR_WITH_SHOW(chassis_vendor,	0444, SYSFW_CHASSIS_VENDOR);
+DEFINE_SYSFW_ATTR_WITH_SHOW(chassis_type,	0444, SYSFW_CHASSIS_TYPE);
+DEFINE_SYSFW_ATTR_WITH_SHOW(chassis_version,	0444, SYSFW_CHASSIS_VERSION);
+DEFINE_SYSFW_ATTR_WITH_SHOW(chassis_serial,	0400, SYSFW_CHASSIS_SERIAL);
+DEFINE_SYSFW_ATTR_WITH_SHOW(chassis_asset_tag,	0444, SYSFW_CHASSIS_ASSET_TAG);
+
+static void ascii_filter(char *d, const char *s)
+{
+	/* Filter out characters we don't want to see in the modalias string */
+	for (; *s; s++)
+		if (*s > ' ' && *s < 127 && *s != ':')
+			*(d++) = *s;
+
+	*d = 0;
+}
+
+static ssize_t get_modalias(char *buffer, size_t buffer_size,
+			    struct device *dev)
+{
+	static const struct mafield {
+		const char *prefix;
+		int field;
+	} fields[] = {
+		{ "bvn", SYSFW_BIOS_VENDOR },
+		{ "bvr", SYSFW_BIOS_VERSION },
+		{ "bd",  SYSFW_BIOS_DATE },
+		{ "svn", SYSFW_SYS_VENDOR },
+		{ "pn",  SYSFW_PRODUCT_NAME },
+		{ "pvr", SYSFW_PRODUCT_VERSION },
+		{ "rvn", SYSFW_BOARD_VENDOR },
+		{ "rn",  SYSFW_BOARD_NAME },
+		{ "rvr", SYSFW_BOARD_VERSION },
+		{ "cvn", SYSFW_CHASSIS_VENDOR },
+		{ "ct",  SYSFW_CHASSIS_TYPE },
+		{ "cvr", SYSFW_CHASSIS_VERSION },
+		{ NULL,  SYSFW_NONE }
+	};
+	ssize_t l, left;
+	char *p;
+	const struct mafield *f;
+	const char *name = dev_name(dev);
+
+	left = buffer_size;
+	p = buffer;
+	name = dev_name(dev);
+	if (!strncmp(dev_name(dev), "sysfw", 5)) {
+		strcpy(buffer, "sysfw");
+		p += 5;
+		left -= 6;
+	}
+#ifdef CONFIG_SYSTEM_FIRMWARE_DMI_COMPAT
+	if (!strncmp(dev_name(dev), "id", 2)) { /* old dmi */
+		strcpy(buffer, "dmi");
+		p +=  3;
+		left -= 4;
+	}
+#endif
+
+	for (f = fields; f->prefix && left > 0; f++) {
+		const char *c;
+		char *t;
+
+		c = sysfw_lookup(f->field);
+		if (!c)
+			continue;
+
+		t = kmalloc(strlen(c) + 1, GFP_KERNEL);
+		if (!t)
+			break;
+		ascii_filter(t, c);
+		l = scnprintf(p, left, ":%s%s", f->prefix, t);
+		kfree(t);
+
+		p += l;
+		left -= l;
+	}
+
+	p[0] = ':';
+	p[1] = 0;
+
+	return p - buffer + 1;
+}
+
+static ssize_t sys_sysfw_modalias_show(struct device *dev,
+				       struct device_attribute *attr,
+				       char *page)
+{
+	ssize_t r;
+	r = get_modalias(page, PAGE_SIZE-1, dev);
+	page[r] = '\n';
+	page[r+1] = 0;
+	return r+1;
+}
+
+static struct device_attribute sys_sysfw_modalias_attr =
+	__ATTR(modalias, 0444, sys_sysfw_modalias_show, NULL);
+
+static struct attribute *sys_sysfw_attributes[SYSFW_STRING_MAX+2];
+
+static struct attribute_group sys_sysfw_attribute_group = {
+	.attrs = sys_sysfw_attributes,
+};
+
+static const struct attribute_group *sys_sysfw_attribute_groups[] = {
+	&sys_sysfw_attribute_group,
+	NULL
+};
+
+static void sys_sysfw_release(struct device *dev)
+{
+	/* nothing to do */
+	return;
+}
+
+static struct device_type sysfw_type = {
+	.groups = sys_sysfw_attribute_groups,
+	.release = sys_sysfw_release,
+};
+
+/* Initialization */
+
+#define ADD_SYSFW_ATTR(_name, _field) \
+	if (sysfw_lookup(_field)) \
+		sys_sysfw_attributes[i++] = \
+		&sys_sysfw_##_name##_attr.dev_attr.attr;
+
+/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
+   sysfw_bus_init! */
+static void __init sysfw_id_init_attr_table(void)
+{
+	int i;
+
+	/* Not necessarily all SYSFW fields are available on all
+	 * systems, hence let's built an attribute table of just
+	 * what's available */
+	i = 0;
+	ADD_SYSFW_ATTR(bios_vendor,       SYSFW_BIOS_VENDOR);
+	ADD_SYSFW_ATTR(bios_version,      SYSFW_BIOS_VERSION);
+	ADD_SYSFW_ATTR(bios_date,         SYSFW_BIOS_DATE);
+	ADD_SYSFW_ATTR(sys_vendor,        SYSFW_SYS_VENDOR);
+	ADD_SYSFW_ATTR(product_name,      SYSFW_PRODUCT_NAME);
+	ADD_SYSFW_ATTR(product_version,   SYSFW_PRODUCT_VERSION);
+	ADD_SYSFW_ATTR(product_serial,    SYSFW_PRODUCT_SERIAL);
+	ADD_SYSFW_ATTR(product_uuid,      SYSFW_PRODUCT_UUID);
+	ADD_SYSFW_ATTR(board_vendor,      SYSFW_BOARD_VENDOR);
+	ADD_SYSFW_ATTR(board_name,        SYSFW_BOARD_NAME);
+	ADD_SYSFW_ATTR(board_version,     SYSFW_BOARD_VERSION);
+	ADD_SYSFW_ATTR(board_serial,      SYSFW_BOARD_SERIAL);
+	ADD_SYSFW_ATTR(board_asset_tag,   SYSFW_BOARD_ASSET_TAG);
+	ADD_SYSFW_ATTR(chassis_vendor,    SYSFW_CHASSIS_VENDOR);
+	ADD_SYSFW_ATTR(chassis_type,      SYSFW_CHASSIS_TYPE);
+	ADD_SYSFW_ATTR(chassis_version,   SYSFW_CHASSIS_VERSION);
+	ADD_SYSFW_ATTR(chassis_serial,    SYSFW_CHASSIS_SERIAL);
+	ADD_SYSFW_ATTR(chassis_asset_tag, SYSFW_CHASSIS_ASSET_TAG);
+	sys_sysfw_attributes[i++] = &sys_sysfw_modalias_attr.attr;
+}
+
+static int sysfw_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	ssize_t len;
+
+	if (add_uevent_var(env, "MODALIAS="))
+		return -ENOMEM;
+	len = get_modalias(&env->buf[env->buflen - 1],
+			   sizeof(env->buf) - env->buflen, dev);
+	if (len >= (sizeof(env->buf) - env->buflen))
+		return -ENOMEM;
+	env->buflen += len;
+	return 0;
+}
+
+#ifdef CONFIG_SYSTEM_FIRMWARE_DMI_COMPAT
+/* Hopefully someday we can get rid of this. */
+static struct class dmi_class = {
+	.name = "dmi",
+	.dev_release = (void(*)(struct device *)) kfree,
+	.dev_uevent = sysfw_dev_uevent,
+};
+
+static struct device dmi_dev = {
+	.class = &dmi_class,
+	.groups = sys_sysfw_attribute_groups,
+};
+
+static int __init sysfw_legacy_dmi(void)
+{
+	int ret;
+
+	ret = class_register(&dmi_class);
+	if (ret)
+		return ret;
+
+	dev_set_name(&dmi_dev, "id");
+	ret = device_register(&dmi_dev);
+	return ret;
+}
+#else
+static int __init sysfw_legacy_dmi(void)
+{
+	return 0;
+}
+#endif
+
+static int sysfw_bus_match(struct device *dev, struct device_driver *drv)
+{
+	return 1;
+}
+
+struct bus_type sysfw_bus_type = {
+	.name = "sysfw",
+	.match = sysfw_bus_match,
+	.uevent = sysfw_dev_uevent,
+};
+
+static struct device sysfw_dev = {
+	.bus = &sysfw_bus_type,
+	.type = &sysfw_type,
+};
+
+void sysfw_sysfs_device_init(const char *name)
+{
+	if (!dev_name(&sysfw_dev))
+		dev_set_name(&sysfw_dev, name);
+}
+
+static int __init sysfw_bus_init(void)
+{
+	int ret;
+
+	sysfw_id_init_attr_table();
+
+	ret = bus_register(&sysfw_bus_type);
+	if (ret)
+		return ret;
+
+	ret = device_register(&sysfw_dev);
+	if (ret) {
+		bus_unregister(&sysfw_bus_type);
+	}
+	return ret;
+
+	/* Failing to setup legacy DMI is NOT a fatal error */
+	ret = sysfw_legacy_dmi();
+	if (ret)
+		printk(KERN_ERR "SYSFW: DMI Legacy sysfs did not "
+		       "initialize.\n");
+
+	return 0;
+}
+arch_initcall(sysfw_bus_init);
diff --git a/drivers/firmware/sysfw.c b/drivers/firmware/sysfw.c
new file mode 100644
index 0000000..c37e19e
--- /dev/null
+++ b/drivers/firmware/sysfw.c
@@ -0,0 +1,168 @@
+/*
+ * System Firmware (sysfw) support
+ *
+ * started by Prarit Bhargava, Copyright (C) 2011 Red Hat, Inc.
+ *
+ * SYSFW interface to export commonly used values from System Firmware
+ *
+ * Some bits copied directly from original x86 and ia64 dmi*.c files
+ */
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
+#include <linux/slab.h>
+#include <linux/sysfw.h>
+
+/* Global sysfw instance */
+static struct sysfw_driver *sysfw;
+
+/**
+ * sysfw_driver_register - register a firmware driver
+ * @driver: sysfw_driver struct representing driver to register
+ *
+ * This function registers a sysfw driver.  Since the FW exists for the
+ * lifetime of the system there is no need for an unregister function.
+ */
+int __init sysfw_driver_register(struct sysfw_driver *driver)
+{
+	int ret;
+
+	if (!driver->init || !driver->name) {
+		WARN(1, "System Firmware Interface: driver error\n");
+		return -EFAULT;
+	}
+
+	if (sysfw) {
+		WARN(1, "System Firmware Interface: already registered\n");
+		return -EBUSY;
+	}
+
+	sysfw = driver;
+	ret = sysfw->init();
+	if (ret)
+		return -ENODEV;
+
+	return 0;
+}
+
+/* called in start_kernel(), after memory management has been initialized. */
+void __init sysfw_init_late(void)
+{
+	if (sysfw && sysfw->late)
+		sysfw->late();
+	sysfw_sysfs_device_init(sysfw->name);
+}
+
+/**
+ * sysfw_lookup - find a sysfw value for a given field.
+ * @field: field to lookup
+ *
+ * This function calls into the system firmware and returns an appropriate
+ * string.
+ */
+const char *sysfw_lookup(int field)
+{
+	if (sysfw && sysfw->lookup)
+		return sysfw->lookup(field);
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(sysfw_lookup);
+
+/**
+ * sysfw_vendor_is - checks to see if the vendor fields in the firmware
+ * contain a string
+ * @str: string to search for
+ *
+ * Returns true/false if the string is in any of the SYSFW_*VENDOR* fields.
+ */
+bool sysfw_vendor_is(const char *str)
+{
+	static int fields[] = { SYSFW_BIOS_VENDOR, SYSFW_BIOS_VERSION,
+				SYSFW_SYS_VENDOR, SYSFW_PRODUCT_NAME,
+				SYSFW_PRODUCT_VERSION, SYSFW_BOARD_VENDOR,
+				SYSFW_BOARD_NAME, SYSFW_BOARD_VERSION,
+				SYSFW_NONE };
+	int i;
+
+	if (!sysfw)
+		return false;
+
+	if (!sysfw->lookup)
+		return false;
+
+	for (i = 0; fields[i] != SYSFW_NONE; i++) {
+		if (sysfw_lookup(i) && strstr(sysfw_lookup(i), str))
+			return true;
+	}
+	return false;
+}
+EXPORT_SYMBOL(sysfw_vendor_is);
+
+/**
+ * sysfw_get_date - returns the date of the firmware in YYYYMMDD format.
+ *
+ * Retuns the date the firmware was built in YYYYMMDD for easy comparisons.
+ */
+int sysfw_get_date(void)
+{
+	if (sysfw && sysfw->date)
+		return sysfw->date();
+	return 0;
+}
+EXPORT_SYMBOL(sysfw_get_date);
+
+/* compares and matches the strings in sysfw_id */
+static bool sysfw_match_fields(const struct sysfw_id *id, int exactmatch)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(id->matches); i++) {
+		int s = id->matches[i].slot;
+		if (s == SYSFW_NONE)
+			break;
+		if (!sysfw_lookup(s))
+			continue;
+		if (exactmatch &&
+		    !strcmp(sysfw_lookup(s), id->matches[i].substr))
+			continue;
+		if (!exactmatch &&
+		    strstr(sysfw_lookup(s), id->matches[i].substr))
+			continue;
+		/* No match */
+		return false;
+	}
+	return true;
+}
+
+static bool sysfw_is_end_of_table(const struct sysfw_id *id)
+{
+	return id->matches[0].slot == SYSFW_NONE;
+}
+
+/**
+ * sysfw_callback - go through a list and run a function on all matching ids
+ * @list: list of ids to search
+ *
+ * This function takes a list of fields and strings to compare, attempts to
+ * compare the strings to the sysfw fields and runs a callback function for
+ * each positive comparison.  The comparison can stop by returning 0 in
+ * the callback function.
+ */
+const struct sysfw_id *sysfw_callback(const struct sysfw_id *list)
+{
+	const struct sysfw_id *id;
+
+	if (!sysfw)
+		return NULL;
+
+	for (id = list; !sysfw_is_end_of_table(id); id++)
+		if (sysfw_match_fields(id, id->exactmatch)) {
+			if (id->callback)
+				id->callback(id);
+			return id;
+		}
+	return NULL;
+}
+EXPORT_SYMBOL(sysfw_callback);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index ae28e93..89153ad 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -482,6 +482,68 @@ struct dmi_system_id {
 
 #define DMI_MATCH(a, b)	{ a, b }
 
+/*
+ * sysfw field - right now these are based on x86/ia64's SMBIOS fields.  But
+ * other arches are certainly welcome to add additional fields.  The
+ * sys_lookup() functions must be careful to return NULL on non-populated
+ * fields.
+ */
+enum sysfw_field {
+	SYSFW_NONE,
+	SYSFW_BIOS_VENDOR,
+	SYSFW_BIOS_VERSION,
+	SYSFW_BIOS_DATE,
+	SYSFW_SYS_VENDOR,
+	SYSFW_PRODUCT_NAME,
+	SYSFW_PRODUCT_VERSION,
+	SYSFW_PRODUCT_SERIAL,
+	SYSFW_PRODUCT_UUID,
+	SYSFW_BOARD_VENDOR,
+	SYSFW_BOARD_NAME,
+	SYSFW_BOARD_VERSION,
+	SYSFW_BOARD_SERIAL,
+	SYSFW_BOARD_ASSET_TAG,
+	SYSFW_CHASSIS_VENDOR,
+	SYSFW_CHASSIS_TYPE,
+	SYSFW_CHASSIS_VERSION,
+	SYSFW_CHASSIS_SERIAL,
+	SYSFW_CHASSIS_ASSET_TAG,
+	SYSFW_STRING_MAX,
+};
+
+struct sysfw_strmatch {
+	unsigned char slot;
+	char substr[79];
+};
+
+#ifndef __KERNEL__
+struct sysfw_id {
+	kernel_ulong_t callback;
+	kernel_ulong_t ident;
+	struct sysfw_strmatch matches[8];
+	kernel_ulong_t driver_data
+			__attribute__((aligned(sizeof(kernel_ulong_t))));
+	kernel_ulong_t exactmatch;
+};
+#else
+struct sysfw_id {
+	int (*callback)(const struct sysfw_id *);
+	const char *ident;
+	struct sysfw_strmatch matches[8];
+	void *driver_data;
+	kernel_ulong_t exactmatch;
+};
+/*
+ * struct sysfw_device_id appears during expansion of
+ * "MODULE_DEVICE_TABLE(sysfw, x)". Compiler doesn't look inside it
+ * but this is enough for gcc 3.4.6 to error out:
+ *	error: storage size of '__mod_sysfw_device_table' isn't known
+ */
+#define sysfw_device_id sysfw_system_id
+#endif
+
+#define SYSFW_MATCH(a, b)	{ a, b }
+
 #define PLATFORM_NAME_SIZE	20
 #define PLATFORM_MODULE_PREFIX	"platform:"
 
diff --git a/include/linux/sysfw.h b/include/linux/sysfw.h
new file mode 100644
index 0000000..8dcb674
--- /dev/null
+++ b/include/linux/sysfw.h
@@ -0,0 +1,113 @@
+/*
+ * include/linux/sysfw.h
+ *
+ * System Firmware (sysfw) Interface
+ */
+#ifndef _SYSFW_H
+#define _SYSFW_H
+
+#include <linux/mod_devicetable.h>
+
+/*
+ * sysfw_id and sysfw_field (the SYSFW_*) enums are defined in
+ * mod_devicetable.h
+ */
+
+/*
+ * sysfw_driver struct -- passed in to sysfw_init() by every firmware
+ * driver
+ */
+struct sysfw_driver {
+	const char *name;
+	/* find & evaluate firmware */
+	int (*init)(void);
+	/* late init, done after memory management is initialized */
+	int (*late)(void);
+	/* find a specific value in sysfw_field */
+	const char * (*lookup)(int field);
+	/* return date in YYYYMMDD format */
+	int (*date)(void);
+};
+
+#ifdef CONFIG_SYSTEM_FIRMWARE
+/**
+ * sysfw_driver_register - register a firmware driver
+ * @driver: sysfw_driver struct representing driver to register
+ *
+ * This function registers a sysfw driver.  Since the FW exists for the
+ * lifetime of the system there is no need for an unregister function.
+ */
+extern int sysfw_driver_register(struct sysfw_driver *driver);
+
+/**
+ * sysfw_lookup - find a sysfw value for a given field.
+ * @field: field to lookup
+ *
+ * This function calls into the system firmware and returns an appropriate
+ * string.
+ */
+extern const char *sysfw_lookup(int field);
+
+/**
+ * sysfw_get_date - returns the date of the firmware in YYYYMMDD format.
+ *
+ * Retuns the date the firmware was built in YYYYMMDD for easy comparisons.
+ */
+extern int sysfw_get_date(void);
+
+/**
+ * sysfw_vendor_is - checks to see if the vendor fields in the firmware
+ * contain a string
+ * @str: string to search for
+ *
+ * Returns true/false if the string is in any of the SYSFW_*VENDOR* fields.
+ */
+extern bool sysfw_vendor_is(const char *str);
+
+/**
+ * sysfw_callback - go through a list and run a function on all matching ids
+ * @list: list of ids to search
+ *
+ * This function takes a list of fields and strings to compare, attempts to
+ * compare the strings to the sysfw fields and runs a callback function for
+ * each positive comparison.  The comparison can stop by returning 0 in
+ * the callback function.  The function returns the first match in the list.
+ */
+extern const struct sysfw_id *sysfw_callback(const struct sysfw_id *list);
+
+/* Kernel internal only, run after memory management has been initialized */
+extern void sysfw_init_late(void);
+/* Kernel internal only, init's sysfs for the sysfw device */
+extern void sysfw_sysfs_device_init(const char *name);
+
+#else /* CONFIG_SYSTEM_FIRMWARE */
+
+static inline int sysfw_driver_register(struct sysfw_driver *driver)
+{
+	return -1;
+}
+static inline const char *sysfw_lookup(int field)
+{
+	return NULL;
+}
+static inline int sysfw_get_date(void)
+{
+	return 0;
+}
+static inline bool sysfw_vendor_is(const char *str)
+{
+	return false;
+}
+static const struct sysfw_id *sysfw_callback(const struct sysfw_id *list)
+{
+	return NULL;
+}
+static inline void sysfw_init_late(void)
+{
+	return;
+}
+#endif /* CONFIG_SYSTEM_FIRMWARE */
+
+#define sysfw_vendor_contains(str) sysfw_vendor_is(str)
+
+#endif /* _SYSFW_H */
diff --git a/init/main.c b/init/main.c
index d7211fa..8b99aeb 100644
--- a/init/main.c
+++ b/init/main.c
@@ -68,6 +68,7 @@
 #include <linux/shmem_fs.h>
 #include <linux/slab.h>
 #include <linux/perf_event.h>
+#include <linux/sysfw.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -554,6 +555,8 @@ asmlinkage void __init start_kernel(void)
 
 	kmem_cache_init_late();
 
+	sysfw_init_late();
+
 	/*
 	 * HACK ALERT! This is early. We're enabling the console before
 	 * we've done PCI setups etc, and console_init() must be aware of
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index e26e2fb..92a27e3 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -753,26 +753,26 @@ static int do_spi_entry(const char *filename, struct spi_device_id *id,
 	return 1;
 }
 
-static const struct dmifield {
+static const struct sysfwfield {
 	const char *prefix;
 	int field;
-} dmi_fields[] = {
-	{ "bvn", DMI_BIOS_VENDOR },
-	{ "bvr", DMI_BIOS_VERSION },
-	{ "bd",  DMI_BIOS_DATE },
-	{ "svn", DMI_SYS_VENDOR },
-	{ "pn",  DMI_PRODUCT_NAME },
-	{ "pvr", DMI_PRODUCT_VERSION },
-	{ "rvn", DMI_BOARD_VENDOR },
-	{ "rn",  DMI_BOARD_NAME },
-	{ "rvr", DMI_BOARD_VERSION },
-	{ "cvn", DMI_CHASSIS_VENDOR },
-	{ "ct",  DMI_CHASSIS_TYPE },
-	{ "cvr", DMI_CHASSIS_VERSION },
-	{ NULL,  DMI_NONE }
+} sysfw_fields[] = {
+	{ "bvn", SYSFW_BIOS_VENDOR },
+	{ "bvr", SYSFW_BIOS_VERSION },
+	{ "bd",  SYSFW_BIOS_DATE },
+	{ "svn", SYSFW_SYS_VENDOR },
+	{ "pn",  SYSFW_PRODUCT_NAME },
+	{ "pvr", SYSFW_PRODUCT_VERSION },
+	{ "rvn", SYSFW_BOARD_VENDOR },
+	{ "rn",  SYSFW_BOARD_NAME },
+	{ "rvr", SYSFW_BOARD_VERSION },
+	{ "cvn", SYSFW_CHASSIS_VENDOR },
+	{ "ct",  SYSFW_CHASSIS_TYPE },
+	{ "cvr", SYSFW_CHASSIS_VERSION },
+	{ NULL,  SYSFW_NONE }
 };
 
-static void dmi_ascii_filter(char *d, const char *s)
+static void sysfw_ascii_filter(char *d, const char *s)
 {
 	/* Filter out characters we don't want to see in the modalias string */
 	for (; *s; s++)
@@ -783,20 +783,20 @@ static void dmi_ascii_filter(char *d, const char *s)
 }
 
 
-static int do_dmi_entry(const char *filename, struct dmi_system_id *id,
-			char *alias)
+static int do_sysfw_entry(const char *filename, struct sysfw_id *id,
+			  char *alias)
 {
 	int i, j;
 
-	sprintf(alias, "dmi*");
+	sprintf(alias, "sysfw*");
 
-	for (i = 0; i < ARRAY_SIZE(dmi_fields); i++) {
+	for (i = 0; i < ARRAY_SIZE(sysfw_fields); i++) {
 		for (j = 0; j < 4; j++) {
 			if (id->matches[j].slot &&
-			    id->matches[j].slot == dmi_fields[i].field) {
+			    id->matches[j].slot == sysfw_fields[i].field) {
 				sprintf(alias + strlen(alias), ":%s*",
-					dmi_fields[i].prefix);
-				dmi_ascii_filter(alias + strlen(alias),
+					sysfw_fields[i].prefix);
+				sysfw_ascii_filter(alias + strlen(alias),
 						 id->matches[j].substr);
 				strcat(alias, "*");
 			}
@@ -1002,10 +1002,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		do_table(symval, sym->st_size,
 			 sizeof(struct spi_device_id), "spi",
 			 do_spi_entry, mod);
-	else if (sym_is(symname, "__mod_dmi_device_table"))
+	else if (sym_is(symname, "__mod_sysfw_device_table"))
 		do_table(symval, sym->st_size,
-			 sizeof(struct dmi_system_id), "dmi",
-			 do_dmi_entry, mod);
+			 sizeof(struct sysfw_id), "sysfw",
+			 do_sysfw_entry, mod);
 	else if (sym_is(symname, "__mod_platform_device_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct platform_device_id), "platform",
-- 
1.6.5.2

^ permalink raw reply related

* [PATCH 02/34] New SMBIOS driver for x86 and ia64.
From: Prarit Bhargava @ 2011-07-18 13:08 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Prarit Bhargava, linux-ia64-u79uwXL29TY76Z2rM5mHXA,
	x86-DgEjT+Ai2ygdnm+yROfE0A, linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	linux-ide-u79uwXL29TY76Z2rM5mHXA,
	openipmi-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	lm-sensors-GZX6beZjE8VD60Wz+7aTrA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-media-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-pci-u79uwXL29TY76Z2rM5mHXA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	evel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	device-drivers-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ, dz-8fiUuRrzOP0dnm+yROfE0A,
	rpurdie-Fm38FmjxZ/leoWH0uzbU5w, eric.piel-VkQ1JFuSMpfAbQlEx87xDw,
	abelay-3s7WtUTddSA, johnpol-9fLWQ3dKdXwox3rIn2DAYQ
In-Reply-To: <1310994528-26276-1-git-send-email-prarit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

This, along with the System Firmware (sysfw) interface replaces the existing
DMI code in the kernel.

This subsystem provides functionality for individual drivers to access
the SMBIOS structures for their own use, smbios_walk(), as well as some
helper functions for some kernel modules.

Cc: linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: openipmi-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Cc: evel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: device-drivers-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org
Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org
Cc: dz-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org
Cc: rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org
Cc: eric.piel-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org
Cc: abelay-3s7WtUTddSA@public.gmane.org
Cc: johnpol-9fLWQ3dKdXwox3rIn2DAYQ@public.gmane.org
Signed-off-by: Prarit Bhargava <prarit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 Documentation/ABI/obsolete/sysfs-dmi   |   40 ++
 Documentation/ABI/testing/sysfw-smbios |   36 ++
 arch/ia64/Kconfig                      |    5 +
 arch/ia64/include/asm/smbios.h         |   12 +
 arch/x86/Kconfig                       |   10 +
 arch/x86/include/asm/smbios.h          |   19 +
 drivers/firmware/Kconfig               |   20 +
 drivers/firmware/Makefile              |    2 +
 drivers/firmware/smbios-sysfs.c        |  705 ++++++++++++++++++++++++++++++++
 drivers/firmware/smbios.c              |  687 +++++++++++++++++++++++++++++++
 include/linux/smbios.h                 |  243 +++++++++++
 11 files changed, 1779 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/obsolete/sysfs-dmi
 create mode 100644 Documentation/ABI/testing/sysfw-smbios
 create mode 100644 arch/ia64/include/asm/smbios.h
 create mode 100644 arch/x86/include/asm/smbios.h
 create mode 100644 drivers/firmware/smbios-sysfs.c
 create mode 100644 drivers/firmware/smbios.c
 create mode 100644 include/linux/smbios.h

diff --git a/Documentation/ABI/obsolete/sysfs-dmi b/Documentation/ABI/obsolete/sysfs-dmi
new file mode 100644
index 0000000..547dc4b
--- /dev/null
+++ b/Documentation/ABI/obsolete/sysfs-dmi
@@ -0,0 +1,40 @@
+What:		/sys/class/dmi
+Date:		July 2011
+KernelVersion:	3.0
+Contact:	Prarit Bhargava <prarit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
+Description:
+		The dmi class is exported if CONFIG_SMBIOS_DMI_COMPAT is
+		set.
+
+		The DMI code currently exposes several values via sysfs.
+		These values are:
+
+		bios_date: The datestamp of the BIOS.
+		bios_vendor: The company that wrote the BIOS.
+		bios_version: The version of the BIOS.
+		board_asset_tag: A unique identifier for the system
+				 motherboard.
+		board_name: The name of the type of motherboard.
+		board_serial: The serial number of the motherboard.
+		board_vendor: The company that designed the motherboard.
+		board_version: The version of the motherboard.
+		chassis_asset_tag: A unique identifier for the chassis.
+		chassis_serial: The serial number of the chassis.
+		chassis_type: The type of chassis.
+		chassis_vendor: The company that designed the chassis.
+		chassis_version: The version of the chassis.
+		product_name: The name of the system as determined by the
+			      OEM.
+		product_serial: The serial number of the system.
+		product_uuid: A unique UUID for the system.
+		product_version: The version number of the system.
+		sys_vendor: The OEM company for the system.
+
+		In addition to these the standard class files are exposed
+		for DMI (uvent, power, subsystem) as well as a modalias
+		file.
+
+		The dmi class is deprecated and should not be used by new
+		code.  Existing code should be migrated to use
+		/sys/class/smbios/* which exposes the same data.
+		The dmi class link will be removed in July of 2013.
diff --git a/Documentation/ABI/testing/sysfw-smbios b/Documentation/ABI/testing/sysfw-smbios
new file mode 100644
index 0000000..c6045f1
--- /dev/null
+++ b/Documentation/ABI/testing/sysfw-smbios
@@ -0,0 +1,36 @@
+What:		/sys/bus/sysfw
+Date:		May 1 2011
+KernelVersion:	2.6.39
+Contact:	Prarit Bhargava <prarit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
+Description:
+		The dmi class is exported if CONFIG_SMBIOS is set.
+
+		The SMBIOS code currently exposes several values via sysfs
+		primarily for use by module handling code.
+
+		These values are:
+
+		bios_date: The datestamp of the BIOS.
+		bios_vendor: The company that wrote the BIOS.
+		bios_version: The version of the BIOS.
+		board_asset_tag: A unique identifier for the system
+				 motherboard.
+		board_name: The name of the type of motherboard.
+		board_serial: The serial number of the motherboard.
+		board_vendor: The company that designed the motherboard.
+		board_version: The version of the motherboard.
+		chassis_asset_tag: A unique identifier for the chassis.
+		chassis_serial: The serial number of the chassis.
+		chassis_type: The type of chassis.
+		chassis_vendor: The company that designed the chassis.
+		chassis_version: The version of the chassis.
+		product_name: The name of the system as determined by the
+			      OEM.
+		product_serial: The serial number of the system.
+		product_uuid: A unique UUID for the system.
+		product_version: The version number of the system.
+		sys_vendor: The OEM company for the system.
+
+		In addition to these the standard class files are exposed
+		for SMBIOS (uvent, power, subsystem) as well as a modalias
+		file.
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 38280ef..ac14d3c 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -93,6 +93,11 @@ config DMI
 	bool
 	default y
 
+config SMBIOS
+	bool
+	default y
+	depends on SYSTEM_FIRMWARE
+
 config EFI
 	bool
 	default y
diff --git a/arch/ia64/include/asm/smbios.h b/arch/ia64/include/asm/smbios.h
new file mode 100644
index 0000000..19c0019
--- /dev/null
+++ b/arch/ia64/include/asm/smbios.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_SMBIOS_H
+#define _ASM_SMBIOS_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for SMBIOS */
+#define smbios_ioremap ioremap
+#define smbios_iounmap(x, l) iounmap(x)
+#define smbios_alloc(l) kmalloc(l, GFP_ATOMIC)
+
+#endif
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index da34972..e7cdde8 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -635,6 +635,16 @@ config DMI
 	  affected by entries in the DMI blacklist. Required by PNP
 	  BIOS code.
 
+config SMBIOS
+	depends on SYSTEM_FIRMWARE
+	bool "Enable SMBIOS scanning" if EXPERT
+	default y
+	---help---
+	  Enabled scanning of SMBIOS to identify machine quirks. Say Y
+	  here unless you have verified that your setup is not
+	  affected by entries in the SMBIOS blacklist. Required by PNP
+	  BIOS code.
+
 config GART_IOMMU
 	bool "GART IOMMU support" if EXPERT
 	default y
diff --git a/arch/x86/include/asm/smbios.h b/arch/x86/include/asm/smbios.h
new file mode 100644
index 0000000..767270b
--- /dev/null
+++ b/arch/x86/include/asm/smbios.h
@@ -0,0 +1,19 @@
+#ifndef _ASM_X86_SMBIOS_H
+#define _ASM_X86_SMBIOS_H
+
+#include <linux/compiler.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/setup.h>
+
+static __always_inline __init void *smbios_alloc(unsigned len)
+{
+	return extend_brk(len, sizeof(int));
+}
+
+/* Use early IO mappings for SMBIOS because it's initialized early */
+#define smbios_ioremap early_ioremap
+#define smbios_iounmap early_iounmap
+
+#endif /* _ASM_X86_SMBIOS_H */
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 79a1b9d..23066d8 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -182,6 +182,26 @@ config SYSTEM_FIRMWARE_DMI_COMPAT
 	  should not be used in new user space software.  Please see
 	  Documentation/ABI for details.
 
+config SYSTEM_FIRMWARE_DMI_COMPAT
+	bool "Export dmi compatibility class in sysfs"
+	depends on SMBIOSID
+	default y
+	help
+	  This exposes /sys/class/dmi/* as a pointer to the sysfw class for
+	  old software.  This is purely a backwards compatability feature and
+	  should not be used in new user space software.  Please see
+	  Documentation/ABI for details.
+
+config SMBIOS_SYSFS
+	tristate "SMBIOS table support in sysfs"
+	depends on SYSFS && SMBIOS
+	help
+	  Say Y or M here to enable the exporting of the raw SMBIOS table
+	  data via sysfs.  This is useful for consuming the data without
+	  requiring any access to /dev/mem at all.  Tables are found
+	  under /sys/firmware/smbios when this option is enabled and
+	  loaded.
+
 source "drivers/firmware/google/Kconfig"
 
 endmenu
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 41bc64a..5c9d81f 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -16,3 +16,5 @@ obj-$(CONFIG_SIGMA)		+= sigma.o
 obj-$(CONFIG_GOOGLE_FIRMWARE)	+= google/
 obj-$(CONFIG_SYSTEM_FIRMWARE)	+= sysfw.o
 obj-$(CONFIG_SYSTEM_FIRMWARE_SYSFS)	+= sysfw-sysfs.o
+obj-$(CONFIG_SMBIOS)		+= smbios.o
+obj-$(CONFIG_SMBIOS_SYSFS)	+= smbios-sysfs.o
diff --git a/drivers/firmware/smbios-sysfs.c b/drivers/firmware/smbios-sysfs.c
new file mode 100644
index 0000000..9fd36a6
--- /dev/null
+++ b/drivers/firmware/smbios-sysfs.c
@@ -0,0 +1,705 @@
+/*
+ * smbios-sysfs.c
+ *
+ * This module exports the SMBIOS tables read-only to userspace through the
+ * sysfs file system.
+ *
+ * Data is currently found below
+ *    /sys/firmware/smbios/...
+ *
+ * SMBIOS attributes are presented in attribute files with names
+ * formatted using %d-%d, so that the first integer indicates the
+ * structure type (0-255), and the second field is the instance of that
+ * entry.
+ *
+ * Copyright 2011 Google, Inc.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kobject.h>
+#include <linux/smbios.h>
+#include <linux/capability.h>
+#include <linux/slab.h>
+#include <linux/list.h>
+#include <linux/io.h>
+
+#define MAX_ENTRY_TYPE 255 /* Most of these aren't used, but we consider
+			      the top entry type is only 8 bits */
+
+struct smbios_sysfs_entry {
+	struct smbios_header dh;
+	struct kobject kobj;
+	int instance;
+	int position;
+	struct list_head list;
+	struct kobject *child;
+};
+
+/*
+ * Global list of smbios_sysfs_entry.  Even though this should only be
+ * manipulated at setup and teardown, the lazy nature of the kobject
+ * system means we get lazy removes.
+ */
+static LIST_HEAD(entry_list);
+static DEFINE_SPINLOCK(entry_list_lock);
+
+/* smbios_sysfs_attribute - Top level attribute. used by all entries. */
+struct smbios_sysfs_attribute {
+	struct attribute attr;
+	ssize_t (*show)(struct smbios_sysfs_entry *entry, char *buf);
+};
+
+#define SMBIOS_SYSFS_ATTR(_entry, _name) \
+struct smbios_sysfs_attribute smbios_sysfs_attr_##_entry##_##_name = { \
+	.attr = {.name = __stringify(_name), .mode = 0400}, \
+	.show = smbios_sysfs_##_entry##_##_name, \
+}
+
+/*
+ * smbios_sysfs_mapped_attribute - Attribute where we require the entry be
+ * mapped in.  Use in conjunction with smbios_sysfs_specialize_attr_ops.
+ */
+struct smbios_sysfs_mapped_attribute {
+	struct attribute attr;
+	ssize_t (*show)(struct smbios_sysfs_entry *entry,
+			const struct smbios_header *dh,
+			char *buf);
+};
+
+#define SMBIOS_SYSFS_MAPPED_ATTR(_entry, _name) \
+struct smbios_sysfs_mapped_attribute smbios_sysfs_attr_##_entry##_##_name = { \
+	.attr = {.name = __stringify(_name), .mode = 0400}, \
+	.show = smbios_sysfs_##_entry##_##_name, \
+}
+
+/*************************************************
+ * Generic SMBIOS entry support.
+ *************************************************/
+static void smbios_entry_free(struct kobject *kobj)
+{
+	kfree(kobj);
+}
+
+static struct smbios_sysfs_entry *to_entry(struct kobject *kobj)
+{
+	return container_of(kobj, struct smbios_sysfs_entry, kobj);
+}
+
+static struct smbios_sysfs_attribute *to_attr(struct attribute *attr)
+{
+	return container_of(attr, struct smbios_sysfs_attribute, attr);
+}
+
+static ssize_t smbios_sysfs_attr_show(struct kobject *kobj,
+				      struct attribute *_attr, char *buf)
+{
+	struct smbios_sysfs_entry *entry = to_entry(kobj);
+	struct smbios_sysfs_attribute *attr = to_attr(_attr);
+
+	/* SMBIOS stuff is only ever admin visible */
+	if (!capable(CAP_SYS_ADMIN))
+		return -EACCES;
+
+	return attr->show(entry, buf);
+}
+
+static const struct sysfs_ops smbios_sysfs_attr_ops = {
+	.show = smbios_sysfs_attr_show,
+};
+
+typedef ssize_t (*smbios_callback)(struct smbios_sysfs_entry *,
+				   const struct smbios_header *dh, void *);
+
+struct find_smbios_data {
+	struct smbios_sysfs_entry	*entry;
+	smbios_callback		callback;
+	void			*private;
+	int			instance_countdown;
+	ssize_t			ret;
+};
+
+static int find_smbios_entry_helper(const union smbios_struct *ss, void *_data)
+{
+	struct find_smbios_data *data = _data;
+	struct smbios_sysfs_entry *entry = data->entry;
+
+	/* Is this the entry we want? */
+	if (ss->header.type != entry->dh.type)
+		return SMBIOS_WALK_CONTINUE;
+
+	if (data->instance_countdown != 0) {
+		/* try the next instance? */
+		data->instance_countdown--;
+		return SMBIOS_WALK_CONTINUE;
+	}
+
+	/*
+	 * Don't ever revisit the instance.  Short circuit later
+	 * instances by letting the instance_countdown run negative
+	 */
+	data->instance_countdown--;
+
+	/* Found the entry */
+	data->ret = data->callback(entry, &ss->header, data->private);
+
+	return SMBIOS_WALK_STOP;
+}
+
+/* State for passing the read parameters through smbios_find_entry() */
+struct smbios_read_state {
+	char *buf;
+	loff_t pos;
+	size_t count;
+};
+
+static ssize_t find_smbios_entry(struct smbios_sysfs_entry *entry,
+				 smbios_callback callback, void *private)
+{
+	struct find_smbios_data data = {
+		.entry = entry,
+		.callback = callback,
+		.private = private,
+		.instance_countdown = entry->instance,
+		.ret = -EIO,  /* To signal the entry disappeared */
+	};
+	const union smbios_struct *ss;
+
+	ss = smbios_walk(find_smbios_entry_helper, &data);
+	if (!ss)
+		return -EINVAL;
+	return data.ret;
+}
+
+/*
+ * Calculate and return the byte length of the smbios entry identified by
+ * dh.  This includes both the formatted portion as well as the
+ * unformatted string space, including the two trailing nul characters.
+ */
+static size_t smbios_entry_length(const struct smbios_header *dh)
+{
+	const char *p = (const char *)dh;
+
+	p += dh->length;
+
+	while (p[0] || p[1])
+		p++;
+
+	return 2 + p - (const char *)dh;
+}
+
+/*************************************************
+ * Support bits for specialized SMBIOS entry support
+ *************************************************/
+struct smbios_entry_attr_show_data {
+	struct attribute *attr;
+	char *buf;
+};
+
+static ssize_t smbios_entry_attr_show_helper(struct smbios_sysfs_entry *entry,
+					     const struct smbios_header *dh,
+					     void *_data)
+{
+	struct smbios_entry_attr_show_data *data = _data;
+	struct smbios_sysfs_mapped_attribute *attr;
+
+	attr = container_of(data->attr,
+			    struct smbios_sysfs_mapped_attribute, attr);
+	return attr->show(entry, dh, data->buf);
+}
+
+static ssize_t smbios_entry_attr_show(struct kobject *kobj,
+				      struct attribute *attr,
+				      char *buf)
+{
+	struct smbios_entry_attr_show_data data = {
+		.attr = attr,
+		.buf  = buf,
+	};
+	/* Find the entry according to our parent and call the
+	 * normalized show method hanging off of the attribute */
+	return find_smbios_entry(to_entry(kobj->parent),
+				 smbios_entry_attr_show_helper, &data);
+}
+
+static const struct sysfs_ops smbios_sysfs_specialize_attr_ops = {
+	.show = smbios_entry_attr_show,
+};
+
+/*************************************************
+ * Specialized SMBIOS entry support.
+ *************************************************/
+
+/*** Type 15 - System Event Table ***/
+
+#define SMBIOS_SEL_ACCESS_METHOD_IO8	0x00
+#define SMBIOS_SEL_ACCESS_METHOD_IO2x8	0x01
+#define SMBIOS_SEL_ACCESS_METHOD_IO16	0x02
+#define SMBIOS_SEL_ACCESS_METHOD_PHYS32	0x03
+#define SMBIOS_SEL_ACCESS_METHOD_GPNV	0x04
+
+struct smbios_system_event_log {
+	struct smbios_header header;
+	u16	area_length;
+	u16	header_start_offset;
+	u16	data_start_offset;
+	u8	access_method;
+	u8	status;
+	u32	change_token;
+	union {
+		struct {
+			u16 index_addr;
+			u16 data_addr;
+		} io;
+		u32	phys_addr32;
+		u16	gpnv_handle;
+		u32	access_method_address;
+	};
+	u8	header_format;
+	u8	type_descriptors_supported_count;
+	u8	per_log_type_descriptor_length;
+	u8	supported_log_type_descriptos[0];
+} __packed;
+
+#define SMBIOS_SYSFS_SEL_FIELD(_field) \
+static ssize_t smbios_sysfs_sel_##_field(struct smbios_sysfs_entry *entry, \
+					 const struct smbios_header *dh, \
+					 char *buf) \
+{ \
+	struct smbios_system_event_log sel; \
+	if (sizeof(sel) > smbios_entry_length(dh)) \
+		return -EIO; \
+	memcpy(&sel, dh, sizeof(sel)); \
+	return sprintf(buf, "%u\n", sel._field); \
+} \
+static SMBIOS_SYSFS_MAPPED_ATTR(sel, _field)
+
+SMBIOS_SYSFS_SEL_FIELD(area_length);
+SMBIOS_SYSFS_SEL_FIELD(header_start_offset);
+SMBIOS_SYSFS_SEL_FIELD(data_start_offset);
+SMBIOS_SYSFS_SEL_FIELD(access_method);
+SMBIOS_SYSFS_SEL_FIELD(status);
+SMBIOS_SYSFS_SEL_FIELD(change_token);
+SMBIOS_SYSFS_SEL_FIELD(access_method_address);
+SMBIOS_SYSFS_SEL_FIELD(header_format);
+SMBIOS_SYSFS_SEL_FIELD(type_descriptors_supported_count);
+SMBIOS_SYSFS_SEL_FIELD(per_log_type_descriptor_length);
+
+static struct attribute *smbios_sysfs_sel_attrs[] = {
+	&smbios_sysfs_attr_sel_area_length.attr,
+	&smbios_sysfs_attr_sel_header_start_offset.attr,
+	&smbios_sysfs_attr_sel_data_start_offset.attr,
+	&smbios_sysfs_attr_sel_access_method.attr,
+	&smbios_sysfs_attr_sel_status.attr,
+	&smbios_sysfs_attr_sel_change_token.attr,
+	&smbios_sysfs_attr_sel_access_method_address.attr,
+	&smbios_sysfs_attr_sel_header_format.attr,
+	&smbios_sysfs_attr_sel_type_descriptors_supported_count.attr,
+	&smbios_sysfs_attr_sel_per_log_type_descriptor_length.attr,
+	NULL,
+};
+
+
+static struct kobj_type smbios_system_event_log_ktype = {
+	.release = smbios_entry_free,
+	.sysfs_ops = &smbios_sysfs_specialize_attr_ops,
+	.default_attrs = smbios_sysfs_sel_attrs,
+};
+
+typedef u8 (*sel_io_reader)(const struct smbios_system_event_log *sel,
+			    loff_t offset);
+
+static DEFINE_MUTEX(io_port_lock);
+
+static u8 read_sel_8bit_indexed_io(const struct smbios_system_event_log *sel,
+				   loff_t offset)
+{
+	u8 ret;
+
+	mutex_lock(&io_port_lock);
+	outb((u8)offset, sel->io.index_addr);
+	ret = inb(sel->io.data_addr);
+	mutex_unlock(&io_port_lock);
+	return ret;
+}
+
+static u8 read_sel_2x8bit_indexed_io(const struct smbios_system_event_log *sel,
+				     loff_t offset)
+{
+	u8 ret;
+
+	mutex_lock(&io_port_lock);
+	outb((u8)offset, sel->io.index_addr);
+	outb((u8)(offset >> 8), sel->io.index_addr + 1);
+	ret = inb(sel->io.data_addr);
+	mutex_unlock(&io_port_lock);
+	return ret;
+}
+
+static u8 read_sel_16bit_indexed_io(const struct smbios_system_event_log *sel,
+				    loff_t offset)
+{
+	u8 ret;
+
+	mutex_lock(&io_port_lock);
+	outw((u16)offset, sel->io.index_addr);
+	ret = inb(sel->io.data_addr);
+	mutex_unlock(&io_port_lock);
+	return ret;
+}
+
+static sel_io_reader sel_io_readers[] = {
+	[SMBIOS_SEL_ACCESS_METHOD_IO8]	= read_sel_8bit_indexed_io,
+	[SMBIOS_SEL_ACCESS_METHOD_IO2x8]	= read_sel_2x8bit_indexed_io,
+	[SMBIOS_SEL_ACCESS_METHOD_IO16]	= read_sel_16bit_indexed_io,
+};
+
+static ssize_t smbios_sel_raw_read_io(struct smbios_sysfs_entry *entry,
+				      const struct smbios_system_event_log *sel,
+				      char *buf, loff_t pos, size_t count)
+{
+	ssize_t wrote = 0;
+
+	sel_io_reader io_reader = sel_io_readers[sel->access_method];
+
+	while (count && pos < sel->area_length) {
+		count--;
+		*(buf++) = io_reader(sel, pos++);
+		wrote++;
+	}
+
+	return wrote;
+}
+
+static ssize_t smbios_sel_raw_read_phys32(struct smbios_sysfs_entry *entry,
+				      const struct smbios_system_event_log *sel,
+					  char *buf, loff_t pos, size_t count)
+{
+	u8 __iomem *mapped;
+	ssize_t wrote = 0;
+
+	mapped = ioremap(sel->access_method_address, sel->area_length);
+	if (!mapped)
+		return -EIO;
+
+	while (count && pos < sel->area_length) {
+		count--;
+		*(buf++) = readb(mapped + pos++);
+		wrote++;
+	}
+
+	iounmap(mapped);
+	return wrote;
+}
+
+static ssize_t smbios_sel_raw_read_helper(struct smbios_sysfs_entry *entry,
+					  const struct smbios_header *dh,
+					  void *_state)
+{
+	struct smbios_read_state *state = _state;
+	struct smbios_system_event_log sel;
+
+	if (sizeof(sel) > smbios_entry_length(dh))
+		return -EIO;
+
+	memcpy(&sel, dh, sizeof(sel));
+
+	switch (sel.access_method) {
+	case SMBIOS_SEL_ACCESS_METHOD_IO8:
+	case SMBIOS_SEL_ACCESS_METHOD_IO2x8:
+	case SMBIOS_SEL_ACCESS_METHOD_IO16:
+		return smbios_sel_raw_read_io(entry, &sel, state->buf,
+					      state->pos, state->count);
+	case SMBIOS_SEL_ACCESS_METHOD_PHYS32:
+		return smbios_sel_raw_read_phys32(entry, &sel, state->buf,
+						  state->pos, state->count);
+	case SMBIOS_SEL_ACCESS_METHOD_GPNV:
+		pr_info("smbios-sysfs: GPNV support missing.\n");
+		return -EIO;
+	default:
+		pr_info("smbios-sysfs: Unknown access method %02x\n",
+			sel.access_method);
+		return -EIO;
+	}
+}
+
+static ssize_t smbios_sel_raw_read(struct file *filp, struct kobject *kobj,
+				   struct bin_attribute *bin_attr,
+				   char *buf, loff_t pos, size_t count)
+{
+	struct smbios_sysfs_entry *entry = to_entry(kobj->parent);
+	struct smbios_read_state state = {
+		.buf = buf,
+		.pos = pos,
+		.count = count,
+	};
+
+	return find_smbios_entry(entry, smbios_sel_raw_read_helper, &state);
+}
+
+static struct bin_attribute smbios_sel_raw_attr = {
+	.attr = {.name = "raw_event_log", .mode = 0400},
+	.read = smbios_sel_raw_read,
+};
+
+static int smbios_system_event_log(struct smbios_sysfs_entry *entry)
+{
+	int ret;
+
+	entry->child = kzalloc(sizeof(*entry->child), GFP_KERNEL);
+	if (!entry->child)
+		return -ENOMEM;
+	ret = kobject_init_and_add(entry->child,
+				   &smbios_system_event_log_ktype,
+				   &entry->kobj,
+				   "system_event_log");
+	if (ret)
+		goto out_free;
+
+	ret = sysfs_create_bin_file(entry->child, &smbios_sel_raw_attr);
+	if (ret)
+		goto out_del;
+
+	return 0;
+
+out_del:
+	kobject_del(entry->child);
+out_free:
+	kfree(entry->child);
+	return ret;
+}
+
+/*************************************************
+ * Generic SMBIOS entry support.
+ *************************************************/
+
+static ssize_t smbios_sysfs_entry_length(struct smbios_sysfs_entry *entry,
+					 char *buf)
+{
+	return sprintf(buf, "%d\n", entry->dh.length);
+}
+
+static ssize_t smbios_sysfs_entry_handle(struct smbios_sysfs_entry *entry,
+					 char *buf)
+{
+	return sprintf(buf, "%d\n", entry->dh.handle);
+}
+
+static ssize_t smbios_sysfs_entry_type(struct smbios_sysfs_entry *entry,
+				       char *buf)
+{
+	return sprintf(buf, "%d\n", entry->dh.type);
+}
+
+static ssize_t smbios_sysfs_entry_instance(struct smbios_sysfs_entry *entry,
+					   char *buf)
+{
+	return sprintf(buf, "%d\n", entry->instance);
+}
+
+static ssize_t smbios_sysfs_entry_position(struct smbios_sysfs_entry *entry,
+					   char *buf)
+{
+	return sprintf(buf, "%d\n", entry->position);
+}
+
+static SMBIOS_SYSFS_ATTR(entry, length);
+static SMBIOS_SYSFS_ATTR(entry, handle);
+static SMBIOS_SYSFS_ATTR(entry, type);
+static SMBIOS_SYSFS_ATTR(entry, instance);
+static SMBIOS_SYSFS_ATTR(entry, position);
+
+static struct attribute *smbios_sysfs_entry_attrs[] = {
+	&smbios_sysfs_attr_entry_length.attr,
+	&smbios_sysfs_attr_entry_handle.attr,
+	&smbios_sysfs_attr_entry_type.attr,
+	&smbios_sysfs_attr_entry_instance.attr,
+	&smbios_sysfs_attr_entry_position.attr,
+	NULL,
+};
+
+static ssize_t smbios_entry_raw_read_helper(struct smbios_sysfs_entry *entry,
+					    const struct smbios_header *dh,
+					    void *_state)
+{
+	struct smbios_read_state *state = _state;
+	size_t entry_length;
+
+	entry_length = smbios_entry_length(dh);
+
+	return memory_read_from_buffer(state->buf, state->count,
+				       &state->pos, dh, entry_length);
+}
+
+static ssize_t smbios_entry_raw_read(struct file *filp,
+				     struct kobject *kobj,
+				     struct bin_attribute *bin_attr,
+				     char *buf, loff_t pos, size_t count)
+{
+	struct smbios_sysfs_entry *entry = to_entry(kobj);
+	struct smbios_read_state state = {
+		.buf = buf,
+		.pos = pos,
+		.count = count,
+	};
+
+	return find_smbios_entry(entry, smbios_entry_raw_read_helper, &state);
+}
+
+static const struct bin_attribute smbios_entry_raw_attr = {
+	.attr = {.name = "raw", .mode = 0400},
+	.read = smbios_entry_raw_read,
+};
+
+static void smbios_sysfs_entry_release(struct kobject *kobj)
+{
+	struct smbios_sysfs_entry *entry = to_entry(kobj);
+	sysfs_remove_bin_file(&entry->kobj, &smbios_entry_raw_attr);
+	spin_lock(&entry_list_lock);
+	list_del(&entry->list);
+	spin_unlock(&entry_list_lock);
+	kfree(entry);
+}
+
+static struct kobj_type smbios_sysfs_entry_ktype = {
+	.release = smbios_sysfs_entry_release,
+	.sysfs_ops = &smbios_sysfs_attr_ops,
+	.default_attrs = smbios_sysfs_entry_attrs,
+};
+
+static struct kobject *smbios_kobj;
+static struct kset *smbios_kset;
+
+/* Global count of all instances seen.  Only for setup */
+static int __initdata instance_counts[MAX_ENTRY_TYPE + 1];
+
+/* Global positional count of all entries seen.  Only for setup */
+static int __initdata position_count;
+
+static int __init smbios_sysfs_register_handle(const union smbios_struct *ss,
+					       void *_ret)
+{
+	struct smbios_sysfs_entry *entry;
+	int *ret = _ret;
+
+	/* Allocate and register a new entry into the entries set */
+	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+	if (!entry) {
+		*ret = -ENOMEM;
+		return SMBIOS_WALK_STOP;
+	}
+
+	/* Set the key */
+	memcpy(&entry->dh, &ss->header, sizeof(struct smbios_header));
+	entry->instance = instance_counts[ss->header.type]++;
+	entry->position = position_count++;
+
+	entry->kobj.kset = smbios_kset;
+	*ret = kobject_init_and_add(&entry->kobj, &smbios_sysfs_entry_ktype,
+				    NULL,
+				    "%d-%d", ss->header.type, entry->instance);
+
+	if (*ret) {
+		kfree(entry);
+		return SMBIOS_WALK_STOP;
+	}
+
+	/* Thread on the global list for cleanup */
+	spin_lock(&entry_list_lock);
+	list_add_tail(&entry->list, &entry_list);
+	spin_unlock(&entry_list_lock);
+
+	/* Handle specializations by type */
+	switch (ss->header.type) {
+	case 15:
+		/* System Event Log */
+		*ret = smbios_system_event_log(entry);
+		break;
+	default:
+		/* No specialization */
+		break;
+	}
+	if (*ret)
+		goto out_err;
+
+	/* Create the raw binary file to access the entry */
+	*ret = sysfs_create_bin_file(&entry->kobj, &smbios_entry_raw_attr);
+	if (*ret)
+		goto out_err;
+
+	return SMBIOS_WALK_CONTINUE;
+out_err:
+	kobject_put(entry->child);
+	kobject_put(&entry->kobj);
+	return SMBIOS_WALK_STOP;
+}
+
+static void cleanup_entry_list(void)
+{
+	struct smbios_sysfs_entry *entry, *next;
+
+	/* No locks, we are on our way out */
+	list_for_each_entry_safe(entry, next, &entry_list, list) {
+		kobject_put(entry->child);
+		kobject_put(&entry->kobj);
+	}
+}
+
+static int __init smbios_sysfs_init(void)
+{
+	int error = -ENOMEM;
+	int val, ret;
+	const union smbios_struct *ss;
+
+	/* Set up our directory */
+	smbios_kobj = kobject_create_and_add("smbios", firmware_kobj);
+	if (!smbios_kobj)
+		goto err;
+
+	smbios_kset = kset_create_and_add("entries", NULL, smbios_kobj);
+	if (!smbios_kset)
+		goto err;
+
+	val = 0;
+	ss = smbios_walk(smbios_sysfs_register_handle, &val);
+	if (ss) {
+		error = -EIO;
+		goto err;
+	}
+	if (val) {
+		error = val;
+		goto err;
+	}
+
+#ifdef CONFIG_SYSTEM_FIRMWARE_DMI_COMPAT
+	ret = sysfs_create_link(firmware_kobj, smbios_kobj, "dmi");
+	if (!ret)
+		pr_debug("smbios-sysfs: DMI compatibility failed.\n");
+#endif
+	pr_debug("smbios-sysfs: loaded.\n");
+
+	return 0;
+err:
+	cleanup_entry_list();
+	kset_unregister(smbios_kset);
+	kobject_put(smbios_kobj);
+	return error;
+}
+
+/* clean up everything. */
+static void __exit smbios_sysfs_exit(void)
+{
+	pr_debug("smbios-sysfs: unloading.\n");
+	cleanup_entry_list();
+	kset_unregister(smbios_kset);
+	kobject_put(smbios_kobj);
+}
+
+module_init(smbios_sysfs_init);
+module_exit(smbios_sysfs_exit);
+
+MODULE_AUTHOR("Mike Waychison <mikew-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>");
+MODULE_DESCRIPTION("SMBIOS sysfs support");
+MODULE_LICENSE("GPL");
diff --git a/drivers/firmware/smbios.c b/drivers/firmware/smbios.c
new file mode 100644
index 0000000..ff83ae5
--- /dev/null
+++ b/drivers/firmware/smbios.c
@@ -0,0 +1,687 @@
+/*
+ * SMBIOS support
+ *
+ * started by Prarit Bhargava, Copyright (C) 2011 Red Hat, Inc.
+ *
+ * SMBIOS interpretation
+ *
+ * Some bits copied directly from original dmi*.c files
+ */
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/ctype.h>
+#include <linux/smbios.h>
+#include <linux/efi.h>
+#include <linux/bootmem.h>
+#include <linux/sysfw.h>
+#include <linux/pci.h>
+
+#include <asm/smbios.h>
+
+/*
+ * "The SMBIOS Specification addresses how motherboard and system vendors
+ * present management information about their products in a standard format by
+ * extending the BIOS interface on x86 architecture systems. The information is
+ * intended to allow generic instrumentation to deliver this information to
+ * management applications that use DMI, CIM or direct access, eliminating the
+ * need for error prone operations like probing system hardware for presence
+ * detection."
+ *
+ * From http://www.dmtf.org/standards/smbios
+ *
+ * ... Grab the Spec.  It'll help.
+ */
+
+/*
+ * SMBIOS Structure Table Entry Point, STEP
+ */
+struct smbios_step {
+	char	anchor_string[4];	/* 0x0, always is "_SM_" */
+	u8	checksum;
+	u8	length;
+	u8	major;
+	u8	minor;
+	u16	max_size;
+	u8	eps_revision;
+	u8	reserved[5];
+	u8	dmi_string[5];		/* 0x10, always is "_DMI_" */
+	u8	intermediate_chksum;
+	u16	struct_len;
+	u32	struct_addr;
+	u16	num_structs;
+	u8	bcd_revision;
+} __packed;
+static struct smbios_step smbios_step;
+
+/* is there an SMBIOS? */
+int smbios_available;
+EXPORT_SYMBOL_GPL(smbios_available);
+
+/* Address of the actual SMBIOS struct */
+static unsigned long smbios_addr;
+
+/* Start address of the SMBIOS tables */
+static u32 smbios_base;
+/* Length of the all the SMBIOS tables */
+static u16 smbios_len;
+/* Number of SMBIOS tables */
+static u16 smbios_num;
+/*
+ * This is the BRK space or IO mapped address of the SMBIOS table.  SMBIOS is
+ * switched from BRK space and into the IO map in smbios_init_late().  After
+ * it is IO mapped, it MUST NOT be unmapped (o/w very bad things will happen).
+ */
+static u8 *smbios_map;
+
+/* We need to store the type field and the UUID somewhere. */
+static char smbios_type3_type[4];
+static char smbios_type1_uuid[16*2+4+1];
+
+/** find the first SMBIOS structure of a specific type */
+const union smbios_struct *smbios_find_struct(int type)
+{
+	int size = sizeof(struct smbios_header);
+	int i = 0;
+	u8 *data = smbios_map;
+	struct smbios_header *dm = NULL;
+
+	/*
+	 *	Stop when we see all the items the table claimed to have
+	 *	OR we run off the end of the table (also happens)
+	 */
+	while ((i < smbios_num) &&
+	       (data - smbios_map + size) <= smbios_len) {
+		dm = (struct smbios_header *)data;
+
+		/*
+		 *  We want to know the total length (formatted area and
+		 *  strings) before returning to make sure we don't return
+		 *  a partial structure
+		 */
+		data += dm->length;
+		while ((data - smbios_map < smbios_len - 1) &&
+		       (data[0] || data[1]))
+			data++;
+		if ((data - smbios_map < smbios_len - 1) &&
+		    (type == dm->type)) {
+			break;
+		}
+		data += 2;
+		i++;
+	}
+	/* just return the address */
+	return (const union smbios_struct *)dm;
+}
+
+static const char smbios_empty_string[] = "        ";
+
+/**
+ * smbios_get_string -- return a string from an SMBIOS structure
+ * @ss: pointer to structure being examined
+ * @s: number of string being examined
+ *
+ * This function returns a string within the structure ss.  Many SMBIOS
+ * structures have their strings at the end of the structure, and the location
+ * of each string is enumerated throughout the structure.
+ *
+ * For example,  The BIOS Information structure, type0, has the BIOS Version
+ * at offset 0x6, which contains a number enumerating the strings at the end
+ * of the structure.
+ *
+ * ie) s is an actual _number_, not a pointer.
+ */
+const char *smbios_get_string(const union smbios_struct *ss, u8 s)
+{
+	const u8 *bp = ((u8 *) ss) + ss->header.length;
+
+	if (s) {
+		s--;
+		while (s > 0 && *bp) {
+			bp += strlen(bp) + 1;
+			s--;
+		}
+
+		if (*bp != 0) {
+			size_t len = strlen(bp)+1;
+			size_t cmp_len = len > 8 ? 8 : len;
+
+			if (!memcmp(bp, smbios_empty_string, cmp_len))
+				return smbios_empty_string;
+			return bp;
+		}
+	}
+
+	return "";
+}
+EXPORT_SYMBOL(smbios_get_string);
+
+#define smbios_find_ptr(_ptr, _struct_name, _type, _field)		 \
+	_struct_name = smbios_find_struct(_type);			 \
+	_ptr = smbios_get_string(_struct_name,				 \
+				 _struct_name->type##_type._field);
+
+static const char *smbios_sysfw_lookup(int field)
+{
+	const union smbios_struct *ss;
+	const u8 *ptr;
+
+	switch (field) {
+	case SYSFW_BIOS_VENDOR:
+		smbios_find_ptr(ptr, ss, 0, vendor);
+		break;
+	case SYSFW_BIOS_VERSION:
+		smbios_find_ptr(ptr, ss, 0, bios_version);
+		break;
+	case SYSFW_BIOS_DATE:
+		smbios_find_ptr(ptr, ss, 0, bios_release_date);
+		break;
+	case SYSFW_SYS_VENDOR:
+		smbios_find_ptr(ptr, ss, 1, manufacturer);
+		break;
+	case SYSFW_PRODUCT_NAME:
+		smbios_find_ptr(ptr, ss, 1, product_name);
+		break;
+	case SYSFW_PRODUCT_VERSION:
+		smbios_find_ptr(ptr, ss, 1, version);
+		break;
+	case SYSFW_PRODUCT_SERIAL:
+		smbios_find_ptr(ptr, ss, 1, serial_number);
+		break;
+	case SYSFW_PRODUCT_UUID:
+		ptr = smbios_type1_uuid;
+		break;
+	case SYSFW_BOARD_VENDOR:
+		smbios_find_ptr(ptr, ss, 2, manufacturer);
+		break;
+	case SYSFW_BOARD_NAME:
+		smbios_find_ptr(ptr, ss, 2, product);
+		break;
+	case SYSFW_BOARD_VERSION:
+		smbios_find_ptr(ptr, ss, 2, version);
+		break;
+	case SYSFW_BOARD_SERIAL:
+		smbios_find_ptr(ptr, ss, 2, serial_number);
+		break;
+	case SYSFW_BOARD_ASSET_TAG:
+		smbios_find_ptr(ptr, ss, 2, asset_tag);
+		break;
+	case SYSFW_CHASSIS_VENDOR:
+		smbios_find_ptr(ptr, ss, 3, manufacturer);
+		break;
+	case SYSFW_CHASSIS_TYPE:
+		ptr = smbios_type3_type;
+		break;
+	case SYSFW_CHASSIS_VERSION:
+		smbios_find_ptr(ptr, ss, 3, version);
+		break;
+	case SYSFW_CHASSIS_SERIAL:
+		smbios_find_ptr(ptr, ss, 3, serial_number);
+		break;
+	case SYSFW_CHASSIS_ASSET_TAG:
+		smbios_find_ptr(ptr, ss, 3, asset_tag_number);
+		break;
+	case SYSFW_STRING_MAX:
+	case SYSFW_NONE:
+	default:
+		ptr = NULL;
+		break;
+	}
+
+	return (const char *)ptr;
+}
+
+/* returns date in formation YYYYMMDD for easy comparisons */
+static int smbios_sysfw_get_date(void)
+{
+	const char *smbios_date;
+	int date, d, m, y;
+
+	/* SMBIOS BIOS DATE is in DD/MM/YYYY format */
+	smbios_date = smbios_sysfw_lookup(SYSFW_BIOS_DATE);
+	if (!smbios_date)
+		return 0;
+
+	sscanf(smbios_date, "%d/%d/%d", &d, &m, &y);
+	date = (y * 10000 + m * 100 + d);
+	return date;
+}
+
+static int __init smbios_sysfw_late(void)
+{
+	if (!smbios_available)
+		return -1;
+
+	/* This looks strange but we're unmapping the BRK space and
+	 * then mapping into memory after the memory subsystem has been
+	 * initialized. */
+	smbios_iounmap(smbios_map, smbios_len);
+	smbios_map = ioremap(smbios_base, smbios_len);
+	if (!smbios_map) {
+		smbios_available = 0;
+		WARN(1, "SMBIOS ioremap failed.");
+		return -ENOMEM;
+	}
+	return 0;
+}
+
+/* print pretty things */
+static void __init print_filtered(const char *info)
+{
+	const char *p;
+
+	if (!info)
+		return;
+
+	for (p = info; *p; p++)
+		if (isprint(*p))
+			printk(KERN_CONT "%c", *p);
+		else
+			printk(KERN_CONT "\\x%02x", *p & 0xff);
+}
+
+/* Dump some basic system information at the beginning of boot */
+static void __init smbios_boot_display(void)
+{
+	const char *board;	/* Board Name is optional */
+
+	if (smbios_available)
+		printk(KERN_DEBUG "SMBIOS: ");
+	else
+		printk(KERN_DEBUG "DMI: ");
+	print_filtered(smbios_sysfw_lookup(SYSFW_SYS_VENDOR));
+	printk(KERN_CONT " ");
+	print_filtered(smbios_sysfw_lookup(SYSFW_PRODUCT_NAME));
+	board = smbios_sysfw_lookup(SYSFW_BOARD_NAME);
+	if (board) {
+		printk(KERN_CONT "/");
+		print_filtered(board);
+	}
+	printk(KERN_CONT ", BIOS ");
+	print_filtered(smbios_sysfw_lookup(SYSFW_BIOS_VERSION));
+	printk(KERN_CONT " ");
+	print_filtered(smbios_sysfw_lookup(SYSFW_BIOS_DATE));
+	printk(KERN_CONT "\n");
+}
+
+static int __init smbios_sysfw_init(void)
+{
+	smbios_boot_display();
+	printk(KERN_INFO "Registered SMBIOS sysfw driver\n");
+	return 0;
+}
+
+static struct sysfw_driver __refdata smbios_sysfw_driver = {
+	.name = "smbios",
+	.init = smbios_sysfw_init,
+	.late = smbios_sysfw_late,
+	.lookup = smbios_sysfw_lookup,
+	.date = smbios_sysfw_get_date,
+};
+
+/*
+ * There are two special "core" values, that require their own strings.
+ * These are SYSFW_CHASSIS_TYPE(ss->type3->type) and
+ * SYSFW_PRODUCT_UUID(ss->type1->uuid).
+ */
+static void smbios_decode_core(void)
+{
+	const union smbios_struct *ss;
+
+	/* SYSFW_CHASSIS_TYPE */
+	ss = smbios_find_struct(3);
+	sprintf(smbios_type3_type, "%u", ss->type3.type & 0x7f);
+	/* SYSFW_PRODUCT_UUID */
+	ss = smbios_find_struct(1);
+	sprintf(smbios_type1_uuid, "%pUB", ss->type1.uuid);
+}
+
+/* This is only useful for legacy DMI table decoding. */
+static int __init dmi_checksum(const u8 *buf)
+{
+	u8 sum = 0;
+	int a;
+
+	for (a = 0; a < 15; a++)
+		sum += buf[a];
+
+	return sum == 0;
+}
+
+/* This is only useful for legacy DMI table decoding. */
+static int __init dmi_present(const char __iomem *p)
+{
+	u8 buf[15];
+
+	memcpy_fromio(buf, p, 15);
+	if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
+		/* use smbios_ even though it's really dmi_ */
+		smbios_num = (buf[13] << 8) | buf[12];
+		smbios_len = (buf[7] << 8) | buf[6];
+		smbios_base = (buf[11] << 24) | (buf[10] << 16) |
+			(buf[9] << 8) | buf[8];
+
+		printk(KERN_INFO "DMI %d.%d present.\n", buf[14] >> 4,
+		       buf[14] & 0xF);
+
+		smbios_map = smbios_ioremap(smbios_base, smbios_len);
+		if (!smbios_map)
+			return -ENOMEM;
+		smbios_boot_display();
+	}
+	return 1;
+}
+
+/* Check and decode the SMBIOS STEP function */
+static int __init smbios_decode_step(void)
+{
+	u8 chksum1, chksum2, *buf, fp;
+
+	if (!smbios_addr)
+		return -ENODEV;
+
+	buf = smbios_ioremap(smbios_addr, sizeof(struct smbios_step));
+	if (!buf)
+		return -ENODEV;
+
+	memcpy(&smbios_step, buf, sizeof(struct smbios_step));
+
+	/* checksum the entire STEP structure */
+	chksum1 = 0;
+	for (fp = 0; fp < smbios_step.length; fp++)
+		chksum1 += buf[fp];
+	if (chksum1) {
+		smbios_iounmap(buf, sizeof(struct smbios_step));
+		WARN(1, "SMBIOS: Invalid STEP table checksum = %u\n", chksum1);
+		return -EINVAL;
+	}
+
+	/* checksum the Intermediate structure */
+	chksum2 = 0;
+	for (fp = 0x10; fp < smbios_step.length; fp++)
+		chksum2 += buf[fp];
+	if (chksum2) {
+		smbios_iounmap(buf, sizeof(struct smbios_step));
+		WARN(1, "SMBIOS: Invalid Intermediate checksum = %u\n",
+		     chksum2);
+		return -EINVAL;
+	}
+
+	smbios_iounmap(buf, sizeof(struct smbios_step));
+
+	printk(KERN_INFO "SMBIOS: version %u.%u @ 0x%lX | %d structures\n",
+	       smbios_step.major, smbios_step.minor, smbios_addr,
+	       smbios_step.num_structs);
+
+	smbios_num = smbios_step.num_structs;
+	smbios_len = smbios_step.struct_len;
+	smbios_base = smbios_step.struct_addr;
+
+	/*
+	 * Need to map smbios_map for the smbios_walk() and other potential
+	 * early callers.  This is unmapped, and ioremap'ed in the late call.
+	 */
+	smbios_map = smbios_ioremap(smbios_base, smbios_len);
+	if (!smbios_map) {
+		printk(KERN_INFO "SMBIOS tables are invalid.\n");
+		return -ENOMEM;
+	}
+	smbios_available = 1;
+
+	return 0;
+}
+
+/**
+ * smbios_init - Initialize the SMBIOS code and register a sysfw driver
+ *
+ * This function looks for the SMBIOS tables, maps them, and registers a
+ * System Firmware driver.
+ */
+int __init smbios_init(void)
+{
+	u8 *buf;
+	int fp = 0, rc;
+	int ret = 0;
+	int smbios_present = 0;
+
+	if (efi_enabled) {
+		if (efi.smbios == EFI_INVALID_TABLE_ADDR) {
+			ret = -ENODEV;
+			goto error;
+		}
+		smbios_addr = efi.smbios;
+	} else {
+		/*
+		 * Legacy SMBIOS is mapped @ 0xF0000, but may not
+		 * necessarily be _at_ 0xF0000
+		 */
+		smbios_addr = 0xF0000;
+	}
+	buf = smbios_ioremap(smbios_addr, SMBIOS_SIZE);
+	if (!buf) {
+		ret = -ENODEV;
+		goto error;
+	}
+
+	/* Find the SMBIOS entry point */
+	for (fp = 0; fp <= 0xFFF0; fp += 0x10) {
+		if (!memcmp(buf + fp, "_SM_", 4)) {
+			smbios_addr += fp;
+			smbios_present = 1;
+			break;
+		}
+	}
+	smbios_iounmap(buf, SMBIOS_SIZE);
+
+	if (smbios_present) {
+		rc = smbios_decode_step();
+		if (rc)
+			return -ENODEV;
+		rc = sysfw_driver_register(&smbios_sysfw_driver);
+		if (rc)
+			return rc;
+		smbios_decode_core();
+	} else {
+		/*
+		 * SMBIOS has been around since the 1990s.  The likelihood
+		 * of there being a DMI table not embedded in a SMBIOS table
+		 * is extremely unlikely, but the old code did look for this
+		 * and there is at least a possibility of a system out there
+		 * like this ... so check to see if an old legacy _DMI_ table
+		 * is available.
+		 *
+		 * XXX: Hopefully we can get rid of this one day.
+		 */
+		buf = smbios_ioremap(smbios_addr, SMBIOS_SIZE);
+		if (!buf) {
+			ret = -ENODEV;
+			goto error;
+		}
+
+		/* Find the DMI entry point */
+		for (fp = 0; fp <= 0xFFF0; fp += 0x10) {
+			if (dmi_present(buf + fp)) {
+				smbios_addr += fp;
+				break;
+			}
+		}
+		smbios_iounmap(buf, SMBIOS_SIZE);
+	}
+error:
+	if (!smbios_present)
+		printk(KERN_INFO "SMBIOS not present.");
+	return ret;
+
+}
+
+/**
+ * smbios_walk - executes a function for each SMBIOS structure
+ * @decode: Function to execute
+ * private_data: data passed into decode function
+ *
+ * This function walks the SMBIOS structures and executes decode on each
+ * structure.  This should have minimal usage in the kernel.  Unless you have
+ * need to access the raw SMBIOS data, you should use sysfw_lookup() or
+ * sysfw_callback().
+ */
+const union smbios_struct
+*smbios_walk(int (*decode)(const union smbios_struct *, void *),
+			   void *private_data)
+{
+	u8 *data = smbios_map;
+	int size = sizeof(struct smbios_header);
+	int i = 0;
+	int ret = SMBIOS_WALK_CONTINUE;
+	const union smbios_struct *ss = NULL;
+
+	/*
+	 * Stop when we see all the items the table claimed to have
+	 * OR we run off the end of the table (also happens)
+	 */
+	while ((i < smbios_num) &&
+	       (data - smbios_map + size) <= smbios_len) {
+		const struct smbios_header *dm;
+
+		/*
+		 *  We want to know the total length (formatted area and
+		 *  strings) before decoding to make sure we won't run off the
+		 *  table
+		 */
+		dm = (const struct smbios_header *)data;
+		data += dm->length;
+		while ((data - smbios_map < smbios_len - 1) &&
+		       (data[0] || data[1]))
+			data++;
+		if (data - smbios_map < smbios_len - 1) {
+			ret = decode((union smbios_struct *)dm, private_data);
+			if (ret == SMBIOS_WALK_STOP) {
+				ss = (union smbios_struct *)dm;
+				break;
+			}
+		}
+		data += 2;
+		i++;
+	}
+
+	return ss;
+}
+EXPORT_SYMBOL_GPL(smbios_walk);
+
+/*
+ * Helper Functions -- We really don't want a lot of these, but structs like
+ * the OEM Strings have a lot of elements and multiple drivers need to
+ * grep through them for string matches.  Might as well do all of this in
+ * one place.
+ */
+
+/*
+ * This seems really general and currently has only two specific needs
+ * in the kernel (type10 and type11).  But looking at other structs we'll need
+ * this for those as well.
+ */
+struct _smbios_strings {
+	int type;
+	int (*count_fn)(const union smbios_struct *ss);
+	const char *in;
+	const char *out;
+};
+
+/* returns SMBIOS_WALK_STOP & match->out != NULL on string match success */
+static int _match_string(const union smbios_struct *ss, void *_match)
+{
+	int i;
+	const char *str;
+	struct _smbios_strings *match = (struct _smbios_strings *)_match;
+
+	if (ss->header.type != match->type)
+		return SMBIOS_WALK_CONTINUE;
+
+	BUG_ON(!match->count_fn);
+
+	for (i = 1; i <= match->count_fn(ss); i++) {
+		str = smbios_get_string(ss, i);
+		if (!strncmp(match->in, str, strlen(match->in))) {
+			match->out = str;
+			return SMBIOS_WALK_STOP;
+		}
+	}
+
+	return SMBIOS_WALK_CONTINUE;
+}
+
+static int type10_count_fn(const union smbios_struct *ss)
+{
+	/*
+	 * From SMBIOS Specification: The user of this structure determines the
+	 * the number of devices as (Length - 4)/2.
+	 */
+	return (ss->header.length - 4) / 2;
+}
+
+const char *smbios_match_type10_string(const char *match, int check_disabled)
+{
+	struct _smbios_strings _match = {
+		.in = match,
+		.out = NULL,
+		.type = 10,
+		.count_fn = type10_count_fn,
+	};
+	const union smbios_struct *ss;
+
+	ss = smbios_walk(_match_string, (void *)&_match);
+	if ((ss && check_disabled) || (ss && (ss->type10.device_type & 0x80)))
+		return _match.out;
+	return NULL;
+}
+
+/** smbios_is_onboard_device - Determines if a device is on (soldered on)
+ * @match: string to match
+ * @check_disabled_devices: match against devices marked disabled in structure
+ *
+ * This function returns true if the string passed in matches a device
+ * that the SMBIOS recognizes as being on board (soldered on).  The function
+ * also can ignore SMBIOS's information about whether or not a device is
+ * disabled in order to workaround broken BIOSes.
+ *
+ * Note: This currently only looks at the type 10 structure.
+ */
+bool smbios_is_onboard_device(const char *match, int check_disabled_devices)
+{
+	const char *ret;
+
+	ret = smbios_match_type10_string(match, check_disabled_devices);
+	if (ret)
+		return true;
+	return false;
+}
+EXPORT_SYMBOL_GPL(smbios_is_onboard_device);
+
+static int type11_count_fn(const union smbios_struct *ss)
+{
+	return ss->type11.count;
+}
+
+/**
+ * smbios_match_oem_string - match a string with the OEM strings provided by
+ * @match: string to match
+ *
+ * This function returns the matching SMBIOS string if the string passed in
+ * matches the OEM strings provided by the SMBIOS.
+ */
+const char *smbios_match_oem_string(const char *match)
+{
+	struct _smbios_strings _match = {
+		.in = match,
+		.out = NULL,
+		.type = 11,
+		.count_fn = type11_count_fn,
+	};
+	const union smbios_struct *ss;
+
+	ss = smbios_walk(_match_string, (void *)&_match);
+	if (ss)
+		return _match.out;
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(smbios_match_oem_string);
diff --git a/include/linux/smbios.h b/include/linux/smbios.h
new file mode 100644
index 0000000..180a5d8
--- /dev/null
+++ b/include/linux/smbios.h
@@ -0,0 +1,243 @@
+/*
+ * linux/include/smbios.h
+ *
+ * "The SMBIOS Specification addresses how motherboard and system vendors
+ * present management information about their products in a standard format by
+ * extending the BIOS interface on x86 architecture systems. The information is
+ * intended to allow generic instrumentation to deliver this information to
+ * management applications that use DMI, CIM or direct access, eliminating the
+ * need for error prone operations like probing system hardware for presence
+ * detection."
+ *
+ * From http://www.dmtf.org/standards/smbios
+ *
+ * ... Grab the Spec.  It'll help.
+ */
+#ifndef __SMBIOS_H__
+#define __SMBIOS_H__
+
+#include <linux/mod_devicetable.h>
+
+/* struct smbios_step (SMBIOS STEP) is defined in drivers/firmware/smbios.c */
+/* enum sysfw_field (SYSFW_BIOS_VENDOR, etc.) is in mod_devicetable.h */
+
+/* max size of SMBIOS as specified in SMBIOS Specification */
+#define SMBIOS_SIZE 0x10000
+
+struct smbios_header {
+	u8 type;
+	u8 length;
+	u16 handle;
+} __attribute__((__packed__));
+
+/* UNION of SMBIOS types as listed in SMBIOS Specification. */
+union smbios_struct {
+	struct smbios_header header;
+	struct { /* BIOS Information */
+		struct smbios_header header;
+		u8 vendor;
+		u8 bios_version;
+		u16 bios_starting_address_segment;
+		u8 bios_release_date;
+		u8 bios_rom_size;
+		u32 bios_characteristics;
+		u16 bios_characteristics_extension_bytes;
+		u8 system_bios_major_release;
+		u8 system_bios_minor_release;
+		u8 embedded_controller_firmware_major_release;
+		u8 embedded_controller_firmware_minor_release;
+	} __attribute__((__packed__)) type0;
+	struct { /* System Information */
+		struct smbios_header header;
+		u8 manufacturer;
+		u8 product_name;
+		u8 version;
+		u8 serial_number;
+		u8 uuid[16];
+		u8 wake_up_type;
+		u8 sku_number;
+	} __attribute__((__packed__)) type1;
+	struct { /* Baseboard (or Module) Information */
+		struct smbios_header header;
+		u8 manufacturer;
+		u8 product;
+		u8 version;
+		u8 serial_number;
+		u8 asset_tag;
+		u8 feature_flags;
+	} __attribute__((__packed__)) type2;
+	struct { /* System Enclosure of Chassis */
+		struct smbios_header header;
+		u8 manufacturer;
+		u8 type;
+		u8 version;
+		u8 serial_number;
+		u8 asset_tag_number;
+		u8 boot_up_state;
+		u8 power_supply_state;
+		u8 thermal_state;
+		u8 security_status;
+		u8 oem_defined;
+		u8 height;
+		u8 number_of_power_cords;
+		u8 contained_element_count;
+		u8 contained_element_record;
+		/* contained elements = contained_element_count X */
+		/*			contained_element_record  */
+		u8 contained_elements;
+		/* u8 sku_number is allocated after that	  */
+	} __attribute__((__packed__)) type3;
+	struct { /* System Slots */
+		struct smbios_header header;
+		u8 slot_designation;
+		u8 slot_type;
+		u8 slot_data_bus_width;
+		u8 current_usage;
+		u8 slot_length;
+		u16 slot_id;
+		u8 slot_characteristics_1;
+		u8 slot_characteristics_2;
+		u16 segment_group_number;
+		u8 bus_number;
+		u8 device_function_number;
+	} __attribute__((__packed__)) type9;
+	struct { /* On Board Devices Information (Obsolete) */
+		struct smbios_header header;	/* count = (length - 4)/2 */
+		u8 device_type;			/* one for each device */
+		/* strings at end of struct, one per device */
+	} __attribute__((__packed__)) type10;
+	struct { /* OEM Strings */
+		struct smbios_header header;
+		u8 count;
+		u8 start;
+		/* variable number (equal to count) strings listed here */
+	} __attribute__((__packed__)) type11;
+	struct { /* IPMI Device Information - BMC Interface Type */
+		struct smbios_header header;
+		u8 interface_type;
+		u8 ipmi_specification_revision;
+		u8 i2c_slave_address;
+		u8 nv_storage_device_address;
+		u32 base_address;
+		union {
+			u8 base_address_modifier;
+			u8 interrupt_info;
+		};
+		u8 interrupt_number;
+	} __attribute__((__packed__)) type38;
+	struct { /* Onboard Devices Extended Information */
+		struct smbios_header header;
+		u8 reference_designation; /* "silkscreen label */
+		u8 device_type;
+		u8 device_type_instance;
+		u16 segment_group_number;
+		u8 bus_number;
+		u8 device_function_number;
+	} __attribute__((__packed__)) type41;
+};
+
+/* enum used for returns in smbios_walk decode() function */
+enum smbios_walk_value {
+	SMBIOS_WALK_CONTINUE = 0,	/* continue executing in smbios_walk */
+	SMBIOS_WALK_STOP,		/* stop executing and return */
+};
+
+#ifdef CONFIG_SMBIOS
+
+/* is there an SMBIOS on this system? */
+extern int smbios_available;
+
+/**
+ * smbios_get_string -- return a string from an SMBIOS structure
+ * @ss: pointer to structure being examined
+ * @s: number of string being examined
+ *
+ * This function returns a string within the structure ss.  Many SMBIOS
+ * structures have their strings at the end of the structure, and the location
+ * of each string is enumerated throughout the structure.
+ *
+ * For example,  The BIOS Information structure, type0, has the BIOS Version
+ * at offset 0x6, which contains a number enumerating the strings at the end
+ * of the structure.
+ *
+ * ie) s is an actual _number_, not a pointer.
+ */
+extern const char *smbios_get_string(const union smbios_struct *ss, u8 s);
+
+/**
+ * smbios_init - Initialize the SMBIOS code and register a sysfw driver
+ *
+ * This function looks for the SMBIOS tables, maps them, and registers a
+ * System Firmware driver.
+ */
+extern int smbios_init(void);
+
+/**
+ * smbios_walk - executes a function for each SMBIOS structure
+ * @decode: Function to execute
+ * private_data: data passed into decode function
+ *
+ * This function walks the SMBIOS structures and executes decode on each
+ * structure.  If you are looking for a specific unique type of structure,
+ * you should use smbios_find_struct().
+ *
+ * This should have minimal usage in the kernel.  The only reason this should
+ * be used is if you need access the raw SMBIOS data.  Otherwise you should
+ * use sysfw_lookup() or sysfw_callback().
+ */
+extern const union smbios_struct *
+smbios_walk(int (*decode)(const union smbios_struct *, void *),
+	    void *private_data);
+
+/* Helper Functions */
+
+/** smbios_is_onboard_device - Determines if a device is on (soldered on)
+ * @match: string to match
+ * @check_disabled_devices: match against devices marked disabled in structure
+ *
+ * This function returns true if the string passed in matches a device
+ * that the SMBIOS recognizes as being on board (soldered on).  The function
+ * also can ignore SMBIOS's information about whether or not a device is
+ * disabled in order to workaround broken BIOSes.
+ *
+ * XXX: Fix me.  This currently only looks at the type 10 structure.
+ */
+extern bool smbios_is_onboard_device(const char *match,
+				     int check_disabled_devices);
+
+/**
+ * smbios_match_oem_string - match a string with the OEM strings provided by
+ * @match: string to match
+ *
+ * This function returns the matching SMBIOS string if the string passed in
+ * matches the OEM strings provided by the SMBIOS.
+ */
+extern const char *smbios_match_oem_string(const char *match);
+
+#else
+#define smbios_available 0
+static inline const char *smbios_get_string(const union smbios_struct *ss, u8 s)
+{
+	return NULL;
+}
+static inline void smbios_init(void)
+{
+	return;
+}
+static inline const union smbios_struct
+*smbios_walk(int (*decode)(const union smbios_struct *, void *),
+	     void *private_data)
+{
+	return NULL;
+}
+static inline bool smbios_is_onboard_device(const char *match,
+					    int check_disabled_devices)
+{
+	return 0;
+}
+static inline const char *smbios_match_oem_string(const char *match)
+{
+	return NULL;
+}
+#endif
+#endif	/* __SMBIOS_H__ */
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 19/34] drivers/net changes for SMBIOS and System Firmware
From: Prarit Bhargava @ 2011-07-18 13:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: Prarit Bhargava, netdev
In-Reply-To: <1310994528-26276-1-git-send-email-prarit@redhat.com>

As part of the new SMBIOS and System Firmware code:

- Replace old dmi* structures and functions with new sysfw* and smbios*
structures and functions in individual drivers
- cleanup sysfw_id lookup tables
- cleanup of includes for dmi.h and mod_devicetable.h which were included in
some files that did not need them

Cc: netdev@vger.kernel.org
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/net/skge.c                 |   11 ++++++-----
 drivers/net/via-rhine.c            |   18 ++++++++++--------
 drivers/net/wireless/wl1251/sdio.c |    1 -
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index f4be5c7..1200c53 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -43,7 +43,7 @@
 #include <linux/seq_file.h>
 #include <linux/mii.h>
 #include <linux/slab.h>
-#include <linux/dmi.h>
+#include <linux/sysfw.h>
 #include <linux/prefetch.h>
 #include <asm/irq.h>
 
@@ -4089,12 +4089,13 @@ static struct pci_driver skge_driver = {
 	.driver.pm =	SKGE_PM_OPS,
 };
 
-static struct dmi_system_id skge_32bit_dma_boards[] = {
+static struct sysfw_id skge_32bit_dma_boards[] = {
 	{
 		.ident = "Gigabyte nForce boards",
 		.matches = {
-			DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"),
-			DMI_MATCH(DMI_BOARD_NAME, "nForce"),
+			SYSFW_MATCH(SYSFW_BOARD_VENDOR,
+				     "Gigabyte Technology Co"),
+			SYSFW_MATCH(SYSFW_BOARD_NAME, "nForce"),
 		},
 	},
 	{}
@@ -4102,7 +4103,7 @@ static struct dmi_system_id skge_32bit_dma_boards[] = {
 
 static int __init skge_init_module(void)
 {
-	if (dmi_check_system(skge_32bit_dma_boards))
+	if (sysfw_callback(skge_32bit_dma_boards))
 		only_32bit_dma = 1;
 	skge_debug_init();
 	return pci_register_driver(&skge_driver);
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 7f23ab9..81725d5 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -110,7 +110,7 @@ static const int multicast_filter_limit = 32;
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
-#include <linux/dmi.h>
+#include <linux/sysfw.h>
 
 /* These identify the driver base version and may not be removed. */
 static const char version[] __devinitconst =
@@ -2294,22 +2294,24 @@ static struct pci_driver rhine_driver = {
 	.shutdown =	rhine_shutdown,
 };
 
-static struct dmi_system_id __initdata rhine_dmi_table[] = {
+static struct sysfw_id __initdata rhine_id_table[] = {
 	{
 		.ident = "EPIA-M",
 		.matches = {
-			DMI_MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."),
-			DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
+			SYSFW_MATCH(SYSFW_BIOS_VENDOR,
+				    "Award Software International, Inc."),
+			SYSFW_MATCH(SYSFW_BIOS_VERSION, "6.00 PG"),
 		},
 	},
 	{
 		.ident = "KV7",
 		.matches = {
-			DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
-			DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
+			SYSFW_MATCH(SYSFW_BIOS_VENDOR,
+				    "Phoenix Technologies, LTD"),
+			SYSFW_MATCH(SYSFW_BIOS_VERSION, "6.00 PG"),
 		},
 	},
-	{ NULL }
+	{}
 };
 
 static int __init rhine_init(void)
@@ -2318,7 +2320,7 @@ static int __init rhine_init(void)
 #ifdef MODULE
 	pr_info("%s\n", version);
 #endif
-	if (dmi_check_system(rhine_dmi_table)) {
+	if (sysfw_callback(rhine_id_table)) {
 		/* these BIOSes fail at PXE boot if chip is in D3 */
 		avoid_D3 = 1;
 		pr_warn("Broken BIOS detected, avoid_D3 enabled\n");
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
index f51a024..68e36d7 100644
--- a/drivers/net/wireless/wl1251/sdio.c
+++ b/drivers/net/wireless/wl1251/sdio.c
@@ -20,7 +20,6 @@
  * Copyright (C) 2009 Bob Copeland (me@bobcopeland.com)
  */
 #include <linux/module.h>
-#include <linux/mod_devicetable.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/platform_device.h>
-- 
1.6.5.2

^ permalink raw reply related

* [PATCH 34/34] Remove old DMI & SMBIOS code and make SMBIOS default on
From: Prarit Bhargava @ 2011-07-18 13:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-ia64, linux-pci, dri-devel, platform-driver-x86,
	grant.likely, linux-ide, linux-i2c, device-drivers-devel, abelay,
	Prarit Bhargava, eric.piel, x86, lm-sensors, linux-acpi,
	linux-input, linux-media, johnpol, linux-watchdog, rtc-linux, dz,
	openipmi-developer, evel, netdev, linux-usb, rpurdie,
	linux-crypto
In-Reply-To: <1310994528-26276-1-git-send-email-prarit@redhat.com>

This code has now been completely replaced by the new System Firmware
Interface (SYSFW) and SMBIOS code.  It is no longer needed in the kernel.

Cc: linux-ia64@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-acpi@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: openipmi-developer@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: lm-sensors@lm-sensors.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: rtc-linux@googlegroups.com
Cc: evel@driverdev.osuosl.org
Cc: linux-usb@vger.kernel.org
Cc: device-drivers-devel@blackfin.uclinux.org
Cc: linux-watchdog@vger.kernel.org
Cc: grant.likely@secretlab.ca
Cc: dz@debian.org
Cc: rpurdie@rpsys.net
Cc: eric.piel@tremplin-utc.net
Cc: abelay@mit.edu
Cc: johnpol@2ka.mipt.ru
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 arch/ia64/include/asm/dmi.h     |   12 -
 arch/x86/Kconfig                |    9 -
 arch/x86/include/asm/dmi.h      |   19 -
 drivers/firmware/Kconfig        |   20 -
 drivers/firmware/Makefile       |    3 -
 drivers/firmware/dmi-id.c       |  245 -------------
 drivers/firmware/dmi-sysfs.c    |  696 ------------------------------------
 drivers/firmware/dmi_scan.c     |  751 ---------------------------------------
 include/linux/dmi.h             |  139 -------
 include/linux/mod_devicetable.h |   55 ---
 10 files changed, 0 insertions(+), 1949 deletions(-)
 delete mode 100644 arch/ia64/include/asm/dmi.h
 delete mode 100644 arch/x86/include/asm/dmi.h
 delete mode 100644 drivers/firmware/dmi-id.c
 delete mode 100644 drivers/firmware/dmi-sysfs.c
 delete mode 100644 drivers/firmware/dmi_scan.c
 delete mode 100644 include/linux/dmi.h

diff --git a/arch/ia64/include/asm/dmi.h b/arch/ia64/include/asm/dmi.h
deleted file mode 100644
index 1ed4c8f..0000000
--- a/arch/ia64/include/asm/dmi.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _ASM_DMI_H
-#define _ASM_DMI_H 1
-
-#include <linux/slab.h>
-#include <asm/io.h>
-
-/* Use normal IO mappings for DMI */
-#define dmi_ioremap ioremap
-#define dmi_iounmap(x,l) iounmap(x)
-#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
-
-#endif
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e7cdde8..92ee12b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -626,15 +626,6 @@ config APB_TIMER
 
 # Mark as expert because too many people got it wrong.
 # The code disables itself when not needed.
-config DMI
-	default y
-	bool "Enable DMI scanning" if EXPERT
-	---help---
-	  Enabled scanning of DMI to identify machine quirks. Say Y
-	  here unless you have verified that your setup is not
-	  affected by entries in the DMI blacklist. Required by PNP
-	  BIOS code.
-
 config SMBIOS
 	depends on SYSTEM_FIRMWARE
 	bool "Enable SMBIOS scanning" if EXPERT
diff --git a/arch/x86/include/asm/dmi.h b/arch/x86/include/asm/dmi.h
deleted file mode 100644
index fd8f9e2..0000000
--- a/arch/x86/include/asm/dmi.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _ASM_X86_DMI_H
-#define _ASM_X86_DMI_H
-
-#include <linux/compiler.h>
-#include <linux/init.h>
-
-#include <asm/io.h>
-#include <asm/setup.h>
-
-static __always_inline __init void *dmi_alloc(unsigned len)
-{
-	return extend_brk(len, sizeof(int));
-}
-
-/* Use early IO mappings for DMI because it's initialized early */
-#define dmi_ioremap early_ioremap
-#define dmi_iounmap early_iounmap
-
-#endif /* _ASM_X86_DMI_H */
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 23066d8..a46c162 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -104,26 +104,6 @@ config DCDBAS
 	  Say Y or M here to enable the driver for use by Dell systems
 	  management software such as Dell OpenManage.
 
-config DMIID
-    bool "Export DMI identification via sysfs to userspace"
-    depends on DMI
-    default y
-	help
-	  Say Y here if you want to query SMBIOS/DMI system identification
-	  information from userspace through /sys/class/dmi/id/ or if you want
-	  DMI-based module auto-loading.
-
-config DMI_SYSFS
-	tristate "DMI table support in sysfs"
-	depends on SYSFS && DMI
-	default n
-	help
-	  Say Y or M here to enable the exporting of the raw DMI table
-	  data via sysfs.  This is useful for consuming the data without
-	  requiring any access to /dev/mem at all.  Tables are found
-	  under /sys/firmware/dmi when this option is enabled and
-	  loaded.
-
 config ISCSI_IBFT_FIND
 	bool "iSCSI Boot Firmware Table Attributes"
 	depends on X86
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 5c9d81f..f372289 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -1,14 +1,11 @@
 #
 # Makefile for the linux kernel.
 #
-obj-$(CONFIG_DMI)		+= dmi_scan.o
-obj-$(CONFIG_DMI_SYSFS)		+= dmi-sysfs.o
 obj-$(CONFIG_EDD)		+= edd.o
 obj-$(CONFIG_EFI_VARS)		+= efivars.o
 obj-$(CONFIG_EFI_PCDP)		+= pcdp.o
 obj-$(CONFIG_DELL_RBU)          += dell_rbu.o
 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_FIRMWARE_MEMMAP)	+= memmap.o
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
deleted file mode 100644
index 94a58a0..0000000
--- a/drivers/firmware/dmi-id.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Export SMBIOS/DMI info via sysfs to userspace
- *
- * Copyright 2007, Lennart Poettering
- *
- * Licensed under GPLv2
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/dmi.h>
-#include <linux/device.h>
-#include <linux/slab.h>
-
-struct dmi_device_attribute{
-	struct device_attribute dev_attr;
-	int field;
-};
-#define to_dmi_dev_attr(_dev_attr) \
-	container_of(_dev_attr, struct dmi_device_attribute, dev_attr)
-
-static ssize_t sys_dmi_field_show(struct device *dev,
-				  struct device_attribute *attr,
-				  char *page)
-{
-	int field = to_dmi_dev_attr(attr)->field;
-	ssize_t len;
-	len = scnprintf(page, PAGE_SIZE, "%s\n", dmi_get_system_info(field));
-	page[len-1] = '\n';
-	return len;
-}
-
-#define DMI_ATTR(_name, _mode, _show, _field)			\
-	{ .dev_attr = __ATTR(_name, _mode, _show, NULL),	\
-	  .field = _field }
-
-#define DEFINE_DMI_ATTR_WITH_SHOW(_name, _mode, _field)		\
-static struct dmi_device_attribute sys_dmi_##_name##_attr =	\
-	DMI_ATTR(_name, _mode, sys_dmi_field_show, _field);
-
-DEFINE_DMI_ATTR_WITH_SHOW(bios_vendor,		0444, DMI_BIOS_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(bios_version,		0444, DMI_BIOS_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(bios_date,		0444, DMI_BIOS_DATE);
-DEFINE_DMI_ATTR_WITH_SHOW(sys_vendor,		0444, DMI_SYS_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(product_name,		0444, DMI_PRODUCT_NAME);
-DEFINE_DMI_ATTR_WITH_SHOW(product_version,	0444, DMI_PRODUCT_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(product_serial,	0400, DMI_PRODUCT_SERIAL);
-DEFINE_DMI_ATTR_WITH_SHOW(product_uuid,		0400, DMI_PRODUCT_UUID);
-DEFINE_DMI_ATTR_WITH_SHOW(board_vendor,		0444, DMI_BOARD_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(board_name,		0444, DMI_BOARD_NAME);
-DEFINE_DMI_ATTR_WITH_SHOW(board_version,	0444, DMI_BOARD_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(board_serial,		0400, DMI_BOARD_SERIAL);
-DEFINE_DMI_ATTR_WITH_SHOW(board_asset_tag,	0444, DMI_BOARD_ASSET_TAG);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_vendor,	0444, DMI_CHASSIS_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_type,		0444, DMI_CHASSIS_TYPE);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_version,	0444, DMI_CHASSIS_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_serial,	0400, DMI_CHASSIS_SERIAL);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_asset_tag,	0444, DMI_CHASSIS_ASSET_TAG);
-
-static void ascii_filter(char *d, const char *s)
-{
-	/* Filter out characters we don't want to see in the modalias string */
-	for (; *s; s++)
-		if (*s > ' ' && *s < 127 && *s != ':')
-			*(d++) = *s;
-
-	*d = 0;
-}
-
-static ssize_t get_modalias(char *buffer, size_t buffer_size)
-{
-	static const struct mafield {
-		const char *prefix;
-		int field;
-	} fields[] = {
-		{ "bvn", DMI_BIOS_VENDOR },
-		{ "bvr", DMI_BIOS_VERSION },
-		{ "bd",  DMI_BIOS_DATE },
-		{ "svn", DMI_SYS_VENDOR },
-		{ "pn",  DMI_PRODUCT_NAME },
-		{ "pvr", DMI_PRODUCT_VERSION },
-		{ "rvn", DMI_BOARD_VENDOR },
-		{ "rn",  DMI_BOARD_NAME },
-		{ "rvr", DMI_BOARD_VERSION },
-		{ "cvn", DMI_CHASSIS_VENDOR },
-		{ "ct",  DMI_CHASSIS_TYPE },
-		{ "cvr", DMI_CHASSIS_VERSION },
-		{ NULL,  DMI_NONE }
-	};
-
-	ssize_t l, left;
-	char *p;
-	const struct mafield *f;
-
-	strcpy(buffer, "dmi");
-	p = buffer + 3; left = buffer_size - 4;
-
-	for (f = fields; f->prefix && left > 0; f++) {
-		const char *c;
-		char *t;
-
-		c = dmi_get_system_info(f->field);
-		if (!c)
-			continue;
-
-		t = kmalloc(strlen(c) + 1, GFP_KERNEL);
-		if (!t)
-			break;
-		ascii_filter(t, c);
-		l = scnprintf(p, left, ":%s%s", f->prefix, t);
-		kfree(t);
-
-		p += l;
-		left -= l;
-	}
-
-	p[0] = ':';
-	p[1] = 0;
-
-	return p - buffer + 1;
-}
-
-static ssize_t sys_dmi_modalias_show(struct device *dev,
-				     struct device_attribute *attr, char *page)
-{
-	ssize_t r;
-	r = get_modalias(page, PAGE_SIZE-1);
-	page[r] = '\n';
-	page[r+1] = 0;
-	return r+1;
-}
-
-static struct device_attribute sys_dmi_modalias_attr =
-	__ATTR(modalias, 0444, sys_dmi_modalias_show, NULL);
-
-static struct attribute *sys_dmi_attributes[DMI_STRING_MAX+2];
-
-static struct attribute_group sys_dmi_attribute_group = {
-	.attrs = sys_dmi_attributes,
-};
-
-static const struct attribute_group* sys_dmi_attribute_groups[] = {
-	&sys_dmi_attribute_group,
-	NULL
-};
-
-static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
-{
-	ssize_t len;
-
-	if (add_uevent_var(env, "MODALIAS="))
-		return -ENOMEM;
-	len = get_modalias(&env->buf[env->buflen - 1],
-			   sizeof(env->buf) - env->buflen);
-	if (len >= (sizeof(env->buf) - env->buflen))
-		return -ENOMEM;
-	env->buflen += len;
-	return 0;
-}
-
-static struct class dmi_class = {
-	.name = "dmi",
-	.dev_release = (void(*)(struct device *)) kfree,
-	.dev_uevent = dmi_dev_uevent,
-};
-
-static struct device *dmi_dev;
-
-/* Initialization */
-
-#define ADD_DMI_ATTR(_name, _field) \
-	if (dmi_get_system_info(_field)) \
-		sys_dmi_attributes[i++] = &sys_dmi_##_name##_attr.dev_attr.attr;
-
-/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
-   dmi_id_init! */
-static void __init dmi_id_init_attr_table(void)
-{
-	int i;
-
-	/* Not necessarily all DMI fields are available on all
-	 * systems, hence let's built an attribute table of just
-	 * what's available */
-	i = 0;
-	ADD_DMI_ATTR(bios_vendor,       DMI_BIOS_VENDOR);
-	ADD_DMI_ATTR(bios_version,      DMI_BIOS_VERSION);
-	ADD_DMI_ATTR(bios_date,         DMI_BIOS_DATE);
-	ADD_DMI_ATTR(sys_vendor,        DMI_SYS_VENDOR);
-	ADD_DMI_ATTR(product_name,      DMI_PRODUCT_NAME);
-	ADD_DMI_ATTR(product_version,   DMI_PRODUCT_VERSION);
-	ADD_DMI_ATTR(product_serial,    DMI_PRODUCT_SERIAL);
-	ADD_DMI_ATTR(product_uuid,      DMI_PRODUCT_UUID);
-	ADD_DMI_ATTR(board_vendor,      DMI_BOARD_VENDOR);
-	ADD_DMI_ATTR(board_name,        DMI_BOARD_NAME);
-	ADD_DMI_ATTR(board_version,     DMI_BOARD_VERSION);
-	ADD_DMI_ATTR(board_serial,      DMI_BOARD_SERIAL);
-	ADD_DMI_ATTR(board_asset_tag,   DMI_BOARD_ASSET_TAG);
-	ADD_DMI_ATTR(chassis_vendor,    DMI_CHASSIS_VENDOR);
-	ADD_DMI_ATTR(chassis_type,      DMI_CHASSIS_TYPE);
-	ADD_DMI_ATTR(chassis_version,   DMI_CHASSIS_VERSION);
-	ADD_DMI_ATTR(chassis_serial,    DMI_CHASSIS_SERIAL);
-	ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG);
-	sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr;
-}
-
-static int __init dmi_id_init(void)
-{
-	int ret;
-
-	if (!dmi_available)
-		return -ENODEV;
-
-	dmi_id_init_attr_table();
-
-	ret = class_register(&dmi_class);
-	if (ret)
-		return ret;
-
-	dmi_dev = kzalloc(sizeof(*dmi_dev), GFP_KERNEL);
-	if (!dmi_dev) {
-		ret = -ENOMEM;
-		goto fail_class_unregister;
-	}
-
-	dmi_dev->class = &dmi_class;
-	dev_set_name(dmi_dev, "id");
-	dmi_dev->groups = sys_dmi_attribute_groups;
-
-	ret = device_register(dmi_dev);
-	if (ret)
-		goto fail_free_dmi_dev;
-
-	return 0;
-
-fail_free_dmi_dev:
-	kfree(dmi_dev);
-fail_class_unregister:
-
-	class_unregister(&dmi_class);
-
-	return ret;
-}
-
-arch_initcall(dmi_id_init);
diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
deleted file mode 100644
index eb26d62..0000000
--- a/drivers/firmware/dmi-sysfs.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
- * dmi-sysfs.c
- *
- * This module exports the DMI tables read-only to userspace through the
- * sysfs file system.
- *
- * Data is currently found below
- *    /sys/firmware/dmi/...
- *
- * DMI attributes are presented in attribute files with names
- * formatted using %d-%d, so that the first integer indicates the
- * structure type (0-255), and the second field is the instance of that
- * entry.
- *
- * Copyright 2011 Google, Inc.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kobject.h>
-#include <linux/dmi.h>
-#include <linux/capability.h>
-#include <linux/slab.h>
-#include <linux/list.h>
-#include <linux/io.h>
-
-#define MAX_ENTRY_TYPE 255 /* Most of these aren't used, but we consider
-			      the top entry type is only 8 bits */
-
-struct dmi_sysfs_entry {
-	struct dmi_header dh;
-	struct kobject kobj;
-	int instance;
-	int position;
-	struct list_head list;
-	struct kobject *child;
-};
-
-/*
- * Global list of dmi_sysfs_entry.  Even though this should only be
- * manipulated at setup and teardown, the lazy nature of the kobject
- * system means we get lazy removes.
- */
-static LIST_HEAD(entry_list);
-static DEFINE_SPINLOCK(entry_list_lock);
-
-/* dmi_sysfs_attribute - Top level attribute. used by all entries. */
-struct dmi_sysfs_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct dmi_sysfs_entry *entry, char *buf);
-};
-
-#define DMI_SYSFS_ATTR(_entry, _name) \
-struct dmi_sysfs_attribute dmi_sysfs_attr_##_entry##_##_name = { \
-	.attr = {.name = __stringify(_name), .mode = 0400}, \
-	.show = dmi_sysfs_##_entry##_##_name, \
-}
-
-/*
- * dmi_sysfs_mapped_attribute - Attribute where we require the entry be
- * mapped in.  Use in conjunction with dmi_sysfs_specialize_attr_ops.
- */
-struct dmi_sysfs_mapped_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct dmi_sysfs_entry *entry,
-			const struct dmi_header *dh,
-			char *buf);
-};
-
-#define DMI_SYSFS_MAPPED_ATTR(_entry, _name) \
-struct dmi_sysfs_mapped_attribute dmi_sysfs_attr_##_entry##_##_name = { \
-	.attr = {.name = __stringify(_name), .mode = 0400}, \
-	.show = dmi_sysfs_##_entry##_##_name, \
-}
-
-/*************************************************
- * Generic DMI entry support.
- *************************************************/
-static void dmi_entry_free(struct kobject *kobj)
-{
-	kfree(kobj);
-}
-
-static struct dmi_sysfs_entry *to_entry(struct kobject *kobj)
-{
-	return container_of(kobj, struct dmi_sysfs_entry, kobj);
-}
-
-static struct dmi_sysfs_attribute *to_attr(struct attribute *attr)
-{
-	return container_of(attr, struct dmi_sysfs_attribute, attr);
-}
-
-static ssize_t dmi_sysfs_attr_show(struct kobject *kobj,
-				   struct attribute *_attr, char *buf)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj);
-	struct dmi_sysfs_attribute *attr = to_attr(_attr);
-
-	/* DMI stuff is only ever admin visible */
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
-	return attr->show(entry, buf);
-}
-
-static const struct sysfs_ops dmi_sysfs_attr_ops = {
-	.show = dmi_sysfs_attr_show,
-};
-
-typedef ssize_t (*dmi_callback)(struct dmi_sysfs_entry *,
-				const struct dmi_header *dh, void *);
-
-struct find_dmi_data {
-	struct dmi_sysfs_entry	*entry;
-	dmi_callback		callback;
-	void			*private;
-	int			instance_countdown;
-	ssize_t			ret;
-};
-
-static void find_dmi_entry_helper(const struct dmi_header *dh,
-				  void *_data)
-{
-	struct find_dmi_data *data = _data;
-	struct dmi_sysfs_entry *entry = data->entry;
-
-	/* Is this the entry we want? */
-	if (dh->type != entry->dh.type)
-		return;
-
-	if (data->instance_countdown != 0) {
-		/* try the next instance? */
-		data->instance_countdown--;
-		return;
-	}
-
-	/*
-	 * Don't ever revisit the instance.  Short circuit later
-	 * instances by letting the instance_countdown run negative
-	 */
-	data->instance_countdown--;
-
-	/* Found the entry */
-	data->ret = data->callback(entry, dh, data->private);
-}
-
-/* State for passing the read parameters through dmi_find_entry() */
-struct dmi_read_state {
-	char *buf;
-	loff_t pos;
-	size_t count;
-};
-
-static ssize_t find_dmi_entry(struct dmi_sysfs_entry *entry,
-			      dmi_callback callback, void *private)
-{
-	struct find_dmi_data data = {
-		.entry = entry,
-		.callback = callback,
-		.private = private,
-		.instance_countdown = entry->instance,
-		.ret = -EIO,  /* To signal the entry disappeared */
-	};
-	int ret;
-
-	ret = dmi_walk(find_dmi_entry_helper, &data);
-	/* This shouldn't happen, but just in case. */
-	if (ret)
-		return -EINVAL;
-	return data.ret;
-}
-
-/*
- * Calculate and return the byte length of the dmi entry identified by
- * dh.  This includes both the formatted portion as well as the
- * unformatted string space, including the two trailing nul characters.
- */
-static size_t dmi_entry_length(const struct dmi_header *dh)
-{
-	const char *p = (const char *)dh;
-
-	p += dh->length;
-
-	while (p[0] || p[1])
-		p++;
-
-	return 2 + p - (const char *)dh;
-}
-
-/*************************************************
- * Support bits for specialized DMI entry support
- *************************************************/
-struct dmi_entry_attr_show_data {
-	struct attribute *attr;
-	char *buf;
-};
-
-static ssize_t dmi_entry_attr_show_helper(struct dmi_sysfs_entry *entry,
-					  const struct dmi_header *dh,
-					  void *_data)
-{
-	struct dmi_entry_attr_show_data *data = _data;
-	struct dmi_sysfs_mapped_attribute *attr;
-
-	attr = container_of(data->attr,
-			    struct dmi_sysfs_mapped_attribute, attr);
-	return attr->show(entry, dh, data->buf);
-}
-
-static ssize_t dmi_entry_attr_show(struct kobject *kobj,
-				   struct attribute *attr,
-				   char *buf)
-{
-	struct dmi_entry_attr_show_data data = {
-		.attr = attr,
-		.buf  = buf,
-	};
-	/* Find the entry according to our parent and call the
-	 * normalized show method hanging off of the attribute */
-	return find_dmi_entry(to_entry(kobj->parent),
-			      dmi_entry_attr_show_helper, &data);
-}
-
-static const struct sysfs_ops dmi_sysfs_specialize_attr_ops = {
-	.show = dmi_entry_attr_show,
-};
-
-/*************************************************
- * Specialized DMI entry support.
- *************************************************/
-
-/*** Type 15 - System Event Table ***/
-
-#define DMI_SEL_ACCESS_METHOD_IO8	0x00
-#define DMI_SEL_ACCESS_METHOD_IO2x8	0x01
-#define DMI_SEL_ACCESS_METHOD_IO16	0x02
-#define DMI_SEL_ACCESS_METHOD_PHYS32	0x03
-#define DMI_SEL_ACCESS_METHOD_GPNV	0x04
-
-struct dmi_system_event_log {
-	struct dmi_header header;
-	u16	area_length;
-	u16	header_start_offset;
-	u16	data_start_offset;
-	u8	access_method;
-	u8	status;
-	u32	change_token;
-	union {
-		struct {
-			u16 index_addr;
-			u16 data_addr;
-		} io;
-		u32	phys_addr32;
-		u16	gpnv_handle;
-		u32	access_method_address;
-	};
-	u8	header_format;
-	u8	type_descriptors_supported_count;
-	u8	per_log_type_descriptor_length;
-	u8	supported_log_type_descriptos[0];
-} __packed;
-
-#define DMI_SYSFS_SEL_FIELD(_field) \
-static ssize_t dmi_sysfs_sel_##_field(struct dmi_sysfs_entry *entry, \
-				      const struct dmi_header *dh, \
-				      char *buf) \
-{ \
-	struct dmi_system_event_log sel; \
-	if (sizeof(sel) > dmi_entry_length(dh)) \
-		return -EIO; \
-	memcpy(&sel, dh, sizeof(sel)); \
-	return sprintf(buf, "%u\n", sel._field); \
-} \
-static DMI_SYSFS_MAPPED_ATTR(sel, _field)
-
-DMI_SYSFS_SEL_FIELD(area_length);
-DMI_SYSFS_SEL_FIELD(header_start_offset);
-DMI_SYSFS_SEL_FIELD(data_start_offset);
-DMI_SYSFS_SEL_FIELD(access_method);
-DMI_SYSFS_SEL_FIELD(status);
-DMI_SYSFS_SEL_FIELD(change_token);
-DMI_SYSFS_SEL_FIELD(access_method_address);
-DMI_SYSFS_SEL_FIELD(header_format);
-DMI_SYSFS_SEL_FIELD(type_descriptors_supported_count);
-DMI_SYSFS_SEL_FIELD(per_log_type_descriptor_length);
-
-static struct attribute *dmi_sysfs_sel_attrs[] = {
-	&dmi_sysfs_attr_sel_area_length.attr,
-	&dmi_sysfs_attr_sel_header_start_offset.attr,
-	&dmi_sysfs_attr_sel_data_start_offset.attr,
-	&dmi_sysfs_attr_sel_access_method.attr,
-	&dmi_sysfs_attr_sel_status.attr,
-	&dmi_sysfs_attr_sel_change_token.attr,
-	&dmi_sysfs_attr_sel_access_method_address.attr,
-	&dmi_sysfs_attr_sel_header_format.attr,
-	&dmi_sysfs_attr_sel_type_descriptors_supported_count.attr,
-	&dmi_sysfs_attr_sel_per_log_type_descriptor_length.attr,
-	NULL,
-};
-
-
-static struct kobj_type dmi_system_event_log_ktype = {
-	.release = dmi_entry_free,
-	.sysfs_ops = &dmi_sysfs_specialize_attr_ops,
-	.default_attrs = dmi_sysfs_sel_attrs,
-};
-
-typedef u8 (*sel_io_reader)(const struct dmi_system_event_log *sel,
-			    loff_t offset);
-
-static DEFINE_MUTEX(io_port_lock);
-
-static u8 read_sel_8bit_indexed_io(const struct dmi_system_event_log *sel,
-				   loff_t offset)
-{
-	u8 ret;
-
-	mutex_lock(&io_port_lock);
-	outb((u8)offset, sel->io.index_addr);
-	ret = inb(sel->io.data_addr);
-	mutex_unlock(&io_port_lock);
-	return ret;
-}
-
-static u8 read_sel_2x8bit_indexed_io(const struct dmi_system_event_log *sel,
-				     loff_t offset)
-{
-	u8 ret;
-
-	mutex_lock(&io_port_lock);
-	outb((u8)offset, sel->io.index_addr);
-	outb((u8)(offset >> 8), sel->io.index_addr + 1);
-	ret = inb(sel->io.data_addr);
-	mutex_unlock(&io_port_lock);
-	return ret;
-}
-
-static u8 read_sel_16bit_indexed_io(const struct dmi_system_event_log *sel,
-				    loff_t offset)
-{
-	u8 ret;
-
-	mutex_lock(&io_port_lock);
-	outw((u16)offset, sel->io.index_addr);
-	ret = inb(sel->io.data_addr);
-	mutex_unlock(&io_port_lock);
-	return ret;
-}
-
-static sel_io_reader sel_io_readers[] = {
-	[DMI_SEL_ACCESS_METHOD_IO8]	= read_sel_8bit_indexed_io,
-	[DMI_SEL_ACCESS_METHOD_IO2x8]	= read_sel_2x8bit_indexed_io,
-	[DMI_SEL_ACCESS_METHOD_IO16]	= read_sel_16bit_indexed_io,
-};
-
-static ssize_t dmi_sel_raw_read_io(struct dmi_sysfs_entry *entry,
-				   const struct dmi_system_event_log *sel,
-				   char *buf, loff_t pos, size_t count)
-{
-	ssize_t wrote = 0;
-
-	sel_io_reader io_reader = sel_io_readers[sel->access_method];
-
-	while (count && pos < sel->area_length) {
-		count--;
-		*(buf++) = io_reader(sel, pos++);
-		wrote++;
-	}
-
-	return wrote;
-}
-
-static ssize_t dmi_sel_raw_read_phys32(struct dmi_sysfs_entry *entry,
-				       const struct dmi_system_event_log *sel,
-				       char *buf, loff_t pos, size_t count)
-{
-	u8 __iomem *mapped;
-	ssize_t wrote = 0;
-
-	mapped = ioremap(sel->access_method_address, sel->area_length);
-	if (!mapped)
-		return -EIO;
-
-	while (count && pos < sel->area_length) {
-		count--;
-		*(buf++) = readb(mapped + pos++);
-		wrote++;
-	}
-
-	iounmap(mapped);
-	return wrote;
-}
-
-static ssize_t dmi_sel_raw_read_helper(struct dmi_sysfs_entry *entry,
-				       const struct dmi_header *dh,
-				       void *_state)
-{
-	struct dmi_read_state *state = _state;
-	struct dmi_system_event_log sel;
-
-	if (sizeof(sel) > dmi_entry_length(dh))
-		return -EIO;
-
-	memcpy(&sel, dh, sizeof(sel));
-
-	switch (sel.access_method) {
-	case DMI_SEL_ACCESS_METHOD_IO8:
-	case DMI_SEL_ACCESS_METHOD_IO2x8:
-	case DMI_SEL_ACCESS_METHOD_IO16:
-		return dmi_sel_raw_read_io(entry, &sel, state->buf,
-					   state->pos, state->count);
-	case DMI_SEL_ACCESS_METHOD_PHYS32:
-		return dmi_sel_raw_read_phys32(entry, &sel, state->buf,
-					       state->pos, state->count);
-	case DMI_SEL_ACCESS_METHOD_GPNV:
-		pr_info("dmi-sysfs: GPNV support missing.\n");
-		return -EIO;
-	default:
-		pr_info("dmi-sysfs: Unknown access method %02x\n",
-			sel.access_method);
-		return -EIO;
-	}
-}
-
-static ssize_t dmi_sel_raw_read(struct file *filp, struct kobject *kobj,
-				struct bin_attribute *bin_attr,
-				char *buf, loff_t pos, size_t count)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj->parent);
-	struct dmi_read_state state = {
-		.buf = buf,
-		.pos = pos,
-		.count = count,
-	};
-
-	return find_dmi_entry(entry, dmi_sel_raw_read_helper, &state);
-}
-
-static struct bin_attribute dmi_sel_raw_attr = {
-	.attr = {.name = "raw_event_log", .mode = 0400},
-	.read = dmi_sel_raw_read,
-};
-
-static int dmi_system_event_log(struct dmi_sysfs_entry *entry)
-{
-	int ret;
-
-	entry->child = kzalloc(sizeof(*entry->child), GFP_KERNEL);
-	if (!entry->child)
-		return -ENOMEM;
-	ret = kobject_init_and_add(entry->child,
-				   &dmi_system_event_log_ktype,
-				   &entry->kobj,
-				   "system_event_log");
-	if (ret)
-		goto out_free;
-
-	ret = sysfs_create_bin_file(entry->child, &dmi_sel_raw_attr);
-	if (ret)
-		goto out_del;
-
-	return 0;
-
-out_del:
-	kobject_del(entry->child);
-out_free:
-	kfree(entry->child);
-	return ret;
-}
-
-/*************************************************
- * Generic DMI entry support.
- *************************************************/
-
-static ssize_t dmi_sysfs_entry_length(struct dmi_sysfs_entry *entry, char *buf)
-{
-	return sprintf(buf, "%d\n", entry->dh.length);
-}
-
-static ssize_t dmi_sysfs_entry_handle(struct dmi_sysfs_entry *entry, char *buf)
-{
-	return sprintf(buf, "%d\n", entry->dh.handle);
-}
-
-static ssize_t dmi_sysfs_entry_type(struct dmi_sysfs_entry *entry, char *buf)
-{
-	return sprintf(buf, "%d\n", entry->dh.type);
-}
-
-static ssize_t dmi_sysfs_entry_instance(struct dmi_sysfs_entry *entry,
-					char *buf)
-{
-	return sprintf(buf, "%d\n", entry->instance);
-}
-
-static ssize_t dmi_sysfs_entry_position(struct dmi_sysfs_entry *entry,
-					char *buf)
-{
-	return sprintf(buf, "%d\n", entry->position);
-}
-
-static DMI_SYSFS_ATTR(entry, length);
-static DMI_SYSFS_ATTR(entry, handle);
-static DMI_SYSFS_ATTR(entry, type);
-static DMI_SYSFS_ATTR(entry, instance);
-static DMI_SYSFS_ATTR(entry, position);
-
-static struct attribute *dmi_sysfs_entry_attrs[] = {
-	&dmi_sysfs_attr_entry_length.attr,
-	&dmi_sysfs_attr_entry_handle.attr,
-	&dmi_sysfs_attr_entry_type.attr,
-	&dmi_sysfs_attr_entry_instance.attr,
-	&dmi_sysfs_attr_entry_position.attr,
-	NULL,
-};
-
-static ssize_t dmi_entry_raw_read_helper(struct dmi_sysfs_entry *entry,
-					 const struct dmi_header *dh,
-					 void *_state)
-{
-	struct dmi_read_state *state = _state;
-	size_t entry_length;
-
-	entry_length = dmi_entry_length(dh);
-
-	return memory_read_from_buffer(state->buf, state->count,
-				       &state->pos, dh, entry_length);
-}
-
-static ssize_t dmi_entry_raw_read(struct file *filp,
-				  struct kobject *kobj,
-				  struct bin_attribute *bin_attr,
-				  char *buf, loff_t pos, size_t count)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj);
-	struct dmi_read_state state = {
-		.buf = buf,
-		.pos = pos,
-		.count = count,
-	};
-
-	return find_dmi_entry(entry, dmi_entry_raw_read_helper, &state);
-}
-
-static const struct bin_attribute dmi_entry_raw_attr = {
-	.attr = {.name = "raw", .mode = 0400},
-	.read = dmi_entry_raw_read,
-};
-
-static void dmi_sysfs_entry_release(struct kobject *kobj)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj);
-	sysfs_remove_bin_file(&entry->kobj, &dmi_entry_raw_attr);
-	spin_lock(&entry_list_lock);
-	list_del(&entry->list);
-	spin_unlock(&entry_list_lock);
-	kfree(entry);
-}
-
-static struct kobj_type dmi_sysfs_entry_ktype = {
-	.release = dmi_sysfs_entry_release,
-	.sysfs_ops = &dmi_sysfs_attr_ops,
-	.default_attrs = dmi_sysfs_entry_attrs,
-};
-
-static struct kobject *dmi_kobj;
-static struct kset *dmi_kset;
-
-/* Global count of all instances seen.  Only for setup */
-static int __initdata instance_counts[MAX_ENTRY_TYPE + 1];
-
-/* Global positional count of all entries seen.  Only for setup */
-static int __initdata position_count;
-
-static void __init dmi_sysfs_register_handle(const struct dmi_header *dh,
-					     void *_ret)
-{
-	struct dmi_sysfs_entry *entry;
-	int *ret = _ret;
-
-	/* If a previous entry saw an error, short circuit */
-	if (*ret)
-		return;
-
-	/* Allocate and register a new entry into the entries set */
-	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
-	if (!entry) {
-		*ret = -ENOMEM;
-		return;
-	}
-
-	/* Set the key */
-	memcpy(&entry->dh, dh, sizeof(*dh));
-	entry->instance = instance_counts[dh->type]++;
-	entry->position = position_count++;
-
-	entry->kobj.kset = dmi_kset;
-	*ret = kobject_init_and_add(&entry->kobj, &dmi_sysfs_entry_ktype, NULL,
-				    "%d-%d", dh->type, entry->instance);
-
-	if (*ret) {
-		kfree(entry);
-		return;
-	}
-
-	/* Thread on the global list for cleanup */
-	spin_lock(&entry_list_lock);
-	list_add_tail(&entry->list, &entry_list);
-	spin_unlock(&entry_list_lock);
-
-	/* Handle specializations by type */
-	switch (dh->type) {
-	case DMI_ENTRY_SYSTEM_EVENT_LOG:
-		*ret = dmi_system_event_log(entry);
-		break;
-	default:
-		/* No specialization */
-		break;
-	}
-	if (*ret)
-		goto out_err;
-
-	/* Create the raw binary file to access the entry */
-	*ret = sysfs_create_bin_file(&entry->kobj, &dmi_entry_raw_attr);
-	if (*ret)
-		goto out_err;
-
-	return;
-out_err:
-	kobject_put(entry->child);
-	kobject_put(&entry->kobj);
-	return;
-}
-
-static void cleanup_entry_list(void)
-{
-	struct dmi_sysfs_entry *entry, *next;
-
-	/* No locks, we are on our way out */
-	list_for_each_entry_safe(entry, next, &entry_list, list) {
-		kobject_put(entry->child);
-		kobject_put(&entry->kobj);
-	}
-}
-
-static int __init dmi_sysfs_init(void)
-{
-	int error = -ENOMEM;
-	int val;
-
-	/* Set up our directory */
-	dmi_kobj = kobject_create_and_add("dmi", firmware_kobj);
-	if (!dmi_kobj)
-		goto err;
-
-	dmi_kset = kset_create_and_add("entries", NULL, dmi_kobj);
-	if (!dmi_kset)
-		goto err;
-
-	val = 0;
-	error = dmi_walk(dmi_sysfs_register_handle, &val);
-	if (error)
-		goto err;
-	if (val) {
-		error = val;
-		goto err;
-	}
-
-	pr_debug("dmi-sysfs: loaded.\n");
-
-	return 0;
-err:
-	cleanup_entry_list();
-	kset_unregister(dmi_kset);
-	kobject_put(dmi_kobj);
-	return error;
-}
-
-/* clean up everything. */
-static void __exit dmi_sysfs_exit(void)
-{
-	pr_debug("dmi-sysfs: unloading.\n");
-	cleanup_entry_list();
-	kset_unregister(dmi_kset);
-	kobject_put(dmi_kobj);
-}
-
-module_init(dmi_sysfs_init);
-module_exit(dmi_sysfs_exit);
-
-MODULE_AUTHOR("Mike Waychison <mikew@google.com>");
-MODULE_DESCRIPTION("DMI sysfs support");
-MODULE_LICENSE("GPL");
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
deleted file mode 100644
index bcb1126..0000000
--- a/drivers/firmware/dmi_scan.c
+++ /dev/null
@@ -1,751 +0,0 @@
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/ctype.h>
-#include <linux/dmi.h>
-#include <linux/efi.h>
-#include <linux/bootmem.h>
-#include <asm/dmi.h>
-
-/*
- * DMI stands for "Desktop Management Interface".  It is part
- * of and an antecedent to, SMBIOS, which stands for System
- * Management BIOS.  See further: http://www.dmtf.org/standards
- */
-static char dmi_empty_string[] = "        ";
-
-/*
- * Catch too early calls to dmi_check_system():
- */
-static int dmi_initialized;
-
-static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)
-{
-	const u8 *bp = ((u8 *) dm) + dm->length;
-
-	if (s) {
-		s--;
-		while (s > 0 && *bp) {
-			bp += strlen(bp) + 1;
-			s--;
-		}
-
-		if (*bp != 0) {
-			size_t len = strlen(bp)+1;
-			size_t cmp_len = len > 8 ? 8 : len;
-
-			if (!memcmp(bp, dmi_empty_string, cmp_len))
-				return dmi_empty_string;
-			return bp;
-		}
-	}
-
-	return "";
-}
-
-static char * __init dmi_string(const struct dmi_header *dm, u8 s)
-{
-	const char *bp = dmi_string_nosave(dm, s);
-	char *str;
-	size_t len;
-
-	if (bp == dmi_empty_string)
-		return dmi_empty_string;
-
-	len = strlen(bp) + 1;
-	str = dmi_alloc(len);
-	if (str != NULL)
-		strcpy(str, bp);
-	else
-		printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
-
-	return str;
-}
-
-/*
- *	We have to be cautious here. We have seen BIOSes with DMI pointers
- *	pointing to completely the wrong place for example
- */
-static void dmi_table(u8 *buf, int len, int num,
-		      void (*decode)(const struct dmi_header *, void *),
-		      void *private_data)
-{
-	u8 *data = buf;
-	int i = 0;
-
-	/*
-	 *	Stop when we see all the items the table claimed to have
-	 *	OR we run off the end of the table (also happens)
-	 */
-	while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) {
-		const struct dmi_header *dm = (const struct dmi_header *)data;
-
-		/*
-		 *  We want to know the total length (formatted area and
-		 *  strings) before decoding to make sure we won't run off the
-		 *  table in dmi_decode or dmi_string
-		 */
-		data += dm->length;
-		while ((data - buf < len - 1) && (data[0] || data[1]))
-			data++;
-		if (data - buf < len - 1)
-			decode(dm, private_data);
-		data += 2;
-		i++;
-	}
-}
-
-static u32 dmi_base;
-static u16 dmi_len;
-static u16 dmi_num;
-
-static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
-		void *))
-{
-	u8 *buf;
-
-	buf = dmi_ioremap(dmi_base, dmi_len);
-	if (buf == NULL)
-		return -1;
-
-	dmi_table(buf, dmi_len, dmi_num, decode, NULL);
-
-	dmi_iounmap(buf, dmi_len);
-	return 0;
-}
-
-static int __init dmi_checksum(const u8 *buf)
-{
-	u8 sum = 0;
-	int a;
-
-	for (a = 0; a < 15; a++)
-		sum += buf[a];
-
-	return sum == 0;
-}
-
-static char *dmi_ident[DMI_STRING_MAX];
-static LIST_HEAD(dmi_devices);
-int dmi_available;
-
-/*
- *	Save a DMI string
- */
-static void __init dmi_save_ident(const struct dmi_header *dm, int slot, int string)
-{
-	const char *d = (const char*) dm;
-	char *p;
-
-	if (dmi_ident[slot])
-		return;
-
-	p = dmi_string(dm, d[string]);
-	if (p == NULL)
-		return;
-
-	dmi_ident[slot] = p;
-}
-
-static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int index)
-{
-	const u8 *d = (u8*) dm + index;
-	char *s;
-	int is_ff = 1, is_00 = 1, i;
-
-	if (dmi_ident[slot])
-		return;
-
-	for (i = 0; i < 16 && (is_ff || is_00); i++) {
-		if(d[i] != 0x00) is_ff = 0;
-		if(d[i] != 0xFF) is_00 = 0;
-	}
-
-	if (is_ff || is_00)
-		return;
-
-	s = dmi_alloc(16*2+4+1);
-	if (!s)
-		return;
-
-	sprintf(s, "%pUB", d);
-
-        dmi_ident[slot] = s;
-}
-
-static void __init dmi_save_type(const struct dmi_header *dm, int slot, int index)
-{
-	const u8 *d = (u8*) dm + index;
-	char *s;
-
-	if (dmi_ident[slot])
-		return;
-
-	s = dmi_alloc(4);
-	if (!s)
-		return;
-
-	sprintf(s, "%u", *d & 0x7F);
-	dmi_ident[slot] = s;
-}
-
-static void __init dmi_save_one_device(int type, const char *name)
-{
-	struct dmi_device *dev;
-
-	/* No duplicate device */
-	if (dmi_find_device(type, name, NULL))
-		return;
-
-	dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
-	if (!dev) {
-		printk(KERN_ERR "dmi_save_one_device: out of memory.\n");
-		return;
-	}
-
-	dev->type = type;
-	strcpy((char *)(dev + 1), name);
-	dev->name = (char *)(dev + 1);
-	dev->device_data = NULL;
-	list_add(&dev->list, &dmi_devices);
-}
-
-static void __init dmi_save_devices(const struct dmi_header *dm)
-{
-	int i, count = (dm->length - sizeof(struct dmi_header)) / 2;
-
-	for (i = 0; i < count; i++) {
-		const char *d = (char *)(dm + 1) + (i * 2);
-
-		/* Skip disabled device */
-		if ((*d & 0x80) == 0)
-			continue;
-
-		dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d + 1)));
-	}
-}
-
-static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
-{
-	int i, count = *(u8 *)(dm + 1);
-	struct dmi_device *dev;
-
-	for (i = 1; i <= count; i++) {
-		char *devname = dmi_string(dm, i);
-
-		if (devname == dmi_empty_string)
-			continue;
-
-		dev = dmi_alloc(sizeof(*dev));
-		if (!dev) {
-			printk(KERN_ERR
-			   "dmi_save_oem_strings_devices: out of memory.\n");
-			break;
-		}
-
-		dev->type = DMI_DEV_TYPE_OEM_STRING;
-		dev->name = devname;
-		dev->device_data = NULL;
-
-		list_add(&dev->list, &dmi_devices);
-	}
-}
-
-static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
-{
-	struct dmi_device *dev;
-	void * data;
-
-	data = dmi_alloc(dm->length);
-	if (data == NULL) {
-		printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
-		return;
-	}
-
-	memcpy(data, dm, dm->length);
-
-	dev = dmi_alloc(sizeof(*dev));
-	if (!dev) {
-		printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
-		return;
-	}
-
-	dev->type = DMI_DEV_TYPE_IPMI;
-	dev->name = "IPMI controller";
-	dev->device_data = data;
-
-	list_add_tail(&dev->list, &dmi_devices);
-}
-
-static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
-					int devfn, const char *name)
-{
-	struct dmi_dev_onboard *onboard_dev;
-
-	onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
-	if (!onboard_dev) {
-		printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
-		return;
-	}
-	onboard_dev->instance = instance;
-	onboard_dev->segment = segment;
-	onboard_dev->bus = bus;
-	onboard_dev->devfn = devfn;
-
-	strcpy((char *)&onboard_dev[1], name);
-	onboard_dev->dev.type = DMI_DEV_TYPE_DEV_ONBOARD;
-	onboard_dev->dev.name = (char *)&onboard_dev[1];
-	onboard_dev->dev.device_data = onboard_dev;
-
-	list_add(&onboard_dev->dev.list, &dmi_devices);
-}
-
-static void __init dmi_save_extended_devices(const struct dmi_header *dm)
-{
-	const u8 *d = (u8*) dm + 5;
-
-	/* Skip disabled device */
-	if ((*d & 0x80) == 0)
-		return;
-
-	dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
-			     dmi_string_nosave(dm, *(d-1)));
-	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
-}
-
-/*
- *	Process a DMI table entry. Right now all we care about are the BIOS
- *	and machine entries. For 2.5 we should pull the smbus controller info
- *	out of here.
- */
-static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
-{
-	switch(dm->type) {
-	case 0:		/* BIOS Information */
-		dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
-		dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
-		dmi_save_ident(dm, DMI_BIOS_DATE, 8);
-		break;
-	case 1:		/* System Information */
-		dmi_save_ident(dm, DMI_SYS_VENDOR, 4);
-		dmi_save_ident(dm, DMI_PRODUCT_NAME, 5);
-		dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
-		dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7);
-		dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8);
-		break;
-	case 2:		/* Base Board Information */
-		dmi_save_ident(dm, DMI_BOARD_VENDOR, 4);
-		dmi_save_ident(dm, DMI_BOARD_NAME, 5);
-		dmi_save_ident(dm, DMI_BOARD_VERSION, 6);
-		dmi_save_ident(dm, DMI_BOARD_SERIAL, 7);
-		dmi_save_ident(dm, DMI_BOARD_ASSET_TAG, 8);
-		break;
-	case 3:		/* Chassis Information */
-		dmi_save_ident(dm, DMI_CHASSIS_VENDOR, 4);
-		dmi_save_type(dm, DMI_CHASSIS_TYPE, 5);
-		dmi_save_ident(dm, DMI_CHASSIS_VERSION, 6);
-		dmi_save_ident(dm, DMI_CHASSIS_SERIAL, 7);
-		dmi_save_ident(dm, DMI_CHASSIS_ASSET_TAG, 8);
-		break;
-	case 10:	/* Onboard Devices Information */
-		dmi_save_devices(dm);
-		break;
-	case 11:	/* OEM Strings */
-		dmi_save_oem_strings_devices(dm);
-		break;
-	case 38:	/* IPMI Device Information */
-		dmi_save_ipmi_device(dm);
-		break;
-	case 41:	/* Onboard Devices Extended Information */
-		dmi_save_extended_devices(dm);
-	}
-}
-
-static void __init print_filtered(const char *info)
-{
-	const char *p;
-
-	if (!info)
-		return;
-
-	for (p = info; *p; p++)
-		if (isprint(*p))
-			printk(KERN_CONT "%c", *p);
-		else
-			printk(KERN_CONT "\\x%02x", *p & 0xff);
-}
-
-static void __init dmi_dump_ids(void)
-{
-	const char *board;	/* Board Name is optional */
-
-	printk(KERN_DEBUG "DMI: ");
-	print_filtered(dmi_get_system_info(DMI_SYS_VENDOR));
-	printk(KERN_CONT " ");
-	print_filtered(dmi_get_system_info(DMI_PRODUCT_NAME));
-	board = dmi_get_system_info(DMI_BOARD_NAME);
-	if (board) {
-		printk(KERN_CONT "/");
-		print_filtered(board);
-	}
-	printk(KERN_CONT ", BIOS ");
-	print_filtered(dmi_get_system_info(DMI_BIOS_VERSION));
-	printk(KERN_CONT " ");
-	print_filtered(dmi_get_system_info(DMI_BIOS_DATE));
-	printk(KERN_CONT "\n");
-}
-
-static int __init dmi_present(const char __iomem *p)
-{
-	u8 buf[15];
-
-	memcpy_fromio(buf, p, 15);
-	if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
-		dmi_num = (buf[13] << 8) | buf[12];
-		dmi_len = (buf[7] << 8) | buf[6];
-		dmi_base = (buf[11] << 24) | (buf[10] << 16) |
-			(buf[9] << 8) | buf[8];
-
-		/*
-		 * DMI version 0.0 means that the real version is taken from
-		 * the SMBIOS version, which we don't know at this point.
-		 */
-		if (buf[14] != 0)
-			printk(KERN_INFO "DMI %d.%d present.\n",
-			       buf[14] >> 4, buf[14] & 0xF);
-		else
-			printk(KERN_INFO "DMI present.\n");
-		if (dmi_walk_early(dmi_decode) == 0) {
-			dmi_dump_ids();
-			return 0;
-		}
-	}
-	return 1;
-}
-
-void __init dmi_scan_machine(void)
-{
-	char __iomem *p, *q;
-	int rc;
-
-	if (efi_enabled) {
-		if (efi.smbios == EFI_INVALID_TABLE_ADDR)
-			goto error;
-
-		/* This is called as a core_initcall() because it isn't
-		 * needed during early boot.  This also means we can
-		 * iounmap the space when we're done with it.
-		 */
-		p = dmi_ioremap(efi.smbios, 32);
-		if (p == NULL)
-			goto error;
-
-		rc = dmi_present(p + 0x10); /* offset of _DMI_ string */
-		dmi_iounmap(p, 32);
-		if (!rc) {
-			dmi_available = 1;
-			goto out;
-		}
-	}
-	else {
-		/*
-		 * no iounmap() for that ioremap(); it would be a no-op, but
-		 * it's so early in setup that sucker gets confused into doing
-		 * what it shouldn't if we actually call it.
-		 */
-		p = dmi_ioremap(0xF0000, 0x10000);
-		if (p == NULL)
-			goto error;
-
-		for (q = p; q < p + 0x10000; q += 16) {
-			rc = dmi_present(q);
-			if (!rc) {
-				dmi_available = 1;
-				dmi_iounmap(p, 0x10000);
-				goto out;
-			}
-		}
-		dmi_iounmap(p, 0x10000);
-	}
- error:
-	printk(KERN_INFO "DMI not present or invalid.\n");
- out:
-	dmi_initialized = 1;
-}
-
-/**
- *	dmi_matches - check if dmi_system_id structure matches system DMI data
- *	@dmi: pointer to the dmi_system_id structure to check
- */
-static bool dmi_matches(const struct dmi_system_id *dmi)
-{
-	int i;
-
-	WARN(!dmi_initialized, KERN_ERR "dmi check: not initialized yet.\n");
-
-	for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) {
-		int s = dmi->matches[i].slot;
-		if (s == DMI_NONE)
-			break;
-		if (dmi_ident[s]
-		    && strstr(dmi_ident[s], dmi->matches[i].substr))
-			continue;
-		/* No match */
-		return false;
-	}
-	return true;
-}
-
-/**
- *	dmi_is_end_of_table - check for end-of-table marker
- *	@dmi: pointer to the dmi_system_id structure to check
- */
-static bool dmi_is_end_of_table(const struct dmi_system_id *dmi)
-{
-	return dmi->matches[0].slot == DMI_NONE;
-}
-
-/**
- *	dmi_check_system - check system DMI data
- *	@list: array of dmi_system_id structures to match against
- *		All non-null elements of the list must match
- *		their slot's (field index's) data (i.e., each
- *		list string must be a substring of the specified
- *		DMI slot's string data) to be considered a
- *		successful match.
- *
- *	Walk the blacklist table running matching functions until someone
- *	returns non zero or we hit the end. Callback function is called for
- *	each successful match. Returns the number of matches.
- */
-int dmi_check_system(const struct dmi_system_id *list)
-{
-	int count = 0;
-	const struct dmi_system_id *d;
-
-	for (d = list; !dmi_is_end_of_table(d); d++)
-		if (dmi_matches(d)) {
-			count++;
-			if (d->callback && d->callback(d))
-				break;
-		}
-
-	return count;
-}
-EXPORT_SYMBOL(dmi_check_system);
-
-/**
- *	dmi_first_match - find dmi_system_id structure matching system DMI data
- *	@list: array of dmi_system_id structures to match against
- *		All non-null elements of the list must match
- *		their slot's (field index's) data (i.e., each
- *		list string must be a substring of the specified
- *		DMI slot's string data) to be considered a
- *		successful match.
- *
- *	Walk the blacklist table until the first match is found.  Return the
- *	pointer to the matching entry or NULL if there's no match.
- */
-const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list)
-{
-	const struct dmi_system_id *d;
-
-	for (d = list; !dmi_is_end_of_table(d); d++)
-		if (dmi_matches(d))
-			return d;
-
-	return NULL;
-}
-EXPORT_SYMBOL(dmi_first_match);
-
-/**
- *	dmi_get_system_info - return DMI data value
- *	@field: data index (see enum dmi_field)
- *
- *	Returns one DMI data value, can be used to perform
- *	complex DMI data checks.
- */
-const char *dmi_get_system_info(int field)
-{
-	return dmi_ident[field];
-}
-EXPORT_SYMBOL(dmi_get_system_info);
-
-/**
- * dmi_name_in_serial - Check if string is in the DMI product serial information
- * @str: string to check for
- */
-int dmi_name_in_serial(const char *str)
-{
-	int f = DMI_PRODUCT_SERIAL;
-	if (dmi_ident[f] && strstr(dmi_ident[f], str))
-		return 1;
-	return 0;
-}
-
-/**
- *	dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information.
- *	@str: 	Case sensitive Name
- */
-int dmi_name_in_vendors(const char *str)
-{
-	static int fields[] = { DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_SYS_VENDOR,
-				DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_BOARD_VENDOR,
-				DMI_BOARD_NAME, DMI_BOARD_VERSION, DMI_NONE };
-	int i;
-	for (i = 0; fields[i] != DMI_NONE; i++) {
-		int f = fields[i];
-		if (dmi_ident[f] && strstr(dmi_ident[f], str))
-			return 1;
-	}
-	return 0;
-}
-EXPORT_SYMBOL(dmi_name_in_vendors);
-
-/**
- *	dmi_find_device - find onboard device by type/name
- *	@type: device type or %DMI_DEV_TYPE_ANY to match all device types
- *	@name: device name string or %NULL to match all
- *	@from: previous device found in search, or %NULL for new search.
- *
- *	Iterates through the list of known onboard devices. If a device is
- *	found with a matching @vendor and @device, a pointer to its device
- *	structure is returned.  Otherwise, %NULL is returned.
- *	A new search is initiated by passing %NULL as the @from argument.
- *	If @from is not %NULL, searches continue from next device.
- */
-const struct dmi_device * dmi_find_device(int type, const char *name,
-				    const struct dmi_device *from)
-{
-	const struct list_head *head = from ? &from->list : &dmi_devices;
-	struct list_head *d;
-
-	for(d = head->next; d != &dmi_devices; d = d->next) {
-		const struct dmi_device *dev =
-			list_entry(d, struct dmi_device, list);
-
-		if (((type == DMI_DEV_TYPE_ANY) || (dev->type == type)) &&
-		    ((name == NULL) || (strcmp(dev->name, name) == 0)))
-			return dev;
-	}
-
-	return NULL;
-}
-EXPORT_SYMBOL(dmi_find_device);
-
-/**
- *	dmi_get_date - parse a DMI date
- *	@field:	data index (see enum dmi_field)
- *	@yearp: optional out parameter for the year
- *	@monthp: optional out parameter for the month
- *	@dayp: optional out parameter for the day
- *
- *	The date field is assumed to be in the form resembling
- *	[mm[/dd]]/yy[yy] and the result is stored in the out
- *	parameters any or all of which can be omitted.
- *
- *	If the field doesn't exist, all out parameters are set to zero
- *	and false is returned.  Otherwise, true is returned with any
- *	invalid part of date set to zero.
- *
- *	On return, year, month and day are guaranteed to be in the
- *	range of [0,9999], [0,12] and [0,31] respectively.
- */
-bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
-{
-	int year = 0, month = 0, day = 0;
-	bool exists;
-	const char *s, *y;
-	char *e;
-
-	s = dmi_get_system_info(field);
-	exists = s;
-	if (!exists)
-		goto out;
-
-	/*
-	 * Determine year first.  We assume the date string resembles
-	 * mm/dd/yy[yy] but the original code extracted only the year
-	 * from the end.  Keep the behavior in the spirit of no
-	 * surprises.
-	 */
-	y = strrchr(s, '/');
-	if (!y)
-		goto out;
-
-	y++;
-	year = simple_strtoul(y, &e, 10);
-	if (y != e && year < 100) {	/* 2-digit year */
-		year += 1900;
-		if (year < 1996)	/* no dates < spec 1.0 */
-			year += 100;
-	}
-	if (year > 9999)		/* year should fit in %04d */
-		year = 0;
-
-	/* parse the mm and dd */
-	month = simple_strtoul(s, &e, 10);
-	if (s == e || *e != '/' || !month || month > 12) {
-		month = 0;
-		goto out;
-	}
-
-	s = e + 1;
-	day = simple_strtoul(s, &e, 10);
-	if (s == y || s == e || *e != '/' || day > 31)
-		day = 0;
-out:
-	if (yearp)
-		*yearp = year;
-	if (monthp)
-		*monthp = month;
-	if (dayp)
-		*dayp = day;
-	return exists;
-}
-EXPORT_SYMBOL(dmi_get_date);
-
-/**
- *	dmi_walk - Walk the DMI table and get called back for every record
- *	@decode: Callback function
- *	@private_data: Private data to be passed to the callback function
- *
- *	Returns -1 when the DMI table can't be reached, 0 on success.
- */
-int dmi_walk(void (*decode)(const struct dmi_header *, void *),
-	     void *private_data)
-{
-	u8 *buf;
-
-	if (!dmi_available)
-		return -1;
-
-	buf = ioremap(dmi_base, dmi_len);
-	if (buf == NULL)
-		return -1;
-
-	dmi_table(buf, dmi_len, dmi_num, decode, private_data);
-
-	iounmap(buf);
-	return 0;
-}
-EXPORT_SYMBOL_GPL(dmi_walk);
-
-/**
- * dmi_match - compare a string to the dmi field (if exists)
- * @f: DMI field identifier
- * @str: string to compare the DMI field to
- *
- * Returns true if the requested field equals to the str (including NULL).
- */
-bool dmi_match(enum dmi_field f, const char *str)
-{
-	const char *info = dmi_get_system_info(f);
-
-	if (info == NULL || str == NULL)
-		return info == str;
-
-	return !strcmp(info, str);
-}
-EXPORT_SYMBOL_GPL(dmi_match);
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
deleted file mode 100644
index f156cca..0000000
--- a/include/linux/dmi.h
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef __DMI_H__
-#define __DMI_H__
-
-#include <linux/list.h>
-#include <linux/mod_devicetable.h>
-
-/* enum dmi_field is in mod_devicetable.h */
-
-enum dmi_device_type {
-	DMI_DEV_TYPE_ANY = 0,
-	DMI_DEV_TYPE_OTHER,
-	DMI_DEV_TYPE_UNKNOWN,
-	DMI_DEV_TYPE_VIDEO,
-	DMI_DEV_TYPE_SCSI,
-	DMI_DEV_TYPE_ETHERNET,
-	DMI_DEV_TYPE_TOKENRING,
-	DMI_DEV_TYPE_SOUND,
-	DMI_DEV_TYPE_PATA,
-	DMI_DEV_TYPE_SATA,
-	DMI_DEV_TYPE_SAS,
-	DMI_DEV_TYPE_IPMI = -1,
-	DMI_DEV_TYPE_OEM_STRING = -2,
-	DMI_DEV_TYPE_DEV_ONBOARD = -3,
-};
-
-enum dmi_entry_type {
-	DMI_ENTRY_BIOS = 0,
-	DMI_ENTRY_SYSTEM,
-	DMI_ENTRY_BASEBOARD,
-	DMI_ENTRY_CHASSIS,
-	DMI_ENTRY_PROCESSOR,
-	DMI_ENTRY_MEM_CONTROLLER,
-	DMI_ENTRY_MEM_MODULE,
-	DMI_ENTRY_CACHE,
-	DMI_ENTRY_PORT_CONNECTOR,
-	DMI_ENTRY_SYSTEM_SLOT,
-	DMI_ENTRY_ONBOARD_DEVICE,
-	DMI_ENTRY_OEMSTRINGS,
-	DMI_ENTRY_SYSCONF,
-	DMI_ENTRY_BIOS_LANG,
-	DMI_ENTRY_GROUP_ASSOC,
-	DMI_ENTRY_SYSTEM_EVENT_LOG,
-	DMI_ENTRY_PHYS_MEM_ARRAY,
-	DMI_ENTRY_MEM_DEVICE,
-	DMI_ENTRY_32_MEM_ERROR,
-	DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR,
-	DMI_ENTRY_MEM_DEV_MAPPED_ADDR,
-	DMI_ENTRY_BUILTIN_POINTING_DEV,
-	DMI_ENTRY_PORTABLE_BATTERY,
-	DMI_ENTRY_SYSTEM_RESET,
-	DMI_ENTRY_HW_SECURITY,
-	DMI_ENTRY_SYSTEM_POWER_CONTROLS,
-	DMI_ENTRY_VOLTAGE_PROBE,
-	DMI_ENTRY_COOLING_DEV,
-	DMI_ENTRY_TEMP_PROBE,
-	DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
-	DMI_ENTRY_OOB_REMOTE_ACCESS,
-	DMI_ENTRY_BIS_ENTRY,
-	DMI_ENTRY_SYSTEM_BOOT,
-	DMI_ENTRY_MGMT_DEV,
-	DMI_ENTRY_MGMT_DEV_COMPONENT,
-	DMI_ENTRY_MGMT_DEV_THRES,
-	DMI_ENTRY_MEM_CHANNEL,
-	DMI_ENTRY_IPMI_DEV,
-	DMI_ENTRY_SYS_POWER_SUPPLY,
-	DMI_ENTRY_ADDITIONAL,
-	DMI_ENTRY_ONBOARD_DEV_EXT,
-	DMI_ENTRY_MGMT_CONTROLLER_HOST,
-	DMI_ENTRY_INACTIVE = 126,
-	DMI_ENTRY_END_OF_TABLE = 127,
-};
-
-struct dmi_header {
-	u8 type;
-	u8 length;
-	u16 handle;
-};
-
-struct dmi_device {
-	struct list_head list;
-	int type;
-	const char *name;
-	void *device_data;	/* Type specific data */
-};
-
-#ifdef CONFIG_DMI
-
-struct dmi_dev_onboard {
-	struct dmi_device dev;
-	int instance;
-	int segment;
-	int bus;
-	int devfn;
-};
-
-extern int dmi_check_system(const struct dmi_system_id *list);
-const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
-extern const char * dmi_get_system_info(int field);
-extern const struct dmi_device * dmi_find_device(int type, const char *name,
-	const struct dmi_device *from);
-extern void dmi_scan_machine(void);
-extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
-extern int dmi_name_in_vendors(const char *str);
-extern int dmi_name_in_serial(const char *str);
-extern int dmi_available;
-extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
-	void *private_data);
-extern bool dmi_match(enum dmi_field f, const char *str);
-
-#else
-
-static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
-static inline const char * dmi_get_system_info(int field) { return NULL; }
-static inline const struct dmi_device * dmi_find_device(int type, const char *name,
-	const struct dmi_device *from) { return NULL; }
-static inline void dmi_scan_machine(void) { return; }
-static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
-{
-	if (yearp)
-		*yearp = 0;
-	if (monthp)
-		*monthp = 0;
-	if (dayp)
-		*dayp = 0;
-	return false;
-}
-static inline int dmi_name_in_vendors(const char *s) { return 0; }
-static inline int dmi_name_in_serial(const char *s) { return 0; }
-#define dmi_available 0
-static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
-	void *private_data) { return -1; }
-static inline bool dmi_match(enum dmi_field f, const char *str)
-	{ return false; }
-static inline const struct dmi_system_id *
-	dmi_first_match(const struct dmi_system_id *list) { return NULL; }
-
-#endif
-
-#endif	/* __DMI_H__ */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 89153ad..5e8d1bc 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -427,61 +427,6 @@ struct spi_device_id {
 			__attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
-/* dmi */
-enum dmi_field {
-	DMI_NONE,
-	DMI_BIOS_VENDOR,
-	DMI_BIOS_VERSION,
-	DMI_BIOS_DATE,
-	DMI_SYS_VENDOR,
-	DMI_PRODUCT_NAME,
-	DMI_PRODUCT_VERSION,
-	DMI_PRODUCT_SERIAL,
-	DMI_PRODUCT_UUID,
-	DMI_BOARD_VENDOR,
-	DMI_BOARD_NAME,
-	DMI_BOARD_VERSION,
-	DMI_BOARD_SERIAL,
-	DMI_BOARD_ASSET_TAG,
-	DMI_CHASSIS_VENDOR,
-	DMI_CHASSIS_TYPE,
-	DMI_CHASSIS_VERSION,
-	DMI_CHASSIS_SERIAL,
-	DMI_CHASSIS_ASSET_TAG,
-	DMI_STRING_MAX,
-};
-
-struct dmi_strmatch {
-	unsigned char slot;
-	char substr[79];
-};
-
-#ifndef __KERNEL__
-struct dmi_system_id {
-	kernel_ulong_t callback;
-	kernel_ulong_t ident;
-	struct dmi_strmatch matches[4];
-	kernel_ulong_t driver_data
-			__attribute__((aligned(sizeof(kernel_ulong_t))));
-};
-#else
-struct dmi_system_id {
-	int (*callback)(const struct dmi_system_id *);
-	const char *ident;
-	struct dmi_strmatch matches[4];
-	void *driver_data;
-};
-/*
- * struct dmi_device_id appears during expansion of
- * "MODULE_DEVICE_TABLE(dmi, x)". Compiler doesn't look inside it
- * but this is enough for gcc 3.4.6 to error out:
- *	error: storage size of '__mod_dmi_device_table' isn't known
- */
-#define dmi_device_id dmi_system_id
-#endif
-
-#define DMI_MATCH(a, b)	{ a, b }
-
 /*
  * sysfw field - right now these are based on x86/ia64's SMBIOS fields.  But
  * other arches are certainly welcome to add additional fields.  The
-- 
1.6.5.2

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox