Invent new #defines for the biospci_{read,write}_config function to
specify the width and use them everywhere. Sponsored by: Netflix
This commit is contained in:
parent
cac7bbe16a
commit
388199e5bb
@ -108,11 +108,11 @@ fw_probe(int index, struct fwohci_softc *sc)
|
|||||||
biospci_write_config(sc->locator,
|
biospci_write_config(sc->locator,
|
||||||
0x4 /* command */,
|
0x4 /* command */,
|
||||||
0x6 /* enable bus master and memory mapped I/O */,
|
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);
|
&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->base_addr);
|
||||||
|
|
||||||
sc->handle = (uint32_t)PTOV(sc->base_addr);
|
sc->handle = (uint32_t)PTOV(sc->base_addr);
|
||||||
|
@ -285,7 +285,7 @@ biospci_enumerate(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* Read the device identifier from the nominated device */
|
/* 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)
|
if (err != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ comc_pcidev_handle(uint32_t locator)
|
|||||||
uint32_t port;
|
uint32_t port;
|
||||||
|
|
||||||
if (biospci_read_config(locator & 0xffff,
|
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);
|
printf("Cannot read bar at 0x%x\n", locator);
|
||||||
return (CMD_ERROR);
|
return (CMD_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,13 @@ extern vm_offset_t memtop_copyin; /* memtop less heap size for the cases */
|
|||||||
extern uint32_t high_heap_size; /* extended memory region available */
|
extern uint32_t high_heap_size; /* extended memory region available */
|
||||||
extern vm_offset_t high_heap_base; /* for use as the heap */
|
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);
|
void biospci_detect(void);
|
||||||
int biospci_find_devclass(uint32_t class, int index, uint32_t *locator);
|
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);
|
int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val);
|
||||||
|
Loading…
Reference in New Issue
Block a user