The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/pci/bt9xx.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Product specific probe and attach routines for:
    3  *      Buslogic BT946 and BT956 SCSI controllers
    4  *
    5  * Copyright (c) 1995 Justin T. Gibbs
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice immediately at the beginning of the file, without modification,
   13  *    this list of conditions, and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. Absolutely no warranty of function or purpose is made by the author
   18  *    Justin T. Gibbs.
   19  * 4. Modifications may be freely made to this file if the above conditions
   20  *    are met.
   21  *
   22  * $FreeBSD: src/sys/pci/bt9xx.c,v 1.8.2.1 1999/09/05 08:20:56 peter Exp $
   23  */
   24 
   25 #include "pci.h"
   26 #if NPCI > 0
   27 #include <sys/param.h>
   28 #include <sys/systm.h>
   29 #include <sys/malloc.h>
   30 #include <sys/kernel.h>
   31 #include <scsi/scsi_all.h>
   32 #include <scsi/scsiconf.h>
   33 #include <pci/pcireg.h>
   34 #include <pci/pcivar.h>
   35 #include <i386/scsi/btreg.h>
   36 
   37 /* XXX Need more device IDs */
   38 #define PCI_DEVICE_ID_BUSLOGIC_946      0x1040104Bul
   39 #define PCI_DEVICE_ID_BUSLOGIC_946_OLD  0x0140104Bul
   40 
   41 static char* bt_pci_probe __P((pcici_t tag, pcidi_t type));
   42 static void bt_pci_attach __P((pcici_t config_id, int unit));
   43 
   44 static struct  pci_device bt_pci_driver = {
   45         "bt",
   46         bt_pci_probe,
   47         bt_pci_attach,
   48         &bt_unit,
   49         NULL
   50 };
   51 
   52 DATA_SET (pcidevice_set, bt_pci_driver);
   53 
   54 static  char*
   55 bt_pci_probe (pcici_t tag, pcidi_t type)
   56 {
   57         switch(type) {
   58                 case PCI_DEVICE_ID_BUSLOGIC_946_OLD:
   59                 case PCI_DEVICE_ID_BUSLOGIC_946:
   60                         return ("Buslogic 946 SCSI host adapter");
   61                         break;
   62                 default:
   63                         break;
   64         }
   65         return (0);
   66 
   67 }
   68 
   69 static void
   70 bt_pci_attach(config_id, unit)
   71         pcici_t config_id;
   72         int     unit;
   73 {
   74         u_char reg;
   75         u_long io_port;
   76         unsigned opri = 0;
   77         struct bt_data *bt;
   78 
   79         for(reg = PCI_MAP_REG_START; reg < PCI_MAP_REG_END; reg+=4) {
   80                 io_port = pci_conf_read(config_id, reg);
   81                 if ((io_port&~7)==0) continue;
   82                 if(io_port & PCI_MAP_IO) {
   83                         io_port &= ~PCI_MAP_IO;
   84                         break;
   85                 }
   86         }
   87         if(reg == PCI_MAP_REG_END)
   88                 return;
   89 
   90         if(!(bt = bt_alloc(unit, io_port)))
   91                 return;  /* XXX PCI code should take return status */
   92 
   93         if(!(pci_map_int(config_id, bt_intr, (void *)bt, &bio_imask))) {
   94                 bt_free(bt);
   95                 return;
   96         }
   97         /*
   98          * Protect ourself from spurrious interrupts during
   99          * intialization and attach.  We should really rely
  100          * on interrupts during attach, but we don't have
  101          * access to our interrupts during ISA probes, so until
  102          * that changes, we mask our interrupts during attach
  103          * too.
  104          */
  105         opri = splbio();
  106 
  107         if(bt_init(bt)){
  108                 bt_free(bt);
  109                 splx(opri);
  110                 return; /* XXX PCI code should take return status */
  111         }
  112 
  113         bt_attach(bt);
  114 
  115         splx(opri);
  116         return;
  117 }
  118 
  119 #endif /* NPCI > 0 */

Cache object: c85851568c7e3c59a5f1dd6eb9db3687


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.