mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-03 23:28:58 +00:00
- Rename UPA_BUS_SPACE to NEXUS_BUS_SPACE; besides an UPA bus, nexus(4)
may also reflect a Fireplane/Safari or JBus bus (or a virtual bus which in turn reflects a JBus bus or something like that...). - In the both the sparc64 and sun4v bus_machdep.c use __FBSDID. - Spell SBus the official way in comments. - Replace hardcoded function names (all of which were actually outdated) in panic and status strings with __func__. - Fix whitespace nits.
This commit is contained in:
parent
f1f234518b
commit
23e81b7e03
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166096
|
@ -84,12 +84,12 @@
|
|||
#include <machine/upa.h>
|
||||
|
||||
/*
|
||||
* UPA and SBUS spaces are non-cached and big endian
|
||||
* Nexus and SBus spaces are non-cached and big endian
|
||||
* (except for RAM and PROM)
|
||||
*
|
||||
* PCI spaces are non-cached and little endian
|
||||
*/
|
||||
#define UPA_BUS_SPACE 0
|
||||
#define NEXUS_BUS_SPACE 0
|
||||
#define SBUS_BUS_SPACE 1
|
||||
#define PCI_CONFIG_BUS_SPACE 2
|
||||
#define PCI_IO_BUS_SPACE 3
|
||||
|
|
|
@ -96,10 +96,11 @@
|
|||
* from: NetBSD: machdep.c,v 1.111 2001/09/15 07:13:40 eeh Exp
|
||||
* and
|
||||
* from: FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.24 2001/08/15
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/lock.h>
|
||||
|
@ -131,8 +132,8 @@ static void nexus_bus_barrier(bus_space_tag_t, bus_space_handle_t,
|
|||
|
||||
/* ASI's for bus access. */
|
||||
int bus_type_asi[] = {
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* UPA */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* SBUS */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* nexus */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* SBus */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT_L, /* PCI configuration space */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT_L, /* PCI memory space */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT_L, /* PCI I/O space */
|
||||
|
@ -140,8 +141,8 @@ int bus_type_asi[] = {
|
|||
};
|
||||
|
||||
int bus_stream_asi[] = {
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* UPA */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* SBUS */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* nexus */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* SBus */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* PCI configuration space */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* PCI memory space */
|
||||
ASI_PHYS_BYPASS_EC_WITH_EBIT, /* PCI I/O space */
|
||||
|
@ -255,9 +256,9 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
|
|||
newtag->dt_lowaddr);
|
||||
newtag->dt_highaddr = ulmax(parent->dt_highaddr,
|
||||
newtag->dt_highaddr);
|
||||
if (newtag->dt_boundary == 0)
|
||||
newtag->dt_boundary = parent->dt_boundary;
|
||||
else if (parent->dt_boundary != 0)
|
||||
if (newtag->dt_boundary == 0)
|
||||
newtag->dt_boundary = parent->dt_boundary;
|
||||
else if (parent->dt_boundary != 0)
|
||||
newtag->dt_boundary = ulmin(parent->dt_boundary,
|
||||
newtag->dt_boundary);
|
||||
atomic_add_int(&parent->dt_ref_count, 1);
|
||||
|
@ -405,7 +406,7 @@ _nexus_dmamap_load_buffer(bus_dma_tag_t dmat, void *buf, bus_size_t buflen,
|
|||
if (curaddr == lastaddr &&
|
||||
(segs[seg].ds_len + sgsize) <= dmat->dt_maxsegsz &&
|
||||
(dmat->dt_boundary == 0 ||
|
||||
(segs[seg].ds_addr & bmask) == (curaddr & bmask)))
|
||||
(segs[seg].ds_addr & bmask) == (curaddr & bmask)))
|
||||
segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= dmat->dt_nsegments)
|
||||
|
@ -611,9 +612,9 @@ nexus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
|
|||
* Actually a #Sync is expensive. We should optimize.
|
||||
*/
|
||||
if ((op & BUS_DMASYNC_PREREAD) || (op & BUS_DMASYNC_PREWRITE)) {
|
||||
/*
|
||||
/*
|
||||
* Don't really need to do anything, but flush any pending
|
||||
* writes anyway.
|
||||
* writes anyway.
|
||||
*/
|
||||
membar(Sync);
|
||||
}
|
||||
|
@ -730,7 +731,7 @@ sparc64_bus_mem_map(bus_space_tag_t tag, bus_space_handle_t handle,
|
|||
addr = (vm_offset_t)handle;
|
||||
size = round_page(size);
|
||||
if (size == 0) {
|
||||
printf("sparc64_bus_map: zero size\n");
|
||||
printf("%s: zero size\n", __func__);
|
||||
return (EINVAL);
|
||||
}
|
||||
switch (tag->bst_type) {
|
||||
|
@ -751,8 +752,7 @@ sparc64_bus_mem_map(bus_space_tag_t tag, bus_space_handle_t handle,
|
|||
sva = trunc_page(vaddr);
|
||||
else {
|
||||
if ((sva = kmem_alloc_nofault(kernel_map, size)) == 0)
|
||||
panic("sparc64_bus_map: cannot allocate virtual "
|
||||
"memory");
|
||||
panic("%s: cannot allocate virtual memory", __func__);
|
||||
}
|
||||
|
||||
/* Preserve page offset. */
|
||||
|
@ -814,7 +814,7 @@ nexus_bus_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
|
|||
bus_size_t size, int flags)
|
||||
{
|
||||
|
||||
/*
|
||||
/*
|
||||
* We have lots of alternatives depending on whether we're
|
||||
* synchronizing loads with loads, loads with stores, stores
|
||||
* with loads, or stores with stores. The only ones that seem
|
||||
|
@ -827,7 +827,7 @@ nexus_bus_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
|
|||
membar(Sync);
|
||||
break;
|
||||
default:
|
||||
panic("sparc64_bus_barrier: unknown flags");
|
||||
panic("%s: unknown flags", __func__);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -835,6 +835,6 @@ nexus_bus_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
|
|||
struct bus_space_tag nexus_bustag = {
|
||||
NULL, /* cookie */
|
||||
NULL, /* parent bus tag */
|
||||
UPA_BUS_SPACE, /* type */
|
||||
NEXUS_BUS_SPACE, /* type */
|
||||
nexus_bus_barrier, /* bus_space_barrier */
|
||||
};
|
||||
|
|
|
@ -245,14 +245,14 @@ OF_decode_addr(phandle_t node, int bank, int *space, bus_addr_t *addr)
|
|||
/* Done with mapping. Return the bus space as used by FreeBSD. */
|
||||
*addr = start;
|
||||
if (OF_parent(lbus) == 0) {
|
||||
*space = UPA_BUS_SPACE;
|
||||
*space = NEXUS_BUS_SPACE;
|
||||
return (0);
|
||||
}
|
||||
if (OF_getprop(lbus, "name", name, sizeof(name)) == -1)
|
||||
return (ENXIO);
|
||||
name[sizeof(name) - 1] = '\0';
|
||||
if (strcmp(name, "central") == 0 || strcmp(name, "upa") == 0) {
|
||||
*space = UPA_BUS_SPACE;
|
||||
*space = NEXUS_BUS_SPACE;
|
||||
return (0);
|
||||
} else if (strcmp(name, "pci") == 0) {
|
||||
switch (cspace) {
|
||||
|
|
|
@ -84,12 +84,12 @@
|
|||
#include <machine/upa.h>
|
||||
|
||||
/*
|
||||
* UPA and SBUS spaces are non-cached and big endian
|
||||
* Nexus and SBus spaces are non-cached and big endian
|
||||
* (except for RAM and PROM)
|
||||
*
|
||||
* PCI spaces are non-cached and little endian
|
||||
*/
|
||||
#define UPA_BUS_SPACE 0
|
||||
#define NEXUS_BUS_SPACE 0
|
||||
#define SBUS_BUS_SPACE 1
|
||||
#define PCI_CONFIG_BUS_SPACE 2
|
||||
#define PCI_IO_BUS_SPACE 3
|
||||
|
|
|
@ -96,10 +96,11 @@
|
|||
* from: NetBSD: machdep.c,v 1.111 2001/09/15 07:13:40 eeh Exp
|
||||
* and
|
||||
* from: FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.24 2001/08/15
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/lock.h>
|
||||
|
@ -131,8 +132,8 @@ static void nexus_bus_barrier(bus_space_tag_t, bus_space_handle_t,
|
|||
|
||||
/* ASI's for bus access. */
|
||||
int bus_type_asi[] = {
|
||||
ASI_REAL_IO, /* UPA */
|
||||
ASI_REAL_IO, /* SBUS */
|
||||
ASI_REAL_IO, /* nexus */
|
||||
ASI_REAL_IO, /* SBus */
|
||||
ASI_REAL_IO_L, /* PCI configuration space */
|
||||
ASI_REAL_IO_L, /* PCI memory space */
|
||||
ASI_REAL_IO_L, /* PCI I/O space */
|
||||
|
@ -140,8 +141,8 @@ int bus_type_asi[] = {
|
|||
};
|
||||
|
||||
int bus_stream_asi[] = {
|
||||
ASI_REAL_IO, /* UPA */
|
||||
ASI_REAL_IO, /* SBUS */
|
||||
ASI_REAL_IO, /* nexus */
|
||||
ASI_REAL_IO, /* SBus */
|
||||
ASI_REAL_IO, /* PCI configuration space */
|
||||
ASI_REAL_IO, /* PCI memory space */
|
||||
ASI_REAL_IO, /* PCI I/O space */
|
||||
|
@ -255,9 +256,9 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
|
|||
newtag->dt_lowaddr);
|
||||
newtag->dt_highaddr = ulmax(parent->dt_highaddr,
|
||||
newtag->dt_highaddr);
|
||||
if (newtag->dt_boundary == 0)
|
||||
newtag->dt_boundary = parent->dt_boundary;
|
||||
else if (parent->dt_boundary != 0)
|
||||
if (newtag->dt_boundary == 0)
|
||||
newtag->dt_boundary = parent->dt_boundary;
|
||||
else if (parent->dt_boundary != 0)
|
||||
newtag->dt_boundary = ulmin(parent->dt_boundary,
|
||||
newtag->dt_boundary);
|
||||
atomic_add_int(&parent->dt_ref_count, 1);
|
||||
|
@ -405,7 +406,7 @@ _nexus_dmamap_load_buffer(bus_dma_tag_t dmat, void *buf, bus_size_t buflen,
|
|||
if (curaddr == lastaddr &&
|
||||
(segs[seg].ds_len + sgsize) <= dmat->dt_maxsegsz &&
|
||||
(dmat->dt_boundary == 0 ||
|
||||
(segs[seg].ds_addr & bmask) == (curaddr & bmask)))
|
||||
(segs[seg].ds_addr & bmask) == (curaddr & bmask)))
|
||||
segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= dmat->dt_nsegments)
|
||||
|
@ -611,9 +612,9 @@ nexus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
|
|||
* Actually a #Sync is expensive. We should optimize.
|
||||
*/
|
||||
if ((op & BUS_DMASYNC_PREREAD) || (op & BUS_DMASYNC_PREWRITE)) {
|
||||
/*
|
||||
/*
|
||||
* Don't really need to do anything, but flush any pending
|
||||
* writes anyway.
|
||||
* writes anyway.
|
||||
*/
|
||||
membar(Sync);
|
||||
}
|
||||
|
@ -731,7 +732,7 @@ sparc64_bus_mem_map(bus_space_tag_t tag, bus_space_handle_t handle,
|
|||
addr = (vm_offset_t)handle;
|
||||
size = round_page(size);
|
||||
if (size == 0) {
|
||||
printf("sparc64_bus_map: zero size\n");
|
||||
printf("%s: zero size\n", __func__);
|
||||
return (EINVAL);
|
||||
}
|
||||
switch (tag->bst_type) {
|
||||
|
@ -752,8 +753,7 @@ sparc64_bus_mem_map(bus_space_tag_t tag, bus_space_handle_t handle,
|
|||
sva = trunc_page(vaddr);
|
||||
else {
|
||||
if ((sva = kmem_alloc_nofault(kernel_map, size)) == 0)
|
||||
panic("sparc64_bus_map: cannot allocate virtual "
|
||||
"memory");
|
||||
panic("%s: cannot allocate virtual memory", __func__);
|
||||
}
|
||||
|
||||
/* Preserve page offset. */
|
||||
|
@ -818,7 +818,7 @@ nexus_bus_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
|
|||
bus_size_t size, int flags)
|
||||
{
|
||||
|
||||
/*
|
||||
/*
|
||||
* We have lots of alternatives depending on whether we're
|
||||
* synchronizing loads with loads, loads with stores, stores
|
||||
* with loads, or stores with stores. The only ones that seem
|
||||
|
@ -831,7 +831,7 @@ nexus_bus_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
|
|||
membar(Sync);
|
||||
break;
|
||||
default:
|
||||
panic("sparc64_bus_barrier: unknown flags");
|
||||
panic("%s: unknown flags", __func__);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -839,6 +839,6 @@ nexus_bus_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
|
|||
struct bus_space_tag nexus_bustag = {
|
||||
NULL, /* cookie */
|
||||
NULL, /* parent bus tag */
|
||||
UPA_BUS_SPACE, /* type */
|
||||
NEXUS_BUS_SPACE, /* type */
|
||||
nexus_bus_barrier, /* bus_space_barrier */
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue