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/if_sr_p.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  * Copyright (c) 1996 John Hay.
    3  * Copyright (c) 1996 SDL Communications, Inc.
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. Neither the name of the author nor the names of any co-contributors
   15  *    may be used to endorse or promote products derived from this software
   16  *    without specific prior written permission.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28  * SUCH DAMAGE.
   29  *
   30  * $FreeBSD: src/sys/pci/if_sr_p.c,v 1.1.2.2 1999/09/05 08:21:10 peter Exp $
   31  */
   32 
   33 #include "pci.h"
   34 #if NPCI > 0
   35 
   36 #include "sr.h"
   37 
   38 #include <sys/param.h>
   39 #include <sys/systm.h>
   40 #include <sys/kernel.h>
   41 #include <sys/malloc.h>
   42 
   43 #include <pci/pcireg.h>
   44 #include <pci/pcivar.h>
   45 
   46 #ifndef BUGGY
   47 #define BUGGY           0
   48 #endif
   49 
   50 /*
   51  * The must match with the real functions in if_sr.c
   52  */
   53 extern void *srattach_pci(int unit,
   54                           vm_offset_t plx_vaddr,
   55                           vm_offset_t sca_vaddr);
   56 extern void srintr_hc(void *hc);
   57 
   58 static char *sr_pci_probe(pcici_t tag, pcidi_t type);
   59 static void sr_pci_attach(pcici_t config_id, int unit);
   60 
   61 static u_long src_count = NSR;
   62 
   63 struct pci_device sr_pci_driver =
   64 {
   65         "src",
   66         sr_pci_probe,
   67         sr_pci_attach,
   68         &src_count,
   69         NULL};
   70 
   71 DATA_SET (pcidevice_set, sr_pci_driver);
   72 
   73 static char *
   74 sr_pci_probe(pcici_t tag, pcidi_t type)
   75 {
   76         switch(type) {
   77         case 0x556812aa:
   78                 return ("RISCom/N2pci");
   79                 break;
   80         case 0x55684778:
   81         case 0x55684877:
   82                 /*
   83                  * XXX This can probably be removed sometime.
   84                  */
   85                 return ("RISCom/N2pci (old id)");
   86                 break;
   87         default:
   88                 break;
   89         }
   90         return (0);
   91 }
   92 
   93 static void
   94 sr_pci_attach(pcici_t config_id, int unit)
   95 {
   96         void *hc;
   97 #if BUGGY > 0
   98         u_int *fecr;
   99 #endif
  100         vm_offset_t plx_vaddr, plx_paddr, sca_vaddr, sca_paddr;
  101 
  102 #if BUGGY > 0
  103         printf("srp: ID %x\n", pci_conf_read(config_id, 0));
  104         printf("srp: BADR0 %x\n", pci_conf_read(config_id, 0x10));
  105         printf("srp: BADR1 %x\n", pci_conf_read(config_id, 0x18));
  106 #endif
  107         if(!pci_map_mem(config_id, 0x10, &plx_vaddr, &plx_paddr)) {
  108                 printf("srp: map failed.\n");
  109                 return;
  110         }
  111 #if BUGGY > 0
  112         printf("srp: vaddr %x, paddr %x\n", plx_vaddr, plx_paddr);
  113 #endif
  114         if(!pci_map_mem(config_id, 0x18, &sca_vaddr, &sca_paddr)) {
  115                 printf("srp: map failed.\n");
  116                 return;
  117         }
  118 #if BUGGY > 0
  119         printf("srp: vaddr %x, paddr %x\n", sca_vaddr, sca_paddr);
  120         fecr = (u_int *)(sca_vaddr + 0x200);
  121         printf("srp: FECR  %x\n", *fecr);
  122 #endif
  123 
  124         hc = srattach_pci(unit, plx_vaddr, sca_vaddr);
  125         if(!hc)
  126                 return;
  127 
  128         if(!pci_map_int(config_id, srintr_hc, (void *)hc, &net_imask)) {
  129                 free(hc, M_DEVBUF);
  130                 return;
  131         }
  132 }
  133 
  134 #endif /* NPCI > 0 */

Cache object: 5758ff4cb06356ce4affdf162ee6a5a6


[ 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.