From owner-freebsd-hackers Thu Jul 17 21:27:39 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA27011 for hackers-outgoing; Thu, 17 Jul 1997 21:27:39 -0700 (PDT) Received: from sendero-ppp.i-connect.net (sendero-ppp.i-Connect.Net [206.190.143.100]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id VAA26994 for ; Thu, 17 Jul 1997 21:27:36 -0700 (PDT) Received: (qmail 505 invoked by uid 1000); 18 Jul 1997 04:21:05 -0000 Message-ID: X-Mailer: XFMail 1.1 [p0] on FreeBSD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <19970716214222.61218@mi.uni-koeln.de> Date: Thu, 17 Jul 1997 16:35:22 -0700 (PDT) Organization: Atlas Telecom From: Simon Shapiro To: Stefan Esser Subject: Re: pcireg.h lost children... ? Cc: freebsd-hackers@freebsd.org Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi Stefan Esser; On 16-Jul-97 you wrote: ... Excellent explanation deleted ... It did, for a while, break compatability... > I did not expect drivers to actually care for the class code > or command register values of a device, since higher level > code should take care of things ... > > What are you using those values for ? In pci/dpt_pci.c: dpt_pci_probe() ... if ((dpt_id = (type & 0xffff0000) >> 16) == DPT_DEVICE_ID) { /* This one appears to belong to us, but what is it? */ class = pci_conf_read(tag, PCI_CLASS_REG); if (((class & PCI_CLASS_MASK) == PCI_CLASS_MASS_STORAGE) && ((class & PCI_SUBCLASS_MASK) == PCI_SUBCLASS_MASS_STORAGE_SCSI) ) { /* It is a SCSI storage device. How do talk to it? */ command = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); if ( ((command & PCI_COMMAND_MEM_ENABLE) == 0) && ((command & PCI_COMMAND_IO_ENABLE) == 0) ) { printf("DPT: Cannot map the controller as memory, nor as I/O :-(\n"); return(NULL); } } else { printf("DPT: Device is not Mass Storage, nor SCSI controller :-(\n"); return(NULL); } command = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); if ( (command & PCI_COMMAND_MASTER_ENABLE) == 0 ) { printf("DPT: BUSMASTER disabled :-(\n"); return (NULL); } And in dpt_pci_attach() ... io_base = 0; vaddr = 0; paddr = 0; data = pci_conf_read(config_id, PCI_BASEADR0); command = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG); if ( ((command & PCI_COMMAND_MEM_ENABLE) == 0) || (pci_map_mem(config_id, PCI_BASEADR0, &vaddr, &paddr) == 0) ) { /* Either not memory mappable or mapping failed. Try I/O mapping */ if ((command & PCI_COMMAND_IO_ENABLE) == 0 || (pci_map_port(config_id, PCI_BASEADR0, &io_base) == 0) ) { free(dpt, M_DEVBUF); printf ("dpt%d: Failed to map memory or I/O registers :-(\n", unit); return; } } Makes sense? Simon