1394 soft busreset notifications in Micorsoft Windows 1394 stack

Discussion in 'Windows Vista Drivers' started by Raj, Jul 7, 2003.

  1. Raj

    Raj Guest

    1394 soft bus reset - i mean the bus reset received by writing to Phy
    register and not actually adding or removing device. I am writing
    device driver for 1394 device (similar to 1394diag) and using
    microsoft 1394 stack 1394bus.sys and ohci1394.sys for lower drivers.

    1) To receive soft busreset notification I am using
    REQUEST_BUS_RESET_NOTIFICATION. But I didnt understand how I should do
    when I have many 1394 devices on multiple 1394 adapter cards. Let us
    say four 1394 devices are connected to 2 cards of PC(2 devices on each

    Do I need to register callback four times or two times ?( Is one
    registration per device or one registration per adapter card ?).
    Since bus reset is per-card issue, if I register per-device will bus
    driver call per-device ?

    How should I go along in such situation? Please advise.

    2) What is recommended to be passed in context for this registration?
    Is this context only for our 1394 driver convenience of callback
    parameter or bus driver does anything.
    Raj, Jul 7, 2003
    1. Advertisements

  2. Raj,
    You should register for bus reset notification once for each device object
    created for your devices. Often this is done in your StartDevice handler in
    your driver, so you will set it up correctly, automatically.
    The context is just for your driver's use. Often a pointer to your device
    object or device extension is used as the context.
    Bill McKenzie, Jul 8, 2003
    1. Advertisements

  3. Raj

    Raj Guest

    Do I need to register callback four times or two times ?
    Thanks Bill. But my doubt here is - If my device driver registers
    'Notification callback' for each device, will the bus driver calls the
    callback function as many times as the number of devices? If so, I
    should keep track of all these many calls for callback from bus

    I have only one device driver and only one App for all devices. Now
    App receives notifications for as many devices since the callback is
    called so many times. Otherwise I should add code in the callback that
    knows number of devices and sends notification only once. But this
    looks ugly.

    Or bus manager should be smart enough to call only once, which cannot
    be the case becuase there can be other devices and their drivers also.
    Raj, Jul 8, 2003
  4. Raj

    Raj Guest

    I have only one device driver and only one App for all devices. Now
    1) Let us say there are four devices. Since I use one driver for
    multiple devices, every device registers same callback function. When
    soft bus reset occurs, bus driver calls the callback function 4 times.

    In the callback function, I actually set an event to signal soft bus
    reset, which is captured by user App. Now user App thinks it received
    soft bus reset 4 times while it received only once.

    2) If we register the function in StartDevice as recommended, I
    observed a problem. My callback function is never called if the 1394
    devices are connected to PC before PC powers up. If I unplug the
    device and connect again, soft bus reset is reported properly. Can you
    suggest/guess what is happening?

    Thank you.
    Raj, Jul 9, 2003
  5. In the callback function, I actually set an event to signal soft bus
    Hmmm, how about only letting one device signal the event. You will have to
    use some global state in the driver to handle this.
    Interesting, I haven't ever seen this. Do you still receive notification of
    hard bus resets in the case where soft resets aren't working properly?
    Bill McKenzie, Jul 11, 2003
  6. Raj

    Raj Guest

    Hmmm, how about only letting one device signal the event. You will have to
    That is what I am doing. I am registering only one device by keeping
    some global flag. If that device is removed, I will register next
    device. This is working fine till I thought of expanding to using TWO
    1394 adapter cards in a PC. Now I have to register one device on each
    interface because what we see on one interface will not be seen on
    other(I guess bus driver will report bus events independently to each
    bus, didnot verify !).

    Then it comes to, I should know which device belongs to which card so
    that I can register one device per card. Again I will have to follow
    reading EUID and match all devices having same local EUID as belonging
    to one interface and others to another interface.
    For hard bus reset, add device and remove device, I use
    RegisterDeviceNotification with GUID of 1394 diagnostic as given in
    1394diag example. This registration doesn't work for soft busreset. So
    for bus reset notification my driver and Application should allow two
    paths. I wish there was a consistent and uniform way of notifying bus
    reset, the interface on which it occured and the reason for bus reset.

    The more I look into Microsoft model, the more I feel this per-device
    method is not exactly suited and this madness for being generic,
    doesn't play well at driver level. But I should admit I dont have tons
    of years experience in drivers. May be I would appreciate this model,
    if I had worked in several drivers like ethernet and USB also, instead
    of just 1394.
    Raj, Jul 11, 2003
  7. I am not sure punching the PHY directly is a good idea, so you should use
    the mechanism provided by the 1394 bus driver as Max suggests. I had it in
    my head that that was what your were doing for some reason.

    I am certainly not above believing that there is yet another bug in the 1394
    bus driver stack. However, make sure that your request to register for bus
    resets is succeeding every time the request is made.

    Also, I don't remember a clear answer on this, but you say soft resets don't
    work for device plugged in before boot, do hard resets work in both cases?
    Try the IRB method of requesting a bus reset and report your results. Do,
    soft resets still not work after a hard reset in the failing case?
    Where in the driver are you going to do that?
    Bill McKenzie, Jul 14, 2003
  8. Raj

    Raj Guest

    Also, I don't remember a clear answer on this, but you say soft resets don't
    It is consistent error. Soft reset notification does not work till
    there is hard reset. Hard reset works always. Soft reset also works,
    but notification doesn't work.
    t1394Diag_PnP() is the dispatch function of the Driver Object Dispatch

    In t1394Diad_Pnp() function, we have the switch case,
    case IRP_MN_START_DEVICE. I am registering callback here.
    Raj, Jul 15, 2003
  9. Soft reset notification does not work till
    Well that is fairly telling right there. If soft reset notification does
    not work before, but does work after a hard bus reset, I would be highly
    suspicious of the 1394 bus driver stack.

    Have you tried multiple soft resets in the failing case?

    Anyway, if what you report is complete and correct, I don't know of a
    workaround. Perhaps someone from Microsoft could chime in here.
    Bill McKenzie, Jul 15, 2003
  10. Raj

    Raj Guest

    Soft reset notification does not work till
    Oh, there was a mistake in what I said. The problem is NOT consistent,
    but other statements are correct. Soft busreset notification is
    sometimes failed and can be regained if I give hard reset. I need to
    observe it in more detail. Thanks Bill.
    Raj, Jul 15, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.