···77 |-- 0000:17:00.088 | |-- class99 | |-- config1010- | |-- detach_state1110 | |-- device1211 | |-- irq1312 | |-- local_cpus···1819 | |-- subsystem_device1920 | |-- subsystem_vendor2021 | `-- vendor2121- `-- detach_state2222+ `-- ...22232324The topmost element describes the PCI domain and bus number. In this case,2425the domain number is 0000 and the bus number is 17 (both values are in hex).···3031 ---- --------3132 class PCI class (ascii, ro)3233 config PCI config space (binary, rw)3333- detach_state connection status (bool, rw)3434 device PCI device (ascii, ro)3535 irq IRQ number (ascii, ro)3636 local_cpus nearby CPU mask (cpumask, ro)
-21
Documentation/power/devices.txt
···207207#READY_AFTER_RESUME208208#209209210210-Driver Detach Power Management211211-212212-The kernel now supports the ability to place a device in a low-power213213-state when it is detached from its driver, which happens when its214214-module is removed. 215215-216216-Each device contains a 'detach_state' file in its sysfs directory217217-which can be used to control this state. Reading from this file218218-displays what the current detach state is set to. This is 0 (On) by219219-default. A user may write a positive integer value to this file in the220220-range of 1-4 inclusive. 221221-222222-A value of 1-3 will indicate the device should be placed in that223223-low-power state, which will cause ->suspend() to be called for that224224-device. A value of 4 indicates that the device should be shutdown, so225225-->shutdown() will be called for that device. 226226-227227-The driver is responsible for reinitializing the device when the228228-module is re-inserted during it's ->probe() (or equivalent) method. 229229-The driver core will not call any extra functions when binding the230230-device to the driver. 231210232211pm_message_t meaning233212
+2-2
Documentation/powerpc/hvcs.txt
···347347looks like the following:348348349349 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # ls350350- . current_vty devspec name partner_vtys351351- .. detach_state index partner_clcs vterm_state350350+ . current_vty devspec name partner_vtys351351+ .. index partner_clcs vterm_state352352353353Each entry is provided, by default with a "name" attribute. Reading the354354"name" attribute will reveal the device type as shown in the following
···11-/*22- * drivers/base/interface.c - common driverfs interface that's exported to33- * the world for all devices.44- *55- * Copyright (c) 2002-3 Patrick Mochel66- * Copyright (c) 2002-3 Open Source Development Labs77- *88- * This file is released under the GPLv299- *1010- */1111-1212-#include <linux/device.h>1313-#include <linux/err.h>1414-#include <linux/stat.h>1515-#include <linux/string.h>1616-1717-/**1818- * detach_state - control the default power state for the device.1919- *2020- * This is the state the device enters when it's driver module is2121- * unloaded. The value is an unsigned integer, in the range of 0-4.2222- * '0' indicates 'On', so no action will be taken when the driver is2323- * unloaded. This is the default behavior.2424- * '4' indicates 'Off', meaning the driver core will call the driver's2525- * shutdown method to quiesce the device.2626- * 1-3 indicate a low-power state for the device to enter via the2727- * driver's suspend method.2828- */2929-3030-static ssize_t detach_show(struct device * dev, char * buf)3131-{3232- return sprintf(buf, "%u\n", dev->detach_state);3333-}3434-3535-static ssize_t detach_store(struct device * dev, const char * buf, size_t n)3636-{3737- u32 state;3838- state = simple_strtoul(buf, NULL, 10);3939- if (state > 4)4040- return -EINVAL;4141- dev->detach_state = state;4242- return n;4343-}4444-4545-static DEVICE_ATTR(detach_state, 0644, detach_show, detach_store);4646-4747-4848-struct attribute * dev_default_attrs[] = {4949- &dev_attr_detach_state.attr,5050- NULL,5151-};
···3333#include <linux/init.h>3434#include <linux/interrupt.h>3535#include <linux/smp_lock.h>3636+#include <asm/atomic.h>3637#include <linux/delay.h>3738#include "pci_hotplug.h"3839#include "cpci_hotplug.h"39404040-#define DRIVER_VERSION "0.2"4141#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"4242#define DRIVER_DESC "CompactPCI Hot Plug Core"4343···5454#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)55555656/* local variables */5757-static spinlock_t list_lock;5757+static DECLARE_RWSEM(list_rwsem);5858static LIST_HEAD(slot_list);5959static int slots;6060+static atomic_t extracting;6061int cpci_debug;6162static struct cpci_hp_controller *controller;6263static struct semaphore event_semaphore; /* mutex for process loop (up if something to process) */···6968static int set_attention_status(struct hotplug_slot *slot, u8 value);7069static int get_power_status(struct hotplug_slot *slot, u8 * value);7170static int get_attention_status(struct hotplug_slot *slot, u8 * value);7171+static int get_adapter_status(struct hotplug_slot *slot, u8 * value);7272+static int get_latch_status(struct hotplug_slot *slot, u8 * value);72737374static struct hotplug_slot_ops cpci_hotplug_slot_ops = {7475 .owner = THIS_MODULE,···7976 .set_attention_status = set_attention_status,8077 .get_power_status = get_power_status,8178 .get_attention_status = get_attention_status,7979+ .get_adapter_status = get_adapter_status,8080+ .get_latch_status = get_latch_status,8281};83828483static int···153148 warn("failure to update adapter file");154149 }155150156156- slot->extracting = 0;157157-151151+ if(slot->extracting) {152152+ slot->extracting = 0;153153+ atomic_dec(&extracting);154154+ }158155 return retval;159156}160157···193186set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)194187{195188 return cpci_set_attention_status(hotplug_slot->private, status);189189+}190190+191191+static int192192+get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)193193+{194194+ *value = hotplug_slot->info->adapter_status;195195+ return 0;196196+}197197+198198+static int199199+get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value)200200+{201201+ *value = hotplug_slot->info->latch_status;202202+ return 0;196203}197204198205static void release_slot(struct hotplug_slot *hotplug_slot)···294273 }295274296275 /* Add slot to our internal list */297297- spin_lock(&list_lock);276276+ down_write(&list_rwsem);298277 list_add(&slot->slot_list, &slot_list);299278 slots++;300300- spin_unlock(&list_lock);279279+ up_write(&list_rwsem);301280 }302281 return 0;303282error_name:···320299 struct list_head *next;321300 int status;322301323323- spin_lock(&list_lock);302302+ down_write(&list_rwsem);324303 if(!slots) {325325- spin_unlock(&list_lock);304304+ up_write(&list_rwsem);326305 return -1;327306 }328307 list_for_each_safe(tmp, next, &slot_list) {···340319 slots--;341320 }342321 }343343- spin_unlock(&list_lock);322322+ up_write(&list_rwsem);344323 return 0;345324}346325···368347}369348370349/*371371- * According to PICMG 2.12 R2.0, section 6.3.2, upon350350+ * According to PICMG 2.1 R2.0, section 6.3.2, upon372351 * initialization, the system driver shall clear the373352 * INS bits of the cold-inserted devices.374353 */···380359 struct pci_dev* dev;381360382361 dbg("%s - enter", __FUNCTION__);383383- spin_lock(&list_lock);362362+ down_read(&list_rwsem);384363 if(!slots) {385385- spin_unlock(&list_lock);364364+ up_read(&list_rwsem);386365 return -1;387366 }388367 list_for_each(tmp, &slot_list) {···407386 }408387 }409388 }410410- spin_unlock(&list_lock);389389+ up_read(&list_rwsem);411390 dbg("%s - exit", __FUNCTION__);412391 return 0;413392}···419398 struct list_head *tmp;420399 int extracted;421400 int inserted;401401+ u16 hs_csr;422402423423- spin_lock(&list_lock);403403+ down_read(&list_rwsem);424404 if(!slots) {425425- spin_unlock(&list_lock);405405+ up_read(&list_rwsem);426406 err("no slots registered, shutting down");427407 return -1;428408 }···433411 dbg("%s - looking at slot %s",434412 __FUNCTION__, slot->hotplug_slot->name);435413 if(cpci_check_and_clear_ins(slot)) {436436- u16 hs_csr;437437-438414 /* Some broken hardware (e.g. PLX 9054AB) asserts ENUM# twice... */439415 if(slot->dev) {440416 warn("slot %s already inserted", slot->hotplug_slot->name);···482462483463 inserted++;484464 } else if(cpci_check_ext(slot)) {485485- u16 hs_csr;486486-487465 /* Process extraction request */488466 dbg("%s - slot %s extracted",489467 __FUNCTION__, slot->hotplug_slot->name);···494476 if(!slot->extracting) {495477 if(update_latch_status(slot->hotplug_slot, 0)) {496478 warn("failure to update latch file");479479+497480 }481481+ atomic_inc(&extracting);498482 slot->extracting = 1;499483 }500484 extracted++;485485+ } else if(slot->extracting) {486486+ hs_csr = cpci_get_hs_csr(slot);487487+ if(hs_csr == 0xffff) {488488+ /*489489+ * Hmmm, we're likely hosed at this point, should we490490+ * bother trying to tell the driver or not?491491+ */492492+ err("card in slot %s was improperly removed",493493+ slot->hotplug_slot->name);494494+ if(update_adapter_status(slot->hotplug_slot, 0)) {495495+ warn("failure to update adapter file");496496+ }497497+ slot->extracting = 0;498498+ atomic_dec(&extracting);499499+ }501500 }502501 }503503- spin_unlock(&list_lock);502502+ up_read(&list_rwsem);503503+ dbg("inserted=%d, extracted=%d, extracting=%d",504504+ inserted, extracted, atomic_read(&extracting));504505 if(inserted || extracted) {505506 return extracted;506507 }507507- else {508508+ else if(!atomic_read(&extracting)) {508509 err("cannot find ENUM# source, shutting down");509510 return -1;510511 }512512+ return 0;511513}512514513515/* This is the interrupt mode worker thread body */···535497event_thread(void *data)536498{537499 int rc;538538- struct slot *slot;539539- struct list_head *tmp;540500541501 lock_kernel();542502 daemonize("cpci_hp_eventd");···548512 thread_finished);549513 if(thread_finished || signal_pending(current))550514 break;551551- while(controller->ops->query_enum()) {515515+ do {552516 rc = check_slots();553553- if (rc > 0)517517+ if (rc > 0) {554518 /* Give userspace a chance to handle extraction */555519 msleep(500);556556- else if (rc < 0) {520520+ } else if (rc < 0) {557521 dbg("%s - error checking slots", __FUNCTION__);558522 thread_finished = 1;559523 break;560524 }561561- }562562- /* Check for someone yanking out a board */563563- list_for_each(tmp, &slot_list) {564564- slot = list_entry(tmp, struct slot, slot_list);565565- if(slot->extracting) {566566- /*567567- * Hmmm, we're likely hosed at this point, should we568568- * bother trying to tell the driver or not?569569- */570570- err("card in slot %s was improperly removed",571571- slot->hotplug_slot->name);572572- if(update_adapter_status(slot->hotplug_slot, 0)) {573573- warn("failure to update adapter file");574574- }575575- slot->extracting = 0;576576- }577577- }525525+ } while(atomic_read(&extracting) != 0);578526579527 /* Re-enable ENUM# interrupt */580528 dbg("%s - re-enabling irq", __FUNCTION__);581529 controller->ops->enable_irq();582530 }583583-584531 dbg("%s - event thread signals exit", __FUNCTION__);585532 up(&thread_exit);586533 return 0;···574555poll_thread(void *data)575556{576557 int rc;577577- struct slot *slot;578578- struct list_head *tmp;579558580559 lock_kernel();581560 daemonize("cpci_hp_polld");···582565 while(1) {583566 if(thread_finished || signal_pending(current))584567 break;585585-586586- while(controller->ops->query_enum()) {587587- rc = check_slots();588588- if(rc > 0)589589- /* Give userspace a chance to handle extraction */590590- msleep(500);591591- else if (rc < 0) {592592- dbg("%s - error checking slots", __FUNCTION__);593593- thread_finished = 1;594594- break;595595- }596596- }597597- /* Check for someone yanking out a board */598598- list_for_each(tmp, &slot_list) {599599- slot = list_entry(tmp, struct slot, slot_list);600600- if(slot->extracting) {601601- /*602602- * Hmmm, we're likely hosed at this point, should we603603- * bother trying to tell the driver or not?604604- */605605- err("card in slot %s was improperly removed",606606- slot->hotplug_slot->name);607607- if(update_adapter_status(slot->hotplug_slot, 0)) {608608- warn("failure to update adapter file");568568+ if(controller->ops->query_enum()) {569569+ do {570570+ rc = check_slots();571571+ if(rc > 0) {572572+ /* Give userspace a chance to handle extraction */573573+ msleep(500);574574+ } else if(rc < 0) {575575+ dbg("%s - error checking slots", __FUNCTION__);576576+ thread_finished = 1;577577+ break;609578 }610610- slot->extracting = 0;611611- }579579+ } while(atomic_read(&extracting) != 0);612580 }613613-614581 msleep(100);615582 }616583 dbg("poll thread signals exit");···668667 int status = 0;669668670669 if(controller) {670670+ if(atomic_read(&extracting) != 0) {671671+ return -EBUSY;672672+ }671673 if(!thread_finished) {672674 cpci_stop_thread();673675 }···695691 return -ENODEV;696692 }697693698698- spin_lock(&list_lock);699699- if(!slots) {700700- spin_unlock(&list_lock);694694+ down_read(&list_rwsem);695695+ if(list_empty(&slot_list)) {696696+ up_read(&list_rwsem);701697 return -ENODEV;702698 }703703- spin_unlock(&list_lock);699699+ up_read(&list_rwsem);704700705701 if(first) {706702 status = init_slots();···731727 if(!controller) {732728 return -ENODEV;733729 }734734-730730+ if(atomic_read(&extracting) != 0) {731731+ return -EBUSY;732732+ }735733 if(controller->irq) {736734 /* Stop enum interrupt processing */737735 dbg("%s - disabling irq", __FUNCTION__);···753747 * Unregister all of our slots with the pci_hotplug subsystem,754748 * and free up all memory that we had allocated.755749 */756756- spin_lock(&list_lock);750750+ down_write(&list_rwsem);757751 if(!slots) {758752 goto null_cleanup;759753 }···767761 kfree(slot);768762 }769763 null_cleanup:770770- spin_unlock(&list_lock);764764+ up_write(&list_rwsem);771765 return;772766}773767774768int __init775769cpci_hotplug_init(int debug)776770{777777- spin_lock_init(&list_lock);778771 cpci_debug = debug;779779-780780- info(DRIVER_DESC " version: " DRIVER_VERSION);781772 return 0;782773}783774
+26-328
drivers/pci/hotplug/cpci_hotplug_pci.c
···3232#include "pci_hotplug.h"3333#include "cpci_hotplug.h"34343535-#if !defined(MODULE)3635#define MY_NAME "cpci_hotplug"3737-#else3838-#define MY_NAME THIS_MODULE->name3939-#endif40364137extern int cpci_debug;4238···122126 }123127 return hs_csr;124128}125125-126126-#if 0127127-u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr)128128-{129129- int hs_cap;130130- u16 new_hs_csr;131131-132132- hs_cap = pci_bus_find_capability(slot->bus,133133- slot->devfn,134134- PCI_CAP_ID_CHSWP);135135- if(!hs_cap) {136136- return 0xFFFF;137137- }138138-139139- /* Write out the new value */140140- if(pci_bus_write_config_word(slot->bus,141141- slot->devfn,142142- hs_cap + 2,143143- hs_csr)) {144144- return 0xFFFF;145145- }146146-147147- /* Read back what we just wrote out */148148- if(pci_bus_read_config_word(slot->bus,149149- slot->devfn,150150- hs_cap + 2,151151- &new_hs_csr)) {152152- return 0xFFFF;153153- }154154- return new_hs_csr;155155-}156156-#endif157129158130int cpci_check_and_clear_ins(struct slot* slot)159131{···225261 return -ENODEV;226262 }227263 if((hs_csr & HS_CSR_LOO) != HS_CSR_LOO) {228228- /* Set LOO */229264 hs_csr |= HS_CSR_LOO;230265 if(pci_bus_write_config_word(slot->bus,231266 slot->devfn,···256293 return -ENODEV;257294 }258295 if(hs_csr & HS_CSR_LOO) {259259- /* Clear LOO */260296 hs_csr &= ~HS_CSR_LOO;261297 if(pci_bus_write_config_word(slot->bus,262298 slot->devfn,···274312 * Device configuration functions275313 */276314277277-static int cpci_configure_dev(struct pci_bus *bus, struct pci_dev *dev)315315+static void cpci_enable_device(struct pci_dev *dev)278316{279279- u8 irq_pin;280280- int r;317317+ struct pci_bus *bus;281318282282- dbg("%s - enter", __FUNCTION__);283283-284284- /* NOTE: device already setup from prior scan */285285-286286- /* FIXME: How would we know if we need to enable the expansion ROM? */287287- pci_write_config_word(dev, PCI_ROM_ADDRESS, 0x00L);288288-289289- /* Assign resources */290290- dbg("assigning resources for %02x:%02x.%x",291291- dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));292292- for (r = 0; r < 6; r++) {293293- struct resource *res = dev->resource + r;294294- if(res->flags)295295- pci_assign_resource(dev, r);296296- }297297- dbg("finished assigning resources for %02x:%02x.%x",298298- dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));299299-300300- /* Does this function have an interrupt at all? */301301- dbg("checking for function interrupt");302302- pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq_pin);303303- if(irq_pin) {304304- dbg("function uses interrupt pin %d", irq_pin);305305- }306306-307307- /*308308- * Need to explicitly set irq field to 0 so that it'll get assigned309309- * by the pcibios platform dependent code called by pci_enable_device.310310- */311311- dev->irq = 0;312312-313313- dbg("enabling device");314314- pci_enable_device(dev); /* XXX check return */315315- dbg("now dev->irq = %d", dev->irq);316316- if(irq_pin && dev->irq) {317317- pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);318318- }319319-320320- /* Can't use pci_insert_device at the moment, do it manually for now */321321- pci_proc_attach_device(dev);322322- dbg("notifying drivers");323323- //pci_announce_device_to_drivers(dev);324324- dbg("%s - exit", __FUNCTION__);325325- return 0;326326-}327327-328328-static int cpci_configure_bridge(struct pci_bus* bus, struct pci_dev* dev)329329-{330330- int rc;331331- struct pci_bus* child;332332- struct resource* r;333333- u8 max, n;334334- u16 command;335335-336336- dbg("%s - enter", __FUNCTION__);337337-338338- /* Do basic bridge initialization */339339- rc = pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x40);340340- if(rc) {341341- printk(KERN_ERR "%s - write of PCI_LATENCY_TIMER failed\n", __FUNCTION__);342342- }343343- rc = pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, 0x40);344344- if(rc) {345345- printk(KERN_ERR "%s - write of PCI_SEC_LATENCY_TIMER failed\n", __FUNCTION__);346346- }347347- rc = pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, L1_CACHE_BYTES / 4);348348- if(rc) {349349- printk(KERN_ERR "%s - write of PCI_CACHE_LINE_SIZE failed\n", __FUNCTION__);350350- }351351-352352- /*353353- * Set parent bridge's subordinate field so that configuration space354354- * access will work in pci_scan_bridge and friends.355355- */356356- max = pci_max_busnr();357357- bus->subordinate = max + 1;358358- pci_write_config_byte(bus->self, PCI_SUBORDINATE_BUS, max + 1);359359-360360- /* Scan behind bridge */361361- n = pci_scan_bridge(bus, dev, max, 2);362362- child = pci_find_bus(0, max + 1);363363- if (!child)364364- return -ENODEV;365365- pci_proc_attach_bus(child);366366-367367- /*368368- * Update parent bridge's subordinate field if there were more bridges369369- * behind the bridge that was scanned.370370- */371371- if(n > max) {372372- bus->subordinate = n;373373- pci_write_config_byte(bus->self, PCI_SUBORDINATE_BUS, n);374374- }375375-376376- /*377377- * Update the bridge resources of the bridge to accommodate devices378378- * behind it.379379- */380380- pci_bus_size_bridges(child);381381- pci_bus_assign_resources(child);382382-383383- /* Enable resource mapping via command register */384384- command = PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY | PCI_COMMAND_SERR;385385- r = child->resource[0];386386- if(r && r->start) {387387- command |= PCI_COMMAND_IO;388388- }389389- r = child->resource[1];390390- if(r && r->start) {391391- command |= PCI_COMMAND_MEMORY;392392- }393393- r = child->resource[2];394394- if(r && r->start) {395395- command |= PCI_COMMAND_MEMORY;396396- }397397- rc = pci_write_config_word(dev, PCI_COMMAND, command);398398- if(rc) {399399- err("Error setting command register");400400- return rc;401401- }402402-403403- /* Set bridge control register */404404- command = PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR | PCI_BRIDGE_CTL_NO_ISA;405405- rc = pci_write_config_word(dev, PCI_BRIDGE_CONTROL, command);406406- if(rc) {407407- err("Error setting bridge control register");408408- return rc;409409- }410410- dbg("%s - exit", __FUNCTION__);411411- return 0;412412-}413413-414414-static int configure_visit_pci_dev(struct pci_dev_wrapped *wrapped_dev,415415- struct pci_bus_wrapped *wrapped_bus)416416-{417417- int rc;418418- struct pci_dev *dev = wrapped_dev->dev;419419- struct pci_bus *bus = wrapped_bus->bus;420420- struct slot* slot;421421-422422- dbg("%s - enter", __FUNCTION__);423423-424424- /*425425- * We need to fix up the hotplug representation with the Linux426426- * representation.427427- */428428- if(wrapped_dev->data) {429429- slot = (struct slot*) wrapped_dev->data;430430- slot->dev = dev;431431- }432432-433433- /* If it's a bridge, scan behind it for devices */319319+ pci_enable_device(dev);434320 if(dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {435435- rc = cpci_configure_bridge(bus, dev);436436- if(rc)437437- return rc;438438- }439439-440440- /* Actually configure device */441441- if(dev) {442442- rc = cpci_configure_dev(bus, dev);443443- if(rc)444444- return rc;445445- }446446- dbg("%s - exit", __FUNCTION__);447447- return 0;448448-}449449-450450-static int unconfigure_visit_pci_dev_phase2(struct pci_dev_wrapped *wrapped_dev,451451- struct pci_bus_wrapped *wrapped_bus)452452-{453453- struct pci_dev *dev = wrapped_dev->dev;454454- struct slot* slot;455455-456456- dbg("%s - enter", __FUNCTION__);457457- if(!dev)458458- return -ENODEV;459459-460460- /* Remove the Linux representation */461461- if(pci_remove_device_safe(dev)) {462462- err("Could not remove device\n");463463- return -1;464464- }465465-466466- /*467467- * Now remove the hotplug representation.468468- */469469- if(wrapped_dev->data) {470470- slot = (struct slot*) wrapped_dev->data;471471- slot->dev = NULL;472472- } else {473473- dbg("No hotplug representation for %02x:%02x.%x",474474- dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));475475- }476476- dbg("%s - exit", __FUNCTION__);477477- return 0;478478-}479479-480480-static int unconfigure_visit_pci_bus_phase2(struct pci_bus_wrapped *wrapped_bus,481481- struct pci_dev_wrapped *wrapped_dev)482482-{483483- struct pci_bus *bus = wrapped_bus->bus;484484- struct pci_bus *parent = bus->self->bus;485485-486486- dbg("%s - enter", __FUNCTION__);487487-488488- /* The cleanup code for proc entries regarding buses should be in the kernel... */489489- if(bus->procdir)490490- dbg("detach_pci_bus %s", bus->procdir->name);491491- pci_proc_detach_bus(bus);492492-493493- /* The cleanup code should live in the kernel... */494494- bus->self->subordinate = NULL;495495-496496- /* unlink from parent bus */497497- list_del(&bus->node);498498-499499- /* Now, remove */500500- if(bus)501501- kfree(bus);502502-503503- /* Update parent's subordinate field */504504- if(parent) {505505- u8 n = pci_bus_max_busnr(parent);506506- if(n < parent->subordinate) {507507- parent->subordinate = n;508508- pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, n);321321+ bus = dev->subordinate;322322+ list_for_each_entry(dev, &bus->devices, bus_list) {323323+ cpci_enable_device(dev);509324 }510325 }511511- dbg("%s - exit", __FUNCTION__);512512- return 0;513326}514514-515515-static struct pci_visit configure_functions = {516516- .visit_pci_dev = configure_visit_pci_dev,517517-};518518-519519-static struct pci_visit unconfigure_functions_phase2 = {520520- .post_visit_pci_bus = unconfigure_visit_pci_bus_phase2,521521- .post_visit_pci_dev = unconfigure_visit_pci_dev_phase2522522-};523523-524327525328int cpci_configure_slot(struct slot* slot)526329{527527- int rc = 0;330330+ unsigned char busnr;331331+ struct pci_bus *child;528332529333 dbg("%s - enter", __FUNCTION__);530334···316588 slot->dev = pci_find_slot(slot->bus->number, slot->devfn);317589 if(slot->dev == NULL) {318590 err("Could not find PCI device for slot %02x", slot->number);319319- return 0;320320- }321321- }322322- dbg("slot->dev = %p", slot->dev);323323- if(slot->dev) {324324- struct pci_dev *dev;325325- struct pci_dev_wrapped wrapped_dev;326326- struct pci_bus_wrapped wrapped_bus;327327- int i;328328-329329- memset(&wrapped_dev, 0, sizeof (struct pci_dev_wrapped));330330- memset(&wrapped_bus, 0, sizeof (struct pci_bus_wrapped));331331-332332- for (i = 0; i < 8; i++) {333333- dev = pci_find_slot(slot->bus->number,334334- PCI_DEVFN(PCI_SLOT(slot->dev->devfn), i));335335- if(!dev)336336- continue;337337- wrapped_dev.dev = dev;338338- wrapped_bus.bus = slot->dev->bus;339339- if(i)340340- wrapped_dev.data = NULL;341341- else342342- wrapped_dev.data = (void*) slot;343343- rc = pci_visit_dev(&configure_functions, &wrapped_dev, &wrapped_bus);591591+ return 1;344592 }345593 }346594347347- dbg("%s - exit, rc = %d", __FUNCTION__, rc);348348- return rc;595595+ if (slot->dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {596596+ pci_read_config_byte(slot->dev, PCI_SECONDARY_BUS, &busnr);597597+ child = pci_add_new_bus(slot->dev->bus, slot->dev, busnr);598598+ pci_do_scan_bus(child);599599+ pci_bus_size_bridges(child);600600+ }601601+602602+ pci_bus_assign_resources(slot->dev->bus);603603+604604+ cpci_enable_device(slot->dev);605605+606606+ dbg("%s - exit", __FUNCTION__);607607+ return 0;349608}350609351610int cpci_unconfigure_slot(struct slot* slot)352611{353353- int rc = 0;354612 int i;355355- struct pci_dev_wrapped wrapped_dev;356356- struct pci_bus_wrapped wrapped_bus;357613 struct pci_dev *dev;358614359615 dbg("%s - enter", __FUNCTION__);360360-361616 if(!slot->dev) {362617 err("No device for slot %02x\n", slot->number);363618 return -ENODEV;364619 }365620366366- memset(&wrapped_dev, 0, sizeof (struct pci_dev_wrapped));367367- memset(&wrapped_bus, 0, sizeof (struct pci_bus_wrapped));368368-369621 for (i = 0; i < 8; i++) {370622 dev = pci_find_slot(slot->bus->number,371623 PCI_DEVFN(PCI_SLOT(slot->devfn), i));372624 if(dev) {373373- wrapped_dev.dev = dev;374374- wrapped_bus.bus = dev->bus;375375- if(i)376376- wrapped_dev.data = NULL;377377- else378378- wrapped_dev.data = (void*) slot;379379- dbg("%s - unconfigure phase 2", __FUNCTION__);380380- rc = pci_visit_dev(&unconfigure_functions_phase2,381381- &wrapped_dev,382382- &wrapped_bus);383383- if(rc)384384- break;625625+ pci_remove_bus_device(dev);626626+ slot->dev = NULL;385627 }386628 }387387- dbg("%s - exit, rc = %d", __FUNCTION__, rc);388388- return rc;629629+ dbg("%s - exit", __FUNCTION__);630630+ return 0;389631}
+1
drivers/pci/hotplug/pciehp.h
···130130 u8 slot_bus; /* Bus where the slots handled by this controller sit */131131 u8 ctrlcap;132132 u16 vendor_id;133133+ u8 cap_base;133134};134135135136struct irq_mapping {
···225225 int errno)226226{227227 char nbuf[16];228228- const char *errstr = ext3_decode_error(sb, errno, nbuf);228228+ const char *errstr;229229230230+ /* Special case: if the error is EROFS, and we're not already231231+ * inside a transaction, then there's really no point in logging232232+ * an error. */233233+ if (errno == -EROFS && journal_current_handle() == NULL &&234234+ (sb->s_flags & MS_RDONLY))235235+ return;236236+237237+ errstr = ext3_decode_error(sb, errno, nbuf);230238 printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n",231239 sb->s_id, function, errstr);232240
-3
include/linux/device.h
···273273 BIOS data relevant to device) */274274 struct dev_pm_info power;275275276276- u32 detach_state; /* State to enter when device is277277- detached from its driver. */278278-279276 u64 *dma_mask; /* dma mask (if dma'able device) */280277 u64 coherent_dma_mask;/* Like dma_mask, but for281278 alloc_coherent mappings as
+3-3
kernel/power/main.c
···156156 goto Unlock;157157 }158158159159- pr_debug("PM: Preparing system for suspend\n");159159+ pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);160160 if ((error = suspend_prepare(state)))161161 goto Unlock;162162163163- pr_debug("PM: Entering state.\n");163163+ pr_debug("PM: Entering %s sleep\n", pm_states[state]);164164 error = suspend_enter(state);165165166166- pr_debug("PM: Finishing up.\n");166166+ pr_debug("PM: Finishing wakeup.\n");167167 suspend_finish(state);168168 Unlock:169169 up(&pm_sem);
+2-2
mm/mmap.c
···12441244 addr = mm->free_area_cache;1245124512461246 /* make sure it can fit in the remaining address space */12471247- if (addr >= len) {12471247+ if (addr > len) {12481248 vma = find_vma(mm, addr-len);12491249 if (!vma || addr <= vma->vm_start)12501250 /* remember the address as a hint for next time */···1266126612671267 /* try just below the current vma->vm_start */12681268 addr = vma->vm_start-len;12691269- } while (len <= vma->vm_start);12691269+ } while (len < vma->vm_start);1270127012711271 /*12721272 * A failed mmap() very likely causes application failure,