Go to the documentation of this file.
38 #define MY_NAME "ibmphpd"
40 #define MY_NAME THIS_MODULE->name
42 #define debug(fmt, arg...) do { if (ibmphp_debug == 1) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
43 #define debug_pci(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
44 #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
45 #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg)
46 #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg)
55 #define EBDA_SLOT_133_MAX 0x20
56 #define EBDA_SLOT_100_MAX 0x10
57 #define EBDA_SLOT_66_MAX 0x02
58 #define EBDA_SLOT_PCIX_CAP 0x08
65 #define EBDA_RSRC_TYPE_MASK 0x03
66 #define EBDA_IO_RSRC_TYPE 0x00
67 #define EBDA_MEM_RSRC_TYPE 0x01
68 #define EBDA_PFM_RSRC_TYPE 0x03
69 #define EBDA_RES_RSRC_TYPE 0x02
76 #define EBDA_IO_RESTRI_MASK 0x0c
77 #define EBDA_NO_RESTRI 0x00
78 #define EBDA_AVO_VGA_ADDR 0x04
79 #define EBDA_AVO_VGA_ADDR_AND_ALIA 0x08
80 #define EBDA_AVO_ISA_ADDR 0x0c
87 #define EBDA_DEV_TYPE_MASK 0x10
88 #define EBDA_PCI_DEV 0x10
89 #define EBDA_NON_PCI_DEV 0x00
96 #define EBDA_PRI_DEF_MASK 0x20
97 #define EBDA_PRI_PCI_BUS_INFO 0x20
98 #define EBDA_NORM_DEV_RSRC_INFO 0x00
217 #define HPC_DEVICE_ID 0x0246
218 #define HPC_SUBSYSTEM_ID 0x0247
219 #define HPC_PCI_OFFSET 0x40
300 #define PCIDEVMASK 0x10
301 #define PRIMARYBUSMASK 0x20
304 #define PCI_VENDOR_ID_NOTVALID 0xFFFF
305 #define PCI_HEADER_TYPE_MULTIDEVICE 0x80
306 #define PCI_HEADER_TYPE_MULTIBRIDGE 0x81
310 #define DEVICEENABLE 0x015F
312 #define IOBRIDGE 0x1000
313 #define MEMBRIDGE 0x100000
316 #define SCSI_IRQ 0x09
318 #define OTHER_IRQ 0x0B
409 #define HPC_ERROR 0xFF
414 #define BUS_SPEED 0x30
415 #define BUS_MODE 0x40
416 #define BUS_MODE_PCIX 0x01
417 #define BUS_MODE_PCI 0x00
418 #define BUS_SPEED_2 0x20
419 #define BUS_SPEED_1 0x10
420 #define BUS_SPEED_33 0x00
421 #define BUS_SPEED_66 0x01
422 #define BUS_SPEED_100 0x02
423 #define BUS_SPEED_133 0x03
424 #define BUS_SPEED_66PCIX 0x04
425 #define BUS_SPEED_66UNKNOWN 0x05
426 #define BUS_STATUS_AVAILABLE 0x01
427 #define BUS_CONTROL_AVAILABLE 0x02
428 #define SLOT_LATCH_REGS_SUPPORTED 0x10
430 #define PRGM_MODEL_REV_LEVEL 0xF0
431 #define MAX_ADAPTER_NONE 0x09
439 #define HPC_CTLR_ENABLEIRQ 0x00 // N 15
440 #define HPC_CTLR_DISABLEIRQ 0x01 // N 15
441 #define HPC_SLOT_OFF 0x02 // Y 0-14
442 #define HPC_SLOT_ON 0x03 // Y 0-14
443 #define HPC_SLOT_ATTNOFF 0x04 // N 0-14
444 #define HPC_SLOT_ATTNON 0x05 // N 0-14
445 #define HPC_CTLR_CLEARIRQ 0x06 // N 15
446 #define HPC_CTLR_RESET 0x07 // Y 15
447 #define HPC_CTLR_IRQSTEER 0x08 // N 15
448 #define HPC_BUS_33CONVMODE 0x09 // Y 31-34
449 #define HPC_BUS_66CONVMODE 0x0A // Y 31-34
450 #define HPC_BUS_66PCIXMODE 0x0B // Y 31-34
451 #define HPC_BUS_100PCIXMODE 0x0C // Y 31-34
452 #define HPC_BUS_133PCIXMODE 0x0D // Y 31-34
453 #define HPC_ALLSLOT_OFF 0x11 // Y 15
454 #define HPC_ALLSLOT_ON 0x12 // Y 15
455 #define HPC_SLOT_BLINKLED 0x13 // N 0-14
460 #define READ_SLOTSTATUS 0x01
461 #define READ_EXTSLOTSTATUS 0x02
462 #define READ_BUSSTATUS 0x03
463 #define READ_CTLRSTATUS 0x04
464 #define READ_ALLSTAT 0x05
465 #define READ_ALLSLOT 0x06
466 #define READ_SLOTLATCHLOWREG 0x07
467 #define READ_REVLEVEL 0x08
468 #define READ_HPCOPTIONS 0x09
472 #define HPC_SLOT_POWER 0x01
473 #define HPC_SLOT_CONNECT 0x02
474 #define HPC_SLOT_ATTN 0x04
475 #define HPC_SLOT_PRSNT2 0x08
476 #define HPC_SLOT_PRSNT1 0x10
477 #define HPC_SLOT_PWRGD 0x20
478 #define HPC_SLOT_BUS_SPEED 0x40
479 #define HPC_SLOT_LATCH 0x80
484 #define HPC_SLOT_POWER_OFF 0x00
485 #define HPC_SLOT_POWER_ON 0x01
490 #define HPC_SLOT_CONNECTED 0x00
491 #define HPC_SLOT_DISCONNECTED 0x01
496 #define HPC_SLOT_ATTN_OFF 0x00
497 #define HPC_SLOT_ATTN_ON 0x01
498 #define HPC_SLOT_ATTN_BLINK 0x02
503 #define HPC_SLOT_EMPTY 0x00
504 #define HPC_SLOT_PRSNT_7 0x01
505 #define HPC_SLOT_PRSNT_15 0x02
506 #define HPC_SLOT_PRSNT_25 0x03
511 #define HPC_SLOT_PWRGD_FAULT_NONE 0x00
512 #define HPC_SLOT_PWRGD_GOOD 0x01
517 #define HPC_SLOT_BUS_SPEED_OK 0x00
518 #define HPC_SLOT_BUS_SPEED_MISM 0x01
523 #define HPC_SLOT_LATCH_OPEN 0x01 // NOTE : in PCI spec bit off = open
524 #define HPC_SLOT_LATCH_CLOSED 0x00 // NOTE : in PCI spec bit on = closed
530 #define HPC_SLOT_PCIX 0x01
531 #define HPC_SLOT_SPEED1 0x02
532 #define HPC_SLOT_SPEED2 0x04
533 #define HPC_SLOT_BLINK_ATTN 0x08
534 #define HPC_SLOT_RSRVD1 0x10
535 #define HPC_SLOT_RSRVD2 0x20
536 #define HPC_SLOT_BUS_MODE 0x40
537 #define HPC_SLOT_RSRVD3 0x80
542 #define HPC_SLOT_PCIX_NO 0x00
543 #define HPC_SLOT_PCIX_YES 0x01
548 #define HPC_SLOT_SPEED_33 0x00
549 #define HPC_SLOT_SPEED_66 0x01
550 #define HPC_SLOT_SPEED_133 0x02
555 #define HPC_SLOT_ATTN_BLINK_OFF 0x00
556 #define HPC_SLOT_ATTN_BLINK_ON 0x01
561 #define HPC_SLOT_BUS_MODE_OK 0x00
562 #define HPC_SLOT_BUS_MODE_MISM 0x01
567 #define HPC_CTLR_WORKING 0x01
568 #define HPC_CTLR_FINISHED 0x02
569 #define HPC_CTLR_RESULT0 0x04
570 #define HPC_CTLR_RESULT1 0x08
571 #define HPC_CTLR_RESULE2 0x10
572 #define HPC_CTLR_RESULT3 0x20
573 #define HPC_CTLR_IRQ_ROUTG 0x40
574 #define HPC_CTLR_IRQ_PENDG 0x80
579 #define HPC_CTLR_WORKING_NO 0x00
580 #define HPC_CTLR_WORKING_YES 0x01
585 #define HPC_CTLR_FINISHED_NO 0x00
586 #define HPC_CTLR_FINISHED_YES 0x01
591 #define HPC_CTLR_RESULT_SUCCESS 0x00
592 #define HPC_CTLR_RESULT_FAILED 0x01
593 #define HPC_CTLR_RESULT_RSVD 0x02
594 #define HPC_CTLR_RESULT_NORESP 0x03
600 #define SLOT_POWER(s) ((u8) ((s & HPC_SLOT_POWER) \
601 ? HPC_SLOT_POWER_ON : HPC_SLOT_POWER_OFF))
603 #define SLOT_CONNECT(s) ((u8) ((s & HPC_SLOT_CONNECT) \
604 ? HPC_SLOT_DISCONNECTED : HPC_SLOT_CONNECTED))
606 #define SLOT_ATTN(s,es) ((u8) ((es & HPC_SLOT_BLINK_ATTN) \
607 ? HPC_SLOT_ATTN_BLINK \
608 : ((s & HPC_SLOT_ATTN) ? HPC_SLOT_ATTN_ON : HPC_SLOT_ATTN_OFF)))
610 #define SLOT_PRESENT(s) ((u8) ((s & HPC_SLOT_PRSNT1) \
611 ? ((s & HPC_SLOT_PRSNT2) ? HPC_SLOT_EMPTY : HPC_SLOT_PRSNT_15) \
612 : ((s & HPC_SLOT_PRSNT2) ? HPC_SLOT_PRSNT_25 : HPC_SLOT_PRSNT_7)))
614 #define SLOT_PWRGD(s) ((u8) ((s & HPC_SLOT_PWRGD) \
615 ? HPC_SLOT_PWRGD_GOOD : HPC_SLOT_PWRGD_FAULT_NONE))
617 #define SLOT_BUS_SPEED(s) ((u8) ((s & HPC_SLOT_BUS_SPEED) \
618 ? HPC_SLOT_BUS_SPEED_MISM : HPC_SLOT_BUS_SPEED_OK))
620 #define SLOT_LATCH(s) ((u8) ((s & HPC_SLOT_LATCH) \
621 ? HPC_SLOT_LATCH_CLOSED : HPC_SLOT_LATCH_OPEN))
623 #define SLOT_PCIX(es) ((u8) ((es & HPC_SLOT_PCIX) \
624 ? HPC_SLOT_PCIX_YES : HPC_SLOT_PCIX_NO))
626 #define SLOT_SPEED(es) ((u8) ((es & HPC_SLOT_SPEED2) \
627 ? ((es & HPC_SLOT_SPEED1) ? HPC_SLOT_SPEED_133 \
628 : HPC_SLOT_SPEED_66) \
629 : HPC_SLOT_SPEED_33))
631 #define SLOT_BUS_MODE(es) ((u8) ((es & HPC_SLOT_BUS_MODE) \
632 ? HPC_SLOT_BUS_MODE_MISM : HPC_SLOT_BUS_MODE_OK))
637 #define CURRENT_BUS_SPEED(s) ((u8) (s & BUS_SPEED_2) \
638 ? ((s & BUS_SPEED_1) ? BUS_SPEED_133 : BUS_SPEED_100) \
639 : ((s & BUS_SPEED_1) ? BUS_SPEED_66 : BUS_SPEED_33))
641 #define CURRENT_BUS_MODE(s) ((u8) (s & BUS_MODE) ? BUS_MODE_PCIX : BUS_MODE_PCI)
643 #define READ_BUS_STATUS(s) ((u8) (s->options & BUS_STATUS_AVAILABLE))
645 #define READ_BUS_MODE(s) ((s->revision & PRGM_MODEL_REV_LEVEL) >= 0x20)
647 #define SET_BUS_STATUS(s) ((u8) (s->options & BUS_CONTROL_AVAILABLE))
649 #define READ_SLOT_LATCH(s) ((u8) (s->options & SLOT_LATCH_REGS_SUPPORTED))
654 #define CTLR_WORKING(c) ((u8) ((c & HPC_CTLR_WORKING) \
655 ? HPC_CTLR_WORKING_YES : HPC_CTLR_WORKING_NO))
656 #define CTLR_FINISHED(c) ((u8) ((c & HPC_CTLR_FINISHED) \
657 ? HPC_CTLR_FINISHED_YES : HPC_CTLR_FINISHED_NO))
658 #define CTLR_RESULT(c) ((u8) ((c & HPC_CTLR_RESULT1) \
659 ? ((c & HPC_CTLR_RESULT0) ? HPC_CTLR_RESULT_NORESP \
660 : HPC_CTLR_RESULT_RSVD) \
661 : ((c & HPC_CTLR_RESULT0) ? HPC_CTLR_RESULT_FAILED \
662 : HPC_CTLR_RESULT_SUCCESS)))
665 #define NEEDTOCHECK_CMDSTATUS(c) ((c == HPC_SLOT_OFF) || \
666 (c == HPC_SLOT_ON) || \
667 (c == HPC_CTLR_RESET) || \
668 (c == HPC_BUS_33CONVMODE) || \
669 (c == HPC_BUS_66CONVMODE) || \
670 (c == HPC_BUS_66PCIXMODE) || \
671 (c == HPC_BUS_100PCIXMODE) || \
672 (c == HPC_BUS_133PCIXMODE) || \
673 (c == HPC_ALLSLOT_OFF) || \
674 (c == HPC_ALLSLOT_ON))
682 #define CARD_INFO 0x07