Date: Thu, 17 Jul 1997 16:35:22 -0700 (PDT) From: Simon Shapiro <Shimon@i-Connect.Net> To: Stefan Esser <se@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: pcireg.h lost children... ? Message-ID: <XFMail.970717212105.Shimon@i-Connect.Net> In-Reply-To: <19970716214222.61218@mi.uni-koeln.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.970717212105.Shimon>