35 #include <linux/sched.h>
37 #define MY_NAME "cpqphp"
39 #define dbg(fmt, arg...) do { if (cpqhp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
40 #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
41 #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg)
42 #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg)
340 #define ROM_PHY_ADDR 0x0F0000
341 #define ROM_PHY_LEN 0x00ffff
343 #define PCI_HPC_ID 0xA0F7
344 #define PCI_SUB_HPC_ID 0xA2F7
345 #define PCI_SUB_HPC_ID2 0xA2F8
346 #define PCI_SUB_HPC_ID3 0xA2F9
347 #define PCI_SUB_HPC_ID_INTC 0xA2FA
348 #define PCI_SUB_HPC_ID4 0xA2FD
350 #define INT_BUTTON_IGNORE 0
351 #define INT_PRESENCE_ON 1
352 #define INT_PRESENCE_OFF 2
353 #define INT_SWITCH_CLOSE 3
354 #define INT_SWITCH_OPEN 4
355 #define INT_POWER_FAULT 5
356 #define INT_POWER_FAULT_CLEAR 6
357 #define INT_BUTTON_PRESS 7
358 #define INT_BUTTON_RELEASE 8
359 #define INT_BUTTON_CANCEL 9
361 #define STATIC_STATE 0
362 #define BLINKINGON_STATE 1
363 #define BLINKINGOFF_STATE 2
364 #define POWERON_STATE 3
365 #define POWEROFF_STATE 4
367 #define PCISLOT_INTERLOCK_CLOSED 0x00000001
368 #define PCISLOT_ADAPTER_PRESENT 0x00000002
369 #define PCISLOT_POWERED 0x00000004
370 #define PCISLOT_66_MHZ_OPERATION 0x00000008
371 #define PCISLOT_64_BIT_OPERATION 0x00000010
372 #define PCISLOT_REPLACE_SUPPORTED 0x00000020
373 #define PCISLOT_ADD_SUPPORTED 0x00000040
374 #define PCISLOT_INTERLOCK_SUPPORTED 0x00000080
375 #define PCISLOT_66_MHZ_SUPPORTED 0x00000100
376 #define PCISLOT_64_BIT_SUPPORTED 0x00000200
378 #define PCI_TO_PCI_BRIDGE_CLASS 0x00060400
380 #define INTERLOCK_OPEN 0x00000002
381 #define ADD_NOT_SUPPORTED 0x00000003
382 #define CARD_FUNCTIONING 0x00000005
383 #define ADAPTER_NOT_SAME 0x00000006
384 #define NO_ADAPTER_PRESENT 0x00000009
385 #define NOT_ENOUGH_RESOURCES 0x0000000B
386 #define DEVICE_TYPE_NOT_SUPPORTED 0x0000000C
387 #define POWER_FAILURE 0x0000000E
389 #define REMOVE_NOT_SUPPORTED 0x00000003
395 #define msg_initialization_err "Initialization failure, error=%d\n"
396 #define msg_HPC_rev_error "Unsupported revision of the PCI hot plug controller found.\n"
397 #define msg_HPC_non_compaq_or_intel "The PCI hot plug controller is not supported by this driver.\n"
398 #define msg_HPC_not_supported "this system is not supported by this version of cpqphpd. Upgrade to a newer version of cpqphpd\n"
399 #define msg_unable_to_save "unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n"
400 #define msg_button_on "PCI slot #%d - powering on due to button press.\n"
401 #define msg_button_off "PCI slot #%d - powering off due to button press.\n"
402 #define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n"
403 #define msg_button_ignore "PCI slot #%d - button press ignored. (action in progress...)\n"
421 unsigned char index);
466 static inline const char *slot_name(
struct slot *
slot)
490 misc = (misc | 0x0001) & 0xFFFB;
500 led_control |= (0x01010000
L <<
slot);
510 led_control &= ~(0x01010000
L <<
slot);
520 led_control &= (0x01010000
L <<
slot);
522 return led_control ? 1 : 0;
531 led_control |= 0x0101
L <<
slot;
540 led_control &= ~(0x0101
L <<
slot);
550 led_control &= ~(0x0101
L <<
slot);
551 led_control |= (0x0001
L <<
slot);
561 slot_enable &= ~(0x01 <<
slot);
571 slot_enable |= (0x01 <<
slot);
581 slot_enable &= (0x01 <<
slot);
582 return slot_enable ? 1 : 0;
606 if ((curr_freq & 0xB0) == 0xB0)
608 if ((curr_freq & 0xA0) == 0xA0)
610 if ((curr_freq & 0x90) == 0x90)
612 if (curr_freq & 0x10)
631 static inline u8 get_adapter_speed(
struct controller *ctrl,
u8 hp_slot)
634 dbg(
"slot: %d, PCIXCAP: %8x\n", hp_slot, temp_dword);
636 if (temp_dword & (0x10000 << hp_slot))
638 if (temp_dword & (0x100 << hp_slot))
642 if (temp_dword & (0x01 << hp_slot))
653 slot_power |= (0x01 <<
slot);
662 slot_power &= ~(0x01 <<
slot);
667 static inline int cpq_get_attention_status(
struct controller *ctrl,
struct slot *
slot)
673 return read_amber_LED(ctrl, hp_slot);
683 return is_slot_enabled(ctrl, hp_slot);
687 static inline int cpq_get_latch_status(
struct controller *ctrl,
694 dbg(
"%s: slot->device = %d, ctrl->slot_device_offset = %d \n",
699 return(status == 0) ? 1 : 0;
703 static inline int get_presence_status(
struct controller *ctrl,
706 int presence_save = 0;
713 presence_save = (
int) ((((~tempdword) >> 23) | ((~tempdword) >> 15))
716 return presence_save;
719 static inline int wait_for_ctrl_irq(
struct controller *ctrl)
724 dbg(
"%s - start\n", __func__);
732 dbg(
"%s - end\n", __func__);
737 static inline int cpqhp_routing_table_length(
void)