3 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/init.h>
21 #include <linux/pci.h>
22 #include <linux/proc_fs.h>
23 #include <linux/bootmem.h>
25 #include <linux/rbtree.h>
26 #include <linux/spinlock.h>
27 #include <linux/seq_file.h>
29 #include <asm/processor.h>
32 #include <asm/machdep.h>
33 #include <asm/pgtable.h>
38 #define BUID_HI(buid) ((buid) >> 32)
39 #define BUID_LO(buid) ((buid) & 0xffffffff)
40 #define CONFIG_ADDR(busno, devfn) \
41 (((((busno) & 0xff) << 8) | ((devfn) & 0xf8)) << 8)
44 static int ibm_set_eeh_option;
45 static int ibm_set_slot_reset;
46 static int ibm_read_slot_reset_state;
48 static int eeh_subsystem_enabled;
49 #define EEH_MAX_OPTS 4096
50 static char *eeh_opts;
51 static int eeh_opts_last;
53 /* System monitoring statistics */
54 static DEFINE_PER_CPU(unsigned long, total_mmio_ffs);
55 static DEFINE_PER_CPU(unsigned long, false_positives);
56 static DEFINE_PER_CPU(unsigned long, ignored_failures);
58 static int eeh_check_opts_config(struct device_node *dn, int class_code,
59 int vendor_id, int device_id,
63 * The pci address cache subsystem. This subsystem places
64 * PCI device address resources into a red-black tree, sorted
65 * according to the address range, so that given only an i/o
66 * address, the corresponding PCI device can be **quickly**
69 * Currently, the only customer of this code is the EEH subsystem;
70 * thus, this code has been somewhat tailored to suit EEH better.
71 * In particular, the cache does *not* hold the addresses of devices
72 * for which EEH is not enabled.
74 * (Implementation Note: The RB tree seems to be better/faster
75 * than any hash algo I could think of for this problem, even
76 * with the penalty of slow pointer chases for d-cache misses).
78 struct pci_io_addr_range
80 struct rb_node rb_node;
81 unsigned long addr_lo;
82 unsigned long addr_hi;
83 struct pci_dev *pcidev;
87 static struct pci_io_addr_cache
89 struct rb_root rb_root;
91 } pci_io_addr_cache_root;
93 static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr)
95 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node;
98 struct pci_io_addr_range *piar;
99 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
101 if (addr < piar->addr_lo) {
104 if (addr > piar->addr_hi) {
107 pci_dev_get(piar->pcidev);
117 * pci_get_device_by_addr - Get device, given only address
118 * @addr: mmio (PIO) phys address or i/o port number
120 * Given an mmio phys address, or a port number, find a pci device
121 * that implements this address. Be sure to pci_dev_put the device
122 * when finished. I/O port numbers are assumed to be offset
123 * from zero (that is, they do *not* have pci_io_addr added in).
124 * It is safe to call this function within an interrupt.
126 static struct pci_dev *pci_get_device_by_addr(unsigned long addr)
131 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
132 dev = __pci_get_device_by_addr(addr);
133 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
139 * Handy-dandy debug print routine, does nothing more
140 * than print out the contents of our addr cache.
142 static void pci_addr_cache_print(struct pci_io_addr_cache *cache)
147 n = rb_first(&cache->rb_root);
149 struct pci_io_addr_range *piar;
150 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
151 printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s %s\n",
152 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt,
153 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev),
154 pci_pretty_name(piar->pcidev));
161 /* Insert address range into the rb tree. */
162 static struct pci_io_addr_range *
163 pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
164 unsigned long ahi, unsigned int flags)
166 struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node;
167 struct rb_node *parent = NULL;
168 struct pci_io_addr_range *piar;
170 /* Walk tree, find a place to insert into tree */
173 piar = rb_entry(parent, struct pci_io_addr_range, rb_node);
174 if (alo < piar->addr_lo) {
175 p = &parent->rb_left;
176 } else if (ahi > piar->addr_hi) {
177 p = &parent->rb_right;
179 if (dev != piar->pcidev ||
180 alo != piar->addr_lo || ahi != piar->addr_hi) {
181 printk(KERN_WARNING "PIAR: overlapping address range\n");
186 piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
195 rb_link_node(&piar->rb_node, parent, p);
196 rb_insert_color(&piar->rb_node, &pci_io_addr_cache_root.rb_root);
201 static void __pci_addr_cache_insert_device(struct pci_dev *dev)
203 struct device_node *dn;
206 dn = pci_device_to_OF_node(dev);
208 printk(KERN_WARNING "PCI: no pci dn found for dev=%s %s\n",
209 pci_name(dev), pci_pretty_name(dev));
214 /* Skip any devices for which EEH is not enabled. */
215 if (!(dn->eeh_mode & EEH_MODE_SUPPORTED) ||
216 dn->eeh_mode & EEH_MODE_NOCHECK) {
218 printk(KERN_INFO "PCI: skip building address cache for=%s %s\n",
219 pci_name(dev), pci_pretty_name(dev));
225 /* Walk resources on this device, poke them into the tree */
226 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
227 unsigned long start = pci_resource_start(dev,i);
228 unsigned long end = pci_resource_end(dev,i);
229 unsigned int flags = pci_resource_flags(dev,i);
231 /* We are interested only bus addresses, not dma or other stuff */
232 if (0 == (flags & (IORESOURCE_IO | IORESOURCE_MEM)))
234 if (start == 0 || ~start == 0 || end == 0 || ~end == 0)
236 pci_addr_cache_insert(dev, start, end, flags);
241 * pci_addr_cache_insert_device - Add a device to the address cache
242 * @dev: PCI device whose I/O addresses we are interested in.
244 * In order to support the fast lookup of devices based on addresses,
245 * we maintain a cache of devices that can be quickly searched.
246 * This routine adds a device to that cache.
248 void pci_addr_cache_insert_device(struct pci_dev *dev)
252 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
253 __pci_addr_cache_insert_device(dev);
254 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
257 static inline void __pci_addr_cache_remove_device(struct pci_dev *dev)
262 n = rb_first(&pci_io_addr_cache_root.rb_root);
264 struct pci_io_addr_range *piar;
265 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
267 if (piar->pcidev == dev) {
268 rb_erase(n, &pci_io_addr_cache_root.rb_root);
278 * pci_addr_cache_remove_device - remove pci device from addr cache
279 * @dev: device to remove
281 * Remove a device from the addr-cache tree.
282 * This is potentially expensive, since it will walk
283 * the tree multiple times (once per resource).
284 * But so what; device removal doesn't need to be that fast.
286 void pci_addr_cache_remove_device(struct pci_dev *dev)
290 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
291 __pci_addr_cache_remove_device(dev);
292 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
296 * pci_addr_cache_build - Build a cache of I/O addresses
298 * Build a cache of pci i/o addresses. This cache will be used to
299 * find the pci device that corresponds to a given address.
300 * This routine scans all pci busses to build the cache.
301 * Must be run late in boot process, after the pci controllers
302 * have been scaned for devices (after all device resources are known).
304 void __init pci_addr_cache_build(void)
306 struct pci_dev *dev = NULL;
308 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
310 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
311 /* Ignore PCI bridges ( XXX why ??) */
312 if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) {
316 pci_addr_cache_insert_device(dev);
320 /* Verify tree built up above, echo back the list of addrs. */
321 pci_addr_cache_print(&pci_io_addr_cache_root);
326 * eeh_token_to_phys - convert EEH address token to phys address
327 * @token i/o token, should be address in the form 0xA....
329 * Converts EEH address tokens into physical addresses. Note that
330 * ths routine does *not* convert I/O BAR addresses (which start
331 * with 0xE...) to phys addresses!
333 static unsigned long eeh_token_to_phys(unsigned long token)
336 unsigned long pa, vaddr;
338 if (REGION_ID(token) == EEH_REGION_ID)
339 vaddr = IO_TOKEN_TO_ADDR(token);
343 ptep = find_linux_pte(ioremap_mm.pgd, vaddr);
344 pa = pte_pfn(*ptep) << PAGE_SHIFT;
346 return pa | (vaddr & (PAGE_SIZE-1));
350 * eeh_check_failure - check if all 1's data is due to EEH slot freeze
351 * @token i/o token, should be address in the form 0xA....
352 * @val value, should be all 1's (XXX why do we need this arg??)
354 * Check for an eeh failure at the given token address.
355 * The given value has been read and it should be 1's (0xff, 0xffff or
358 * Probe to determine if an error actually occurred. If not return val.
361 * Note this routine might be called in an interrupt context ...
363 unsigned long eeh_check_failure(void *token, unsigned long val)
367 struct device_node *dn;
368 unsigned long ret, rets[2];
369 static spinlock_t lock = SPIN_LOCK_UNLOCKED;
370 /* dont want this on the stack */
371 static unsigned char slot_err_buf[RTAS_ERROR_LOG_MAX];
374 __get_cpu_var(total_mmio_ffs)++;
376 if (!eeh_subsystem_enabled)
379 /* Finding the phys addr + pci device; this is pretty quick. */
380 addr = eeh_token_to_phys((unsigned long)token);
381 dev = pci_get_device_by_addr(addr);
385 dn = pci_device_to_OF_node(dev);
391 /* Access to IO BARs might get this far and still not want checking. */
392 if (!(dn->eeh_mode & EEH_MODE_SUPPORTED) ||
393 dn->eeh_mode & EEH_MODE_NOCHECK) {
398 /* Make sure we aren't ISA */
399 if (!strcmp(dn->type, "isa")) {
404 if (!dn->eeh_config_addr) {
410 * Now test for an EEH failure. This is VERY expensive.
411 * Note that the eeh_config_addr may be a parent device
412 * in the case of a device behind a bridge, or it may be
413 * function zero of a multi-function device.
414 * In any case they must share a common PHB.
416 ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets,
417 dn->eeh_config_addr, BUID_HI(dn->phb->buid),
418 BUID_LO(dn->phb->buid));
420 if (ret == 0 && rets[1] == 1 && rets[0] >= 2) {
421 unsigned long slot_err_ret;
423 spin_lock_irqsave(&lock, flags);
424 memset(slot_err_buf, 0, RTAS_ERROR_LOG_MAX);
425 slot_err_ret = rtas_call(rtas_token("ibm,slot-error-detail"),
426 8, 1, NULL, dn->eeh_config_addr,
427 BUID_HI(dn->phb->buid),
428 BUID_LO(dn->phb->buid), NULL, 0,
431 2 /* Permanent Error */);
433 if (slot_err_ret == 0)
434 log_error(slot_err_buf, ERR_TYPE_RTAS_LOG,
437 spin_unlock_irqrestore(&lock, flags);
440 * XXX We should create a separate sysctl for this.
442 * Since the panic_on_oops sysctl is used to halt
443 * the system in light of potential corruption, we
447 panic("EEH: MMIO failure (%ld) on device:%s %s\n",
448 rets[0], pci_name(dev), pci_pretty_name(dev));
450 __get_cpu_var(ignored_failures)++;
451 printk(KERN_INFO "EEH: MMIO failure (%ld) on device:%s %s\n",
452 rets[0], pci_name(dev), pci_pretty_name(dev));
455 __get_cpu_var(false_positives)++;
461 EXPORT_SYMBOL(eeh_check_failure);
463 struct eeh_early_enable_info {
464 unsigned int buid_hi;
465 unsigned int buid_lo;
468 /* Enable eeh for the given device node. */
469 static void *early_enable_eeh(struct device_node *dn, void *data)
471 struct eeh_early_enable_info *info = data;
473 char *status = get_property(dn, "status", 0);
474 u32 *class_code = (u32 *)get_property(dn, "class-code", 0);
475 u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", 0);
476 u32 *device_id = (u32 *)get_property(dn, "device-id", 0);
480 if (status && strcmp(status, "ok") != 0)
481 return NULL; /* ignore devices with bad status */
483 /* Weed out PHBs or other bad nodes. */
484 if (!class_code || !vendor_id || !device_id)
487 /* Ignore known PHBs and EADs bridges */
488 if (*vendor_id == PCI_VENDOR_ID_IBM &&
489 (*device_id == 0x0102 || *device_id == 0x008b ||
490 *device_id == 0x0188 || *device_id == 0x0302))
494 * Now decide if we are going to "Disable" EEH checking
495 * for this device. We still run with the EEH hardware active,
496 * but we won't be checking for ff's. This means a driver
497 * could return bad data (very bad!), an interrupt handler could
498 * hang waiting on status bits that won't change, etc.
499 * But there are a few cases like display devices that make sense.
501 enable = 1; /* i.e. we will do checking */
502 if ((*class_code >> 16) == PCI_BASE_CLASS_DISPLAY)
505 if (!eeh_check_opts_config(dn, *class_code, *vendor_id, *device_id,
508 printk(KERN_WARNING "EEH: %s user requested to run "
509 "without EEH.\n", dn->full_name);
515 dn->eeh_mode = EEH_MODE_NOCHECK;
519 /* This device may already have an EEH parent. */
520 if (dn->parent && (dn->parent->eeh_mode & EEH_MODE_SUPPORTED)) {
521 /* Parent supports EEH. */
522 dn->eeh_mode |= EEH_MODE_SUPPORTED;
523 dn->eeh_config_addr = dn->parent->eeh_config_addr;
527 /* Ok... see if this device supports EEH. */
528 regs = (u32 *)get_property(dn, "reg", 0);
530 /* First register entry is addr (00BBSS00) */
531 /* Try to enable eeh */
532 ret = rtas_call(ibm_set_eeh_option, 4, 1, NULL,
533 regs[0], info->buid_hi, info->buid_lo,
536 eeh_subsystem_enabled = 1;
537 dn->eeh_mode |= EEH_MODE_SUPPORTED;
538 dn->eeh_config_addr = regs[0];
540 printk(KERN_DEBUG "EEH: %s: eeh enabled\n",
544 printk(KERN_WARNING "EEH: %s: rtas_call failed.\n",
548 printk(KERN_WARNING "EEH: %s: unable to get reg property.\n",
556 * Initialize EEH by trying to enable it for all of the adapters in the system.
557 * As a side effect we can determine here if eeh is supported at all.
558 * Note that we leave EEH on so failed config cycles won't cause a machine
559 * check. If a user turns off EEH for a particular adapter they are really
560 * telling Linux to ignore errors.
562 * We should probably distinguish between "ignore errors" and "turn EEH off"
563 * but for now disabling EEH for adapters is mostly to work around drivers that
564 * directly access mmio space (without using the macros).
566 * The eeh-force-off option does literally what it says, so if Linux must
567 * avoid enabling EEH this must be done.
569 void __init eeh_init(void)
571 struct device_node *phb;
572 struct eeh_early_enable_info info;
573 char *eeh_force_off = strstr(saved_command_line, "eeh-force-off");
575 ibm_set_eeh_option = rtas_token("ibm,set-eeh-option");
576 ibm_set_slot_reset = rtas_token("ibm,set-slot-reset");
577 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state");
579 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE)
583 printk(KERN_WARNING "EEH: WARNING: PCI Enhanced I/O Error "
584 "Handling is user disabled\n");
588 /* Enable EEH for all adapters. Note that eeh requires buid's */
589 for (phb = of_find_node_by_name(NULL, "pci"); phb;
590 phb = of_find_node_by_name(phb, "pci")) {
594 buid_vals = (int *)get_property(phb, "ibm,fw-phb-id", &len);
597 if (len == sizeof(int)) {
598 info.buid_lo = buid_vals[0];
600 } else if (len == sizeof(int)*2) {
601 info.buid_hi = buid_vals[0];
602 info.buid_lo = buid_vals[1];
604 printk(KERN_INFO "EEH: odd ibm,fw-phb-id len returned: %d\n", len);
607 traverse_pci_devices(phb, early_enable_eeh, NULL, &info);
610 if (eeh_subsystem_enabled)
611 printk(KERN_INFO "EEH: PCI Enhanced I/O Error Handling Enabled\n");
615 * eeh_add_device_early - enable EEH for the indicated device_node
616 * @dn: device node for which to set up EEH
618 * This routine must be used to perform EEH initialization for PCI
619 * devices that were added after system boot (e.g. hotplug, dlpar).
620 * This routine must be called before any i/o is performed to the
621 * adapter (inluding any config-space i/o).
622 * Whether this actually enables EEH or not for this device depends
623 * on the CEC architecture, type of the device, on earlier boot
624 * command-line arguments & etc.
626 void eeh_add_device_early(struct device_node *dn)
628 struct pci_controller *phb;
629 struct eeh_early_enable_info info;
631 if (!dn || !eeh_subsystem_enabled)
634 if (NULL == phb || 0 == phb->buid) {
635 printk(KERN_WARNING "EEH: Expected buid but found none\n");
639 info.buid_hi = BUID_HI(phb->buid);
640 info.buid_lo = BUID_LO(phb->buid);
641 early_enable_eeh(dn, &info);
643 EXPORT_SYMBOL(eeh_add_device_early);
646 * eeh_add_device_late - perform EEH initialization for the indicated pci device
647 * @dev: pci device for which to set up EEH
649 * This routine must be used to complete EEH initialization for PCI
650 * devices that were added after system boot (e.g. hotplug, dlpar).
652 void eeh_add_device_late(struct pci_dev *dev)
654 if (!dev || !eeh_subsystem_enabled)
658 printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev),
659 pci_pretty_name(dev));
662 pci_addr_cache_insert_device (dev);
664 EXPORT_SYMBOL(eeh_add_device_late);
667 * eeh_remove_device - undo EEH setup for the indicated pci device
668 * @dev: pci device to be removed
670 * This routine should be when a device is removed from a running
671 * system (e.g. by hotplug or dlpar).
673 void eeh_remove_device(struct pci_dev *dev)
675 if (!dev || !eeh_subsystem_enabled)
678 /* Unregister the device with the EEH/PCI address search system */
680 printk(KERN_DEBUG "EEH: remove device %s %s\n", pci_name(dev),
681 pci_pretty_name(dev));
683 pci_addr_cache_remove_device(dev);
685 EXPORT_SYMBOL(eeh_remove_device);
688 * If EEH is implemented, find the PCI device using given phys addr
689 * and check to see if eeh failure checking is disabled.
690 * Remap the addr (trivially) to the EEH region if EEH checking enabled.
691 * For addresses not known to PCI the vaddr is simply returned unchanged.
693 void *eeh_ioremap(unsigned long addr, void *vaddr)
696 struct device_node *dn;
698 if (!eeh_subsystem_enabled)
701 dev = pci_get_device_by_addr(addr);
705 dn = pci_device_to_OF_node(dev);
711 if (dn->eeh_mode & EEH_MODE_NOCHECK) {
717 return (void *)IO_ADDR_TO_TOKEN(vaddr);
720 static int proc_eeh_show(struct seq_file *m, void *v)
723 unsigned long ffs = 0, positives = 0, failures = 0;
726 ffs += per_cpu(total_mmio_ffs, cpu);
727 positives += per_cpu(false_positives, cpu);
728 failures += per_cpu(ignored_failures, cpu);
731 if (0 == eeh_subsystem_enabled) {
732 seq_printf(m, "EEH Subsystem is globally disabled\n");
733 seq_printf(m, "eeh_total_mmio_ffs=%ld\n", ffs);
735 seq_printf(m, "EEH Subsystem is enabled\n");
736 seq_printf(m, "eeh_total_mmio_ffs=%ld\n"
737 "eeh_false_positives=%ld\n"
738 "eeh_ignored_failures=%ld\n",
739 ffs, positives, failures);
745 static int proc_eeh_open(struct inode *inode, struct file *file)
747 return single_open(file, proc_eeh_show, NULL);
750 static struct file_operations proc_eeh_operations = {
751 .open = proc_eeh_open,
754 .release = single_release,
757 static int __init eeh_init_proc(void)
759 struct proc_dir_entry *e;
761 if (systemcfg->platform & PLATFORM_PSERIES) {
762 e = create_proc_entry("ppc64/eeh", 0, NULL);
764 e->proc_fops = &proc_eeh_operations;
769 __initcall(eeh_init_proc);
772 * Test if "dev" should be configured on or off.
773 * This processes the options literally from left to right.
774 * This lets the user specify stupid combinations of options,
775 * but at least the result should be very predictable.
777 static int eeh_check_opts_config(struct device_node *dn,
778 int class_code, int vendor_id, int device_id,
781 char devname[32], classname[32];
784 int ret = default_state;
786 /* Build list of strings to match */
788 s = (char *)get_property(dn, "ibm,loc-code", 0);
791 sprintf(devname, "dev%04x:%04x", vendor_id, device_id);
792 strs[nstrs++] = devname;
793 sprintf(classname, "class%04x", class_code);
794 strs[nstrs++] = classname;
795 strs[nstrs++] = ""; /* yes, this matches the empty string */
798 * Now see if any string matches the eeh_opts list.
799 * The eeh_opts list entries start with + or -.
801 for (s = eeh_opts; s && (s < (eeh_opts + eeh_opts_last));
803 for (i = 0; i < nstrs; i++) {
804 if (strcasecmp(strs[i], s+1) == 0) {
805 ret = (strs[i][0] == '+') ? 1 : 0;
813 * Handle kernel eeh-on & eeh-off cmd line options for eeh.
816 * eeh-off=loc1,loc2,loc3...
818 * and this option can be repeated so
819 * eeh-off=loc1,loc2 eeh-off=loc3
820 * is the same as eeh-off=loc1,loc2,loc3
822 * loc is an IBM location code that can be found in a manual or
823 * via openfirmware (or the Hardware Management Console).
825 * We also support these additional "loc" values:
827 * dev#:# vendor:device id in hex (e.g. dev1022:2000)
828 * class# class id in hex (e.g. class0200)
830 * If no location code is specified all devices are assumed
831 * so eeh-off means eeh by default is off.
835 * This is implemented as a null separated list of strings.
836 * Each string looks like this: "+X" or "-X"
837 * where X is a loc code, vendor:device, class (as shown above)
838 * or empty which is used to indicate all.
840 * We interpret this option string list so that it will literally
841 * behave left-to-right even if some combinations don't make sense.
843 static int __init eeh_parm(char *str, int state)
845 char *s, *cur, *curend;
848 eeh_opts = alloc_bootmem(EEH_MAX_OPTS);
849 eeh_opts[eeh_opts_last++] = '+'; /* default */
850 eeh_opts[eeh_opts_last++] = '\0';
853 eeh_opts[eeh_opts_last++] = state ? '+' : '-';
854 eeh_opts[eeh_opts_last++] = '\0';
859 for (s = str; s && *s != '\0'; s = curend) {
861 /* ignore empties. Don't treat as "all-on" or "all-off" */
864 curend = strchr(cur, ',');
866 curend = cur + strlen(cur);
868 int curlen = curend-cur;
869 if (eeh_opts_last + curlen > EEH_MAX_OPTS-2) {
870 printk(KERN_WARNING "EEH: sorry...too many "
871 "eeh cmd line options\n");
874 eeh_opts[eeh_opts_last++] = state ? '+' : '-';
875 strncpy(eeh_opts+eeh_opts_last, cur, curlen);
876 eeh_opts_last += curlen;
877 eeh_opts[eeh_opts_last++] = '\0';
884 static int __init eehoff_parm(char *str)
886 return eeh_parm(str, 0);
889 static int __init eehon_parm(char *str)
891 return eeh_parm(str, 1);
894 __setup("eeh-off", eehoff_parm);
895 __setup("eeh-on", eehon_parm);