Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/freebsd32/freebsd32_ioctl.c
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/sysent.h> | #include <sys/sysent.h> | ||||
#include <sys/sysproto.h> | #include <sys/sysproto.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/uio.h> | #include <sys/uio.h> | ||||
#include <compat/freebsd32/freebsd32.h> | #include <compat/freebsd32/freebsd32.h> | ||||
#include <compat/freebsd32/freebsd32_ioctl.h> | #include <compat/freebsd32/freebsd32_ioctl.h> | ||||
#include <compat/freebsd32/freebsd32_misc.h> | |||||
#include <compat/freebsd32/freebsd32_proto.h> | #include <compat/freebsd32/freebsd32_proto.h> | ||||
CTASSERT(sizeof(struct ioc_read_toc_entry32) == 8); | CTASSERT(sizeof(struct ioc_read_toc_entry32) == 8); | ||||
CTASSERT(sizeof(struct mem_range_op32) == 12); | CTASSERT(sizeof(struct mem_range_op32) == 12); | ||||
CTASSERT(sizeof(struct pci_conf_io32) == 36); | CTASSERT(sizeof(struct pci_conf_io32) == 36); | ||||
CTASSERT(sizeof(struct pci_match_conf32) == 44); | CTASSERT(sizeof(struct pci_match_conf32) == 44); | ||||
CTASSERT(sizeof(struct pci_conf32) == 44); | CTASSERT(sizeof(struct pci_conf32) == 44); | ||||
▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | if (pci.patterns) | ||||
copyout_unmap(td, (vm_offset_t)pci.patterns, pci.pat_buf_len); | copyout_unmap(td, (vm_offset_t)pci.patterns, pci.pat_buf_len); | ||||
if (pci.matches) | if (pci.matches) | ||||
copyout_unmap(td, (vm_offset_t)pci.matches, pci.match_buf_len); | copyout_unmap(td, (vm_offset_t)pci.matches, pci.match_buf_len); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
freebsd32_ioctl_barmmap(struct thread *td, | |||||
struct freebsd32_ioctl_args *uap, struct file *fp) | |||||
{ | |||||
struct pci_bar_mmap32 pbm32; | |||||
struct pci_bar_mmap pbm; | |||||
int error; | |||||
error = copyin(uap->data, &pbm32, sizeof(pbm32)); | |||||
if (error != 0) | |||||
return (error); | |||||
PTRIN_CP(pbm32, pbm, pbm_map_base); | |||||
CP(pbm32, pbm, pbm_sel); | |||||
CP(pbm32, pbm, pbm_reg); | |||||
CP(pbm32, pbm, pbm_flags); | |||||
CP(pbm32, pbm, pbm_memattr); | |||||
pbm.pbm_bar_length = PAIR32TO64(uint64_t, pbm32.pbm_bar_length); | |||||
error = fo_ioctl(fp, PCIOCBARMMAP, (caddr_t)&pbm, td->td_ucred, td); | |||||
if (error == 0) { | |||||
PTROUT_CP(pbm, pbm32, pbm_map_base); | |||||
CP(pbm, pbm32, pbm_map_length); | |||||
#if BYTE_ORDER == LITTLE_ENDIAN | |||||
pbm32.pbm_bar_length1 = pbm.pbm_bar_length; | |||||
pbm32.pbm_bar_length2 = pbm.pbm_bar_length >> 32; | |||||
#else | |||||
pbm32.pbm_bar_length1 = pbm.pbm_bar_length >> 32; | |||||
pbm32.pbm_bar_length2 = pbm.pbm_bar_length; | |||||
#endif | |||||
CP(pbm, pbm32, pbm_bar_off); | |||||
error = copyout(&pbm32, uap->data, sizeof(pbm32)); | |||||
} | |||||
return (error); | |||||
} | |||||
static int | |||||
freebsd32_ioctl_sg(struct thread *td, | freebsd32_ioctl_sg(struct thread *td, | ||||
struct freebsd32_ioctl_args *uap, struct file *fp) | struct freebsd32_ioctl_args *uap, struct file *fp) | ||||
{ | { | ||||
struct sg_io_hdr io; | struct sg_io_hdr io; | ||||
struct sg_io_hdr32 io32; | struct sg_io_hdr32 io32; | ||||
int error; | int error; | ||||
if ((error = copyin(uap->data, &io32, sizeof(io32))) != 0) | if ((error = copyin(uap->data, &io32, sizeof(io32))) != 0) | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | freebsd32_ioctl(struct thread *td, struct freebsd32_ioctl_args *uap) | ||||
case PCIOCGETCONF_32: | case PCIOCGETCONF_32: | ||||
error = freebsd32_ioctl_pciocgetconf(td, uap, fp); | error = freebsd32_ioctl_pciocgetconf(td, uap, fp); | ||||
break; | break; | ||||
case SG_IO_32: | case SG_IO_32: | ||||
error = freebsd32_ioctl_sg(td, uap, fp); | error = freebsd32_ioctl_sg(td, uap, fp); | ||||
break; | break; | ||||
case PCIOCBARMMAP_32: | |||||
error = freebsd32_ioctl_barmmap(td, uap, fp); | |||||
break; | |||||
default: | default: | ||||
fdrop(fp, td); | fdrop(fp, td); | ||||
ap.fd = uap->fd; | ap.fd = uap->fd; | ||||
ap.com = uap->com; | ap.com = uap->com; | ||||
PTRIN_CP(*uap, ap, data); | PTRIN_CP(*uap, ap, data); | ||||
return sys_ioctl(td, &ap); | return sys_ioctl(td, &ap); | ||||
} | } | ||||
fdrop(fp, td); | fdrop(fp, td); | ||||
return error; | return (error); | ||||
} | } |