-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm trying to port a linux driver to freebsd (hsdpa/umts nozomi card),
and i'm experiencing some really weird problem... probably due to my limited
kernel knowledge/experience.

Here it is the attach routine, which tries to read a portion of the device 
memory into
a specially formatted struct. Then the first filed in the struct is compared to 
a predefined value (a signature)
to make sure that the read was successfull. The problem is that right now this 
only works if i do the printfs marked
with XXX. When i comment them the read returns something that looks to me like 
random garbage...
probably i'm doing something very stupid, or missing something essential...  
any insight is greatly appreciated.

Again, here is the original linux driver for reference : 
http://www.pharscape.org/3G/nozomi_2.1_060703.tar.gz

P.S.: This is on 7.0-CURRENT

Thanks in advance!

Regards,
Niki Denev

[ code ]
int
nozomi_attach(device_t dev)
{
        struct nozomi_softc *sc;
        int i;
        u_int8_t r;

        sc = device_get_softc(dev);
        sc->noz_dev = dev;

        sc->bar.id = PCIR_BAR(0);
        sc->bar.res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->bar.id, 0, 
~0, 1, RF_ACTIVE);

        sc->bar.tag = rman_get_bustag(sc->bar.res);
        sc->bar.hdl = rman_get_bushandle(sc->bar.res);
        sc->base_addr = rman_get_start(sc->bar.res);
        sc->virt_addr = rman_get_virtual(sc->bar.res);

        /* set card type to F32_8 on no match */
        sc->card_type = rman_get_size(sc->bar.res) == 2048 ? F32_2 : F32_8;
        device_printf(sc->noz_dev, "card has %uKB memory\n", sc->card_type);

        /* XXX if i don't print these the reading of the bus memory will be 
incorrect */
        printf("phys address 0x%08lx\n", sc->base_addr);
        printf("virt address 0x%p\n", sc->virt_addr);
        printf("cfg address 0x%p\n", &sc->cfg_table);

        for(i=0; i < sizeof(config_table_t); i++) {
                r =  bus_space_read_1(sc->bar.tag, sc->bar.hdl, i);
                *((u_int8_t *)&sc->cfg_table + i) =  r;
                }

        if(sc->cfg_table.signature != CONFIG_MAGIC) {
                printf("ConfigTable Bad! 0x%08X != 0x%08X\n", 
sc->cfg_table.signature, CONFIG_MAGIC);
                return(ENXIO);
        }
[ code continues ... ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE1KXcHNAJ/fLbfrkRAhEZAKCvz1+ZBDH+mSMBLtoreAGDlzSL4wCgsZcL
yxziRoie0cqIFYCzdI4gAkk=
=6D/Y
-----END PGP SIGNATURE-----
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to