···190190 u32 reserved2;191191} __attribute__ ((packed));192192193193-/* offsets to the hotplug resource table registers based on the above structure layout */193193+/* offsets to the hotplug resource table registers based on the above194194+ * structure layout195195+ */194196enum hrt_offsets {195197 SIG0 = offsetof(struct hrt, sig0),196198 SIG1 = offsetof(struct hrt, sig1),···219217 u16 pre_mem_length;220218} __attribute__ ((packed));221219222222-/* offsets to the hotplug slot resource table registers based on the above structure layout */220220+/* offsets to the hotplug slot resource table registers based on the above221221+ * structure layout222222+ */223223enum slot_rt_offsets {224224 DEV_FUNC = offsetof(struct slot_rt, dev_func),225225 PRIMARY_BUS = offsetof(struct slot_rt, primary_bus),···290286struct controller {291287 struct controller *next;292288 u32 ctrl_int_comp;293293- struct mutex crit_sect; /* critical section mutex */294294- void __iomem *hpc_reg; /* cookie for our pci controller location */289289+ struct mutex crit_sect; /* critical section mutex */290290+ void __iomem *hpc_reg; /* cookie for our pci controller location */295291 struct pci_resource *mem_head;296292 struct pci_resource *p_mem_head;297293 struct pci_resource *io_head;···303299 u8 next_event;304300 u8 interrupt;305301 u8 cfgspc_irq;306306- u8 bus; /* bus number for the pci hotplug controller */302302+ u8 bus; /* bus number for the pci hotplug controller */307303 u8 rev;308304 u8 slot_device_offset;309305 u8 first_slot;···462458 * return_resource463459 *464460 * Puts node back in the resource list pointed to by head465465- *466461 */467462static inline void return_resource(struct pci_resource **head, struct pci_resource *node)468463{···578575}579576580577581581-/*578578+/**582579 * get_controller_speed - find the current frequency/mode of controller.583580 *584581 * @ctrl: controller to get frequency/mode for.585582 *586583 * Returns controller speed.587587- *588584 */589585static inline u8 get_controller_speed(struct controller *ctrl)590586{···609607}610608611609612612-/*610610+/**613611 * get_adapter_speed - find the max supported frequency/mode of adapter.614612 *615613 * @ctrl: hotplug controller.616614 * @hp_slot: hotplug slot where adapter is installed.617615 *618616 * Returns adapter speed.619619- *620617 */621618static inline u8 get_adapter_speed(struct controller *ctrl, u8 hp_slot)622619{···720719}721720722721#endif723723-
+84-73
drivers/pci/hotplug/cpqphp_core.c
···2626 *2727 * Jan 12, 2003 - Added 66/100/133MHz PCI-X support,2828 * Torben Mathiasen <torben.mathiasen@hp.com>2929- *3029 */31303231#include <linux/module.h>···170171 tempdword = ctrl->first_slot;171172172173 number_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F;173173- // Loop through slots174174+ /* Loop through slots */174175 while (number_of_slots) {175176 physical_slot = tempdword;176177 writeb(0, ctrl->hpc_reg + SLOT_SERR);···199200200201 len = (routing_table->size - sizeof(struct irq_routing_table)) /201202 sizeof(struct irq_info);202202- // Make sure I got at least one entry203203+ /* Make sure I got at least one entry */203204 if (len == 0) {204205 kfree(routing_table);205206 return -1;···243244 if (!smbios_table || !curr)244245 return(NULL);245246246246- // set p_max to the end of the table247247+ /* set p_max to the end of the table */247248 p_max = smbios_start + readw(smbios_table + ST_LENGTH);248249249250 p_temp = curr;···252253 while ((p_temp < p_max) && !bail) {253254 /* Look for the double NULL terminator254255 * The first condition is the previous byte255255- * and the second is the curr */256256+ * and the second is the curr257257+ */256258 if (!previous_byte && !(readb(p_temp))) {257259 bail = 1;258260 }···387387 slot->task_event.expires = jiffies + 5 * HZ;388388 slot->task_event.function = cpqhp_pushbutton_thread;389389390390- //FIXME: these capabilities aren't used but if they are391391- // they need to be correctly implemented390390+ /*FIXME: these capabilities aren't used but if they are391391+ * they need to be correctly implemented392392+ */392393 slot->capabilities |= PCISLOT_REPLACE_SUPPORTED;393394 slot->capabilities |= PCISLOT_INTERLOCK_SUPPORTED;394395···403402 ctrl_slot =404403 slot_device - (readb(ctrl->hpc_reg + SLOT_MASK) >> 4);405404406406- // Check presence405405+ /* Check presence */407406 slot->capabilities |=408407 ((((~tempdword) >> 23) |409408 ((~tempdword) >> 15)) >> ctrl_slot) & 0x02;410410- // Check the switch state409409+ /* Check the switch state */411410 slot->capabilities |=412411 ((~tempdword & 0xFF) >> ctrl_slot) & 0x01;413413- // Check the slot enable412412+ /* Check the slot enable */414413 slot->capabilities |=415414 ((read_slot_enable(ctrl) << 2) >> ctrl_slot) & 0x04;416415···477476478477 cpqhp_remove_debugfs_files(ctrl);479478480480- //Free IRQ associated with hot plug device479479+ /* Free IRQ associated with hot plug device */481480 free_irq(ctrl->interrupt, ctrl);482482- //Unmap the memory481481+ /* Unmap the memory */483482 iounmap(ctrl->hpc_reg);484484- //Finally reclaim PCI mem483483+ /* Finally reclaim PCI mem */485484 release_mem_region(pci_resource_start(ctrl->pci_dev, 0),486485 pci_resource_len(ctrl->pci_dev, 0));487486···489488}490489491490492492-//============================================================================493493-// function: get_slot_mapping494494-//495495-// Description: Attempts to determine a logical slot mapping for a PCI496496-// device. Won't work for more than one PCI-PCI bridge497497-// in a slot.498498-//499499-// Input: u8 bus_num - bus number of PCI device500500-// u8 dev_num - device number of PCI device501501-// u8 *slot - Pointer to u8 where slot number will502502-// be returned503503-//504504-// Output: SUCCESS or FAILURE505505-//=============================================================================491491+/**492492+ * get_slot_mapping - determine logical slot mapping for PCI device493493+ *494494+ * Won't work for more than one PCI-PCI bridge in a slot.495495+ *496496+ * @bus_num - bus number of PCI device497497+ * @dev_num - device number of PCI device498498+ * @slot - Pointer to u8 where slot number will be returned499499+ *500500+ * Output: SUCCESS or FAILURE501501+ */506502static int507503get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)508504{···520522521523 len = (PCIIRQRoutingInfoLength->size -522524 sizeof(struct irq_routing_table)) / sizeof(struct irq_info);523523- // Make sure I got at least one entry525525+ /* Make sure I got at least one entry */524526 if (len == 0) {525527 kfree(PCIIRQRoutingInfoLength);526528 return -1;···537539 return 0;538540 } else {539541 /* Did not get a match on the target PCI device. Check540540- * if the current IRQ table entry is a PCI-to-PCI bridge541541- * device. If so, and it's secondary bus matches the542542- * bus number for the target device, I need to save the543543- * bridge's slot number. If I can not find an entry for544544- * the target device, I will have to assume it's on the545545- * other side of the bridge, and assign it the bridge's546546- * slot. */542542+ * if the current IRQ table entry is a PCI-to-PCI543543+ * bridge device. If so, and it's secondary bus544544+ * matches the bus number for the target device, I need545545+ * to save the bridge's slot number. If I can not find546546+ * an entry for the target device, I will have to547547+ * assume it's on the other side of the bridge, and548548+ * assign it the bridge's slot.549549+ */547550 bus->number = tbus;548551 pci_bus_read_config_dword(bus, PCI_DEVFN(tdevice, 0),549552 PCI_CLASS_REVISION, &work);···562563563564 }564565565565- // If we got here, we didn't find an entry in the IRQ mapping table566566- // for the target PCI device. If we did determine that the target567567- // device is on the other side of a PCI-to-PCI bridge, return the568568- // slot number for the bridge.566566+ /* If we got here, we didn't find an entry in the IRQ mapping table for567567+ * the target PCI device. If we did determine that the target device568568+ * is on the other side of a PCI-to-PCI bridge, return the slot number569569+ * for the bridge.570570+ */569571 if (bridgeSlot != 0xFF) {570572 *slot = bridgeSlot;571573 kfree(PCIIRQRoutingInfoLength);572574 return 0;573575 }574576 kfree(PCIIRQRoutingInfoLength);575575- // Couldn't find an entry in the routing table for this PCI device577577+ /* Couldn't find an entry in the routing table for this PCI device */576578 return -1;577579}578580···595595596596 hp_slot = func->device - ctrl->slot_device_offset;597597598598- // Wait for exclusive access to hardware598598+ /* Wait for exclusive access to hardware */599599 mutex_lock(&ctrl->crit_sect);600600601601 if (status == 1) {···603603 } else if (status == 0) {604604 amber_LED_off (ctrl, hp_slot);605605 } else {606606- // Done with exclusive hardware access606606+ /* Done with exclusive hardware access */607607 mutex_unlock(&ctrl->crit_sect);608608 return(1);609609 }610610611611 set_SOGO(ctrl);612612613613- // Wait for SOBS to be unset613613+ /* Wait for SOBS to be unset */614614 wait_for_ctrl_irq (ctrl);615615616616- // Done with exclusive hardware access616616+ /* Done with exclusive hardware access */617617 mutex_unlock(&ctrl->crit_sect);618618619619 return(0);···815815 return err;816816 }817817818818- // Need to read VID early b/c it's used to differentiate CPQ and INTC discovery818818+ /* Need to read VID early b/c it's used to differentiate CPQ and INTC819819+ * discovery820820+ */819821 rc = pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor_id);820822 if (rc || ((vendor_id != PCI_VENDOR_ID_COMPAQ) && (vendor_id != PCI_VENDOR_ID_INTEL))) {821823 err(msg_HPC_non_compaq_or_intel);···839837 * Also Intel HPC's may have RID=0.840838 */841839 if ((pdev->revision > 2) || (vendor_id == PCI_VENDOR_ID_INTEL)) {842842- // TODO: This code can be made to support non-Compaq or Intel subsystem IDs840840+ /* TODO: This code can be made to support non-Compaq or Intel841841+ * subsystem IDs842842+ */843843 rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid);844844 if (rc) {845845 err("%s : pci_read_config_word failed\n", __func__);···869865870866 info("Hot Plug Subsystem Device ID: %x\n", subsystem_deviceid);871867872872- /* Set Vendor ID, so it can be accessed later from other functions */868868+ /* Set Vendor ID, so it can be accessed later from other869869+ * functions870870+ */873871 ctrl->vendor_id = vendor_id;874872875873 switch (subsystem_vid) {···998992999993 /* PHP Status (0=De-feature PHP, 1=Normal operation) */1000994 if (subsystem_deviceid & 0x0008) {10011001- ctrl->defeature_PHP = 1; // PHP supported995995+ ctrl->defeature_PHP = 1; /* PHP supported */1002996 } else {10031003- ctrl->defeature_PHP = 0; // PHP not supported997997+ ctrl->defeature_PHP = 0; /* PHP not supported */1004998 }100599910061000 /* Alternate Base Address Register Interface (0=not supported, 1=supported) */10071001 if (subsystem_deviceid & 0x0010) {10081008- ctrl->alternate_base_address = 1; // supported10021002+ ctrl->alternate_base_address = 1; /* supported */10091003 } else {10101010- ctrl->alternate_base_address = 0; // not supported10041004+ ctrl->alternate_base_address = 0; /* not supported */10111005 }1012100610131007 /* PCI Config Space Index (0=not supported, 1=supported) */10141008 if (subsystem_deviceid & 0x0020) {10151015- ctrl->pci_config_space = 1; // supported10091009+ ctrl->pci_config_space = 1; /* supported */10161010 } else {10171017- ctrl->pci_config_space = 0; // not supported10111011+ ctrl->pci_config_space = 0; /* not supported */10181012 }1019101310201014 /* PCI-X support */···10481042 return -ENODEV;10491043 }1050104410511051- // Tell the user that we found one.10451045+ /* Tell the user that we found one. */10521046 info("Initializing the PCI hot plug controller residing on PCI bus %d\n",10531047 pdev->bus->number);10541048···11261120 *11271121 ********************************************************/1128112211291129- // find the physical slot number of the first hot plug slot11231123+ /* find the physical slot number of the first hot plug slot */1130112411311125 /* Get slot won't work for devices behind bridges, but11321126 * in this case it will always be called for the "base"···11431137 goto err_iounmap;11441138 }1145113911461146- // Store PCI Config Space for all devices on this bus11401140+ /* Store PCI Config Space for all devices on this bus */11471141 rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK));11481142 if (rc) {11491143 err("%s: unable to save PCI configuration data, error %d\n",···11541148 /*11551149 * Get IO, memory, and IRQ resources for new devices11561150 */11571157- // The next line is required for cpqhp_find_available_resources11511151+ /* The next line is required for cpqhp_find_available_resources */11581152 ctrl->interrupt = pdev->irq;11591153 if (ctrl->interrupt < 0x10) {11601154 cpqhp_legacy_mode = 1;···12021196 goto err_iounmap;12031197 }1204119812051205- /* Enable Shift Out interrupt and clear it, also enable SERR on power fault */11991199+ /* Enable Shift Out interrupt and clear it, also enable SERR on power12001200+ * fault12011201+ */12061202 temp_word = readw(ctrl->hpc_reg + MISC);12071203 temp_word |= 0x4006;12081204 writew(temp_word, ctrl->hpc_reg + MISC);1209120512101210- // Changed 05/05/97 to clear all interrupts at start12061206+ /* Changed 05/05/97 to clear all interrupts at start */12111207 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_INPUT_CLEAR);1212120812131209 ctrl->ctrl_int_comp = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);···12241216 cpqhp_ctrl_list = ctrl;12251217 }1226121812271227- // turn off empty slots here unless command line option "ON" set12281228- // Wait for exclusive access to hardware12191219+ /* turn off empty slots here unless command line option "ON" set12201220+ * Wait for exclusive access to hardware12211221+ */12291222 mutex_lock(&ctrl->crit_sect);1230122312311224 num_of_slots = readb(ctrl->hpc_reg + SLOT_MASK) & 0x0F;1232122512331233- // find first device number for the ctrl12261226+ /* find first device number for the ctrl */12341227 device = readb(ctrl->hpc_reg + SLOT_MASK) >> 4;1235122812361229 while (num_of_slots) {···12431234 hp_slot = func->device - ctrl->slot_device_offset;12441235 dbg("hp_slot: %d\n", hp_slot);1245123612461246- // We have to save the presence info for these slots12371237+ /* We have to save the presence info for these slots */12471238 temp_word = ctrl->ctrl_int_comp >> 16;12481239 func->presence_save = (temp_word >> hp_slot) & 0x01;12491240 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;···1267125812681259 if (!power_mode) {12691260 set_SOGO(ctrl);12701270- // Wait for SOBS to be unset12611261+ /* Wait for SOBS to be unset */12711262 wait_for_ctrl_irq(ctrl);12721263 }12731264···12781269 goto err_free_irq;12791270 }1280127112811281- // Done with exclusive hardware access12721272+ /* Done with exclusive hardware access */12821273 mutex_unlock(&ctrl->crit_sect);1283127412841275 cpqhp_create_debugfs_files(ctrl);···13251316 cpqhp_slot_list[loop] = NULL;13261317 }1327131813281328- // FIXME: We also need to hook the NMI handler eventually.13291329- // this also needs to be worked with Christoph13301330- // register_NMI_handler();13311331-13321332- // Map rom address13191319+ /* FIXME: We also need to hook the NMI handler eventually.13201320+ * this also needs to be worked with Christoph13211321+ * register_NMI_handler();13221322+ */13231323+ /* Map rom address */13331324 cpqhp_rom_start = ioremap(ROM_PHY_ADDR, ROM_PHY_LEN);13341325 if (!cpqhp_rom_start) {13351326 err ("Could not ioremap memory region for ROM\n");···13371328 goto error;13381329 }1339133013401340- /* Now, map the int15 entry point if we are on compaq specific hardware */13311331+ /* Now, map the int15 entry point if we are on compaq specific13321332+ * hardware13331333+ */13411334 compaq_nvram_init(cpqhp_rom_start);1342133513431336 /* Map smbios table entry point structure */···14731462 }14741463 }1475146414761476- // Stop the notification mechanism14651465+ /* Stop the notification mechanism */14771466 if (initialized)14781467 cpqhp_event_stop_thread();1479146814801480- //unmap the rom address14691469+ /* unmap the rom address */14811470 if (cpqhp_rom_start)14821471 iounmap(cpqhp_rom_start);14831472 if (smbios_start)
+77-54
drivers/pci/hotplug/cpqphp_ctrl.c
···81818282 for (hp_slot = 0; hp_slot < 6; hp_slot++) {8383 if (change & (0x1L << hp_slot)) {8484- /**********************************8484+ /*8585 * this one changed.8686- **********************************/8686+ */8787 func = cpqhp_slot_find(ctrl->bus,8888 (hp_slot + ctrl->slot_device_offset), 0);89899090 /* this is the structure that tells the worker thread9191- *what to do */9191+ * what to do9292+ */9293 taskInfo = &(ctrl->event_queue[ctrl->next_event]);9394 ctrl->next_event = (ctrl->next_event + 1) % 10;9495 taskInfo->hp_slot = hp_slot;···101100 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;102101103102 if (ctrl->ctrl_int_comp & (0x1L << hp_slot)) {104104- /**********************************103103+ /*105104 * Switch opened106106- **********************************/105105+ */107106108107 func->switch_save = 0;109108110109 taskInfo->event_type = INT_SWITCH_OPEN;111110 } else {112112- /**********************************111111+ /*113112 * Switch closed114114- **********************************/113113+ */115114116115 func->switch_save = 0x10;117116···153152 if (!change)154153 return 0;155154156156- /**********************************155155+ /*157156 * Presence Change158158- **********************************/157157+ */159158 dbg("cpqsbd: Presence/Notify input change.\n");160159 dbg(" Changed bits are 0x%4.4x\n", change );161160162161 for (hp_slot = 0; hp_slot < 6; hp_slot++) {163162 if (change & (0x0101 << hp_slot)) {164164- /**********************************163163+ /*165164 * this one changed.166166- **********************************/165165+ */167166 func = cpqhp_slot_find(ctrl->bus,168167 (hp_slot + ctrl->slot_device_offset), 0);169168···178177 return 0;179178180179 /* If the switch closed, must be a button181181- * If not in button mode, nevermind */180180+ * If not in button mode, nevermind181181+ */182182 if (func->switch_save && (ctrl->push_button == 1)) {183183 temp_word = ctrl->ctrl_int_comp >> 16;184184 temp_byte = (temp_word >> hp_slot) & 0x01;185185 temp_byte |= (temp_word >> (hp_slot + 7)) & 0x02;186186187187 if (temp_byte != func->presence_save) {188188- /**************************************188188+ /*189189 * button Pressed (doesn't do anything)190190- **************************************/190190+ */191191 dbg("hp_slot %d button pressed\n", hp_slot);192192 taskInfo->event_type = INT_BUTTON_PRESS;193193 } else {194194- /**********************************194194+ /*195195 * button Released - TAKE ACTION!!!!196196- **********************************/196196+ */197197 dbg("hp_slot %d button released\n", hp_slot);198198 taskInfo->event_type = INT_BUTTON_RELEASE;199199···212210 }213211 } else {214212 /* Switch is open, assume a presence change215215- * Save the presence state */213213+ * Save the presence state214214+ */216215 temp_word = ctrl->ctrl_int_comp >> 16;217216 func->presence_save = (temp_word >> hp_slot) & 0x01;218217 func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;···244241 if (!change)245242 return 0;246243247247- /**********************************244244+ /*248245 * power fault249249- **********************************/246246+ */250247251248 info("power fault interrupt\n");252249253250 for (hp_slot = 0; hp_slot < 6; hp_slot++) {254251 if (change & (0x01 << hp_slot)) {255255- /**********************************252252+ /*256253 * this one changed.257257- **********************************/254254+ */258255 func = cpqhp_slot_find(ctrl->bus,259256 (hp_slot + ctrl->slot_device_offset), 0);260257···265262 rc++;266263267264 if (ctrl->ctrl_int_comp & (0x00000100 << hp_slot)) {268268- /**********************************265265+ /*269266 * power fault Cleared270270- **********************************/267267+ */271268 func->status = 0x00;272269273270 taskInfo->event_type = INT_POWER_FAULT_CLEAR;274271 } else {275275- /**********************************272272+ /*276273 * power fault277277- **********************************/274274+ */278275 taskInfo->event_type = INT_POWER_FAULT;279276280277 if (ctrl->rev < 4) {···435432436433437434 /* If we got here, there the bridge requires some of the resource, but438438- * we may be able to split some off of the front */435435+ * we may be able to split some off of the front436436+ */439437440438 node = *head;441439442440 if (node->length & (alignment -1)) {443441 /* this one isn't an aligned length, so we'll make a new entry444444- * and split it up. */442442+ * and split it up.443443+ */445444 split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);446445447446 if (!split_node)···561556562557 if (node->base & (size - 1)) {563558 /* this one isn't base aligned properly564564- * so we'll make a new entry and split it up */559559+ * so we'll make a new entry and split it up560560+ */565561 temp_dword = (node->base | (size-1)) + 1;566562567563 /* Short circuit if adjusted size is too small */···587581 /* Don't need to check if too small since we already did */588582 if (node->length > size) {589583 /* this one is longer than we need590590- * so we'll make a new entry and split it up */584584+ * so we'll make a new entry and split it up585585+ */591586 split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);592587593588 if (!split_node)···608601 continue;609602610603 /* If we got here, then it is the right size611611- * Now take it out of the list and break */604604+ * Now take it out of the list and break605605+ */612606 if (*head == node) {613607 *head = node->next;614608 } else {···651643652644 for (max = *head; max; max = max->next) {653645 /* If not big enough we could probably just bail,654654- * instead we'll continue to the next. */646646+ * instead we'll continue to the next.647647+ */655648 if (max->length < size)656649 continue;657650658651 if (max->base & (size - 1)) {659652 /* this one isn't base aligned properly660660- * so we'll make a new entry and split it up */653653+ * so we'll make a new entry and split it up654654+ */661655 temp_dword = (max->base | (size-1)) + 1;662656663657 /* Short circuit if adjusted size is too small */···682672683673 if ((max->base + max->length) & (size - 1)) {684674 /* this one isn't end aligned properly at the top685685- * so we'll make a new entry and split it up */675675+ * so we'll make a new entry and split it up676676+ */686677 split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);687678688679 if (!split_node)···755744 if (node->base & (size - 1)) {756745 dbg("%s: not aligned\n", __func__);757746 /* this one isn't base aligned properly758758- * so we'll make a new entry and split it up */747747+ * so we'll make a new entry and split it up748748+ */759749 temp_dword = (node->base | (size-1)) + 1;760750761751 /* Short circuit if adjusted size is too small */···781769 if (node->length > size) {782770 dbg("%s: too big\n", __func__);783771 /* this one is longer than we need784784- * so we'll make a new entry and split it up */772772+ * so we'll make a new entry and split it up773773+ */785774 split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);786775787776 if (!split_node)···901888902889903890 misc = readw(ctrl->hpc_reg + MISC);904904- /***************************************891891+ /*905892 * Check to see if it was our interrupt906906- ***************************************/893893+ */907894 if (!(misc & 0x000C)) {908895 return IRQ_NONE;909896 }910897911898 if (misc & 0x0004) {912912- /**********************************899899+ /*913900 * Serial Output interrupt Pending914914- **********************************/901901+ */915902916903 /* Clear the interrupt */917904 misc |= 0x0004;···976963 new_slot = kzalloc(sizeof(*new_slot), GFP_KERNEL);977964 if (new_slot == NULL) {978965 /* I'm not dead yet!979979- * You will be. */966966+ * You will be.967967+ */980968 return new_slot;981969 }982970···11491135 return 0;1150113611511137 /* We don't allow freq/mode changes if we find another adapter running11521152- * in another slot on this controller */11381138+ * in another slot on this controller11391139+ */11531140 for(slot = ctrl->slot; slot; slot = slot->next) {11541141 if (slot->device == (hp_slot + ctrl->slot_device_offset))11551142 continue;···11601145 continue;11611146 /* If another adapter is running on the same segment but at a11621147 * lower speed/mode, we allow the new adapter to function at11631163- * this rate if supported */11481148+ * this rate if supported11491149+ */11641150 if (ctrl->speed < adapter_speed)11651151 return 0;11661152···11691153 }1170115411711155 /* If the controller doesn't support freq/mode changes and the11721172- * controller is running at a higher mode, we bail */11561156+ * controller is running at a higher mode, we bail11571157+ */11731158 if ((ctrl->speed > adapter_speed) && (!ctrl->pcix_speed_capability))11741159 return 1;11751160···11791162 return 0;1180116311811164 /* We try to set the max speed supported by both the adapter and11821182- * controller */11651165+ * controller11661166+ */11831167 if (ctrl->speed_capability < adapter_speed) {11841168 if (ctrl->speed == ctrl->speed_capability)11851169 return 0;···12621244}1263124512641246/* the following routines constitute the bulk of the12651265- hotplug controller logic12471247+ * hotplug controller logic12661248 */1267124912681250···12871269 hp_slot = func->device - ctrl->slot_device_offset;1288127012891271 if (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)) {12901290- /**********************************12721272+ /*12911273 * The switch is open.12921292- **********************************/12741274+ */12931275 rc = INTERLOCK_OPEN;12941276 } else if (is_slot_enabled (ctrl, hp_slot)) {12951295- /**********************************12771277+ /*12961278 * The board is already on12971297- **********************************/12791279+ */12981280 rc = CARD_FUNCTIONING;12991281 } else {13001282 mutex_lock(&ctrl->crit_sect);···13701352 * Get slot won't work for devices behind13711353 * bridges, but in this case it will always be13721354 * called for the "base" bus/dev/func of an13731373- * adapter. */13551355+ * adapter.13561356+ */1374135713751358 mutex_lock(&ctrl->crit_sect);13761359···1396137713971378 * Get slot won't work for devices behind bridges, but13981379 * in this case it will always be called for the "base"13991399- * bus/dev/func of an adapter. */13801380+ * bus/dev/func of an adapter.13811381+ */1400138214011383 mutex_lock(&ctrl->crit_sect);14021384···14541434 wait_for_ctrl_irq (ctrl);1455143514561436 /* Change bits in slot power register to force another shift out14571457- * NOTE: this is to work around the timer bug */14371437+ * NOTE: this is to work around the timer bug14381438+ */14581439 temp_byte = readb(ctrl->hpc_reg + SLOT_POWER);14591440 writeb(0x00, ctrl->hpc_reg + SLOT_POWER);14601441 writeb(temp_byte, ctrl->hpc_reg + SLOT_POWER);···25052484 temp_resources.irqs = &irqs;2506248525072486 /* Make copies of the nodes we are going to pass down so that25082508- * if there is a problem,we can just use these to free resources */24872487+ * if there is a problem,we can just use these to free resources24882488+ */25092489 hold_bus_node = kmalloc(sizeof(*hold_bus_node), GFP_KERNEL);25102490 hold_IO_node = kmalloc(sizeof(*hold_IO_node), GFP_KERNEL);25112491 hold_mem_node = kmalloc(sizeof(*hold_mem_node), GFP_KERNEL);···25782556 temp_word = (p_mem_node->base + p_mem_node->length - 1) >> 16;25792557 rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);2580255825812581- /* Adjust this to compensate for extra adjustment in first loop */25592559+ /* Adjust this to compensate for extra adjustment in first loop25602560+ */25822561 irqs.barber_pole--;2583256225842563 rc = 0;
+42-37
drivers/pci/hotplug/cpqphp_nvram.c
···94949595static void __iomem *compaq_int15_entry_point;96969797-static spinlock_t int15_lock; /* lock for ordering int15_bios_call() */9797+/* lock for ordering int15_bios_call() */9898+static spinlock_t int15_lock;989999100100101/* This is a series of function that deals with101101- setting & getting the hotplug resource table in some environment variable.102102-*/102102+ * setting & getting the hotplug resource table in some environment variable.103103+ */103104104105/*105106 * We really shouldn't be doing this unless there is a _very_ good reason to!!!···211210212211 available = 1024;213212214214- // Now load the EV213213+ /* Now load the EV */215214 temp_dword = available;216215217216 rc = access_EV(READ_EV, "CQTHPS", evbuffer, &temp_dword);218217219218 evbuffer_length = temp_dword;220219221221- // We're maintaining the resource lists so write FF to invalidate old info220220+ /* We're maintaining the resource lists so write FF to invalidate old221221+ * info222222+ */222223 temp_dword = 1;223224224225 rc = access_EV(WRITE_EV, "CQTHPS", &temp_byte, &temp_dword);···267264268265 ctrl = cpqhp_ctrl_list;269266270270- // The revision of this structure267267+ /* The revision of this structure */271268 rc = add_byte( &pFill, 1 + ctrl->push_flag, &usedbytes, &available);272269 if (rc)273270 return(rc);274271275275- // The number of controllers272272+ /* The number of controllers */276273 rc = add_byte( &pFill, 1, &usedbytes, &available);277274 if (rc)278275 return(rc);···282279283280 numCtrl++;284281285285- // The bus number282282+ /* The bus number */286283 rc = add_byte( &pFill, ctrl->bus, &usedbytes, &available);287284 if (rc)288285 return(rc);289286290290- // The device Number287287+ /* The device Number */291288 rc = add_byte( &pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available);292289 if (rc)293290 return(rc);294291295295- // The function Number292292+ /* The function Number */296293 rc = add_byte( &pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available);297294 if (rc)298295 return(rc);299296300300- // Skip the number of available entries297297+ /* Skip the number of available entries */301298 rc = add_dword( &pFill, 0, &usedbytes, &available);302299 if (rc)303300 return(rc);304301305305- // Figure out memory Available302302+ /* Figure out memory Available */306303307304 resNode = ctrl->mem_head;308305···311308 while (resNode) {312309 loop ++;313310314314- // base311311+ /* base */315312 rc = add_dword( &pFill, resNode->base, &usedbytes, &available);316313 if (rc)317314 return(rc);318315319319- // length316316+ /* length */320317 rc = add_dword( &pFill, resNode->length, &usedbytes, &available);321318 if (rc)322319 return(rc);···324321 resNode = resNode->next;325322 }326323327327- // Fill in the number of entries324324+ /* Fill in the number of entries */328325 p_ev_ctrl->mem_avail = loop;329326330330- // Figure out prefetchable memory Available327327+ /* Figure out prefetchable memory Available */331328332329 resNode = ctrl->p_mem_head;333330···336333 while (resNode) {337334 loop ++;338335339339- // base336336+ /* base */340337 rc = add_dword( &pFill, resNode->base, &usedbytes, &available);341338 if (rc)342339 return(rc);343340344344- // length341341+ /* length */345342 rc = add_dword( &pFill, resNode->length, &usedbytes, &available);346343 if (rc)347344 return(rc);···349346 resNode = resNode->next;350347 }351348352352- // Fill in the number of entries349349+ /* Fill in the number of entries */353350 p_ev_ctrl->p_mem_avail = loop;354351355355- // Figure out IO Available352352+ /* Figure out IO Available */356353357354 resNode = ctrl->io_head;358355···361358 while (resNode) {362359 loop ++;363360364364- // base361361+ /* base */365362 rc = add_dword( &pFill, resNode->base, &usedbytes, &available);366363 if (rc)367364 return(rc);368365369369- // length366366+ /* length */370367 rc = add_dword( &pFill, resNode->length, &usedbytes, &available);371368 if (rc)372369 return(rc);···374371 resNode = resNode->next;375372 }376373377377- // Fill in the number of entries374374+ /* Fill in the number of entries */378375 p_ev_ctrl->io_avail = loop;379376380380- // Figure out bus Available377377+ /* Figure out bus Available */381378382379 resNode = ctrl->bus_head;383380···386383 while (resNode) {387384 loop ++;388385389389- // base386386+ /* base */390387 rc = add_dword( &pFill, resNode->base, &usedbytes, &available);391388 if (rc)392389 return(rc);393390394394- // length391391+ /* length */395392 rc = add_dword( &pFill, resNode->length, &usedbytes, &available);396393 if (rc)397394 return(rc);···399396 resNode = resNode->next;400397 }401398402402- // Fill in the number of entries399399+ /* Fill in the number of entries */403400 p_ev_ctrl->bus_avail = loop;404401405402 ctrl = ctrl->next;···407404408405 p_EV_header->num_of_ctrl = numCtrl;409406410410- // Now store the EV407407+ /* Now store the EV */411408412409 temp_dword = usedbytes;413410···452449 struct ev_hrt_header *p_EV_header;453450454451 if (!evbuffer_init) {455455- // Read the resource list information in from NVRAM452452+ /* Read the resource list information in from NVRAM */456453 if (load_HRT(rom_start))457454 memset (evbuffer, 0, 1024);458455459456 evbuffer_init = 1;460457 }461458462462- // If we saved information in NVRAM, use it now459459+ /* If we saved information in NVRAM, use it now */463460 p_EV_header = (struct ev_hrt_header *) evbuffer;464461465465- // The following code is for systems where version 1.0 of this466466- // driver has been loaded, but doesn't support the hardware.467467- // In that case, the driver would incorrectly store something468468- // in NVRAM.462462+ /* The following code is for systems where version 1.0 of this463463+ * driver has been loaded, but doesn't support the hardware.464464+ * In that case, the driver would incorrectly store something465465+ * in NVRAM.466466+ */469467 if ((p_EV_header->Version == 2) ||470468 ((p_EV_header->Version == 1) && !ctrl->push_flag)) {471469 p_byte = &(p_EV_header->next);···495491 if (p_byte > ((u8*)p_EV_header + evbuffer_length))496492 return 2;497493498498- // Skip forward to the next entry494494+ /* Skip forward to the next entry */499495 p_byte += (nummem + numpmem + numio + numbus) * 8;500496501497 if (p_byte > ((u8*)p_EV_header + evbuffer_length))···633629 ctrl->bus_head = bus_node;634630 }635631636636- // If all of the following fail, we don't have any resources for637637- // hot plug add632632+ /* If all of the following fail, we don't have any resources for633633+ * hot plug add634634+ */638635 rc = 1;639636 rc &= cpqhp_resource_sort_and_combine(&(ctrl->mem_head));640637 rc &= cpqhp_resource_sort_and_combine(&(ctrl->p_mem_head));
+173-140
drivers/pci/hotplug/cpqphp_pci.c
···178178 if (!rc)179179 return !rc;180180181181- // set the Edge Level Control Register (ELCR)181181+ /* set the Edge Level Control Register (ELCR) */182182 temp_word = inb(0x4d0);183183 temp_word |= inb(0x4d1) << 8;184184185185 temp_word |= 0x01 << irq_num;186186187187- // This should only be for x86 as it sets the Edge Level Control Register188188- outb((u8) (temp_word & 0xFF), 0x4d0);189189- outb((u8) ((temp_word & 0xFF00) >> 8), 0x4d1);190190- rc = 0;191191- }187187+ /* This should only be for x86 as it sets the Edge Level188188+ * Control Register189189+ */190190+ outb((u8) (temp_word & 0xFF), 0x4d0); outb((u8) ((temp_word &191191+ 0xFF00) >> 8), 0x4d1); rc = 0; }192192193193 return rc;194194}···213213 ctrl->pci_bus->number = bus_num;214214215215 for (tdevice = 0; tdevice < 0xFF; tdevice++) {216216- //Scan for access first216216+ /* Scan for access first */217217 if (PCI_RefinedAccessConfig(ctrl->pci_bus, tdevice, 0x08, &work) == -1)218218 continue;219219 dbg("Looking for nonbridge bus_num %d dev_num %d\n", bus_num, tdevice);220220- //Yep we got one. Not a bridge ?220220+ /* Yep we got one. Not a bridge ? */221221 if ((work >> 8) != PCI_TO_PCI_BRIDGE_CLASS) {222222 *dev_num = tdevice;223223 dbg("found it !\n");···225225 }226226 }227227 for (tdevice = 0; tdevice < 0xFF; tdevice++) {228228- //Scan for access first228228+ /* Scan for access first */229229 if (PCI_RefinedAccessConfig(ctrl->pci_bus, tdevice, 0x08, &work) == -1)230230 continue;231231 dbg("Looking for bridge bus_num %d dev_num %d\n", bus_num, tdevice);232232- //Yep we got one. bridge ?232232+ /* Yep we got one. bridge ? */233233 if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) {234234 pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(tdevice, 0), PCI_SECONDARY_BUS, &tbus);235235 dbg("Recurse on bus_num %d tdevice %d\n", tbus, tdevice);···257257258258 len = (PCIIRQRoutingInfoLength->size -259259 sizeof(struct irq_routing_table)) / sizeof(struct irq_info);260260- // Make sure I got at least one entry260260+ /* Make sure I got at least one entry */261261 if (len == 0) {262262 kfree(PCIIRQRoutingInfoLength );263263 return -1;···304304305305int cpqhp_get_bus_dev (struct controller *ctrl, u8 * bus_num, u8 * dev_num, u8 slot)306306{307307- return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0); //plain (bridges allowed)307307+ /* plain (bridges allowed) */308308+ return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0);308309}309310310311311311-/* More PCI configuration routines; this time centered around hotplug controller */312312+/* More PCI configuration routines; this time centered around hotplug313313+ * controller314314+ */312315313316314317/*···342339 int stop_it;343340 int index;344341345345- // Decide which slots are supported342342+ /* Decide which slots are supported */346343347344 if (is_hot_plug) {348348- //*********************************349349- // is_hot_plug is the slot mask350350- //*********************************345345+ /*346346+ * is_hot_plug is the slot mask347347+ */351348 FirstSupported = is_hot_plug >> 4;352349 LastSupported = FirstSupported + (is_hot_plug & 0x0F) - 1;353350 } else {···355352 LastSupported = 0x1F;356353 }357354358358- // Save PCI configuration space for all devices in supported slots355355+ /* Save PCI configuration space for all devices in supported slots */359356 ctrl->pci_bus->number = busnumber;360357 for (device = FirstSupported; device <= LastSupported; device++) {361358 ID = 0xFFFFFFFF;362359 rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID);363360364364- if (ID != 0xFFFFFFFF) { // device in slot361361+ if (ID != 0xFFFFFFFF) { /* device in slot */365362 rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(device, 0), 0x0B, &class_code);366363 if (rc)367364 return rc;···370367 if (rc)371368 return rc;372369373373- // If multi-function device, set max_functions to 8370370+ /* If multi-function device, set max_functions to 8 */374371 if (header_type & 0x80)375372 max_functions = 8;376373 else···380377381378 do {382379 DevError = 0;383383-384384- if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { // P-P Bridge385385- // Recurse the subordinate bus386386- // get the subordinate bus number380380+ if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {381381+ /* Recurse the subordinate bus382382+ * get the subordinate bus number383383+ */387384 rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(device, function), PCI_SECONDARY_BUS, &secondary_bus);388385 if (rc) {389386 return rc;390387 } else {391388 sub_bus = (int) secondary_bus;392389393393- // Save secondary bus cfg spc394394- // with this recursive call.390390+ /* Save secondary bus cfg spc391391+ * with this recursive call.392392+ */395393 rc = cpqhp_save_config(ctrl, sub_bus, 0);396394 if (rc)397395 return rc;···407403 new_slot = cpqhp_slot_find(busnumber, device, index++);408404409405 if (!new_slot) {410410- // Setup slot structure.406406+ /* Setup slot structure. */411407 new_slot = cpqhp_slot_create(busnumber);412408413409 if (new_slot == NULL)···419415 new_slot->function = (u8) function;420416 new_slot->is_a_board = 1;421417 new_slot->switch_save = 0x10;422422- // In case of unsupported board418418+ /* In case of unsupported board */423419 new_slot->status = DevError;424420 new_slot->pci_dev = pci_find_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function);425421···433429434430 stop_it = 0;435431436436- // this loop skips to the next present function437437- // reading in Class Code and Header type.432432+ /* this loop skips to the next present function433433+ * reading in Class Code and Header type.434434+ */438435439436 while ((function < max_functions)&&(!stop_it)) {440437 rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(device, function), PCI_VENDOR_ID, &ID);441441- if (ID == 0xFFFFFFFF) { // nothing there.438438+ if (ID == 0xFFFFFFFF) { /* nothing there. */442439 function++;443443- } else { // Something there440440+ } else { /* Something there */444441 rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(device, function), 0x0B, &class_code);445442 if (rc)446443 return rc;···455450 }456451457452 } while (function < max_functions);458458- } // End of IF (device in slot?)453453+ } /* End of IF (device in slot?) */459454 else if (is_hot_plug) {460460- // Setup slot structure with entry for empty slot455455+ /* Setup slot structure with entry for empty slot */461456 new_slot = cpqhp_slot_create(busnumber);462457463458 if (new_slot == NULL) {···471466 new_slot->presence_save = 0;472467 new_slot->switch_save = 0;473468 }474474- } // End of FOR loop469469+ } /* End of FOR loop */475470476471 return(0);477472}···503498 ctrl->pci_bus->number = new_slot->bus;504499 pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID);505500506506- if (ID != 0xFFFFFFFF) { // device in slot501501+ if (ID != 0xFFFFFFFF) { /* device in slot */507502 pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), 0x0B, &class_code);508503 pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_HEADER_TYPE, &header_type);509504510510- if (header_type & 0x80) // Multi-function device505505+ if (header_type & 0x80) /* Multi-function device */511506 max_functions = 8;512507 else513508 max_functions = 1;···515510 function = 0;516511517512 do {518518- if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { // PCI-PCI Bridge519519- // Recurse the subordinate bus513513+ if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {514514+ /* Recurse the subordinate bus */520515 pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_SECONDARY_BUS, &secondary_bus);521516522517 sub_bus = (int) secondary_bus;523518524524- // Save the config headers for the secondary bus.519519+ /* Save the config headers for the secondary520520+ * bus.521521+ */525522 rc = cpqhp_save_config(ctrl, sub_bus, 0);526523 if (rc)527524 return(rc);528525 ctrl->pci_bus->number = new_slot->bus;529526530530- } // End of IF527527+ } /* End of IF */531528532529 new_slot->status = 0;533530···541534542535 stop_it = 0;543536544544- // this loop skips to the next present function545545- // reading in the Class Code and the Header type.546546-537537+ /* this loop skips to the next present function538538+ * reading in the Class Code and the Header type.539539+ */547540 while ((function < max_functions) && (!stop_it)) {548541 pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_VENDOR_ID, &ID);549542550550- if (ID == 0xFFFFFFFF) { // nothing there.543543+ if (ID == 0xFFFFFFFF) { /* nothing there. */551544 function++;552552- } else { // Something there545545+ } else { /* Something there */553546 pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), 0x0B, &class_code);554547555548 pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_HEADER_TYPE, &header_type);···559552 }560553561554 } while (function < max_functions);562562- } // End of IF (device in slot?)555555+ } /* End of IF (device in slot?) */563556 else {564557 return 2;565558 }···597590 pci_bus->number = func->bus;598591 devfn = PCI_DEVFN(func->device, func->function);599592600600- // Check for Bridge593593+ /* Check for Bridge */601594 pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);602595603596 if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {604604- // PCI-PCI Bridge605597 pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);606598607599 sub_bus = (int) secondary_bus;···616610 }617611 pci_bus->number = func->bus;618612619619- //FIXME: this loop is duplicated in the non-bridge case. The two could be rolled together620620- // Figure out IO and memory base lengths613613+ /* FIXME: this loop is duplicated in the non-bridge614614+ * case. The two could be rolled together Figure out615615+ * IO and memory base lengths616616+ */621617 for (cloop = 0x10; cloop <= 0x14; cloop += 4) {622618 temp_register = 0xFFFFFFFF;623619 pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);624620 pci_bus_read_config_dword (pci_bus, devfn, cloop, &base);625625-626626- if (base) { // If this register is implemented621621+ /* If this register is implemented */622622+ if (base) {627623 if (base & 0x01L) {628628- // IO base629629- // set base = amount of IO space requested624624+ /* IO base625625+ * set base = amount of IO space626626+ * requested627627+ */630628 base = base & 0xFFFFFFFE;631629 base = (~base) + 1;632630633631 type = 1;634632 } else {635635- // memory base633633+ /* memory base */636634 base = base & 0xFFFFFFF0;637635 base = (~base) + 1;638636···647637 type = 0;648638 }649639650650- // Save information in slot structure640640+ /* Save information in slot structure */651641 func->base_length[(cloop - 0x10) >> 2] =652642 base;653643 func->base_type[(cloop - 0x10) >> 2] = type;654644655655- } // End of base register loop645645+ } /* End of base register loop */656646657657-658658- } else if ((header_type & 0x7F) == 0x00) { // PCI-PCI Bridge659659- // Figure out IO and memory base lengths647647+ } else if ((header_type & 0x7F) == 0x00) {648648+ /* Figure out IO and memory base lengths */660649 for (cloop = 0x10; cloop <= 0x24; cloop += 4) {661650 temp_register = 0xFFFFFFFF;662651 pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);663652 pci_bus_read_config_dword (pci_bus, devfn, cloop, &base);664653665665- if (base) { // If this register is implemented654654+ /* If this register is implemented */655655+ if (base) {666656 if (base & 0x01L) {667667- // IO base668668- // base = amount of IO space requested657657+ /* IO base658658+ * base = amount of IO space659659+ * requested660660+ */669661 base = base & 0xFFFFFFFE;670662 base = (~base) + 1;671663672664 type = 1;673665 } else {674674- // memory base675675- // base = amount of memory space requested666666+ /* memory base667667+ * base = amount of memory668668+ * space requested669669+ */676670 base = base & 0xFFFFFFF0;677671 base = (~base) + 1;678672···687673 type = 0;688674 }689675690690- // Save information in slot structure676676+ /* Save information in slot structure */691677 func->base_length[(cloop - 0x10) >> 2] = base;692678 func->base_type[(cloop - 0x10) >> 2] = type;693679694694- } // End of base register loop680680+ } /* End of base register loop */695681696696- } else { // Some other unknown header type682682+ } else { /* Some other unknown header type */697683 }698684699699- // find the next device in this slot685685+ /* find the next device in this slot */700686 func = cpqhp_slot_find(func->bus, func->device, index++);701687 }702688···742728 pci_bus->number = func->bus;743729 devfn = PCI_DEVFN(func->device, func->function);744730745745- // Save the command register731731+ /* Save the command register */746732 pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &save_command);747733748748- // disable card734734+ /* disable card */749735 command = 0x00;750736 pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command);751737752752- // Check for Bridge738738+ /* Check for Bridge */753739 pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type);754740755755- if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { // PCI-PCI Bridge756756- // Clear Bridge Control Register741741+ if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {742742+ /* Clear Bridge Control Register */757743 command = 0x00;758744 pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command);759745 pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);···769755 bus_node->next = func->bus_head;770756 func->bus_head = bus_node;771757772772- // Save IO base and Limit registers758758+ /* Save IO base and Limit registers */773759 pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_BASE, &b_base);774760 pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_LIMIT, &b_length);775761···785771 func->io_head = io_node;786772 }787773788788- // Save memory base and Limit registers774774+ /* Save memory base and Limit registers */789775 pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_BASE, &w_base);790776 pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);791777···801787 func->mem_head = mem_node;802788 }803789804804- // Save prefetchable memory base and Limit registers790790+ /* Save prefetchable memory base and Limit registers */805791 pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);806792 pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);807793···816802 p_mem_node->next = func->p_mem_head;817803 func->p_mem_head = p_mem_node;818804 }819819- // Figure out IO and memory base lengths805805+ /* Figure out IO and memory base lengths */820806 for (cloop = 0x10; cloop <= 0x14; cloop += 4) {821807 pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base);822808···826812827813 temp_register = base;828814829829- if (base) { // If this register is implemented815815+ /* If this register is implemented */816816+ if (base) {830817 if (((base & 0x03L) == 0x01)831818 && (save_command & 0x01)) {832832- // IO base833833- // set temp_register = amount of IO space requested819819+ /* IO base820820+ * set temp_register = amount821821+ * of IO space requested822822+ */834823 temp_register = base & 0xFFFFFFFE;835824 temp_register = (~temp_register) + 1;836825···851834 } else852835 if (((base & 0x0BL) == 0x08)853836 && (save_command & 0x02)) {854854- // prefetchable memory base837837+ /* prefetchable memory base */855838 temp_register = base & 0xFFFFFFF0;856839 temp_register = (~temp_register) + 1;857840···868851 } else869852 if (((base & 0x0BL) == 0x00)870853 && (save_command & 0x02)) {871871- // prefetchable memory base854854+ /* prefetchable memory base */872855 temp_register = base & 0xFFFFFFF0;873856 temp_register = (~temp_register) + 1;874857···885868 } else886869 return(1);887870 }888888- } // End of base register loop889889- } else if ((header_type & 0x7F) == 0x00) { // Standard header890890- // Figure out IO and memory base lengths871871+ } /* End of base register loop */872872+ /* Standard header */873873+ } else if ((header_type & 0x7F) == 0x00) {874874+ /* Figure out IO and memory base lengths */891875 for (cloop = 0x10; cloop <= 0x24; cloop += 4) {892876 pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base);893877···898880899881 temp_register = base;900882901901- if (base) { // If this register is implemented883883+ /* If this register is implemented */884884+ if (base) {902885 if (((base & 0x03L) == 0x01)903886 && (save_command & 0x01)) {904904- // IO base905905- // set temp_register = amount of IO space requested887887+ /* IO base888888+ * set temp_register = amount889889+ * of IO space requested890890+ */906891 temp_register = base & 0xFFFFFFFE;907892 temp_register = (~temp_register) + 1;908893···922901 } else923902 if (((base & 0x0BL) == 0x08)924903 && (save_command & 0x02)) {925925- // prefetchable memory base904904+ /* prefetchable memory base */926905 temp_register = base & 0xFFFFFFF0;927906 temp_register = (~temp_register) + 1;928907···939918 } else940919 if (((base & 0x0BL) == 0x00)941920 && (save_command & 0x02)) {942942- // prefetchable memory base921921+ /* prefetchable memory base */943922 temp_register = base & 0xFFFFFFF0;944923 temp_register = (~temp_register) + 1;945924···956935 } else957936 return(1);958937 }959959- } // End of base register loop960960- } else { // Some other unknown header type938938+ } /* End of base register loop */939939+ /* Some other unknown header type */940940+ } else {961941 }962942963963- // find the next device in this slot943943+ /* find the next device in this slot */964944 func = cpqhp_slot_find(func->bus, func->device, index++);965945 }966946···997975 pci_bus->number = func->bus;998976 devfn = PCI_DEVFN(func->device, func->function);99997710001000- // Start at the top of config space so that the control10011001- // registers are programmed last978978+ /* Start at the top of config space so that the control979979+ * registers are programmed last980980+ */1002981 for (cloop = 0x3C; cloop > 0; cloop -= 4) {1003982 pci_bus_write_config_dword (pci_bus, devfn, cloop, func->config_space[cloop >> 2]);1004983 }10059841006985 pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);100798610081008- // If this is a bridge device, restore subordinate devices10091009- if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { // PCI-PCI Bridge987987+ /* If this is a bridge device, restore subordinate devices */988988+ if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {1010989 pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);10119901012991 sub_bus = (int) secondary_bus;···10231000 }10241001 } else {1025100210261026- // Check all the base Address Registers to make sure10271027- // they are the same. If not, the board is different.10031003+ /* Check all the base Address Registers to make sure10041004+ * they are the same. If not, the board is different.10051005+ */1028100610291007 for (cloop = 16; cloop < 40; cloop += 4) {10301008 pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp);···1082105810831059 pci_bus_read_config_dword (pci_bus, devfn, PCI_VENDOR_ID, &temp_register);1084106010851085- // No adapter present10611061+ /* No adapter present */10861062 if (temp_register == 0xFFFFFFFF)10871063 return(NO_ADAPTER_PRESENT);1088106410891065 if (temp_register != func->config_space[0])10901066 return(ADAPTER_NOT_SAME);1091106710921092- // Check for same revision number and class code10681068+ /* Check for same revision number and class code */10931069 pci_bus_read_config_dword (pci_bus, devfn, PCI_CLASS_REVISION, &temp_register);1094107010951095- // Adapter not the same10711071+ /* Adapter not the same */10961072 if (temp_register != func->config_space[0x08 >> 2])10971073 return(ADAPTER_NOT_SAME);1098107410991099- // Check for Bridge10751075+ /* Check for Bridge */11001076 pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);1101107711021102- if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { // PCI-PCI Bridge11031103- // In order to continue checking, we must program the11041104- // bus registers in the bridge to respond to accesses11051105- // for it's subordinate bus(es)10781078+ if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {10791079+ /* In order to continue checking, we must program the10801080+ * bus registers in the bridge to respond to accesses10811081+ * for its subordinate bus(es)10821082+ */1106108311071084 temp_register = func->config_space[0x18 >> 2];11081085 pci_bus_write_config_dword (pci_bus, devfn, PCI_PRIMARY_BUS, temp_register);···11211096 }1122109711231098 }11241124- // Check to see if it is a standard config header10991099+ /* Check to see if it is a standard config header */11251100 else if ((header_type & 0x7F) == PCI_HEADER_TYPE_NORMAL) {11261126- // Check subsystem vendor and ID11011101+ /* Check subsystem vendor and ID */11271102 pci_bus_read_config_dword (pci_bus, devfn, PCI_SUBSYSTEM_VENDOR_ID, &temp_register);1128110311291104 if (temp_register != func->config_space[0x2C >> 2]) {11301130- // If it's a SMART-2 and the register isn't filled11311131- // in, ignore the difference because11321132- // they just have an old rev of the firmware11331133-11051105+ /* If it's a SMART-2 and the register isn't11061106+ * filled in, ignore the difference because11071107+ * they just have an old rev of the firmware11081108+ */11341109 if (!((func->config_space[0] == 0xAE100E11)11351110 && (temp_register == 0x00L)))11361111 return(ADAPTER_NOT_SAME);11371112 }11381138- // Figure out IO and memory base lengths11131113+ /* Figure out IO and memory base lengths */11391114 for (cloop = 0x10; cloop <= 0x24; cloop += 4) {11401115 temp_register = 0xFFFFFFFF;11411116 pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);11421117 pci_bus_read_config_dword (pci_bus, devfn, cloop, &base);11431143- if (base) { // If this register is implemented11181118+11191119+ /* If this register is implemented */11201120+ if (base) {11441121 if (base & 0x01L) {11451145- // IO base11461146- // set base = amount of IO space requested11221122+ /* IO base11231123+ * set base = amount of IO11241124+ * space requested11251125+ */11471126 base = base & 0xFFFFFFFE;11481127 base = (~base) + 1;1149112811501129 type = 1;11511130 } else {11521152- // memory base11311131+ /* memory base */11531132 base = base & 0xFFFFFFF0;11541133 base = (~base) + 1;11551134···11641135 type = 0;11651136 }1166113711671167- // Check information in slot structure11381138+ /* Check information in slot structure */11681139 if (func->base_length[(cloop - 0x10) >> 2] != base)11691140 return(ADAPTER_NOT_SAME);1170114111711142 if (func->base_type[(cloop - 0x10) >> 2] != type)11721143 return(ADAPTER_NOT_SAME);1173114411741174- } // End of base register loop11451145+ } /* End of base register loop */1175114611761176- } // End of (type 0 config space) else11471147+ } /* End of (type 0 config space) else */11771148 else {11781178- // this is not a type 0 or 1 config space header so11791179- // we don't know how to do it11491149+ /* this is not a type 0 or 1 config space header so11501150+ * we don't know how to do it11511151+ */11801152 return(DEVICE_TYPE_NOT_SUPPORTED);11811153 }1182115411831183- // Get the next function11551155+ /* Get the next function */11841156 func = cpqhp_slot_find(func->bus, func->device, index++);11851157 }11861158···12201190 if (rom_resource_table == NULL) {12211191 return -ENODEV;12221192 }12231223- // Sum all resources and setup resource maps11931193+ /* Sum all resources and setup resource maps */12241194 unused_IRQ = readl(rom_resource_table + UNUSED_IRQ);12251195 dbg("unused_IRQ = %x\n", unused_IRQ);12261196···12921262 dev_func, io_base, io_length, mem_base, mem_length, pre_mem_base, pre_mem_length,12931263 primary_bus, secondary_bus, max_bus);1294126412951295- // If this entry isn't for our controller's bus, ignore it12651265+ /* If this entry isn't for our controller's bus, ignore it */12961266 if (primary_bus != ctrl->bus) {12971267 i--;12981268 one_slot += sizeof (struct slot_rt);12991269 continue;13001270 }13011301- // find out if this entry is for an occupied slot12711271+ /* find out if this entry is for an occupied slot */13021272 ctrl->pci_bus->number = primary_bus;13031273 pci_bus_read_config_dword (ctrl->pci_bus, dev_func, PCI_VENDOR_ID, &temp_dword);13041274 dbg("temp_D_word = %x\n", temp_dword);···13121282 func = cpqhp_slot_find(primary_bus, dev_func >> 3, index++);13131283 }1314128413151315- // If we can't find a match, skip this table entry12851285+ /* If we can't find a match, skip this table entry */13161286 if (!func) {13171287 i--;13181288 one_slot += sizeof (struct slot_rt);13191289 continue;13201290 }13211321- // this may not work and shouldn't be used12911291+ /* this may not work and shouldn't be used */13221292 if (secondary_bus != primary_bus)13231293 bridged_slot = 1;13241294 else···13311301 }133213021333130313341334- // If we've got a valid IO base, use it13041304+ /* If we've got a valid IO base, use it */1335130513361306 temp_dword = io_base + io_length;13371307···13551325 }13561326 }1357132713581358- // If we've got a valid memory base, use it13281328+ /* If we've got a valid memory base, use it */13591329 temp_dword = mem_base + mem_length;13601330 if ((mem_base) && (temp_dword < 0x10000)) {13611331 mem_node = kmalloc(sizeof(*mem_node), GFP_KERNEL);···13781348 }13791349 }1380135013811381- // If we've got a valid prefetchable memory base, and13821382- // the base + length isn't greater than 0xFFFF13511351+ /* If we've got a valid prefetchable memory base, and13521352+ * the base + length isn't greater than 0xFFFF13531353+ */13831354 temp_dword = pre_mem_base + pre_mem_length;13841355 if ((pre_mem_base) && (temp_dword < 0x10000)) {13851356 p_mem_node = kmalloc(sizeof(*p_mem_node), GFP_KERNEL);···14031372 }14041373 }1405137414061406- // If we've got a valid bus number, use it14071407- // The second condition is to ignore bus numbers on14081408- // populated slots that don't have PCI-PCI bridges13751375+ /* If we've got a valid bus number, use it13761376+ * The second condition is to ignore bus numbers on13771377+ * populated slots that don't have PCI-PCI bridges13781378+ */14091379 if (secondary_bus && (secondary_bus != primary_bus)) {14101380 bus_node = kmalloc(sizeof(*bus_node), GFP_KERNEL);14111381 if (!bus_node)···14301398 one_slot += sizeof (struct slot_rt);14311399 }1432140014331433- // If all of the following fail, we don't have any resources for14341434- // hot plug add14011401+ /* If all of the following fail, we don't have any resources for14021402+ * hot plug add14031403+ */14351404 rc = 1;14361405 rc &= cpqhp_resource_sort_and_combine(&(ctrl->mem_head));14371406 rc &= cpqhp_resource_sort_and_combine(&(ctrl->p_mem_head));