Commit 188db2b9 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-voyager.bkbits.net/eisa-sysfs-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 91f5fe70 eb420b6f
...@@ -535,6 +535,7 @@ config VERBOSE_MCHECK ...@@ -535,6 +535,7 @@ config VERBOSE_MCHECK
bool "Verbose Machine Checks" bool "Verbose Machine Checks"
source "drivers/pci/Kconfig" source "drivers/pci/Kconfig"
source "drivers/eisa/Kconfig"
config HOTPLUG config HOTPLUG
bool "Support for hot-pluggable devices" bool "Support for hot-pluggable devices"
......
...@@ -1181,6 +1181,8 @@ config EISA ...@@ -1181,6 +1181,8 @@ config EISA
Otherwise, say N. Otherwise, say N.
source "drivers/eisa/Kconfig"
config MCA config MCA
bool "MCA support" bool "MCA support"
depends on !(X86_VISWS || X86_VOYAGER) depends on !(X86_VISWS || X86_VOYAGER)
......
...@@ -44,3 +44,4 @@ obj-$(CONFIG_BT) += bluetooth/ ...@@ -44,3 +44,4 @@ obj-$(CONFIG_BT) += bluetooth/
obj-$(CONFIG_HOTPLUG_PCI) += hotplug/ obj-$(CONFIG_HOTPLUG_PCI) += hotplug/
obj-$(CONFIG_ISDN_BOOL) += isdn/ obj-$(CONFIG_ISDN_BOOL) += isdn/
obj-$(CONFIG_MCA) += mca/ obj-$(CONFIG_MCA) += mca/
obj-$(CONFIG_EISA) += eisa/
#
# PCI configuration
#
config EISA_NAMES
bool "EISA device name database"
depends on EISA
default y
---help---
By default, the kernel contains a database of all known EISA
device names to make the information in sysfs comprehensible
to the user. This database increases size of the kernel
image by about 40KB, but it gets freed after the system
boots up, so it doesn't take up kernel memory. Anyway, if
you are building an installation floppy or kernel for an
embedded system where kernel image size really matters, you
can disable this feature and you'll get device ID instead of
names.
When in doubt, say Y.
# Makefile for the Linux device tree
obj-$(CONFIG_EISA) += eisa-bus.o
export-objs := eisa-bus.o
clean-files:= devlist.h
# Ugly hack to get DEVICE_NAME_SIZE value...
DEVICE_NAME_SIZE:=$(shell awk '$$1=="\#define" && $$2=="DEVICE_NAME_SIZE" {print $$3-1}' $(srctree)/include/linux/device.h)
$(obj)/eisa-bus.o: $(obj)/devlist.h
$(obj)/devlist.h: $(src)/eisa.ids $(srctree)/include/linux/device.h
sed -e '/^#/D' -e 's/^\([[:alnum:]]\{7\}\) \+"\([^"]\{1,$(DEVICE_NAME_SIZE)\}\).*"/EISA_DEVINFO ("\1", "\2"),/' $< > $@
$(src)/eisa.ids:
touch $@
/*
* EISA bus support functions for sysfs.
*
* (C) 2002 Marc Zyngier <maz@wild-wind.fr.eu.org>
*
* This code is released under the GPL version 2.
*/
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/eisa.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <asm/io.h>
#define EISA_DEVINFO(i,s) { .id = { .sig = i }, .name = s }
struct eisa_device_info {
struct eisa_device_id id;
char name[DEVICE_NAME_SIZE];
};
struct eisa_device_info __initdata eisa_table[] = {
#ifdef CONFIG_EISA_NAMES
#include "devlist.h"
#endif
};
#define EISA_INFOS (sizeof (eisa_table) / (sizeof (struct eisa_device_info)))
static void __init eisa_name_device (struct eisa_device *edev)
{
int i;
for (i = 0; i < EISA_INFOS; i++) {
if (!strcmp (edev->id.sig, eisa_table[i].id.sig)) {
strncpy (edev->dev.name,
eisa_table[i].name,
DEVICE_NAME_SIZE - 1);
return;
}
}
/* No name was found */
sprintf (edev->dev.name, "EISA device %.7s", edev->id.sig);
}
static char __init *decode_eisa_sig(unsigned long addr)
{
static char sig_str[EISA_SIG_LEN];
u8 sig[4];
u16 rev;
int i;
sig[0] = inb (addr);
if (sig[0] & 0x80)
return NULL;
for (i = 1; i < 4; i++)
sig[i] = inb (addr + i);
sig_str[0] = ((sig[0] >> 2) & 0x1f) + ('A' - 1);
sig_str[1] = (((sig[0] & 3) << 3) | (sig[1] >> 5)) + ('A' - 1);
sig_str[2] = (sig[1] & 0x1f) + ('A' - 1);
rev = (sig[2] << 8) | sig[3];
sprintf(sig_str + 3, "%04X", rev);
return sig_str;
}
static int eisa_bus_match (struct device *dev, struct device_driver *drv)
{
struct eisa_device *edev = to_eisa_device (dev);
struct eisa_driver *edrv = to_eisa_driver (drv);
const struct eisa_device_id *eids = edrv->id_table;
if (!eids)
return 0;
while (strlen (eids->sig)) {
if (!strcmp (eids->sig, edev->id.sig))
return 1;
eids++;
}
return 0;
}
struct bus_type eisa_bus_type = {
.name = "eisa",
.match = eisa_bus_match,
};
/* The default EISA device parent (virtual root device). */
static struct device eisa_bus_root = {
.name = "EISA Bridge",
.bus_id = "eisa",
};
int eisa_driver_register (struct eisa_driver *edrv)
{
int r;
edrv->driver.bus = &eisa_bus_type;
if ((r = driver_register (&edrv->driver)) < 0)
return r;
return 1;
}
void eisa_driver_unregister (struct eisa_driver *edrv)
{
driver_unregister (&edrv->driver);
}
static ssize_t eisa_show_sig (struct device *dev, char *buf)
{
struct eisa_device *edev = to_eisa_device (dev);
return sprintf (buf,"%s\n", edev->id.sig);
}
static DEVICE_ATTR(signature, S_IRUGO, eisa_show_sig, NULL);
static void __init eisa_register_device (char *sig, int slot)
{
struct eisa_device *edev;
if (!(edev = kmalloc (sizeof (*edev), GFP_KERNEL)))
return;
memset (edev, 0, sizeof (*edev));
memcpy (edev->id.sig, sig, 7);
edev->slot = slot;
edev->base_addr = 0x1000 * slot;
eisa_name_device (edev);
edev->dev.parent = &eisa_bus_root;
edev->dev.bus = &eisa_bus_type;
sprintf (edev->dev.bus_id, "00:%02X", slot);
/* Don't register resource for slot 0, since this will surely
* fail... :-( */
if (slot) {
edev->res.name = edev->dev.name;
edev->res.start = edev->base_addr;
edev->res.end = edev->res.start + 0xfff;
edev->res.flags = IORESOURCE_IO;
if (request_resource (&ioport_resource, &edev->res)) {
printk (KERN_WARNING \
"Cannot allocate resource for EISA slot %d\n",
slot);
kfree (edev);
return;
}
}
if (device_register (&edev->dev)) {
kfree (edev);
return;
}
device_create_file (&edev->dev, &dev_attr_signature);
}
static int __init eisa_probe (void)
{
int i, c;
char *str;
unsigned long slot_addr;
printk (KERN_INFO "EISA: Probing bus...\n");
for (c = 0, i = 0; i <= EISA_MAX_SLOTS; i++) {
slot_addr = (0x1000 * i) + EISA_VENDOR_ID_OFFSET;
if ((str = decode_eisa_sig (slot_addr))) {
if (!i)
printk (KERN_INFO "EISA: Motherboard %s detected\n",
str);
else {
printk (KERN_INFO "EISA: slot %d : %s detected.\n",
i, str);
c++;
}
eisa_register_device (str, i);
}
}
printk (KERN_INFO "EISA: Detected %d card%s.\n", c, c < 2 ? "" : "s");
return 0;
}
static int __init eisa_init (void)
{
int r;
if ((r = bus_register (&eisa_bus_type)))
return r;
if ((r = device_register (&eisa_bus_root))) {
bus_unregister (&eisa_bus_type);
return r;
}
printk (KERN_INFO "EISA bus registered\n");
return eisa_probe ();
}
postcore_initcall (eisa_init);
EXPORT_SYMBOL (eisa_bus_type);
EXPORT_SYMBOL (eisa_driver_register);
EXPORT_SYMBOL (eisa_driver_unregister);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -55,7 +55,6 @@ extern int hp_probe(struct net_device *dev); ...@@ -55,7 +55,6 @@ extern int hp_probe(struct net_device *dev);
extern int hp_plus_probe(struct net_device *dev); extern int hp_plus_probe(struct net_device *dev);
extern int express_probe(struct net_device *); extern int express_probe(struct net_device *);
extern int eepro_probe(struct net_device *); extern int eepro_probe(struct net_device *);
extern int el3_probe(struct net_device *);
extern int at1500_probe(struct net_device *); extern int at1500_probe(struct net_device *);
extern int at1700_probe(struct net_device *); extern int at1700_probe(struct net_device *);
extern int fmv18x_probe(struct net_device *); extern int fmv18x_probe(struct net_device *);
...@@ -210,9 +209,6 @@ static struct devprobe mca_probes[] __initdata = { ...@@ -210,9 +209,6 @@ static struct devprobe mca_probes[] __initdata = {
* look for EISA/PCI/MCA cards in addition to ISA cards). * look for EISA/PCI/MCA cards in addition to ISA cards).
*/ */
static struct devprobe isa_probes[] __initdata = { static struct devprobe isa_probes[] __initdata = {
#ifdef CONFIG_EL3 /* ISA, EISA, MCA 3c5x9 */
{el3_probe, 0},
#endif
#ifdef CONFIG_HP100 /* ISA, EISA & PCI */ #ifdef CONFIG_HP100 /* ISA, EISA & PCI */
{hp100_probe, 0}, {hp100_probe, 0},
#endif #endif
......
...@@ -54,6 +54,8 @@ config EISA ...@@ -54,6 +54,8 @@ config EISA
supports both the Mongoose & Wax EISA adapters. It is sadly supports both the Mongoose & Wax EISA adapters. It is sadly
incomplete and lacks support for card-to-host DMA. incomplete and lacks support for card-to-host DMA.
source "drivers/eisa/Kconfig"
config ISA config ISA
bool bool
depends on EISA depends on EISA
......
#ifndef _LINUX_EISA_H
#define _LINUX_EISA_H
#define EISA_SIG_LEN 8
#define EISA_MAX_SLOTS 8
/* A few EISA constants/offsets... */
#define EISA_DMA1_STATUS 8
#define EISA_INT1_CTRL 0x20
#define EISA_INT1_MASK 0x21
#define EISA_INT2_CTRL 0xA0
#define EISA_INT2_MASK 0xA1
#define EISA_DMA2_STATUS 0xD0
#define EISA_DMA2_WRITE_SINGLE 0xD4
#define EISA_EXT_NMI_RESET_CTRL 0x461
#define EISA_INT1_EDGE_LEVEL 0x4D0
#define EISA_INT2_EDGE_LEVEL 0x4D1
#define EISA_VENDOR_ID_OFFSET 0xC80
/* The EISA signature, in ASCII form, null terminated */
struct eisa_device_id {
char sig[EISA_SIG_LEN];
};
/* There is not much we can say about an EISA device, apart from
* signature, slot number, and base address */
struct eisa_device {
struct eisa_device_id id;
int slot;
unsigned long base_addr;
struct resource res;
struct device dev; /* generic device */
};
#define to_eisa_device(n) container_of(n, struct eisa_device, dev)
struct eisa_driver {
const struct eisa_device_id *id_table;
struct device_driver driver;
};
#define to_eisa_driver(drv) container_of(drv,struct eisa_driver, driver)
extern struct bus_type eisa_bus_type;
int eisa_driver_register (struct eisa_driver *edrv);
void eisa_driver_unregister (struct eisa_driver *edrv);
/* Mimics pci.h... */
static inline void *eisa_get_drvdata (struct eisa_device *edev)
{
return edev->dev.driver_data;
}
static inline void eisa_set_drvdata (struct eisa_device *edev, void *data)
{
edev->dev.driver_data = data;
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment