home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 October / CHIP_CD_1996_10_PL.iso / software / ktest / qemm8 / technote.qip / BUS-MAST.TEC next >
Encoding:
Text File  |  1995-11-15  |  15.2 KB  |  306 lines

  1.  
  2.             Using SCSI and Bus-Mastering Devices
  3.  
  4.  Quarterdeck Technical Note #121         Filename: BUS-MAST.TEC
  5.  by Quarterdeck Technical Support      CompuServe: BUSMAS.TEC
  6.  Last revised: 3/28/95                   Category: HW
  7.  
  8.  Subject: This note provides troubleshooting tips for users of
  9.           bus-mastering (typically SCSI) hard drives, and explains
  10.           bus-mastering technology in general for those who are
  11.           interested.
  12.  
  13.  Note: All references to 386 computers or to the 80386 processor,
  14.  unless otherwise stated, refer to 386 and higher processors.
  15.  
  16.  This note is divided into two parts -- a troubleshooting section
  17.  for those who believe that they are having problems with QEMM and
  18.  a SCSI hard drive, and an informational section on bus-mastering
  19.  issues.
  20.  
  21.  Refer to the troubleshooting section of the QEMM manual, or in the
  22.  technical note QEMM GENERAL TROUBLESHOOTING (TROUBLE.TEC) for
  23.  instructions on how to boot your machine without QEMM.
  24.  
  25.  1) If your machine locks immediately after posting the banner for
  26.     QEMM386, check to see if the DB=2 parameter is on the
  27.     QEMM386.SYS line in CONFIG.SYS. If this parameter is not
  28.     present, add it. If your machine now works, you're done, and
  29.     you may read the information section below. If your machine
  30.     still fails, continue with Step 2.
  31.  
  32.  2) Add the parameter VDS:N to the QEMM line, and reboot. If this
  33.     solves your problem, proceed to Step 3.
  34.  
  35.  3) Remove VDS:N parmeter (if one is present) from the QEMM line,
  36.     and immediately before the QEMM386.SYS place the line
  37.  
  38.     DEVICE=C:\QEMM\FIXINT13.SYS /STACKSIZE=384
  39.  
  40.     FIXINT13.SYS is in the QEMM directory.  It is also
  41.     available on the Quarterdeck BBS at UK 01245-496943 or Ireland
  42.     353 1 2844381. If this solves your problem, you're done.
  43.     If this does not solve your problem (but the VDS parameter did),
  44.     replace it. In either case, you may now choose to read the
  45.     information section below.
  46.  
  47.  Q. What is a bus-mastering device?
  48.  
  49.  A. Bus-mastering devices are peripherals, typically hard drives,
  50.     that do their own direct memory addressing (DMA) without going
  51.     through the machine's Central Processing Unit (CPU) or its DMA
  52.     controller. The most common bus-mastering devices are SCSI hard
  53.     disk controllers, but other types of devices can be
  54.     bus-mastering as well. Bus-mastering ESDI disk controllers and
  55.     video cards do exist, and an increasing number of bus-mastering
  56.     network cards are available as well. While bus-mastering
  57.     devices are high-performance devices and quite often found on
  58.     386 and higher systems, they are, unfortunately, by design
  59.     incompatible with one of the most common operating modes of the
  60.     80386 processor--the Virtual 86 mode.
  61.  
  62.     Specifically, the problem is that the device puts data into
  63.     absolute memory addresses and assumes that the contents of
  64.     those memory addresses will always remain constant. However, on
  65.     a 386 processor in Virtual 86 mode, this is often an incorrect
  66.     assumption. When a 386 memory manager such as QEMM, or a 386
  67.     operating environment such as DESQview 386 or Microsoft Windows
  68.     Enhanced Mode is used, it typically associates physical memory
  69.     with linear or "logical" addresses. QEMM does this, for
  70.     instance, to make High RAM appear at addresses between 640K and
  71.     1MB. When a bus-mastering device tries to access data in
  72.     memory, it presumes that physical and logical addresses are the
  73.     same. In Virtual 86 mode, a given memory address can, at any
  74.     moment, contain code or data from various regions of physical
  75.     memory.
  76.  
  77.     If you are using a bus-mastering device on a 386 that is in
  78.     Virtual 86 mode and memory paging is occurring (when QEMM is
  79.     providing High RAM; when QEMM is providing expanded memory;
  80.     when DESQview 386 or Microsoft Windows is switching from one
  81.     virtual machine to another), your machine will probably hang
  82.     when you use the bus-mastering device, unless certain
  83.     precautions are taken.
  84.  
  85.     Quarterdeck first became aware of the problem from customers
  86.     who had bus-mastering SCSI hard disk controllers. Users
  87.     reported that they could boot their machines and start up
  88.     DESQview. As long as they ran only one application, their
  89.     system ran fine. As soon as they opened a second application,
  90.     the system would hang. The problem was also seen by users who
  91.     were not using DESQview, but who were using the LOADHI feature
  92.     of QEMM. In both cases, the hang would occur because the disk
  93.     controller assumed that memory really existed at the address
  94.     that it was accessing. In theory, this could have caused data
  95.     corruption, but in reality it never did. The memory corruption
  96.     was typically so extensive that the systems simply hung as soon
  97.     as a change in the memory map occurred. Other 386 memory
  98.     managers exhibited the same symptoms, as did Windows version
  99.     3.x when run in Enhanced Mode. QEMM solved the problem in its
  100.     own code, but this solution was not adopted by Windows when it
  101.     entered Enhanced Mode (see the reference to SMARTDRV in item 4
  102.     below).
  103.  
  104.  Q. What is the best approach to running bus-mastering devices?
  105.  
  106.  A. There are several possible solutions:
  107.  
  108.  1) THE BEST SOLUTION: Contact the maker of your bus-mastering
  109.     device and see whether the manufacturer supports the VDS
  110.     (Virtual DMA Services) specification. VDS is now an
  111.     industry-wide specification supported by IBM, Microsoft and
  112.     Quarterdeck, as well as many other hardware and software
  113.     suppliers. VDS, either provided in the device's ROM or as a
  114.     device driver, allows a bus-mastering device to find the real
  115.     physical address of its data when the processor is in Virtual
  116.     86 mode. QEMM versions 5.00 and later support the VDS
  117.     specification. A VDS driver provides the best solution to this
  118.     problem in terms of reliability, speed and memory efficiency. A
  119.     VDS driver may be loaded into High RAM if it appears in the
  120.     CONFIG.SYS file after the QEMM386.SYS line, but you may need to
  121.     manually add a DB=2 parameter to the QEMM386.SYS device line to
  122.     accomplish this if you are not using QEMM 7.5 or later; see
  123.     section 6 below.
  124.  
  125.  2) Make sure you're using QEMM version 7.5 or later. QEMM now
  126.     automatically creates a buffer when it detects an addressing
  127.     problem with a bus-mastering hard drive controller, and this
  128.     buffer's support continues into Microsoft Windows.
  129.  
  130.  3) Similarly, the drivers of many bus-mastering hard disks have
  131.     proprietary (that is, non-VDS) buffering options. The best
  132.     course in this case is to check the documentation for your disk
  133.     controller to see if the driver has a parameter to set up
  134.     buffering for disk operations. Some drivers will also document
  135.     parameters that are specific to 386 operations. For example,
  136.     the early Adaptec drivers SCSIHA.SYS and AHA1540.SYS included
  137.     both 386 and disk buffering options invoked by the parameters
  138.     "/v386" and "/b:64." "/v386" stands for virtual 386; "/b:64"
  139.     allocates a 64k buffer, for DMA.
  140.  
  141.     Unlike the drivers in (1) above, these drivers do not provide
  142.     VDS services. If you are using a driver such as this, make sure
  143.     that it is not loaded high. The purpose of such a driver is to
  144.     provide buffering into physical addresses that are the same as
  145.     logical addresses; if the program is loaded high, its buffer
  146.     will be in logical addresses that are not the same as their
  147.     physical addresses. Please read the section below titled
  148.     "Making Sure Your Device Driver Loads Low".
  149.  
  150.  4) Check the documentation for your bus-mastering device and see
  151.     if it can be configured to use the BIOS or any one of the
  152.     standard DMA channels. QEMM can correct the problem if the BIOS
  153.     or standard DMA channels are used.
  154.  
  155.  5) As mentioned above, bus-mastering hard drives can also cause
  156.     problems for Microsoft Windows 3. Microsoft's solution is in
  157.     its SmartDrive disk cache. SMARTDRV (and other disk caches)
  158.     contain code that can buffer direct memory access. Before QEMM
  159.     7.03, QEMM's VDS services were almost completely disabled when
  160.     you entered Enhanced mode, so SMARTDRV's buffering was needed
  161.     to ensure that no bus-mastering conflicts occured inside of
  162.     Microsoft Windows. If you are using QEMM 7.5 or later, QEMM's
  163.     VDS services and disk buffering will function properly while
  164.     Microsoft Windows Enhanced mode is running, so loading SMARTDRV
  165.     is not necessary.
  166.  
  167.     a) The versions of Smartdrv that ship with Microsoft Windows
  168.        3.1, DOS 5, and DOS 6 have two functions: to provide disk
  169.        caching through a module loaded in AUTOEXEC.BAT, and to
  170.        provide buffering for SCSI hard drives through a module
  171.        loaded in CONFIG.SYS. If you are using Windows 3.1 AND a
  172.        bus-mastering hard drive and you are NOT using any of the
  173.        options numbered 1 through 4 above, make sure that the
  174.        following line appears in CONFIG.SYS:
  175.  
  176.        DEVICE=C:\WINDOWS\SMARTDRV.EXE /DOUBLE_BUFFER
  177.  
  178.        (If your path to SmartDrive differs, change C:\WINDOWS to
  179.        the correct path.) Please read the section below titled
  180.        "Making Sure Your Device Driver Loads Low".
  181.  
  182.     b) Windows 3.0 and DOS 5 shipped with SmartDrive version 3 or
  183.        lower. If you are using one of these versions of SmartDrive,
  184.        make sure that the following line appears in your CONFIG.SYS
  185.        file:
  186.  
  187.        DEVICE=C:\WINDOWS\SMARTDRV.SYS
  188.  
  189.        (If your path to SmartDrive differs, change C:\WINDOWS to
  190.        the correct path.)
  191.  
  192.        Please read the section below titled "Making Sure Your
  193.        Device Driver Loads Low".
  194.  
  195.  6) QEMM has a DB=xx (DISKBUF=xx) parameter that can prevent
  196.     QEMM-SCSI problems at the expense of a little conventional
  197.     memory. "xx" is the number of K used for buffering. Any value
  198.     for xx is sufficient to correct the problem. DISKBUF=2 is fine
  199.     for most cases. Configuring QEMM with a DISKBUF greater than 2
  200.     might improve disk performance, but setting DISKBUF to more
  201.     than 10 is probably a waste of memory.
  202.  
  203.  Q. How does QEMM's detection of bus-mastering hard drives work?
  204.  
  205.  A. QEMM will detect a bus-mastering hard drive and create a disk
  206.     buffer automatically as long as QEMM itself is loaded from that
  207.     bus-mastering hard drive. If you load a driver that provides
  208.     VDS (Virtual DMA Services) support BEFORE you load QEMM, QEMM
  209.     will not create the disk buffer. In cases where QEMM
  210.     automatically creates this buffer, it does not add a DISKBUF
  211.     parameter to the QEMM386.SYS line. QEMM's automatic detection
  212.     of bus-mastering hard disks is active only when the RAM
  213.     parameter is specified on the QEMM386.SYS line in the
  214.     CONFIG.SYS file. You can disable QEMM's automatic disk
  215.     buffering by using the QEMM386.SYS parameters DISKBUF=0, but
  216.     there is usually no reason to disable this feature. If you have
  217.     a bus-mastering hard disk that you do not load QEMM from, QEMM
  218.     will not detect bus-mastering conflicts with it, and you must
  219.     either use the disk controller's VDS support or specify the
  220.     DISKBUF=nn (DB=nn).
  221.  
  222.     Use of the DB= parameter will not help if the bus-mastering
  223.     device is something other than a hard disk. If your
  224.     bus-mastering device is not a hard disk then the solutions
  225.     above, especially #1, are your only options.
  226.  
  227.     If your bus-mastering hard disk controller uses a VDS device
  228.     driver that is loaded after QEMM386.SYS, QEMM will still create
  229.     a 2K disk buffer, because the VDS support will not be active
  230.     when QEMM loads. This disk buffer will be necessary in most
  231.     circumstances, because the Optimize program would otherwise
  232.     fail when it tried to load the VDS driver into High RAM.
  233.     However, you may wish in this circumstance to reduce the size
  234.     of the disk buffer as much as possible by placing the DISKBUF=1
  235.     parameter on the QEMM386.SYS device driver line. The smaller
  236.     disk buffer is preferable here, because the disk buffer will
  237.     never again be used after the VDS driver loads, and a bigger
  238.     disk buffer uses valuable conventional memory.
  239.  
  240.     If you are both disabling automatic disk buffering (with the
  241.     DISKBUF=0 parameter) and creating a disk buffer for the page
  242.     frame (with the DISKBUFFRAME=xx parameter), you must place the
  243.     DISKBUF=0 parameter before the DISKBUFFRAME=xx parameter on the
  244.     QEMM386.SYS line in the CONFIG.SYS file. If you reverse this
  245.     ordering, automatic disk buffering will still be disabled, but
  246.     the disk buffer for the page frame will not be created.
  247.  
  248.  Q. I don't have a VDS driver, and I think that my proprietary
  249.     device driver or my disk cache should be loaded low. How do I
  250.     prevent it from loading high?
  251.  
  252.  A. For double-buffering to work properly, the device driver for
  253.     your bus-mastering hardware must be loaded in conventional
  254.     memory, where physical and logical addresses are almost always
  255.     the same. You must therefore make sure that it loads low if you
  256.     are depending on it to provide DMA buffering. We will use
  257.     SMARTDRV as an example of such a program. Change the
  258.     instructions below to fit your device driver.
  259.  
  260.     Ensure that there is no LOADHI command preceding SMARTDRV on
  261.     the line which loads it.
  262.  
  263.     OPTIMIZE will very likely try to load SmartDrive high, unless
  264.     you instruct it not to do so. This is most easily done as
  265.     follows:
  266.  
  267.     1) Using a text editor, create a text file called OPTIMIZE.NOT
  268.        in the \QEMM directory. Systems with DOS 5 and later can
  269.        type "EDIT OPTIMIZE.NOT" from the \QEMM directory to create
  270.        the file. If such a file exists already, simply open it for
  271.        editing.
  272.  
  273.     2) Put a new line in OPTIMIZE.NOT that says:
  274.  
  275.        SMARTDRV
  276.  
  277.        Do not specify a pathname nor an extension to the file name.
  278.        Save the file and exit the editor.
  279.  
  280.     3) From now on, OPTIMIZE will not affect the SMARTDRV line in
  281.        either CONFIG.SYS or AUTOEXEC.BAT. As long as SMARTDRV is
  282.        not being loaded high already, it will not load high during
  283.        future OPTIMIZE sessions.
  284.  
  285.  Q. I know I have a bus-mastering device on my computer, but I
  286.     haven't seen any problem. Why not?
  287.  
  288.  A. It's possible that your bus-mastering device uses a standard
  289.     DMA channel for DMA operations. QEMM automatically supports
  290.     bus-mastering when standard DMA channels are used.
  291.  
  292.     Your bus-mastering device may have been shipped with a VDS
  293.     driver in its ROM. Some bus-mastering hard disk controllers
  294.     ship with drivers that make VDS calls, and these drivers do not
  295.     require the DB parameter or any other buffering. We expect that
  296.     most bus-mastering devices will eventually include VDS drivers
  297.     and, therefore, will not exhibit any problems when run in
  298.     Virtual 86 mode.
  299.  
  300.  ******************************************************************
  301.  *      Trademarks are property of their respective owners.       *
  302.  *   This and other technical notes may be available in updated   *
  303.  *     forms through Quarterdeck's standard support channels.     *
  304.  *          Copyright (C) 1995 Quarterdeck Corporation            *
  305.  ******************** E N D   O F   F I L E ***********************
  306.