Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Oct 2005 09:11:34 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        mayong@mail.com
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: Some Questions
Message-ID:  <20051018.091134.85411642.imp@bsdimp.com>
In-Reply-To: <200510180826.j9I8Quw26871@cal1-1.us4.outblaze.com>

index | next in thread | previous in thread | raw e-mail

In message: <200510180826.j9I8Quw26871@cal1-1.us4.outblaze.com>
            "Yong Ma" <mayong@mail.com> writes:

: 1)Some drivers declares the device_open() as int device_open(dev_t
: dev,...),and some declare it as int device_open(struct cdev
: *dev,...),sometimes the first one couldn't be
: compliedsuccessfully,what's the difference?

In 4.x, the former was used.  In 5.x and newer, the latter is used.
On 4.x you could get away with the latter because dev_t was typedefed
to be struct cdev *.


: 2) if (pci_get_vendor(dev) == 0x11c1) { ...
:                               ~~~~~~~~how to get this number if I don't know it?

(1) Ask the vendor of your device (2) Read the datasheet for your
device (3) pciconf -l :-)

: 3)Could the device on PCI slot be listed by /pciconf -l /without driver.

Yes.

: 4)The printf() seems not work under XWindow mode in functions like
: deviec_prob or device_attach,how to make it work?

It works.  However, the output is sent to the console.  Under X
windows, the console is normally hidden from you somewhere.  You can
get the last bit of console output, however, using the dmesg command.

: 5)If only the pseudo-device in /dev can be destroyed with
: destroy_dev(sc->dev0) in detach() function in a KLD driver? I can't
: do that!

I'm afraid I don't understand this question.  If you have, say, a
global control device for all instances of the driver, you can keep a
'reference count' of the number of instances attached and then delete
the device when the last one detaches.  If it is something else, then
I'll need more information.

Warner


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051018.091134.85411642.imp>