From hiramoto@grape.phys.chs.nihon-u.ac.jp  Mon Aug 28 02:14:47 2000
Return-Path: <hiramoto@grape.phys.chs.nihon-u.ac.jp>
Received: from grape.phys.chs.nihon-u.ac.jp (grape.phys.chs.nihon-u.ac.jp [133.43.174.46])
	by hub.freebsd.org (Postfix) with ESMTP id B0F8F37B424
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 28 Aug 2000 02:14:45 -0700 (PDT)
Received: (from hiramoto@localhost)
	by grape.phys.chs.nihon-u.ac.jp (8.11.0/8.11.0) id e7S9Ei401248;
	Mon, 28 Aug 2000 18:14:44 +0900 (JST)
	(envelope-from hiramoto)
Message-Id: <200008280914.e7S9Ei401248@grape.phys.chs.nihon-u.ac.jp>
Date: Mon, 28 Aug 2000 18:14:44 +0900 (JST)
From: hiramoto@phys.chs.nihon-u.ac.jp
Sender: hiramoto@grape.phys.chs.nihon-u.ac.jp
Reply-To: hiramoto@phys.chs.nihon-u.ac.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: sym driver doesn't work for SYM53C895A
X-Send-Pr-Version: 3.2

>Number:         20895
>Category:       kern
>Synopsis:       sym driver doesn't work for SYM53C895A
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-scsi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 28 02:20:03 PDT 2000
>Closed-Date:    Thu Aug 26 05:50:02 GMT 2004
>Last-Modified:  Sat Jun 07 06:07:07 UTC 2008
>Originator:     Hisashi Hiramoto
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
>Environment:

	4.1-stable and 5.0-current (x86)
	Compaq Prliant ML 330 (on-board chips sym53c895a ultra2 scsi,
	no ide disk)
	
>Description:

	sym0: <895a> port 0x1000-0x10ff mem 0xb1100000-0xb1101fff,0xb1400000-0xb14003ff irq 15 at device 4.0 on pci1
	sym0: failed to allocate RAM resouces

	Fatal trap 12: page fault while in kernel mode
		.....

	The legacy(?) ncr driver works, so the generic kernel of 4.1 is OK,
	but it works as ultra, not as ultra-2.

>How-To-Repeat:

	In my system (Compaq Prliant ML 330), 5.0 generic kernel and
	4.1-stable kernel with sym (without ncr) reliably reproduce
	this problem.  I have no idea whether this is generic for any
	sytems having Symbios 53c895a or not,  because I have no other
	system with 53c895a.

>Fix:

	The following patch works at least for me, although I don't know
	this is the right fix. (Non-FreeBSD_Bus_Io_Abstraction part is
	untested)


*** sym_hipd.c.orig	Mon Jul  3 15:21:53 2000
--- sym_hipd.c	Mon Aug 28 02:39:07 2000
***************
*** 9057,9066 ****
  	    (command & PCIM_CMD_MEMEN) != 0) {
  #ifdef FreeBSD_Bus_Io_Abstraction
  		int regs_id = SYM_PCI_RAM;
! 		if (np->features & FE_64BIT)
  			regs_id = SYM_PCI_RAM64;
! 		np->ram_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &regs_id,
! 						 0, ~0, 1, RF_ACTIVE);
  		if (!np->ram_res) {
  			device_printf(dev,"failed to allocate RAM resources\n");
  			goto attach_failed;
--- 9057,9072 ----
  	    (command & PCIM_CMD_MEMEN) != 0) {
  #ifdef FreeBSD_Bus_Io_Abstraction
  		int regs_id = SYM_PCI_RAM;
! 		if (np->features & FE_64BIT) {
  			regs_id = SYM_PCI_RAM64;
! 			np->ram_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
! 						&regs_id, 0, ~0, 1, RF_ACTIVE);
! 			if (!np->ram_res)
! 				regs_id = SYM_PCI_RAM;
! 		}
! 		if (regs_id == SYM_PCI_RAM)
! 			np->ram_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
! 						&regs_id, 0, ~0, 1, RF_ACTIVE);
  		if (!np->ram_res) {
  			device_printf(dev,"failed to allocate RAM resources\n");
  			goto attach_failed;
***************
*** 9074,9082 ****
  #else
  		vm_offset_t vaddr, paddr;
  		int regs_id = SYM_PCI_RAM;
! 		if (np->features & FE_64BIT)
  			regs_id = SYM_PCI_RAM64;
! 		if (!pci_map_mem(pci_tag, regs_id, &vaddr, &paddr)) {
  			printf("%s: failed to map RAM window\n", sym_name(np));
  			goto attach_failed;
  		}
--- 9080,9092 ----
  #else
  		vm_offset_t vaddr, paddr;
  		int regs_id = SYM_PCI_RAM;
! 		if (np->features & FE_64BIT) {
  			regs_id = SYM_PCI_RAM64;
! 			if (!pci_map_mem(pci_tag, regs_id, &vaddr, &paddr))
! 				regs_id = SYM_PCI_RAM;
! 		}
! 		if (regs_id == SYM_PCI_RAM &&
! 		    !pci_map_mem(pci_tag, regs_id, &vaddr, &paddr)) {
  			printf("%s: failed to map RAM window\n", sym_name(np));
  			goto attach_failed;
  		}

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->groudier 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Aug 28 02:30:39 PDT 2000 
Responsible-Changed-Why:  
Gerard, this one contains a proposed patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20895 

From: =?ISO-8859-1?Q?G=E9rard_Roudier?= <groudier@club-internet.fr>
To: hiramoto@phys.chs.nihon-u.ac.jp
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/20895: sym driver doesn't work for SYM53C895A
Date: Mon, 28 Aug 2000 21:08:40 +0200 (CEST)

 I am glad that you found some trick for your system to work, but I guess
 that your patch will not go into `sym', as it is, for the following
 reason:
 
 The below relevant part of the trace:
 
     0x1000-0x10ff mem 0xb1100000-0xb1101fff,0xb1400000-0xb14003ff
 
 seems to indicate that MMIO resource (256 bytes) and on-chip RAM resource
 (8192 bytes) are presented to the driver, by some part, in reverse order.
 
 I donnot know why for now, but reporting the first 64 bytes of PCI config
 space will actually tell me what part is wrong, and so a correct fix or
 work-around will get possible to be implemented.
 
 Thanks in advance to report me the actual content of the PCI configuration
 space header (first 64 bytes) of your SYM53C895A.
 
   G=E9rard.
 
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Thu Aug 26 03:12:51 GMT 2004 
State-Changed-Why:  
Is this still a problem with modern versions of FreeBSD? 


Responsible-Changed-From-To: groudier->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Aug 26 03:12:51 GMT 2004 
Responsible-Changed-Why:  
With bugmeister hat on, reassign from inactive committer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20895 
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Thu Aug 26 05:49:45 GMT 2004 
State-Changed-Why:  
Apparently the problem was fixed long ago. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20895 
Responsible-Changed-From-To: freebsd-bugs->freebsd-scsi 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Aug 26 19:30:19 GMT 2004 
Responsible-Changed-Why:  
Reassign to appropriate mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20895 
>Unformatted:
