SIS496 Issues

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

SIS496 Issues

Postby gnif » Fri Mar 12, 2021 3:01 am

Hi,

I have a VT6212 PCI card in a SIS496 based motherboard with an Am5x86-75 in it. Due to poor selections by the BIOS, I have had to learn how to and write a device driver to re-assign the IRQs and re-configure the PIC as the VT6212 is a multifunction device and the BIOS is assigning IRQ15 to one of the functions which break IDE access as it's used by the secondary IDE controller. As a result, I am now able to finally load USBUHCIL.COM, however, I still have two issues to resolve.

1) I can only load USBUHCL into the lower memory segment, if I attempt to load high I can only load one for a single function, attempting to install it for the 2nd function fails and the entire device never sees any attached USB devices. Is this because DMA is nonfunctional in the UMB on my system?

2) I have a collection of USB mice that are all flagged as "bad" when attached, however, if I used the closed source UHCI.EXE USB driver they work just fine. Seeing as they are just HID devices I am having trouble understanding why they won't just work.

I have tried to read the driver source to understand what is going on, however, 25k+ lines of 16-bit asm (an impressive feat btw Bert, congrats!) is just too much for me at this time, especially as this is my first time writing anything for DOS/16-bit and I am still trying to wrap my head around how the memory model works :)
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby gnif » Fri Mar 12, 2021 2:51 pm

gnif wrote:2) I have a collection of USB mice that are all flagged as "bad" when attached, however, if I used the closed source UHCI.EXE USB driver they work just fine. Seeing as they are just HID devices I am having trouble understanding why they won't just work.


I think I might know what is causing this... I am still learning the PC architecture at this level and I did not map the IRQs I was assigned to the correct PCI Interrupt Lines, as such the bulk transfers are failing. I have fixed my code to assign things correctly however now I am having issues with IRQ conflicts as the VGA card is wired to use INTA#, and the VT6212 is wired to use INTA#, INTB# and INTC#. I think there is still a gap in my understanding of the IRQ routing as from what I understand the interrupt lines should be able to be shared, but I am not sure how to configure the chipset to assign multiple IRQs to a single line.
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby gnif » Sat Mar 13, 2021 2:58 am

So after a ton of extra reading, I finally understand how PCI Interrupt line routing works and I was able to map the physical assignments out. For my board it's as follows
Code: Select all
|Slot 0|A|B|C|D|
|Slot 1|B|C|D|A|
|Slot 2|C|D|A|B|


Using this information I was able to write some code that correctly re-assigns the IRQs based on the physical routing while avoiding stomping on reserved IRQs. USBUHCI can now load for both devices correctly and can enumerate devices!
There are still issues, all my mice both old, simple and complex all have various faults. USB sticks have bulk transfer timeouts during enumeration.

I have verified that the interrupts are working correctly using a DSO, and UHCI.COM is able to load correctly and provide DOS mouse services for ALL my mice. The only thing that remains now is a software compatibility issue with the VIA chipset.
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby gnif » Sat Mar 13, 2021 1:35 pm

Ok some more test results:

My singular Kensington USB 1.1 mouse enumerates and USBMOUSE tries to use it, however, it is flagged bad with the error 4h at stage 200. Code shows that this is may really be an issue however the mouse doesn't function.

Two of my USB 2.0 mice, both HP branded Logitech mice from different years enumerate fine however USBMOUSE fails with a Babble error 20h at stage 50.
Not sure if this would help, but Linux seems to handle these Babble errors differently here, please see: http://lkml.iu.edu/hypermail/linux/kern ... 00665.html

My last two mice which are more complex devices (multiple HIDs) fail to enumerate correctly... but I wasn't expecting much from these.

If there is anything I can provide to help please let me know, I am capable of dumping out registers, etc... I just need to know what you're looking for.
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby Bret » Sat Mar 13, 2021 6:11 pm

Wow! You've been busy with some pretty sophisticated troubleshooting. Tracking down PCI and IRQ issues is pretty impressive -- not a whole lot of people can do that.

I've personally never seen Babble errors before -- a Babble error means that the device is sending more data than it is supposed to. Your link to the site that references XCHI Babble error handling really doesn't help, but it was a good attempt.

I think the next thing to do is to download the descriptors. The way I have USBMOUSE setup, stages less than 200 are related to the general enumeration process (among other things, assigning the device an address). Stages 200 and up are related to downloading the descriptors from the device and figuring out what kind of device it is. For mice, this includes (among other things) figuring out how many buttons and wheels it has.

You can use the USBUHCI(L) /Descr and /R (HID Report descriptor) to download the descriptors and see what they look. The /Descr option needs the device address as a parameter and mainly downloads the Device, Interface, and EndPoint descriptors. The /R option needs both an address and an interface number as parameters and downloads the HID Report Descriptor which for a mouse contains details about the wheels and buttons and number of bits/bytes dedicated to each of those. HID Report Descriptors can get REALLY complicated and confusing. Looking at the descriptors is the next logical step, I think.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: SIS496 Issues

Postby gnif » Sat Mar 13, 2021 8:23 pm

Thanks Bret,

I am no stranger to debugging low-level issues :)

Once I get this working I will clean up my little driver and post it on GitHub for others, it could be of use to quite a few. From what I am reading on Vogons people avoid this VIA USB chip and opt for an NEC-based USB device due to hanging issues (likely IRQ conflict) on 486 gen hardware, this might be why you have not seen such reports before.

I have created HID-based devices using MCUs in the past and know how complex they can be, however, I have never had to write a parser so I can imagine how complex this could be.

PS: For what it's worth, I also dug into the babble error and dumped out the registers from the VT6212 devices, it defaults to leaving the ports enabled when a babble error occurs.

This also may be of use: https://www.insidegadgets.com/wp-conten ... T6212L.pdf
One of the few chips like this that actually has public documentation about it's registers, etc.

Here is everything :)
Thanks again Bret!

Code: Select all
USBHOSTS 0.06, (C) 2007-2009, Bret E. Johnson.

       PCI BUS
      ÍÍÍÍÍÍÍÍÍÍ                             BASE           USB DRIVER
      I   B  D F                      BASE   PHYSICAL   ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
HOST  d   u  v n              USB IRQ I/O    MEMORY     HST             BW
TYPE  x   s  c c  VENDR PROD  VER NUM ADDR   ADDRESS    IDX   STATUS   USED
ÍÍÍÍ  Í ÍÍÍ ÍÍ Í  ÍÍÍÍÍ ÍÍÍÍÍ ÍÍÍ ÍÍÍ ÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍ  ÍÍÍ ÍÍÍÍÍÍÍÍÍÍ ÍÍÍÍ
UHCI  0   0 13 1  1106h 3038h 1.0  11 FF80h ±±±±±±±±±±  ±±± ±±±±±±±±±± ±±±±
                  VIA Technologies Inc                   

UHCI  1   0 13 0  1106h 3038h 1.0  10 FF40h ±±±±±±±±±±  ±±± ±±±±±±±±±± ±±±±
                  VIA Technologies Inc                   

ÍÍÍÍ  Í ÍÍÍ ÍÍ Í  ÍÍÍÍÍ ÍÍÍÍÍ ÍÍÍ ÍÍÍ ÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍ  ÍÍÍ ÍÍÍÍÍÍÍÍÍÍ ÍÍÍÍ
EHCI  0   0 13 2  1106h 3104h 2.0  12 ±±±±± FFBE_FF00h  ±±± ±±±±±±±±±± ±±±±
                  VIA Technologies Inc                   


Code: Select all
USBDEVIC 0.05, (C) 2008, Bret E. Johnson.
Program to display information about Devices attached to the USB Host(s).

                               DEVICE ADDRESSES
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Host Index:  0  Host Type: UHCI  Bus Type: PCI   IRQ#: 11  Root Hub Ports: 2
Vendor: 1106h = VIA Technologies Inc                       Product: 3038h
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
                DEVICES                                   INTERFACES           
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
                           L                C  I A                O           
ADRS                       o         P      o  n l                w           
ÍÍÍÍ   (hex)               S         o BUS  n  t t                n           
Test VEND PROD     Sub Pro p USB HUB r POWR f  f I                e     Sub Pro
RWak  ID   ID  Cls Cls col d VER ADR t (mA) g  c n  DESCRIPTION   d Cls Cls col
ÍÍÍÍ ÍÍÍÍ ÍÍÍÍ ÍÍÍ ÍÍÍ ÍÍÍ Í ÍÍÍ ÍÍÍ Í ÍÍÍÍ Í  Í Í ÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Í ÍÍÍ ÍÍÍ ÍÍÍ
  1  1106 3038   9   0   0 . 1.0 ... . s  0 1  0 0*Root Hub       Y   9   0   0
     VIA Technologies Inc                   


                               DEVICE ADDRESSES
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Host Index:  1  Host Type: UHCI  Bus Type: PCI   IRQ#: 10  Root Hub Ports: 2
Vendor: 1106h = VIA Technologies Inc                       Product: 3038h
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
                DEVICES                                   INTERFACES           
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
                           L                C  I A                O           
ADRS                       o         P      o  n l                w           
ÍÍÍÍ   (hex)               S         o BUS  n  t t                n           
Test VEND PROD     Sub Pro p USB HUB r POWR f  f I                e     Sub Pro
RWak  ID   ID  Cls Cls col d VER ADR t (mA) g  c n  DESCRIPTION   d Cls Cls col
ÍÍÍÍ ÍÍÍÍ ÍÍÍÍ ÍÍÍ ÍÍÍ ÍÍÍ Í ÍÍÍ ÍÍÍ Í ÍÍÍÍ Í  Í Í ÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Í ÍÍÍ ÍÍÍ ÍÍÍ
  1  1106 3038   9   0   0 . 1.0 ... . s  0 1  0 0*Root Hub       Y   9   0   0
     VIA Technologies Inc                   
ÄÄÄÄ ÄÄÄÄ ÄÄÄÄ ÄÄÄ ÄÄÄ ÄÄÄ Ä ÄÄÄ ÄÄÄ Ä ÄÄÄÄ Ä  Ä Ä ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Ä ÄÄÄ ÄÄÄ ÄÄÄ
  2R 046D C018   0   0   0 Y 2.0   1 1  100 1  0 0*Mouse          .   3   1   2
     Logitech Inc                           


Code: Select all
USBUHCI 0.14, (C) 2007-2010, Bret E. Johnson.
DOS Driver for a Universal HCI compatible USB Host Controller.

DEVICE ADDRESS:   2
CONFIGURATION:    1

        DEVICE DESCRIPTOR
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Descr Length:                 12h  18
Descr Type:                   01h  Device
USB Release:                0200h  2.00
Device Class:                 00h  Look at Interface
Device SubClass:              00h  None
Device Protocol:              00h  None
Max Packet Size EP0:          08h  8
Vendor ID:                  046Dh  Logitech Inc                           
Product ID:                 C018h  49,176
Device Release:             4301h  43.01
Manufacturer String:          01h  "Logitech"
Product String:               02h  "USB Optical Mouse"
Serial # String:              00h  None
# of Configs:                 01h  1

    CONFIGURATION DESCRIPTOR
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Descr Length:                 09h  9
Descr Type:                   02h  Configuration
Descr Total Length:         0022h  34
# of Interfaces:              01h  1
Configuration Value:          01h  1
Configuration String:         00h  None
Attributes:                   A0h  Valid Historical Attribute 80h
                                   Bus Powered
                                   Remote Wakeup
                                   Not Battery Powered
Current Draw / 2:             32h  50 (100 mA)

      INTERFACE DESCRIPTOR
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Descr Length:                 09h  9
Descr Type:                   04h  Interface
Interface Number:             00h  0
Alternate Setting:            00h  0
# of End Points:              01h  1
Interface Class:              03h  HID (Human Interface Device)
Interface SubClass:           01h  Boot
Interface Protocol:           02h  Mouse
Interface String:             00h  None

  HUMAN INTERFACE DEVICE DESCR
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Descr Length:                 09h  9
Descr Type:                   21h  HID (Human Interface Device)
HID Class Release:          0111h  1.11
Country Code:                 00h  None/Not Applicable
# of Classes:                 01h  1
Class Descr Type 1:           22h  Report
Class Descr Size 1:         0034h  52

      END POINT DESCRIPTOR
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Descr Length:                 07h  7
Descr Type:                   05h  EndPoint
End Point Number:             81h  EndPoint = 1  Direction = In
Attributes:                   03h  Interrupt NonSynchronous Data
Max Packet Size:            0005h  5
Max Poll Interval:            0Ah  10


Code: Select all
USBUHCI 0.14, (C) 2007-2010, Bret E. Johnson.
DOS Driver for a Universal HCI compatible USB Host Controller.

              USB HID (HUMAN INTERFACE DEVICE) REPORT DESCRIPTOR               
ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
05 01          Usage Page:       Generic Desktop
09 02          Usage:            Mouse
A1 01          Collection:       Application

09 01            Usage:            Pointer
A1 00            Collection:       Physical

05 09              Usage Page:       Buttons
19 01              Usage Min:        Button #1 (Primary)
29 03              Usage Max:        Button #3 (Tertiary)
15 00              Logical Min:      00h  0  0
25 01              Logical Max:      01h  1  +1
75 01              Report Size:      1
95 03              Report Count:     3
81 02              INPUT:            Data  Variable  Absolute
                                     No_Wrap  Linear  Preferred_State
                                     No_Null_State  Non_Volatile  Bit_Field

75 05              Report Size:      5
95 01              Report Count:     1
81 01              INPUT:            Constant  Array  Absolute
                                     No_Wrap  Linear  Preferred_State
                                     No_Null_State  Non_Volatile  Bit_Field

05 01              Usage Page:       Generic Desktop
09 30              Usage:            X-axis
09 31              Usage:            Y-axis
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby gnif » Sun Mar 14, 2021 9:51 am

Ok, I figured it out mostly!

1) Can't load high due to the fact that I was using a UMB enabler
2) Swapping back to EMM386 all the mice now function correctly... but...
3) New fault, SB16 when playing sound effects in some games and at windows 3.11 start causes a system hang if `USBMOUSE` is loaded, even without cutemouse, etc.

This is not an IRQ conflict, SB is on IRQ5... perhaps a DMA conflict.
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby gnif » Sun Mar 14, 2021 6:03 pm

Further diagnostics...

IRQ5 (The sound card) ISR is being messed with by USBMOUSE by the looks of things. Games that work fine are using polling (Space Quest 1, SimCity 2000, etc..) but anything that uses interrupts it seems the ISR randomly doesn't fire and the interrupt is never cleared. My DSO shows IRQ5 on the ISA bus goes high and stays there, even though it works fine a handful of times first.

As soon as I load USBMOUSE this problem starts... even without CTMOUSE.

EDIT: Further diagnostics show the INTA# and INTB# signals are asserted before IRQ5 hangs indicating that the ISR is not properly clearing the interrupts coming from the PCI device. If I wait long enough, the system recovers for a second or two, and then repeats, in some instances triggering a warm reboot.

It should also be noted that on some boots, usually when I have done a warm reboot via ctrl+alt+del, USBUHCI reports there is another program controlling the device, which is simply not possible as this BIOS has no notion of USB.
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby Bret » Mon Mar 15, 2021 5:03 am

USBMOUSE doesn't directly modify any IRQ's by itself -- it simply "leverages" the one used by the Host Controller. In the new versions I'm considering changing that so all USB "polling" using INT 70h (IRQ 8). I haven't got that all figured out yet, though.

However, the PS2 mouse uses IRQ 12 (INT 74h), so there could be some sort of conflict going on there. USBMOUSE doesn't directly do anything to IRQ 12 but is indirectly tied to the software portion of IRQ 12 (the INT 74h software). Again, it is a very indirect relationship due to the way the mouse software works -- USBMOUSE never changes the IRQ handling software (particularly the part that handles the PIC). I have no idea how any of that would affect IRQ 5.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: SIS496 Issues

Postby gnif » Mon Mar 15, 2021 6:07 am

I have since confirmed that it's not directly affecting IRQ5, it's an end result of the system hang. I just did a nasty hack to verify that the vt6212 is not at fault by allowing it to load, and then physically disconnecting it's interrupt lines. If it was caused by a stuck PCI interrupt this would have prevented the issue from occurring, but it made no difference.

This confirms without a doubt that the USB MOUSE or USBUHCI drivers are breaking something. I also monitored IRQ12 during this and never saw any change, as well as the DMA request and ACK lines for the sound card which works just fine also. Whatever is going wrong is preventing ISRs from running and clearing serviced interrupts.... perhaps disabling interrupts and failing to re-enable them somewhere?

EDIT: Also starting to get a high-level understanding of your code and what AMIS is... although I am still way out of my depth at the moment when it comes to DOS programming.

EDIT2: One other thought, from what I understand USBUHCI should have worked even when I was not using EMM386 just in low memory too... This might all be related.

EDIT3: I just saw it hang without USBMOSUE loaded, so this isolates it back to USBUHCI
gnif
 
Posts: 8
Joined: Fri Mar 12, 2021 2:49 am

Re: SIS496 Issues

Postby Bret » Thu Mar 18, 2021 2:18 pm

Which IRQ is the USB host controller actually using?

The only two IRQ's that USBUHCI messes with are the one for the host controller and the clock (IRQ0/INT08). If the host controller is using IRQ 5 and so is the sound card, that would explain the problem. USBUHCI tries to "play nice" with sharing IRQ's (like allowing multiple USB hosts to share the same IRQ), but other hardware (like sound cards) usually don't.

Just a shot in the dark right now.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM


Return to Programs

Who is online

Users browsing this forum: No registered users and 2 guests

cron