tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RFC: device attachment/detachment



David Young wrote:
> On Sat, May 02, 2009 at 12:56:43AM +0200, Christoph Egger wrote:
>> Attached patch modifies the driver's attachment function to
>> return an error code, zero for success.
>> I modified all drivers necessary to compile an amd64 GENERIC
>> kernel plus bwi(4). The intended functional change is in
>> subr_autoconf.c, there's no intended functional change in the
>> drivers.
> 
> I agree that attach routines should return with a result code.
> 
>> W/o the patch 'drvctl -d bwi0' crashes in various places
>> due to assumptions even in MI code.
> 
>>From my perspective, drvctl -d bwi0 crashes because bwi_detach() is not
> correct or complete.
> 
>> With the patch, bwi0 detaches:
>>
>> bwi0 at pci3 dev 0 function 0: Broadcom Wireless
>> bwi0: interrupting at ioapic0 pin 16
>> bwi0: bwi_attach
>> bwi0: bwi_power_on
>> bwi0: regwin: type 0x800, rev 19, vendor 0x4243
>> bwi0: BBP id 0x4321, BBP rev 0x3, BBP pkg 0
>> bwi0: nregwin 5, cap 0x0864000d
>> bwi0: regwin: type 0x812, rev 12, vendor 0x4243
>> bwi0: MAC: rev 12
>> bwi0: regwin: type 0x820, rev 4, vendor 0x4243
>> bwi0: regwin: type 0x804, rev 13, vendor 0x4243
>> bwi0: bus regwin already exists
>> bwi0: regwin: type 0x817, rev 4, vendor 0x4243
>> bwi0: bwi_power_on
>> bwi0: clksrc CS_OSC
>> bwi0: clkfreq min 990000, max 1010000
>> bwi0: power on delay 3
>> bwi0: bus rev 4
>> bwi0: PCIE is enabled
>> bwi0: card flags 0x3844
>> bwi0: 0th led, act 91, lowact 0
>> bwi0: 1th led, act 91, lowact 0
>> bwi0: 2th led, act 41, lowact 0
>> bwi0: 3th led, act 41, lowact 0
>> bwi0: MAC was already disabled
>> bwi0: PHY is linked
>> bwi0: PHY type 4, rev 2, ver 5
>> bwi0: unsupported PHY type 4
>> bwi0: detached
> 
> But you have only nominally detached bwi0: the OS has reclaimed none of
> the resources (kmem, bus space, DMA buffers, DMA maps, et cetera) that
> bwi0 grabbed during attachment.

No, the intention of that patch is just to modify the semantic of the
attach routine - to return an error code.
I used bwi(4) to show the changes in subr_autoconf.c

Christoph


Home | Main Index | Thread Index | Old Index