Merge svn+ssh://svn.freebsd.org/base/head@207793
This commit is contained in:
commit
9307d8bdd4
@ -419,62 +419,77 @@ bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size)
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JA:
|
||||
JMP(stream.refs[stream.bpf_pc + ins->k] -
|
||||
stream.refs[stream.bpf_pc]);
|
||||
JUMP(ins->k);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JGT|BPF_K:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
CMPid(ins->k, EAX);
|
||||
JCC(JA, JBE);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JGE|BPF_K:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
CMPid(ins->k, EAX);
|
||||
JCC(JAE, JB);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JEQ|BPF_K:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
CMPid(ins->k, EAX);
|
||||
JCC(JE, JNE);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JSET|BPF_K:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
TESTid(ins->k, EAX);
|
||||
JCC(JNE, JE);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JGT|BPF_X:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
CMPrd(EDX, EAX);
|
||||
JCC(JA, JBE);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JGE|BPF_X:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
CMPrd(EDX, EAX);
|
||||
JCC(JAE, JB);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JEQ|BPF_X:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
CMPrd(EDX, EAX);
|
||||
JCC(JE, JNE);
|
||||
break;
|
||||
|
||||
case BPF_JMP|BPF_JSET|BPF_X:
|
||||
if (ins->jt == 0 && ins->jf == 0)
|
||||
if (ins->jt == ins->jf) {
|
||||
JUMP(ins->jt);
|
||||
break;
|
||||
}
|
||||
TESTrd(EDX, EAX);
|
||||
JCC(JNE, JE);
|
||||
break;
|
||||
|
@ -473,4 +473,10 @@ typedef void (*emit_func)(bpf_bin_stream *stream, u_int value, u_int n);
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define JUMP(off) do { \
|
||||
if ((off) != 0) \
|
||||
JMP(stream.refs[stream.bpf_pc + (off)] - \
|
||||
stream.refs[stream.bpf_pc]); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _BPF_JIT_MACHDEP_H_ */
|
||||
|
@ -50,14 +50,14 @@
|
||||
.bss
|
||||
.globl dtrace_invop_jump_addr
|
||||
.align 8
|
||||
.type dtrace_invop_jump_addr, @object
|
||||
.size dtrace_invop_jump_addr, 8
|
||||
.type dtrace_invop_jump_addr,@object
|
||||
.size dtrace_invop_jump_addr,8
|
||||
dtrace_invop_jump_addr:
|
||||
.zero 8
|
||||
.globl dtrace_invop_calltrap_addr
|
||||
.align 8
|
||||
.type dtrace_invop_calltrap_addr, @object
|
||||
.size dtrace_invop_calltrap_addr, 8
|
||||
.type dtrace_invop_calltrap_addr,@object
|
||||
.size dtrace_invop_calltrap_addr,8
|
||||
dtrace_invop_calltrap_addr:
|
||||
.zero 8
|
||||
#endif
|
||||
@ -157,7 +157,6 @@ IDTVEC(align)
|
||||
* kernel from userland. Reenable interrupts if they were enabled
|
||||
* before the trap. This approximates SDT_SYS386TGT on the i386 port.
|
||||
*/
|
||||
|
||||
SUPERALIGN_TEXT
|
||||
.globl alltraps
|
||||
.type alltraps,@function
|
||||
@ -211,16 +210,16 @@ alltraps_pushregs_no_rdi:
|
||||
* Set our jump address for the jump back in the event that
|
||||
* the breakpoint wasn't caused by DTrace at all.
|
||||
*/
|
||||
movq $calltrap, dtrace_invop_calltrap_addr(%rip)
|
||||
movq $calltrap,dtrace_invop_calltrap_addr(%rip)
|
||||
|
||||
/* Jump to the code hooked in by DTrace. */
|
||||
movq dtrace_invop_jump_addr, %rax
|
||||
movq dtrace_invop_jump_addr,%rax
|
||||
jmpq *dtrace_invop_jump_addr
|
||||
#endif
|
||||
.globl calltrap
|
||||
.type calltrap,@function
|
||||
calltrap:
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
MEXITCOUNT
|
||||
jmp doreti /* Handle any pending ASTs */
|
||||
@ -274,9 +273,11 @@ IDTVEC(dblfault)
|
||||
testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
|
||||
jz 1f /* already running with kernel GS.base */
|
||||
swapgs
|
||||
1: movq %rsp, %rdi
|
||||
1:
|
||||
movq %rsp,%rdi
|
||||
call dblfault_handler
|
||||
2: hlt
|
||||
2:
|
||||
hlt
|
||||
jmp 2b
|
||||
|
||||
IDTVEC(page)
|
||||
@ -369,7 +370,7 @@ IDTVEC(fast_syscall)
|
||||
movq %r15,TF_R15(%rsp) /* C preserved */
|
||||
movl $TF_HASSEGS,TF_FLAGS(%rsp)
|
||||
FAKE_MCOUNT(TF_RIP(%rsp))
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call syscall
|
||||
movq PCPU(CURPCB),%rax
|
||||
andq $~PCB_FULLCTX,PCB_FLAGS(%rax)
|
||||
@ -456,7 +457,7 @@ nmi_fromuserspace:
|
||||
/* Note: this label is also used by ddb and gdb: */
|
||||
nmi_calltrap:
|
||||
FAKE_MCOUNT(TF_RIP(%rsp))
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
MEXITCOUNT
|
||||
#ifdef HWPMC_HOOKS
|
||||
@ -555,9 +556,9 @@ nmi_restoreregs:
|
||||
iretq
|
||||
|
||||
ENTRY(fork_trampoline)
|
||||
movq %r12, %rdi /* function */
|
||||
movq %rbx, %rsi /* arg1 */
|
||||
movq %rsp, %rdx /* trapframe pointer */
|
||||
movq %r12,%rdi /* function */
|
||||
movq %rbx,%rsi /* arg1 */
|
||||
movq %rsp,%rdx /* trapframe pointer */
|
||||
call fork_exit
|
||||
MEXITCOUNT
|
||||
jmp doreti /* Handle any ASTs */
|
||||
@ -628,7 +629,7 @@ doreti_ast:
|
||||
testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax)
|
||||
je doreti_exit
|
||||
sti
|
||||
movq %rsp, %rdi /* pass a pointer to the trapframe */
|
||||
movq %rsp,%rdi /* pass a pointer to the trapframe */
|
||||
call ast
|
||||
jmp doreti_ast
|
||||
|
||||
@ -648,8 +649,8 @@ doreti_exit:
|
||||
* Do not reload segment registers for kernel.
|
||||
* Since we do not reload segments registers with sane
|
||||
* values on kernel entry, descriptors referenced by
|
||||
* segments registers may be not valid. This is fatal
|
||||
* for the usermode, but is innocent for the kernel.
|
||||
* segments registers might be not valid. This is fatal
|
||||
* for user mode, but is not a problem for the kernel.
|
||||
*/
|
||||
testb $SEL_RPL_MASK,TF_CS(%rsp)
|
||||
jz ld_regs
|
||||
@ -662,14 +663,16 @@ do_segs:
|
||||
/* Restore %fs and fsbase */
|
||||
movw TF_FS(%rsp),%ax
|
||||
.globl ld_fs
|
||||
ld_fs: movw %ax,%fs
|
||||
ld_fs:
|
||||
movw %ax,%fs
|
||||
cmpw $KUF32SEL,%ax
|
||||
jne 1f
|
||||
movl $MSR_FSBASE,%ecx
|
||||
movl PCB_FSBASE(%r8),%eax
|
||||
movl PCB_FSBASE+4(%r8),%edx
|
||||
.globl ld_fsbase
|
||||
ld_fsbase: wrmsr
|
||||
ld_fsbase:
|
||||
wrmsr
|
||||
1:
|
||||
/* Restore %gs and gsbase */
|
||||
movw TF_GS(%rsp),%si
|
||||
@ -678,7 +681,8 @@ ld_fsbase: wrmsr
|
||||
movl $MSR_GSBASE,%ecx
|
||||
rdmsr
|
||||
.globl ld_gs
|
||||
ld_gs: movw %si,%gs
|
||||
ld_gs:
|
||||
movw %si,%gs
|
||||
wrmsr
|
||||
popfq
|
||||
cmpw $KUG32SEL,%si
|
||||
@ -687,12 +691,17 @@ ld_gs: movw %si,%gs
|
||||
movl PCB_GSBASE(%r8),%eax
|
||||
movl PCB_GSBASE+4(%r8),%edx
|
||||
.globl ld_gsbase
|
||||
ld_gsbase: wrmsr
|
||||
1: .globl ld_es
|
||||
ld_es: movw TF_ES(%rsp),%es
|
||||
ld_gsbase:
|
||||
wrmsr
|
||||
1:
|
||||
.globl ld_es
|
||||
ld_es:
|
||||
movw TF_ES(%rsp),%es
|
||||
.globl ld_ds
|
||||
ld_ds: movw TF_DS(%rsp),%ds
|
||||
ld_regs:movq TF_RDI(%rsp),%rdi
|
||||
ld_ds:
|
||||
movw TF_DS(%rsp),%ds
|
||||
ld_regs:
|
||||
movq TF_RDI(%rsp),%rdi
|
||||
movq TF_RSI(%rsp),%rsi
|
||||
movq TF_RDX(%rsp),%rdx
|
||||
movq TF_RCX(%rsp),%rcx
|
||||
@ -711,7 +720,8 @@ ld_regs:movq TF_RDI(%rsp),%rdi
|
||||
jz 1f /* keep running with kernel GS.base */
|
||||
cli
|
||||
swapgs
|
||||
1: addq $TF_RIP,%rsp /* skip over tf_err, tf_trapno */
|
||||
1:
|
||||
addq $TF_RIP,%rsp /* skip over tf_err, tf_trapno */
|
||||
.globl doreti_iret
|
||||
doreti_iret:
|
||||
iretq
|
||||
@ -738,7 +748,8 @@ doreti_iret_fault:
|
||||
testl $PSL_I,TF_RFLAGS(%rsp)
|
||||
jz 1f
|
||||
sti
|
||||
1: movw %fs,TF_FS(%rsp)
|
||||
1:
|
||||
movw %fs,TF_FS(%rsp)
|
||||
movw %gs,TF_GS(%rsp)
|
||||
movw %es,TF_ES(%rsp)
|
||||
movw %ds,TF_DS(%rsp)
|
||||
@ -768,7 +779,7 @@ doreti_iret_fault:
|
||||
.globl ds_load_fault
|
||||
ds_load_fault:
|
||||
movl $T_PROTFLT,TF_TRAPNO(%rsp)
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
movw $KUDSEL,TF_DS(%rsp)
|
||||
jmp doreti
|
||||
@ -777,7 +788,7 @@ ds_load_fault:
|
||||
.globl es_load_fault
|
||||
es_load_fault:
|
||||
movl $T_PROTFLT,TF_TRAPNO(%rsp)
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
movw $KUDSEL,TF_ES(%rsp)
|
||||
jmp doreti
|
||||
@ -786,7 +797,7 @@ es_load_fault:
|
||||
.globl fs_load_fault
|
||||
fs_load_fault:
|
||||
movl $T_PROTFLT,TF_TRAPNO(%rsp)
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
movw $KUF32SEL,TF_FS(%rsp)
|
||||
jmp doreti
|
||||
@ -796,7 +807,7 @@ fs_load_fault:
|
||||
gs_load_fault:
|
||||
popfq
|
||||
movl $T_PROTFLT,TF_TRAPNO(%rsp)
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
movw $KUG32SEL,TF_GS(%rsp)
|
||||
jmp doreti
|
||||
@ -805,7 +816,7 @@ gs_load_fault:
|
||||
.globl fsbase_load_fault
|
||||
fsbase_load_fault:
|
||||
movl $T_PROTFLT,TF_TRAPNO(%rsp)
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
movq PCPU(CURTHREAD),%r8
|
||||
movq TD_PCB(%r8),%r8
|
||||
@ -815,9 +826,8 @@ fsbase_load_fault:
|
||||
ALIGN_TEXT
|
||||
.globl gsbase_load_fault
|
||||
gsbase_load_fault:
|
||||
popfq
|
||||
movl $T_PROTFLT,TF_TRAPNO(%rsp)
|
||||
movq %rsp, %rdi
|
||||
movq %rsp,%rdi
|
||||
call trap
|
||||
movq PCPU(CURTHREAD),%r8
|
||||
movq TD_PCB(%r8),%r8
|
||||
|
@ -240,7 +240,7 @@ printcpuinfo(void)
|
||||
printf("\n Features2=0x%b", cpu_feature2,
|
||||
"\020"
|
||||
"\001SSE3" /* SSE3 */
|
||||
"\002<b1>"
|
||||
"\002PCLMULQDQ" /* Carry-Less Mul Quadword */
|
||||
"\003DTES64" /* 64-bit Debug Trace */
|
||||
"\004MON" /* MONITOR/MWAIT Instructions */
|
||||
"\005DS_CPL" /* CPL Qualified Debug Store */
|
||||
@ -264,7 +264,7 @@ printcpuinfo(void)
|
||||
"\027MOVBE"
|
||||
"\030POPCNT"
|
||||
"\031<b24>"
|
||||
"\032<b25>"
|
||||
"\032AESNI" /* AES Crypto*/
|
||||
"\033XSAVE"
|
||||
"\034OSXSAVE"
|
||||
"\035<b28>"
|
||||
|
@ -28,60 +28,32 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/priv.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
#include <machine/frame.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/specialreg.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <machine/iodev.h>
|
||||
#include <machine/psl.h>
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ioopen(struct cdev *dev __unused, int flags __unused, int fmt __unused,
|
||||
struct thread *td)
|
||||
iodev_open(struct thread *td)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = priv_check(td, PRIV_IO);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
error = securelevel_gt(td->td_ucred, 0);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
td->td_frame->tf_rflags |= PSL_IOPL;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ioclose(struct cdev *dev __unused, int flags __unused, int fmt __unused,
|
||||
struct thread *td)
|
||||
iodev_close(struct thread *td)
|
||||
{
|
||||
|
||||
td->td_frame->tf_rflags &= ~PSL_IOPL;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ioioctl(struct cdev *dev __unused, u_long cmd __unused, caddr_t data __unused,
|
||||
int fflag __unused, struct thread *td __unused)
|
||||
iodev_ioctl(u_long cmd __unused, caddr_t data __unused)
|
||||
{
|
||||
|
||||
return (ENXIO);
|
||||
return (ENOIOCTL);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef KDTRACE_HOOKS
|
||||
#include <sys/dtrace_bsd.h>
|
||||
cyclic_clock_func_t lapic_cyclic_clock_func[MAXCPU];
|
||||
cyclic_clock_func_t cyclic_clock_func[MAXCPU];
|
||||
#endif
|
||||
|
||||
/* Sanity checks on IDT vectors. */
|
||||
@ -778,8 +778,8 @@ lapic_handle_timer(struct trapframe *frame)
|
||||
* timers.
|
||||
*/
|
||||
int cpu = PCPU_GET(cpuid);
|
||||
if (lapic_cyclic_clock_func[cpu] != NULL)
|
||||
(*lapic_cyclic_clock_func[cpu])(frame);
|
||||
if (cyclic_clock_func[cpu] != NULL)
|
||||
(*cyclic_clock_func[cpu])(frame);
|
||||
#endif
|
||||
|
||||
/* Fire hardclock at hz. */
|
||||
|
@ -236,6 +236,7 @@ static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte);
|
||||
static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
|
||||
static void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva);
|
||||
static boolean_t pmap_is_modified_pvh(struct md_page *pvh);
|
||||
static boolean_t pmap_is_referenced_pvh(struct md_page *pvh);
|
||||
static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
|
||||
static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va);
|
||||
static void pmap_pde_attr(pd_entry_t *pde, int cache_bits);
|
||||
@ -283,7 +284,7 @@ pmap_kmem_choose(vm_offset_t addr)
|
||||
vm_offset_t newaddr = addr;
|
||||
|
||||
newaddr = (addr + (NBPDR - 1)) & ~(NBPDR - 1);
|
||||
return newaddr;
|
||||
return (newaddr);
|
||||
}
|
||||
|
||||
/********************/
|
||||
@ -294,7 +295,7 @@ pmap_kmem_choose(vm_offset_t addr)
|
||||
static __inline vm_pindex_t
|
||||
pmap_pde_pindex(vm_offset_t va)
|
||||
{
|
||||
return va >> PDRSHIFT;
|
||||
return (va >> PDRSHIFT);
|
||||
}
|
||||
|
||||
|
||||
@ -353,7 +354,7 @@ pmap_pdpe(pmap_t pmap, vm_offset_t va)
|
||||
|
||||
pml4e = pmap_pml4e(pmap, va);
|
||||
if ((*pml4e & PG_V) == 0)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
return (pmap_pml4e_to_pdpe(pml4e, va));
|
||||
}
|
||||
|
||||
@ -375,7 +376,7 @@ pmap_pde(pmap_t pmap, vm_offset_t va)
|
||||
|
||||
pdpe = pmap_pdpe(pmap, va);
|
||||
if (pdpe == NULL || (*pdpe & PG_V) == 0)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
return (pmap_pdpe_to_pde(pdpe, va));
|
||||
}
|
||||
|
||||
@ -397,12 +398,27 @@ pmap_pte(pmap_t pmap, vm_offset_t va)
|
||||
|
||||
pde = pmap_pde(pmap, va);
|
||||
if (pde == NULL || (*pde & PG_V) == 0)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
if ((*pde & PG_PS) != 0) /* compat with i386 pmap_pte() */
|
||||
return ((pt_entry_t *)pde);
|
||||
return (pmap_pde_to_pte(pde, va));
|
||||
}
|
||||
|
||||
static __inline void
|
||||
pmap_resident_count_inc(pmap_t pmap, int count)
|
||||
{
|
||||
|
||||
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
|
||||
pmap->pm_stats.resident_count += count;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
pmap_resident_count_dec(pmap_t pmap, int count)
|
||||
{
|
||||
|
||||
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
|
||||
pmap->pm_stats.resident_count -= count;
|
||||
}
|
||||
|
||||
PMAP_INLINE pt_entry_t *
|
||||
vtopte(vm_offset_t va)
|
||||
@ -777,7 +793,6 @@ static u_long pmap_pdpe_demotions;
|
||||
SYSCTL_ULONG(_vm_pmap_pdpe, OID_AUTO, demotions, CTLFLAG_RD,
|
||||
&pmap_pdpe_demotions, 0, "1GB page demotions");
|
||||
|
||||
|
||||
/***************************************************
|
||||
* Low level helper routines.....
|
||||
***************************************************/
|
||||
@ -1184,15 +1199,20 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
{
|
||||
pd_entry_t pde, *pdep;
|
||||
pt_entry_t pte;
|
||||
vm_paddr_t pa;
|
||||
vm_page_t m;
|
||||
|
||||
pa = 0;
|
||||
m = NULL;
|
||||
vm_page_lock_queues();
|
||||
PMAP_LOCK(pmap);
|
||||
retry:
|
||||
pdep = pmap_pde(pmap, va);
|
||||
if (pdep != NULL && (pde = *pdep)) {
|
||||
if (pde & PG_PS) {
|
||||
if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
|
||||
if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
|
||||
(va & PDRMASK), &pa))
|
||||
goto retry;
|
||||
m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
|
||||
(va & PDRMASK));
|
||||
vm_page_hold(m);
|
||||
@ -1201,12 +1221,14 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
pte = *pmap_pde_to_pte(pdep, va);
|
||||
if ((pte & PG_V) &&
|
||||
((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
|
||||
if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa))
|
||||
goto retry;
|
||||
m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
|
||||
vm_page_hold(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
vm_page_unlock_queues();
|
||||
PA_UNLOCK_COND(pa);
|
||||
PMAP_UNLOCK(pmap);
|
||||
return (m);
|
||||
}
|
||||
@ -1236,7 +1258,7 @@ pmap_kextract(vm_offset_t va)
|
||||
pa = (pa & PG_FRAME) | (va & PAGE_MASK);
|
||||
}
|
||||
}
|
||||
return pa;
|
||||
return (pa);
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
@ -1466,9 +1488,9 @@ pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *free)
|
||||
|
||||
--m->wire_count;
|
||||
if (m->wire_count == 0)
|
||||
return _pmap_unwire_pte_hold(pmap, va, m, free);
|
||||
return (_pmap_unwire_pte_hold(pmap, va, m, free));
|
||||
else
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1476,6 +1498,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
vm_page_t *free)
|
||||
{
|
||||
|
||||
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
|
||||
/*
|
||||
* unmap the page table page
|
||||
*/
|
||||
@ -1495,7 +1518,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
pd = pmap_pde(pmap, va);
|
||||
*pd = 0;
|
||||
}
|
||||
--pmap->pm_stats.resident_count;
|
||||
pmap_resident_count_dec(pmap, 1);
|
||||
if (m->pindex < NUPDE) {
|
||||
/* We just released a PT, unhold the matching PD */
|
||||
vm_page_t pdpg;
|
||||
@ -1524,7 +1547,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
*/
|
||||
pmap_add_delayed_free_list(m, free, TRUE);
|
||||
|
||||
return 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1537,10 +1560,10 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t va, pd_entry_t ptepde, vm_page_t *free)
|
||||
vm_page_t mpte;
|
||||
|
||||
if (va >= VM_MAXUSER_ADDRESS)
|
||||
return 0;
|
||||
return (0);
|
||||
KASSERT(ptepde != 0, ("pmap_unuse_pt: ptepde != 0"));
|
||||
mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME);
|
||||
return pmap_unwire_pte_hold(pmap, va, mpte, free);
|
||||
return (pmap_unwire_pte_hold(pmap, va, mpte, free));
|
||||
}
|
||||
|
||||
void
|
||||
@ -1612,6 +1635,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
|
||||
(flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK,
|
||||
("_pmap_allocpte: flags is neither M_NOWAIT nor M_WAITOK"));
|
||||
|
||||
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
|
||||
/*
|
||||
* Allocate a page table page.
|
||||
*/
|
||||
@ -1729,9 +1753,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
|
||||
*pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M;
|
||||
}
|
||||
|
||||
pmap->pm_stats.resident_count++;
|
||||
pmap_resident_count_inc(pmap, 1);
|
||||
|
||||
return m;
|
||||
return (m);
|
||||
}
|
||||
|
||||
static vm_page_t
|
||||
@ -2036,7 +2060,7 @@ pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq)
|
||||
PMAP_LOCK(pmap);
|
||||
else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap))
|
||||
continue;
|
||||
pmap->pm_stats.resident_count--;
|
||||
pmap_resident_count_dec(pmap, 1);
|
||||
pde = pmap_pde(pmap, va);
|
||||
KASSERT((*pde & PG_PS) == 0, ("pmap_collect: found"
|
||||
" a 2mpage in page %p's pv list", m));
|
||||
@ -2437,7 +2461,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va)
|
||||
return (FALSE);
|
||||
}
|
||||
if (va < VM_MAXUSER_ADDRESS)
|
||||
pmap->pm_stats.resident_count++;
|
||||
pmap_resident_count_inc(pmap, 1);
|
||||
}
|
||||
mptepa = VM_PAGE_TO_PHYS(mpte);
|
||||
firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa);
|
||||
@ -2529,7 +2553,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva,
|
||||
*/
|
||||
if (oldpde & PG_G)
|
||||
pmap_invalidate_page(kernel_pmap, sva);
|
||||
pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE;
|
||||
pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
|
||||
if (oldpde & PG_MANAGED) {
|
||||
pvh = pa_to_pvh(oldpde & PG_PS_FRAME);
|
||||
pmap_pvh_free(pvh, pmap, sva);
|
||||
@ -2552,7 +2576,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva,
|
||||
mpte = pmap_lookup_pt_page(pmap, sva);
|
||||
if (mpte != NULL) {
|
||||
pmap_remove_pt_page(pmap, mpte);
|
||||
pmap->pm_stats.resident_count--;
|
||||
pmap_resident_count_dec(pmap, 1);
|
||||
KASSERT(mpte->wire_count == NPTEPG,
|
||||
("pmap_remove_pde: pte page wire count error"));
|
||||
mpte->wire_count = 0;
|
||||
@ -2583,7 +2607,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va,
|
||||
*/
|
||||
if (oldpte & PG_G)
|
||||
pmap_invalidate_page(kernel_pmap, va);
|
||||
pmap->pm_stats.resident_count -= 1;
|
||||
pmap_resident_count_dec(pmap, 1);
|
||||
if (oldpte & PG_MANAGED) {
|
||||
m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME);
|
||||
if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
|
||||
@ -2775,9 +2799,9 @@ pmap_remove_all(vm_page_t m)
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
|
||||
while ((pv = TAILQ_FIRST(&pvh->pv_list)) != NULL) {
|
||||
va = pv->pv_va;
|
||||
pmap = PV_PMAP(pv);
|
||||
PMAP_LOCK(pmap);
|
||||
va = pv->pv_va;
|
||||
pde = pmap_pde(pmap, va);
|
||||
(void)pmap_demote_pde(pmap, pde, va);
|
||||
PMAP_UNLOCK(pmap);
|
||||
@ -2785,7 +2809,7 @@ pmap_remove_all(vm_page_t m)
|
||||
while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
|
||||
pmap = PV_PMAP(pv);
|
||||
PMAP_LOCK(pmap);
|
||||
pmap->pm_stats.resident_count--;
|
||||
pmap_resident_count_dec(pmap, 1);
|
||||
pde = pmap_pde(pmap, pv->pv_va);
|
||||
KASSERT((*pde & PG_PS) == 0, ("pmap_remove_all: found"
|
||||
" a 2mpage in page %p's pv list", m));
|
||||
@ -2832,18 +2856,9 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot)
|
||||
if (oldpde & PG_MANAGED) {
|
||||
eva = sva + NBPDR;
|
||||
for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
|
||||
va < eva; va += PAGE_SIZE, m++) {
|
||||
/*
|
||||
* In contrast to the analogous operation on a 4KB page
|
||||
* mapping, the mapping's PG_A flag is not cleared and
|
||||
* the page's PG_REFERENCED flag is not set. The
|
||||
* reason is that pmap_demote_pde() expects that a 2MB
|
||||
* page mapping with a stored page table page has PG_A
|
||||
* set.
|
||||
*/
|
||||
va < eva; va += PAGE_SIZE, m++)
|
||||
if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
|
||||
vm_page_dirty(m);
|
||||
}
|
||||
}
|
||||
if ((prot & VM_PROT_WRITE) == 0)
|
||||
newpde &= ~(PG_RW | PG_M);
|
||||
@ -2952,23 +2967,15 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
|
||||
obits = pbits = *pte;
|
||||
if ((pbits & PG_V) == 0)
|
||||
continue;
|
||||
if (pbits & PG_MANAGED) {
|
||||
m = NULL;
|
||||
if (pbits & PG_A) {
|
||||
|
||||
if ((prot & VM_PROT_WRITE) == 0) {
|
||||
if ((pbits & (PG_MANAGED | PG_M | PG_RW)) ==
|
||||
(PG_MANAGED | PG_M | PG_RW)) {
|
||||
m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
|
||||
vm_page_flag_set(m, PG_REFERENCED);
|
||||
pbits &= ~PG_A;
|
||||
}
|
||||
if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
|
||||
if (m == NULL)
|
||||
m = PHYS_TO_VM_PAGE(pbits &
|
||||
PG_FRAME);
|
||||
vm_page_dirty(m);
|
||||
}
|
||||
}
|
||||
|
||||
if ((prot & VM_PROT_WRITE) == 0)
|
||||
pbits &= ~(PG_RW | PG_M);
|
||||
}
|
||||
if ((prot & VM_PROT_EXECUTE) == 0)
|
||||
pbits |= pg_nx;
|
||||
|
||||
@ -3142,9 +3149,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m,
|
||||
* In the case that a page table page is not
|
||||
* resident, we are creating it here.
|
||||
*/
|
||||
if (va < VM_MAXUSER_ADDRESS) {
|
||||
if (va < VM_MAXUSER_ADDRESS)
|
||||
mpte = pmap_allocpte(pmap, va, M_WAITOK);
|
||||
}
|
||||
|
||||
pde = pmap_pde(pmap, va);
|
||||
if (pde != NULL && (*pde & PG_V) != 0) {
|
||||
@ -3208,7 +3214,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m,
|
||||
" va: 0x%lx", va));
|
||||
}
|
||||
} else
|
||||
pmap->pm_stats.resident_count++;
|
||||
pmap_resident_count_inc(pmap, 1);
|
||||
|
||||
/*
|
||||
* Enter on the PV list if part of our managed memory.
|
||||
@ -3342,7 +3348,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
|
||||
/*
|
||||
* Increment counters.
|
||||
*/
|
||||
pmap->pm_stats.resident_count += NBPDR / PAGE_SIZE;
|
||||
pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE);
|
||||
|
||||
/*
|
||||
* Map the superpage.
|
||||
@ -3392,7 +3398,7 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end,
|
||||
mpte);
|
||||
m = TAILQ_NEXT(m, listq);
|
||||
}
|
||||
PMAP_UNLOCK(pmap);
|
||||
PMAP_UNLOCK(pmap);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3496,7 +3502,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
/*
|
||||
* Increment counters
|
||||
*/
|
||||
pmap->pm_stats.resident_count++;
|
||||
pmap_resident_count_inc(pmap, 1);
|
||||
|
||||
pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 0);
|
||||
if ((prot & VM_PROT_EXECUTE) == 0)
|
||||
@ -3509,7 +3515,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
pte_store(pte, pa | PG_V | PG_U);
|
||||
else
|
||||
pte_store(pte, pa | PG_V | PG_U | PG_MANAGED);
|
||||
return mpte;
|
||||
return (mpte);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3601,8 +3607,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object,
|
||||
if ((*pde & PG_V) == 0) {
|
||||
pde_store(pde, pa | PG_PS | PG_M | PG_A |
|
||||
PG_U | PG_RW | PG_V);
|
||||
pmap->pm_stats.resident_count += NBPDR /
|
||||
PAGE_SIZE;
|
||||
pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE);
|
||||
pmap_pde_mappings++;
|
||||
} else {
|
||||
/* Continue on if the PDE is already valid. */
|
||||
@ -3669,8 +3674,6 @@ pmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired)
|
||||
PMAP_UNLOCK(pmap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Copy the range specified by src_addr/len
|
||||
* from the source map to the range dst_addr/len
|
||||
@ -3745,8 +3748,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len,
|
||||
pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr &
|
||||
PG_PS_FRAME))) {
|
||||
*pde = srcptepaddr & ~PG_W;
|
||||
dst_pmap->pm_stats.resident_count +=
|
||||
NBPDR / PAGE_SIZE;
|
||||
pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE);
|
||||
} else
|
||||
dstmpde->wire_count--;
|
||||
continue;
|
||||
@ -3789,7 +3791,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len,
|
||||
*/
|
||||
*dst_pte = ptetemp & ~(PG_W | PG_M |
|
||||
PG_A);
|
||||
dst_pmap->pm_stats.resident_count++;
|
||||
pmap_resident_count_inc(dst_pmap, 1);
|
||||
} else {
|
||||
free = NULL;
|
||||
if (pmap_unwire_pte_hold(dst_pmap,
|
||||
@ -3886,12 +3888,12 @@ pmap_page_exists_quick(pmap_t pmap, vm_page_t m)
|
||||
int loops = 0;
|
||||
|
||||
if (m->flags & PG_FICTITIOUS)
|
||||
return FALSE;
|
||||
return (FALSE);
|
||||
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
|
||||
if (PV_PMAP(pv) == pmap) {
|
||||
return TRUE;
|
||||
return (TRUE);
|
||||
}
|
||||
loops++;
|
||||
if (loops >= 16)
|
||||
@ -3959,16 +3961,15 @@ pmap_pvh_wired_mappings(struct md_page *pvh, int count)
|
||||
boolean_t
|
||||
pmap_page_is_mapped(vm_page_t m)
|
||||
{
|
||||
struct md_page *pvh;
|
||||
boolean_t rv;
|
||||
|
||||
if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
|
||||
return (FALSE);
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
if (TAILQ_EMPTY(&m->md.pv_list)) {
|
||||
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
|
||||
return (!TAILQ_EMPTY(&pvh->pv_list));
|
||||
} else
|
||||
return (TRUE);
|
||||
vm_page_lock_queues();
|
||||
rv = !TAILQ_EMPTY(&m->md.pv_list) ||
|
||||
!TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list);
|
||||
vm_page_unlock_queues();
|
||||
return (rv);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4062,7 +4063,7 @@ pmap_remove_pages(pmap_t pmap)
|
||||
pv_entry_count--;
|
||||
pc->pc_map[field] |= bitmask;
|
||||
if ((tpte & PG_PS) != 0) {
|
||||
pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE;
|
||||
pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
|
||||
pvh = pa_to_pvh(tpte & PG_PS_FRAME);
|
||||
TAILQ_REMOVE(&pvh->pv_list, pv, pv_list);
|
||||
if (TAILQ_EMPTY(&pvh->pv_list)) {
|
||||
@ -4073,7 +4074,7 @@ pmap_remove_pages(pmap_t pmap)
|
||||
mpte = pmap_lookup_pt_page(pmap, pv->pv_va);
|
||||
if (mpte != NULL) {
|
||||
pmap_remove_pt_page(pmap, mpte);
|
||||
pmap->pm_stats.resident_count--;
|
||||
pmap_resident_count_dec(pmap, 1);
|
||||
KASSERT(mpte->wire_count == NPTEPG,
|
||||
("pmap_remove_pages: pte page wire count error"));
|
||||
mpte->wire_count = 0;
|
||||
@ -4081,7 +4082,7 @@ pmap_remove_pages(pmap_t pmap)
|
||||
atomic_subtract_int(&cnt.v_wire_count, 1);
|
||||
}
|
||||
} else {
|
||||
pmap->pm_stats.resident_count--;
|
||||
pmap_resident_count_dec(pmap, 1);
|
||||
TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
|
||||
if (TAILQ_EMPTY(&m->md.pv_list)) {
|
||||
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
|
||||
@ -4177,6 +4178,49 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr)
|
||||
return (rv);
|
||||
}
|
||||
|
||||
/*
|
||||
* pmap_is_referenced:
|
||||
*
|
||||
* Return whether or not the specified physical page was referenced
|
||||
* in any physical maps.
|
||||
*/
|
||||
boolean_t
|
||||
pmap_is_referenced(vm_page_t m)
|
||||
{
|
||||
|
||||
if (m->flags & PG_FICTITIOUS)
|
||||
return (FALSE);
|
||||
if (pmap_is_referenced_pvh(&m->md))
|
||||
return (TRUE);
|
||||
return (pmap_is_referenced_pvh(pa_to_pvh(VM_PAGE_TO_PHYS(m))));
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns TRUE if any of the given mappings were referenced and FALSE
|
||||
* otherwise. Both page and 2mpage mappings are supported.
|
||||
*/
|
||||
static boolean_t
|
||||
pmap_is_referenced_pvh(struct md_page *pvh)
|
||||
{
|
||||
pv_entry_t pv;
|
||||
pt_entry_t *pte;
|
||||
pmap_t pmap;
|
||||
boolean_t rv;
|
||||
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
rv = FALSE;
|
||||
TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
|
||||
pmap = PV_PMAP(pv);
|
||||
PMAP_LOCK(pmap);
|
||||
pte = pmap_pte(pmap, pv->pv_va);
|
||||
rv = (*pte & (PG_A | PG_V)) == (PG_A | PG_V);
|
||||
PMAP_UNLOCK(pmap);
|
||||
if (rv)
|
||||
break;
|
||||
}
|
||||
return (rv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the write and modified bits in each of the given page's mappings.
|
||||
*/
|
||||
@ -4196,9 +4240,9 @@ pmap_remove_write(vm_page_t m)
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
|
||||
TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
|
||||
va = pv->pv_va;
|
||||
pmap = PV_PMAP(pv);
|
||||
PMAP_LOCK(pmap);
|
||||
va = pv->pv_va;
|
||||
pde = pmap_pde(pmap, va);
|
||||
if ((*pde & PG_RW) != 0)
|
||||
(void)pmap_demote_pde(pmap, pde, va);
|
||||
@ -4254,9 +4298,9 @@ pmap_ts_referenced(vm_page_t m)
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
|
||||
TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, pvn) {
|
||||
va = pv->pv_va;
|
||||
pmap = PV_PMAP(pv);
|
||||
PMAP_LOCK(pmap);
|
||||
va = pv->pv_va;
|
||||
pde = pmap_pde(pmap, va);
|
||||
oldpde = *pde;
|
||||
if ((oldpde & PG_A) != 0) {
|
||||
@ -4326,9 +4370,9 @@ pmap_clear_modify(vm_page_t m)
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
|
||||
TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
|
||||
va = pv->pv_va;
|
||||
pmap = PV_PMAP(pv);
|
||||
PMAP_LOCK(pmap);
|
||||
va = pv->pv_va;
|
||||
pde = pmap_pde(pmap, va);
|
||||
oldpde = *pde;
|
||||
if ((oldpde & PG_RW) != 0) {
|
||||
@ -4391,9 +4435,9 @@ pmap_clear_reference(vm_page_t m)
|
||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
|
||||
TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
|
||||
va = pv->pv_va;
|
||||
pmap = PV_PMAP(pv);
|
||||
PMAP_LOCK(pmap);
|
||||
va = pv->pv_va;
|
||||
pde = pmap_pde(pmap, va);
|
||||
oldpde = *pde;
|
||||
if ((oldpde & PG_A) != 0) {
|
||||
@ -4864,7 +4908,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr)
|
||||
if (pte != 0) {
|
||||
val |= MINCORE_INCORE;
|
||||
if ((pte & PG_MANAGED) == 0)
|
||||
return val;
|
||||
return (val);
|
||||
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
|
||||
@ -4893,14 +4937,12 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr)
|
||||
*/
|
||||
vm_page_lock_queues();
|
||||
if ((m->flags & PG_REFERENCED) ||
|
||||
pmap_ts_referenced(m)) {
|
||||
pmap_is_referenced(m))
|
||||
val |= MINCORE_REFERENCED_OTHER;
|
||||
vm_page_flag_set(m, PG_REFERENCED);
|
||||
}
|
||||
vm_page_unlock_queues();
|
||||
}
|
||||
}
|
||||
return val;
|
||||
return (val);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -172,52 +172,6 @@ SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
|
||||
|
||||
extern char *syscallnames[];
|
||||
|
||||
/* #define DEBUG 1 */
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
report_seg_fault(const char *segn, struct trapframe *frame)
|
||||
{
|
||||
struct proc_ldt *pldt;
|
||||
struct trapframe *pf;
|
||||
|
||||
pldt = curproc->p_md.md_ldt;
|
||||
printf("%d: %s load fault %lx %p %d\n",
|
||||
curproc->p_pid, segn, frame->tf_err,
|
||||
pldt != NULL ? pldt->ldt_base : NULL,
|
||||
pldt != NULL ? pldt->ldt_refcnt : 0);
|
||||
kdb_backtrace();
|
||||
pf = (struct trapframe *)frame->tf_rsp;
|
||||
printf("rdi %lx\n", pf->tf_rdi);
|
||||
printf("rsi %lx\n", pf->tf_rsi);
|
||||
printf("rdx %lx\n", pf->tf_rdx);
|
||||
printf("rcx %lx\n", pf->tf_rcx);
|
||||
printf("r8 %lx\n", pf->tf_r8);
|
||||
printf("r9 %lx\n", pf->tf_r9);
|
||||
printf("rax %lx\n", pf->tf_rax);
|
||||
printf("rbx %lx\n", pf->tf_rbx);
|
||||
printf("rbp %lx\n", pf->tf_rbp);
|
||||
printf("r10 %lx\n", pf->tf_r10);
|
||||
printf("r11 %lx\n", pf->tf_r11);
|
||||
printf("r12 %lx\n", pf->tf_r12);
|
||||
printf("r13 %lx\n", pf->tf_r13);
|
||||
printf("r14 %lx\n", pf->tf_r14);
|
||||
printf("r15 %lx\n", pf->tf_r15);
|
||||
printf("fs %x\n", pf->tf_fs);
|
||||
printf("gs %x\n", pf->tf_gs);
|
||||
printf("es %x\n", pf->tf_es);
|
||||
printf("ds %x\n", pf->tf_ds);
|
||||
printf("tno %x\n", pf->tf_trapno);
|
||||
printf("adr %lx\n", pf->tf_addr);
|
||||
printf("flg %x\n", pf->tf_flags);
|
||||
printf("err %lx\n", pf->tf_err);
|
||||
printf("rip %lx\n", pf->tf_rip);
|
||||
printf("cs %lx\n", pf->tf_cs);
|
||||
printf("rfl %lx\n", pf->tf_rflags);
|
||||
printf("rsp %lx\n", pf->tf_rsp);
|
||||
printf("ss %lx\n", pf->tf_ss);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exception, fault, and trap interface to the FreeBSD kernel.
|
||||
* This common code is called from assembly language IDT gate entry
|
||||
@ -314,9 +268,7 @@ trap(struct trapframe *frame)
|
||||
*/
|
||||
printf("kernel trap %d with interrupts disabled\n",
|
||||
type);
|
||||
#ifdef DEBUG
|
||||
report_seg_fault("hlt", frame);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We shouldn't enable interrupts while holding a
|
||||
* spin lock or servicing an NMI.
|
||||
@ -535,33 +487,21 @@ trap(struct trapframe *frame)
|
||||
goto out;
|
||||
}
|
||||
if (frame->tf_rip == (long)ld_ds) {
|
||||
#ifdef DEBUG
|
||||
report_seg_fault("ds", frame);
|
||||
#endif
|
||||
frame->tf_rip = (long)ds_load_fault;
|
||||
frame->tf_ds = _udatasel;
|
||||
goto out;
|
||||
}
|
||||
if (frame->tf_rip == (long)ld_es) {
|
||||
#ifdef DEBUG
|
||||
report_seg_fault("es", frame);
|
||||
#endif
|
||||
frame->tf_rip = (long)es_load_fault;
|
||||
frame->tf_es = _udatasel;
|
||||
goto out;
|
||||
}
|
||||
if (frame->tf_rip == (long)ld_fs) {
|
||||
#ifdef DEBUG
|
||||
report_seg_fault("fs", frame);
|
||||
#endif
|
||||
frame->tf_rip = (long)fs_load_fault;
|
||||
frame->tf_fs = _ufssel;
|
||||
goto out;
|
||||
}
|
||||
if (frame->tf_rip == (long)ld_gs) {
|
||||
#ifdef DEBUG
|
||||
report_seg_fault("gs", frame);
|
||||
#endif
|
||||
frame->tf_rip = (long)gs_load_fault;
|
||||
frame->tf_gs = _ugssel;
|
||||
goto out;
|
||||
@ -667,30 +607,6 @@ trap(struct trapframe *frame)
|
||||
ksi.ksi_addr = (void *)addr;
|
||||
trapsignal(td, &ksi);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
register_t rg,rgk, rf;
|
||||
|
||||
if (type <= MAX_TRAP_MSG) {
|
||||
uprintf("fatal process exception: %s",
|
||||
trap_msg[type]);
|
||||
if ((type == T_PAGEFLT) || (type == T_PROTFLT))
|
||||
uprintf(", fault VA = 0x%lx", frame->tf_addr);
|
||||
uprintf("\n");
|
||||
}
|
||||
rf = rdmsr(0xc0000100);
|
||||
rg = rdmsr(0xc0000101);
|
||||
rgk = rdmsr(0xc0000102);
|
||||
uprintf("pid %d TRAP %d rip %lx err %lx addr %lx cs %lx ss %lx ds %x "
|
||||
"es %x fs %x fsbase %lx %lx gs %x gsbase %lx %lx %lx\n",
|
||||
curproc->p_pid, type, frame->tf_rip, frame->tf_err,
|
||||
frame->tf_addr,
|
||||
frame->tf_cs, frame->tf_ss, frame->tf_ds, frame->tf_es,
|
||||
frame->tf_fs, td->td_pcb->pcb_fsbase, rf,
|
||||
frame->tf_gs, td->td_pcb->pcb_gsbase, rg, rgk);
|
||||
}
|
||||
#endif
|
||||
|
||||
user:
|
||||
userret(td, frame);
|
||||
mtx_assert(&Giant, MA_NOTOWNED);
|
||||
|
@ -224,6 +224,7 @@ device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le')
|
||||
device re # RealTek 8139C+/8169/8169S/8110S
|
||||
device rl # RealTek 8129/8139
|
||||
device sf # Adaptec AIC-6915 (``Starfire'')
|
||||
device sge # Silicon Integrated Systems SiS190/191
|
||||
device sis # Silicon Integrated Systems SiS 900/SiS 7016
|
||||
device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet
|
||||
device ste # Sundance ST201 (D-Link DFE-550TX)
|
||||
@ -280,6 +281,7 @@ device firmware # firmware assist module
|
||||
device bpf # Berkeley packet filter
|
||||
|
||||
# USB support
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device uhci # UHCI PCI->USB interface
|
||||
device ohci # OHCI PCI->USB interface
|
||||
device ehci # EHCI PCI->USB interface (USB 2.0)
|
||||
|
@ -141,9 +141,11 @@ ia32_get_mcontext(struct thread *td, struct ia32_mcontext *mcp, int flags)
|
||||
mcp->mc_esi = tp->tf_rsi;
|
||||
mcp->mc_ebp = tp->tf_rbp;
|
||||
mcp->mc_isp = tp->tf_rsp;
|
||||
mcp->mc_eflags = tp->tf_rflags;
|
||||
if (flags & GET_MC_CLEAR_RET) {
|
||||
mcp->mc_eax = 0;
|
||||
mcp->mc_edx = 0;
|
||||
mcp->mc_eflags &= ~PSL_C;
|
||||
} else {
|
||||
mcp->mc_eax = tp->tf_rax;
|
||||
mcp->mc_edx = tp->tf_rdx;
|
||||
@ -152,7 +154,6 @@ ia32_get_mcontext(struct thread *td, struct ia32_mcontext *mcp, int flags)
|
||||
mcp->mc_ecx = tp->tf_rcx;
|
||||
mcp->mc_eip = tp->tf_rip;
|
||||
mcp->mc_cs = tp->tf_cs;
|
||||
mcp->mc_eflags = tp->tf_rflags;
|
||||
mcp->mc_esp = tp->tf_rsp;
|
||||
mcp->mc_ss = tp->tf_ss;
|
||||
mcp->mc_len = sizeof(*mcp);
|
||||
|
@ -25,7 +25,22 @@
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef _MACHINE_IODEV_H_
|
||||
#define _MACHINE_IODEV_H_
|
||||
|
||||
d_open_t ioopen;
|
||||
d_close_t ioclose;
|
||||
d_ioctl_t ioioctl;
|
||||
#ifdef _KERNEL
|
||||
#include <machine/cpufunc.h>
|
||||
|
||||
#define iodev_read_1 inb
|
||||
#define iodev_read_2 inw
|
||||
#define iodev_read_4 inl
|
||||
#define iodev_write_1 outb
|
||||
#define iodev_write_2 outw
|
||||
#define iodev_write_4 outl
|
||||
|
||||
int iodev_open(struct thread *td);
|
||||
int iodev_close(struct thread *td);
|
||||
int iodev_ioctl(u_long cmd, caddr_t data);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _MACHINE_IODEV_H_ */
|
||||
|
@ -245,6 +245,8 @@ struct pmap {
|
||||
pml4_entry_t *pm_pml4; /* KVA of level 4 page table */
|
||||
TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */
|
||||
u_int pm_active; /* active on cpus */
|
||||
uint32_t pm_gen_count; /* generation count (pmap lock dropped) */
|
||||
u_int pm_retries;
|
||||
/* spare u_int here due to padding */
|
||||
struct pmap_statistics pm_stats; /* pmap statistics */
|
||||
vm_page_t pm_root; /* spare page table pages */
|
||||
|
@ -53,6 +53,9 @@ struct mdproc {
|
||||
struct system_segment_descriptor md_ldt_sd;
|
||||
};
|
||||
|
||||
#define KINFO_PROC_SIZE 1088
|
||||
#define KINFO_PROC32_SIZE 768
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
/* Get the current kernel thread stack usage. */
|
||||
|
@ -113,6 +113,7 @@
|
||||
#define CPUID_PBE 0x80000000
|
||||
|
||||
#define CPUID2_SSE3 0x00000001
|
||||
#define CPUID2_PCLMULQDQ 0x00000002
|
||||
#define CPUID2_DTES64 0x00000004
|
||||
#define CPUID2_MON 0x00000008
|
||||
#define CPUID2_DS_CPL 0x00000010
|
||||
@ -131,6 +132,7 @@
|
||||
#define CPUID2_X2APIC 0x00200000
|
||||
#define CPUID2_MOVBE 0x00400000
|
||||
#define CPUID2_POPCNT 0x00800000
|
||||
#define CPUID2_AESNI 0x02000000
|
||||
|
||||
/*
|
||||
* Important bits in the AMD extended cpuid flags
|
||||
|
@ -145,6 +145,10 @@
|
||||
#define VM_LEVEL_0_ORDER 9
|
||||
#endif
|
||||
|
||||
#ifdef SMP
|
||||
#define PA_LOCK_COUNT 256
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Virtual addresses of things. Derived from the page directory and
|
||||
* page table indexes from pmap.h for precision.
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004,2005 Kip Macy
|
||||
/*-
|
||||
* Copyright (c) 2004, 2005 Kip Macy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -11,22 +10,22 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _XEN_XENFUNC_H_
|
||||
#define _XEN_XENFUNC_H_
|
||||
|
||||
|
@ -1,29 +1,27 @@
|
||||
/*
|
||||
/*-
|
||||
* Copyright (c) 2008 Kip Macy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
@ -783,69 +783,66 @@ struct cpu_functions xscalec3_cpufuncs = {
|
||||
#endif /* CPU_XSCALE_81342 */
|
||||
|
||||
|
||||
#if defined(CPU_FA526)
|
||||
#if defined(CPU_FA526) || defined(CPU_FA626TE)
|
||||
struct cpu_functions fa526_cpufuncs = {
|
||||
/* CPU functions */
|
||||
|
||||
.cf_id = cpufunc_id,
|
||||
.cf_cpwait = cpufunc_nullop,
|
||||
cpufunc_id, /* id */
|
||||
cpufunc_nullop, /* cpwait */
|
||||
|
||||
/* MMU functions */
|
||||
|
||||
.cf_control = cpufunc_control,
|
||||
.cf_domains = cpufunc_domains,
|
||||
.cf_setttb = fa526_setttb,
|
||||
.cf_faultstatus = cpufunc_faultstatus,
|
||||
.cf_faultaddress = cpufunc_faultaddress,
|
||||
cpufunc_control, /* control */
|
||||
cpufunc_domains, /* domain */
|
||||
fa526_setttb, /* setttb */
|
||||
cpufunc_faultstatus, /* faultstatus */
|
||||
cpufunc_faultaddress, /* faultaddress */
|
||||
|
||||
/* TLB functions */
|
||||
|
||||
.cf_tlb_flushID = armv4_tlb_flushID,
|
||||
.cf_tlb_flushID_SE = fa526_tlb_flushID_SE,
|
||||
.cf_tlb_flushI = armv4_tlb_flushI,
|
||||
.cf_tlb_flushI_SE = fa526_tlb_flushI_SE,
|
||||
.cf_tlb_flushD = armv4_tlb_flushD,
|
||||
.cf_tlb_flushD_SE = armv4_tlb_flushD_SE,
|
||||
armv4_tlb_flushID, /* tlb_flushID */
|
||||
fa526_tlb_flushID_SE, /* tlb_flushID_SE */
|
||||
armv4_tlb_flushI, /* tlb_flushI */
|
||||
fa526_tlb_flushI_SE, /* tlb_flushI_SE */
|
||||
armv4_tlb_flushD, /* tlb_flushD */
|
||||
armv4_tlb_flushD_SE, /* tlb_flushD_SE */
|
||||
|
||||
/* Cache operations */
|
||||
|
||||
.cf_icache_sync_all = fa526_icache_sync_all,
|
||||
.cf_icache_sync_range = fa526_icache_sync_range,
|
||||
fa526_icache_sync_all, /* icache_sync_all */
|
||||
fa526_icache_sync_range, /* icache_sync_range */
|
||||
|
||||
.cf_dcache_wbinv_all = fa526_dcache_wbinv_all,
|
||||
.cf_dcache_wbinv_range = fa526_dcache_wbinv_range,
|
||||
.cf_dcache_inv_range = fa526_dcache_inv_range,
|
||||
.cf_dcache_wb_range = fa526_dcache_wb_range,
|
||||
|
||||
.cf_idcache_wbinv_all = fa526_idcache_wbinv_all,
|
||||
.cf_idcache_wbinv_range = fa526_idcache_wbinv_range,
|
||||
|
||||
|
||||
.cf_l2cache_wbinv_all = cpufunc_nullop,
|
||||
.cf_l2cache_wbinv_range = (void *)cpufunc_nullop,
|
||||
.cf_l2cache_inv_range = (void *)cpufunc_nullop,
|
||||
.cf_l2cache_wb_range = (void *)cpufunc_nullop,
|
||||
fa526_dcache_wbinv_all, /* dcache_wbinv_all */
|
||||
fa526_dcache_wbinv_range, /* dcache_wbinv_range */
|
||||
fa526_dcache_inv_range, /* dcache_inv_range */
|
||||
fa526_dcache_wb_range, /* dcache_wb_range */
|
||||
|
||||
fa526_idcache_wbinv_all, /* idcache_wbinv_all */
|
||||
fa526_idcache_wbinv_range, /* idcache_wbinv_range */
|
||||
cpufunc_nullop, /* l2cache_wbinv_all */
|
||||
(void *)cpufunc_nullop, /* l2cache_wbinv_range */
|
||||
(void *)cpufunc_nullop, /* l2cache_inv_range */
|
||||
(void *)cpufunc_nullop, /* l2cache_wb_range */
|
||||
|
||||
/* Other functions */
|
||||
|
||||
.cf_flush_prefetchbuf = fa526_flush_prefetchbuf,
|
||||
.cf_drain_writebuf = armv4_drain_writebuf,
|
||||
.cf_flush_brnchtgt_C = cpufunc_nullop,
|
||||
.cf_flush_brnchtgt_E = fa526_flush_brnchtgt_E,
|
||||
fa526_flush_prefetchbuf, /* flush_prefetchbuf */
|
||||
armv4_drain_writebuf, /* drain_writebuf */
|
||||
cpufunc_nullop, /* flush_brnchtgt_C */
|
||||
fa526_flush_brnchtgt_E, /* flush_brnchtgt_E */
|
||||
|
||||
.cf_sleep = fa526_cpu_sleep,
|
||||
fa526_cpu_sleep, /* sleep */
|
||||
|
||||
/* Soft functions */
|
||||
|
||||
.cf_dataabt_fixup = cpufunc_null_fixup,
|
||||
.cf_prefetchabt_fixup = cpufunc_null_fixup,
|
||||
cpufunc_null_fixup, /* dataabt_fixup */
|
||||
cpufunc_null_fixup, /* prefetchabt_fixup */
|
||||
|
||||
.cf_context_switch = fa526_context_switch,
|
||||
fa526_context_switch, /* context_switch */
|
||||
|
||||
.cf_setup = fa526_setup
|
||||
};
|
||||
#endif /* CPU_FA526 */
|
||||
fa526_setup /* cpu setup */
|
||||
};
|
||||
#endif /* CPU_FA526 || CPU_FA626TE */
|
||||
|
||||
|
||||
/*
|
||||
@ -856,11 +853,11 @@ struct cpu_functions cpufuncs;
|
||||
u_int cputype;
|
||||
u_int cpu_reset_needs_v4_MMU_disable; /* flag used in locore.s */
|
||||
|
||||
#if defined(CPU_ARM7TDMI) || defined(CPU_ARM8) || defined(CPU_ARM9) || \
|
||||
defined (CPU_ARM9E) || defined (CPU_ARM10) || \
|
||||
defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \
|
||||
defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
|
||||
defined(CPU_FA526) || \
|
||||
#if defined(CPU_ARM7TDMI) || defined(CPU_ARM8) || defined(CPU_ARM9) || \
|
||||
defined (CPU_ARM9E) || defined (CPU_ARM10) || \
|
||||
defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \
|
||||
defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
|
||||
defined(CPU_FA526) || defined(CPU_FA626TE) || \
|
||||
defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342)
|
||||
|
||||
static void get_cachetype_cp15(void);
|
||||
@ -1141,8 +1138,8 @@ set_cpufuncs()
|
||||
goto out;
|
||||
}
|
||||
#endif /* CPU_SA1110 */
|
||||
#ifdef CPU_FA526
|
||||
if (cputype == CPU_ID_FA526) {
|
||||
#if defined(CPU_FA526) || defined(CPU_FA626TE)
|
||||
if (cputype == CPU_ID_FA526 || cputype == CPU_ID_FA626TE) {
|
||||
cpufuncs = fa526_cpufuncs;
|
||||
cpu_reset_needs_v4_MMU_disable = 1; /* SA needs it */
|
||||
get_cachetype_cp15();
|
||||
@ -1153,7 +1150,7 @@ set_cpufuncs()
|
||||
|
||||
goto out;
|
||||
}
|
||||
#endif /* CPU_FA526 */
|
||||
#endif /* CPU_FA526 || CPU_FA626TE */
|
||||
#ifdef CPU_IXP12X0
|
||||
if (cputype == CPU_ID_IXP1200) {
|
||||
cpufuncs = ixp12x0_cpufuncs;
|
||||
@ -1629,7 +1626,7 @@ late_abort_fixup(arg)
|
||||
defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
|
||||
defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \
|
||||
defined(CPU_ARM10) || defined(CPU_ARM11) || \
|
||||
defined(CPU_FA526)
|
||||
defined(CPU_FA526) || defined(CPU_FA626TE)
|
||||
|
||||
#define IGN 0
|
||||
#define OR 1
|
||||
@ -2095,7 +2092,7 @@ sa11x0_setup(args)
|
||||
}
|
||||
#endif /* CPU_SA1100 || CPU_SA1110 */
|
||||
|
||||
#if defined(CPU_FA526)
|
||||
#if defined(CPU_FA526) || defined(CPU_FA626TE)
|
||||
struct cpu_option fa526_options[] = {
|
||||
#ifdef COMPAT_12
|
||||
{ "nocache", IGN, BIC, (CPU_CONTROL_IC_ENABLE |
|
||||
@ -2149,7 +2146,7 @@ fa526_setup(char *args)
|
||||
ctrl = cpuctrl;
|
||||
cpu_control(0xffffffff, cpuctrl);
|
||||
}
|
||||
#endif /* CPU_FA526 */
|
||||
#endif /* CPU_FA526 || CPU_FA626TE */
|
||||
|
||||
|
||||
#if defined(CPU_IXP12X0)
|
||||
|
@ -32,7 +32,11 @@
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef CPU_FA526
|
||||
#define CACHELINE_SIZE 16
|
||||
#else
|
||||
#define CACHELINE_SIZE 32
|
||||
#endif
|
||||
|
||||
ENTRY(fa526_setttb)
|
||||
mov r1, #0
|
||||
|
@ -57,7 +57,7 @@ void __startC(void);
|
||||
#define cpu_idcache_wbinv_all arm8_cache_purgeID
|
||||
#elif defined(CPU_ARM9)
|
||||
#define cpu_idcache_wbinv_all arm9_idcache_wbinv_all
|
||||
#elif defined(CPU_FA526)
|
||||
#elif defined(CPU_FA526) || defined(CPU_FA626TE)
|
||||
#define cpu_idcache_wbinv_all fa526_idcache_wbinv_all
|
||||
#elif defined(CPU_ARM9E)
|
||||
#define cpu_idcache_wbinv_all armv5_ec_idcache_wbinv_all
|
||||
|
@ -220,7 +220,9 @@ const struct cpuidtab cpuids[] = {
|
||||
generic_steppings },
|
||||
{ CPU_ID_ARM966ESR1, CPU_CLASS_ARM9ES, "ARM966E-S",
|
||||
generic_steppings },
|
||||
{ CPU_ID_FA526, CPU_CLASS_ARM9, "FA526",
|
||||
{ CPU_ID_FA526, CPU_CLASS_ARM9, "FA526",
|
||||
generic_steppings },
|
||||
{ CPU_ID_FA626TE, CPU_CLASS_ARM9ES, "FA626TE",
|
||||
generic_steppings },
|
||||
|
||||
{ CPU_ID_TI925T, CPU_CLASS_ARM9TDMI, "TI ARM925T",
|
||||
|
@ -3740,13 +3740,14 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
struct l2_dtable *l2;
|
||||
pd_entry_t l1pd;
|
||||
pt_entry_t *ptep, pte;
|
||||
vm_paddr_t pa;
|
||||
vm_paddr_t pa, paddr;
|
||||
vm_page_t m = NULL;
|
||||
u_int l1idx;
|
||||
l1idx = L1_IDX(va);
|
||||
paddr = 0;
|
||||
|
||||
vm_page_lock_queues();
|
||||
PMAP_LOCK(pmap);
|
||||
retry:
|
||||
l1pd = pmap->pm_l1->l1_kva[l1idx];
|
||||
if (l1pte_section_p(l1pd)) {
|
||||
/*
|
||||
@ -3758,6 +3759,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
pa = (l1pd & L1_SUP_FRAME) | (va & L1_SUP_OFFSET);
|
||||
else
|
||||
pa = (l1pd & L1_S_FRAME) | (va & L1_S_OFFSET);
|
||||
if (vm_page_pa_tryrelock(pmap, pa & PG_FRAME, &paddr))
|
||||
goto retry;
|
||||
if (l1pd & L1_S_PROT_W || (prot & VM_PROT_WRITE) == 0) {
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
vm_page_hold(m);
|
||||
@ -3774,7 +3777,6 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
if (l2 == NULL ||
|
||||
(ptep = l2->l2_bucket[L2_BUCKET(l1idx)].l2b_kva) == NULL) {
|
||||
PMAP_UNLOCK(pmap);
|
||||
vm_page_unlock_queues();
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -3783,7 +3785,6 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
|
||||
if (pte == 0) {
|
||||
PMAP_UNLOCK(pmap);
|
||||
vm_page_unlock_queues();
|
||||
return (NULL);
|
||||
}
|
||||
if (pte & L2_S_PROT_W || (prot & VM_PROT_WRITE) == 0) {
|
||||
@ -3796,13 +3797,15 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
pa = (pte & L2_S_FRAME) | (va & L2_S_OFFSET);
|
||||
break;
|
||||
}
|
||||
if (vm_page_pa_tryrelock(pmap, pa & PG_FRAME, &paddr))
|
||||
goto retry;
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
vm_page_hold(m);
|
||||
}
|
||||
}
|
||||
|
||||
PMAP_UNLOCK(pmap);
|
||||
vm_page_unlock_queues();
|
||||
PA_UNLOCK_COND(paddr);
|
||||
return (m);
|
||||
}
|
||||
|
||||
@ -4492,6 +4495,20 @@ pmap_clear_modify(vm_page_t m)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* pmap_is_referenced:
|
||||
*
|
||||
* Return whether or not the specified physical page was referenced
|
||||
* in any physical maps.
|
||||
*/
|
||||
boolean_t
|
||||
pmap_is_referenced(vm_page_t m)
|
||||
{
|
||||
|
||||
return ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 &&
|
||||
(m->md.pvh_attrs & PVF_REF) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* pmap_clear_reference:
|
||||
*
|
||||
|
@ -272,8 +272,8 @@ ate_attach(device_t dev)
|
||||
ifp->if_ioctl = ateioctl;
|
||||
ifp->if_init = ateinit;
|
||||
ifp->if_baudrate = 10000000;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
|
||||
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
|
||||
ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
ifp->if_linkmib = &sc->mibdata;
|
||||
ifp->if_linkmiblen = sizeof(sc->mibdata);
|
||||
|
@ -67,6 +67,7 @@ device e1000phy
|
||||
device bpf
|
||||
|
||||
# USB
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device usb
|
||||
device ehci
|
||||
device umass
|
||||
|
@ -74,6 +74,7 @@ device iicbus
|
||||
device ds133x
|
||||
|
||||
# USB
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device usb
|
||||
device ehci
|
||||
device umass
|
||||
|
@ -67,6 +67,7 @@ device e1000phy
|
||||
device bpf
|
||||
|
||||
# USB
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device usb
|
||||
device ehci
|
||||
device umass
|
||||
|
@ -95,6 +95,7 @@ device icee
|
||||
|
||||
device bpf
|
||||
# USB support
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device ohci # OHCI localbus->USB interface
|
||||
device usb # USB Bus (required)
|
||||
#device udbp # USB Double Bulk Pipe devices
|
||||
|
@ -96,6 +96,7 @@ device icee
|
||||
|
||||
device bpf
|
||||
# USB support
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device ohci # OHCI localbus->USB interface
|
||||
device usb # USB Bus (required)
|
||||
#device udbp # USB Double Bulk Pipe devices
|
||||
|
@ -79,6 +79,7 @@ options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed
|
||||
|
||||
device md
|
||||
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device usb
|
||||
device ohci
|
||||
device umass
|
||||
|
@ -61,6 +61,7 @@ options DEVICE_POLLING
|
||||
device vlan
|
||||
|
||||
# USB
|
||||
options USB_DEBUG # enable debug msgs
|
||||
device usb
|
||||
device ehci
|
||||
device umass
|
||||
|
@ -62,6 +62,7 @@
|
||||
defined(CPU_XSCALE_80321) + \
|
||||
defined(CPU_XSCALE_PXA2X0) + \
|
||||
defined(CPU_FA526) + \
|
||||
defined(CPU_FA626TE) + \
|
||||
defined(CPU_XSCALE_IXP425))
|
||||
|
||||
/*
|
||||
@ -78,7 +79,7 @@
|
||||
#if (defined(CPU_ARM9E) || defined(CPU_ARM10) || \
|
||||
defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \
|
||||
defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \
|
||||
defined(CPU_XSCALE_PXA2X0))
|
||||
defined(CPU_XSCALE_PXA2X0) || defined(CPU_FA626TE))
|
||||
#define ARM_ARCH_5 1
|
||||
#else
|
||||
#define ARM_ARCH_5 0
|
||||
@ -126,7 +127,8 @@
|
||||
|
||||
#if (defined(CPU_ARM6) || defined(CPU_ARM7) || defined(CPU_ARM7TDMI) || \
|
||||
defined(CPU_ARM8) || defined(CPU_ARM9) || defined(CPU_ARM9E) || \
|
||||
defined(CPU_ARM10) || defined(CPU_ARM11) || defined(CPU_FA526))
|
||||
defined(CPU_ARM10) || defined(CPU_ARM11) || defined(CPU_FA526) || \
|
||||
defined(CPU_FA626TE))
|
||||
#define ARM_MMU_GENERIC 1
|
||||
#else
|
||||
#define ARM_MMU_GENERIC 0
|
||||
|
@ -284,7 +284,7 @@ u_int arm8_clock_config (u_int, u_int);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CPU_FA526
|
||||
#if defined(CPU_FA526) || defined(CPU_FA626TE)
|
||||
void fa526_setup (char *arg);
|
||||
void fa526_setttb (u_int ttb);
|
||||
void fa526_context_switch (void);
|
||||
@ -464,11 +464,11 @@ extern unsigned armv5_dcache_index_max;
|
||||
extern unsigned armv5_dcache_index_inc;
|
||||
#endif
|
||||
|
||||
#if defined(CPU_ARM9) || defined(CPU_ARM9E) || defined(CPU_ARM10) || \
|
||||
defined(CPU_SA110) || defined(CPU_SA1100) || defined(CPU_SA1110) || \
|
||||
defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \
|
||||
defined(CPU_FA526) || \
|
||||
defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
|
||||
#if defined(CPU_ARM9) || defined(CPU_ARM9E) || defined(CPU_ARM10) || \
|
||||
defined(CPU_SA110) || defined(CPU_SA1100) || defined(CPU_SA1110) || \
|
||||
defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \
|
||||
defined(CPU_FA526) || defined(CPU_FA626TE) || \
|
||||
defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
|
||||
defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342)
|
||||
|
||||
void armv4_tlb_flushID (void);
|
||||
|
@ -134,6 +134,8 @@ struct pmap {
|
||||
struct l1_ttable *pm_l1;
|
||||
struct l2_dtable *pm_l2[L2_SIZE];
|
||||
pd_entry_t *pm_pdir; /* KVA of page directory */
|
||||
uint32_t pm_gen_count; /* generation count (pmap lock dropped) */
|
||||
u_int pm_retries;
|
||||
int pm_active; /* active on cpus */
|
||||
struct pmap_statistics pm_stats; /* pmap statictics */
|
||||
TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */
|
||||
|
@ -60,4 +60,6 @@ struct mdproc {
|
||||
void *md_sigtramp;
|
||||
};
|
||||
|
||||
#define KINFO_PROC_SIZE 792
|
||||
|
||||
#endif /* !_MACHINE_PROC_H_ */
|
||||
|
@ -30,6 +30,7 @@ arm/mv/timer.c standard
|
||||
arm/mv/twsi.c optional iicbus
|
||||
|
||||
dev/mge/if_mge.c optional mge
|
||||
dev/mvs/mvs_soc.c optional mvs
|
||||
dev/uart/uart_bus_mbus.c optional uart
|
||||
dev/uart/uart_cpu_mv.c optional uart
|
||||
dev/uart/uart_dev_ns8250.c optional uart
|
||||
|
@ -360,7 +360,7 @@ npe_attach(device_t dev)
|
||||
ifp->if_ioctl = npeioctl;
|
||||
ifp->if_init = npeinit;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, sc->txdma.nbuf - 1);
|
||||
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
|
||||
ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
ifp->if_linkmib = &sc->mibdata;
|
||||
ifp->if_linkmiblen = sizeof(sc->mibdata);
|
||||
|
@ -197,8 +197,6 @@ if_epair_load="NO" # Virtual b-t-b Ethernet-like interface pair
|
||||
if_faith_load="NO" # IPv6-to-IPv4 TCP relay capturing interface
|
||||
if_gif_load="NO" # generic tunnel interface
|
||||
if_gre_load="NO" # encapsulating network device
|
||||
if_ppp_load="NO" # Kernel ppp
|
||||
if_sl_load="NO" # SLIP
|
||||
if_stf_load="NO" # 6to4 tunnel interface
|
||||
if_tap_load="NO" # Ethernet tunnel software network interface
|
||||
if_tun_load="NO" # Tunnel driver (user process ppp)
|
||||
@ -217,7 +215,6 @@ if_age_load="NO" # Attansic/Atheros L1 Gigabit Ethernet
|
||||
if_alc_load="NO" # Atheros AR8131/AR8132 Ethernet
|
||||
if_ale_load="NO" # Atheros AR8121/AR8113/AR8114 Ethernet
|
||||
if_an_load="NO" # Aironet 4500/4800 802.11 wireless NICs
|
||||
if_ar_load="NO" # Digi SYNC/570i
|
||||
if_ath_load="NO" # Atheros IEEE 802.11 wireless NICs
|
||||
if_aue_load="NO" # ADMtek AN986 Pegasus USB Ethernet
|
||||
if_awi_load="NO" # AMD PCnetMobile IEEE 802.11 wireless NICs
|
||||
@ -237,6 +234,7 @@ if_ed_load="NO" # National Semiconductor DS8390/WD83C690
|
||||
if_em_load="NO" # Intel(R) PRO/1000 Gigabit Ethernet
|
||||
if_en_load="NO" # Midway-based ATM interfaces
|
||||
if_ep_load="NO" # 3Com Etherlink III (3c5x9)
|
||||
if_et_load="NO" # Agere ET1310 10/100/Gigabit Ethernet
|
||||
if_ex_load="NO" # Intel EtherExpress Pro/10 Ethernet
|
||||
if_fe_load="NO" # Fujitsu MB86960A/MB86965A based Ethernet
|
||||
# adapters
|
||||
@ -265,16 +263,15 @@ if_nve_load="NO" # NVIDIA nForce MCP Networking Adapter
|
||||
if_nxge_load="NO" # Neterion Xframe 10Gb Ethernet
|
||||
if_pcn_load="NO" # AMD PCnet PCI
|
||||
if_ral_load="NO" # Ralink Technology wireless
|
||||
if_ray_load="NO" # Raytheon Raylink/Webgear Aviator PCCard
|
||||
if_re_load="NO" # RealTek 8139C+/8169/8169S/8110S
|
||||
if_rl_load="NO" # RealTek 8129/8139
|
||||
if_rue_load="NO" # RealTek RTL8150 USB to Fast Ethernet
|
||||
if_sbni_load="NO" # Granch SBNI12 leased line adapters
|
||||
if_sf_load="NO" # Adaptec Duralink PCI (AIC-6915 "starfire")
|
||||
if_sge_load="NO" # Silicon Integrated Systems SiS 190/191
|
||||
if_sis_load="NO" # Silicon Integrated Systems SiS 900/7016
|
||||
if_sk_load="NO" # SysKonnect SK-984x series PCI Gigabit Ethernet
|
||||
if_sn_load="NO" # SMC 91Cxx
|
||||
if_sr_load="NO" # synchronous RISCom/N2 / WANic 400/405
|
||||
if_ste_load="NO" # Sundance Technologies ST201 Fast Ethernet
|
||||
if_stge_load="NO" # Sundance/Tamarack TC9021 Gigabit Ethernet
|
||||
if_ti_load="NO" # Alteon Networks Tigon 1 and Tigon 2
|
||||
|
@ -451,7 +451,8 @@ dtlb_va_to_pa_sun4u(vm_offset_t va)
|
||||
reg = dtlb_get_data_sun4u(i);
|
||||
wrpr(pstate, pstate, 0);
|
||||
reg >>= TD_PA_SHIFT;
|
||||
if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
|
||||
if (cpu_impl == CPU_IMPL_SPARC64V ||
|
||||
cpu_impl >= CPU_IMPL_ULTRASPARCIII)
|
||||
return (reg & TD_PA_CH_MASK);
|
||||
return (reg & TD_PA_SF_MASK);
|
||||
}
|
||||
@ -474,7 +475,8 @@ itlb_va_to_pa_sun4u(vm_offset_t va)
|
||||
reg = itlb_get_data_sun4u(i);
|
||||
wrpr(pstate, pstate, 0);
|
||||
reg >>= TD_PA_SHIFT;
|
||||
if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
|
||||
if (cpu_impl == CPU_IMPL_SPARC64V ||
|
||||
cpu_impl >= CPU_IMPL_ULTRASPARCIII)
|
||||
return (reg & TD_PA_CH_MASK);
|
||||
return (reg & TD_PA_SF_MASK);
|
||||
}
|
||||
@ -696,6 +698,7 @@ cpu_cpuid_prop_sun4u(void)
|
||||
|
||||
switch (cpu_impl) {
|
||||
case CPU_IMPL_SPARC64:
|
||||
case CPU_IMPL_SPARC64V:
|
||||
case CPU_IMPL_ULTRASPARCI:
|
||||
case CPU_IMPL_ULTRASPARCII:
|
||||
case CPU_IMPL_ULTRASPARCIIi:
|
||||
@ -720,6 +723,7 @@ cpu_get_mid_sun4u(void)
|
||||
|
||||
switch (cpu_impl) {
|
||||
case CPU_IMPL_SPARC64:
|
||||
case CPU_IMPL_SPARC64V:
|
||||
case CPU_IMPL_ULTRASPARCI:
|
||||
case CPU_IMPL_ULTRASPARCII:
|
||||
case CPU_IMPL_ULTRASPARCIIi:
|
||||
|
@ -686,14 +686,10 @@ adaregister(struct cam_periph *periph, void *arg)
|
||||
else
|
||||
softc->quirks = ADA_Q_NONE;
|
||||
|
||||
/* Check if the SIM does not want queued commands */
|
||||
bzero(&cpi, sizeof(cpi));
|
||||
xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);
|
||||
cpi.ccb_h.func_code = XPT_PATH_INQ;
|
||||
xpt_action((union ccb *)&cpi);
|
||||
if (cpi.ccb_h.status != CAM_REQ_CMP ||
|
||||
(cpi.hba_inquiry & PI_TAG_ABLE) == 0)
|
||||
softc->flags &= ~ADA_FLAG_CAN_NCQ;
|
||||
|
||||
TASK_INIT(&softc->sysctl_task, 0, adasysctlinit, periph);
|
||||
|
||||
|
@ -101,6 +101,7 @@ struct pmp_softc {
|
||||
int events;
|
||||
#define PMP_EV_RESET 1
|
||||
#define PMP_EV_RESCAN 2
|
||||
u_int caps;
|
||||
struct task sysctl_task;
|
||||
struct sysctl_ctx_list sysctl_ctx;
|
||||
struct sysctl_oid *sysctl_tree;
|
||||
@ -457,6 +458,14 @@ pmpstart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
ata_pm_read_cmd(ataio, 2, 15);
|
||||
break;
|
||||
case PMP_STATE_PRECONFIG:
|
||||
/* Get/update host SATA capabilities. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
|
||||
softc->caps = cts.xport_specific.sata.caps;
|
||||
cam_fill_ataio(ataio,
|
||||
pmp_retry_count,
|
||||
pmpdone,
|
||||
@ -644,14 +653,16 @@ pmpdone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
(done_ccb->ataio.res.lba_mid << 16) +
|
||||
(done_ccb->ataio.res.lba_low << 8) +
|
||||
done_ccb->ataio.res.sector_count;
|
||||
if ((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) {
|
||||
if (((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) ||
|
||||
(res & 0x600) != 0) {
|
||||
if (bootverbose) {
|
||||
printf("%s%d: port %d status: %08x\n",
|
||||
periph->periph_name, periph->unit_number,
|
||||
softc->pm_step, res);
|
||||
}
|
||||
/* Report device speed. */
|
||||
if (xpt_create_path(&dpath, periph,
|
||||
/* Report device speed if it is online. */
|
||||
if ((res & 0xf0f) == 0x103 &&
|
||||
xpt_create_path(&dpath, periph,
|
||||
xpt_path_path_id(periph->path),
|
||||
softc->pm_step, 0) == CAM_REQ_CMP) {
|
||||
bzero(&cts, sizeof(cts));
|
||||
@ -660,6 +671,9 @@ pmpdone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
cts.xport_specific.sata.revision = (res & 0x0f0) >> 4;
|
||||
cts.xport_specific.sata.valid = CTS_SATA_VALID_REVISION;
|
||||
cts.xport_specific.sata.caps = softc->caps &
|
||||
(CTS_SATA_CAPS_H_PMREQ | CTS_SATA_CAPS_H_DMAAA);
|
||||
cts.xport_specific.sata.valid |= CTS_SATA_VALID_CAPS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
xpt_free_path(dpath);
|
||||
}
|
||||
|
@ -88,6 +88,9 @@ typedef enum {
|
||||
PROBE_IDENTIFY,
|
||||
PROBE_SPINUP,
|
||||
PROBE_SETMODE,
|
||||
PROBE_SETPM,
|
||||
PROBE_SETAPST,
|
||||
PROBE_SETDMAAA,
|
||||
PROBE_SET_MULTI,
|
||||
PROBE_INQUIRY,
|
||||
PROBE_FULL_INQUIRY,
|
||||
@ -101,6 +104,9 @@ static char *probe_action_text[] = {
|
||||
"PROBE_IDENTIFY",
|
||||
"PROBE_SPINUP",
|
||||
"PROBE_SETMODE",
|
||||
"PROBE_SETPM",
|
||||
"PROBE_SETAPST",
|
||||
"PROBE_SETDMAAA",
|
||||
"PROBE_SET_MULTI",
|
||||
"PROBE_INQUIRY",
|
||||
"PROBE_FULL_INQUIRY",
|
||||
@ -132,6 +138,7 @@ typedef struct {
|
||||
uint32_t pm_prv;
|
||||
int restart;
|
||||
int spinup;
|
||||
u_int caps;
|
||||
struct cam_periph *periph;
|
||||
} probe_softc;
|
||||
|
||||
@ -393,6 +400,45 @@ probestart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
ata_28bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode);
|
||||
break;
|
||||
}
|
||||
case PROBE_SETPM:
|
||||
cam_fill_ataio(ataio,
|
||||
1,
|
||||
probedone,
|
||||
CAM_DIR_NONE,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
30*1000);
|
||||
ata_28bit_cmd(ataio, ATA_SETFEATURES,
|
||||
(softc->caps & CTS_SATA_CAPS_H_PMREQ) ? 0x10 : 0x90,
|
||||
0, 0x03);
|
||||
break;
|
||||
case PROBE_SETAPST:
|
||||
cam_fill_ataio(ataio,
|
||||
1,
|
||||
probedone,
|
||||
CAM_DIR_NONE,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
30*1000);
|
||||
ata_28bit_cmd(ataio, ATA_SETFEATURES,
|
||||
(softc->caps & CTS_SATA_CAPS_H_APST) ? 0x10 : 0x90,
|
||||
0, 0x07);
|
||||
break;
|
||||
case PROBE_SETDMAAA:
|
||||
cam_fill_ataio(ataio,
|
||||
1,
|
||||
probedone,
|
||||
CAM_DIR_NONE,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
30*1000);
|
||||
ata_28bit_cmd(ataio, ATA_SETFEATURES,
|
||||
(softc->caps & CTS_SATA_CAPS_H_DMAAA) ? 0x10 : 0x90,
|
||||
0, 0x02);
|
||||
break;
|
||||
case PROBE_SET_MULTI:
|
||||
{
|
||||
u_int sectors, bytecount;
|
||||
@ -685,6 +731,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
probe_softc *softc;
|
||||
struct cam_path *path;
|
||||
u_int32_t priority;
|
||||
u_int caps;
|
||||
int found = 1;
|
||||
|
||||
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probedone\n"));
|
||||
@ -766,7 +813,9 @@ device_fail: if ((!softc->restart) &&
|
||||
}
|
||||
case PROBE_IDENTIFY:
|
||||
{
|
||||
struct ccb_pathinq cpi;
|
||||
int16_t *ptr;
|
||||
int changed = 1;
|
||||
|
||||
ident_buf = &softc->ident_data;
|
||||
for (ptr = (int16_t *)ident_buf;
|
||||
@ -808,9 +857,12 @@ device_fail: if ((!softc->restart) &&
|
||||
sizeof(ident_buf->serial))) {
|
||||
/* Device changed. */
|
||||
xpt_async(AC_LOST_DEVICE, path, NULL);
|
||||
} else
|
||||
} else {
|
||||
bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params));
|
||||
} else {
|
||||
changed = 0;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params));
|
||||
/* Clean up from previous instance of this device */
|
||||
if (path->device->serial_num != NULL) {
|
||||
@ -840,16 +892,24 @@ device_fail: if ((!softc->restart) &&
|
||||
ata_find_quirk(path->device);
|
||||
if (path->device->mintags != 0 &&
|
||||
path->bus->sim->max_tagged_dev_openings != 0) {
|
||||
/* Report SIM which tags are allowed. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
cts.xport_specific.sata.tags = path->device->maxtags;
|
||||
cts.xport_specific.sata.valid = CTS_SATA_VALID_TAGS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
/* Reconfigure queues for tagged queueing. */
|
||||
xpt_start_tags(path);
|
||||
/* Check if the SIM does not want queued commands. */
|
||||
bzero(&cpi, sizeof(cpi));
|
||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cpi.ccb_h.func_code = XPT_PATH_INQ;
|
||||
xpt_action((union ccb *)&cpi);
|
||||
if (cpi.ccb_h.status == CAM_REQ_CMP &&
|
||||
(cpi.hba_inquiry & PI_TAG_ABLE)) {
|
||||
/* Report SIM which tags are allowed. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
cts.xport_specific.sata.tags = path->device->maxtags;
|
||||
cts.xport_specific.sata.valid = CTS_SATA_VALID_TAGS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
/* Reconfigure queues for tagged queueing. */
|
||||
xpt_start_tags(path);
|
||||
}
|
||||
}
|
||||
ata_device_transport(path);
|
||||
PROBE_SET_ACTION(softc, PROBE_SETMODE);
|
||||
@ -866,6 +926,67 @@ device_fail: if ((!softc->restart) &&
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
case PROBE_SETMODE:
|
||||
if (path->device->transport != XPORT_SATA)
|
||||
goto notsata;
|
||||
/* Set supported bits. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
|
||||
caps = cts.xport_specific.sata.caps & CTS_SATA_CAPS_H;
|
||||
else
|
||||
caps = 0;
|
||||
if (ident_buf->satacapabilities != 0xffff) {
|
||||
if (ident_buf->satacapabilities & ATA_SUPPORT_IFPWRMNGTRCV)
|
||||
caps |= CTS_SATA_CAPS_D_PMREQ;
|
||||
if (ident_buf->satacapabilities & ATA_SUPPORT_HAPST)
|
||||
caps |= CTS_SATA_CAPS_D_APST;
|
||||
}
|
||||
/* Mask unwanted bits. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_USER_SETTINGS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
|
||||
caps &= cts.xport_specific.sata.caps;
|
||||
/* Store result to SIM. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
cts.xport_specific.sata.caps = caps;
|
||||
cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
softc->caps = caps;
|
||||
if (ident_buf->satasupport & ATA_SUPPORT_IFPWRMNGT) {
|
||||
PROBE_SET_ACTION(softc, PROBE_SETPM);
|
||||
xpt_release_ccb(done_ccb);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case PROBE_SETPM:
|
||||
if (ident_buf->satacapabilities != 0xffff &&
|
||||
ident_buf->satacapabilities & ATA_SUPPORT_DAPST) {
|
||||
PROBE_SET_ACTION(softc, PROBE_SETAPST);
|
||||
xpt_release_ccb(done_ccb);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case PROBE_SETAPST:
|
||||
if (ident_buf->satasupport & ATA_SUPPORT_AUTOACTIVATE) {
|
||||
PROBE_SET_ACTION(softc, PROBE_SETDMAAA);
|
||||
xpt_release_ccb(done_ccb);
|
||||
xpt_schedule(periph, priority);
|
||||
return;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case PROBE_SETDMAAA:
|
||||
notsata:
|
||||
if (path->device->protocol == PROTO_ATA) {
|
||||
PROBE_SET_ACTION(softc, PROBE_SET_MULTI);
|
||||
} else {
|
||||
@ -951,6 +1072,35 @@ device_fail: if ((!softc->restart) &&
|
||||
snprintf(ident_buf->revision, sizeof(ident_buf->revision),
|
||||
"%04x", softc->pm_prv);
|
||||
path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
|
||||
/* Set supported bits. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
|
||||
caps = cts.xport_specific.sata.caps & CTS_SATA_CAPS_H;
|
||||
else
|
||||
caps = 0;
|
||||
/* All PMPs must support PM requests. */
|
||||
caps |= CTS_SATA_CAPS_D_PMREQ;
|
||||
/* Mask unwanted bits. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_USER_SETTINGS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
|
||||
caps &= cts.xport_specific.sata.caps;
|
||||
/* Store result to SIM. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
cts.xport_specific.sata.caps = caps;
|
||||
cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS;
|
||||
xpt_action((union ccb *)&cts);
|
||||
softc->caps = caps;
|
||||
if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
|
||||
path->device->flags &= ~CAM_DEV_UNCONFIGURED;
|
||||
xpt_acquire_device(path->device);
|
||||
@ -1105,13 +1255,13 @@ ata_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
|
||||
work_ccb = request_ccb;
|
||||
/* Reuse the same CCB to query if a device was really found */
|
||||
scan_info = (ata_scan_bus_info *)work_ccb->ccb_h.ppriv_ptr0;
|
||||
/* Free the current request path- we're done with it. */
|
||||
xpt_free_path(work_ccb->ccb_h.path);
|
||||
/* If there is PMP... */
|
||||
if ((scan_info->cpi->hba_inquiry & PI_SATAPM) &&
|
||||
(scan_info->counter == scan_info->cpi->max_target)) {
|
||||
if (work_ccb->ccb_h.status == CAM_REQ_CMP) {
|
||||
/* everything else willbe probed by it */
|
||||
/* everything else will be probed by it */
|
||||
/* Free the current request path- we're done with it. */
|
||||
xpt_free_path(work_ccb->ccb_h.path);
|
||||
goto done;
|
||||
} else {
|
||||
struct ccb_trans_settings cts;
|
||||
@ -1119,7 +1269,7 @@ ata_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
|
||||
/* Report SIM that PM is absent. */
|
||||
bzero(&cts, sizeof(cts));
|
||||
xpt_setup_ccb(&cts.ccb_h,
|
||||
scan_info->request_ccb->ccb_h.path, 1);
|
||||
work_ccb->ccb_h.path, CAM_PRIORITY_NONE);
|
||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
cts.xport_specific.sata.pm_present = 0;
|
||||
@ -1127,6 +1277,8 @@ ata_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
|
||||
xpt_action((union ccb *)&cts);
|
||||
}
|
||||
}
|
||||
/* Free the current request path- we're done with it. */
|
||||
xpt_free_path(work_ccb->ccb_h.path);
|
||||
if (scan_info->counter ==
|
||||
((scan_info->cpi->hba_inquiry & PI_SATAPM) ?
|
||||
0 : scan_info->cpi->max_target)) {
|
||||
|
@ -837,12 +837,21 @@ struct ccb_trans_settings_sata {
|
||||
#define CTS_SATA_VALID_PM 0x08
|
||||
#define CTS_SATA_VALID_TAGS 0x10
|
||||
#define CTS_SATA_VALID_ATAPI 0x20
|
||||
#define CTS_SATA_VALID_CAPS 0x40
|
||||
int mode; /* Legacy PATA mode */
|
||||
u_int bytecount; /* Length of PIO transaction */
|
||||
int revision; /* SATA revision */
|
||||
u_int pm_present; /* PM is present (XPT->SIM) */
|
||||
u_int tags; /* Number of allowed tags */
|
||||
u_int atapi; /* Length of ATAPI CDB */
|
||||
u_int caps; /* Device and host SATA caps. */
|
||||
#define CTS_SATA_CAPS_H 0x0000ffff
|
||||
#define CTS_SATA_CAPS_H_PMREQ 0x00000001
|
||||
#define CTS_SATA_CAPS_H_APST 0x00000002
|
||||
#define CTS_SATA_CAPS_H_DMAAA 0x00000010 /* Auto-activation */
|
||||
#define CTS_SATA_CAPS_D 0xffff0000
|
||||
#define CTS_SATA_CAPS_D_PMREQ 0x00010000
|
||||
#define CTS_SATA_CAPS_D_APST 0x00020000
|
||||
};
|
||||
|
||||
/* Get/Set transfer rate/width/disconnection/tag queueing settings */
|
||||
|
@ -467,34 +467,7 @@ xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td
|
||||
ccb = xpt_alloc_ccb();
|
||||
|
||||
CAM_SIM_LOCK(bus->sim);
|
||||
/* Ensure passed in target/lun supported on this bus. */
|
||||
if ((inccb->ccb_h.target_id != CAM_TARGET_WILDCARD) ||
|
||||
(inccb->ccb_h.target_lun != CAM_LUN_WILDCARD)) {
|
||||
if (xpt_create_path(&ccb->ccb_h.path,
|
||||
xpt_periph,
|
||||
inccb->ccb_h.path_id,
|
||||
CAM_TARGET_WILDCARD,
|
||||
CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
|
||||
error = EINVAL;
|
||||
CAM_SIM_UNLOCK(bus->sim);
|
||||
xpt_free_ccb(ccb);
|
||||
break;
|
||||
}
|
||||
xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path,
|
||||
inccb->ccb_h.pinfo.priority);
|
||||
ccb->ccb_h.func_code = XPT_PATH_INQ;
|
||||
xpt_action(ccb);
|
||||
xpt_free_path(ccb->ccb_h.path);
|
||||
if ((inccb->ccb_h.target_id != CAM_TARGET_WILDCARD &&
|
||||
inccb->ccb_h.target_id > ccb->cpi.max_target) ||
|
||||
(inccb->ccb_h.target_lun != CAM_LUN_WILDCARD &&
|
||||
inccb->ccb_h.target_lun > ccb->cpi.max_lun)) {
|
||||
error = EINVAL;
|
||||
CAM_SIM_UNLOCK(bus->sim);
|
||||
xpt_free_ccb(ccb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a path using the bus, target, and lun the
|
||||
* user passed in.
|
||||
@ -4901,6 +4874,8 @@ camisr_runqueue(void *V_queue)
|
||||
if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0
|
||||
&& (--dev->tag_delay_count == 0))
|
||||
xpt_start_tags(ccb_h->path);
|
||||
if (!device_is_send_queued(dev))
|
||||
xpt_schedule_dev_sendq(ccb_h->path->bus, dev);
|
||||
}
|
||||
|
||||
if (ccb_h->status & CAM_RELEASE_SIMQ) {
|
||||
|
@ -2773,8 +2773,12 @@ cdcheckmedia(struct cam_periph *periph)
|
||||
softc->flags &= ~(CD_FLAG_VALID_MEDIA|CD_FLAG_VALID_TOC);
|
||||
cdprevent(periph, PR_ALLOW);
|
||||
return (error);
|
||||
} else
|
||||
} else {
|
||||
softc->flags |= CD_FLAG_VALID_MEDIA;
|
||||
softc->disk->d_sectorsize = softc->params.blksize;
|
||||
softc->disk->d_mediasize =
|
||||
(off_t)softc->params.blksize * softc->params.disksize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we check the table of contents. This (currently) is only
|
||||
@ -2863,9 +2867,6 @@ cdcheckmedia(struct cam_periph *periph)
|
||||
}
|
||||
|
||||
softc->flags |= CD_FLAG_VALID_TOC;
|
||||
softc->disk->d_sectorsize = softc->params.blksize;
|
||||
softc->disk->d_mediasize =
|
||||
(off_t)softc->params.blksize * softc->params.disksize;
|
||||
|
||||
bailout:
|
||||
|
||||
|
@ -52,9 +52,9 @@ static void
|
||||
system_taskq_init(void *arg)
|
||||
{
|
||||
|
||||
system_taskq = (taskq_t *)taskqueue_thread;
|
||||
taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask),
|
||||
NULL, NULL, NULL, NULL, 0, 0);
|
||||
system_taskq = taskq_create("system_taskq", mp_ncpus, 0, 0, 0, 0);
|
||||
}
|
||||
SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, NULL);
|
||||
|
||||
@ -62,6 +62,7 @@ static void
|
||||
system_taskq_fini(void *arg)
|
||||
{
|
||||
|
||||
taskq_destroy(system_taskq);
|
||||
uma_zdestroy(taskq_zone);
|
||||
}
|
||||
SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL);
|
||||
@ -72,10 +73,8 @@ taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused,
|
||||
{
|
||||
taskq_t *tq;
|
||||
|
||||
if ((flags & TASKQ_THREADS_CPU_PCT) != 0) {
|
||||
/* TODO: Calculate number od threads. */
|
||||
printf("%s: TASKQ_THREADS_CPU_PCT\n", __func__);
|
||||
}
|
||||
if ((flags & TASKQ_THREADS_CPU_PCT) != 0)
|
||||
nthreads = MAX((mp_ncpus * nthreads) / 100, 1);
|
||||
|
||||
tq = kmem_alloc(sizeof(*tq), KM_SLEEP);
|
||||
tq->tq_queue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue,
|
||||
@ -85,6 +84,14 @@ taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused,
|
||||
return ((taskq_t *)tq);
|
||||
}
|
||||
|
||||
taskq_t *
|
||||
taskq_create_proc(const char *name, int nthreads, pri_t pri, int minalloc,
|
||||
int maxalloc, proc_t *proc __unused, uint_t flags)
|
||||
{
|
||||
|
||||
return (taskq_create(name, nthreads, pri, minalloc, maxalloc, flags));
|
||||
}
|
||||
|
||||
void
|
||||
taskq_destroy(taskq_t *tq)
|
||||
{
|
||||
|
@ -131,7 +131,6 @@
|
||||
#include <sys/kstat.h>
|
||||
#include <sys/sdt.h>
|
||||
|
||||
#include <sys/ktr.h>
|
||||
#include <vm/vm_pageout.h>
|
||||
|
||||
static kmutex_t arc_reclaim_thr_lock;
|
||||
@ -238,7 +237,7 @@ struct arcs_lock {
|
||||
*/
|
||||
#define ARC_BUFC_NUMDATALISTS 16
|
||||
#define ARC_BUFC_NUMMETADATALISTS 16
|
||||
#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS+ARC_BUFC_NUMDATALISTS)
|
||||
#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS + ARC_BUFC_NUMDATALISTS)
|
||||
|
||||
typedef struct arc_state {
|
||||
uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; /* amount of evictable data */
|
||||
@ -247,7 +246,7 @@ typedef struct arc_state {
|
||||
struct arcs_lock arcs_locks[ARC_BUFC_NUMLISTS] __aligned(CACHE_LINE_SIZE);
|
||||
} arc_state_t;
|
||||
|
||||
#define ARCS_LOCK(s, i) &((s)->arcs_locks[(i)].arcs_lock)
|
||||
#define ARCS_LOCK(s, i) (&((s)->arcs_locks[(i)].arcs_lock))
|
||||
|
||||
/* The 6 states: */
|
||||
static arc_state_t ARC_anon;
|
||||
@ -307,9 +306,9 @@ typedef struct arc_stats {
|
||||
kstat_named_t arcstat_l2_hdr_size;
|
||||
kstat_named_t arcstat_memory_throttle_count;
|
||||
kstat_named_t arcstat_l2_write_trylock_fail;
|
||||
kstat_named_t arcstat_l2_write_in_l2;
|
||||
kstat_named_t arcstat_l2_write_passed_headroom;
|
||||
kstat_named_t arcstat_l2_write_spa_mismatch;
|
||||
kstat_named_t arcstat_l2_write_in_l2;
|
||||
kstat_named_t arcstat_l2_write_hdr_io_in_progress;
|
||||
kstat_named_t arcstat_l2_write_not_cacheable;
|
||||
kstat_named_t arcstat_l2_write_full;
|
||||
@ -370,19 +369,19 @@ static arc_stats_t arc_stats = {
|
||||
{ "l2_size", KSTAT_DATA_UINT64 },
|
||||
{ "l2_hdr_size", KSTAT_DATA_UINT64 },
|
||||
{ "memory_throttle_count", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_trylock_fail", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_in_l2", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_passed_headroom", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_spa_mismatch", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_io_in_progress", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_not_cacheable", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_full", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_iter", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_pios", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_bytes_written", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 }
|
||||
{ "l2_write_trylock_fail", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_passed_headroom", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_spa_mismatch", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_in_l2", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_io_in_progress", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_not_cacheable", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_full", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_iter", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_pios", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_bytes_written", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 },
|
||||
{ "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 }
|
||||
};
|
||||
|
||||
#define ARCSTAT(stat) (arc_stats.stat.value.ui64)
|
||||
@ -390,7 +389,7 @@ static arc_stats_t arc_stats = {
|
||||
#define ARCSTAT_INCR(stat, val) \
|
||||
atomic_add_64(&arc_stats.stat.value.ui64, (val));
|
||||
|
||||
#define ARCSTAT_BUMP(stat) ARCSTAT_INCR(stat, 1)
|
||||
#define ARCSTAT_BUMP(stat) ARCSTAT_INCR(stat, 1)
|
||||
#define ARCSTAT_BUMPDOWN(stat) ARCSTAT_INCR(stat, -1)
|
||||
|
||||
#define ARCSTAT_MAX(stat, val) { \
|
||||
@ -424,7 +423,7 @@ static arc_stats_t arc_stats = {
|
||||
}
|
||||
|
||||
kstat_t *arc_ksp;
|
||||
static arc_state_t *arc_anon;
|
||||
static arc_state_t *arc_anon;
|
||||
static arc_state_t *arc_mru;
|
||||
static arc_state_t *arc_mru_ghost;
|
||||
static arc_state_t *arc_mfu;
|
||||
@ -1076,10 +1075,10 @@ get_buf_info(arc_buf_hdr_t *ab, arc_state_t *state, list_t **list, kmutex_t **lo
|
||||
{
|
||||
uint64_t buf_hashid = buf_hash(ab->b_spa, &ab->b_dva, ab->b_birth);
|
||||
|
||||
if (ab->b_type == ARC_BUFC_METADATA)
|
||||
buf_hashid &= (ARC_BUFC_NUMMETADATALISTS-1);
|
||||
if (ab->b_type == ARC_BUFC_METADATA)
|
||||
buf_hashid &= (ARC_BUFC_NUMMETADATALISTS - 1);
|
||||
else {
|
||||
buf_hashid &= (ARC_BUFC_NUMDATALISTS-1);
|
||||
buf_hashid &= (ARC_BUFC_NUMDATALISTS - 1);
|
||||
buf_hashid += ARC_BUFC_NUMMETADATALISTS;
|
||||
}
|
||||
|
||||
@ -1096,18 +1095,16 @@ add_reference(arc_buf_hdr_t *ab, kmutex_t *hash_lock, void *tag)
|
||||
|
||||
if ((refcount_add(&ab->b_refcnt, tag) == 1) &&
|
||||
(ab->b_state != arc_anon)) {
|
||||
list_t *list;
|
||||
kmutex_t *lock;
|
||||
uint64_t delta = ab->b_size * ab->b_datacnt;
|
||||
uint64_t *size = &ab->b_state->arcs_lsize[ab->b_type];
|
||||
list_t *list;
|
||||
kmutex_t *lock;
|
||||
|
||||
get_buf_info(ab, ab->b_state, &list, &lock);
|
||||
ASSERT(!MUTEX_HELD(lock));
|
||||
mutex_enter(lock);
|
||||
ASSERT(list_link_active(&ab->b_arc_node));
|
||||
list_remove(list, ab);
|
||||
mutex_exit(lock);
|
||||
|
||||
if (GHOST_STATE(ab->b_state)) {
|
||||
ASSERT3U(ab->b_datacnt, ==, 0);
|
||||
ASSERT3P(ab->b_buf, ==, NULL);
|
||||
@ -1116,6 +1113,7 @@ add_reference(arc_buf_hdr_t *ab, kmutex_t *hash_lock, void *tag)
|
||||
ASSERT(delta > 0);
|
||||
ASSERT3U(*size, >=, delta);
|
||||
atomic_add_64(size, -delta);
|
||||
mutex_exit(lock);
|
||||
/* remove the prefetch flag if we get a reference */
|
||||
if (ab->b_flags & ARC_PREFETCH)
|
||||
ab->b_flags &= ~ARC_PREFETCH;
|
||||
@ -1138,15 +1136,13 @@ remove_reference(arc_buf_hdr_t *ab, kmutex_t *hash_lock, void *tag)
|
||||
kmutex_t *lock;
|
||||
|
||||
get_buf_info(ab, state, &list, &lock);
|
||||
|
||||
ASSERT(!MUTEX_HELD(lock));
|
||||
mutex_enter(lock);
|
||||
ASSERT(!list_link_active(&ab->b_arc_node));
|
||||
list_insert_head(list, ab);
|
||||
mutex_exit(lock);
|
||||
|
||||
ASSERT(ab->b_datacnt > 0);
|
||||
atomic_add_64(size, ab->b_size * ab->b_datacnt);
|
||||
mutex_exit(lock);
|
||||
}
|
||||
return (cnt);
|
||||
}
|
||||
@ -1182,7 +1178,6 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *ab, kmutex_t *hash_lock)
|
||||
|
||||
get_buf_info(ab, old_state, &list, &lock);
|
||||
use_mutex = !MUTEX_HELD(lock);
|
||||
|
||||
if (use_mutex)
|
||||
mutex_enter(lock);
|
||||
|
||||
@ -1205,13 +1200,11 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *ab, kmutex_t *hash_lock)
|
||||
mutex_exit(lock);
|
||||
}
|
||||
if (new_state != arc_anon) {
|
||||
int use_mutex;
|
||||
int use_mutex;
|
||||
uint64_t *size = &new_state->arcs_lsize[ab->b_type];
|
||||
|
||||
get_buf_info(ab, new_state, &list, &lock);
|
||||
use_mutex = !MUTEX_HELD(lock);
|
||||
|
||||
|
||||
if (use_mutex)
|
||||
mutex_enter(lock);
|
||||
|
||||
@ -1629,7 +1622,7 @@ arc_evict(arc_state_t *state, spa_t *spa, int64_t bytes, boolean_t recycle,
|
||||
ASSERT(state == arc_mru || state == arc_mfu);
|
||||
|
||||
evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost;
|
||||
|
||||
|
||||
if (type == ARC_BUFC_METADATA) {
|
||||
offset = 0;
|
||||
list_count = ARC_BUFC_NUMMETADATALISTS;
|
||||
@ -1638,7 +1631,6 @@ arc_evict(arc_state_t *state, spa_t *spa, int64_t bytes, boolean_t recycle,
|
||||
idx = evict_metadata_offset;
|
||||
} else {
|
||||
offset = ARC_BUFC_NUMMETADATALISTS;
|
||||
|
||||
list_start = &state->arcs_lists[offset];
|
||||
evicted_list_start = &evicted_state->arcs_lists[offset];
|
||||
list_count = ARC_BUFC_NUMDATALISTS;
|
||||
@ -1646,12 +1638,12 @@ arc_evict(arc_state_t *state, spa_t *spa, int64_t bytes, boolean_t recycle,
|
||||
}
|
||||
bytes_remaining = evicted_state->arcs_lsize[type];
|
||||
count = 0;
|
||||
|
||||
|
||||
evict_start:
|
||||
list = &list_start[idx];
|
||||
evicted_list = &evicted_list_start[idx];
|
||||
lock = ARCS_LOCK(state, (offset + idx));
|
||||
evicted_lock = ARCS_LOCK(evicted_state, (offset + idx));
|
||||
evicted_lock = ARCS_LOCK(evicted_state, (offset + idx));
|
||||
|
||||
mutex_enter(lock);
|
||||
mutex_enter(evicted_lock);
|
||||
@ -1721,7 +1713,7 @@ arc_evict(arc_state_t *state, spa_t *spa, int64_t bytes, boolean_t recycle,
|
||||
if (bytes_remaining > 0) {
|
||||
mutex_exit(evicted_lock);
|
||||
mutex_exit(lock);
|
||||
idx = ((idx + 1)&(list_count-1));
|
||||
idx = ((idx + 1) & (list_count - 1));
|
||||
count++;
|
||||
goto evict_start;
|
||||
}
|
||||
@ -1732,8 +1724,8 @@ arc_evict(arc_state_t *state, spa_t *spa, int64_t bytes, boolean_t recycle,
|
||||
|
||||
mutex_exit(evicted_lock);
|
||||
mutex_exit(lock);
|
||||
|
||||
idx = ((idx + 1)&(list_count-1));
|
||||
|
||||
idx = ((idx + 1) & (list_count - 1));
|
||||
count++;
|
||||
|
||||
if (bytes_evicted < bytes) {
|
||||
@ -1743,11 +1735,11 @@ arc_evict(arc_state_t *state, spa_t *spa, int64_t bytes, boolean_t recycle,
|
||||
dprintf("only evicted %lld bytes from %x",
|
||||
(longlong_t)bytes_evicted, state);
|
||||
}
|
||||
if (type == ARC_BUFC_METADATA)
|
||||
if (type == ARC_BUFC_METADATA)
|
||||
evict_metadata_offset = idx;
|
||||
else
|
||||
evict_data_offset = idx;
|
||||
|
||||
|
||||
if (skipped)
|
||||
ARCSTAT_INCR(arcstat_evict_skip, skipped);
|
||||
|
||||
@ -1804,7 +1796,7 @@ arc_evict_ghost(arc_state_t *state, spa_t *spa, int64_t bytes)
|
||||
list_start = &state->arcs_lists[ARC_BUFC_NUMMETADATALISTS];
|
||||
list_count = ARC_BUFC_NUMDATALISTS;
|
||||
offset = ARC_BUFC_NUMMETADATALISTS;
|
||||
|
||||
|
||||
evict_start:
|
||||
list = &list_start[idx];
|
||||
lock = ARCS_LOCK(state, idx + offset);
|
||||
@ -1851,12 +1843,12 @@ arc_evict_ghost(arc_state_t *state, spa_t *spa, int64_t bytes)
|
||||
}
|
||||
}
|
||||
mutex_exit(lock);
|
||||
idx = ((idx + 1)&(ARC_BUFC_NUMDATALISTS-1));
|
||||
idx = ((idx + 1) & (ARC_BUFC_NUMDATALISTS - 1));
|
||||
count++;
|
||||
|
||||
|
||||
if (count < list_count)
|
||||
goto evict_start;
|
||||
|
||||
|
||||
evict_offset = idx;
|
||||
if ((uintptr_t)list > (uintptr_t)&state->arcs_lists[ARC_BUFC_NUMMETADATALISTS] &&
|
||||
(bytes < 0 || bytes_deleted < bytes)) {
|
||||
@ -1945,7 +1937,7 @@ arc_do_user_evicts(void)
|
||||
/*
|
||||
* Move list over to avoid LOR
|
||||
*/
|
||||
restart:
|
||||
restart:
|
||||
mutex_enter(&arc_eviction_mtx);
|
||||
tmp_arc_eviction_list = arc_eviction_list;
|
||||
arc_eviction_list = NULL;
|
||||
@ -2056,7 +2048,7 @@ arc_reclaim_needed(void)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* If pages are needed or we're within 2048 pages
|
||||
* If pages are needed or we're within 2048 pages
|
||||
* of needing to page need to reclaim
|
||||
*/
|
||||
if (vm_pages_needed || (vm_paging_target() > -2048))
|
||||
@ -2614,10 +2606,7 @@ arc_read_done(zio_t *zio)
|
||||
hdr->b_flags &= ~ARC_L2_EVICTED;
|
||||
if (l2arc_noprefetch && (hdr->b_flags & ARC_PREFETCH))
|
||||
hdr->b_flags &= ~ARC_L2CACHE;
|
||||
#if 0
|
||||
else if ((hdr->b_flags & ARC_PREFETCH) == 0)
|
||||
hdr->b_flags |= ARC_L2CACHE;
|
||||
#endif
|
||||
|
||||
/* byteswap if necessary */
|
||||
callback_list = hdr->b_acb;
|
||||
ASSERT(callback_list != NULL);
|
||||
@ -2731,7 +2720,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *pbuf,
|
||||
uint32_t *arc_flags, const zbookmark_t *zb)
|
||||
{
|
||||
int err;
|
||||
arc_buf_hdr_t *hdr = pbuf->b_hdr;
|
||||
|
||||
ASSERT(!refcount_is_zero(&pbuf->b_hdr->b_refcnt));
|
||||
ASSERT3U((char *)bp - (char *)pbuf->b_data, <, pbuf->b_hdr->b_size);
|
||||
@ -2739,8 +2727,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *pbuf,
|
||||
|
||||
err = arc_read_nolock(pio, spa, bp, done, private, priority,
|
||||
zio_flags, arc_flags, zb);
|
||||
|
||||
ASSERT3P(hdr, ==, pbuf->b_hdr);
|
||||
rw_exit(&pbuf->b_lock);
|
||||
return (err);
|
||||
}
|
||||
@ -2957,7 +2943,7 @@ arc_read_nolock(zio_t *pio, spa_t *spa, blkptr_t *bp,
|
||||
* released by l2arc_read_done().
|
||||
*/
|
||||
rzio = zio_read_phys(pio, vd, addr, size,
|
||||
buf->b_data, ZIO_CHECKSUM_OFF,
|
||||
buf->b_data, ZIO_CHECKSUM_OFF,
|
||||
l2arc_read_done, cb, priority, zio_flags |
|
||||
ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL |
|
||||
ZIO_FLAG_DONT_PROPAGATE |
|
||||
@ -3054,7 +3040,7 @@ arc_buf_evict(arc_buf_t *buf)
|
||||
arc_buf_t **bufp;
|
||||
list_t *list, *evicted_list;
|
||||
kmutex_t *lock, *evicted_lock;
|
||||
|
||||
|
||||
rw_enter(&buf->b_lock, RW_WRITER);
|
||||
hdr = buf->b_hdr;
|
||||
if (hdr == NULL) {
|
||||
@ -3729,7 +3715,6 @@ arc_init(void)
|
||||
arc_size = 0;
|
||||
|
||||
for (i = 0; i < ARC_BUFC_NUMLISTS; i++) {
|
||||
|
||||
mutex_init(&arc_anon->arcs_locks[i].arcs_lock,
|
||||
NULL, MUTEX_DEFAULT, NULL);
|
||||
mutex_init(&arc_mru->arcs_locks[i].arcs_lock,
|
||||
@ -3742,7 +3727,7 @@ arc_init(void)
|
||||
NULL, MUTEX_DEFAULT, NULL);
|
||||
mutex_init(&arc_l2c_only->arcs_locks[i].arcs_lock,
|
||||
NULL, MUTEX_DEFAULT, NULL);
|
||||
|
||||
|
||||
list_create(&arc_mru->arcs_lists[i],
|
||||
sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node));
|
||||
list_create(&arc_mru_ghost->arcs_lists[i],
|
||||
@ -3792,7 +3777,7 @@ arc_init(void)
|
||||
#ifdef _KERNEL
|
||||
if (TUNABLE_INT_FETCH("vfs.zfs.prefetch_disable", &zfs_prefetch_disable))
|
||||
prefetch_tunable_set = 1;
|
||||
|
||||
|
||||
#ifdef __i386__
|
||||
if (prefetch_tunable_set == 0) {
|
||||
printf("ZFS NOTICE: Prefetch is disabled by default on i386 "
|
||||
@ -3801,7 +3786,7 @@ arc_init(void)
|
||||
"to /boot/loader.conf.\n");
|
||||
zfs_prefetch_disable=1;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if ((((uint64_t)physmem * PAGESIZE) < (1ULL << 32)) &&
|
||||
prefetch_tunable_set == 0) {
|
||||
printf("ZFS NOTICE: Prefetch is disabled by default if less "
|
||||
@ -3810,7 +3795,7 @@ arc_init(void)
|
||||
"to /boot/loader.conf.\n");
|
||||
zfs_prefetch_disable=1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/* Warn about ZFS memory and address space requirements. */
|
||||
if (((uint64_t)physmem * PAGESIZE) < (256 + 128 + 64) * (1 << 20)) {
|
||||
printf("ZFS WARNING: Recommended minimum RAM size is 512MB; "
|
||||
@ -3830,7 +3815,7 @@ void
|
||||
arc_fini(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
mutex_enter(&arc_reclaim_thr_lock);
|
||||
arc_thread_exit = 1;
|
||||
cv_signal(&arc_reclaim_thr_cv);
|
||||
@ -3856,14 +3841,16 @@ arc_fini(void)
|
||||
list_destroy(&arc_mru_ghost->arcs_lists[i]);
|
||||
list_destroy(&arc_mfu->arcs_lists[i]);
|
||||
list_destroy(&arc_mfu_ghost->arcs_lists[i]);
|
||||
list_destroy(&arc_l2c_only->arcs_lists[i]);
|
||||
|
||||
mutex_destroy(&arc_anon->arcs_locks[i].arcs_lock);
|
||||
mutex_destroy(&arc_mru->arcs_locks[i].arcs_lock);
|
||||
mutex_destroy(&arc_mru_ghost->arcs_locks[i].arcs_lock);
|
||||
mutex_destroy(&arc_mfu->arcs_locks[i].arcs_lock);
|
||||
mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock);
|
||||
mutex_destroy(&arc_l2c_only->arcs_locks[i].arcs_lock);
|
||||
}
|
||||
|
||||
|
||||
mutex_destroy(&zfs_write_limit_lock);
|
||||
|
||||
buf_fini();
|
||||
@ -4259,18 +4246,18 @@ l2arc_list_locked(int list_num, kmutex_t **lock)
|
||||
{
|
||||
list_t *list;
|
||||
int idx;
|
||||
|
||||
ASSERT(list_num >= 0 && list_num < 2*ARC_BUFC_NUMLISTS);
|
||||
|
||||
ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS);
|
||||
|
||||
if (list_num < ARC_BUFC_NUMMETADATALISTS) {
|
||||
idx = list_num;
|
||||
list = &arc_mfu->arcs_lists[idx];
|
||||
*lock = ARCS_LOCK(arc_mfu, idx);
|
||||
} else if (list_num < ARC_BUFC_NUMMETADATALISTS*2) {
|
||||
} else if (list_num < ARC_BUFC_NUMMETADATALISTS * 2) {
|
||||
idx = list_num - ARC_BUFC_NUMMETADATALISTS;
|
||||
list = &arc_mru->arcs_lists[idx];
|
||||
*lock = ARCS_LOCK(arc_mru, idx);
|
||||
} else if (list_num < (ARC_BUFC_NUMMETADATALISTS*2 +
|
||||
} else if (list_num < (ARC_BUFC_NUMMETADATALISTS * 2 +
|
||||
ARC_BUFC_NUMDATALISTS)) {
|
||||
idx = list_num - ARC_BUFC_NUMMETADATALISTS;
|
||||
list = &arc_mfu->arcs_lists[idx];
|
||||
@ -4281,8 +4268,6 @@ l2arc_list_locked(int list_num, kmutex_t **lock)
|
||||
*lock = ARCS_LOCK(arc_mru, idx);
|
||||
}
|
||||
|
||||
CTR3(KTR_SPARE2, "list=%p list_num=%d idx=%d",
|
||||
list, list_num, idx);
|
||||
ASSERT(!(MUTEX_HELD(*lock)));
|
||||
mutex_enter(*lock);
|
||||
return (list);
|
||||
@ -4452,7 +4437,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
|
||||
* Copy buffers for L2ARC writing.
|
||||
*/
|
||||
mutex_enter(&l2arc_buflist_mtx);
|
||||
for (try = 0; try < 2*ARC_BUFC_NUMLISTS; try++) {
|
||||
for (try = 0; try < 2 * ARC_BUFC_NUMLISTS; try++) {
|
||||
list = l2arc_list_locked(try, &list_lock);
|
||||
passed_sz = 0;
|
||||
ARCSTAT_BUMP(arcstat_l2_write_buffer_list_iter);
|
||||
@ -4468,9 +4453,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
|
||||
ab = list_head(list);
|
||||
else
|
||||
ab = list_tail(list);
|
||||
if (ab == NULL) {
|
||||
if (ab == NULL)
|
||||
ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter);
|
||||
}
|
||||
|
||||
for (; ab; ab = ab_prev) {
|
||||
if (arc_warm == B_FALSE)
|
||||
@ -4478,7 +4462,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
|
||||
else
|
||||
ab_prev = list_prev(list, ab);
|
||||
ARCSTAT_INCR(arcstat_l2_write_buffer_bytes_scanned, ab->b_size);
|
||||
|
||||
|
||||
hash_lock = HDR_LOCK(ab);
|
||||
have_lock = MUTEX_HELD(hash_lock);
|
||||
if (!have_lock && !mutex_tryenter(hash_lock)) {
|
||||
@ -4562,6 +4546,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
|
||||
hdrl2->b_dev = dev;
|
||||
hdrl2->b_daddr = dev->l2ad_hand;
|
||||
|
||||
ab->b_flags |= ARC_L2_WRITING;
|
||||
ab->b_l2hdr = hdrl2;
|
||||
list_insert_head(dev->l2ad_buflist, ab);
|
||||
buf_data = ab->b_buf->b_data;
|
||||
|
@ -464,15 +464,15 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags)
|
||||
ASSERT(db->db_buf == NULL);
|
||||
|
||||
if (db->db_blkid == DB_BONUS_BLKID) {
|
||||
int bonuslen = dn->dn_bonuslen;
|
||||
int bonuslen = MIN(dn->dn_bonuslen, dn->dn_phys->dn_bonuslen);
|
||||
|
||||
ASSERT3U(bonuslen, <=, db->db.db_size);
|
||||
db->db.db_data = zio_buf_alloc(DN_MAX_BONUSLEN);
|
||||
arc_space_consume(DN_MAX_BONUSLEN);
|
||||
if (bonuslen < DN_MAX_BONUSLEN)
|
||||
bzero(db->db.db_data, DN_MAX_BONUSLEN);
|
||||
bcopy(DN_BONUS(dn->dn_phys), db->db.db_data,
|
||||
bonuslen);
|
||||
if (bonuslen)
|
||||
bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, bonuslen);
|
||||
dbuf_update_data(db);
|
||||
db->db_state = DB_CACHED;
|
||||
mutex_exit(&db->db_mtx);
|
||||
|
@ -128,15 +128,6 @@ dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot,
|
||||
return (0);
|
||||
}
|
||||
|
||||
tx = dmu_tx_create(os);
|
||||
dmu_tx_hold_bonus(tx, object);
|
||||
err = dmu_tx_assign(tx, TXG_WAIT);
|
||||
if (err) {
|
||||
dmu_tx_abort(tx);
|
||||
dnode_rele(dn, FTAG);
|
||||
return (err);
|
||||
}
|
||||
|
||||
nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT);
|
||||
|
||||
/*
|
||||
@ -144,16 +135,27 @@ dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot,
|
||||
* be a new file instance. We must clear out the previous file
|
||||
* contents before we can change this type of metadata in the dnode.
|
||||
*/
|
||||
if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize)
|
||||
dmu_free_long_range(os, object, 0, DMU_OBJECT_END);
|
||||
if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize) {
|
||||
err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
||||
tx = dmu_tx_create(os);
|
||||
dmu_tx_hold_bonus(tx, object);
|
||||
err = dmu_tx_assign(tx, TXG_WAIT);
|
||||
if (err) {
|
||||
dmu_tx_abort(tx);
|
||||
goto out;
|
||||
}
|
||||
|
||||
dnode_reallocate(dn, ot, blocksize, bonustype, bonuslen, tx);
|
||||
|
||||
dmu_tx_commit(tx);
|
||||
|
||||
out:
|
||||
dnode_rele(dn, FTAG);
|
||||
|
||||
return (0);
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1213,6 +1213,39 @@ dmu_objset_find_spa(spa_t *spa, const char *name,
|
||||
return (err);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
dmu_objset_prefetch(char *name, void *arg)
|
||||
{
|
||||
dsl_dataset_t *ds;
|
||||
|
||||
if (dsl_dataset_hold(name, FTAG, &ds))
|
||||
return (0);
|
||||
|
||||
if (!BP_IS_HOLE(&ds->ds_phys->ds_bp)) {
|
||||
mutex_enter(&ds->ds_opening_lock);
|
||||
if (!dsl_dataset_get_user_ptr(ds)) {
|
||||
uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH;
|
||||
zbookmark_t zb;
|
||||
|
||||
zb.zb_objset = ds->ds_object;
|
||||
zb.zb_object = 0;
|
||||
zb.zb_level = -1;
|
||||
zb.zb_blkid = 0;
|
||||
|
||||
(void) arc_read_nolock(NULL, dsl_dataset_get_spa(ds),
|
||||
&ds->ds_phys->ds_bp, NULL, NULL,
|
||||
ZIO_PRIORITY_ASYNC_READ,
|
||||
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE,
|
||||
&aflags, &zb);
|
||||
}
|
||||
mutex_exit(&ds->ds_opening_lock);
|
||||
}
|
||||
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
dmu_objset_set_user(objset_t *os, void *user_ptr)
|
||||
{
|
||||
|
@ -300,6 +300,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
|
||||
tx = dmu_tx_create_assigned(dp, txg);
|
||||
|
||||
dp->dp_read_overhead = 0;
|
||||
start = gethrtime();
|
||||
zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
|
||||
while (ds = txg_list_remove(&dp->dp_dirty_datasets, txg)) {
|
||||
if (!list_link_active(&ds->ds_synced_link))
|
||||
@ -310,7 +311,6 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
|
||||
}
|
||||
DTRACE_PROBE(pool_sync__1setup);
|
||||
|
||||
start = gethrtime();
|
||||
err = zio_wait(zio);
|
||||
write_time = gethrtime() - start;
|
||||
ASSERT(err == 0);
|
||||
|
@ -2564,11 +2564,12 @@ spa_tryimport(nvlist_t *tryconfig)
|
||||
* The act of destroying or exporting a pool is very simple. We make sure there
|
||||
* is no more pending I/O and any references to the pool are gone. Then, we
|
||||
* update the pool state and sync all the labels to disk, removing the
|
||||
* configuration from the cache afterwards.
|
||||
* configuration from the cache afterwards. If the 'hardforce' flag is set, then
|
||||
* we don't sync the labels or remove the configuration cache.
|
||||
*/
|
||||
static int
|
||||
spa_export_common(char *pool, int new_state, nvlist_t **oldconfig,
|
||||
boolean_t force)
|
||||
boolean_t force, boolean_t hardforce)
|
||||
{
|
||||
spa_t *spa;
|
||||
|
||||
@ -2636,7 +2637,7 @@ spa_export_common(char *pool, int new_state, nvlist_t **oldconfig,
|
||||
* so mark them all dirty. spa_unload() will do the
|
||||
* final sync that pushes these changes out.
|
||||
*/
|
||||
if (new_state != POOL_STATE_UNINITIALIZED) {
|
||||
if (new_state != POOL_STATE_UNINITIALIZED && !hardforce) {
|
||||
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
|
||||
spa->spa_state = new_state;
|
||||
spa->spa_final_txg = spa_last_synced_txg(spa) + 1;
|
||||
@ -2656,7 +2657,8 @@ spa_export_common(char *pool, int new_state, nvlist_t **oldconfig,
|
||||
VERIFY(nvlist_dup(spa->spa_config, oldconfig, 0) == 0);
|
||||
|
||||
if (new_state != POOL_STATE_UNINITIALIZED) {
|
||||
spa_config_sync(spa, B_TRUE, B_TRUE);
|
||||
if (!hardforce)
|
||||
spa_config_sync(spa, B_TRUE, B_TRUE);
|
||||
spa_remove(spa);
|
||||
}
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
@ -2670,16 +2672,19 @@ spa_export_common(char *pool, int new_state, nvlist_t **oldconfig,
|
||||
int
|
||||
spa_destroy(char *pool)
|
||||
{
|
||||
return (spa_export_common(pool, POOL_STATE_DESTROYED, NULL, B_FALSE));
|
||||
return (spa_export_common(pool, POOL_STATE_DESTROYED, NULL,
|
||||
B_FALSE, B_FALSE));
|
||||
}
|
||||
|
||||
/*
|
||||
* Export a storage pool.
|
||||
*/
|
||||
int
|
||||
spa_export(char *pool, nvlist_t **oldconfig, boolean_t force)
|
||||
spa_export(char *pool, nvlist_t **oldconfig, boolean_t force,
|
||||
boolean_t hardforce)
|
||||
{
|
||||
return (spa_export_common(pool, POOL_STATE_EXPORTED, oldconfig, force));
|
||||
return (spa_export_common(pool, POOL_STATE_EXPORTED, oldconfig,
|
||||
force, hardforce));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2690,7 +2695,7 @@ int
|
||||
spa_reset(char *pool)
|
||||
{
|
||||
return (spa_export_common(pool, POOL_STATE_UNINITIALIZED, NULL,
|
||||
B_FALSE));
|
||||
B_FALSE, B_FALSE));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -55,8 +55,8 @@ struct arc_buf {
|
||||
};
|
||||
|
||||
typedef enum arc_buf_contents {
|
||||
ARC_BUFC_METADATA, /* buffer contains metadata */
|
||||
ARC_BUFC_DATA, /* buffer contains data */
|
||||
ARC_BUFC_METADATA, /* buffer contains metadata */
|
||||
ARC_BUFC_NUMTYPES
|
||||
} arc_buf_contents_t;
|
||||
/*
|
||||
|
@ -26,8 +26,6 @@
|
||||
#ifndef _SYS_DMU_OBJSET_H
|
||||
#define _SYS_DMU_OBJSET_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <sys/spa.h>
|
||||
#include <sys/arc.h>
|
||||
#include <sys/txg.h>
|
||||
@ -118,6 +116,7 @@ int dmu_objset_find(char *name, int func(char *, void *), void *arg,
|
||||
int flags);
|
||||
int dmu_objset_find_spa(spa_t *spa, const char *name,
|
||||
int func(spa_t *, uint64_t, const char *, void *), void *arg, int flags);
|
||||
int dmu_objset_prefetch(char *name, void *arg);
|
||||
void dmu_objset_byteswap(void *buf, size_t size);
|
||||
int dmu_objset_evict_dbufs(objset_t *os);
|
||||
|
||||
|
@ -333,7 +333,8 @@ extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props);
|
||||
extern int spa_import_faulted(const char *, nvlist_t *, nvlist_t *);
|
||||
extern nvlist_t *spa_tryimport(nvlist_t *tryconfig);
|
||||
extern int spa_destroy(char *pool);
|
||||
extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force);
|
||||
extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force,
|
||||
boolean_t hardforce);
|
||||
extern int spa_reset(char *pool);
|
||||
extern void spa_async_request(spa_t *spa, int flag);
|
||||
extern void spa_async_unrequest(spa_t *spa, int flag);
|
||||
|
@ -38,15 +38,22 @@ static void txg_quiesce_thread(void *arg);
|
||||
|
||||
int zfs_txg_timeout = 30; /* max seconds worth of delta per txg */
|
||||
extern int zfs_txg_synctime;
|
||||
extern uint64_t zfs_write_limit_override;
|
||||
|
||||
SYSCTL_DECL(_vfs_zfs);
|
||||
SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0, "ZFS TXG");
|
||||
SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0,
|
||||
"ZFS transaction groups (TXG)");
|
||||
TUNABLE_INT("vfs.zfs.txg.timeout", &zfs_txg_timeout);
|
||||
SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RDTUN, &zfs_txg_timeout, 0,
|
||||
"Maximum seconds worth of delta per txg");
|
||||
TUNABLE_INT("vfs.zfs.txg.synctime", &zfs_txg_synctime);
|
||||
SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, synctime, CTLFLAG_RDTUN, &zfs_txg_synctime,
|
||||
0, "Target seconds to sync a txg");
|
||||
TUNABLE_QUAD("vfs.zfs.txg.write_limit_override", &zfs_write_limit_override);
|
||||
SYSCTL_QUAD(_vfs_zfs_txg, OID_AUTO, write_limit_override, CTLFLAG_RW,
|
||||
&zfs_write_limit_override, 0,
|
||||
"Override maximum size of a txg to this size in bytes, "
|
||||
"value of 0 means don't override");
|
||||
|
||||
/*
|
||||
* Prepare the txg subsystem.
|
||||
|
@ -2235,11 +2235,24 @@ zfs_zaccess_common(znode_t *zp, uint32_t v4_mode, uint32_t *working_mode,
|
||||
return (EPERM);
|
||||
}
|
||||
|
||||
#ifdef sun
|
||||
if ((v4_mode & (ACE_DELETE | ACE_DELETE_CHILD)) &&
|
||||
(zp->z_phys->zp_flags & ZFS_NOUNLINK)) {
|
||||
*check_privs = B_FALSE;
|
||||
return (EPERM);
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* In FreeBSD we allow to modify directory's content is ZFS_NOUNLINK
|
||||
* (sunlnk) is set. We just don't allow directory removal, which is
|
||||
* handled in zfs_zaccess_delete().
|
||||
*/
|
||||
if ((v4_mode & ACE_DELETE) &&
|
||||
(zp->z_phys->zp_flags & ZFS_NOUNLINK)) {
|
||||
*check_privs = B_FALSE;
|
||||
return (EPERM);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (((v4_mode & (ACE_READ_DATA|ACE_EXECUTE)) &&
|
||||
(zp->z_phys->zp_flags & ZFS_AV_QUARANTINED))) {
|
||||
|
@ -19,12 +19,10 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <sys/fs/zfs.h>
|
||||
@ -50,7 +48,6 @@ zfs_oldace_byteswap(ace_t *ace, int ace_cnt)
|
||||
void
|
||||
zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout)
|
||||
{
|
||||
#ifdef TODO
|
||||
caddr_t end;
|
||||
caddr_t ptr;
|
||||
zfs_ace_t *zacep;
|
||||
@ -64,6 +61,20 @@ zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout)
|
||||
|
||||
while (ptr < end) {
|
||||
if (zfs_layout) {
|
||||
/*
|
||||
* Avoid overrun. Embedded aces can have one
|
||||
* of several sizes. We don't know exactly
|
||||
* how many our present, only the size of the
|
||||
* buffer containing them. That size may be
|
||||
* larger than needed to hold the aces
|
||||
* present. As long as we do not do any
|
||||
* swapping beyond the end of our block we are
|
||||
* okay. It it safe to swap any non-ace data
|
||||
* within the block since it is just zeros.
|
||||
*/
|
||||
if (ptr + sizeof (zfs_ace_hdr_t) > end) {
|
||||
break;
|
||||
}
|
||||
zacep = (zfs_ace_t *)ptr;
|
||||
zacep->z_hdr.z_access_mask =
|
||||
BSWAP_32(zacep->z_hdr.z_access_mask);
|
||||
@ -72,6 +83,10 @@ zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout)
|
||||
BSWAP_16(zacep->z_hdr.z_type);
|
||||
entry_type = zacep->z_hdr.z_flags & ACE_TYPE_FLAGS;
|
||||
} else {
|
||||
/* Overrun avoidance */
|
||||
if (ptr + sizeof (ace_t) > end) {
|
||||
break;
|
||||
}
|
||||
acep = (ace_t *)ptr;
|
||||
acep->a_access_mask = BSWAP_32(acep->a_access_mask);
|
||||
acep->a_flags = BSWAP_16(acep->a_flags);
|
||||
@ -88,8 +103,14 @@ zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout)
|
||||
break;
|
||||
case ACE_IDENTIFIER_GROUP:
|
||||
default:
|
||||
/* Overrun avoidance */
|
||||
if (zfs_layout) {
|
||||
zacep->z_fuid = BSWAP_64(zacep->z_fuid);
|
||||
if (ptr + sizeof (zfs_ace_t) <= end) {
|
||||
zacep->z_fuid = BSWAP_64(zacep->z_fuid);
|
||||
} else {
|
||||
entry_size = sizeof (zfs_ace_t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (ace_type) {
|
||||
case ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE:
|
||||
@ -108,9 +129,6 @@ zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout)
|
||||
}
|
||||
ptr = ptr + entry_size;
|
||||
}
|
||||
#else /* TODO */
|
||||
panic("%s:%u: TODO", __func__, __LINE__);
|
||||
#endif /* TODO */
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
@ -173,7 +191,8 @@ zfs_znode_byteswap(void *buf, size_t size)
|
||||
if (zp->zp_acl.z_acl_version == ZFS_ACL_VERSION) {
|
||||
zfs_acl_byteswap((void *)&zp->zp_acl.z_ace_data[0],
|
||||
ZFS_ACE_SPACE);
|
||||
} else
|
||||
} else {
|
||||
zfs_oldace_byteswap((ace_t *)&zp->zp_acl.z_ace_data[0],
|
||||
ACE_SLOT_CNT);
|
||||
}
|
||||
}
|
||||
|
@ -882,9 +882,10 @@ zfs_ioc_pool_export(zfs_cmd_t *zc)
|
||||
{
|
||||
int error;
|
||||
boolean_t force = (boolean_t)zc->zc_cookie;
|
||||
boolean_t hardforce = (boolean_t)zc->zc_guid;
|
||||
|
||||
zfs_log_history(zc);
|
||||
error = spa_export(zc->zc_name, NULL, force);
|
||||
error = spa_export(zc->zc_name, NULL, force, hardforce);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1349,6 +1350,14 @@ zfs_ioc_dataset_list_next(zfs_cmd_t *zc)
|
||||
(void) strlcat(zc->zc_name, "/", sizeof (zc->zc_name));
|
||||
p = zc->zc_name + strlen(zc->zc_name);
|
||||
|
||||
if (zc->zc_cookie == 0) {
|
||||
uint64_t cookie = 0;
|
||||
int len = sizeof (zc->zc_name) - (p - zc->zc_name);
|
||||
|
||||
while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0)
|
||||
dmu_objset_prefetch(p, NULL);
|
||||
}
|
||||
|
||||
do {
|
||||
error = dmu_dir_list_next(os,
|
||||
sizeof (zc->zc_name) - (p - zc->zc_name), p,
|
||||
@ -1387,6 +1396,9 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc)
|
||||
objset_t *os;
|
||||
int error;
|
||||
|
||||
if (zc->zc_cookie == 0)
|
||||
dmu_objset_find(zc->zc_name, dmu_objset_prefetch,
|
||||
NULL, DS_FIND_SNAPSHOTS);
|
||||
error = dmu_objset_open(zc->zc_name,
|
||||
DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os);
|
||||
if (error)
|
||||
|
@ -868,13 +868,15 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp)
|
||||
ZFS_ENTER_NOERROR(zfsvfs);
|
||||
|
||||
error = zfs_zget(zfsvfs, zfsvfs->z_root, &rootzp);
|
||||
|
||||
ZFS_EXIT(zfsvfs);
|
||||
|
||||
if (error == 0) {
|
||||
*vpp = ZTOV(rootzp);
|
||||
error = vn_lock(*vpp, flags);
|
||||
(*vpp)->v_vflag |= VV_ROOT;
|
||||
}
|
||||
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1143,13 +1145,13 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp)
|
||||
VN_RELE(ZTOV(zp));
|
||||
err = EINVAL;
|
||||
}
|
||||
ZFS_EXIT(zfsvfs);
|
||||
if (err != 0)
|
||||
*vpp = NULL;
|
||||
else {
|
||||
*vpp = ZTOV(zp);
|
||||
vn_lock(*vpp, flags);
|
||||
}
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (err);
|
||||
}
|
||||
|
||||
@ -1237,8 +1239,8 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp)
|
||||
} else {
|
||||
VN_HOLD(*vpp);
|
||||
}
|
||||
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
|
||||
ZFS_EXIT(zfsvfs);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1259,10 +1261,11 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
ZFS_EXIT(zfsvfs);
|
||||
|
||||
*vpp = ZTOV(zp);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
|
||||
vnode_create_vobject(*vpp, zp->z_phys->zp_size, curthread);
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -1209,15 +1209,17 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
|
||||
ltype = VOP_ISLOCKED(dvp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
}
|
||||
ZFS_EXIT(zfsvfs);
|
||||
error = vn_lock(*vpp, cnp->cn_lkflags);
|
||||
if (cnp->cn_flags & ISDOTDOT)
|
||||
vn_lock(dvp, ltype | LK_RETRY);
|
||||
if (error != 0) {
|
||||
VN_RELE(*vpp);
|
||||
*vpp = NULL;
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (error);
|
||||
}
|
||||
} else {
|
||||
ZFS_EXIT(zfsvfs);
|
||||
}
|
||||
|
||||
#ifdef FREEBSD_NAMECACHE
|
||||
@ -1237,8 +1239,6 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
|
||||
}
|
||||
#endif
|
||||
|
||||
ZFS_EXIT(zfsvfs);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -3977,6 +3977,9 @@ zfs_freebsd_write(ap)
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
if (vn_rlimit_fsize(ap->a_vp, ap->a_uio, ap->a_uio->uio_td))
|
||||
return (EFBIG);
|
||||
|
||||
return (zfs_write(ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, NULL));
|
||||
}
|
||||
|
||||
|
@ -704,6 +704,8 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
||||
DMU_OT_ZNODE, sizeof (znode_phys_t) + bonuslen, tx);
|
||||
}
|
||||
}
|
||||
|
||||
ZFS_OBJ_HOLD_ENTER(zfsvfs, obj);
|
||||
VERIFY(0 == dmu_bonus_hold(zfsvfs->z_os, obj, NULL, &db));
|
||||
dmu_buf_will_dirty(db, tx);
|
||||
|
||||
@ -765,9 +767,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
||||
|
||||
pzp->zp_mode = MAKEIMODE(vap->va_type, vap->va_mode);
|
||||
if (!(flag & IS_ROOT_NODE)) {
|
||||
ZFS_OBJ_HOLD_ENTER(zfsvfs, obj);
|
||||
*zpp = zfs_znode_alloc(zfsvfs, db, 0);
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj);
|
||||
} else {
|
||||
/*
|
||||
* If we are creating the root node, the "parent" we
|
||||
@ -776,6 +776,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
||||
*zpp = dzp;
|
||||
}
|
||||
zfs_perm_init(*zpp, dzp, flag, vap, tx, cr, setaclp, fuidp);
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj);
|
||||
if (!(flag & IS_ROOT_NODE)) {
|
||||
vnode_t *vp;
|
||||
|
||||
@ -939,19 +940,31 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp)
|
||||
|
||||
/*
|
||||
* Not found create new znode/vnode
|
||||
* but only if file exists.
|
||||
*
|
||||
* There is a small window where zfs_vget() could
|
||||
* find this object while a file create is still in
|
||||
* progress. Since a gen number can never be zero
|
||||
* we will check that to determine if its an allocated
|
||||
* file.
|
||||
*/
|
||||
zp = zfs_znode_alloc(zfsvfs, db, doi.doi_data_block_size);
|
||||
|
||||
vp = ZTOV(zp);
|
||||
vp->v_vflag |= VV_FORCEINSMQ;
|
||||
err = insmntque(vp, zfsvfs->z_vfs);
|
||||
vp->v_vflag &= ~VV_FORCEINSMQ;
|
||||
KASSERT(err == 0, ("insmntque() failed: error %d", err));
|
||||
VOP_UNLOCK(vp, 0);
|
||||
|
||||
if (((znode_phys_t *)db->db_data)->zp_gen != 0) {
|
||||
zp = zfs_znode_alloc(zfsvfs, db, doi.doi_data_block_size);
|
||||
*zpp = zp;
|
||||
vp = ZTOV(zp);
|
||||
vp->v_vflag |= VV_FORCEINSMQ;
|
||||
err = insmntque(vp, zfsvfs->z_vfs);
|
||||
vp->v_vflag &= ~VV_FORCEINSMQ;
|
||||
KASSERT(err == 0, ("insmntque() failed: error %d", err));
|
||||
VOP_UNLOCK(vp, 0);
|
||||
err = 0;
|
||||
} else {
|
||||
dmu_buf_rele(db, NULL);
|
||||
err = ENOENT;
|
||||
}
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
|
||||
*zpp = zp;
|
||||
return (0);
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
@ -1440,6 +1453,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
||||
uint64_t norm = 0;
|
||||
nvpair_t *elem;
|
||||
int error;
|
||||
int i;
|
||||
znode_t *rootzp = NULL;
|
||||
vnode_t vnode;
|
||||
vattr_t vattr;
|
||||
@ -1537,6 +1551,9 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
||||
list_create(&zfsvfs.z_all_znodes, sizeof (znode_t),
|
||||
offsetof(znode_t, z_link_node));
|
||||
|
||||
for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
|
||||
mutex_init(&zfsvfs.z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL);
|
||||
|
||||
ASSERT(!POINTER_IS_VALID(rootzp->z_zfsvfs));
|
||||
rootzp->z_zfsvfs = &zfsvfs;
|
||||
zfs_mknode(rootzp, &vattr, tx, cr, IS_ROOT_NODE, &zp, 0, NULL, NULL);
|
||||
@ -1547,6 +1564,8 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
||||
|
||||
dmu_buf_rele(rootzp->z_dbuf, NULL);
|
||||
rootzp->z_dbuf = NULL;
|
||||
for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
|
||||
mutex_destroy(&zfsvfs.z_hold_mtx[i]);
|
||||
mutex_destroy(&zfsvfs.z_znodes_lock);
|
||||
rootzp->z_vnode = NULL;
|
||||
kmem_cache_free(znode_cache, rootzp);
|
||||
|
@ -1,133 +0,0 @@
|
||||
/*-
|
||||
* Copyright 2007 John Birrell <jb@FreeBSD.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
static void enable(cyb_arg_t);
|
||||
static void disable(cyb_arg_t);
|
||||
static void reprogram(cyb_arg_t, hrtime_t);
|
||||
static void xcall(cyb_arg_t, cpu_t *, cyc_func_t, void *);
|
||||
|
||||
static cyc_backend_t be = {
|
||||
NULL, /* cyb_configure */
|
||||
NULL, /* cyb_unconfigure */
|
||||
enable,
|
||||
disable,
|
||||
reprogram,
|
||||
xcall,
|
||||
NULL /* cyb_arg_t cyb_arg */
|
||||
};
|
||||
|
||||
static void
|
||||
cyclic_ap_start(void *dummy)
|
||||
{
|
||||
/* Initialise the rest of the CPUs. */
|
||||
cyclic_mp_init();
|
||||
}
|
||||
|
||||
SYSINIT(cyclic_ap_start, SI_SUB_SMP, SI_ORDER_ANY, cyclic_ap_start, NULL);
|
||||
|
||||
/*
|
||||
* Machine dependent cyclic subsystem initialisation.
|
||||
*/
|
||||
static void
|
||||
cyclic_machdep_init(void)
|
||||
{
|
||||
/* Register the cyclic backend. */
|
||||
cyclic_init(&be);
|
||||
}
|
||||
|
||||
static void
|
||||
cyclic_machdep_uninit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= mp_maxid; i++)
|
||||
/* Reset the cyclic clock callback hook. */
|
||||
lapic_cyclic_clock_func[i] = NULL;
|
||||
|
||||
/* De-register the cyclic backend. */
|
||||
cyclic_uninit();
|
||||
}
|
||||
|
||||
static hrtime_t exp_due[MAXCPU];
|
||||
|
||||
/*
|
||||
* This function is the one registered by the machine dependent
|
||||
* initialiser as the callback for high speed timer events.
|
||||
*/
|
||||
static void
|
||||
cyclic_clock(struct trapframe *frame)
|
||||
{
|
||||
cpu_t *c = &solaris_cpu[curcpu];
|
||||
|
||||
if (c->cpu_cyclic != NULL && gethrtime() >= exp_due[curcpu]) {
|
||||
if (TRAPF_USERMODE(frame)) {
|
||||
c->cpu_profile_pc = 0;
|
||||
c->cpu_profile_upc = TRAPF_PC(frame);
|
||||
} else {
|
||||
c->cpu_profile_pc = TRAPF_PC(frame);
|
||||
c->cpu_profile_upc = 0;
|
||||
}
|
||||
|
||||
c->cpu_intr_actv = 1;
|
||||
|
||||
/* Fire any timers that are due. */
|
||||
cyclic_fire(c);
|
||||
|
||||
c->cpu_intr_actv = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void enable(cyb_arg_t arg)
|
||||
{
|
||||
/* Register the cyclic clock callback function. */
|
||||
lapic_cyclic_clock_func[curcpu] = cyclic_clock;
|
||||
}
|
||||
|
||||
static void disable(cyb_arg_t arg)
|
||||
{
|
||||
/* Reset the cyclic clock callback function. */
|
||||
lapic_cyclic_clock_func[curcpu] = NULL;
|
||||
}
|
||||
|
||||
static void reprogram(cyb_arg_t arg, hrtime_t exp)
|
||||
{
|
||||
exp_due[curcpu] = exp;
|
||||
}
|
||||
|
||||
static void xcall(cyb_arg_t arg, cpu_t *c, cyc_func_t func, void *param)
|
||||
{
|
||||
/*
|
||||
* If the target CPU is the current one, just call the
|
||||
* function. This covers the non-SMP case.
|
||||
*/
|
||||
if (c == &solaris_cpu[curcpu])
|
||||
(*func)(param);
|
||||
else
|
||||
smp_rendezvous_cpus((cpumask_t) (1 << c->cpuid), NULL,
|
||||
func, smp_no_rendevous_barrier, param);
|
||||
}
|
@ -67,7 +67,7 @@ cyclic_machdep_uninit(void)
|
||||
|
||||
for (i = 0; i <= mp_maxid; i++)
|
||||
/* Reset the cyclic clock callback hook. */
|
||||
lapic_cyclic_clock_func[i] = NULL;
|
||||
cyclic_clock_func[i] = NULL;
|
||||
|
||||
/* De-register the cyclic backend. */
|
||||
cyclic_uninit();
|
||||
@ -105,13 +105,13 @@ cyclic_clock(struct trapframe *frame)
|
||||
static void enable(cyb_arg_t arg)
|
||||
{
|
||||
/* Register the cyclic clock callback function. */
|
||||
lapic_cyclic_clock_func[curcpu] = cyclic_clock;
|
||||
cyclic_clock_func[curcpu] = cyclic_clock;
|
||||
}
|
||||
|
||||
static void disable(cyb_arg_t arg)
|
||||
{
|
||||
/* Reset the cyclic clock callback function. */
|
||||
lapic_cyclic_clock_func[curcpu] = NULL;
|
||||
cyclic_clock_func[curcpu] = NULL;
|
||||
}
|
||||
|
||||
static void reprogram(cyb_arg_t arg, hrtime_t exp)
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <sys/procfs.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#define PTRIN(v) (void *)(uintptr_t) (v)
|
||||
#define PTROUT(v) (u_int32_t)(uintptr_t) (v)
|
||||
@ -229,4 +230,85 @@ struct mq_attr32 {
|
||||
int __reserved[4];
|
||||
};
|
||||
|
||||
struct kinfo_proc32 {
|
||||
int ki_structsize;
|
||||
int ki_layout;
|
||||
uint32_t ki_args;
|
||||
uint32_t ki_paddr;
|
||||
uint32_t ki_addr;
|
||||
uint32_t ki_tracep;
|
||||
uint32_t ki_textvp;
|
||||
uint32_t ki_fd;
|
||||
uint32_t ki_vmspace;
|
||||
uint32_t ki_wchan;
|
||||
pid_t ki_pid;
|
||||
pid_t ki_ppid;
|
||||
pid_t ki_pgid;
|
||||
pid_t ki_tpgid;
|
||||
pid_t ki_sid;
|
||||
pid_t ki_tsid;
|
||||
short ki_jobc;
|
||||
short ki_spare_short1;
|
||||
dev_t ki_tdev;
|
||||
sigset_t ki_siglist;
|
||||
sigset_t ki_sigmask;
|
||||
sigset_t ki_sigignore;
|
||||
sigset_t ki_sigcatch;
|
||||
uid_t ki_uid;
|
||||
uid_t ki_ruid;
|
||||
uid_t ki_svuid;
|
||||
gid_t ki_rgid;
|
||||
gid_t ki_svgid;
|
||||
short ki_ngroups;
|
||||
short ki_spare_short2;
|
||||
gid_t ki_groups[KI_NGROUPS];
|
||||
uint32_t ki_size;
|
||||
int32_t ki_rssize;
|
||||
int32_t ki_swrss;
|
||||
int32_t ki_tsize;
|
||||
int32_t ki_dsize;
|
||||
int32_t ki_ssize;
|
||||
u_short ki_xstat;
|
||||
u_short ki_acflag;
|
||||
fixpt_t ki_pctcpu;
|
||||
u_int ki_estcpu;
|
||||
u_int ki_slptime;
|
||||
u_int ki_swtime;
|
||||
int ki_spareint1;
|
||||
u_int64_t ki_runtime;
|
||||
struct timeval32 ki_start;
|
||||
struct timeval32 ki_childtime;
|
||||
int ki_flag;
|
||||
int ki_kiflag;
|
||||
int ki_traceflag;
|
||||
char ki_stat;
|
||||
signed char ki_nice;
|
||||
char ki_lock;
|
||||
char ki_rqindex;
|
||||
u_char ki_oncpu;
|
||||
u_char ki_lastcpu;
|
||||
char ki_ocomm[OCOMMLEN+1];
|
||||
char ki_wmesg[WMESGLEN+1];
|
||||
char ki_login[LOGNAMELEN+1];
|
||||
char ki_lockname[LOCKNAMELEN+1];
|
||||
char ki_comm[COMMLEN+1];
|
||||
char ki_emul[KI_EMULNAMELEN+1];
|
||||
char ki_sparestrings[68];
|
||||
int ki_spareints[KI_NSPARE_INT];
|
||||
u_int ki_cr_flags;
|
||||
int ki_jid;
|
||||
int ki_numthreads;
|
||||
lwpid_t ki_tid;
|
||||
struct priority ki_pri;
|
||||
struct rusage32 ki_rusage;
|
||||
struct rusage32 ki_rusage_ch;
|
||||
uint32_t ki_pcb;
|
||||
uint32_t ki_kstack;
|
||||
uint32_t ki_udata;
|
||||
uint32_t ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
|
||||
int ki_sparelongs[KI_NSPARE_LONG];
|
||||
int ki_sflag;
|
||||
int ki_tdflags;
|
||||
};
|
||||
|
||||
#endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */
|
||||
|
@ -129,6 +129,28 @@ static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count);
|
||||
#define RETVAL_LO 0
|
||||
#endif
|
||||
|
||||
void
|
||||
freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32)
|
||||
{
|
||||
|
||||
TV_CP(*s, *s32, ru_utime);
|
||||
TV_CP(*s, *s32, ru_stime);
|
||||
CP(*s, *s32, ru_maxrss);
|
||||
CP(*s, *s32, ru_ixrss);
|
||||
CP(*s, *s32, ru_idrss);
|
||||
CP(*s, *s32, ru_isrss);
|
||||
CP(*s, *s32, ru_minflt);
|
||||
CP(*s, *s32, ru_majflt);
|
||||
CP(*s, *s32, ru_nswap);
|
||||
CP(*s, *s32, ru_inblock);
|
||||
CP(*s, *s32, ru_oublock);
|
||||
CP(*s, *s32, ru_msgsnd);
|
||||
CP(*s, *s32, ru_msgrcv);
|
||||
CP(*s, *s32, ru_nsignals);
|
||||
CP(*s, *s32, ru_nvcsw);
|
||||
CP(*s, *s32, ru_nivcsw);
|
||||
}
|
||||
|
||||
int
|
||||
freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
|
||||
{
|
||||
@ -146,22 +168,7 @@ freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
|
||||
if (uap->status != NULL)
|
||||
error = copyout(&status, uap->status, sizeof(status));
|
||||
if (uap->rusage != NULL && error == 0) {
|
||||
TV_CP(ru, ru32, ru_utime);
|
||||
TV_CP(ru, ru32, ru_stime);
|
||||
CP(ru, ru32, ru_maxrss);
|
||||
CP(ru, ru32, ru_ixrss);
|
||||
CP(ru, ru32, ru_idrss);
|
||||
CP(ru, ru32, ru_isrss);
|
||||
CP(ru, ru32, ru_minflt);
|
||||
CP(ru, ru32, ru_majflt);
|
||||
CP(ru, ru32, ru_nswap);
|
||||
CP(ru, ru32, ru_inblock);
|
||||
CP(ru, ru32, ru_oublock);
|
||||
CP(ru, ru32, ru_msgsnd);
|
||||
CP(ru, ru32, ru_msgrcv);
|
||||
CP(ru, ru32, ru_nsignals);
|
||||
CP(ru, ru32, ru_nvcsw);
|
||||
CP(ru, ru32, ru_nivcsw);
|
||||
freebsd32_rusage_out(&ru, &ru32);
|
||||
error = copyout(&ru32, uap->rusage, sizeof(ru32));
|
||||
}
|
||||
return (error);
|
||||
@ -755,22 +762,7 @@ freebsd32_getrusage(struct thread *td, struct freebsd32_getrusage_args *uap)
|
||||
if (error)
|
||||
return (error);
|
||||
if (uap->rusage != NULL) {
|
||||
TV_CP(s, s32, ru_utime);
|
||||
TV_CP(s, s32, ru_stime);
|
||||
CP(s, s32, ru_maxrss);
|
||||
CP(s, s32, ru_ixrss);
|
||||
CP(s, s32, ru_idrss);
|
||||
CP(s, s32, ru_isrss);
|
||||
CP(s, s32, ru_minflt);
|
||||
CP(s, s32, ru_majflt);
|
||||
CP(s, s32, ru_nswap);
|
||||
CP(s, s32, ru_inblock);
|
||||
CP(s, s32, ru_oublock);
|
||||
CP(s, s32, ru_msgsnd);
|
||||
CP(s, s32, ru_msgrcv);
|
||||
CP(s, s32, ru_nsignals);
|
||||
CP(s, s32, ru_nvcsw);
|
||||
CP(s, s32, ru_nivcsw);
|
||||
freebsd32_rusage_out(&s, &s32);
|
||||
error = copyout(&s32, uap->rusage, sizeof(s32));
|
||||
}
|
||||
return (error);
|
||||
|
@ -94,9 +94,12 @@ int syscall32_module_handler(struct module *mod, int what, void *arg);
|
||||
int syscall32_helper_register(struct syscall_helper_data *sd);
|
||||
int syscall32_helper_unregister(struct syscall_helper_data *sd);
|
||||
|
||||
register_t *freebsd32_copyout_strings(struct image_params *imgp);
|
||||
struct iovec32;
|
||||
struct rusage32;
|
||||
register_t *freebsd32_copyout_strings(struct image_params *imgp);
|
||||
int freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt,
|
||||
struct iovec **iov, int error);
|
||||
void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32);
|
||||
|
||||
|
||||
#endif /* !_COMPAT_FREEBSD32_FREEBSD32_UTIL_H_ */
|
||||
|
@ -274,7 +274,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS)
|
||||
"cpu family\t: %d\n"
|
||||
"model\t\t: %d\n"
|
||||
"model name\t: %s\n"
|
||||
"stepping\t: %d\n",
|
||||
"stepping\t: %d\n\n",
|
||||
i, cpu_vendor, class, cpu, model, cpu_id & 0xf);
|
||||
/* XXX per-cpu vendor / class / model / id? */
|
||||
}
|
||||
|
@ -2628,6 +2628,7 @@ bsd_to_linux_v4l_tuner(struct video_tuner *vt, struct l_video_tuner *lvt)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_LINUX_V4L_CLIPLIST
|
||||
static int
|
||||
linux_to_bsd_v4l_clip(struct l_video_clip *lvc, struct video_clip *vc)
|
||||
{
|
||||
@ -2638,6 +2639,7 @@ linux_to_bsd_v4l_clip(struct l_video_clip *lvc, struct video_clip *vc)
|
||||
vc->next = PTRIN(lvc->next); /* possible pointer size conversion */
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
linux_to_bsd_v4l_window(struct l_video_window *lvw, struct video_window *vw)
|
||||
@ -2698,6 +2700,7 @@ linux_to_bsd_v4l_code(struct l_video_code *lvc, struct video_code *vc)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_LINUX_V4L_CLIPLIST
|
||||
static int
|
||||
linux_v4l_clip_copy(void *lvc, struct video_clip **ppvc)
|
||||
{
|
||||
@ -2772,15 +2775,18 @@ linux_v4l_cliplist_copy(struct l_video_window *lvw, struct video_window *vw)
|
||||
* example of cliplist use.
|
||||
*/
|
||||
plvc = PTRIN(lvw->clips);
|
||||
vw->clips = NULL;
|
||||
ppvc = &(vw->clips);
|
||||
while (clipcount-- > 0) {
|
||||
if (plvc == 0)
|
||||
if (plvc == 0) {
|
||||
error = EFAULT;
|
||||
if (!error)
|
||||
error = linux_v4l_clip_copy(plvc, ppvc);
|
||||
if (error) {
|
||||
linux_v4l_cliplist_free(vw);
|
||||
break;
|
||||
} else {
|
||||
error = linux_v4l_clip_copy(plvc, ppvc);
|
||||
if (error) {
|
||||
linux_v4l_cliplist_free(vw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ppvc = &((*ppvc)->next);
|
||||
plvc = PTRIN(((struct l_video_clip *) plvc)->next);
|
||||
@ -2795,6 +2801,7 @@ linux_v4l_cliplist_copy(struct l_video_window *lvw, struct video_window *vw)
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args)
|
||||
@ -2818,6 +2825,12 @@ linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args)
|
||||
case LINUX_VIDIOCGTUNER:
|
||||
if ((error = fget(td, args->fd, &fp)) != 0)
|
||||
return (error);
|
||||
error = copyin((void *) args->arg, &l_vtun, sizeof(l_vtun));
|
||||
if (error) {
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
linux_to_bsd_v4l_tuner(&l_vtun, &vtun);
|
||||
error = fo_ioctl(fp, VIDIOCGTUNER, &vtun, td->td_ucred, td);
|
||||
if (!error) {
|
||||
bsd_to_linux_v4l_tuner(&vtun, &l_vtun);
|
||||
@ -2836,7 +2849,7 @@ linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args)
|
||||
return (error);
|
||||
}
|
||||
linux_to_bsd_v4l_tuner(&l_vtun, &vtun);
|
||||
error = fo_ioctl(fp, VIDIOCSMICROCODE, &vtun, td->td_ucred, td);
|
||||
error = fo_ioctl(fp, VIDIOCSTUNER, &vtun, td->td_ucred, td);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
|
||||
@ -2865,14 +2878,18 @@ linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args)
|
||||
return (error);
|
||||
}
|
||||
linux_to_bsd_v4l_window(&l_vwin, &vwin);
|
||||
#ifdef COMPAT_LINUX_V4L_CLIPLIST
|
||||
error = linux_v4l_cliplist_copy(&l_vwin, &vwin);
|
||||
if (error) {
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
error = fo_ioctl(fp, VIDIOCSWIN, &vwin, td->td_ucred, td);
|
||||
fdrop(fp, td);
|
||||
#ifdef COMPAT_LINUX_V4L_CLIPLIST
|
||||
linux_v4l_cliplist_free(&vwin);
|
||||
#endif
|
||||
return (error);
|
||||
|
||||
case LINUX_VIDIOCGFBUF:
|
||||
@ -2924,7 +2941,7 @@ linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args)
|
||||
return (error);
|
||||
}
|
||||
linux_to_bsd_v4l_code(&l_vcode, &vcode);
|
||||
error = fo_ioctl(fp, VIDIOCSTUNER, &vcode, td->td_ucred, td);
|
||||
error = fo_ioctl(fp, VIDIOCSMICROCODE, &vcode, td->td_ucred, td);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
|
||||
|
@ -47,11 +47,15 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/iodev.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
#define X86BIOS_NATIVE_ARCH
|
||||
#endif
|
||||
|
||||
#define X86BIOS_PAGE_SIZE 0x00001000 /* 4K */
|
||||
|
||||
#define X86BIOS_IVT_SIZE 0x00000500 /* 1K + 256 (BDA) */
|
||||
@ -236,27 +240,49 @@ x86bios_emu_inb(struct x86emu *emu, uint16_t port)
|
||||
if (port >= 0x80 && port < 0x88) /* POST status register */
|
||||
return (0);
|
||||
|
||||
return (inb(port));
|
||||
return (iodev_read_1(port));
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
x86bios_emu_inw(struct x86emu *emu, uint16_t port)
|
||||
{
|
||||
uint16_t val;
|
||||
|
||||
if (port >= 0x80 && port < 0x88) /* POST status register */
|
||||
return (0);
|
||||
|
||||
return (inw(port));
|
||||
#ifndef X86BIOS_NATIVE_ARCH
|
||||
if ((port & 1) != 0) {
|
||||
val = iodev_read_1(port);
|
||||
val |= iodev_read_1(port + 1) << 8;
|
||||
} else
|
||||
#endif
|
||||
val = iodev_read_2(port);
|
||||
|
||||
return (val);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
x86bios_emu_inl(struct x86emu *emu, uint16_t port)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
if (port >= 0x80 && port < 0x88) /* POST status register */
|
||||
return (0);
|
||||
|
||||
return (inl(port));
|
||||
#ifndef X86BIOS_NATIVE_ARCH
|
||||
if ((port & 1) != 0) {
|
||||
val = iodev_read_1(port);
|
||||
val |= iodev_read_2(port + 1) << 8;
|
||||
val |= iodev_read_1(port + 3) << 24;
|
||||
} else if ((port & 2) != 0) {
|
||||
val = iodev_read_2(port);
|
||||
val |= iodev_read_2(port + 2) << 16;
|
||||
} else
|
||||
#endif
|
||||
val = iodev_read_4(port);
|
||||
|
||||
return (val);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -268,7 +294,7 @@ x86bios_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val)
|
||||
if (port >= 0x80 && port < 0x88) /* POST status register */
|
||||
return;
|
||||
|
||||
outb(port, val);
|
||||
iodev_write_1(port, val);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -278,7 +304,13 @@ x86bios_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val)
|
||||
if (port >= 0x80 && port < 0x88) /* POST status register */
|
||||
return;
|
||||
|
||||
outw(port, val);
|
||||
#ifndef X86BIOS_NATIVE_ARCH
|
||||
if ((port & 1) != 0) {
|
||||
iodev_write_1(port, val);
|
||||
iodev_write_1(port + 1, val >> 8);
|
||||
} else
|
||||
#endif
|
||||
iodev_write_2(port, val);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -288,7 +320,17 @@ x86bios_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val)
|
||||
if (port >= 0x80 && port < 0x88) /* POST status register */
|
||||
return;
|
||||
|
||||
outl(port, val);
|
||||
#ifndef X86BIOS_NATIVE_ARCH
|
||||
if ((port & 1) != 0) {
|
||||
iodev_write_1(port, val);
|
||||
iodev_write_2(port + 1, val >> 8);
|
||||
iodev_write_1(port + 3, val >> 24);
|
||||
} else if ((port & 2) != 0) {
|
||||
iodev_write_2(port, val);
|
||||
iodev_write_2(port + 2, val >> 16);
|
||||
} else
|
||||
#endif
|
||||
iodev_write_4(port, val);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -484,45 +526,53 @@ x86bios_match_device(uint32_t offset, device_t dev)
|
||||
return (1);
|
||||
}
|
||||
|
||||
#if defined(__amd64__) || (defined(__i386__) && !defined(PC98))
|
||||
#define PROBE_EBDA 1
|
||||
static __inline void
|
||||
x86bios_unmap_mem(void)
|
||||
{
|
||||
|
||||
if (x86bios_ivt != NULL)
|
||||
#ifdef X86BIOS_NATIVE_ARCH
|
||||
pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
|
||||
#else
|
||||
#define PROBE_EBDA 0
|
||||
free(x86bios_ivt, M_DEVBUF);
|
||||
#endif
|
||||
if (x86bios_rom != NULL)
|
||||
pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
|
||||
if (x86bios_seg != NULL)
|
||||
contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
x86bios_map_mem(void)
|
||||
{
|
||||
|
||||
#ifdef X86BIOS_NATIVE_ARCH
|
||||
x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE);
|
||||
if (x86bios_ivt == NULL)
|
||||
return (1);
|
||||
|
||||
#if PROBE_EBDA
|
||||
#ifndef PC98
|
||||
/* Probe EBDA via BDA. */
|
||||
x86bios_rom_phys = *(uint16_t *)((vm_offset_t)x86bios_ivt + 0x40e);
|
||||
x86bios_rom_phys = le16toh(x86bios_rom_phys) << 4;
|
||||
x86bios_rom_phys = *(uint16_t *)((caddr_t)x86bios_ivt + 0x40e);
|
||||
x86bios_rom_phys = x86bios_rom_phys << 4;
|
||||
if (x86bios_rom_phys != 0 && x86bios_rom_phys < X86BIOS_ROM_BASE &&
|
||||
X86BIOS_ROM_BASE - x86bios_rom_phys <= 128 * 1024)
|
||||
x86bios_rom_phys =
|
||||
rounddown(x86bios_rom_phys, X86BIOS_PAGE_SIZE);
|
||||
else
|
||||
#endif
|
||||
#else
|
||||
x86bios_ivt = malloc(X86BIOS_IVT_SIZE, M_DEVBUF, M_ZERO | M_WAITOK);
|
||||
#endif
|
||||
|
||||
x86bios_rom_phys = X86BIOS_ROM_BASE;
|
||||
x86bios_rom = pmap_mapdev(x86bios_rom_phys, X86BIOS_ROM_SIZE);
|
||||
if (x86bios_rom == NULL) {
|
||||
pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
|
||||
return (1);
|
||||
}
|
||||
#if PROBE_EBDA
|
||||
if (x86bios_rom == NULL)
|
||||
goto fail;
|
||||
#if defined(X86BIOS_NATIVE_ARCH) && !defined(PC98)
|
||||
/* Change attribute for EBDA. */
|
||||
if (x86bios_rom_phys < X86BIOS_ROM_BASE &&
|
||||
pmap_change_attr((vm_offset_t)x86bios_rom,
|
||||
X86BIOS_ROM_BASE - x86bios_rom_phys, PAT_WRITE_BACK) != 0) {
|
||||
pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
|
||||
pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
|
||||
return (1);
|
||||
}
|
||||
X86BIOS_ROM_BASE - x86bios_rom_phys, PAT_WRITE_BACK) != 0)
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_WAITOK,
|
||||
@ -537,12 +587,10 @@ x86bios_map_mem(void)
|
||||
(uint32_t)x86bios_seg_phys,
|
||||
X86BIOS_SEG_SIZE + (uint32_t)x86bios_seg_phys - 1,
|
||||
x86bios_seg);
|
||||
#if PROBE_EBDA
|
||||
if (x86bios_rom_phys < X86BIOS_ROM_BASE)
|
||||
printf("x86bios: EBDA 0x%06x-0x%06x at %p\n",
|
||||
(uint32_t)x86bios_rom_phys, X86BIOS_ROM_BASE - 1,
|
||||
x86bios_rom);
|
||||
#endif
|
||||
printf("x86bios: ROM 0x%06x-0x%06x at %p\n",
|
||||
X86BIOS_ROM_BASE, X86BIOS_MEM_SIZE - X86BIOS_SEG_SIZE - 1,
|
||||
(void *)((vm_offset_t)x86bios_rom + X86BIOS_ROM_BASE -
|
||||
@ -550,28 +598,22 @@ x86bios_map_mem(void)
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
fail:
|
||||
x86bios_unmap_mem();
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
#undef PROBE_EBDA
|
||||
|
||||
static __inline void
|
||||
x86bios_unmap_mem(void)
|
||||
{
|
||||
|
||||
pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
|
||||
pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
|
||||
contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF);
|
||||
}
|
||||
|
||||
static void
|
||||
x86bios_init(void *arg __unused)
|
||||
static int
|
||||
x86bios_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN);
|
||||
|
||||
if (x86bios_map_mem() != 0)
|
||||
return;
|
||||
return (ENOMEM);
|
||||
|
||||
mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN);
|
||||
|
||||
x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
@ -600,10 +642,12 @@ x86bios_init(void *arg __unused)
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
x86bios_emu._x86emu_intrTab[i] = x86bios_emu_get_intr;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
x86bios_uninit(void *arg __unused)
|
||||
static int
|
||||
x86bios_uninit(void)
|
||||
{
|
||||
vm_offset_t *map = x86bios_map;
|
||||
|
||||
@ -618,6 +662,8 @@ x86bios_uninit(void *arg __unused)
|
||||
x86bios_unmap_mem();
|
||||
|
||||
mtx_destroy(&x86bios_lock);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -626,16 +672,12 @@ x86bios_modevent(module_t mod __unused, int type, void *data __unused)
|
||||
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
x86bios_init(NULL);
|
||||
break;
|
||||
return (x86bios_init());
|
||||
case MOD_UNLOAD:
|
||||
x86bios_uninit(NULL);
|
||||
break;
|
||||
return (x86bios_uninit());
|
||||
default:
|
||||
return (ENOTSUP);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static moduledata_t x86bios_mod = {
|
||||
|
@ -1660,12 +1660,14 @@ device twe # 3ware ATA RAID
|
||||
# Serial ATA host controllers:
|
||||
#
|
||||
# ahci: Advanced Host Controller Interface (AHCI) compatible
|
||||
# mvs: Marvell 88SX50XX/88SX60XX/88SX70XX/SoC controllers
|
||||
# siis: SiliconImage SiI3124/SiI3132/SiI3531 controllers
|
||||
#
|
||||
# These drivers are part of cam(4) subsystem. They supersede less featured
|
||||
# ata(4) subsystem drivers, supporting same hardware.
|
||||
|
||||
device ahci
|
||||
device mvs
|
||||
device siis
|
||||
|
||||
#
|
||||
@ -1952,6 +1954,7 @@ device xmphy # XaQti XMAC II
|
||||
# This includes dual and quad port cards, as well as one 100baseFX card.
|
||||
# Most of these are 64-bit PCI devices, except for one single port
|
||||
# card which is 32-bit.
|
||||
# sge: Silicon Integrated Systems SiS190/191 Fast/Gigabit Ethernet adapter
|
||||
# sis: Support for NICs based on the Silicon Integrated Systems SiS 900,
|
||||
# SiS 7016 and NS DP83815 PCI fast ethernet controller chips.
|
||||
# sk: Support for the SysKonnect SK-984x series PCI gigabit ethernet NICs.
|
||||
@ -2046,6 +2049,7 @@ device re # RealTek 8139C+/8169/8169S/8110S
|
||||
device rl # RealTek 8129/8139
|
||||
device pcn # AMD Am79C97x PCI 10/100 NICs
|
||||
device sf # Adaptec AIC-6915 (``Starfire'')
|
||||
device sge # Silicon Integrated Systems SiS190/191
|
||||
device sis # Silicon Integrated Systems SiS 900/SiS 7016
|
||||
device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet
|
||||
device ste # Sundance ST201 (D-Link DFE-550TX)
|
||||
@ -2089,6 +2093,15 @@ device ath_hal # pci/cardbus chip support
|
||||
#device ath_rf5413
|
||||
#device ath_ar5416 # AR5416 chips
|
||||
options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
|
||||
# All of the AR5212 parts have a problem when paired with the AR71xx
|
||||
# CPUS. These parts have a bug that triggers a fatal bus error on the AR71xx
|
||||
# only. Details of the exact nature of the bug are sketchy, but some can be
|
||||
# found at https://forum.openwrt.org/viewtopic.php?pid=70060 on pages 4, 5 and
|
||||
# 6. This option enables this workaround. There is a performance penalty
|
||||
# for this work around, but without it things don't work at all. The DMA
|
||||
# from the card usually bursts 128 bytes, but on the affected CPUs, only
|
||||
# 4 are safe.
|
||||
options AH_RXCFG_SDMAMW_4BYTES
|
||||
#device ath_ar9160 # AR9160 chips
|
||||
#device ath_ar9280 # AR9280 chips
|
||||
#device ath_ar9285 # AR9285 chips
|
||||
|
@ -174,6 +174,8 @@ contrib/dev/acpica/dispatcher/dswstate.c optional acpi
|
||||
contrib/dev/acpica/events/evevent.c optional acpi
|
||||
contrib/dev/acpica/events/evgpe.c optional acpi
|
||||
contrib/dev/acpica/events/evgpeblk.c optional acpi
|
||||
contrib/dev/acpica/events/evgpeinit.c optional acpi
|
||||
contrib/dev/acpica/events/evgpeutil.c optional acpi
|
||||
contrib/dev/acpica/events/evmisc.c optional acpi
|
||||
contrib/dev/acpica/events/evregion.c optional acpi
|
||||
contrib/dev/acpica/events/evrgnini.c optional acpi
|
||||
@ -1291,6 +1293,9 @@ dev/mpt/mpt_pci.c optional mpt pci
|
||||
dev/mpt/mpt_raid.c optional mpt
|
||||
dev/mpt/mpt_user.c optional mpt
|
||||
dev/msk/if_msk.c optional msk inet
|
||||
dev/mvs/mvs.c optional mvs
|
||||
dev/mvs/mvs_if.m standard
|
||||
dev/mvs/mvs_pci.c optional mvs pci
|
||||
dev/mwl/if_mwl.c optional mwl
|
||||
dev/mwl/if_mwl_pci.c optional mwl pci
|
||||
dev/mwl/mwlhal.c optional mwl
|
||||
@ -1490,6 +1495,7 @@ dev/scd/scd.c optional scd isa
|
||||
dev/scd/scd_isa.c optional scd isa
|
||||
dev/sdhci/sdhci.c optional sdhci pci
|
||||
dev/sf/if_sf.c optional sf pci
|
||||
dev/sge/if_sge.c optional sge pci
|
||||
dev/si/si.c optional si
|
||||
dev/si/si2_z280.c optional si
|
||||
dev/si/si3_t225.c optional si
|
||||
|
@ -50,7 +50,6 @@ mips/mips/bus_space_generic.c standard
|
||||
mips/mips/busdma_machdep.c standard
|
||||
mips/mips/cache.c standard
|
||||
mips/mips/cache_mipsNN.c standard
|
||||
#mips/mips/copystr.S standard
|
||||
mips/mips/db_disasm.c optional ddb
|
||||
mips/mips/db_interface.c optional ddb
|
||||
mips/mips/db_trace.c optional ddb
|
||||
|
@ -22,7 +22,7 @@ ukbdmap.h optional ukbd_dflt_keymap \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "ukbdmap.h"
|
||||
#
|
||||
crypto/blowfish/bf_enc.c optional crypto | ipsec
|
||||
crypto/blowfish/bf_enc.c optional crypto | ipsec
|
||||
crypto/des/des_enc.c optional crypto | ipsec | netsmb
|
||||
dev/atkbdc/atkbd.c optional atkbd atkbdc
|
||||
dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc
|
||||
@ -42,11 +42,11 @@ dev/kbd/kbd.c optional atkbd | sc | ukbd
|
||||
dev/le/if_le_lebuffer.c optional le sbus
|
||||
dev/le/if_le_ledma.c optional le sbus
|
||||
dev/le/lebuffer_sbus.c optional le sbus
|
||||
dev/ofw/ofw_if.m standard
|
||||
dev/ofw/ofw_bus_if.m standard
|
||||
dev/ofw/ofw_bus_subr.c standard
|
||||
dev/ofw/ofw_standard.c standard
|
||||
dev/ofw/ofw_console.c optional ofw_console
|
||||
dev/ofw/ofw_if.m standard
|
||||
dev/ofw/ofw_standard.c standard
|
||||
dev/ofw/openfirm.c standard
|
||||
dev/ofw/openfirmio.c standard
|
||||
dev/ofw/openpromio.c standard
|
||||
@ -79,7 +79,7 @@ sparc64/pci/ofw_pcib.c optional pci
|
||||
sparc64/pci/ofw_pcib_subr.c optional pci
|
||||
sparc64/pci/ofw_pcibus.c optional pci
|
||||
sparc64/pci/psycho.c optional pci
|
||||
sparc64/pci/sbbc.c optional uart sbbc
|
||||
sparc64/pci/sbbc.c optional sbbc uart
|
||||
sparc64/pci/schizo.c optional pci
|
||||
sparc64/sbus/dma_sbus.c optional sbus
|
||||
sparc64/sbus/sbus.c optional sbus
|
||||
@ -138,3 +138,4 @@ sparc64/sparc64/tsb.c standard
|
||||
sparc64/sparc64/uio_machdep.c standard
|
||||
sparc64/sparc64/upa.c optional creator
|
||||
sparc64/sparc64/vm_machdep.c standard
|
||||
sparc64/sparc64/zeus.c standard
|
||||
|
@ -18,12 +18,12 @@ ukbdmap.h optional ukbd_dflt_keymap \
|
||||
clean "ukbdmap.h"
|
||||
#
|
||||
#
|
||||
crypto/blowfish/bf_enc.c optional crypto | ipsec
|
||||
crypto/blowfish/bf_enc.c optional crypto | ipsec
|
||||
crypto/des/des_enc.c optional crypto | ipsec | netsmb
|
||||
dev/ofw/ofw_bus_if.m standard
|
||||
dev/ofw/ofw_if.m standard
|
||||
dev/ofw/ofw_bus_subr.c standard
|
||||
dev/ofw/ofw_console.c optional ofw_console
|
||||
dev/ofw/ofw_if.m standard
|
||||
dev/ofw/ofw_standard.c standard
|
||||
dev/ofw/openfirm.c standard
|
||||
dev/ofw/openfirmio.c standard
|
||||
|
@ -128,7 +128,8 @@ NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
|
||||
NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
|
||||
${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
|
||||
|
||||
NORMAL_CTFCONVERT= @[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
||||
NORMAL_CTFCONVERT= [ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
|
||||
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
||||
|
||||
NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
|
||||
|
||||
|
@ -137,6 +137,10 @@ CFLAGS+= -mlongcall -fno-omit-frame-pointer
|
||||
CFLAGS+= -G0 -fno-pic -mno-abicalls -mlong-calls
|
||||
.endif
|
||||
|
||||
.if defined(DEBUG) || defined(DEBUG_FLAGS)
|
||||
CTFFLAGS+= -g
|
||||
.endif
|
||||
|
||||
.if defined(FIRMWS)
|
||||
.if !exists(@)
|
||||
${KMOD:S/$/.c/}: @
|
||||
@ -204,6 +208,7 @@ ${KMOD}.kld: ${OBJS}
|
||||
${FULLPROG}: ${OBJS}
|
||||
.endif
|
||||
${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
|
||||
@[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
|
||||
.if defined(EXPORT_SYMS)
|
||||
.if ${EXPORT_SYMS} != YES
|
||||
.if ${EXPORT_SYMS} == NO
|
||||
@ -340,7 +345,7 @@ MFILES?= dev/acpica/acpi_if.m dev/acpi_support/acpi_wmi_if.m \
|
||||
dev/agp/agp_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \
|
||||
dev/iicbus/iicbb_if.m dev/iicbus/iicbus_if.m \
|
||||
dev/mmc/mmcbr_if.m dev/mmc/mmcbus_if.m \
|
||||
dev/mii/miibus_if.m dev/ofw/ofw_bus_if.m \
|
||||
dev/mii/miibus_if.m dev/mvs/mvs_if.m dev/ofw/ofw_bus_if.m \
|
||||
dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \
|
||||
dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \
|
||||
dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \
|
||||
|
@ -771,6 +771,7 @@ AH_PRIVATE_DIAG opt_ah.h
|
||||
AH_NEED_DESC_SWAP opt_ah.h
|
||||
AH_USE_INIPDGAIN opt_ah.h
|
||||
AH_MAXCHAN opt_ah.h
|
||||
AH_RXCFG_SDMAMW_4BYTES opt_ah.h
|
||||
|
||||
# options for the Broadcom BCM43xx driver (bwi)
|
||||
BWI_DEBUG opt_bwi.h
|
||||
|
@ -37,3 +37,4 @@ AT91_BWCT opt_at91.h
|
||||
AT91_TSC opt_at91.h
|
||||
AT91_KWIKBYTE opt_at91.h
|
||||
CPU_FA526 opt_global.h
|
||||
CPU_FA626TE opt_global.h
|
||||
|
@ -19,7 +19,7 @@ fulldirs="common compiler debugger disassembler dispatcher events \
|
||||
tools utilities"
|
||||
|
||||
# files to remove
|
||||
stripdirs="acpisrc acpixtract examples generate os_specific"
|
||||
stripdirs="acpisrc acpixtract examples generate os_specific tests"
|
||||
stripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h \
|
||||
acos2.h accygwin.h acefi.h acwin.h acwin64.h aeexec.c \
|
||||
aehandlers.c aemain.c aetables.c osunixdir.c readme.txt \
|
||||
|
@ -1,3 +1,69 @@
|
||||
----------------------------------------
|
||||
28 April 2010. Summary of changes for version 20100428:
|
||||
|
||||
1) ACPI CA Core Subsystem:
|
||||
|
||||
Implemented GPE support for dynamically loaded ACPI tables. For all GPEs,
|
||||
including FADT-based and GPE Block Devices, execute any _PRW methods in the
|
||||
new table, and process any _Lxx/_Exx GPE methods in the new table. Any
|
||||
runtime GPE that is referenced by an _Lxx/_Exx method in the new table is
|
||||
immediately enabled. Handles the FADT-defined GPEs as well as GPE Block
|
||||
Devices. Provides compatibility with other ACPI implementations. Two new
|
||||
files added, evgpeinit.c and evgpeutil.c. ACPICA BZ 833. Lin Ming, Bob Moore.
|
||||
|
||||
Fixed a regression introduced in version 20100331 within the table manager
|
||||
where initial table loading could fail. This was introduced in the fix for
|
||||
AcpiReallocateRootTable. Also, renamed some of fields in the table manager
|
||||
data structures to clarify their meaning and use.
|
||||
|
||||
Fixed a possible allocation overrun during internal object copy in
|
||||
AcpiUtCopySimpleObject. The original code did not correctly handle the case
|
||||
where the object to be copied was a namespace node. Lin Ming. ACPICA BZ 847.
|
||||
|
||||
Updated the allocation dump routine, AcpiUtDumpAllocation and fixed a
|
||||
possible access beyond end-of-allocation. Also, now fully validate descriptor
|
||||
(size and type) before output. Lin Ming, Bob Moore. ACPICA BZ 847
|
||||
|
||||
Example Code and Data Size: These are the sizes for the OS-independent
|
||||
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
|
||||
debug version of the code includes the debug output trace mechanism and has a
|
||||
much larger code and data size.
|
||||
|
||||
Previous Release:
|
||||
Non-Debug Version: 87.9K Code, 18.6K Data, 106.5K Total
|
||||
Debug Version: 163.5K Code, 51.3K Data, 214.8K Total
|
||||
Current Release:
|
||||
Non-Debug Version: 88.4K Code, 18.8K Data, 107.2K Total
|
||||
Debug Version: 164.2K Code, 51.5K Data, 215.7K Total
|
||||
|
||||
2) iASL Compiler/Disassembler and Tools:
|
||||
|
||||
iASL: Implemented Min/Max/Len/Gran validation for address resource
|
||||
descriptors. This change implements validation for the address fields that
|
||||
are common to all address-type resource descriptors. These checks are
|
||||
implemented: Checks for valid Min/Max, length within the Min/Max window,
|
||||
valid granularity, Min/Max a multiple of granularity, and _MIF/_MAF as per
|
||||
table 6-40 in the ACPI 4.0a specification. Also split the large aslrestype1.c
|
||||
and aslrestype2.c files into five new files. ACPICA BZ 840.
|
||||
|
||||
iASL: Added support for the _Wxx predefined names. This support was missing
|
||||
and these names were not recognized by the compiler as valid predefined
|
||||
names. ACPICA BZ 851.
|
||||
|
||||
iASL: Added an error for all predefined names that are defined to return no
|
||||
value and thus must be implemented as Control Methods. These include all of
|
||||
the _Lxx, _Exx, _Wxx, and _Qxx names, as well as some other miscellaneous
|
||||
names such as _DIS, _INI, _IRC, _OFF, _ON, and _PSx. ACPICA BZ 850, 856.
|
||||
|
||||
iASL: Implemented the -ts option to emit hex AML data in ASL format, as an
|
||||
ASL Buffer. Allows ACPI tables to be easily included within ASL files, to be
|
||||
dynamically loaded via the Load() operator. Also cleaned up output for the -
|
||||
ta and -tc options. ACPICA BZ 853.
|
||||
|
||||
Tests: Added a new file with examples of extended iASL error checking.
|
||||
Demonstrates the advanced error checking ability of the iASL compiler.
|
||||
Available at tests/misc/badcode.asl.
|
||||
|
||||
----------------------------------------
|
||||
31 March 2010. Summary of changes for version 20100331:
|
||||
|
||||
|
@ -282,8 +282,8 @@ AdInitialize (
|
||||
|
||||
/* Setup the Table Manager (cheat - there is no RSDT) */
|
||||
|
||||
AcpiGbl_RootTableList.Size = 1;
|
||||
AcpiGbl_RootTableList.Count = 0;
|
||||
AcpiGbl_RootTableList.MaxTableCount = 1;
|
||||
AcpiGbl_RootTableList.CurrentTableCount = 0;
|
||||
AcpiGbl_RootTableList.Tables = LocalTables;
|
||||
|
||||
return (Status);
|
||||
@ -1156,7 +1156,7 @@ AdParseTable (
|
||||
|
||||
/* If LoadTable is FALSE, we are parsing the last loaded table */
|
||||
|
||||
TableIndex = AcpiGbl_RootTableList.Count - 1;
|
||||
TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1;
|
||||
|
||||
/* Pass 2 */
|
||||
|
||||
|
@ -177,7 +177,8 @@ AslCompilerSignon (
|
||||
{
|
||||
Prefix = "; ";
|
||||
}
|
||||
else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
|
||||
else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
|
||||
(Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
|
||||
Prefix = " * ";
|
||||
@ -265,7 +266,8 @@ AslCompilerFileHeader (
|
||||
{
|
||||
Prefix = "; ";
|
||||
}
|
||||
else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
|
||||
else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
|
||||
(Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
|
||||
{
|
||||
Prefix = " * ";
|
||||
}
|
||||
|
@ -592,6 +592,10 @@ FlFileError (
|
||||
UINT32 FileId,
|
||||
UINT8 ErrorId);
|
||||
|
||||
UINT32
|
||||
FlGetFileSize (
|
||||
UINT32 FileId);
|
||||
|
||||
ACPI_STATUS
|
||||
FlReadFile (
|
||||
UINT32 FileId,
|
||||
@ -750,6 +754,34 @@ UtDoConstant (
|
||||
/*
|
||||
* aslresource - Resource template generation utilities
|
||||
*/
|
||||
void
|
||||
RsSmallAddressCheck (
|
||||
UINT8 Type,
|
||||
UINT32 Minimum,
|
||||
UINT32 Maximum,
|
||||
UINT32 Length,
|
||||
UINT32 Alignment,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *AlignOp);
|
||||
|
||||
void
|
||||
RsLargeAddressCheck (
|
||||
UINT64 Minimum,
|
||||
UINT64 Maximum,
|
||||
UINT64 Length,
|
||||
UINT64 Granularity,
|
||||
UINT8 Flags,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *GranOp);
|
||||
|
||||
UINT16
|
||||
RsGetStringDataLength (
|
||||
ACPI_PARSE_OBJECT *InitializerOp);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsAllocateResourceNode (
|
||||
UINT32 Size);
|
||||
@ -805,43 +837,18 @@ RsDoResourceTemplate (
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype1 - generate Small descriptors
|
||||
* aslrestype1 - Miscellaneous Small descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoEndTagDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoEndDependentDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoMemory24Descriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -874,7 +881,36 @@ RsDoVendorSmallDescriptor (
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2 - generate Large descriptors
|
||||
* aslrestype1i - I/O-related Small descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2 - Large resource descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoInterruptDescriptor (
|
||||
@ -882,6 +918,20 @@ RsDoInterruptDescriptor (
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoVendorLargeDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoGeneralRegisterDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2d - DWord address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
@ -896,6 +946,10 @@ RsDoDwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2e - Extended address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -911,6 +965,10 @@ RsDoExtendedSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2q - QWord address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -926,6 +984,10 @@ RsDoQwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* aslrestype2w - Word address descriptors
|
||||
*/
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -941,15 +1003,5 @@ RsDoWordBusNumberDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoVendorLargeDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoGeneralRegisterDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
#endif /* __ASLCOMPILER_H */
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
||||
#define CompilerId "ASL Optimizing Compiler"
|
||||
#define DisassemblerId "AML Disassembler"
|
||||
#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation"
|
||||
#define CompilerCompliance "Supports ACPI Specification Revision 4.0"
|
||||
#define CompilerCompliance "Supports ACPI Specification Revision 4.0a"
|
||||
#define CompilerName "iasl"
|
||||
#define CompilerCreatorId "INTL"
|
||||
|
||||
|
@ -234,6 +234,36 @@ FlOpenFile (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlGetFileSize
|
||||
*
|
||||
* PARAMETERS: FileId - Index into file info array
|
||||
*
|
||||
* RETURN: File Size
|
||||
*
|
||||
* DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
FlGetFileSize (
|
||||
UINT32 FileId)
|
||||
{
|
||||
FILE *fp;
|
||||
UINT32 FileSize;
|
||||
|
||||
|
||||
fp = Gbl_Files[FileId].Handle;
|
||||
|
||||
fseek (fp, 0, SEEK_END);
|
||||
FileSize = (UINT32) ftell (fp);
|
||||
fseek (fp, 0, SEEK_SET);
|
||||
|
||||
return (FileSize);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: FlReadFile
|
||||
|
@ -188,6 +188,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);
|
||||
@ -200,6 +201,8 @@ ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNI
|
||||
#define HEX_OUTPUT_NONE 0
|
||||
#define HEX_OUTPUT_C 1
|
||||
#define HEX_OUTPUT_ASM 2
|
||||
#define HEX_OUTPUT_ASL 3
|
||||
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE);
|
||||
|
||||
|
||||
|
@ -198,6 +198,10 @@ static void
|
||||
LsDoHexOutputAsm (
|
||||
void);
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsl (
|
||||
void);
|
||||
|
||||
ACPI_STATUS
|
||||
LsTreeWriteWalk (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
@ -1337,6 +1341,11 @@ LsDoHexOutput (
|
||||
LsDoHexOutputAsm ();
|
||||
break;
|
||||
|
||||
case HEX_OUTPUT_ASL:
|
||||
|
||||
LsDoHexOutputAsl ();
|
||||
break;
|
||||
|
||||
default:
|
||||
/* No other output types supported */
|
||||
break;
|
||||
@ -1362,60 +1371,160 @@ static void
|
||||
LsDoHexOutputC (
|
||||
void)
|
||||
{
|
||||
UINT32 j;
|
||||
UINT8 FileByte[HEX_TABLE_LINE_SIZE];
|
||||
UINT8 Buffer[4];
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n");
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
|
||||
|
||||
/* Start at the beginning of the AML file */
|
||||
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
|
||||
/* Process all AML bytes in the AML file */
|
||||
|
||||
j = 0;
|
||||
while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
if (j == 0)
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
if (!LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convert each AML byte to hex */
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
UtConvertByteToHex (FileByte[j], Buffer);
|
||||
FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
|
||||
/* An occasional linefeed improves readability */
|
||||
|
||||
Offset++;
|
||||
j++;
|
||||
|
||||
if (j >= HEX_TABLE_LINE_SIZE)
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/* End of line, emit the ascii dump of the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT,
|
||||
" /* %8.8X", Offset - HEX_TABLE_LINE_SIZE);
|
||||
|
||||
/* Write the ASCII character associated with each of the bytes */
|
||||
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT,
|
||||
HEX_TABLE_LINE_SIZE, FileByte);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " */\n");
|
||||
|
||||
/* Start new line */
|
||||
|
||||
j = 0;
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n};\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
|
||||
FlCloseFile (ASL_FILE_HEX_OUTPUT);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: LsDoHexOutputAsl
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None.
|
||||
*
|
||||
* DESCRIPTION: Create the hex output file. This is the same data as the AML
|
||||
* output file, but formatted into hex/ascii bytes suitable for
|
||||
* inclusion into a C source file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
LsDoHexOutputAsl (
|
||||
void)
|
||||
{
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
|
||||
AmlFileSize);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n");
|
||||
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
if (!LineLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the very last byte of the AML file
|
||||
* (Some C compilers complain about a trailing comma)
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
|
||||
if ((Offset + i + 1) < AmlFileSize)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
|
||||
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n");
|
||||
FlCloseFile (ASL_FILE_HEX_OUTPUT);
|
||||
}
|
||||
|
||||
@ -1438,58 +1547,64 @@ static void
|
||||
LsDoHexOutputAsm (
|
||||
void)
|
||||
{
|
||||
UINT32 j;
|
||||
UINT8 FileByte[HEX_TABLE_LINE_SIZE];
|
||||
UINT8 Buffer[4];
|
||||
UINT8 FileData[HEX_TABLE_LINE_SIZE];
|
||||
UINT32 LineLength;
|
||||
UINT32 Offset = 0;
|
||||
BOOLEAN DoComma = FALSE;
|
||||
UINT32 AmlFileSize;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n;\n");
|
||||
/* Get AML size, seek back to start */
|
||||
|
||||
/* Start at the beginning of the AML file */
|
||||
AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
|
||||
|
||||
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n");
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n",
|
||||
AmlFileSize);
|
||||
|
||||
/* Process all AML bytes in the AML file */
|
||||
|
||||
j = 0;
|
||||
while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
|
||||
while (Offset < AmlFileSize)
|
||||
{
|
||||
if (j == 0)
|
||||
/* Read enough bytes needed for one output line */
|
||||
|
||||
LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
|
||||
if (!LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
|
||||
}
|
||||
else if (DoComma)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
DoComma = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convert each AML byte to hex */
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
|
||||
|
||||
UtConvertByteToAsmHex (FileByte[j], Buffer);
|
||||
FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
|
||||
|
||||
/* An occasional linefeed improves readability */
|
||||
|
||||
Offset++;
|
||||
j++;
|
||||
if (j >= HEX_TABLE_LINE_SIZE)
|
||||
for (i = 0; i < LineLength; i++)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT,
|
||||
" ;%8.8X", Offset - HEX_TABLE_LINE_SIZE);
|
||||
|
||||
/* Write the ASCII character associated with each of the bytes */
|
||||
|
||||
LsDumpAscii (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
j = 0;
|
||||
/*
|
||||
* Print each hex byte.
|
||||
* Add a comma until the last byte of the line
|
||||
*/
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]);
|
||||
if ((i + 1) < LineLength)
|
||||
{
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
|
||||
|
||||
/* Add fill spaces if needed for last line */
|
||||
|
||||
if (LineLength < HEX_TABLE_LINE_SIZE)
|
||||
{
|
||||
DoComma = TRUE;
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
|
||||
5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
|
||||
}
|
||||
|
||||
/* Emit the offset and ascii dump for the entire line */
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset);
|
||||
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
|
||||
Offset += LineLength;
|
||||
}
|
||||
|
||||
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
|
||||
|
@ -167,7 +167,7 @@ AslDoResponseFile (
|
||||
|
||||
|
||||
#define ASL_TOKEN_SEPARATORS " \t\n"
|
||||
#define ASL_SUPPORTED_OPTIONS "@:2b:cd^e:fgh^i^I:l^o:p:r:s:t:v:w:x:"
|
||||
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -203,13 +203,14 @@ Options (
|
||||
printf ("\nAML Output Files:\n");
|
||||
printf (" -s<a|c> Create AML in assembler or C source file (*.asm or *.c)\n");
|
||||
printf (" -i<a|c> Create assembler or C include file (*.inc or *.h)\n");
|
||||
printf (" -t<a|c> Create AML in assembler or C hex table (*.hex)\n");
|
||||
printf (" -t<a|c|s> Create AML in assembler, C, or ASL hex table (*.hex)\n");
|
||||
|
||||
printf ("\nAML Code Generation:\n");
|
||||
printf (" -oa Disable all optimizations (compatibility mode)\n");
|
||||
printf (" -of Disable constant folding\n");
|
||||
printf (" -oi Disable integer optimization to Zero/One/Ones\n");
|
||||
printf (" -on Disable named reference string optimization\n");
|
||||
printf (" -cr Disable Resource Descriptor error checking\n");
|
||||
printf (" -r<Revision> Override table header Revision (1-255)\n");
|
||||
|
||||
printf ("\nListings:\n");
|
||||
@ -264,7 +265,7 @@ HelpMessage (
|
||||
printf (" -b<p|t|b> Create compiler debug/trace file (*.txt)\n");
|
||||
printf (" Types: Parse/Tree/Both\n");
|
||||
printf (" -f Ignore errors, force creation of AML output file(s)\n");
|
||||
printf (" -c Parse only, no output generation\n");
|
||||
printf (" -n Parse only, no output generation\n");
|
||||
printf (" -ot Display compile times\n");
|
||||
printf (" -x<level> Set debug level for trace output\n");
|
||||
}
|
||||
@ -507,10 +508,16 @@ AslDoOptions (
|
||||
|
||||
|
||||
case 'c':
|
||||
switch (AcpiGbl_Optarg[0])
|
||||
{
|
||||
case 'r':
|
||||
Gbl_NoResourceChecking = TRUE;
|
||||
break;
|
||||
|
||||
/* Parse only */
|
||||
|
||||
Gbl_ParseOnlyFlag = TRUE;
|
||||
default:
|
||||
printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -688,6 +695,14 @@ AslDoOptions (
|
||||
break;
|
||||
|
||||
|
||||
case 'n':
|
||||
|
||||
/* Parse only */
|
||||
|
||||
Gbl_ParseOnlyFlag = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case 'p':
|
||||
|
||||
/* Override default AML output filename */
|
||||
@ -741,6 +756,10 @@ AslDoOptions (
|
||||
Gbl_HexOutputFlag = HEX_OUTPUT_C;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
Gbl_HexOutputFlag = HEX_OUTPUT_ASL;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
|
||||
return (-1);
|
||||
|
@ -243,11 +243,11 @@ ApCheckForPredefinedMethod (
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx, _Exx, and _Qxx methods */
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
Gbl_ReservedMethods++;
|
||||
|
||||
/* NumArguments must be zero for all _Lxx, _Exx, and _Qxx methods */
|
||||
/* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
if (MethodInfo->NumArguments != 0)
|
||||
{
|
||||
@ -346,12 +346,12 @@ ApCheckPredefinedReturnValue (
|
||||
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
|
||||
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
|
||||
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx, _Exx, and _Qxx methods */
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
/* Just return, nothing to do */
|
||||
return;
|
||||
|
||||
default: /* a real predefined ACPI name */
|
||||
default: /* A standard predefined ACPI name */
|
||||
|
||||
/* Exit if no return value expected */
|
||||
|
||||
@ -425,29 +425,59 @@ ApCheckForPredefinedObject (
|
||||
* or a predefined scope name
|
||||
*/
|
||||
Index = ApCheckForPredefinedName (Op, Name);
|
||||
if (Index > ACPI_VALID_RESERVED_NAME_MAX)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We found a matching predefind name.
|
||||
* Check if this predefined name requires input arguments
|
||||
*/
|
||||
if (PredefinedNames[Index].Info.ParamCount > 0)
|
||||
switch (Index)
|
||||
{
|
||||
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
|
||||
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
|
||||
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
|
||||
|
||||
/* Nothing to do */
|
||||
return;
|
||||
|
||||
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
|
||||
|
||||
/*
|
||||
* This predefined name must always be defined as a control
|
||||
* method because it is required to have input arguments.
|
||||
* These names must be control methods, by definition in ACPI spec.
|
||||
* Also because they are defined to return no value. None of them
|
||||
* require any arguments.
|
||||
*/
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
|
||||
"with arguments");
|
||||
"with zero arguments");
|
||||
return;
|
||||
|
||||
default: /* A standard predefined ACPI name */
|
||||
|
||||
/*
|
||||
* If this predefined name requires input arguments, then
|
||||
* it must be implemented as a control method
|
||||
*/
|
||||
if (PredefinedNames[Index].Info.ParamCount > 0)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
|
||||
"with arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If no return value is expected from this predefined name, then
|
||||
* it follows that it must be implemented as a control method
|
||||
* (with zero args, because the args > 0 case was handled above)
|
||||
* Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
|
||||
*/
|
||||
if (!PredefinedNames[Index].Info.ExpectedBtypes)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
|
||||
"with zero arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Typecheck the actual object, it is the next argument */
|
||||
|
||||
ApCheckObjectType (Op->Asl.Child->Asl.Next,
|
||||
PredefinedNames[Index].Info.ExpectedBtypes);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Typecheck the actual object, it is the next argument */
|
||||
|
||||
ApCheckObjectType (Op->Asl.Child->Asl.Next,
|
||||
PredefinedNames[Index].Info.ExpectedBtypes);
|
||||
}
|
||||
|
||||
|
||||
@ -514,7 +544,7 @@ ApCheckForPredefinedName (
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for _Lxx, _Exx, _Qxx, _T_x. Warning if unknown predefined name */
|
||||
/* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */
|
||||
|
||||
return (ApCheckForSpecialName (Op, Name));
|
||||
}
|
||||
@ -530,7 +560,7 @@ ApCheckForPredefinedName (
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Check for the "special" predefined names -
|
||||
* _Lxx, _Exx, _Qxx, and _T_x
|
||||
* _Lxx, _Exx, _Qxx, _Wxx, and _T_x
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -541,14 +571,16 @@ ApCheckForSpecialName (
|
||||
{
|
||||
|
||||
/*
|
||||
* Check for the "special" predefined names. We know the first char is an
|
||||
* underscore already.
|
||||
* Check for the "special" predefined names. We already know that the
|
||||
* first character is an underscore.
|
||||
* GPE: _Lxx
|
||||
* GPE: _Exx
|
||||
* GPE: _Wxx
|
||||
* EC: _Qxx
|
||||
*/
|
||||
if ((Name[1] == 'L') ||
|
||||
(Name[1] == 'E') ||
|
||||
(Name[1] == 'W') ||
|
||||
(Name[1] == 'Q'))
|
||||
{
|
||||
/* The next two characters must be hex digits */
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslresource - Resource templates and descriptors
|
||||
* Module Name: aslresource - Resource template/descriptor utilities
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -124,6 +124,298 @@
|
||||
ACPI_MODULE_NAME ("aslresource")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsSmallAddressCheck
|
||||
*
|
||||
* PARAMETERS: Minimum - Address Min value
|
||||
* Maximum - Address Max value
|
||||
* Length - Address range value
|
||||
* Alignment - Address alignment value
|
||||
* MinOp - Original Op for Address Min
|
||||
* MaxOp - Original Op for Address Max
|
||||
* LengthOp - Original Op for address range
|
||||
* AlignOp - Original Op for address alignment. If
|
||||
* NULL, means "zero value for alignment is
|
||||
* OK, and means 64K alignment" (for
|
||||
* Memory24 descriptor)
|
||||
*
|
||||
* RETURN: None. Adds error messages to error log if necessary
|
||||
*
|
||||
* DESCRIPTION: Perform common value checks for "small" address descriptors.
|
||||
* Currently:
|
||||
* Io, Memory24, Memory32
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
RsSmallAddressCheck (
|
||||
UINT8 Type,
|
||||
UINT32 Minimum,
|
||||
UINT32 Maximum,
|
||||
UINT32 Length,
|
||||
UINT32 Alignment,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *AlignOp)
|
||||
{
|
||||
|
||||
if (Gbl_NoResourceChecking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Special case for Memory24, values are compressed */
|
||||
|
||||
if (Type == ACPI_RESOURCE_NAME_MEMORY24)
|
||||
{
|
||||
if (!Alignment) /* Alignment==0 means 64K - no invalid alignment */
|
||||
{
|
||||
Alignment = ACPI_UINT16_MAX + 1;
|
||||
}
|
||||
|
||||
Minimum <<= 8;
|
||||
Maximum <<= 8;
|
||||
Length *= 256;
|
||||
}
|
||||
|
||||
/* IO descriptor has different definition of min/max, don't check */
|
||||
|
||||
if (Type != ACPI_RESOURCE_NAME_IO)
|
||||
{
|
||||
/* Basic checks on Min/Max/Length */
|
||||
|
||||
if (Minimum > Maximum)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL);
|
||||
}
|
||||
else if (Length > (Maximum - Minimum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Alignment of zero is not in ACPI spec, but is used to mean byte acc */
|
||||
|
||||
if (!Alignment)
|
||||
{
|
||||
Alignment = 1;
|
||||
}
|
||||
|
||||
/* Addresses must be an exact multiple of the alignment value */
|
||||
|
||||
if (Minimum % Alignment)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL);
|
||||
}
|
||||
if (Maximum % Alignment)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsLargeAddressCheck
|
||||
*
|
||||
* PARAMETERS: Minimum - Address Min value
|
||||
* Maximum - Address Max value
|
||||
* Length - Address range value
|
||||
* Granularity - Address granularity value
|
||||
* Flags - General flags for address descriptors:
|
||||
* _MIF, _MAF, _DEC
|
||||
* MinOp - Original Op for Address Min
|
||||
* MaxOp - Original Op for Address Max
|
||||
* LengthOp - Original Op for address range
|
||||
* GranOp - Original Op for address granularity
|
||||
*
|
||||
* RETURN: None. Adds error messages to error log if necessary
|
||||
*
|
||||
* DESCRIPTION: Perform common value checks for "large" address descriptors.
|
||||
* Currently:
|
||||
* WordIo, WordBusNumber, WordSpace
|
||||
* DWordIo, DWordMemory, DWordSpace
|
||||
* QWordIo, QWordMemory, QWordSpace
|
||||
* ExtendedIo, ExtendedMemory, ExtendedSpace
|
||||
*
|
||||
* _MIF flag set means that the minimum address is fixed and is not relocatable
|
||||
* _MAF flag set means that the maximum address is fixed and is not relocatable
|
||||
* Length of zero means that the record size is variable
|
||||
*
|
||||
* This function implements the LEN/MIF/MAF/MIN/MAX/GRA rules within Table 6-40
|
||||
* of the ACPI 4.0a specification. Added 04/2010.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
RsLargeAddressCheck (
|
||||
UINT64 Minimum,
|
||||
UINT64 Maximum,
|
||||
UINT64 Length,
|
||||
UINT64 Granularity,
|
||||
UINT8 Flags,
|
||||
ACPI_PARSE_OBJECT *MinOp,
|
||||
ACPI_PARSE_OBJECT *MaxOp,
|
||||
ACPI_PARSE_OBJECT *LengthOp,
|
||||
ACPI_PARSE_OBJECT *GranOp)
|
||||
{
|
||||
|
||||
if (Gbl_NoResourceChecking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Basic checks on Min/Max/Length */
|
||||
|
||||
if (Minimum > Maximum)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL);
|
||||
return;
|
||||
}
|
||||
else if (Length > (Maximum - Minimum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If specified (non-zero), ensure granularity is a power-of-two minus one */
|
||||
|
||||
if (Granularity)
|
||||
{
|
||||
if ((Granularity + 1) &
|
||||
Granularity)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_GRANULARITY, GranOp, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the various combinations of Length, MinFixed, and MaxFixed
|
||||
*/
|
||||
if (Length)
|
||||
{
|
||||
/* Fixed non-zero length */
|
||||
|
||||
switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF))
|
||||
{
|
||||
case 0:
|
||||
/*
|
||||
* Fixed length, variable locations (both _MIN and _MAX).
|
||||
* Length must be a multiple of granularity
|
||||
*/
|
||||
if (Granularity & Length)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, LengthOp, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF):
|
||||
|
||||
/* Fixed length, fixed location. Granularity must be zero */
|
||||
|
||||
if (Granularity != 0)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_GRAN_FIXED, GranOp, NULL);
|
||||
}
|
||||
|
||||
/* Length must be exactly the size of the min/max window */
|
||||
|
||||
if (Length != (Maximum - Minimum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH_FIXED, LengthOp, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
/* All other combinations are invalid */
|
||||
|
||||
case ACPI_RESOURCE_FLAG_MIF:
|
||||
case ACPI_RESOURCE_FLAG_MAF:
|
||||
default:
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Variable length (length==0) */
|
||||
|
||||
switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF))
|
||||
{
|
||||
case 0:
|
||||
/*
|
||||
* Both _MIN and _MAX are variable.
|
||||
* No additional requirements, just exit
|
||||
*/
|
||||
break;
|
||||
|
||||
case ACPI_RESOURCE_FLAG_MIF:
|
||||
|
||||
/* _MIN is fixed. _MIN must be multiple of _GRA */
|
||||
|
||||
/*
|
||||
* The granularity is defined by the ACPI specification to be a
|
||||
* power-of-two minus one, therefore the granularity is a
|
||||
* bitmask which can be used to easily validate the addresses.
|
||||
*/
|
||||
if (Granularity & Minimum)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_RESOURCE_FLAG_MAF:
|
||||
|
||||
/* _MAX is fixed. (_MAX + 1) must be multiple of _GRA */
|
||||
|
||||
if (Granularity & (Maximum + 1))
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, "-1");
|
||||
}
|
||||
break;
|
||||
|
||||
/* Both MIF/MAF set is invalid if length is zero */
|
||||
|
||||
case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF):
|
||||
default:
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsGetStringDataLength
|
||||
*
|
||||
* PARAMETERS: InitializerOp - Start of a subtree of init nodes
|
||||
*
|
||||
* RETURN: Valid string length if a string node is found (otherwise 0)
|
||||
*
|
||||
* DESCRIPTION: In a list of peer nodes, find the first one that contains a
|
||||
* string and return the length of the string.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT16
|
||||
RsGetStringDataLength (
|
||||
ACPI_PARSE_OBJECT *InitializerOp)
|
||||
{
|
||||
|
||||
while (InitializerOp)
|
||||
{
|
||||
if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
|
||||
{
|
||||
return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1));
|
||||
}
|
||||
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsAllocateResourceNode
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype1 - Short (type1) resource templates and descriptors
|
||||
* Module Name: aslrestype1 - Miscellaneous small resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -121,6 +121,18 @@
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype1")
|
||||
|
||||
/*
|
||||
* This module contains miscellaneous small resource descriptors:
|
||||
*
|
||||
* EndTag
|
||||
* EndDependentFn
|
||||
* Memory24
|
||||
* Memory32
|
||||
* Memory32Fixed
|
||||
* StartDependentFn
|
||||
* StartDependentFnNoPri
|
||||
* VendorShort
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -156,127 +168,6 @@ RsDoEndTagDescriptor (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDmaDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "DMA" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
UINT8 DmaChannelMask = 0;
|
||||
UINT8 DmaChannels = 0;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
|
||||
ASL_RDESC_DMA_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* DMA type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
|
||||
break;
|
||||
|
||||
case 1: /* Bus Master */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* Xfer Type (transfer width) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All DMA channel bytes are handled here, after flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 8 channels can be specified in the list */
|
||||
|
||||
DmaChannels++;
|
||||
if (DmaChannels > 8)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only DMA channels 0-7 are allowed (mask is 8 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 7)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
|
||||
/* Build the mask */
|
||||
|
||||
DmaChannelMask |=
|
||||
(1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
|
||||
if (i == 4) /* case 4: First DMA byte */
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
|
||||
CurrentByteOffset +
|
||||
ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Dma.DmaChannelMask = DmaChannelMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoEndDependentDescriptor
|
||||
@ -309,396 +200,6 @@ RsDoEndDependentDescriptor (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoFixedIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "FixedIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
|
||||
ASL_RDESC_FIXED_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Base Address */
|
||||
|
||||
Descriptor->FixedIo.Address =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
|
||||
break;
|
||||
|
||||
case 1: /* Length */
|
||||
|
||||
Descriptor->FixedIo.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
|
||||
break;
|
||||
|
||||
case 2: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
|
||||
ASL_RDESC_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Decode size */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Min Address */
|
||||
|
||||
Descriptor->Io.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
|
||||
Descriptor->Io.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
|
||||
Descriptor->Io.Alignment =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
|
||||
Descriptor->Io.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQ" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
|
||||
|
||||
/* Length = 3 (with flag byte) */
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
(ASL_RDESC_IRQ_SIZE + 0x01);
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Interrupt Type (or Mode - edge/level) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Interrupt Level (or Polarity - Active high/low) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
|
||||
break;
|
||||
|
||||
case 2: /* Share Type - Default: exclusive (0) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 4: First IRQ value in list */
|
||||
|
||||
if (i == 4)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqNoFlagsDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQNoFlags" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
ASL_RDESC_IRQ_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 1: First IRQ value in list */
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the interrupt mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoMemory24Descriptor
|
||||
@ -720,6 +221,10 @@ RsDoMemory24Descriptor (
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *AlignOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
@ -749,6 +254,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
@ -756,6 +262,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
@ -763,6 +270,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
|
||||
AlignOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
@ -770,6 +278,7 @@ RsDoMemory24Descriptor (
|
||||
Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
@ -786,6 +295,15 @@ RsDoMemory24Descriptor (
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
|
||||
|
||||
RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
|
||||
Descriptor->Memory24.Minimum,
|
||||
Descriptor->Memory24.Maximum,
|
||||
Descriptor->Memory24.AddressLength,
|
||||
Descriptor->Memory24.Alignment,
|
||||
MinOp, MaxOp, LengthOp, NULL);
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
@ -811,6 +329,10 @@ RsDoMemory32Descriptor (
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *AlignOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
@ -840,6 +362,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
@ -847,6 +370,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
@ -854,6 +378,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
|
||||
AlignOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
@ -861,6 +386,7 @@ RsDoMemory32Descriptor (
|
||||
Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
@ -877,6 +403,15 @@ RsDoMemory32Descriptor (
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Align values */
|
||||
|
||||
RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
|
||||
Descriptor->Memory32.Minimum,
|
||||
Descriptor->Memory32.Maximum,
|
||||
Descriptor->Memory32.AddressLength,
|
||||
Descriptor->Memory32.Alignment,
|
||||
MinOp, MaxOp, LengthOp, AlignOp);
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
@ -1027,6 +562,7 @@ RsDoStartDependentDescriptor (
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
NextRnode = RsDoOneResourceDescriptor (InitializerOp,
|
||||
CurrentByteOffset, &State);
|
||||
|
||||
@ -1036,7 +572,6 @@ RsDoStartDependentDescriptor (
|
||||
* must keep track of the offset of not only each descriptor, but each
|
||||
* element (field) within each descriptor as well.
|
||||
*/
|
||||
|
||||
CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
|
||||
NextRnode);
|
||||
break;
|
||||
@ -1182,4 +717,3 @@ RsDoVendorSmallDescriptor (
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
|
668
sys/contrib/dev/acpica/compiler/aslrestype1i.c
Normal file
668
sys/contrib/dev/acpica/compiler/aslrestype1i.c
Normal file
@ -0,0 +1,668 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype1i - Small I/O-related resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype1i")
|
||||
|
||||
/*
|
||||
* This module contains the I/O-related small resource descriptors:
|
||||
*
|
||||
* DMA
|
||||
* FixedIO
|
||||
* IO
|
||||
* IRQ
|
||||
* IRQNoFlags
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDmaDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "DMA" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
UINT8 DmaChannelMask = 0;
|
||||
UINT8 DmaChannels = 0;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
|
||||
ASL_RDESC_DMA_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* DMA type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
|
||||
break;
|
||||
|
||||
case 1: /* Bus Master */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* Xfer Type (transfer width) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All DMA channel bytes are handled here, after flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 8 channels can be specified in the list */
|
||||
|
||||
DmaChannels++;
|
||||
if (DmaChannels > 8)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only DMA channels 0-7 are allowed (mask is 8 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 7)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
|
||||
/* Build the mask */
|
||||
|
||||
DmaChannelMask |=
|
||||
(1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
|
||||
if (i == 4) /* case 4: First DMA byte */
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
|
||||
CurrentByteOffset +
|
||||
ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Dma.DmaChannelMask = DmaChannelMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoFixedIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "FixedIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *AddressOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
|
||||
ASL_RDESC_FIXED_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Base Address */
|
||||
|
||||
Descriptor->FixedIo.Address =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
|
||||
AddressOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 1: /* Length */
|
||||
|
||||
Descriptor->FixedIo.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
|
||||
break;
|
||||
|
||||
case 2: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Error checks */
|
||||
|
||||
if (Descriptor->FixedIo.Address > 0x03FF)
|
||||
{
|
||||
AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
|
||||
}
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *AlignOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
|
||||
ASL_RDESC_IO_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Decode size */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Min Address */
|
||||
|
||||
Descriptor->Io.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 2: /* Max Address */
|
||||
|
||||
Descriptor->Io.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 3: /* Alignment */
|
||||
|
||||
Descriptor->Io.Alignment =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
|
||||
AlignOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 4: /* Length */
|
||||
|
||||
Descriptor->Io.AddressLength =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Align values */
|
||||
|
||||
RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
|
||||
Descriptor->Io.Minimum,
|
||||
Descriptor->Io.Maximum,
|
||||
Descriptor->Io.AddressLength,
|
||||
Descriptor->Io.Alignment,
|
||||
MinOp, MaxOp, LengthOp, AlignOp);
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQ" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
|
||||
|
||||
/* Length = 3 (with flag byte) */
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
(ASL_RDESC_IRQ_SIZE + 0x01);
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Interrupt Type (or Mode - edge/level) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Interrupt Level (or Polarity - Active high/low) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
|
||||
break;
|
||||
|
||||
case 2: /* Share Type - Default: exclusive (0) */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
|
||||
break;
|
||||
|
||||
case 3: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 4: First IRQ value in list */
|
||||
|
||||
if (i == 4)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the channel mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqNoFlagsDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQNoFlags" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 IrqMask = 0;
|
||||
UINT32 Interrupts = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
|
||||
ASL_RDESC_IRQ_SIZE;
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Name */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* IRQ bytes are handled here, after the flags and name */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Up to 16 interrupts can be specified in the list */
|
||||
|
||||
Interrupts++;
|
||||
if (Interrupts > 16)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
|
||||
InitializerOp, NULL);
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
|
||||
|
||||
if (InitializerOp->Asl.Value.Integer > 15)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
|
||||
}
|
||||
}
|
||||
|
||||
/* Case 1: First IRQ value in list */
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
/* Check now for duplicates in list */
|
||||
|
||||
RsCheckListForDuplicates (InitializerOp);
|
||||
|
||||
/* Create a named field at the start of the list */
|
||||
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Now we can set the interrupt mask */
|
||||
|
||||
Descriptor->Irq.IrqMask = IrqMask;
|
||||
return (Rnode);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
814
sys/contrib/dev/acpica/compiler/aslrestype2d.c
Normal file
814
sys/contrib/dev/acpica/compiler/aslrestype2d.c
Normal file
@ -0,0 +1,814 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2d - Large DWord address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2d")
|
||||
|
||||
/*
|
||||
* This module contains the Dword (32-bit) address space descriptors:
|
||||
*
|
||||
* DwordIO
|
||||
* DwordMemory
|
||||
* DwordSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDwordIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "DwordIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT8 *OptionalFields;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
|
||||
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS32) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->Address32.Granularity =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->Address32.Minimum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->Address32.Maximum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->Address32.TranslationOffset =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->Address32.AddressLength =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
/* Found a valid ResourceSourceIndex */
|
||||
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address32.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 11: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
/* Found a valid ResourceSource */
|
||||
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(Descriptor->Address32.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 13: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 14: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address32.Minimum,
|
||||
Descriptor->Address32.Maximum,
|
||||
Descriptor->Address32.AddressLength,
|
||||
Descriptor->Address32.Granularity,
|
||||
Descriptor->Address32.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDwordMemoryDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "DwordMemory" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
|
||||
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS32) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
|
||||
break;
|
||||
|
||||
case 2: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
|
||||
break;
|
||||
|
||||
case 3: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
|
||||
break;
|
||||
|
||||
case 4: /* Memory Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1);
|
||||
break;
|
||||
|
||||
case 5: /* Read/Write Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address32.Granularity =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address32.Minimum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address32.Maximum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address32.TranslationOffset =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address32.AddressLength =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address32.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(Descriptor->Address32.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
|
||||
case 14: /* Address Range */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3);
|
||||
break;
|
||||
|
||||
case 15: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address32.Minimum,
|
||||
Descriptor->Address32.Maximum,
|
||||
Descriptor->Address32.AddressLength,
|
||||
Descriptor->Address32.Granularity,
|
||||
Descriptor->Address32.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDwordSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "DwordSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS32) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->Address32.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->Address32.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address32.Granularity =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address32.Minimum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address32.Maximum =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address32.TranslationOffset =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address32.AddressLength =
|
||||
(UINT32) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address32.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address32.ResourceLength = (UINT16)
|
||||
(Descriptor->Address32.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST,
|
||||
InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address32.Minimum,
|
||||
Descriptor->Address32.Maximum,
|
||||
Descriptor->Address32.AddressLength,
|
||||
Descriptor->Address32.Granularity,
|
||||
Descriptor->Address32.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
646
sys/contrib/dev/acpica/compiler/aslrestype2e.c
Normal file
646
sys/contrib/dev/acpica/compiler/aslrestype2e.c
Normal file
@ -0,0 +1,646 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2e - Large Extended address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2e")
|
||||
|
||||
/*
|
||||
* This module contains the Extended (64-bit) address space descriptors:
|
||||
*
|
||||
* ExtendedIO
|
||||
* ExtendedMemory
|
||||
* ExtendedSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoExtendedIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "ExtendedIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
|
||||
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
|
||||
|
||||
Descriptor->ExtAddress64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* Type-Specific Attributes */
|
||||
|
||||
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
|
||||
break;
|
||||
|
||||
case 11: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 12: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 13: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->ExtAddress64.Minimum,
|
||||
Descriptor->ExtAddress64.Maximum,
|
||||
Descriptor->ExtAddress64.AddressLength,
|
||||
Descriptor->ExtAddress64.Granularity,
|
||||
Descriptor->ExtAddress64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoExtendedMemoryDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "ExtendedMemory" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
|
||||
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
|
||||
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
|
||||
|
||||
Descriptor->ExtAddress64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 2: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 3: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 4: /* Memory Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1);
|
||||
break;
|
||||
|
||||
case 5: /* Read/Write Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* Type-Specific Attributes */
|
||||
|
||||
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
|
||||
case 13: /* Address Range */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3);
|
||||
break;
|
||||
|
||||
case 14: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->ExtAddress64.Minimum,
|
||||
Descriptor->ExtAddress64.Maximum,
|
||||
Descriptor->ExtAddress64.AddressLength,
|
||||
Descriptor->ExtAddress64.Granularity,
|
||||
Descriptor->ExtAddress64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoExtendedSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "ExtendedSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoExtendedSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
|
||||
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
|
||||
|
||||
Descriptor->ExtAddress64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->ExtAddress64.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->ExtAddress64.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* Type-Specific Attributes */
|
||||
|
||||
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->ExtAddress64.Minimum,
|
||||
Descriptor->ExtAddress64.Maximum,
|
||||
Descriptor->ExtAddress64.AddressLength,
|
||||
Descriptor->ExtAddress64.Granularity,
|
||||
Descriptor->ExtAddress64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
|
||||
return (Rnode);
|
||||
}
|
793
sys/contrib/dev/acpica/compiler/aslrestype2q.c
Normal file
793
sys/contrib/dev/acpica/compiler/aslrestype2q.c
Normal file
@ -0,0 +1,793 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2q - Large QWord address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2q")
|
||||
|
||||
/*
|
||||
* This module contains the QWord (64-bit) address space descriptors:
|
||||
*
|
||||
* QWordIO
|
||||
* QWordMemory
|
||||
* QWordSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoQwordIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "QwordIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
|
||||
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address64.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 11: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(Descriptor->Address64.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 13: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 14: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address64.Minimum,
|
||||
Descriptor->Address64.Maximum,
|
||||
Descriptor->Address64.AddressLength,
|
||||
Descriptor->Address64.Granularity,
|
||||
Descriptor->Address64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoQwordMemoryDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "QwordMemory" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
|
||||
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 2: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 3: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 4: /* Memory Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1);
|
||||
break;
|
||||
|
||||
case 5: /* Read/Write Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 1);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address64.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(Descriptor->Address64.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
|
||||
case 14: /* Address Range */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3);
|
||||
break;
|
||||
|
||||
case 15: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address64.Minimum,
|
||||
Descriptor->Address64.Maximum,
|
||||
Descriptor->Address64.AddressLength,
|
||||
Descriptor->Address64.Granularity,
|
||||
Descriptor->Address64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoQwordSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "QwordSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS64) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->Address64.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->Address64.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address64.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address64.ResourceLength = (UINT16)
|
||||
(Descriptor->Address64.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address64.Minimum,
|
||||
Descriptor->Address64.Maximum,
|
||||
Descriptor->Address64.AddressLength,
|
||||
Descriptor->Address64.Granularity,
|
||||
Descriptor->Address64.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
774
sys/contrib/dev/acpica/compiler/aslrestype2w.c
Normal file
774
sys/contrib/dev/acpica/compiler/aslrestype2w.c
Normal file
@ -0,0 +1,774 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype2w - Large Word address resource descriptors
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <contrib/dev/acpica/compiler/aslcompiler.h>
|
||||
#include "aslcompiler.y.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
ACPI_MODULE_NAME ("aslrestype2w")
|
||||
|
||||
/*
|
||||
* This module contains the Word (16-bit) address space descriptors:
|
||||
*
|
||||
* WordIO
|
||||
* WordMemory
|
||||
* WordSpace
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoWordIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "WordIO" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
|
||||
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS16) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Range Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0);
|
||||
break;
|
||||
|
||||
case 5: /* Address Granularity */
|
||||
|
||||
Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Address Min */
|
||||
|
||||
Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Address Max */
|
||||
|
||||
Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Translation Offset */
|
||||
|
||||
Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 9: /* Address Length */
|
||||
|
||||
Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 10: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address16.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 11: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(Descriptor->Address16.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 12: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
case 13: /* Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 4, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4);
|
||||
break;
|
||||
|
||||
case 14: /* Translation Type */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address16.Minimum,
|
||||
Descriptor->Address16.Maximum,
|
||||
Descriptor->Address16.AddressLength,
|
||||
Descriptor->Address16.Granularity,
|
||||
Descriptor->Address16.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoWordBusNumberDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "WordBusNumber" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordBusNumberDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
|
||||
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS16) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 1: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
|
||||
break;
|
||||
|
||||
case 2: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
|
||||
break;
|
||||
|
||||
case 3: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
|
||||
break;
|
||||
|
||||
case 4: /* Address Granularity */
|
||||
|
||||
Descriptor->Address16.Granularity =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 5: /* Min Address */
|
||||
|
||||
Descriptor->Address16.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 6: /* Max Address */
|
||||
|
||||
Descriptor->Address16.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Translation Offset */
|
||||
|
||||
Descriptor->Address16.TranslationOffset =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 8: /* Address Length */
|
||||
|
||||
Descriptor->Address16.AddressLength =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address16.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(Descriptor->Address16.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 11: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address16.Minimum,
|
||||
Descriptor->Address16.Maximum,
|
||||
Descriptor->Address16.AddressLength,
|
||||
Descriptor->Address16.Granularity,
|
||||
Descriptor->Address16.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoWordSpaceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
*
|
||||
* DESCRIPTION: Construct a long "WordSpace" descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordSpaceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset)
|
||||
{
|
||||
AML_RESOURCE *Descriptor;
|
||||
ACPI_PARSE_OBJECT *InitializerOp;
|
||||
ACPI_PARSE_OBJECT *MinOp = NULL;
|
||||
ACPI_PARSE_OBJECT *MaxOp = NULL;
|
||||
ACPI_PARSE_OBJECT *LengthOp = NULL;
|
||||
ACPI_PARSE_OBJECT *GranOp = NULL;
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
UINT8 *OptionalFields;
|
||||
UINT16 StringLength = 0;
|
||||
UINT32 OptionIndex = 0;
|
||||
UINT32 i;
|
||||
BOOLEAN ResSourceIndex = FALSE;
|
||||
|
||||
|
||||
InitializerOp = Op->Asl.Child;
|
||||
StringLength = RsGetStringDataLength (InitializerOp);
|
||||
|
||||
Rnode = RsAllocateResourceNode (
|
||||
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
|
||||
|
||||
/*
|
||||
* Initial descriptor length -- may be enlarged if there are
|
||||
* optional fields present
|
||||
*/
|
||||
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(sizeof (AML_RESOURCE_ADDRESS16) -
|
||||
sizeof (AML_RESOURCE_LARGE_HEADER));
|
||||
|
||||
/* Process all child initialization nodes */
|
||||
|
||||
for (i = 0; InitializerOp; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: /* Resource Type */
|
||||
|
||||
Descriptor->Address16.ResourceType =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 1: /* Resource Usage */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
|
||||
break;
|
||||
|
||||
case 2: /* DecodeType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
|
||||
break;
|
||||
|
||||
case 3: /* MinType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
|
||||
break;
|
||||
|
||||
case 4: /* MaxType */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
|
||||
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
|
||||
break;
|
||||
|
||||
case 5: /* Type-Specific flags */
|
||||
|
||||
Descriptor->Address16.SpecificFlags =
|
||||
(UINT8) InitializerOp->Asl.Value.Integer;
|
||||
break;
|
||||
|
||||
case 6: /* Address Granularity */
|
||||
|
||||
Descriptor->Address16.Granularity =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
|
||||
GranOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 7: /* Min Address */
|
||||
|
||||
Descriptor->Address16.Minimum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
|
||||
MinOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 8: /* Max Address */
|
||||
|
||||
Descriptor->Address16.Maximum =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
|
||||
MaxOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 9: /* Translation Offset */
|
||||
|
||||
Descriptor->Address16.TranslationOffset =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
|
||||
break;
|
||||
|
||||
case 10: /* Address Length */
|
||||
|
||||
Descriptor->Address16.AddressLength =
|
||||
(UINT16) InitializerOp->Asl.Value.Integer;
|
||||
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
|
||||
LengthOp = InitializerOp;
|
||||
break;
|
||||
|
||||
case 11: /* ResSourceIndex [Optional Field - BYTE] */
|
||||
|
||||
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
||||
{
|
||||
OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
|
||||
OptionIndex++;
|
||||
Descriptor->Address16.ResourceLength++;
|
||||
ResSourceIndex = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* ResSource [Optional Field - STRING] */
|
||||
|
||||
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
|
||||
(InitializerOp->Asl.Value.String))
|
||||
{
|
||||
if (StringLength)
|
||||
{
|
||||
Descriptor->Address16.ResourceLength = (UINT16)
|
||||
(Descriptor->Address16.ResourceLength + StringLength);
|
||||
|
||||
strcpy ((char *)
|
||||
&OptionalFields[OptionIndex],
|
||||
InitializerOp->Asl.Value.String);
|
||||
|
||||
/* ResourceSourceIndex must also be valid */
|
||||
|
||||
if (!ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Not a valid ResourceSource, ResourceSourceIndex must also
|
||||
* be invalid
|
||||
*/
|
||||
else if (ResSourceIndex)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
|
||||
InitializerOp, NULL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13: /* ResourceTag */
|
||||
|
||||
UtAttachNamepathToOwner (Op, InitializerOp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
|
||||
}
|
||||
|
||||
/* Validate the Min/Max/Len/Gran values */
|
||||
|
||||
RsLargeAddressCheck (
|
||||
Descriptor->Address16.Minimum,
|
||||
Descriptor->Address16.Maximum,
|
||||
Descriptor->Address16.AddressLength,
|
||||
Descriptor->Address16.Granularity,
|
||||
Descriptor->Address16.Flags,
|
||||
MinOp, MaxOp, LengthOp, GranOp);
|
||||
|
||||
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
|
||||
OptionIndex + StringLength;
|
||||
return (Rnode);
|
||||
}
|
@ -420,7 +420,16 @@ typedef enum
|
||||
ASL_MSG_SERIALIZED,
|
||||
ASL_MSG_COMPILER_RESERVED,
|
||||
ASL_MSG_NAMED_OBJECT_IN_WHILE,
|
||||
ASL_MSG_LOCAL_OUTSIDE_METHOD
|
||||
ASL_MSG_LOCAL_OUTSIDE_METHOD,
|
||||
ASL_MSG_ALIGNMENT,
|
||||
ASL_MSG_ISA_ADDRESS,
|
||||
ASL_MSG_INVALID_MIN_MAX,
|
||||
ASL_MSG_INVALID_LENGTH,
|
||||
ASL_MSG_INVALID_LENGTH_FIXED,
|
||||
ASL_MSG_INVALID_GRANULARITY,
|
||||
ASL_MSG_INVALID_GRAN_FIXED,
|
||||
ASL_MSG_INVALID_ACCESS_SIZE,
|
||||
ASL_MSG_INVALID_ADDR_FLAGS
|
||||
|
||||
} ASL_MESSAGE_IDS;
|
||||
|
||||
@ -540,7 +549,16 @@ char *AslMessages [] = {
|
||||
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
|
||||
/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
|
||||
/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
|
||||
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method"
|
||||
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method",
|
||||
/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value",
|
||||
/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)",
|
||||
/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max",
|
||||
/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window",
|
||||
/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window",
|
||||
/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
|
||||
/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
|
||||
/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
|
||||
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags"
|
||||
|
||||
};
|
||||
|
||||
|
@ -675,7 +675,7 @@ AcpiDbDisplayTableInfo (
|
||||
|
||||
/* Walk the entire root table list */
|
||||
|
||||
for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
|
||||
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
|
||||
{
|
||||
TableDesc = &AcpiGbl_RootTableList.Tables[i];
|
||||
AcpiOsPrintf ("%d ", i);
|
||||
|
@ -816,6 +816,7 @@ AcpiDbDisplayGpes (
|
||||
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
|
||||
ACPI_GPE_EVENT_INFO *GpeEventInfo;
|
||||
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
|
||||
char *GpeType;
|
||||
UINT32 GpeIndex;
|
||||
UINT32 Block = 0;
|
||||
UINT32 i;
|
||||
@ -844,8 +845,17 @@ AcpiDbDisplayGpes (
|
||||
AcpiOsPrintf ("Could not convert name to pathname\n");
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n",
|
||||
Block, GpeBlock, GpeBlock->Node, Buffer);
|
||||
if (GpeBlock->Node == AcpiGbl_FadtGpeDevice)
|
||||
{
|
||||
GpeType = "FADT-defined GPE block";
|
||||
}
|
||||
else
|
||||
{
|
||||
GpeType = "GPE Block Device";
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s] - %s\n",
|
||||
Block, GpeBlock, GpeBlock->Node, Buffer, GpeType);
|
||||
|
||||
AcpiOsPrintf (" Registers: %u (%u GPEs)\n",
|
||||
GpeBlock->RegisterCount, GpeBlock->GpeCount);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user