Author: imp
Date: Sat Jan  6 06:00:45 2018
New Revision: 327612
URL: https://svnweb.freebsd.org/changeset/base/327612

Log:
  Invent new #defines for the biospci_{read,write}_config function to
  specify the width and use them everywhere.
  
  Sponsored by: Netflix

Modified:
  head/stand/i386/libfirewire/firewire.c
  head/stand/i386/libi386/biospci.c
  head/stand/i386/libi386/comconsole.c
  head/stand/i386/libi386/libi386.h

Modified: head/stand/i386/libfirewire/firewire.c
==============================================================================
--- head/stand/i386/libfirewire/firewire.c      Sat Jan  6 06:00:40 2018        
(r327611)
+++ head/stand/i386/libfirewire/firewire.c      Sat Jan  6 06:00:45 2018        
(r327612)
@@ -108,11 +108,11 @@ fw_probe(int index, struct fwohci_softc *sc)
        biospci_write_config(sc->locator,
                0x4     /* command */,
                0x6     /* enable bus master and memory mapped I/O */,
-               1       /* word */);
+               BIOSPCI_16BITS);
 
-       biospci_read_config(sc->locator, 0x00 /*devid*/, 2 /*dword*/,
+       biospci_read_config(sc->locator, 0x00 /*devid*/, BIOSPCI_32BITS,
                &sc->devid);
-       biospci_read_config(sc->locator, 0x10 /*base_addr*/, 2 /*dword*/,
+       biospci_read_config(sc->locator, 0x10 /*base_addr*/, BIOSPCI_32BITS,
                &sc->base_addr);
 
         sc->handle = (uint32_t)PTOV(sc->base_addr);

Modified: head/stand/i386/libi386/biospci.c
==============================================================================
--- head/stand/i386/libi386/biospci.c   Sat Jan  6 06:00:40 2018        
(r327611)
+++ head/stand/i386/libi386/biospci.c   Sat Jan  6 06:00:45 2018        
(r327612)
@@ -285,7 +285,7 @@ biospci_enumerate(void)
                        break;
 
                    /* Read the device identifier from the nominated device */
-                   err = biospci_read_config(locator, 0, 2, &devid);
+                   err = biospci_read_config(locator, 0, BIOSPCI_32BITS, 
&devid);
                    if (err != 0)
                        break;
                    

Modified: head/stand/i386/libi386/comconsole.c
==============================================================================
--- head/stand/i386/libi386/comconsole.c        Sat Jan  6 06:00:40 2018        
(r327611)
+++ head/stand/i386/libi386/comconsole.c        Sat Jan  6 06:00:45 2018        
(r327612)
@@ -263,7 +263,7 @@ comc_pcidev_handle(uint32_t locator)
        uint32_t port;
 
        if (biospci_read_config(locator & 0xffff,
-                               (locator & 0xff0000) >> 16, 2, &port) == -1) {
+           (locator & 0xff0000) >> 16, BIOSPCI_32BITS, &port) == -1) {
                printf("Cannot read bar at 0x%x\n", locator);
                return (CMD_ERROR);
        }

Modified: head/stand/i386/libi386/libi386.h
==============================================================================
--- head/stand/i386/libi386/libi386.h   Sat Jan  6 06:00:40 2018        
(r327611)
+++ head/stand/i386/libi386/libi386.h   Sat Jan  6 06:00:45 2018        
(r327612)
@@ -135,6 +135,13 @@ extern vm_offset_t memtop_copyin;  /* memtop less heap 
 extern uint32_t                high_heap_size; /* extended memory region 
available */
 extern vm_offset_t     high_heap_base; /* for use as the heap */
 
+/*
+ * Values for width parameter to biospci_{read,write}_config
+ */
+#define BIOSPCI_8BITS  0
+#define BIOSPCI_16BITS 1
+#define BIOSPCI_32BITS 2
+
 void   biospci_detect(void);
 int    biospci_find_devclass(uint32_t class, int index, uint32_t *locator);
 int    biospci_read_config(uint32_t locator, int offset, int width, uint32_t 
*val);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to