📄 sl_x400p.c
字号:
#define span_to_byte(__span) (__span)#else#error "Must know the endianess of processor\n"#endif#endifenum xp_board { PLX9030 = 0, PLXDEVBRD, X400P, E400P, T400P, X400PSS7, E400PSS7, T400PSS7, V400P, V400PE, V400PT, V401PE, V401PT,};/* indexed by xp_board above *//* *INDENT-OFF* */static struct { char *name; u32 hw_flags; u32 idle_word;} xp_board_info[] __devinitdata = { { "PLX 9030", 0, 0x00000000 }, { "PLX Development Board", 0, 0x00000000 }, { "X400P", 1, 0xffffffff }, { "E400P", 1, 0xffffffff }, { "T400P", 1, 0xfefefefe }, { "X400P-SS7", 1, 0xffffffff }, { "E400P-SS7", 1, 0xffffffff }, { "T400P-SS7", 1, 0xfefefefe }, { "V400P", 1, 0xffffffff }, { "V400PE", 1, 0xffffffff }, { "V400PT", 1, 0xfefefefe }, { "V401PE", 1, 0xffffffff }, { "V401PT", 1, 0xfefefefe },};#define XPF_SUPPORTED 0x01#define XP_DEV_IDMASK 0xf0#define XP_DEV_SHIFT 4#define XP_DEV_REVMASK 0x0f#define XP_DEV_DS2152 0x00#define XP_DEV_DS21352 0x01#define XP_DEV_DS21552 0x02#define XP_DEV_DS2154 0x08#define XP_DEV_DS21354 0x09#define XP_DEV_DS21554 0x0a#define XP_DEV_DS2155 0x0b#define XP_DEV_DS2156 0x0cSTATIC struct { char *name; uint32_t hw_flags;} xp_device_info[] __devinitdata = { { "DS2152 (T1)", 1 }, { "DS21352 (T1)", 1 }, { "DS21552 (T1)", 1 }, { "Unknown ID 0011", 0 }, { "Unknown ID 0100", 0 }, { "Unknown ID 0101", 0 }, { "Unknown ID 0110", 0 }, { "Unknown ID 0111", 0 }, { "DS2154 (E1)", 1 }, { "DS21354 (E1)", 1 }, { "DS21554 (E1)", 1 }, { "DS2155 (E1/T1/J1)", 1 }, { "DS2156 (E1/T1/J1)", 1 }, { "Unknown ID 1101", 0 }, { "Unknown ID 1110", 0 }, { "Unknown ID 1111", 0 }};STATIC struct pci_device_id xp_pci_tbl[] __devinitdata = { {PCI_VENDOR_ID_PLX, 0x9030, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_OTHER << 8, 0xffff00, PLX9030}, {PCI_VENDOR_ID_PLX, 0x3001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_OTHER << 8, 0xffff00, PLXDEVBRD}, {PCI_VENDOR_ID_PLX, 0xD00D, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_OTHER << 8, 0xffff00, X400P}, {PCI_VENDOR_ID_PLX, 0x0557, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_OTHER << 8, 0xffff00, X400PSS7}, {PCI_VENDOR_ID_PLX, 0x4000, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_OTHER << 8, 0xffff00, V400P}, {PCI_VENDOR_ID_PLX, 0xD33D, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_OTHER << 8, 0xffff00, V401PT}, {PCI_VENDOR_ID_PLX, 0xD44D, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_OTHER << 8, 0xffff00, V401PE}, {0,}};/* *INDENT-ON* */#ifdef MODULE_DEVICE_TABLEMODULE_DEVICE_TABLE(pci, xp_pci_tbl);#ifdef MODULE_ALIASMODULE_ALIAS("pci:v000010B5d000009030sv*sd*bc06sc80i*");MODULE_ALIAS("pci:v000010B5d000003001sv*sd*bc06sc80i*");MODULE_ALIAS("pci:v000010B5d00000D00Dsv*sd*bc06sc80i*");MODULE_ALIAS("pci:v000010B5d000000557sv*sd*bc06sc80i*");MODULE_ALIAS("pci:v000010B5d000004000sv*sd*bc06sc80i*");MODULE_ALIAS("pci:v000010B5d00000D33Dsv*sd*bc06sc80i*");MODULE_ALIAS("pci:v000010B5d00000D44Dsv*sd*bc06sc80i*");#endif /* MODULE_ALIAS */#endif /* MODULE_DEVICE_TABLE */STATIC int __devinit xp_probe(struct pci_dev *, const struct pci_device_id *);STATIC void __devexit xp_remove(struct pci_dev *);#ifdef CONFIG_PM#ifndef HAVE_KTYPE_PM_MESSAGE_Ttypedef u32 pm_message_t;#endifSTATIC int xp_suspend(struct pci_dev *pdev, pm_message_t state);STATIC int xp_resume(struct pci_dev *pdev);#endifSTATIC struct pci_driver xp_driver = { name:DRV_NAME, probe:xp_probe, remove:__devexit_p(xp_remove), id_table:xp_pci_tbl,#ifdef CONFIG_PM suspend:xp_suspend, resume:xp_resume,#endif};STATIC int x400p_boards = 0;STATIC struct cd *x400p_cards;#define X400P_EBUFNO (1<<7) /* 128k elastic buffers *//* * ======================================================================== * * PRIMITIVES Sent Upstream * * ======================================================================== *//* * M_ERROR * ----------------------------------- */STATIC noinline __unlikely intm_error(struct xp *xp, queue_t *q, int err){ mblk_t *mp; if ((mp = ss7_allocb(q, 2, BPRI_MED))) { mp->b_datap->db_type = M_ERROR; *mp->b_wptr++ = err < 0 ? -err : err; *mp->b_wptr++ = err < 0 ? -err : err; printd(("%s: %p: <- M_ERROR\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_PDU_IND * ----------------------------------- * We don't actually use SL_PDU_INDs, we pass along M_DATA messages. */STATIC inline fastcall __hot_read intsl_pdu_ind(struct xp *xp, queue_t *q, mblk_t *dp){ mblk_t *mp; sl_pdu_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_PDU_IND; mp->b_cont = dp; printd(("%s: %p: <- SL_PDU_IND\n", DRV_NAME, xp)); put(RD(q), mp); return (QR_ABSORBED); } rare(); return (-ENOBUFS);}/* * SL_LINK_CONGESTED_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_link_congested_ind(struct xp *xp, queue_t *q, sl_ulong cong, sl_ulong disc){ mblk_t *mp; sl_link_cong_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_LINK_CONGESTED_IND; p->sl_cong_status = cong; p->sl_disc_status = disc; printd(("%s: %p: <- SL_LINK_CONGESTED_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_LINK_CONGESTION_CEASED_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_link_congestion_ceased_ind(struct xp *xp, queue_t *q, sl_ulong cong, sl_ulong disc){ mblk_t *mp; sl_link_cong_ceased_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_LINK_CONGESTION_CEASED_IND; p->sl_timestamp = jiffies; p->sl_cong_status = cong; p->sl_disc_status = disc; printd(("%s: %p: <- SL_LINK_CONGESTION_CEASED_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RETRIEVED_MESSAGE_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_retrieved_message_ind(struct xp *xp, queue_t *q, mblk_t *dp){ mblk_t *mp; sl_retrieved_msg_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RETRIEVED_MESSAGE_IND; mp->b_cont = dp; printd(("%s: %p: <- SL_RETRIEVED_MESSGAGE_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RETRIEVAL_COMPLETE_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_retrieval_complete_ind(struct xp *xp, queue_t *q){ mblk_t *mp; sl_retrieval_comp_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RETRIEVAL_COMPLETE_IND; printd(("%s: %p: <- SL_RETIREVAL_COMPLETE_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RB_CLEARED_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_rb_cleared_ind(struct xp *xp, queue_t *q){ mblk_t *mp; sl_rb_cleared_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RB_CLEARED_IND; printd(("%s: %p: <- SL_RB_CLEARED_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_BSNT_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_bsnt_ind(struct xp *xp, queue_t *q, sl_ulong bsnt){ mblk_t *mp; sl_bsnt_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_BSNT_IND; p->sl_bsnt = bsnt; printd(("%s: %p: <- SL_BSNT_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_IN_SERVICE_IND * ----------------------------------- */STATIC noinline fastcall intsl_in_service_ind(struct xp *xp, queue_t *q){ mblk_t *mp; sl_in_service_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_IN_SERVICE_IND; printd(("%s: %p: <- SL_IN_SERVICE_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_OUT_OF_SERVICE_IND * ----------------------------------- */STATIC noinline fastcall intsl_out_of_service_ind(struct xp *xp, queue_t *q, sl_ulong reason){ mblk_t *mp; sl_out_of_service_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_OUT_OF_SERVICE_IND; p->sl_timestamp = jiffies; p->sl_reason = reason; printd(("%s: %p: <- SL_OUT_OF_SERVICE_IND\n", DRV_NAME, xp)); put(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_REMOTE_PROCESSOR_OUTAGE_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_remote_processor_outage_ind(struct xp *xp, queue_t *q){ mblk_t *mp; sl_rem_proc_out_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_REMOTE_PROCESSOR_OUTAGE_IND; p->sl_timestamp = jiffies; printd(("%s: %p: <- SL_REMOTE_PROCESSOR_OUTAGE_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_REMOTE_PROCESSOR_RECOVERED_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_remote_processor_recovered_ind(struct xp *xp, queue_t *q){ mblk_t *mp; sl_rem_proc_recovered_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_REMOTE_PROCESSOR_RECOVERED_IND; p->sl_timestamp = jiffies; printd(("%s: %p: <- SL_REMOTE_PROCESSOR_RECOVERED_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RTB_CLEARED_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_rtb_cleared_ind(struct xp *xp, queue_t *q){ mblk_t *mp; sl_rtb_cleared_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RTB_CLEARED_IND; printd(("%s: %p: <- SL_RTB_CLEARED_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#if 0/* * SL_RETRIEVAL_NOT_POSSIBLE_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_retrieval_not_possible_ind(struct xp *xp, queue_t *q){ mblk_t *mp; sl_retrieval_not_poss_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RETRIEVAL_NOT_POSSIBLE_IND; printd(("%s: %p: <- SL_RETRIEVAL_NOT_POSSIBLE_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_BSNT_NOT_RETRIEVABLE_IND * ----------------------------------- */STATIC noinline fastcall __unlikely intsl_bsnt_not_retrievable_ind(struct xp *xp, queue_t *q, sl_ulong bsnt){ mblk_t *mp; sl_bsnt_not_retr_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_BSNT_NOT_RETRIEVABLE_IND; p->sl_bsnt = bsnt; printd(("%s: %p: <- SL_BSNT_NOT_RETRIEVABLE_IND\n", DRV_NAME, xp)); putnext(RD(q), mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -