PERFORCE change 124158 for review

Christopher Davis loafier at FreeBSD.org
Fri Jul 27 05:54:30 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=124158

Change 124158 by loafier at chrisdsoc on 2007/07/27 05:53:29

	Use return value of pci_enable_io() to help determine whether to 
	allocate memory or io ports.

Affected files ...

.. //depot/projects/soc2007/loafier_busalloc/src/sys/dev/sound/pci/es137x.c#3 edit

Differences ...

==== //depot/projects/soc2007/loafier_busalloc/src/sys/dev/sound/pci/es137x.c#3 (text+ko) ====

@@ -1689,7 +1689,6 @@
 static int
 es_pci_attach(device_t dev)
 {
-	uint32_t	data;
 	struct es_info *es = NULL;
 	int		mapped, i, numplay, dac_cfg;
 	char		status[SND_STATUSLEN];
@@ -1704,17 +1703,13 @@
 	mapped = 0;
 
 	pci_enable_busmaster(dev);
-	data = pci_read_config(dev, PCIR_COMMAND, 2);
-	data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN);
-	pci_write_config(dev, PCIR_COMMAND, data, 2);
-	data = pci_read_config(dev, PCIR_COMMAND, 2);
 
-	if (mapped == 0 && (data & PCIM_CMD_MEMEN)) {
+	if (mapped == 0 && pci_enable_io(dev, SYS_RES_MEMORY) == 0) {
 		es->spec = es_res_spec_mem;
 		if (bus_alloc_resources(dev, es->spec, es->res) == 0) 
 			mapped++;
 	}
-	if (mapped == 0 && (data & PCIM_CMD_PORTEN)) {
+	if (mapped == 0 && pci_enable_io(dev, SYS_RES_IOPORT) == 0) {
 		es->spec = es_res_spec_io;
 		if (bus_alloc_resources(dev, es->spec, es->res) == 0)
 			mapped++;


More information about the p4-projects mailing list