mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-09-08 01:08:03 -04:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
56
drivers/eisa/Kconfig
Normal file
56
drivers/eisa/Kconfig
Normal file
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# EISA configuration
|
||||
#
|
||||
config EISA_VLB_PRIMING
|
||||
bool "Vesa Local Bus priming"
|
||||
depends on X86 && EISA
|
||||
default n
|
||||
---help---
|
||||
Activate this option if your system contains a Vesa Local
|
||||
Bus (VLB) card that identify itself as an EISA card (such as
|
||||
the Adaptec AHA-284x).
|
||||
|
||||
When in doubt, say N.
|
||||
|
||||
config EISA_PCI_EISA
|
||||
bool "Generic PCI/EISA bridge"
|
||||
depends on !PARISC && PCI && EISA
|
||||
default y
|
||||
---help---
|
||||
Activate this option if your system contains a PCI to EISA
|
||||
bridge. If your system have both PCI and EISA slots, you
|
||||
certainly need this option.
|
||||
|
||||
When in doubt, say Y.
|
||||
|
||||
# Using EISA_VIRTUAL_ROOT on something other than an Alpha or
|
||||
# an X86 may lead to crashes...
|
||||
|
||||
config EISA_VIRTUAL_ROOT
|
||||
bool "EISA virtual root device"
|
||||
depends on EISA && (ALPHA || X86)
|
||||
default y
|
||||
---help---
|
||||
Activate this option if your system only have EISA bus
|
||||
(no PCI slots). The Alpha Jensen is an example of such
|
||||
a system.
|
||||
|
||||
When in doubt, say Y.
|
||||
|
||||
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.
|
||||
|
21
drivers/eisa/Makefile
Normal file
21
drivers/eisa/Makefile
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Makefile for the Linux device tree
|
||||
|
||||
obj-$(CONFIG_EISA) += eisa-bus.o
|
||||
obj-${CONFIG_EISA_PCI_EISA} += pci_eisa.o
|
||||
|
||||
# virtual_root.o should be the last EISA root device to initialize,
|
||||
# so leave it at the end of the list.
|
||||
obj-${CONFIG_EISA_VIRTUAL_ROOT} += virtual_root.o
|
||||
|
||||
|
||||
# Ugly hack to get DEVICE_NAME_SIZE value...
|
||||
DEVICE_NAME_SIZE = 50
|
||||
|
||||
$(obj)/eisa-bus.o: $(obj)/devlist.h
|
||||
|
||||
quiet_cmd_eisaid = GEN $@
|
||||
cmd_eisaid = sed -e '/^\#/D' -e 's/^\([[:alnum:]]\{7\}\) \+"\([^"]\{1,$(DEVICE_NAME_SIZE)\}\).*"/EISA_DEVINFO ("\1", "\2"),/' $< > $@
|
||||
|
||||
clean-files := devlist.h
|
||||
$(obj)/devlist.h: $(src)/eisa.ids include/linux/device.h
|
||||
$(call cmd,eisaid)
|
462
drivers/eisa/eisa-bus.c
Normal file
462
drivers/eisa/eisa-bus.c
Normal file
|
@ -0,0 +1,462 @@
|
|||
/*
|
||||
* EISA bus support functions for sysfs.
|
||||
*
|
||||
* (C) 2002, 2003 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/moduleparam.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define SLOT_ADDRESS(r,n) (r->bus_base_addr + (0x1000 * n))
|
||||
|
||||
#define EISA_DEVINFO(i,s) { .id = { .sig = i }, .name = s }
|
||||
|
||||
struct eisa_device_info {
|
||||
struct eisa_device_id id;
|
||||
char name[50];
|
||||
};
|
||||
|
||||
#ifdef CONFIG_EISA_NAMES
|
||||
static struct eisa_device_info __initdata eisa_table[] = {
|
||||
#include "devlist.h"
|
||||
};
|
||||
#define EISA_INFOS (sizeof (eisa_table) / (sizeof (struct eisa_device_info)))
|
||||
#endif
|
||||
|
||||
#define EISA_MAX_FORCED_DEV 16
|
||||
|
||||
static int enable_dev[EISA_MAX_FORCED_DEV];
|
||||
static unsigned int enable_dev_count;
|
||||
static int disable_dev[EISA_MAX_FORCED_DEV];
|
||||
static unsigned int disable_dev_count;
|
||||
|
||||
static int is_forced_dev(int *forced_tab,
|
||||
int forced_count,
|
||||
struct eisa_root_device *root,
|
||||
struct eisa_device *edev)
|
||||
{
|
||||
int i, x;
|
||||
|
||||
for (i = 0; i < forced_count; i++) {
|
||||
x = (root->bus_nr << 8) | edev->slot;
|
||||
if (forced_tab[i] == x)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __init eisa_name_device(struct eisa_device *edev)
|
||||
{
|
||||
#ifdef CONFIG_EISA_NAMES
|
||||
int i;
|
||||
for (i = 0; i < EISA_INFOS; i++) {
|
||||
if (!strcmp(edev->id.sig, eisa_table[i].id.sig)) {
|
||||
strlcpy(edev->pretty_name,
|
||||
eisa_table[i].name,
|
||||
sizeof(edev->pretty_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* No name was found */
|
||||
sprintf(edev->pretty_name, "EISA device %.7s", edev->id.sig);
|
||||
#endif
|
||||
}
|
||||
|
||||
static char __init *decode_eisa_sig(unsigned long addr)
|
||||
{
|
||||
static char sig_str[EISA_SIG_LEN];
|
||||
u8 sig[4];
|
||||
u16 rev;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
#ifdef CONFIG_EISA_VLB_PRIMING
|
||||
/*
|
||||
* This ugly stuff is used to wake up VL-bus cards
|
||||
* (AHA-284x is the only known example), so we can
|
||||
* read the EISA id.
|
||||
*
|
||||
* Thankfully, this only exists on x86...
|
||||
*/
|
||||
outb(0x80 + i, addr);
|
||||
#endif
|
||||
sig[i] = inb(addr + i);
|
||||
|
||||
if (!i && (sig[0] & 0x80))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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) &&
|
||||
edev->state & EISA_CONFIG_ENABLED) {
|
||||
edev->id.driver_data = eids->driver_data;
|
||||
return 1;
|
||||
}
|
||||
|
||||
eids++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int eisa_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
struct eisa_device *edev = to_eisa_device(dev);
|
||||
|
||||
add_uevent_var(env, "MODALIAS=" EISA_DEVICE_MODALIAS_FMT, edev->id.sig);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct bus_type eisa_bus_type = {
|
||||
.name = "eisa",
|
||||
.match = eisa_bus_match,
|
||||
.uevent = eisa_bus_uevent,
|
||||
};
|
||||
EXPORT_SYMBOL(eisa_bus_type);
|
||||
|
||||
int eisa_driver_register(struct eisa_driver *edrv)
|
||||
{
|
||||
edrv->driver.bus = &eisa_bus_type;
|
||||
return driver_register(&edrv->driver);
|
||||
}
|
||||
EXPORT_SYMBOL(eisa_driver_register);
|
||||
|
||||
void eisa_driver_unregister(struct eisa_driver *edrv)
|
||||
{
|
||||
driver_unregister(&edrv->driver);
|
||||
}
|
||||
EXPORT_SYMBOL(eisa_driver_unregister);
|
||||
|
||||
static ssize_t eisa_show_sig(struct device *dev, struct device_attribute *attr,
|
||||
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 ssize_t eisa_show_state(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct eisa_device *edev = to_eisa_device(dev);
|
||||
return sprintf(buf, "%d\n", edev->state & EISA_CONFIG_ENABLED);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(enabled, S_IRUGO, eisa_show_state, NULL);
|
||||
|
||||
static ssize_t eisa_show_modalias(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct eisa_device *edev = to_eisa_device(dev);
|
||||
return sprintf(buf, EISA_DEVICE_MODALIAS_FMT "\n", edev->id.sig);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(modalias, S_IRUGO, eisa_show_modalias, NULL);
|
||||
|
||||
static int __init eisa_init_device(struct eisa_root_device *root,
|
||||
struct eisa_device *edev,
|
||||
int slot)
|
||||
{
|
||||
char *sig;
|
||||
unsigned long sig_addr;
|
||||
int i;
|
||||
|
||||
sig_addr = SLOT_ADDRESS(root, slot) + EISA_VENDOR_ID_OFFSET;
|
||||
|
||||
sig = decode_eisa_sig(sig_addr);
|
||||
if (!sig)
|
||||
return -1; /* No EISA device here */
|
||||
|
||||
memcpy(edev->id.sig, sig, EISA_SIG_LEN);
|
||||
edev->slot = slot;
|
||||
edev->state = inb(SLOT_ADDRESS(root, slot) + EISA_CONFIG_OFFSET)
|
||||
& EISA_CONFIG_ENABLED;
|
||||
edev->base_addr = SLOT_ADDRESS(root, slot);
|
||||
edev->dma_mask = root->dma_mask; /* Default DMA mask */
|
||||
eisa_name_device(edev);
|
||||
edev->dev.parent = root->dev;
|
||||
edev->dev.bus = &eisa_bus_type;
|
||||
edev->dev.dma_mask = &edev->dma_mask;
|
||||
edev->dev.coherent_dma_mask = edev->dma_mask;
|
||||
dev_set_name(&edev->dev, "%02X:%02X", root->bus_nr, slot);
|
||||
|
||||
for (i = 0; i < EISA_MAX_RESOURCES; i++) {
|
||||
#ifdef CONFIG_EISA_NAMES
|
||||
edev->res[i].name = edev->pretty_name;
|
||||
#else
|
||||
edev->res[i].name = edev->id.sig;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (is_forced_dev(enable_dev, enable_dev_count, root, edev))
|
||||
edev->state = EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED;
|
||||
|
||||
if (is_forced_dev(disable_dev, disable_dev_count, root, edev))
|
||||
edev->state = EISA_CONFIG_FORCED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init eisa_register_device(struct eisa_device *edev)
|
||||
{
|
||||
int rc = device_register(&edev->dev);
|
||||
if (rc) {
|
||||
put_device(&edev->dev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = device_create_file(&edev->dev, &dev_attr_signature);
|
||||
if (rc)
|
||||
goto err_devreg;
|
||||
rc = device_create_file(&edev->dev, &dev_attr_enabled);
|
||||
if (rc)
|
||||
goto err_sig;
|
||||
rc = device_create_file(&edev->dev, &dev_attr_modalias);
|
||||
if (rc)
|
||||
goto err_enab;
|
||||
|
||||
return 0;
|
||||
|
||||
err_enab:
|
||||
device_remove_file(&edev->dev, &dev_attr_enabled);
|
||||
err_sig:
|
||||
device_remove_file(&edev->dev, &dev_attr_signature);
|
||||
err_devreg:
|
||||
device_unregister(&edev->dev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __init eisa_request_resources(struct eisa_root_device *root,
|
||||
struct eisa_device *edev,
|
||||
int slot)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < EISA_MAX_RESOURCES; i++) {
|
||||
/* Don't register resource for slot 0, since this is
|
||||
* very likely to fail... :-( Instead, grab the EISA
|
||||
* id, now we can display something in /proc/ioports.
|
||||
*/
|
||||
|
||||
/* Only one region for mainboard */
|
||||
if (!slot && i > 0) {
|
||||
edev->res[i].start = edev->res[i].end = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (slot) {
|
||||
edev->res[i].name = NULL;
|
||||
edev->res[i].start = SLOT_ADDRESS(root, slot)
|
||||
+ (i * 0x400);
|
||||
edev->res[i].end = edev->res[i].start + 0xff;
|
||||
edev->res[i].flags = IORESOURCE_IO;
|
||||
} else {
|
||||
edev->res[i].name = NULL;
|
||||
edev->res[i].start = SLOT_ADDRESS(root, slot)
|
||||
+ EISA_VENDOR_ID_OFFSET;
|
||||
edev->res[i].end = edev->res[i].start + 3;
|
||||
edev->res[i].flags = IORESOURCE_IO | IORESOURCE_BUSY;
|
||||
}
|
||||
|
||||
if (request_resource(root->res, &edev->res[i]))
|
||||
goto failed;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
while (--i >= 0)
|
||||
release_resource(&edev->res[i]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void __init eisa_release_resources(struct eisa_device *edev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < EISA_MAX_RESOURCES; i++)
|
||||
if (edev->res[i].start || edev->res[i].end)
|
||||
release_resource(&edev->res[i]);
|
||||
}
|
||||
|
||||
static int __init eisa_probe(struct eisa_root_device *root)
|
||||
{
|
||||
int i, c;
|
||||
struct eisa_device *edev;
|
||||
char *enabled_str;
|
||||
|
||||
dev_info(root->dev, "Probing EISA bus %d\n", root->bus_nr);
|
||||
|
||||
/* First try to get hold of slot 0. If there is no device
|
||||
* here, simply fail, unless root->force_probe is set. */
|
||||
|
||||
edev = kzalloc(sizeof(*edev), GFP_KERNEL);
|
||||
if (!edev) {
|
||||
dev_err(root->dev, "EISA: Couldn't allocate mainboard slot\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (eisa_request_resources(root, edev, 0)) {
|
||||
dev_warn(root->dev,
|
||||
"EISA: Cannot allocate resource for mainboard\n");
|
||||
kfree(edev);
|
||||
if (!root->force_probe)
|
||||
return -EBUSY;
|
||||
goto force_probe;
|
||||
}
|
||||
|
||||
if (eisa_init_device(root, edev, 0)) {
|
||||
eisa_release_resources(edev);
|
||||
kfree(edev);
|
||||
if (!root->force_probe)
|
||||
return -ENODEV;
|
||||
goto force_probe;
|
||||
}
|
||||
|
||||
dev_info(&edev->dev, "EISA: Mainboard %s detected\n", edev->id.sig);
|
||||
|
||||
if (eisa_register_device(edev)) {
|
||||
dev_err(&edev->dev, "EISA: Failed to register %s\n",
|
||||
edev->id.sig);
|
||||
eisa_release_resources(edev);
|
||||
kfree(edev);
|
||||
}
|
||||
|
||||
force_probe:
|
||||
|
||||
for (c = 0, i = 1; i <= root->slots; i++) {
|
||||
edev = kzalloc(sizeof(*edev), GFP_KERNEL);
|
||||
if (!edev) {
|
||||
dev_err(root->dev, "EISA: Out of memory for slot %d\n",
|
||||
i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eisa_request_resources(root, edev, i)) {
|
||||
dev_warn(root->dev,
|
||||
"Cannot allocate resource for EISA slot %d\n",
|
||||
i);
|
||||
kfree(edev);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eisa_init_device(root, edev, i)) {
|
||||
eisa_release_resources(edev);
|
||||
kfree(edev);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (edev->state == (EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED))
|
||||
enabled_str = " (forced enabled)";
|
||||
else if (edev->state == EISA_CONFIG_FORCED)
|
||||
enabled_str = " (forced disabled)";
|
||||
else if (edev->state == 0)
|
||||
enabled_str = " (disabled)";
|
||||
else
|
||||
enabled_str = "";
|
||||
|
||||
dev_info(&edev->dev, "EISA: slot %d: %s detected%s\n", i,
|
||||
edev->id.sig, enabled_str);
|
||||
|
||||
c++;
|
||||
|
||||
if (eisa_register_device(edev)) {
|
||||
dev_err(&edev->dev, "EISA: Failed to register %s\n",
|
||||
edev->id.sig);
|
||||
eisa_release_resources(edev);
|
||||
kfree(edev);
|
||||
}
|
||||
}
|
||||
|
||||
dev_info(root->dev, "EISA: Detected %d card%s\n", c, c == 1 ? "" : "s");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct resource eisa_root_res = {
|
||||
.name = "EISA root resource",
|
||||
.start = 0,
|
||||
.end = 0xffffffff,
|
||||
.flags = IORESOURCE_IO,
|
||||
};
|
||||
|
||||
static int eisa_bus_count;
|
||||
|
||||
int __init eisa_root_register(struct eisa_root_device *root)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Use our own resources to check if this bus base address has
|
||||
* been already registered. This prevents the virtual root
|
||||
* device from registering after the real one has, for
|
||||
* example... */
|
||||
|
||||
root->eisa_root_res.name = eisa_root_res.name;
|
||||
root->eisa_root_res.start = root->res->start;
|
||||
root->eisa_root_res.end = root->res->end;
|
||||
root->eisa_root_res.flags = IORESOURCE_BUSY;
|
||||
|
||||
err = request_resource(&eisa_root_res, &root->eisa_root_res);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
root->bus_nr = eisa_bus_count++;
|
||||
|
||||
err = eisa_probe(root);
|
||||
if (err)
|
||||
release_resource(&root->eisa_root_res);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int __init eisa_init(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = bus_register(&eisa_bus_type);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
printk(KERN_INFO "EISA bus registered\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_param_array(enable_dev, int, &enable_dev_count, 0444);
|
||||
module_param_array(disable_dev, int, &disable_dev_count, 0444);
|
||||
|
||||
postcore_initcall(eisa_init);
|
||||
|
||||
int EISA_bus; /* for legacy drivers */
|
||||
EXPORT_SYMBOL(EISA_bus);
|
1283
drivers/eisa/eisa.ids
Normal file
1283
drivers/eisa/eisa.ids
Normal file
File diff suppressed because it is too large
Load diff
90
drivers/eisa/pci_eisa.c
Normal file
90
drivers/eisa/pci_eisa.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Minimalist driver for a generic PCI-to-EISA bridge.
|
||||
*
|
||||
* (C) 2003 Marc Zyngier <maz@wild-wind.fr.eu.org>
|
||||
*
|
||||
* This code is released under the GPL version 2.
|
||||
*
|
||||
* Ivan Kokshaysky <ink@jurassic.park.msu.ru> :
|
||||
* Generalisation from i82375 to PCI_CLASS_BRIDGE_EISA.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/eisa.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
/* There is only *one* pci_eisa device per machine, right ? */
|
||||
static struct eisa_root_device pci_eisa_root;
|
||||
|
||||
static int __init pci_eisa_init(struct pci_dev *pdev)
|
||||
{
|
||||
int rc, i;
|
||||
struct resource *res, *bus_res = NULL;
|
||||
|
||||
if ((rc = pci_enable_device (pdev))) {
|
||||
dev_err(&pdev->dev, "Could not enable device\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI
|
||||
* device, so the resources available on EISA are the same as those
|
||||
* available on the 82375 bus. This works the same as a PCI-PCI
|
||||
* bridge in subtractive-decode mode (see pci_read_bridge_bases()).
|
||||
* We assume other PCI-EISA bridges are similar.
|
||||
*
|
||||
* eisa_root_register() can only deal with a single io port resource,
|
||||
* so we use the first valid io port resource.
|
||||
*/
|
||||
pci_bus_for_each_resource(pdev->bus, res, i)
|
||||
if (res && (res->flags & IORESOURCE_IO)) {
|
||||
bus_res = res;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bus_res) {
|
||||
dev_err(&pdev->dev, "No resources available\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pci_eisa_root.dev = &pdev->dev;
|
||||
pci_eisa_root.res = bus_res;
|
||||
pci_eisa_root.bus_base_addr = bus_res->start;
|
||||
pci_eisa_root.slots = EISA_MAX_SLOTS;
|
||||
pci_eisa_root.dma_mask = pdev->dma_mask;
|
||||
dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
|
||||
|
||||
if (eisa_root_register (&pci_eisa_root)) {
|
||||
dev_err(&pdev->dev, "Could not register EISA root\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init().
|
||||
* Otherwise pnp resource will get enabled early and could prevent eisa
|
||||
* to be initialized.
|
||||
* Also need to make sure pci_eisa_init_early() is called after
|
||||
* x86/pci_subsys_init().
|
||||
* So need to use subsys_initcall_sync with it.
|
||||
*/
|
||||
static int __init pci_eisa_init_early(void)
|
||||
{
|
||||
struct pci_dev *dev = NULL;
|
||||
int ret;
|
||||
|
||||
for_each_pci_dev(dev)
|
||||
if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) {
|
||||
ret = pci_eisa_init(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
subsys_initcall_sync(pci_eisa_init_early);
|
74
drivers/eisa/virtual_root.c
Normal file
74
drivers/eisa/virtual_root.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Virtual EISA root driver.
|
||||
* Acts as a placeholder if we don't have a proper EISA bridge.
|
||||
*
|
||||
* (C) 2003 Marc Zyngier <maz@wild-wind.fr.eu.org>
|
||||
*
|
||||
* This code is released under the GPL version 2.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/eisa.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#if defined(CONFIG_ALPHA_JENSEN) || defined(CONFIG_EISA_VLB_PRIMING)
|
||||
#define EISA_FORCE_PROBE_DEFAULT 1
|
||||
#else
|
||||
#define EISA_FORCE_PROBE_DEFAULT 0
|
||||
#endif
|
||||
|
||||
static int force_probe = EISA_FORCE_PROBE_DEFAULT;
|
||||
static void virtual_eisa_release (struct device *);
|
||||
|
||||
/* The default EISA device parent (virtual root device).
|
||||
* Now use a platform device, since that's the obvious choice. */
|
||||
|
||||
static struct platform_device eisa_root_dev = {
|
||||
.name = "eisa",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.release = virtual_eisa_release,
|
||||
},
|
||||
};
|
||||
|
||||
static struct eisa_root_device eisa_bus_root = {
|
||||
.dev = &eisa_root_dev.dev,
|
||||
.bus_base_addr = 0,
|
||||
.res = &ioport_resource,
|
||||
.slots = EISA_MAX_SLOTS,
|
||||
.dma_mask = 0xffffffff,
|
||||
};
|
||||
|
||||
static void virtual_eisa_release (struct device *dev)
|
||||
{
|
||||
/* nothing really to do here */
|
||||
}
|
||||
|
||||
static int __init virtual_eisa_root_init (void)
|
||||
{
|
||||
int r;
|
||||
|
||||
if ((r = platform_device_register (&eisa_root_dev))) {
|
||||
return r;
|
||||
}
|
||||
|
||||
eisa_bus_root.force_probe = force_probe;
|
||||
|
||||
dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root);
|
||||
|
||||
if (eisa_root_register (&eisa_bus_root)) {
|
||||
/* A real bridge may have been registered before
|
||||
* us. So quietly unregister. */
|
||||
platform_device_unregister (&eisa_root_dev);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_param (force_probe, int, 0444);
|
||||
|
||||
device_initcall (virtual_eisa_root_init);
|
Loading…
Add table
Add a link
Reference in a new issue