3/4 PCI Hot-plug driver patch for 2.5.74 kernel
PATCH 1/1 3/4 PCI Hot-plug driver patch for 2.5.74 kernel
Part 3 of 4 PCI Hot-plug driver patch for 2.5.74 kernel
drivers/pci/hotplug/cpqphp_hpc.c +1203 -0
@@ -0,0 +1,1203 @@ +/* +* Compaq PCI Hot Plug Driver +* +* Copyright (c) 1995,2001 Compaq Computer Corporation +* +* All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or +* NON INFRINGEMENT. See the GNU General Public License for more +* details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* Send feedback to <[email protected]> +* +*/ + +#include <linux/config.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/types.h> +#include <linux/slab.h> +#include <linux/vmalloc.h> +#include <linux/interrupt.h> +#include <linux/spinlock.h> +#include <linux/pci.h> +#include <linux/delay.h> /* for delays */ +#include <asm/system.h> +#include "cpqphp.h" + +#ifdef DEBUG +#define DBG_K_TRACE_ENTRY ((unsigned int)0x00000001)/* On function entry */ +#define DBG_K_TRACE_EXIT ((unsigned int)0x00000002)/* On function exit */ +#define DBG_K_INFO ((unsigned int)0x00000004)/* Info messages */ +#define DBG_K_ERROR ((unsigned int)0x00000008)/* Error messages */ +#define DBG_K_TRACE (DBG_K_TRACE_ENTRY|DBG_K_TRACE_EXIT) +#define DBG_K_STANDARD (DBG_K_INFO|DBG_K_ERROR|DBG_K_TRACE) +/* Redefine this flagword to set debug level */ +#define DEBUG_LEVEL DBG_K_STANDARD + +#define DEFINE_DBG_BUFFER char __dbg_str_buf[256]; + +#define DBG_PRINT( dbg_flags, args... ) \ + do { \ + if ( DEBUG_LEVEL & ( dbg_flags ) ) \ + { \ + int len; \ + len = sprintf( __dbg_str_buf, "%s:%d: %s: ", \ + __FILE__, __LINE__, __FUNCTION__ ); \ + sprintf( __dbg_str_buf + len, args ); \ + printk( KERN_NOTICE "%s\n", __dbg_str_buf ); \ + } \ + } while (0) + +#define DBG_ENTER_ROUTINE DBG_PRINT (DBG_K_TRACE_ENTRY, "%s", "[Entry]"); +#define DBG_LEAVE_ROUTINE DBG_PRINT (DBG_K_TRACE_EXIT, "%s", "[Exit]"); +#else +#define DEFINE_DBG_BUFFER +#define DBG_ENTER_ROUTINE +#define DBG_LEAVE_ROUTINE +#endif /* DEBUG */ + +struct ctrl_reg {/* offset */ +u8 slot_RST;/* 0x00 */ +u8 slot_enable;/* 0x01 */ +u16 misc;/* 0x02 */ +u32 led_control;/* 0x04 */ +u32 int_input_clear;/* 0x08 */ +u32 int_mask;/* 0x0a */ +u8 reserved0;/* 0x10 */ +u8 reserved1;/* 0x11 */ +u8 reserved2;/* 0x12 */ +u8 gen_output_AB;/* 0x13 */ +u32 non_int_input;/* 0x14 */ +u32 reserved3;/* 0x18 */ +u32 reserved4;/* 0x1a */ +u32 reserved5;/* 0x20 */ +u8 reserved6;/* 0x24 */ +u8 reserved7;/* 0x25 */ +u16 reserved8;/* 0x26 */ +u8 slot_mask;/* 0x28 */ +u8 reserved9;/* 0x29 */ +u8 reserved10;/* 0x2a */ +u8 reserved11;/* 0x2b */ +u8 slot_SERR;/* 0x2c */ +u8 slot_power;/* 0x2d */ +u8 reserved12;/* 0x2e */ +u8 reserved13;/* 0x2f */ +u8 next_curr_freq;/* 0x30 */ +u8 reset_freq_mode;/* 0x31 */ + +} __attribute__ ((packed)); + +/* offsets to the controller registers based on the above structure layout */ +enum ctrl_offsets { +SLOT_RST = offsetof(struct ctrl_reg , slot_RST), +SLOT_ENABLE = offsetof(struct ctrl_reg , slot_enable), +MISC = offsetof(struct ctrl_reg , misc), +LED_CONTROL = offsetof(struct ctrl_reg , led_control), +INT_INPUT_CLEAR = offsetof(struct ctrl_reg , int_input_clear), +INT_MASK = offsetof(struct ctrl_reg , int_mask), +CTRL_RESERVED0 = offsetof(struct ctrl_reg , reserved0), +CTRL_RESERVED1 = offsetof(struct ctrl_reg , reserved1), +CTRL_RESERVED2 = offsetof(struct ctrl_reg , reserved1), +GEN_OUTPUT_AB = offsetof(struct ctrl_reg , gen_output_AB), +NON_INT_INPUT = offsetof(struct ctrl_reg , non_int_input), +CTRL_RESERVED3 = offsetof(struct ctrl_reg , reserved3), +CTRL_RESERVED4 = offsetof(struct ctrl_reg , reserved4), +CTRL_RESERVED5 = offsetof(struct ctrl_reg , reserved5), +CTRL_RESERVED6 = offsetof(struct ctrl_reg , reserved6), +CTRL_RESERVED7 = offsetof(struct ctrl_reg , reserved7), +CTRL_RESERVED8 = offsetof(struct ctrl_reg , reserved8), +SLOT_MASK = offsetof(struct ctrl_reg , slot_mask), +CTRL_RESERVED9 = offsetof(struct ctrl_reg , reserved9), +CTRL_RESERVED10 = offsetof(struct ctrl_reg , reserved10), +CTRL_RESERVED11 = offsetof(struct ctrl_reg , reserved11), +SLOT_SERR = offsetof(struct ctrl_reg , slot_SERR), +SLOT_POWER = offsetof(struct ctrl_reg , slot_power), +CTRL_RESERVED12 = offsetof(struct ctrl_reg , reserved12), +CTRL_RESERVED13 = offsetof(struct ctrl_reg , reserved13), +NEXT_CURR_FREQ = offsetof(struct ctrl_reg , next_curr_freq), +RESET_FREQ_MODE = offsetof(struct ctrl_reg , reset_freq_mode), +}; + + +struct sema_struct { +struct semaphore crit_sect; +int owner_id; +int count; +}; + +struct php_ctlr_state_s { +struct php_ctlr_state_s *pnext; +struct pci_dev *pci_dev; +unsigned int irq; +struct sema_struct hwlock; +unsigned long flags;/* spinlock's */ +u32 ctrl_int_comp;/* interrupt comparator */ +u32 first_device_num; +u32 num_slots; +u16 ctlrcap; +php_intr_callback_t switch_change_callback; +php_intr_callback_t presence_change_callback; +php_intr_callback_t power_fault_callback; +void *callback_instance_id; +void *creg;/* Ptr to controller register space */ +}; + + +spinlock_t hpc_event_lock; + +DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ +static struct php_ctlr_state_s *php_ctlr_list_head = 0; /* HPC state linked list */ +static int ctlr_seq_num =0 ;/* Controller sequenc # */ + +static irqreturn_t hpc_isr (int IRQ ,void *dev_id,struct pt_regs *regs); + +static wait_queue_head_t delay_wait_q_head; + +/* delay in jiffies to wait */ +static void longdelay (int delay) +{ +init_waitqueue_head (&delay_wait_q_head); + +interruptible_sleep_on_timeout (&delay_wait_q_head, delay); +} + +static void cpqhpc_set_SOGO (struct slot *slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u16 misc; + + misc =readw (php_ctlr->creg +MISC ); + misc = (misc |0x0001 ) &0xFFFB ; +writew (misc, php_ctlr->creg +MISC ); +} + +static int cpqhpc_wait_for_SOBS (struct slot *slot) +{ +DECLARE_WAITQUEUE (wait, current); +int retval =0 ; + + DBG_ENTER_ROUTINE + + add_wait_queue(&slot->ctrl->queue, &wait); +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (2 *HZ ); +set_current_state (TASK_RUNNING ); +remove_wait_queue (&slot->ctrl->queue, &wait); +if (signal_pending (current)) + retval = -EINTR ; + +DBG_LEAVE_ROUTINE + return retval; +} + +static void hpc_update_hpc (struct slot *slot) +{ +cpqhpc_set_SOGO (slot); +cpqhpc_wait_for_SOBS (slot); +} + +static int hpc_get_attention_status (struct slot *slot,u8 *status) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 led_control; + +DBG_ENTER_ROUTINE + + led_control =readl (php_ctlr->creg +LED_CONTROL ); + led_control &= (0x01010000L << slot->hp_slot); + *status = led_control ?1 :0 ; + +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_get_power_status (struct slot * slot,u8 *status) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u8 slot_enable; + +DBG_ENTER_ROUTINE + + slot_enable =readb (php_ctlr->creg +SLOT_ENABLE ); + slot_enable &= (0x01L << slot->hp_slot); + *status = slot_enable ?1 :0 ; + +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_get_latch_status (struct slot *slot,u8 *status) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 latch_status; + +DBG_ENTER_ROUTINE + + latch_status = (readl (php_ctlr->creg +INT_INPUT_CLEAR ) & (0x01L << slot->hp_slot)); + *status = (latch_status ==0 ) ?1 :0 ; + +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_get_adapter_status (struct slot *slot,u8 *status) +{ +u8 presence_save =0 ; +u32 tempdword; +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; + +DBG_ENTER_ROUTINE + + tempdword =readl (php_ctlr->creg +INT_INPUT_CLEAR ); + presence_save = (u8) ((((~tempdword) >>23 ) | ((~tempdword) >>15 )) >> slot->hp_slot) &0x02 ; + + *status = (presence_save !=0 ) ?1 :0 ; + +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_query_power_fault (struct slot * slot) +{ +u32 status; +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 tempdword; + +DBG_ENTER_ROUTINE + + tempdword =readl (php_ctlr->creg +INT_INPUT_CLEAR ); + status = (tempdword & (0x00000100 << slot->hp_slot)); + +DBG_LEAVE_ROUTINE +/* Note: Logic 0 => fault */ + return status ? 0 : 1; +} + +/* +* change to call set_led_state() +*/ + +static void hpc_set_attention_status (struct slot *slot,u8 status) +{ +struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 led_control; + +switch (status) { +case 0 : + led_control =readl (php_ctlr->creg +LED_CONTROL ); + led_control &= ~(0x01010000L << slot->hp_slot); +writel (led_control, php_ctlr->creg +LED_CONTROL ); +break ; +case 1 : + led_control =readl (php_ctlr->creg +LED_CONTROL ); + led_control |= (0x01010000L << slot->hp_slot); +writel (led_control, php_ctlr->creg +LED_CONTROL ); +break ; + } +} + +static void hpc_green_led_on (struct slot * slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 led_control; + + led_control =readl (php_ctlr->creg +LED_CONTROL ); + led_control |=0x0101L << slot->hp_slot; +writel (led_control, php_ctlr->creg +LED_CONTROL ); + +} + +static void hpc_green_led_off (struct slot * slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 led_control; + + led_control =readl (php_ctlr->creg +LED_CONTROL ); + led_control &= ~(0x0101L << slot->hp_slot); +writel (led_control, php_ctlr->creg +LED_CONTROL ); + +} + +static void hpc_green_led_blink (struct slot * slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 led_control; + + led_control =readl (php_ctlr->creg +LED_CONTROL ); + led_control &= ~(0x0101L << slot->hp_slot); + led_control |= (0x0001L << slot->hp_slot); +writel (led_control, php_ctlr->creg +LED_CONTROL ); + +} + +/* +* 0: all 4 variables set +* 1: no physical_slot_num +*/ +int phphpc_get_ctlr_slot_config (struct controller *ctrl, +int *num_ctlr_slots,/* number of slots in this HPC */ +int *first_device_num,/* PCI dev num of the first slot in this HPC */ +int *physical_slot_num,/* phy slot num of the first slot in this HPC */ +int *updown,/* physical_slot_num increament: 1 or -1 */ +int *flags) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; + +DBG_ENTER_ROUTINE + + * first_device_num = php_ctlr->first_device_num; + *num_ctlr_slots = php_ctlr->num_slots; + +/* this HPC does not conform to SHPC and provides no physical_slot_num. */ + *physical_slot_num =-1 ; + + *updown =1 ;/* could be -1 in SHPC */ + *flags =1 ; +DBG_LEAVE_ROUTINE + return 0; +} + +static void hpc_release_ctlr (struct controller *ctrl) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; +struct php_ctlr_state_s *p, *p_prev; + +DBG_ENTER_ROUTINE + + if (php_ctlr->irq) { +free_irq (php_ctlr->irq, ctrl); + php_ctlr->irq =0 ; + } + +if (php_ctlr->pci_dev) { +iounmap ((void *)pci_resource_start (php_ctlr->pci_dev,0 )); +release_mem_region (pci_resource_start (php_ctlr->pci_dev,0 ),pci_resource_len (php_ctlr->pci_dev,0 )); + php_ctlr->pci_dev =0 ; + } + + p = php_ctlr_list_head; + p_prev =NULL ; +while (p) { +if (p == php_ctlr) { +if (p_prev) + p_prev->pnext = p->pnext; +else + php_ctlr_list_head = p->pnext; +break ; + }else { + p_prev = p; + p = p->pnext; + } + } + +kfree (php_ctlr); + + DBG_LEAVE_ROUTINE +} + +static int hpc_power_on_slot (struct slot * slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u8 slot_enable; + +DBG_ENTER_ROUTINE + + slot_enable =readb (php_ctlr->creg +SLOT_ENABLE ); + slot_enable |= (0x01 << slot->hp_slot); +writeb (slot_enable, php_ctlr->creg +SLOT_ENABLE ); + +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_power_off_slot (struct slot * slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u8 slot_enable; + +DBG_ENTER_ROUTINE + + slot_enable =readb (php_ctlr->creg +SLOT_ENABLE ); + slot_enable &= ~(0x01 << slot->hp_slot); +writeb (slot_enable, php_ctlr->creg +SLOT_ENABLE ); + +DBG_LEAVE_ROUTINE + + return 0; +} + +static void hpc_enable_msl_interrupt (struct slot *slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 rc; +u16 misc; + +DBG_ENTER_ROUTINE + + if (php_ctlr->creg) { + rc =readb (php_ctlr->creg +SLOT_ENABLE ); + +writeb (rc, php_ctlr->creg +SLOT_SERR ); +writel (0xFFFFFFC0L | ~rc, php_ctlr->creg +INT_MASK ); + + misc =readw (php_ctlr->creg +MISC ); + misc &=0xFFFD ; +writew (misc, php_ctlr->creg +MISC ); + } + + DBG_LEAVE_ROUTINE +} + +static u32 hpc_get_slot_capability (struct slot *slot) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 slot_state =0 , temp; +u8 slot_enable; + +DBG_ENTER_ROUTINE + + temp =readl (php_ctlr->creg +INT_INPUT_CLEAR ); + +/* Check presence */ + slot_state |= ((((~temp) >>23 ) | ((~temp) >>15 )) >> slot->hp_slot) &0x02 ; +/* Check the switch state */ + slot_state |= ((~temp &0xFF ) >> slot->hp_slot) &0x01 ; +/* Check the slot enable */ + slot_enable =readb (php_ctlr->creg +SLOT_ENABLE ); + slot_state |= ((slot_enable <<2 ) >> slot->hp_slot) &0x04 ; + +return slot_state; + + DBG_LEAVE_ROUTINE +} + +static irqreturn_t hpc_isr (int IRQ ,void *dev_id,struct pt_regs *regs) +{ +struct controller *ctrl = (struct controller *)dev_id; +struct php_ctlr_state_s *php_ctlr; +u8 schedule_flag =0 ; +u32 Diff; +u32 temp_dword; +u16 misc; +u8 reset; + +if (!ctrl || !(php_ctlr = ctrl->hpc_ctlr_handle) || !php_ctlr->creg) +return IRQ_NONE ; + +/* Check to see if it was our interrupt */ + misc =readw (php_ctlr->creg +MISC ); +if (!(misc &0x000C )) +return IRQ_NONE ; + +if (misc &0x0004 ) { +/* Serial Output interrupt Pending */ + misc |=0x0004 ;/* Clear the interrupt */ +writew (misc, php_ctlr->creg +MISC ); + misc =readw (php_ctlr->creg +MISC );/* Read to clear posted writes */ +wake_up_interruptible (&ctrl->queue); + } + +if (misc &0x0008 ) { +/* General-interrupt-input interrupt Pending */ + Diff =readl (php_ctlr->creg +INT_INPUT_CLEAR ) ^ php_ctlr->ctrl_int_comp; + + php_ctlr->ctrl_int_comp =readl (php_ctlr->creg +INT_INPUT_CLEAR ); + +writel (Diff, php_ctlr->creg +INT_INPUT_CLEAR );/* Clear the interrupt */ + +/* Read it back to clear any posted writes */ + temp_dword =readl (php_ctlr->creg +INT_INPUT_CLEAR ); + +if (!Diff) +writel (0xFFFFFFFF , php_ctlr->creg +INT_INPUT_CLEAR );/* Clear all interrupts */ + +if (php_ctlr->switch_change_callback) + schedule_flag += php_ctlr->switch_change_callback ( + (Diff &0xFFL ), php_ctlr->callback_instance_id); +if (php_ctlr->presence_change_callback) + schedule_flag += php_ctlr->presence_change_callback ( + ((Diff &0xFFFF0000L ) >>16 ), php_ctlr->callback_instance_id); +if (php_ctlr->power_fault_callback) + schedule_flag += php_ctlr->power_fault_callback ( + ((Diff &0xFF00L ) >>8 ), php_ctlr->callback_instance_id); + } + +/* Setting bus speed is applicable only to Compaq HPC with rev >= 0x13 +* or with subsystem_device == PCI_SUB_HPC_ID4 +*/ +if ((ctrl->pci_dev->subsystem_vendor ==PCI_VENDOR_ID_COMPAQ ) && + ((ctrl->rev >=0x13 ) || (ctrl->pci_dev->subsystem_device ==PCI_SUB_HPC_ID4 ))) { + reset =readb (php_ctlr->creg +RESET_FREQ_MODE ); +if (reset &0x40 ) { +/* Bus reset has completed */ + reset &=0xCF ; +writeb (reset, php_ctlr->creg +RESET_FREQ_MODE ); + reset =readb (php_ctlr->creg +RESET_FREQ_MODE ); +wake_up_interruptible (&ctrl->queue); + } + } +return IRQ_HANDLED ; +} + +int phphpc_get_ctrl_cap (struct controller *ctrl,u16 * pctlrcap,u8 * prev) +{ +u16 vendor_id; +u16 subsystem_vid; +u16 subsystem_did; +u32 rc; +u8 bus_cap; +struct pci_dev *pdev; +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; + + DBG_ENTER_ROUTINE + + if (!ctrl->hpc_ctlr_handle) { +err ("Process %d: Invalid HPC controller handle!\n" , current->pid); +return -1 ; + } + +if (!pctlrcap) { +err ("Process %d: Invalid HPC ctrlcap pointer passed in!\n" , current->pid); +return -1 ; + } + +if (!prev) { +err ("Process %d: Invalid HPC rev pointer passed in!\n" , current->pid); +return -1 ; + } + +dbg ("Pass in ctlrcap = %x\n" , *pctlrcap); + +if (!php_ctlr->pci_dev) { +err ("Process %d: Invalid HPC controller pci_dev!\n" , current->pid); +return -1 ; + } + + pdev = php_ctlr->pci_dev; + +/* Need to read VID early b/c it's used to differentiate CPQ and INTC discovery */ + vendor_id = pdev->vendor; +if ((vendor_id !=PCI_VENDOR_ID_COMPAQ ) && (vendor_id !=PCI_VENDOR_ID_INTEL )) { +err ("%s: HPC controller(vendor=%x) not supported by this driver!\n" , __FUNCTION__, vendor_id); +return -1 ; + } + + rc =pci_read_config_byte (pdev,PCI_REVISION_ID , prev); +dbg ("Vendor ID: %x revision: %x\n" , vendor_id, *prev); +if (rc || ((vendor_id ==PCI_VENDOR_ID_COMPAQ ) && (!(*prev)))) { +err ("%s: Unsupported revision of HPC controller found!\n" , __FUNCTION__); +return -1 ; + } + +/* +* Check for the proper subsytem ID's +* Intel uses a different SSID programming model than Compaq. For Intel, each +* SSID bit identifies a PHP capability. +* Also Intel HPC's may have RID=0. +*/ +if ((*prev >2 ) || (vendor_id ==PCI_VENDOR_ID_INTEL )) { + subsystem_vid = pdev->subsystem_vendor; + subsystem_did = pdev->subsystem_device; +dbg ("Sub-Vendor ID: %x, Sub-Device ID: %x\n" , subsystem_vid, subsystem_did); +if ((subsystem_vid !=PCI_VENDOR_ID_COMPAQ ) && (subsystem_vid !=PCI_VENDOR_ID_INTEL )) { +err ("%s: HPC controller not supported by this driver!\n" , __FUNCTION__); +return -1 ; + } + +/* Set Default values of "0" for everything */ + *pctlrcap =0 ; + +/* +* Interpretation of bit pattern in *pctlrcap +* Based on Intel PHPC SSVID/SID Programming Model +* Bit 0 Speed_capability: 0 = 33MHz, 1 = 66MHz +* Bit 1 Push_button : 0 = pushbutton present, 1 = no pushbutton +* Bit 2 Slot_switch_type: 0 = switch present, 1 = no switch +* Bit 3 DeFeature PHP: 0 = PHP not supported, 1 = PHP supported +* Bit 4 Alternate_base_address: 0 = not supported, 1 = supported +* Bit 5 PCI_config_space: Index/data access to working registers +* 0 = not supported, 1 = supported +* Bit 6 PCIX_speed: 0 = 100Mhz PCI-X if Bit 7 is 1 and Bit 0 is 0, +* 66MHz PCI_X if Bit 7 is 1 and Bit 0 is 1 +* 1 = 133MHz PCI-X if Bit 7 is 1 +* Bit 7 PCIX_support: 0 = conventional PCI, 1 = PCI-X +* Bit 8-15 Reserved +*/ +if (subsystem_vid ==PCI_VENDOR_ID_COMPAQ ) { +switch ( *prev >=0x13 ) { +case 0 : +if (subsystem_did ==PCI_SUB_HPC_ID ) { + *pctlrcap =0x2A ;/* sw, 33, no pb, no pcix */ +break ; + }else if (subsystem_did ==PCI_SUB_HPC_ID2 ) { + *pctlrcap =0x28 ;/* sw, 33, pb, no pcix */ +break ; + }else if (subsystem_did ==PCI_SUB_HPC_ID_INTC ) { + *pctlrcap =0x2A ;/* sw, 33, no pb, no pcix */ +break ; + }else if (subsystem_did ==PCI_SUB_HPC_ID3 ) { + *pctlrcap =0x29 ;/* sw, 66, pb, no pcix */ +break ; + }else if (subsystem_did ==PCI_SUB_HPC_ID4 ) { + *pctlrcap =0xA8 ;/* sw, 100, pb, pcix */ +break ; + }else { +err ("%s: unsupported Sub-Device ID: %x\n" , __FUNCTION__, subsystem_did); + php_ctlr->ctlrcap =0 ; +return -1 ; + } +case 1 :/* True for CIOBX */ +pci_read_config_byte (pdev,0x41 , &bus_cap); +if (bus_cap &0x80 ) { + *pctlrcap =0xE8 ;/* sw, 133, pb, pcix */ +break ; + }else if (bus_cap &0x40 ) { + *pctlrcap =0xA8 ;/* sw, 100, pb, pcix */ +break ; + }else if (bus_cap &0x20 ) { + *pctlrcap =0xA9 ;/* sw, 66, pb, pcix */ +break ; + }else if (bus_cap &0x10 ) { + *pctlrcap =0x29 ;/* sw, 100, pb, no pcix */ +break ; + }else { + *pctlrcap =0xA9 ;/* default to sw, 66, pb, pcix */ +break ; + } + } + }else if (subsystem_vid ==PCI_VENDOR_ID_INTEL ) { + *pctlrcap = subsystem_did; + }else +err ("%s: unsupported Sub-Vendor ID: %x\n" , __FUNCTION__, subsystem_vid); + + php_ctlr->ctlrcap = *pctlrcap; + } + +dbg ("ctlrcap = %x\n" , *pctlrcap); + +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_get_max_bus_speed (struct slot *slot,enum pci_bus_speed *value) +{ +enum pci_bus_speed bus_speed =PCI_SPEED_UNKNOWN ; +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; + + DBG_ENTER_ROUTINE + if (!slot->ctrl->hpc_ctlr_handle) { +err ("%s: Invalid HPC controller handle!\n" , __FUNCTION__); +return -1 ; + } + +/* PCI-X support */ +if (php_ctlr->ctlrcap &0x0080 ) { +/* Frequency of operation in PCI-X mode */ +if (php_ctlr->ctlrcap &0x0040 ) { + bus_speed = PCI_SPEED_133MHz_PCIX; + }else { +if (php_ctlr->ctlrcap &0x0001 ) + bus_speed = PCI_SPEED_66MHz_PCIX; +else + bus_speed = PCI_SPEED_100MHz_PCIX; + } + }else { +if (php_ctlr->ctlrcap &0x0001 ) + bus_speed = PCI_SPEED_66MHz; +else + bus_speed = PCI_SPEED_33MHz; + } + + *value = bus_speed; + +dbg ("Supported bus speed = %d\n" , bus_speed); +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_get_adapter_speed (struct slot *slot,enum pci_bus_speed *value) +{ +u8 adapter_speed =PCI_SPEED_UNKNOWN ; +u8 m66cap, pcixcap1, pcixcap2; +u8 temp_byte; + +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; + + DBG_ENTER_ROUTINE + if (!slot->ctrl->hpc_ctlr_handle) { +err ("%s: Invalid HPC controller handle!\n" , __FUNCTION__); +return -1 ; + } + +if (slot->hp_slot >= php_ctlr->num_slots) { +err ("%s: Invalid HPC slot number!\n" , __FUNCTION__); +return -1 ; + } + +down (&slot->ctrl->crit_sect); + +/* turn on board without attaching to the bus */ + temp_byte =readb (php_ctlr->creg +SLOT_POWER ); + temp_byte |= (0x01 << slot->hp_slot); +writeb (temp_byte, php_ctlr->creg +SLOT_POWER ); + +hpc_update_hpc (slot); + +/* Change bits in slot power register to force another shift out */ +/* NOTE: this is to work around the timer bug */ + temp_byte =readb (php_ctlr->creg +SLOT_POWER ); +writeb (0x00 , php_ctlr->creg +SLOT_POWER ); +writeb (temp_byte, php_ctlr->creg +SLOT_POWER ); + +hpc_update_hpc (slot); + +longdelay (6 * (HZ /10 )); + + m66cap =readl (php_ctlr->creg +NON_INT_INPUT ) &0xff ; + pcixcap1 = (readl (php_ctlr->creg +NON_INT_INPUT ) >>8 ) &0xff ; + pcixcap2 = (readl (php_ctlr->creg +NON_INT_INPUT ) >>16 ) &0xff ; +dbg ("m66cap = %x\n" , m66cap); + +if (php_ctlr->ctlrcap & PCIXSupport) { +if ((pcixcap1 >> slot->hp_slot) &1 ) { +if ((pcixcap2 >> slot->hp_slot) &1 ) + adapter_speed = PCI_SPEED_133MHz_PCIX; +else + adapter_speed = PCI_SPEED_66MHz_PCIX; + }else { +if ((m66cap >> slot->hp_slot) &1 ) + adapter_speed = PCI_SPEED_66MHz; +else + adapter_speed = PCI_SPEED_33MHz; + } + }else { +if ((m66cap >> slot->hp_slot) &1 ) + adapter_speed = PCI_SPEED_66MHz; +else + adapter_speed = PCI_SPEED_33MHz; + } + +/* turn off board without attaching to the bus */ + temp_byte =readb (php_ctlr->creg +SLOT_POWER ); + temp_byte &= ~(0x01 << slot->hp_slot); +writeb (temp_byte, php_ctlr->creg +SLOT_POWER ); + +hpc_update_hpc (slot); + +/* Done with exclusive hardware access */ +up (&slot->ctrl->crit_sect); + + *value = adapter_speed; +dbg ("Adapter speed = %d\n" , adapter_speed); +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_get_cur_bus_speed (struct slot *slot,enum pci_bus_speed *value) +{ +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; +u32 pci_misc_config; +enum pci_bus_speed bus_speed =PCI_SPEED_UNKNOWN ; +u16 temp_word; +u32 temp_dword; +struct pci_dev *dev; +u8 curr_freq; +struct controller *ctrl; + + DBG_ENTER_ROUTINE + if (!slot->ctrl->hpc_ctlr_handle || !php_ctlr->pci_dev) { +err ("%s: Invalid HPC controller handle!\n" , __FUNCTION__); +return -1 ; + } + + ctrl = slot->ctrl; + +if ((php_ctlr->pci_dev->vendor ==PCI_VENDOR_ID_INTEL ) && + (php_ctlr->pci_dev->device ==PCI_INTC_P64H2_DID )) { + +/* +* For P64H2 hpc, bus speed is determined by P64H2_HUB +* Let's find P64H2_HUB on this bus. +*/ + dev =pci_find_subsys (PCI_VENDOR_ID_INTEL ,PCI_INTC_P64H2_HUB_PCI ,PCI_ANY_ID ,PCI_ANY_ID ,NULL ); +if (dev ==NULL ) +info ("Can't find VID-0x8086 DID-0x1460\n" ); + +while (dev !=NULL ) { +pci_read_config_word (dev,0x40 , &temp_word); +pci_read_config_dword (dev,0x18 , &temp_dword); +dbg ("%s: bus=%x dev=%x, CNF=%x, BNUM=%x\n" , __FUNCTION__, dev->bus->number,PCI_SLOT (dev->devfn), temp_word, temp_dword); +if (((temp_dword &0x0000ff00 ) >>8 ) == php_ctlr->pci_dev->bus->number) { +if ((temp_word &0x0100 ) ==0x0100 ) { +if ((temp_word &0x00c0 ) ==0x00c0 ) + bus_speed = PCI_SPEED_133MHz_PCIX; +else if ((temp_word &0x0080 ) ==0x0080 ) + bus_speed = PCI_SPEED_100MHz_PCIX; +else if ((temp_word &0x0040 ) ==0x0040 ) + bus_speed = PCI_SPEED_66MHz_PCIX; + }else { +if ((temp_word &0x0040 ) ==0x0040 ) + bus_speed = PCI_SPEED_66MHz; +else if ((temp_word &0x00c0 ) ==0 ) + bus_speed = PCI_SPEED_33MHz; + } +break ; + } + dev =pci_find_subsys (PCI_VENDOR_ID_INTEL ,PCI_INTC_P64H2_HUB_PCI ,PCI_ANY_ID ,PCI_ANY_ID , dev); + } + }else { +if (php_ctlr->ctlrcap & PCIXSupport) { +if ((ctrl->pci_dev->subsystem_vendor ==PCI_VENDOR_ID_COMPAQ ) && + ((ctrl->rev >=0x13 ) || (ctrl->pci_dev->subsystem_device ==PCI_SUB_HPC_ID4 ))) { +/* for Compaq CIOBX or PCI_SUB_HPC_ID4 */ + curr_freq =readb (php_ctlr->creg +NEXT_CURR_FREQ ); +if ((curr_freq &0xB0 ) ==0xB0 ) + bus_speed = PCI_SPEED_133MHz_PCIX; +else if ((curr_freq &0xA0 ) ==0xA0 ) + bus_speed = PCI_SPEED_100MHz_PCIX; +else if ((curr_freq &0x90 ) ==0x90 ) + bus_speed = PCI_SPEED_66MHz_PCIX; +else if ((curr_freq &0x10 ) ==0x10 ) + bus_speed = PCI_SPEED_66MHz; +else bus_speed = PCI_SPEED_33MHz; + }else {/* all others */ + +pci_read_config_dword (php_ctlr->pci_dev,0x40 , &pci_misc_config); +/* Read HPC PCI Misc. Configuration at offset 40h */ + +dbg ("HPC PCI Misc Config = %x\n" , pci_misc_config); + +if (pci_misc_config &0x00200000 ) {/* Bit 21 of PCI Misc. Config. */ +if (readw (php_ctlr->creg +MISC ) &0x8000 ) {/* Bit 31 - 133 MHZ Prescale indicator */ +if (readw (php_ctlr->creg +MISC ) &0x0040 )/* Bit 22 - frequency range bit */ + bus_speed = PCI_SPEED_133MHz_PCIX; +else + bus_speed = PCI_SPEED_100MHz_PCIX; + }else + bus_speed = PCI_SPEED_66MHz_PCIX; + }else { +if (readw (php_ctlr->creg +MISC ) &0x0800 )/* Bit 27 - 66MHZ Prescale indicator */ + bus_speed = PCI_SPEED_66MHz; +else + bus_speed = PCI_SPEED_33MHz; + } + } + }else { +if (readw (php_ctlr->creg +MISC ) &0x0800 )/* Bit 27 - 66MHZ Prescale indicator */ + bus_speed = PCI_SPEED_66MHz; +else + bus_speed = PCI_SPEED_33MHz; + } + } + + *value = bus_speed; +dbg ("Current bus speed = %d\n" , bus_speed); +DBG_LEAVE_ROUTINE + return 0; +} + +static int hpc_set_controller_speed (struct slot *slot,enum pci_bus_speed value) +{ +struct slot *p_slot; +struct controller *ctrl; +u8 reg, adapter_speed; +u8 slot_power, hp_slot; +u16 reg16; +u32 leds; + +struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; + + DBG_ENTER_ROUTINE + if (!slot->ctrl->hpc_ctlr_handle) { +err ("%s: Invalid HPC controller handle!\n" , __FUNCTION__); +return -1 ; + } + + ctrl = slot->ctrl; + hp_slot = slot->hp_slot; + slot_power =readb (php_ctlr->creg +SLOT_POWER ); + leds =readl (php_ctlr->creg +LED_CONTROL ); + adapter_speed = value; + +/* We don't allow freq/mode changes if we find another adapter running +* in another slot on this controller */ +for (p_slot = ctrl->slot; p_slot; p_slot = p_slot->next) { +if (p_slot->device == (hp_slot + ctrl->slot_device_offset)) +continue ; +if (!p_slot->hotplug_slot && !p_slot->hotplug_slot->info) +continue ; +if (p_slot->hotplug_slot->info->adapter_status ==0 ) +continue ; +/* If another adapter is running on the same segment but at a +* lower speed/mode, we allow the new adapter to function at +* this rate if supported */ +if (ctrl->speed < adapter_speed) +return 0 ; + +return 1 ; + } + +/* We try to set the max speed supported by both the adapter and +* controller */ +if (ctrl->speed_capability < adapter_speed) { +if (ctrl->speed == ctrl->speed_capability) +return 0 ; + adapter_speed = ctrl->speed_capability; + } + +writel (0x0L , php_ctlr->creg +LED_CONTROL ); +writeb (0x00 , php_ctlr->creg +SLOT_ENABLE ); + +hpc_update_hpc (slot); + +if (adapter_speed != PCI_SPEED_133MHz_PCIX) + reg =0xF5 ; +else + reg =0xF4 ; +pci_write_config_byte (ctrl->pci_dev,0x41 , reg); + + reg16 =readw (php_ctlr->creg +NEXT_CURR_FREQ ); + reg16 &= ~0x000F ; +switch (adapter_speed) { +case (PCI_SPEED_133MHz_PCIX): + reg =0x75 ; + reg16 |=0xB ; +break ; +case (PCI_SPEED_100MHz_PCIX): + reg =0x74 ; + reg16 |=0xA ; +break ; +case (PCI_SPEED_66MHz_PCIX): + reg =0x73 ; + reg16 |=0x9 ; +break ; +case (PCI_SPEED_66MHz): + reg =0x73 ; + reg16 |=0x1 ; +break ; +default :/* 33MHz PCI 2.2 */ + reg =0x71 ; +break ; + + } + reg16 |=0xB <<12 ; +writew (reg16, php_ctlr->creg +NEXT_CURR_FREQ ); + +mdelay (5 ); + +/* Reenable interrupts */ +writel (0 , php_ctlr->creg +INT_MASK ); + +pci_write_config_byte (ctrl->pci_dev,0x41 , reg); + +/* Restart state machine */ + reg = ~0xF ; +pci_read_config_byte (ctrl->pci_dev,0x43 , ®); +pci_write_config_byte (ctrl->pci_dev,0x43 , reg); + +/* Only if mode change...*/ +if (((ctrl->speed == PCI_SPEED_66MHz) && (adapter_speed == PCI_SPEED_66MHz_PCIX)) || + ((ctrl->speed == PCI_SPEED_66MHz_PCIX) && (adapter_speed == PCI_SPEED_66MHz))) +hpc_update_hpc (slot); + +mdelay (1100 ); + +/* Restore LED/Slot state */ +writel (leds, php_ctlr->creg +LED_CONTROL ); +writeb (slot_power, php_ctlr->creg +SLOT_ENABLE ); + +hpc_update_hpc (slot); + + ctrl->speed = adapter_speed; + slot =cpqhp_find_slot (ctrl, hp_slot + ctrl->slot_device_offset); + +info ("Successfully changed frequency/mode for adapter in slot %d\n" , + slot->number); +return 0 ; +} + +static struct hpc_ops cpqphp_hpc_ops = { + .power_on_slot = hpc_power_on_slot, + .power_off_slot = hpc_power_off_slot, + .set_attention_status = hpc_set_attention_status, + .get_power_status = hpc_get_power_status, + .get_attention_status = hpc_get_attention_status, + .get_latch_status = hpc_get_latch_status, + .get_adapter_status = hpc_get_adapter_status, + + .get_max_bus_speed = hpc_get_max_bus_speed, + .get_cur_bus_speed = hpc_get_cur_bus_speed, + .get_adapter_speed = hpc_get_adapter_speed, + .set_controller_speed = hpc_set_controller_speed, + + .get_slot_capability = hpc_get_slot_capability, + .query_power_fault = hpc_query_power_fault, + .green_led_on = hpc_green_led_on, + .green_led_off = hpc_green_led_off, + .green_led_blink = hpc_green_led_blink, + + .enable_msl_interrupt = hpc_enable_msl_interrupt, + .update_hpc = hpc_update_hpc, + .release_ctlr = hpc_release_ctlr, +}; + +int phphpc_init (struct controller * ctrl, +struct pci_dev * pdev, +php_intr_callback_t switch_change_callback, +php_intr_callback_t presence_change_callback, +php_intr_callback_t power_fault_callback) +{ +struct php_ctlr_state_s *php_ctlr, *p; +void *instance_id = ctrl; +unsigned long psw; +int rc; +u16 temp_word, misc; +static int first =1 ; + +DBG_ENTER_ROUTINE + php_ctlr = (struct php_ctlr_state_s *)kmalloc (sizeof (struct php_ctlr_state_s ),GFP_KERNEL ); + +if (!php_ctlr) {/* allocate controller state data */ +err ("%s: HPC controller memory allocation error!\n" , __FUNCTION__); + goto abort; + } + +memset (php_ctlr,0 ,sizeof (struct php_ctlr_state_s )); + + php_ctlr->pci_dev = pdev;/* save pci_dev in context */ + +if (first) { +spin_lock_init (&hpc_event_lock); + first =0 ; + } + +dbg ("pdev = %p: b:d:f:irq=0x%x:%x:%x:%x\n" , pdev, pdev->bus->number,PCI_SLOT (pdev->devfn),PCI_FUNC (pdev->devfn), pdev->irq); +for ( rc =0 ; rc <DEVICE_COUNT_RESOURCE ; rc++) +if (pci_resource_len (pdev, rc) >0 ) +dbg ("pci resource[%d] start=0x%lx(len=0x%lx)\n" , rc, +pci_resource_start (pdev, rc),pci_resource_len (pdev, rc)); +info ("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n" , pdev->vendor, pdev->device, pdev->subsystem_vendor, pdev->subsystem_device); + +if (!request_mem_region (pci_resource_start (pdev,0 ),pci_resource_len (pdev,0 ),MY_NAME )) { +err ("%s: cannot reserve MMIO region\n" , __FUNCTION__); + goto abort_free_ctlr; + } + + php_ctlr->creg = (struct ctrl_reg *) +ioremap (pci_resource_start (pdev,0 ),pci_resource_len (pdev,0 )); +if (!php_ctlr->creg) { +err ("%s: cannot remap MMIO region %lx @ %lx\n" , __FUNCTION__,pci_resource_len (pdev,0 ),pci_resource_start (pdev,0 )); +release_mem_region (pci_resource_start (pdev,0 ),pci_resource_len (pdev,0 )); + goto abort_free_ctlr; + } + +init_MUTEX (&ctrl->crit_sect); +/* setup wait queue */ +init_waitqueue_head (&ctrl->queue); + +/* find the IRQ */ + php_ctlr->irq = pdev->irq; +dbg ("HPC interrupt = %d\n" , php_ctlr->irq); + +/* Save interrupt callback info */ + php_ctlr->switch_change_callback = switch_change_callback; + php_ctlr->presence_change_callback = presence_change_callback; + php_ctlr->power_fault_callback = power_fault_callback; + php_ctlr->callback_instance_id = instance_id; + +/* return PCI Controller Info */ + php_ctlr->first_device_num =readb (php_ctlr->creg +SLOT_MASK ) >>4 ; + php_ctlr->num_slots =readb (php_ctlr->creg +SLOT_MASK ) &0xF ; + +/* Mask all general input interrupts */ +writel (0xFFFFFFFFL , php_ctlr->creg +INT_MASK ); + +/*Disable interrupts */ +spin_lock_irqsave (&hpc_event_lock, psw); + +/*this code installs the interrupt handler */ + rc =request_irq (php_ctlr->irq, hpc_isr,SA_SHIRQ ,MY_NAME , (void *) ctrl); +dbg ("%s: request_irq %d for hpc%d (returns %d)\n" , __FUNCTION__, php_ctlr->irq, ctlr_seq_num, rc); + +if ((php_ctlr->pci_dev->vendor ==PCI_VENDOR_ID_INTEL ) && + (php_ctlr->pci_dev->device ==PCI_INTC_P64H2_DID )) { +/* +* If this is the Intel Tiger IA64 platform, Read the ABAR config +* space register and clear bit 14 to assure HPC uses normal +* interrupts, NOT SCI interrupt. +*/ + rc =pci_read_config_word (pdev,0x80 , &temp_word); +dbg ("ABAR reads %x\n" , temp_word); + temp_word = temp_word &0xBFFF ; + rc |=pci_write_config_word (pdev,0x80 , temp_word); +pci_read_config_word (pdev,0x80 , &temp_word); +if (rc || (temp_word & ~0xBFFF )) +err ("Unable to set ABAR[%x] rc = %d\n" , temp_word, rc); +else +dbg ("ABAR set to %x\n" , temp_word); + } + +/* Re-enable interrupts */ +spin_unlock_irqrestore (&hpc_event_lock, psw); + +/* Enable Shift Out interrupt and clear it, also */ +/* enable SERR on power fault */ + misc =readw (php_ctlr->creg +MISC ); + misc |=0x6006 ; +writew (misc, php_ctlr->creg +MISC ); + +/* Changed 05/05/97 to clear all interrupts at start */ +writel (0xFFFFFFFF , php_ctlr->creg +INT_INPUT_CLEAR ); + + php_ctlr->ctrl_int_comp =readl (php_ctlr->creg +INT_INPUT_CLEAR ); + +writel (0x0L , php_ctlr->creg +INT_MASK ); +/* +* Initialize the per slot SERR for unexpected switch open to 0 +* If the bit is et to 1, slot switch interrupt causes the SERR# pin +* to be asserted. +*/ +writeb (0 , php_ctlr->creg +SLOT_SERR ); + +/* Add this HPC instance into the HPC list */ +/* TO DO: Do we need to spinlock this? */ +if (php_ctlr_list_head ==0 ) { + php_ctlr_list_head = php_ctlr; + p = php_ctlr_list_head; + p->pnext =0 ; + }else { + p = php_ctlr_list_head; + +while (p->pnext) + p = p->pnext; + + p->pnext = php_ctlr; + } + + ctlr_seq_num++; + ctrl->hpc_ctlr_handle = php_ctlr; + ctrl->hpc_ops = &cpqphp_hpc_ops; + +DBG_LEAVE_ROUTINE + return 0; + +/* We end up here for the many possible ways to fail this API. */ +abort_free_ctlr: +kfree (php_ctlr); +abort: +DBG_LEAVE_ROUTINE + return -1; +}
drivers/pci/hotplug/cpqphp_pci.c +411 -932
1,690 lines not on this page · raw message
drivers/pci/hotplug/Kconfig +14 -4
@@ -47,11 +47,11 @@ When in doubt, say N. config HOTPLUG_PCI_COMPAQ - tristate "Compaq PCI Hotplug driver" - depends on HOTPLUG_PCI && X86 + tristate "Compaq/Intel PCI Hotplug driver" + depends on HOTPLUG_PCI help Say Y here if you have a motherboard with a Compaq PCI Hotplug - controller. + controller or equivalent Intel controller. This code is also available as a module ( = code which can be inserted in and removed from the running kernel whenever you want).
@@ -60,9 +60,19 @@ When in doubt, say N. +config HOTPLUG_PCI_COMPAQ_PHPRM_LEGACY + bool "Non-ACPI: Use Hotplug Resource Table ($HRT) for resource information" + depends on HOTPLUG_PCI_COMPAQ + help + Say Y here if Hotplug resource/configuration information is provided + by platform BIOS $HRT, not by ACPI. + Some ACPI compliant platforms may use this too if $HRT is provided. + + When in doubt, say N. + config HOTPLUG_PCI_COMPAQ_NVRAM bool "Save configuration into NVRAM on Compaq servers" - depends on HOTPLUG_PCI_COMPAQ + depends on HOTPLUG_PCI_COMPAQ_PHPRM_LEGACY help Say Y here if you have a Compaq server that has a PCI Hotplug controller. This will allow the PCI Hotplug driver to store the PCI
drivers/pci/hotplug/Makefile +10 -2
@@ -3,7 +3,7 @@ # obj-$(CONFIG_HOTPLUG_PCI) += pci_hotplug.o -obj-$(CONFIG_HOTPLUG_PCI_FAKE) += fakephp.o +obj-$(CONFIG_HOTPLUG_PCI_FAKE) += fakephp.o obj-$(CONFIG_HOTPLUG_PCI_COMPAQ) += cpqphp.o obj-$(CONFIG_HOTPLUG_PCI_IBM) += ibmphp.o obj-$(CONFIG_HOTPLUG_PCI_ACPI) += acpiphp.o
@@ -20,7 +20,8 @@ cpqphp-objs := cpqphp_core.o \ cpqphp_ctrl.o \ cpqphp_sysfs.o \ - cpqphp_pci.o + cpqphp_pci.o \ + cpqphp_hpc.o ibmphp-objs := ibmphp_core.o \ ibmphp_ebda.o \
@@ -40,6 +41,13 @@ endif endif +ifeq ($(CONFIG_HOTPLUG_PCI_COMPAQ_PHPRM_LEGACY),y) + cpqphp-objs += phprm_legacy.o +else + cpqphp-objs += phprm_acpi.o + EXTRA_CFLAGS += -D_LINUX -I$(TOPDIR)/drivers/acpi -I$(TOPDIR)/drivers/acpi/include -DPHP_ACPI +endif + ifeq ($(CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM),y) cpqphp-objs += cpqphp_nvram.o endif