kernels/linux-2.4.0/drivers/ieee1394/ieee1394_core.c
/*
 * Verify num_of_selfids SelfIDs and return number of nodes.  Return zero in
 * case verification failed.
 */
Verify num_of_selfids SelfIDs and return number of nodes.  Return zero in
case verification failed.
Verify num_of_selfids SelfIDs and return number of nodes . Return zero in case verification failed .
static int check_selfids(struct hpsb_host *host, unsigned int num_of_selfids)
{
        int nodeid = -1;
        int rest_of_selfids = num_of_selfids;
        struct selfid *sid = (struct selfid *)host->topology_map;
        struct ext_selfid *esid;
        int esid_seq = 23;
        while (rest_of_selfids--) {
                if (!sid->extended) {
                        nodeid++;
                        esid_seq = 0;
                        if (sid->phy_id != nodeid) {
                                HPSB_INFO("SelfIDs failed monotony check with "
                                          "%d", sid->phy_id);
                                return 0;
                        }
                        if (sid->contender && sid->link_active) {
                                host->irm_id = LOCAL_BUS | sid->phy_id;
                        }
                } else {
                        esid = (struct ext_selfid *)sid;
                        if ((esid->phy_id != nodeid) 
                            || (esid->seq_nr != esid_seq)) {
                                HPSB_INFO("SelfIDs failed monotony check with "
                                          "%d/%d", esid->phy_id, esid->seq_nr);
                                return 0;
                        }
                        esid_seq++;
                }
                sid++;
        }
        esid = (struct ext_selfid *)(sid - 1);
        while (esid->extended) {
                if ((esid->porta == 0x2) || (esid->portb == 0x2)
                    || (esid->portc == 0x2) || (esid->portd == 0x2)
                    || (esid->porte == 0x2) || (esid->portf == 0x2)
                    || (esid->portg == 0x2) || (esid->porth == 0x2)) {
                                HPSB_INFO("SelfIDs failed root check on "
                                          "extended SelfID");
                                return 0;
                }
                esid--;
        }
        sid = (struct selfid *)esid;
        if ((sid->port0 == 0x2) || (sid->port1 == 0x2) || (sid->port2 == 0x2)) {
                        HPSB_INFO("SelfIDs failed root check");
                        return 0;
        }
        return nodeid + 1;
}
static int check_selfids ( struct hpsb_host * host , unsigned int num_of_selfids ) { int nodeid = -1 ; int rest_of_selfids = num_of_selfids ; struct selfid * sid = ( struct selfid * ) host -> topology_map ; struct ext_selfid * esid ; int esid_seq = 23 ; while ( rest_of_selfids -- ) { if ( ! sid -> extended ) { nodeid ++ ; esid_seq = 0 ; if ( sid -> phy_id != nodeid ) { HPSB_INFO ( " " " " , sid -> phy_id ) ; return 0 ; } if ( sid -> contender && sid -> link_active ) { host -> irm_id = LOCAL_BUS | sid -> phy_id ; } } else { esid = ( struct ext_selfid * ) sid ; if ( ( esid -> phy_id != nodeid ) || ( esid -> seq_nr != esid_seq ) ) { HPSB_INFO ( " " " " , esid -> phy_id , esid -> seq_nr ) ; return 0 ; } esid_seq ++ ; } sid ++ ; } esid = ( struct ext_selfid * ) ( sid - 1 ) ; while ( esid -> extended ) { if ( ( esid -> porta == 0x2 ) || ( esid -> portb == 0x2 ) || ( esid -> portc == 0x2 ) || ( esid -> portd == 0x2 ) || ( esid -> porte == 0x2 ) || ( esid -> portf == 0x2 ) || ( esid -> portg == 0x2 ) || ( esid -> porth == 0x2 ) ) { HPSB_INFO ( " " " " ) ; return 0 ; } esid -- ; } sid = ( struct selfid * ) esid ; if ( ( sid -> port0 == 0x2 ) || ( sid -> port1 == 0x2 ) || ( sid -> port2 == 0x2 ) ) { HPSB_INFO ( " " ) ; return 0 ; } return nodeid + 1 ; }
Verify num_of_selfids SelfIDs and return number of nodes.
Verify num_of_selfids SelfIDs and return number of nodes .