New sources layout

Change-Id: Ic716f336b7071063997cf5b4dae6d50e0b4631e9
This commit is contained in:
2014-07-28 21:19:37 +02:00
parent 428aa25dc6
commit 433d6423c3
3138 changed files with 693 additions and 606 deletions

View File

@@ -37,11 +37,6 @@ INCS+= ssp/ssp.h ssp/stdio.h ssp/string.h ssp/strings.h ssp/unistd.h
INCS+= ieeefp.h
.endif
.if defined(__MINIX)
# MINIX Specific headers.
INCS+= env.h fetch.h lib.h libutil.h varargs.h
.endif
.include <bsd.own.mk>
@@ -50,17 +45,11 @@ INCSDIR= /usr/include
.if defined(__MINIX)
# RPC is not compiled in the libc. This include also needs
# rpcgen, which can be compiled if needed.
SUBDIR+= ../minix/include
.else
SUBDIR= rpc
.endif # defined(__MINIX)
SUBDIR+= ../common/include/prop
.if defined(__MINIX)
SUBDIR+= arch sys minix
SUBDIR+= net
SUBDIR+= ddekit
SUBDIR+= libdde
.endif # defined(__MINIX)
SUBDIR+= ../common/include/ppath
.include <bsd.prog.mk>

View File

@@ -1,5 +0,0 @@
.include <bsd.own.mk>
SUBDIR= ${MACHINE_ARCH}
.include <bsd.subdir.mk>

View File

@@ -1,4 +0,0 @@
SUBDIR= include
.include <bsd.subdir.mk>

View File

@@ -1,8 +0,0 @@
INCSDIR= /usr/include/arm
INCS= archconst.h archtypes.h diskparm.h elf.h interrupt.h \
ipcconst.h memory.h multiboot.h partition.h \
stackframe.h vm.h
.include <bsd.kinc.mk>

View File

@@ -1,6 +0,0 @@
#ifndef _ARM_CONST_H
#define _ARM_CONST_H
#define DEFAULT_HZ 1000
#endif /* #ifndef _ARM_CONST_H */

View File

@@ -1,27 +0,0 @@
#ifndef _ARM_TYPES_H
#define _ARM_TYPES_H
#include <minix/sys_config.h>
#include <machine/stackframe.h>
#include <sys/cdefs.h>
typedef struct segframe {
reg_t p_ttbr; /* page table root */
u32_t *p_ttbr_v;
char *fpu_state;
} segframe_t;
struct cpu_info {
u32_t arch;
u32_t implementer;
u32_t part;
u32_t variant;
u32_t freq; /* in MHz */
u32_t revision;
};
typedef u32_t atomic_t; /* access to an aligned 32bit value is atomic on ARM */
#endif /* #ifndef _ARM_TYPES_H */

View File

@@ -1,20 +0,0 @@
/* PC (and AT) BIOS structure to hold disk parameters. Under Minix, it is
* used mainly for formatting.
*/
#ifndef _DISKPARM_H
#define _DISKPARM_H
struct disk_parameter_s {
char spec1;
char spec2;
char motor_turnoff_sec;
char sector_size_code;
char sectors_per_cylinder;
char gap_length;
char dtl;
char gap_length_for_format;
char fill_byte_for_format;
char head_settle_msec;
char motor_start_eigth_sec;
};
#endif /* _DISKPARM_H */

View File

@@ -1,42 +0,0 @@
/*-
* Copyright (c) 1996-1997 John D. Polstra.
* 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 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 _MACHINE_ELF_H_
#define _MACHINE_ELF_H_ 1
/*
* ELF definitions for the ARM architecture.
*/
/* Define "machine" characteristics */
#define ELF_TARG_CLASS ELFCLASS32
#define ELF_TARG_DATA ELFDATA2LSB
#define ELF_TARG_MACH EM_ARM
#define ELF_TARG_VER 1
#endif /* !_MACHINE_ELF_H_ */

View File

@@ -1,8 +0,0 @@
/* Interrupt numbers and hardware vectors. */
#ifndef _INTERRUPT_H
#define _INTERRUPT_H
#define NR_IRQ_VECTORS 125
#endif /* _INTERRUPT_H */

View File

@@ -1,9 +0,0 @@
#ifndef _ARM_IPCCONST_H_
#define _ARM_IPCCONST_H_
#define KERVEC_INTR 32 /* syscall trap to kernel */
#define IPCVEC_INTR 33 /* ipc trap to kernel */
#define IPC_STATUS_REG r1
#endif /* _ARM_IPCCONST_H_ */

View File

@@ -1,10 +0,0 @@
/* Physical memory layout */
#ifndef _ARM_MEMORY_H
#define _ARM_MEMORY_H
/* omap */
#define PHYS_MEM_BEGIN 0x80000000
#define PHYS_MEM_END 0xbfffffff
#endif /* _ARM_MEMORY_H */

View File

@@ -1,351 +0,0 @@
/* $NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $ */
/*-
* Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julio M. Merino Vidal.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#ifndef __MULTIBOOT_H__
#define __MULTIBOOT_H__
#if !defined(_KERNEL) && defined(_STANDALONE)
/* --------------------------------------------------------------------- */
/*
* Multiboot header structure.
*/
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
#define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001
#define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002
#define MULTIBOOT_HEADER_HAS_VBE 0x00000004
#define MULTIBOOT_HEADER_HAS_ADDR 0x00010000
#if !defined(_LOCORE)
struct multiboot_header {
uint32_t mh_magic;
uint32_t mh_flags;
uint32_t mh_checksum;
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
paddr_t mh_header_addr;
paddr_t mh_load_addr;
paddr_t mh_load_end_addr;
paddr_t mh_bss_end_addr;
paddr_t mh_entry_addr;
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
uint32_t mh_mode_type;
uint32_t mh_width;
uint32_t mh_height;
uint32_t mh_depth;
};
#endif /* !defined(_LOCORE) */
/*
* Symbols defined in locore.S.
*/
#if !defined(_LOCORE) && defined(_KERNEL)
extern struct multiboot_header *Multiboot_Header;
#endif /* !defined(_LOCORE) && defined(_KERNEL) */
/* --------------------------------------------------------------------- */
/*
* Multiboot information structure.
*/
#define MULTIBOOT_INFO_MAGIC 0x2BADB002
#define MULTIBOOT_INFO_HAS_MEMORY 0x00000001
#define MULTIBOOT_INFO_HAS_BOOT_DEVICE 0x00000002
#define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004
#define MULTIBOOT_INFO_HAS_MODS 0x00000008
#define MULTIBOOT_INFO_HAS_AOUT_SYMS 0x00000010
#define MULTIBOOT_INFO_HAS_ELF_SYMS 0x00000020
#define MULTIBOOT_INFO_HAS_MMAP 0x00000040
#define MULTIBOOT_INFO_HAS_DRIVES 0x00000080
#define MULTIBOOT_INFO_HAS_CONFIG_TABLE 0x00000100
#define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200
#define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400
#define MULTIBOOT_INFO_HAS_VBE 0x00000800
#if !defined(_LOCORE)
struct multiboot_info {
uint32_t mi_flags;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
uint32_t mi_mem_lower;
uint32_t mi_mem_upper;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
uint8_t mi_boot_device_part3;
uint8_t mi_boot_device_part2;
uint8_t mi_boot_device_part1;
uint8_t mi_boot_device_drive;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
char * mi_cmdline;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
uint32_t mi_mods_count;
vaddr_t mi_mods_addr;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
uint32_t mi_elfshdr_num;
uint32_t mi_elfshdr_size;
vaddr_t mi_elfshdr_addr;
uint32_t mi_elfshdr_shndx;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
uint32_t mi_mmap_length;
vaddr_t mi_mmap_addr;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
uint32_t mi_drives_length;
vaddr_t mi_drives_addr;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
void * unused_mi_config_table;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
char * mi_loader_name;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
void * unused_mi_apm_table;
/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
void * unused_mi_vbe_control_info;
void * unused_mi_vbe_mode_info;
paddr_t unused_mi_vbe_interface_seg;
paddr_t unused_mi_vbe_interface_off;
uint32_t unused_mi_vbe_interface_len;
};
/* --------------------------------------------------------------------- */
/*
* Drive information. This describes an entry in the drives table as
* pointed to by mi_drives_addr.
*/
struct multiboot_drive {
uint32_t md_length;
uint8_t md_number;
uint8_t md_mode;
uint16_t md_cylinders;
uint8_t md_heads;
uint8_t md_sectors;
/* The variable-sized 'ports' field comes here, so this structure
* can be longer. */
};
/* --------------------------------------------------------------------- */
/*
* Memory mapping. This describes an entry in the memory mappings table
* as pointed to by mi_mmap_addr.
*
* Be aware that mm_size specifies the size of all other fields *except*
* for mm_size. In order to jump between two different entries, you
* have to count mm_size + 4 bytes.
*/
struct multiboot_mmap {
uint32_t mm_size;
uint64_t mm_base_addr;
uint64_t mm_length;
uint32_t mm_type;
};
/*
* Modules. This describes an entry in the modules table as pointed
* to by mi_mods_addr.
*/
struct multiboot_module {
uint32_t mmo_start;
uint32_t mmo_end;
char * mmo_string;
uint32_t mmo_reserved;
};
#endif /* !defined(_LOCORE) */
/* --------------------------------------------------------------------- */
/*
* Prototypes for public functions defined in multiboot.c.
*/
#if !defined(_LOCORE) && defined(_KERNEL)
void multiboot_pre_reloc(struct multiboot_info *);
void multiboot_post_reloc(void);
void multiboot_print_info(void);
bool multiboot_ksyms_addsyms_elf(void);
#endif /* !defined(_LOCORE) */
/* --------------------------------------------------------------------- */
#else /* !defined(_KERNEL) && defined(_STANDALONE) */
/* LSC FIXME: OLD MINIX DEFINITION: should be removed and replace with
definition above... */
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
/* Must pass memory information to OS. */
#define MULTIBOOT_PAGE_ALIGN 0x00000001
#define MULTIBOOT_MEMORY_INFO 0x00000002
#define MULTIBOOT_VIDEO_MODE 0x00000004
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
/* consts used for Multiboot pre-init */
#define MULTIBOOT_VIDEO_MODE_EGA 1
#define MULTIBOOT_VIDEO_BUFFER 0xB8000
/* Usable lower memory chunk has a upper bound */
#define MULTIBOOT_LOWER_MEM_MAX 0x7f800
#define MULTIBOOT_CONSOLE_LINES 25
#define MULTIBOOT_CONSOLE_COLS 80
#define MULTIBOOT_VIDEO_BUFFER_BYTES \
(MULTIBOOT_CONSOLE_LINES*MULTIBOOT_CONSOLE_COLS*2)
#define MULTIBOOT_STACK_SIZE 4096
#define MULTIBOOT_PARAM_BUF_SIZE 1024
#define MULTIBOOT_MAX_MODS 20
/* Flags to be set in the flags member of the multiboot info structure. */
#define MULTIBOOT_INFO_MEMORY 0x00000001
#define MULTIBOOT_INFO_MEM_MAP 0x00000040
/* Is there a boot device set? */
#define MULTIBOOT_INFO_BOOTDEV 0x00000002
/* Is the command-line defined? */
#define MULTIBOOT_INFO_CMDLINE 0x00000004
/* Are there modules to do something with? */
#define MULTIBOOT_INFO_MODS 0x00000008
#define MULTIBOOT_HIGH_MEM_BASE 0x100000
#ifndef __ASSEMBLY__
#include <sys/types.h>
/* The symbol table for a.out. */
struct multiboot_aout_symbol_table
{
u32_t tabsize;
u32_t strsize;
u32_t addr;
u32_t reserved;
};
/* The section header table for ELF. */
struct multiboot_elf_section_header_table
{
u32_t num;
u32_t size;
u32_t addr;
u32_t shndx;
};
typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
struct multiboot_info
{
/* Multiboot info version number */
u32_t flags;
/* Available memory from BIOS */
u32_t mem_lower_unused; /* minix uses memmap instead */
u32_t mem_upper_unused;
/* "root" partition */
u32_t boot_device;
/* Kernel command line */
u32_t cmdline;
/* Boot-Module list */
u32_t mi_mods_count;
u32_t mods_addr;
union
{
multiboot_aout_symbol_table_t aout_sym;
multiboot_elf_section_header_table_t elf_sec;
} u;
/* Memory Mapping buffer */
u32_t mmap_length;
u32_t mmap_addr;
/* Drive Info buffer */
u32_t drives_length;
u32_t drives_addr;
/* ROM configuration table */
u32_t config_table;
/* Boot Loader Name */
u32_t boot_loader_name;
/* APM table */
u32_t apm_table;
/* Video */
u32_t vbe_control_info;
u32_t vbe_mode_info;
u16_t vbe_mode;
u16_t vbe_interface_seg;
u16_t vbe_interface_off;
u16_t vbe_interface_len;
};
typedef struct multiboot_info multiboot_info_t;
struct multiboot_mod_list
{
/* Memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
u32_t mod_start;
u32_t mod_end;
/* Module command line */
u32_t cmdline;
/* Pad struct to 16 bytes (must be zero) */
u32_t pad;
};
typedef struct multiboot_mod_list multiboot_module_t;
#define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2
struct multiboot_mmap_entry
{
u32_t size;
u64_t mm_base_addr;
u64_t mm_length;
#define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2
u32_t type;
} __attribute__((packed));
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
#endif /* __ASSEMBLY__ */
#endif /* !defined(_KERNEL) && defined(_STANDALONE) */
#endif /* __MULTIBOOT_H__ */

View File

@@ -1,28 +0,0 @@
/* Description of entry in partition table. */
#ifndef _PARTITION_H
#define _PARTITION_H
#include <stdint.h>
struct part_entry {
uint8_t bootind; /* boot indicator 0/ACTIVE_FLAG */
uint8_t start_head; /* head value for first sector */
uint8_t start_sec; /* sector value + cyl bits for first sector */
uint8_t start_cyl; /* track value for first sector */
uint8_t sysind; /* system indicator */
uint8_t last_head; /* head value for last sector */
uint8_t last_sec; /* sector value + cyl bits for last sector */
uint8_t last_cyl; /* track value for last sector */
uint32_t lowsec; /* logical first sector */
uint32_t size; /* size of partition in sectors */
};
#define ACTIVE_FLAG 0x80 /* value for active in bootind field (hd0) */
#define NR_PARTITIONS 4 /* number of entries in partition table */
#define PART_TABLE_OFF 0x1BE /* offset of partition table in boot sector */
/* Partition types. */
#define NO_PART 0x00 /* unused entry */
#define MINIX_PART 0x81 /* Minix partition type */
#endif /* _PARTITION_H */

View File

@@ -1,28 +0,0 @@
#ifndef _ARM_STACKFRAME_H
#define _ARM_STACKFRAME_H
#include <sys/types.h>
typedef u32_t reg_t; /* machine register */
struct stackframe_s {
reg_t retreg; /* r0 */
reg_t r1;
reg_t r2;
reg_t r3;
reg_t r4;
reg_t r5;
reg_t r6;
reg_t r7;
reg_t r8;
reg_t r9; /* sb */
reg_t r10; /* sl */
reg_t fp; /* r11 */
reg_t r12; /* ip */
reg_t sp; /* r13 */
reg_t lr; /* r14 */
reg_t pc; /* r15 */
reg_t psr;
};
#endif /* _ARM_STACKFRAME_H */

View File

@@ -1,196 +0,0 @@
#ifndef __SYS_VM_ARM_H__
#define __SYS_VM_ARM_H__
/*
arm/vm.h
*/
/*
* We are using the following setup
* the system is configured to have the TRE (Tex remap enable bit) set to 0
* The TEX[2:0] B and C bits are used to determins memory attributes.
* These bits together with the S Bit (Shareability Bit) determines the
* memory attributes.
*
* The S bit is ignored when the other attribute define the memory as
* "device" or "strongly ordered"
*
* We are setting the tex[2] bit to one to end up with the following
* encoding
*
* 00 00 Non cacheable
* 01 01 Write back, Write allocate
* 10 10 Write trough, No write allocate
* 11 11 Write back , Write alloc
*/
#define ARM_PAGE_SIZE 4096 /* small page on ARM */
#define ARM_SECTION_SIZE (1024 * 1024) /* 1 MB section */
/* Second level page table entries */
#define ARM_VM_PAGETABLE (1 << 1) /* Page table */
#define ARM_VM_PTE_PRESENT (1 << 1) /* Page is present */
#define ARM_VM_PTE_B (1 << 2) /* B bit */
#define ARM_VM_PTE_C (1 << 3) /* C bit */
#define ARM_VM_PTE_SUPER (0x1 << 4) /* Super access only AP[1:0] */
#define ARM_VM_PTE_USER (0x3 << 4) /* Super/User access AP[1:0] */
#define ARM_VM_PTE_TEX0 (1 << 6) /* TEX[0] */
#define ARM_VM_PTE_TEX1 (1 << 7) /* TEX[1] */
#define ARM_VM_PTE_TEX2 (1 << 8) /* TEX[2] */
#define ARM_VM_PTE_RO (1 << 9) /* Read only access AP[2] */
#define ARM_VM_PTE_RW (0 << 9) /* Read-write access AP[2] */
#define ARM_VM_PTE_S (1 << 10) /* "Shareable" */
#define ARM_VM_PTE_NOTGLOBAL (1 << 11) /* Not Global */
/* inner and outer write-back, write-allocate */
#define ARM_VM_PTE_WB (ARM_VM_PTE_TEX2 | ARM_VM_PTE_TEX0 | ARM_VM_PTE_B)
/* inner and outer write-through, no write-allocate */
#define ARM_VM_PTE_WT (ARM_VM_PTE_TEX2 | ARM_VM_PTE_TEX1 | ARM_VM_PTE_C )
/* Inner , Write through, No Write Allocate Outer - Write Back, Write Allocate */
#define ARM_VM_PTE_WTWB (ARM_VM_PTE_TEX2 | ARM_VM_PTE_TEX0 | ARM_VM_PTE_C )
#define ARM_VM_PTE_CACHED ARM_VM_PTE_WTWB
/* shareable device */
#define ARM_VM_PTE_DEVICE (ARM_VM_PTE_B)
#define ARM_VM_ADDR_MASK 0xFFFFF000 /* physical address */
#define ARM_VM_ADDR_MASK_1MB 0xFFF00000 /* physical address */
#define ARM_VM_OFFSET_MASK_1MB 0x000FFFFF /* physical address */
/* Big page (1MB section) specific flags. */
#define ARM_VM_SECTION (1 << 1) /* 1MB section */
#define ARM_VM_SECTION_PRESENT (1 << 1) /* Section is present */
#define ARM_VM_SECTION_B (1 << 2) /* B Bit */
#define ARM_VM_SECTION_C (1 << 3) /* C Bit */
#define ARM_VM_SECTION_DOMAIN (0xF << 5) /* Domain Number */
#define ARM_VM_SECTION_SUPER (0x1 << 10) /* Super access only AP[1:0] */
#define ARM_VM_SECTION_USER (0x3 << 10) /* Super/User access AP[1:0] */
#define ARM_VM_SECTION_TEX0 (1 << 12) /* TEX[0] */
#define ARM_VM_SECTION_TEX1 (1 << 13) /* TEX[1] */
#define ARM_VM_SECTION_TEX2 (1 << 14) /* TEX[2] */
#define ARM_VM_SECTION_RO (1 << 15) /* Read only access AP[2] */
#define ARM_VM_SECTION_SHAREABLE (1 << 16) /* Shareable */
#define ARM_VM_SECTION_NOTGLOBAL (1 << 17) /* Not Global */
/* inner and outer write-back, write-allocate */
#define ARM_VM_SECTION_WB (ARM_VM_SECTION_TEX2 | ARM_VM_SECTION_TEX0 | ARM_VM_SECTION_B )
/* inner and outer write-through, no write-allocate */
#define ARM_VM_SECTION_WT (ARM_VM_SECTION_TEX2 | ARM_VM_SECTION_TEX1 | ARM_VM_SECTION_C )
/* Inner , Write through, No Write Allocate Outer - Write Back, Write Allocate */
#define ARM_VM_SECTION_WTWB (ARM_VM_SECTION_TEX2 | ARM_VM_SECTION_TEX0 | ARM_VM_SECTION_C )
/* shareable device */
#define ARM_VM_SECTION_CACHED ARM_VM_SECTION_WTWB
#define ARM_VM_SECTION_DEVICE (ARM_VM_SECTION_B)
/* Page directory specific flags. */
#define ARM_VM_PAGEDIR (1 << 0) /* Page directory */
#define ARM_VM_PDE_PRESENT (1 << 0) /* Page directory is present */
#define ARM_VM_PDE_DOMAIN (0xF << 5) /* Domain Number */
#define ARM_VM_PT_ENT_SIZE 4 /* Size of a page table entry */
#define ARM_VM_DIR_ENT_SIZE 4 /* Size of a page dir entry */
#define ARM_VM_DIR_ENTRIES 4096 /* Number of entries in a page dir */
#define ARM_VM_DIR_ENT_SHIFT 20 /* Shift to get entry in page dir. */
#define ARM_VM_PT_ENT_SHIFT 12 /* Shift to get entry in page table */
#define ARM_VM_PT_ENT_MASK 0xFF /* Mask to get entry in page table */
#define ARM_VM_PT_ENTRIES 256 /* Number of entries in a page table */
#define ARM_VM_PTE(v) (((v) >> ARM_VM_PT_ENT_SHIFT) & ARM_VM_PT_ENT_MASK)
#define ARM_VM_PDE(v) ( (v) >> ARM_VM_DIR_ENT_SHIFT)
#define ARM_VM_PFA(e) ( (e) & ARM_VM_ADDR_MASK)
/* Second level small pages entry(Page Table Entry) points to 4K */
#define ARM_VM_PTE_SHIFT 12
#define ARM_VM_PTE_MASK (~((1 << ARM_VM_PTE_SHIFT) - 1))
/* First level entry(Page Directory Entry) to a second level small page PTE */
#define ARM_VM_PDE_SHIFT 10
#define ARM_VM_PDE_MASK (~((1 << ARM_VM_PDE_SHIFT) - 1))
/* First level entry(Page Directory Entry) to a 1MB section */
#define ARM_VM_SECTION_SHIFT 20
#define ARM_VM_SECTION_MASK (~((1 << ARM_VM_SECTION_SHIFT) - 1))
#define ARM_VM_DIR_SIZE (ARM_VM_DIR_ENTRIES * ARM_VM_DIR_ENT_SIZE)
#define ARM_PAGEDIR_SIZE (ARM_VM_DIR_SIZE)
#define ARM_VM_PT_SIZE (ARM_VM_PT_ENTRIES * ARM_VM_PT_ENT_SIZE)
#define ARM_PAGETABLE_SIZE (ARM_VM_PT_SIZE)
/* ARM pagefault status bits */
#define ARM_VM_PFE_ALIGN 0x01 /* Pagefault caused by Alignment fault */
#define ARM_VM_PFE_IMAINT 0x04 /* Caused by Instruction cache
maintenance fault */
#define ARM_VM_PFE_TTWALK_L1ABORT 0x0c /* Caused by Synchronous external abort
* on translation table walk (Level 1)
*/
#define ARM_VM_PFE_TTWALK_L2ABORT 0x0e /* Caused by Synchronous external abort
* on translation table walk (Level 2)
*/
#define ARM_VM_PFE_TTWALK_L1PERR 0x1c /* Caused by Parity error
* on translation table walk (Level 1)
*/
#define ARM_VM_PFE_TTWALK_L2PERR 0x1e /* Caused by Parity error
* on translation table walk (Level 2)
*/
#define ARM_VM_PFE_L1TRANS 0x05 /* Caused by Translation fault (Level 1)
*/
#define ARM_VM_PFE_L2TRANS 0x07 /* Caused by Translation fault (Level 2)
*/
#define ARM_VM_PFE_L1ACCESS 0x03 /* Caused by Access flag fault (Level 1)
*/
#define ARM_VM_PFE_L2ACCESS 0x06 /* Caused by Access flag fault (Level 2)
*/
#define ARM_VM_PFE_L1DOMAIN 0x09 /* Caused by Domain fault (Level 1)
*/
#define ARM_VM_PFE_L2DOMAIN 0x0b /* Caused by Domain fault (Level 2)
*/
#define ARM_VM_PFE_L1PERM 0x0d /* Caused by Permission fault (Level 1)
*/
#define ARM_VM_PFE_L2PERM 0x0f /* Caused by Permission fault (Level 2)
*/
#define ARM_VM_PFE_DEBUG 0x02 /* Caused by Debug event */
#define ARM_VM_PFE_ABORT 0x08 /* Caused by Synchronous external abort
*/
#define ARM_VM_PFE_TLB_CONFLICT 0x10 /* Caused by TLB conflict abort
*/
#define ARM_VM_PFE_W (1<<11) /* Caused by write (otherwise read) */
#define ARM_VM_PFE_FS4 (1<<10) /* Fault status (bit 4) */
#define ARM_VM_PFE_FS3_0 0xf /* Fault status (bits 3:0) */
/* Translation table base register specfic flags */
#define ARM_TTBR_C (0x01) /* Cacheable bit. Indicates whether the translation table walk is to Inner Cacheable memory. */
/* RGN bits[4:3] indicates the Outer cacheability attributes
for the memory associated with the translation table walks */
#define ARM_TTBR_OUTER_NC (0x0 << 3) /* Non-cacheable*/
#define ARM_TTBR_OUTER_WBWA (0x1 << 3) /* Outer Write-Back Write-Allocate Cacheable. */
#define ARM_TTBR_OUTER_WT (0x2 << 3) /* Outer Write-Through Cacheable. */
#define ARM_TTBR_OUTER_WBNWA (0x3 << 3) /* Outer Write-Back no Write-Allocate Cacheable. */
#define ARM_TTBR_ADDR_MASK (0xffffc000) /* only the 18 upper bits are to be used as address */
#define ARM_TTBR_FLAGS_CACHED ARM_TTBR_OUTER_WBWA
/* Fault status */
#define ARM_VM_PFE_FS(s) \
((((s) & ARM_VM_PFE_FS4) >> 6) | ((s) & ARM_VM_PFE_FS3_0))
#ifndef __ASSEMBLY__
#include <minix/type.h>
/* structure used by VM to pass data to the kernel while enabling paging */
struct vm_ep_data {
struct mem_map * mem_map;
vir_bytes data_seg_limit;
};
#endif
#endif /* __SYS_VM_ARM_H__ */

View File

@@ -1,4 +0,0 @@
SUBDIR= include
.include <bsd.subdir.mk>

View File

@@ -1,11 +0,0 @@
INCSDIR= /usr/include/i386
INCS= archconst.h archtypes.h bios.h cmos.h \
diskparm.h elf.h fpu.h int86.h interrupt.h \
ipcconst.h memory.h partition.h \
pci_amd.h pci.h pci_intel.h pci_sis.h \
pci_via.h ports.h stackframe.h vm.h
.include <bsd.kinc.mk>

View File

@@ -1,6 +0,0 @@
#ifndef _I386_CONST_H
#define _I386_CONST_H
#define DEFAULT_HZ 60 /* clock freq (software settable on IBM-PC) */
#endif /* #ifndef _I386_CONST_H */

View File

@@ -1,51 +0,0 @@
#ifndef _I386_TYPES_H
#define _I386_TYPES_H
#include <minix/sys_config.h>
#include <machine/stackframe.h>
#include <machine/fpu.h>
#include <sys/cdefs.h>
struct segdesc_s { /* segment descriptor for protected mode */
u16_t limit_low;
u16_t base_low;
u8_t base_middle;
u8_t access; /* |P|DL|1|X|E|R|A| */
u8_t granularity; /* |G|X|0|A|LIMT| */
u8_t base_high;
} __attribute__((packed));
struct gatedesc_s {
u16_t offset_low;
u16_t selector;
u8_t pad; /* |000|XXXXX| ig & trpg, |XXXXXXXX| task g */
u8_t p_dpl_type; /* |P|DL|0|TYPE| */
u16_t offset_high;
} __attribute__((packed));
struct desctableptr_s {
u16_t limit;
u32_t base;
} __attribute__((packed));
typedef struct segframe {
reg_t p_cr3; /* page table root */
u32_t *p_cr3_v;
char *fpu_state;
int p_kern_trap_style;
} segframe_t;
struct cpu_info {
u8_t vendor;
u8_t family;
u8_t model;
u8_t stepping;
u32_t freq; /* in MHz */
u32_t flags[2];
};
typedef u32_t atomic_t; /* access to an aligned 32bit value is atomic on i386 */
#endif /* #ifndef _I386_TYPES_H */

View File

@@ -1,125 +0,0 @@
/* Definitions of several known BIOS addresses. The addresses listed here
* are found in three memory areas that have been defined in <ibm/memory.h>.
* - the BIOS interrupt vectors
* - the BIOS data area
* - the motherboard BIOS memory
*
* Created: March 2005, Jorrit N. Herder
*/
#ifndef _BIOS_H
#define _BIOS_H
/* PART I --
* The BIOS interrupt vector table (IVT) area (1024 B as of address 0x0000).
* Although this area holds 256 interrupt vectors (with jump addresses), some
* vectors actually contain important BIOS data. Some addresses are below.
*/
#define BIOS_EQUIP_CHECK_ADDR 0x0044
#define BIOS_EQUIP_CHECK_SIZE 4L
#define BIOS_VIDEO_PARAMS_ADDR 0x0074
#define BIOS_VIDEO_PARAMS_SIZE 4L
#define BIOS_FLOP_PARAMS_ADDR 0x0078
#define BIOS_FLOP_PARAMS_SIZE 4L
#define BIOS_HD0_PARAMS_ADDR 0x0104 /* disk 0 parameters */
#define BIOS_HD0_PARAMS_SIZE 4L
#define BIOS_HD1_PARAMS_ADDR 0x0118 /* disk 1 parameters */
#define BIOS_HD1_PARAMS_SIZE 4L
/* PART I --
* Addresses in the BIOS data area (256 B as of address 0x0400). The addresses
* listed below are the most important ones, and the ones that are currently
* used. Other addresses may be defined below when new features are added.
*/
/* Serial ports (COM1-COM4). */
#define COM1_IO_PORT_ADDR 0x400 /* COM1 port address */
#define COM1_IO_PORT_SIZE 2L
#define COM2_IO_PORT_ADDR 0x402 /* COM2 port address */
#define COM2_IO_PORT_SIZE 2L
#define COM3_IO_PORT_ADDR 0x404 /* COM3 port address */
#define COM3_IO_PORT_SIZE 2L
#define COM4_IO_PORT_ADDR 0x406 /* COM4 port address */
#define COM4_IO_PORT_SIZE 2L
/* Parallel ports (LPT1-LPT4). */
#define LPT1_IO_PORT_ADDR 0x408 /* LPT1 port address */
#define LPT1_IO_PORT_SIZE 2L
#define LPT2_IO_PORT_ADDR 0x40A /* LPT2 port address */
#define LPT2_IO_PORT_SIZE 2L
#define LPT3_IO_PORT_ADDR 0x40C /* LPT3 port address */
#define LPT3_IO_PORT_SIZE 2L
#define LPT4_IO_PORT_ADDR 0x40E /* LPT4 port (except on PS/2) */
#define LPT4_IO_PORT_SIZE 2L
/* Video controller (VDU). */
#define VDU_SCREEN_COLS_ADDR 0x44A /* VDU nr of screen columns */
#define VDU_SCREEN_COLS_SIZE 2L
/* Base I/O port address for active 6845 CRT controller. */
#define VDU_CRT_BASE_ADDR 0x463 /* 3B4h = mono, 3D4h = color */
#define VDU_CRT_BASE_SIZE 2L
/* Soft reset flags to control shutdown. */
#define SOFT_RESET_FLAG_ADDR 0x472 /* soft reset flag on Ctl-Alt-Del */
#define SOFT_RESET_FLAG_SIZE 2L
#define STOP_MEM_CHECK 0x1234 /* bypass memory tests & CRT init */
#define PRESERVE_MEMORY 0x4321 /* preserve memory */
#define SYSTEM_SUSPEND 0x5678 /* system suspend */
#define MANUFACTURER_TEST 0x9ABC /* manufacturer test */
#define CONVERTIBLE_POST 0xABCD /* convertible POST loop */
/* ... many other values are used during POST */
/* Hard disk parameters. (Also see BIOS interrupt vector table above.) */
#define NR_HD_DRIVES_ADDR 0x475 /* number of hard disk drives */
#define NR_HD_DRIVES_SIZE 1L
/* Parallel ports (LPT1-LPT4) timeout values. */
#define LPT1_TIMEOUT_ADDR 0x478 /* time-out value for LPT1 */
#define LPT1_TIMEOUT_SIZE 1L
#define LPT2_TIMEOUT_ADDR 0x479 /* time-out value for LPT2 */
#define LPT2_TIMEOUT_SIZE 1L
#define LPT3_TIMEOUT_ADDR 0x47A /* time-out value for LPT3 */
#define LPT3_TIMEOUT_SIZE 1L
#define LPT4_TIMEOUT_ADDR 0x47B /* time-out for LPT4 (except PS/2) */
#define LPT4_TIMEOUT_SIZE 1L
/* Serial ports (COM1-COM4) timeout values. */
#define COM1_TIMEOUT_ADDR 0x47C /* time-out value for COM1 */
#define COM1_TIMEOUT_SIZE 1L
#define COM2_TIMEOUT_ADDR 0x47D /* time-out value for COM2 */
#define COM2_TIMEOUT_SIZE 1L
#define COM3_TIMEOUT_ADDR 0x47E /* time-out value for COM3 */
#define COM3_TIMEOUT_SIZE 1L
#define COM4_TIMEOUT_ADDR 0x47F /* time-out value for COM4 */
#define COM4_TIMEOUT_SIZE 1L
/* Video controller (VDU). */
#define VDU_SCREEN_ROWS_ADDR 0x484 /* screen rows (less 1, EGA+)*/
#define VDU_SCREEN_ROWS_SIZE 1L
#define VDU_FONTLINES_ADDR 0x485 /* point height of char matrix */
#define VDU_FONTLINES_SIZE 2L
/* Video controller (VDU). */
#define VDU_VIDEO_MODE_ADDR 0x49A /* current video mode */
#define VDU_VIDEO_MODE_SIZE 1L
/* PART III --
* The motherboard BIOS memory contains some known values that are currently
* in use. Other sections in the upper memory area (UMA) addresses vary in
* size and locus and are not further defined here. A rough map is given in
* <ibm/memory.h>.
*/
/* Machine ID (we're interested in PS/2 and AT models). */
#define MACHINE_ID_ADDR 0xFFFFE /* BIOS machine ID byte */
#define MACHINE_ID_SIZE 1L
#define PS_386_MACHINE 0xF8 /* ID byte for PS/2 modela 70/80 */
#define PC_AT_MACHINE 0xFC /* PC/AT, PC/XT286, PS/2 models 50/60 */
#endif /* _BIOS_H */

View File

@@ -1,85 +0,0 @@
/*
ibm/cmos.h
Created: Dec 1998 by Philip Homburg <philip@cs.vu.nl>
Definitions for the CMOS/realtime clock. Based on the datasheet for the
Dallas DS12887, compatible with the Motorola MC146818
*/
#define RTC_INDEX 0x70 /* Bit 7 = NMI enable (1) / disable (0)
* bits 0..6 index
*/
#define RTC_IO 0x71 /* Data register,
* Note: the operation following a write to
* RTC_INDEX should an access (read or write)
* to RTC_IO
*/
#define RTC_SEC 0x0 /* Seconds register */
#define RTC_SEC_ALRM 0x1 /* Seconds register for alarm */
#define RTC_MIN 0x2 /* Minutes register */
#define RTC_MIN_ALRM 0x3 /* Minutes register for alarm */
#define RTC_HOUR 0x4 /* Hours register */
#define RTC_HOUR_ALRM 0x5 /* Hours register for alarm */
#define RTC_WDAY 0x6 /* Day of the week, 1..7, Sunday = 1 */
#define RTC_MDAY 0x7 /* Day of the month, 1..31 */
#define RTC_MONTH 0x8 /* Month, 1..12 */
#define RTC_YEAR 0x9 /* Year, 0..99 */
#define RTC_REG_A 0xA
#define RTC_A_UIP 0x80 /* Update in progress. When clear,
* no update will occur for 244
* micro seconds.
*/
#define RTC_A_DV 0x70 /* Divider bits, valid values are: */
#define RTC_A_DV_OK 0x20 /* Normal */
#define RTC_A_DV_STOP 0x70 /* Stop, a re-start starts
* halfway through a cycle,
* i.e. the update occurs after
* 500ms.
*/
#define RTC_A_RS 0x0F /* Int. freq */
/* 0 None
* 1 256 Hz
* 2 128 Hz
* 3 8192 Hz
* 4 4096 Hz
* 5 2048 Hz
* 6 1024 Hz
* 7 512 Hz
* 8 256 Hz
* 9 128 Hz
* 10 64 Hz
* 11 32 Hz
* 12 16 Hz
* 13 8 Hz
* 14 4 Hz
* 15 2 Hz
*/
#define RTC_A_RS_DEF 6 /* Default freq. */
#define RTC_REG_B 0xB
#define RTC_B_SET 0x80 /* Inhibit updates */
#define RTC_B_PIE 0x40 /* Enable periodic interrupts */
#define RTC_B_AIE 0x20 /* Enable alarm interrupts */
#define RTC_B_UIE 0x10 /* Enable update ended interrupts */
#define RTC_B_SQWE 0x08 /* Enable square wave output */
#define RTC_B_DM_BCD 0x04 /* Data is in BCD (otherwise binary) */
#define RTC_B_24 0x02 /* Count hours in 24-hour mode */
#define RTC_B_DSE 0x01 /* Automatic (wrong) daylight savings
* updates
*/
#define RTC_REG_C 0xC
/* Contents of the general purpose CMOS RAM (source IBM reference manual) */
#define CMOS_STATUS 0xE
#define CS_LOST_POWER 0x80 /* Chip lost power */
#define CS_BAD_CHKSUM 0x40 /* Checksum is incorrect */
#define CS_BAD_CONFIG 0x20 /* Bad configuration info */
#define CS_BAD_MEMSIZE 0x10 /* Wrong memory size of CMOS */
#define CS_BAD_HD 0x08 /* Harddisk failed */
#define CS_BAD_TIME 0x04 /* CMOS time is invalid */
/* bits 0 and 1 are reserved */
/*
* $PchId: cmos.h,v 1.1 1998/12/16 09:14:21 philip Exp $
*/

View File

@@ -1,20 +0,0 @@
/* PC (and AT) BIOS structure to hold disk parameters. Under Minix, it is
* used mainly for formatting.
*/
#ifndef _DISKPARM_H
#define _DISKPARM_H
struct disk_parameter_s {
char spec1;
char spec2;
char motor_turnoff_sec;
char sector_size_code;
char sectors_per_cylinder;
char gap_length;
char dtl;
char gap_length_for_format;
char fill_byte_for_format;
char head_settle_msec;
char motor_start_eigth_sec;
};
#endif /* _DISKPARM_H */

View File

@@ -1,42 +0,0 @@
/*-
* Copyright (c) 1996-1997 John D. Polstra.
* 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 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 _MACHINE_ELF_H_
#define _MACHINE_ELF_H_ 1
/*
* ELF definitions for the i386 architecture.
*/
/* Define "machine" characteristics */
#define ELF_TARG_CLASS ELFCLASS32
#define ELF_TARG_DATA ELFDATA2LSB
#define ELF_TARG_MACH EM_386
#define ELF_TARG_VER 1
#endif /* !_MACHINE_ELF_H_ */

View File

@@ -1,50 +0,0 @@
#ifndef FPU_H
#define FPU_H
/* x87 FPU state, MMX Technolodgy.
* 108 bytes.*/
struct fpu_regs_s {
u16_t fp_control; /* control */
u16_t fp_unused_1;
u16_t fp_status; /* status */
u16_t fp_unused_2;
u16_t fp_tag; /* register tags */
u16_t fp_unused_3;
u32_t fp_eip; /* eip at failed instruction */
u16_t fp_cs; /* cs at failed instruction */
u16_t fp_opcode; /* opcode of failed instruction */
u32_t fp_dp; /* data address */
u16_t fp_ds; /* data segment */
u16_t fp_unused_4;
u16_t fp_st_regs[8][5]; /* 8 80-bit FP registers */
};
/* x87 FPU, MMX Technolodgy and SSE state.
* 512 bytes (if you need size use FPU_XFP_SIZE). */
struct xfp_save {
u16_t fp_control; /* control */
u16_t fp_status; /* status */
u16_t fp_tag; /* register tags */
u16_t fp_opcode; /* opcode of failed instruction */
u32_t fp_eip; /* eip at failed instruction */
u16_t fp_cs; /* cs at failed instruction */
u16_t fp_unused_1;
u32_t fp_dp; /* data address */
u16_t fp_ds; /* data segment */
u16_t fp_unused_2;
u32_t fp_mxcsr; /* MXCSR */
u32_t fp_mxcsr_mask; /* MXCSR_MASK */
u16_t fp_st_regs[8][8]; /* 128 bytes for ST/MM regs */
u32_t fp_xreg_word[32]; /* space for 8 128-bit XMM registers */
u32_t fp_padding[56];
};
/* Size of xfp_save structure. */
#define FPU_XFP_SIZE 512
union fpu_state_u {
struct fpu_regs_s fpu_regs;
struct xfp_save xfp_regs;
};
#endif /* #ifndef FPU_H */

View File

@@ -1,61 +0,0 @@
/* int86.h - 8086 interrupt types Author: Kees J. Bot
* 3 May 2000
*/
/* Registers used in an PC real mode call for BIOS or DOS services. A
* driver is called through the vector if the interrupt number is zero.
*/
union reg86 {
struct l {
u32_t ef; /* 32 bit flags (output only) */
u32_t vec; /* Driver vector (input only) */
u32_t _ds_es[1];
u32_t eax; /* 32 bit general registers */
u32_t ebx;
u32_t ecx;
u32_t edx;
u32_t esi;
u32_t edi;
u32_t ebp;
} l;
struct w {
u16_t f, _ef[1]; /* 16 bit flags (output only) */
u16_t off, seg; /* Driver vector (input only) */
u16_t ds, es; /* DS and ES real mode segment regs */
u16_t ax, _eax[1]; /* 16 bit general registers */
u16_t bx, _ebx[1];
u16_t cx, _ecx[1];
u16_t dx, _edx[1];
u16_t si, _esi[1];
u16_t di, _edi[1];
u16_t bp, _ebp[1];
} w;
struct b {
u8_t intno, _intno[3]; /* Interrupt number (input only) */
u8_t _vec[4];
u8_t _ds_es[4];
u8_t al, ah, _eax[2]; /* 8 bit general registers */
u8_t bl, bh, _ebx[2];
u8_t cl, ch, _ecx[2];
u8_t dl, dh, _edx[2];
u8_t _esi[4];
u8_t _edi[4];
u8_t _ebp[4];
} b;
};
struct reg86u { union reg86 u; }; /* Better for forward declarations */
/* Parameters passed on ioctls to the memory task. */
struct mio_int86 { /* MIOCINT86 */
union reg86 reg86; /* x86 registers as above */
u16_t off, seg; /* Address of kernel buffer */
void *buf; /* User data buffer */
size_t len; /* Size of user buffer */
};
struct mio_ldt86 { /* MIOCGLDT86, MIOCSLDT86 */
size_t idx; /* Index in process' LDT */
u16_t entry[4]; /* One LDT entry to get or set. */
};

View File

@@ -1,59 +0,0 @@
/* Interrupt numbers and hardware vectors. */
#ifndef _INTERRUPT_H
#define _INTERRUPT_H
#if defined(__i386__)
/* 8259A interrupt controller ports. */
#define INT_CTL 0x20 /* I/O port for interrupt controller */
#define INT_CTLMASK 0x21 /* setting bits in this port disables ints */
#define INT2_CTL 0xA0 /* I/O port for second interrupt controller */
#define INT2_CTLMASK 0xA1 /* setting bits in this port disables ints */
/* Magic numbers for interrupt controller. */
#define END_OF_INT 0x20 /* code used to re-enable after an interrupt */
#define IRQ0_VECTOR 0x50 /* nice vectors to relocate IRQ0-7 to */
#define IRQ8_VECTOR 0x70 /* no need to move IRQ8-15 */
/* Interrupt vectors defined/reserved by processor. */
#define DIVIDE_VECTOR 0 /* divide error */
#define DEBUG_VECTOR 1 /* single step (trace) */
#define NMI_VECTOR 2 /* non-maskable interrupt */
#define BREAKPOINT_VECTOR 3 /* software breakpoint */
#define OVERFLOW_VECTOR 4 /* from INTO */
/* Fixed system call vector. */
#define KERN_CALL_VECTOR_ORIG 32 /* system calls are made with int SYSVEC */
#define IPC_VECTOR_ORIG 33 /* interrupt vector for ipc */
#define KERN_CALL_VECTOR_UM 34 /* user-mapped equivalent */
#define IPC_VECTOR_UM 35 /* user-mapped equivalent */
/* Hardware interrupt numbers. */
#ifndef USE_APIC
#define NR_IRQ_VECTORS 16
#else
#define NR_IRQ_VECTORS 64
#endif
#define CLOCK_IRQ 0
#define KEYBOARD_IRQ 1
#define CASCADE_IRQ 2 /* cascade enable for 2nd AT controller */
#define ETHER_IRQ 3 /* default ethernet interrupt vector */
#define SECONDARY_IRQ 3 /* RS232 interrupt vector for port 2 */
#define RS232_IRQ 4 /* RS232 interrupt vector for port 1 */
#define XT_WINI_IRQ 5 /* xt winchester */
#define FLOPPY_IRQ 6 /* floppy disk */
#define PRINTER_IRQ 7
#define SPURIOUS_IRQ 7
#define CMOS_CLOCK_IRQ 8
#define KBD_AUX_IRQ 12 /* AUX (PS/2 mouse) port in kbd controller */
#define AT_WINI_0_IRQ 14 /* at winchester controller 0 */
#define AT_WINI_1_IRQ 15 /* at winchester controller 1 */
#define VECTOR(irq) \
(((irq) < 8 ? IRQ0_VECTOR : IRQ8_VECTOR) + ((irq) & 0x07))
#endif /* (CHIP == INTEL) */
#endif /* _INTERRUPT_H */

View File

@@ -1,12 +0,0 @@
#ifndef _I386_IPCCONST_H_
#define _I386_IPCCONST_H_
#define KERVEC_INTR 32 /* syscall trap to kernel */
#define IPCVEC_INTR 33 /* ipc trap to kernel */
#define KERVEC_UM 34 /* syscall trap to kernel, user-mapped code */
#define IPCVEC_UM 35 /* ipc trap to kernel, user-mapped code */
#define IPC_STATUS_REG bx
#endif /* _I386_IPCCONST_H_ */

View File

@@ -1,171 +0,0 @@
/* Physical memory layout on IBM compatible PCs. Only the major, fixed memory
* areas are detailed here. Known addresses of the BIOS data area are defined
* in <ibm/bios.h>. The map upper memory area (UMA) is only roughly defined
* since the UMA sections may vary in size and locus.
*
* Created: March 2005, Jorrit N. Herder
*/
/* I/O-mapped peripherals. I/O addresses are different from memory addresses
* due to the I/O signal on the ISA bus. Individual I/O ports are defined by
* the drivers that use them or looked up with help of the BIOS.
*/
#define IO_MEMORY_BEGIN 0x0000
#define IO_MEMORY_END 0xFFFF
/* Physical memory layout. Design decisions made for the earliest PCs, caused
* memory to be broken broken into the following four basic pieces:
* - Conventional or base memory: first 640 KB (incl. BIOS data, see below);
* The top of conventional memory is often used by the BIOS to store data.
* - Upper Memory Area (UMA): upper 384 KB of the first megabyte of memory;
* - High Memory Area (HMA): ~ first 64 KB of the second megabyte of memory;
* - Extended Memory: all the memory above first megabyte of memory.
* The high memory area overlaps with the first 64 KB of extended memory, but
* is different from the rest of extended memory because it can be accessed
* when the processor is in real mode.
*/
#define BASE_MEM_BEGIN 0x000000
#define BASE_MEM_TOP 0x090000
#define BASE_MEM_END 0x09FFFF
#define UPPER_MEM_BEGIN 0x0A0000
#define UPPER_MEM_END 0x0FFFFF
#define HIGH_MEM_BEGIN 0x100000
#define HIGH_MEM_END 0x10FFEF
#define EXTENDED_MEM_BEGIN 0x100000
#define EXTENDED_MEM_END ((unsigned) -1)
/* The logical memory map of the first 1.5 MB is as follows (hexadecimals):
*
* offset [size] (id) = memory usage
* ------------------------------------------------------------------------
* 000000 [00400] (I) = Real-Mode Interrupt Vector Table (1024 B)
* 000400 [00100] (B) = BIOS Data Area (256 B)
* 000800 [00066] (W) = 80286 Loadall workspace
* 010000 [10000] (c) = Real-Mode Compatibility Segment (64 KB)
* 020000 [70000] (.) = Program-accessible memory (free)
* 090000 [10000] (E) = BIOS Extension
* 0A0000 [10000] (G) = Graphics Mode Video RAM
* 0B0000 [08000] (M) = Monochrome Text Mode Video RAM
* 0B8000 [08000] (C) = Color Text Mode Video RAM
* 0C0000 [08000] (V) = Video ROM BIOS (would be "a" in PS/2)
* 0C8000 [18000] (a) = Adapter ROM + special-purpose RAM (free UMA space)
* 0E0000 [10000] (r) = PS/2 Motherboard ROM BIOS (free UMA in non-PS/2)
* 0F0000 [06000] (R) = Motherboard ROM BIOS
* 0F6000 [08000] (b) = IBM Cassette BASIC ROM ("R" in IBM compatibles)
* 0FD000 [02000] (R) = Motherboard ROM BIOS
* 100000 [.....] (.) = Extended memory, program-accessible (free)
* 100000 [0FFEF] (h) = High Memory Area (HMA)
*
*
* Conventional (Base) Memory:
*
* : [~~~~~16 KB~~~~][~~~~~16 KB~~~~][~~~~~16 KB~~~~][~~~~~16 KB~~~~]
* : 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
* 000000: IBW.............................................................
* 010000: cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
* 020000: ................................................................
* 030000: ................................................................
* 040000: ................................................................
* 050000: ................................................................
* 060000: ................................................................
* 070000: ................................................................
* 080000: ................................................................
* 090000: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
*
* Upper Memory Area (UMA):
*
* : 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
* 0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
* 0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
* 0C0000: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
* 0D0000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
* 0E0000: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
* 0F0000: RRRRRRRRRRRRRRRRRRRRRRRRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbRRRRRRRR
*
* Extended Memory:
*
* : 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
* 100000: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.
* 110000: ................................................................
* 120000: ................................................................
* 130000: ................................................................
* 140000: ................................................................
* 150000: ................................................................
* 160000: ................................................................
* 170000: ................................................................
*
* Source: The logical memory map was partly taken from the book "Upgrading
* & Repairing PCs Eight Edition", Macmillan Computer Publishing.
*/
/* The bottom part of conventional or base memory is occupied by BIOS data.
* The BIOS memory can be distinguished in two parts:
* o The first the first 1024 bytes of addressable memory contains the BIOS
* real-mode interrupt vector table (IVT). The table is used to access BIOS
* hardware services in real-mode by loading a interrupt vector and issuing
* an INT instruction. Some vectors contain BIOS data that can be retrieved
* directly and are useful in protected-mode as well.
* o The BIOS data area is located directly above the interrupt vectors. It
* comprises 256 bytes of memory. These data are used by the device drivers
* to retrieve hardware details, such as I/O ports to be used.
*/
#define BIOS_MEM_BEGIN 0x00000 /* all BIOS memory */
#define BIOS_MEM_END 0x004FF
#define BIOS_IVT_BEGIN 0x00000 /* BIOS interrupt vectors */
#define BIOS_IVT_END 0x003FF
#define BIOS_DATA_BEGIN 0x00400 /* BIOS data area */
#define BIOS_DATA_END 0x004FF
/* The base memory is followed by 384 KB reserved memory located at the top of
* the first MB of physical memory. This memory is known as the upper memory
* area (UMA). It is used for memory-mapped peripherals, such as video RAM,
* adapter BIOS (adapter ROM and special purpose RAM), and the motherboard
* BIOS (I/O system, Power-On Self Test, bootstrap loader). The upper memory
* can roughly be distinguished in three parts:
*
* o The first 128K of the upper memory area (A0000-BFFFF) is reserved for use
* by memory-mapped video adapters. Hence, it is also called Video RAM. The
* display driver can directly write to this memory and request the hardware
* to show the data on the screen.
*/
#define UMA_VIDEO_RAM_BEGIN 0xA0000 /* video RAM */
#define UMA_VIDEO_RAM_END 0xBFFFF
#define UMA_GRAPHICS_RAM_BEGIN 0xA0000 /* graphics RAM */
#define UMA_GRAPHICS_RAM_END 0xAFFFF
#define UMA_MONO_TEXT_BEGIN 0xB0000 /* monochrome text */
#define UMA_MONO_TEXT_END 0xB7FFF
#define UMA_COLOR_TEXT_BEGIN 0xB8000 /* color text */
#define UMA_COLOR_TEXT_END 0xBFFFF
/* o The next 128K (the memory range C0000-DFFFF) is reserved for the adapter
* BIOS that resides in the ROM on some adapter boards. Most VGA-compatible
* video adapters use the first 32 KB of this area for their on-board BIOS.
* The rest can be used by any other adapters. The IDE controller often
* occupies the second 32 KB.
*/
#define UMA_ADAPTER_BIOS_BEGIN 0xC0000 /* adapter BIOS */
#define UMA_ADAPTER_BIOS_END 0xDFFFF
#define UMA_VIDEO_BIOS_BEGIN 0xC0000 /* video adapter */
#define UMA_VIDEO_BIOS_END 0xC7FFF
#define UMA_IDE_HD_BIOS_BEGIN 0xC8000 /* IDE hard disk */
#define UMA_IDE_HD_BIOS_END 0xCBFFF
/* o The last 128K of the upper memory area (E0000-FFFFF) is reserved for
* motherboard BIOS (Basic I/O System). The POST (Power-On Self Test) and
* bootstrap loader also reside in this space. The memory falls apart in
* two areas: Plug & Play BIOS data and the system BIOS data.
*/
#define UMA_MB_BIOS_BEGIN 0xE0000 /* motherboard BIOS */
#define UMA_MB_BIOS_END 0xFFFFF
#define UMA_PNP_ESCD_BIOS_BEGIN 0xE0000 /* PnP extended data */
#define UMA_PNP_ESCD_BIOS_END 0xEFFFF
#define UMA_SYSTEM_BIOS_BEGIN 0xF0000 /* system BIOS */
#define UMA_SYSTEM_BIOS_END 0xFFFFF

View File

@@ -1,28 +0,0 @@
/* Description of entry in partition table. */
#ifndef _PARTITION_H
#define _PARTITION_H
#include <stdint.h>
struct part_entry {
uint8_t bootind; /* boot indicator 0/ACTIVE_FLAG */
uint8_t start_head; /* head value for first sector */
uint8_t start_sec; /* sector value + cyl bits for first sector */
uint8_t start_cyl; /* track value for first sector */
uint8_t sysind; /* system indicator */
uint8_t last_head; /* head value for last sector */
uint8_t last_sec; /* sector value + cyl bits for last sector */
uint8_t last_cyl; /* track value for last sector */
uint32_t lowsec; /* logical first sector */
uint32_t size; /* size of partition in sectors */
};
#define ACTIVE_FLAG 0x80 /* value for active in bootind field (hd0) */
#define NR_PARTITIONS 4 /* number of entries in partition table */
#define PART_TABLE_OFF 0x1BE /* offset of partition table in boot sector */
/* Partition types. */
#define NO_PART 0x00 /* unused entry */
#define MINIX_PART 0x81 /* Minix partition type */
#endif /* _PARTITION_H */

View File

@@ -1,147 +0,0 @@
/*
pci.h
Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
*/
/* Header type 00, normal PCI devices */
#define PCI_VID 0x00 /* Vendor ID, 16-bit */
#define PCI_DID 0x02 /* Device ID, 16-bit */
#define PCI_CR 0x04 /* Command Register, 16-bit */
#define PCI_CR_MAST_EN 0x0004 /* Enable Busmaster Access */
#define PCI_CR_MEM_EN 0x0002 /* Enable Mem Cycles */
#define PCI_CR_IO_EN 0x0001 /* Enable I/O Cycles */
#define PCI_SR 0x06 /* PCI status, 16-bit */
#define PSR_SSE 0x4000 /* Signaled System Error */
#define PSR_RMAS 0x2000 /* Received Master Abort Status */
#define PSR_RTAS 0x1000 /* Received Target Abort Status */
#define PSR_CAPPTR 0x0010 /* Capabilities list */
#define PCI_REV 0x08 /* Revision ID */
#define PCI_PIFR 0x09 /* Prog. Interface Register */
#define PCI_SCR 0x0A /* Sub-Class Register */
#define PCI_BCR 0x0B /* Base-Class Register */
#define PCI_CLS 0x0C /* Cache Line Size */
#define PCI_LT 0x0D /* Latency Timer */
#define PCI_HEADT 0x0E /* Header type, 8-bit */
#define PHT_MASK 0x7F /* Header type mask */
#define PHT_NORMAL 0x00
#define PHT_BRIDGE 0x01
#define PHT_CARDBUS 0x02
#define PHT_MULTIFUNC 0x80 /* Multiple functions */
#define PCI_BIST 0x0F /* Built-in Self Test */
#define PCI_BAR 0x10 /* Base Address Register */
#define PCI_BAR_IO 0x00000001 /* Reg. refers to I/O space */
#define PCI_BAR_TYPE 0x00000006 /* Memory BAR type */
#define PCI_TYPE_32 0x00000000 /* 32-bit BAR */
#define PCI_TYPE_32_1M 0x00000002 /* 32-bit below 1MB (legacy) */
#define PCI_TYPE_64 0x00000004 /* 64-bit BAR */
#define PCI_BAR_PREFETCH 0x00000008 /* Memory is prefetchable */
#define PCI_BAR_IO_MASK 0xFFFFFFFC /* I/O address mask */
#define PCI_BAR_MEM_MASK 0xFFFFFFF0 /* Memory address mask */
#define PCI_BAR_2 0x14 /* Base Address Register */
#define PCI_BAR_3 0x18 /* Base Address Register */
#define PCI_BAR_4 0x1C /* Base Address Register */
#define PCI_BAR_5 0x20 /* Base Address Register */
#define PCI_BAR_6 0x24 /* Base Address Register */
#define PCI_CBCISPTR 0x28 /* Cardbus CIS Pointer */
#define PCI_SUBVID 0x2C /* Subsystem Vendor ID */
#define PCI_SUBDID 0x2E /* Subsystem Device ID */
#define PCI_EXPROM 0x30 /* Expansion ROM Base Address */
#define PCI_CAPPTR 0x34 /* Capabilities Pointer */
#define PCI_CP_MASK 0xfc /* Lower 2 bits should be ignored */
#define PCI_ILR 0x3C /* Interrupt Line Register */
#define PCI_ILR_UNKNOWN 0xFF /* IRQ is unassigned or unknown */
#define PCI_IPR 0x3D /* Interrupt Pin Register */
#define PCI_MINGNT 0x3E /* Min Grant */
#define PCI_MAXLAT 0x3F /* Max Latency */
/* Header type 01, PCI-to-PCI bridge devices */
/* The following registers are in common with type 00:
* PCI_VID, PCI_DID, PCI_CR, PCI_SR, PCI_REV, PCI_PIFR, PCI_SCR, PCI_BCR,
* PCI_CLS, PCI_LT, PCI_HEADT, PCI_BIST, PCI_BAR, PCI_BAR2, PCI_CAPPTR,
* PCI_ILR, PCI_IPR.
*/
#define PPB_PRIMBN 0x18 /* Primary Bus Number */
#define PPB_SECBN 0x19 /* Secondary Bus Number */
#define PPB_SUBORDBN 0x1A /* Subordinate Bus Number */
#define PPB_SECBLT 0x1B /* Secondary Bus Latency Timer */
#define PPB_IOBASE 0x1C /* I/O Base */
#define PPB_IOB_MASK 0xf0
#define PPB_IOLIMIT 0x1D /* I/O Limit */
#define PPB_IOL_MASK 0xf0
#define PPB_SSTS 0x1E /* Secondary Status Register */
#define PPB_MEMBASE 0x20 /* Memory Base */
#define PPB_MEMB_MASK 0xfff0
#define PPB_MEMLIMIT 0x22 /* Memory Limit */
#define PPB_MEML_MASK 0xfff0
#define PPB_PFMEMBASE 0x24 /* Prefetchable Memory Base */
#define PPB_PFMEMB_MASK 0xfff0
#define PPB_PFMEMLIMIT 0x26 /* Prefetchable Memory Limit */
#define PPB_PFMEML_MASK 0xfff0
#define PPB_PFMBU32 0x28 /* Prefetchable Memory Base Upper 32 */
#define PPB_PFMLU32 0x2C /* Prefetchable Memory Limit Upper 32 */
#define PPB_IOBASEU16 0x30 /* I/O Base Upper 16 */
#define PPB_IOLIMITU16 0x32 /* I/O Limit Upper 16 */
#define PPB_EXPROM 0x38 /* Expansion ROM Base Address */
#define PPB_BRIDGECTRL 0x3E /* Bridge Control */
#define PPB_BC_CRST 0x40 /* Assert reset line */
/* Header type 02, Cardbus bridge devices */
/* The following registers are in common with type 00:
* PCI_VID, PCI_DID, PCI_CR, PCI_SR, PCI_REV, PCI_PIFR, PCI_SCR, PCI_BCR,
* PCI_CLS, PCI_LT, PCI_HEADT, PCI_BIST, PCI_BAR, PCI_ILR, PCI_IPR.
*/
/* The following registers are in common with type 01:
* PPB_PRIMBN, PPB_SECBN, PPB_SUBORDBN, PPB_SECBLT.
*/
#define CBB_CAPPTR 0x14 /* Capability Pointer */
#define CBB_SSTS 0x16 /* Secondary Status Register */
#define CBB_MEMBASE_0 0x1C /* Memory Base 0 */
#define CBB_MEMLIMIT_0 0x20 /* Memory Limit 0 */
#define CBB_MEML_MASK 0xfffff000
#define CBB_MEMBASE_1 0x24 /* Memory Base 1 */
#define CBB_MEMLIMIT_1 0x28 /* Memory Limit 1 */
#define CBB_IOBASE_0 0x2C /* I/O Base 0 */
#define CBB_IOLIMIT_0 0x30 /* I/O Limit 0 */
#define CBB_IOL_MASK 0xfffffffc
#define CBB_IOBASE_1 0x34 /* I/O Base 1 */
#define CBB_IOLIMIT_1 0x38 /* I/O Limit 1 */
#define CBB_BRIDGECTRL 0x3E /* Bridge Control */
#define CBB_BC_INTEXCA 0x80 /* Interrupt are routed to ExCAs */
#define CBB_BC_CRST 0x40 /* Assert reset line */
#define CAP_TYPE 0x00 /* Type field in capability */
#define CAP_NEXT 0x01 /* Next field in capability */
#define PCI_BCR_MASS_STORAGE 0x01 /* Mass Storage class */
#define PCI_MS_IDE 0x01 /* IDE storage class */
#define PCI_IDE_PRI_NATIVE 0x01 /* Primary channel is
* in native mode.
*/
#define PCI_IDE_SEC_NATIVE 0x04 /* Secondary channel is
* in native mode.
*/
/* Device type values as ([PCI_BCR] << 16) | ([PCI_SCR] << 8) | [PCI_PIFR] */
#define PCI_T3_VGA_OLD 0x000100 /* OLD VGA class code */
#define PCI_T3_RAID 0x010400 /* RAID controller */
#define PCI_T3_AHCI 0x010601 /* AHCI controller */
#define PCI_T3_VGA 0x030000 /* VGA-compatible video card */
#define PCI_T3_ISA 0x060100 /* ISA bridge */
#define PCI_T3_PCI2PCI 0x060400 /* PCI-to-PCI Bridge device */
#define PCI_T3_PCI2PCI_SUBTR 0x060401 /* Subtr. PCI-to-PCI Bridge */
#define PCI_T3_CARDBUS 0x060700 /* Bardbus Bridge */
#define NO_VID 0xffff /* No PCI card present */
/* Capabilities */
#define CAP_T_SECURE_DEV 0x0f /* (AMD) Secure device
* capability
*/
#define CAP_SD_INFO 2 /* Offset from CAP ptr */
#define CAP_SD_SUBTYPE_MASK 0x0f /* Mask for subtype */
#define CAP_T_SD_DEV 0 /* AMD DEV */
/*
* $PchId: pci.h,v 1.4 2001/12/06 20:21:22 philip Exp $
*/

View File

@@ -1,21 +0,0 @@
/*
pci_amd.h
Created: Nov 2001 by Philip Homburg <philip@cs.vu.nl>
*/
#define AMD_ISABR_FUNC 3 /* Registers are in function 3 */
#define AMD_ISABR_PCIIRQ_LEV 0x54
#define AMD_PCILEV_INTA 0x1
#define AMD_PCILEV_INTB 0x2
#define AMD_PCILEV_INTC 4x2
#define AMD_PCILEV_INTD 4x8
#define AMD_ISABR_PCIIRQ_ROUTE 0x56
#define AMD_PCIIRQ_INTA_MASK 0x000F
#define AMD_PCIIRQ_INTB_MASK 0x00F0
#define AMD_PCIIRQ_INTC_MASK 0x0F00
#define AMD_PCIIRQ_INTD_MASK 0xF000
/*
* $PchId: pci_amd.h,v 1.1 2001/11/09 19:57:37 philip Exp $
*/

View File

@@ -1,58 +0,0 @@
/*
pci_intel.h
Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
*/
#define PCII_CONFADD 0xCF8
#define PCIIC_CODE 0x80000000
#define PCIIC_BUSNUM_MASK 0xff0000
#define PCIIC_BUSNUM_SHIFT 16
#define PCIIC_DEVNUM_MASK 0xf800
#define PCIIC_DEVNUM_SHIFT 11
#define PCIIC_FUNCNUM_MASK 0x700
#define PCIIC_FUNCNUM_SHIFT 8
#define PCIIC_REGNUM_MASK 0xfc
#define PCIIC_REGNUM_SHIFT 2
#define PCII_CONFDATA 0xCFC
#define PCII_SELREG_(bus, dev, func, reg) \
(PCIIC_CODE | \
(((bus) << PCIIC_BUSNUM_SHIFT) & PCIIC_BUSNUM_MASK) | \
(((dev) << PCIIC_DEVNUM_SHIFT) & PCIIC_DEVNUM_MASK) | \
(((func) << PCIIC_FUNCNUM_SHIFT) & PCIIC_FUNCNUM_MASK) | \
((((reg)/4) << PCIIC_REGNUM_SHIFT) & PCIIC_REGNUM_MASK))
#define PCII_UNSEL (0)
#define PCII_RREG8_(bus, dev, func, reg) \
(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
pci_inb(PCII_CONFDATA+((reg)&3)))
#define PCII_RREG16_(bus, dev, func, reg) \
(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
pci_inw(PCII_CONFDATA+((reg)&2)))
#define PCII_RREG32_(bus, dev, func, reg) \
(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
pci_inl(PCII_CONFDATA))
#define PCII_WREG8_(bus, dev, func, reg, val) \
(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
pci_outb(PCII_CONFDATA+((reg)&3), (val)))
#define PCII_WREG16_(bus, dev, func, reg, val) \
(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
pci_outw(PCII_CONFDATA+((reg)&2), (val)))
#define PCII_WREG32_(bus, dev, func, reg, val) \
(pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
pci_outl(PCII_CONFDATA, (val)))
/* PIIX configuration registers */
#define PIIX_PIRQRCA 0x60
#define PIIX_IRQ_DI 0x80
#define PIIX_IRQ_MASK 0x0F
/* PIIX extensions to the PIC */
#define PIIX_ELCR1 0x4D0
#define PIIX_ELCR2 0x4D1
/*
* $PchId: pci_intel.h,v 1.1 2000/08/12 11:20:17 philip Exp $
*/

View File

@@ -1,17 +0,0 @@
/*
pci_sis.h
Created: Nov 2001 by Philip Homburg <philip@cs.vu.nl>
*/
/* Constants are taken from pci-irq.c in the Linux kernel source */
#define SIS_ISABR_IRQ_A 0x41 /* IRQA routing */
#define SIS_ISABR_IRQ_B 0x42 /* IRQB routing */
#define SIS_ISABR_IRQ_C 0x43 /* IRQC routing */
#define SIS_ISABR_IRQ_D 0x44 /* IRQD routing */
#define SIS_IRQ_DISABLED 0x80
#define SIS_IRQ_MASK 0x0F
/*
* $PchId: pci_sis.h,v 1.1 2001/12/06 20:22:52 philip Exp $
*/

View File

@@ -1,27 +0,0 @@
/*
pci_via.h
Created: Jun 2001 by Philip Homburg <philip@cs.vu.nl>
*/
#define VIA_ISABR_EL 0x54 /* Edge or level triggered */
#define VIA_ISABR_EL_INTA 0x08 /* Edge (1) or level (0) */
#define VIA_ISABR_EL_INTB 0x04
#define VIA_ISABR_EL_INTC 0x02
#define VIA_ISABR_EL_INTD 0x01
#define VIA_ISABR_IRQ_R1 0x55 /* IRQ routing 1 */
#define VIA_ISABR_IRQ_INTD 0xf0 /* routing for INTD */
#define VIA_ISABR_IRQ_INT0 0x0f /* routing for INT0 */
#define VIA_ISABR_IRQ_R2 0x56 /* IRQ routing 2 */
#define VIA_ISABR_IRQ_INTA 0xf0 /* routing for INTA */
#define VIA_ISABR_IRQ_INTB 0x0f /* routing for INTB */
#define VIA_ISABR_IRQ_R3 0x57 /* IRQ routing 3 */
#define VIA_ISABR_IRQ_INTC 0xf0 /* routing for INTC */
#define VIA_ISABR_IRQ_INT1 0x0f /* routing for INT1 */
#define VIA_ISABR_IRQ_R4 0x58 /* IRQ routing 4 */
#define VIA_ISABR_IRQ_INT2 0x0f /* routing for INT2 */
/*
* $PchId: pci_via.h,v 1.1 2001/06/20 15:50:25 philip Exp $
*/

View File

@@ -1,17 +0,0 @@
/* Addresses and magic numbers for miscellaneous ports. */
#ifndef _PORTS_H
#define _PORTS_H
#if defined(__i386__)
/* Miscellaneous ports. */
#define PCR 0x65 /* Planar Control Register */
#define PORT_B 0x61 /* I/O port for 8255 port B (kbd, beeper...) */
#define TIMER0 0x40 /* I/O port for timer channel 0 */
#define TIMER2 0x42 /* I/O port for timer channel 2 */
#define TIMER_MODE 0x43 /* I/O port for timer mode control */
#endif /* defined(__i386__) */
#endif /* _PORTS_H */

View File

@@ -1,38 +0,0 @@
#ifndef STACK_FRAME_H
#define STACK_FRAME_H
#include <sys/types.h>
typedef unsigned reg_t; /* machine register */
typedef reg_t segdesc_t;
/* The stack frame layout is determined by the software, but for efficiency
* it is laid out so the assembly code to use it is as simple as possible.
* 80286 protected mode and all real modes use the same frame, built with
* 16-bit registers. Real mode lacks an automatic stack switch, so little
* is lost by using the 286 frame for it. The 386 frame differs only in
* having 32-bit registers and more segment registers. The same names are
* used for the larger registers to avoid differences in the code.
*/
struct stackframe_s {
u16_t gs; /* last item pushed by save */
u16_t fs; /* ^ */
u16_t es; /* | */
u16_t ds; /* | */
reg_t di; /* di through cx are not accessed in C */
reg_t si; /* order is to match pusha/popa */
reg_t fp; /* bp */
/* reg_t st; */ /* hole for another copy of sp */
reg_t bx; /* | */
reg_t dx; /* | */
reg_t cx; /* | */
reg_t retreg; /* ax and above are all pushed by save */
/* reg_t retadr; */ /* return address for assembly code save() */
reg_t pc; /* ^ last item pushed by interrupt */
reg_t cs; /* | */
reg_t psw; /* | */
reg_t sp; /* | */
reg_t ss; /* these are pushed by CPU during interrupt */
};
#endif /* #ifndef STACK_FRAME_H */

View File

@@ -1,102 +0,0 @@
#ifndef __SYS_VM_386_H__
#define __SYS_VM_386_H__
/*
i386/vm.h
*/
#define I386_PAGE_SIZE 4096
#define I386_BIG_PAGE_SIZE (I386_PAGE_SIZE*I386_VM_PT_ENTRIES)
/* i386 paging constants */
#define I386_VM_PRESENT 0x001 /* Page is present */
#define I386_VM_WRITE 0x002 /* Read/write access allowed */
#define I386_VM_READ 0x000 /* Read access only */
#define I386_VM_USER 0x004 /* User access allowed */
#define I386_VM_PWT 0x008 /* Write through */
#define I386_VM_PCD 0x010 /* Cache disable */
#define I386_VM_ACC 0x020 /* Accessed */
#define I386_VM_ADDR_MASK 0xFFFFF000 /* physical address */
#define I386_VM_ADDR_MASK_4MB 0xFFC00000 /* physical address */
#define I386_VM_OFFSET_MASK_4MB 0x003FFFFF /* physical address */
/* Page directory specific flags. */
#define I386_VM_BIGPAGE 0x080 /* 4MB page */
/* Page table specific flags. */
#define I386_VM_DIRTY (1L<< 6) /* Dirty */
#define I386_VM_PS (1L<< 7) /* Page size. */
#define I386_VM_GLOBAL (1L<< 8) /* Global. */
#define I386_VM_PTAVAIL1 (1L<< 9) /* Available for use. */
#define I386_VM_PTAVAIL2 (1L<<10) /* Available for use. */
#define I386_VM_PTAVAIL3 (1L<<11) /* Available for use. */
#define I386_VM_PT_ENT_SIZE 4 /* Size of a page table entry */
#define I386_VM_DIR_ENTRIES 1024 /* Number of entries in a page dir */
#define I386_VM_DIR_ENT_SHIFT 22 /* Shift to get entry in page dir. */
#define I386_VM_PT_ENT_SHIFT 12 /* Shift to get entry in page table */
#define I386_VM_PT_ENT_MASK 0x3FF /* Mask to get entry in page table */
#define I386_VM_PT_ENTRIES 1024 /* Number of entries in a page table */
#define I386_VM_PFA_SHIFT 22 /* Page frame address shift */
/* CR0 bits */
#define I386_CR0_PE 0x00000001 /* Protected mode */
#define I386_CR0_MP 0x00000002 /* Monitor Coprocessor */
#define I386_CR0_EM 0x00000004 /* Emulate */
#define I386_CR0_TS 0x00000008 /* Task Switched */
#define I386_CR0_ET 0x00000010 /* Extension Type */
#define I386_CR0_WP 0x00010000 /* Enable paging */
#define I386_CR0_PG 0x80000000 /* Enable paging */
/* some CR4 bits */
#define I386_CR4_VME 0x00000001 /* Virtual 8086 */
#define I386_CR4_PVI 0x00000002 /* Virtual ints */
#define I386_CR4_TSD 0x00000004 /* RDTSC privileged */
#define I386_CR4_DE 0x00000008 /* Debugging extensions */
#define I386_CR4_PSE 0x00000010 /* Page size extensions */
#define I386_CR4_PAE 0x00000020 /* Physical addr extens. */
#define I386_CR4_MCE 0x00000040 /* Machine check enable */
#define I386_CR4_PGE 0x00000080 /* Global page flag enable */
/* i386 paging 'functions' */
#define I386_VM_PTE(v) (((v) >> I386_VM_PT_ENT_SHIFT) & I386_VM_PT_ENT_MASK)
#define I386_VM_PDE(v) ( (v) >> I386_VM_DIR_ENT_SHIFT)
#define I386_VM_PFA(e) ( (e) & I386_VM_ADDR_MASK)
#define I386_VM_PAGE(v) ( (v) >> I386_VM_PFA_SHIFT)
/* i386 pagefault error code bits */
#define I386_VM_PFE_P 0x01 /* Pagefault caused by non-present page.
* (otherwise protection violation.)
*/
#define I386_VM_PFE_W 0x02 /* Caused by write (otherwise read) */
#define I386_VM_PFE_U 0x04 /* CPU in user mode (otherwise supervisor) */
/* CPUID flags */
#define CPUID1_EDX_FPU (1L) /* FPU presence */
#define CPUID1_EDX_PSE (1L << 3) /* Page Size Extension */
#define CPUID1_EDX_SYSENTER (1L << 11) /* Intel SYSENTER */
#define CPUID1_EDX_PGE (1L << 13) /* Page Global (bit) Enable */
#define CPUID1_EDX_APIC_ON_CHIP (1L << 9) /* APIC is present on the chip */
#define CPUID1_EDX_TSC (1L << 4) /* Timestamp counter present */
#define CPUID1_EDX_HTT (1L << 28) /* Supports HTT */
#define CPUID1_EDX_FXSR (1L << 24)
#define CPUID1_EDX_SSE (1L << 25)
#define CPUID1_EDX_SSE2 (1L << 26)
#define CPUID1_ECX_SSE3 (1L)
#define CPUID1_ECX_SSSE3 (1L << 9)
#define CPUID1_ECX_SSE4_1 (1L << 19)
#define CPUID1_ECX_SSE4_2 (1L << 20)
#define CPUID_EF_EDX_SYSENTER (1L << 11) /* Intel SYSENTER */
#ifndef __ASSEMBLY__
#include <minix/type.h>
/* structure used by VM to pass data to the kernel while enabling paging */
struct vm_ep_data {
struct mem_map * mem_map;
vir_bytes data_seg_limit;
};
#endif
#endif /* __SYS_VM_386_H__ */

View File

@@ -1,11 +0,0 @@
INCSDIR= /usr/include/ddekit
INCS+= assert.h initcall.h memory.h pgtab.h \
thread.h attribs.h inline.h printf.h \
timer.h condvar.h interrupt.h panic.h \
resources.h types.h debug.h lock.h \
pci.h semaphore.h usb.h ddekit.h
SUBDIR+= minix
.include <bsd.kinc.mk>

View File

@@ -1,23 +0,0 @@
#ifndef _ddekit_assert_h
#define _ddekit_assert_h
#include <ddekit/ddekit.h>
#include <ddekit/printf.h>
#include <ddekit/panic.h>
/** \file ddekit/assert.h */
/** Assert that an expression is true and panic if not.
* \ingroup DDEKit_util
*/
#define ddekit_assert(expr) do \
{ \
if (!(expr)) { \
ddekit_print("\033[31;1mDDE: Assertion failed: "#expr"\033[0m\n"); \
ddekit_printf(" File: %s:%d\n",__FILE__,__LINE__); \
ddekit_printf(" Function: %s()\n", __FUNCTION__); \
ddekit_panic("Assertion failed."); \
}} while (0);
#define Assert ddekit_assert
#endif

View File

@@ -1,16 +0,0 @@
#ifndef _DDEKIT_ATTRIBS_H
#define _DDEKIT_ATTRIBS_H
#ifdef __ACK__
#else
#define DDEKIT_USED __attribute__((used))
#define DDEKIT_CONSTRUCTOR __attribute__((constructor))
#define DDEKIT_PUBLIC PUBLIC
#define DDEKIT_PRIVATE static
#endif
#endif

View File

@@ -1,31 +0,0 @@
#ifndef _ddekit_condvar_h
#define _ddekit_condvar_h
/** \file ddekit/condvar.h */
#include <ddekit/ddekit.h>
#include <ddekit/lock.h>
struct ddekit_condvar;
typedef struct ddekit_condvar ddekit_condvar_t;
/* Initialize conditional variable. */
ddekit_condvar_t * ddekit_condvar_init(void);
/* Uninitialize conditional variable. */
void ddekit_condvar_deinit(ddekit_condvar_t *cvp);
/* Wait on a conditional variable. */
void ddekit_condvar_waiti(ddekit_condvar_t *cvp, ddekit_lock_t *mp);
/* Wait on a conditional variable at most until a timeout expires. (UNIMPL) */
int ddekit_condvar_wait_timed(ddekit_condvar_t *cvp, ddekit_lock_t *mp,
int timo);
/* Send signal to the next one waiting for condvar. */
void ddekit_condvar_signal(ddekit_condvar_t *cvp);
/* Send signal to all threads waiting for condvar. */
void ddekit_condvar_broadcast(ddekit_condvar_t *cvp);
#endif

View File

@@ -1,6 +0,0 @@
#ifndef _DDEKIT_DDEKIT_H
#define _DDEKIT_DDEKIT_H
void ddekit_init(void);
#endif

View File

@@ -1,41 +0,0 @@
#ifndef DDEKIT_DEBUG_H
#define DDEKIT_DEBUG_H
#include <ddekit/ddekit.h>
#include <ddekit/printf.h>
#define DDEBUG_QUIET 0
#define DDEBUG_ERR 1
#define DDEBUG_WARN 2
#define DDEBUG_INFO 3
#define DDEBUG_VERBOSE 4
#define DDEBUG_MEM DDEBUG_INFO
#define DDEBUG_MSG_ERR(fmt, ...)
#define DDEBUG_MSG_WARN(fmt, ...)
#define DDEBUG_MSG_INFO(fmt, ...)
#define DDEBUG_MSG_VERBOSE(fmt, ...)
#if DDEBUG >= DDEBUG_ERR
#undef DDEBUG_MSG_ERR
#define DDEBUG_MSG_ERR(fmt, ...) ddekit_printf("%s : "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#if DDEBUG >= DDEBUG_WARN
#undef DDEBUG_MSG_WARN
#define DDEBUG_MSG_WARN(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#if DDEBUG >= DDEBUG_INFO
#undef DDEBUG_MSG_INFO
#define DDEBUG_MSG_INFO(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#if DDEBUG >= DDEBUG_VERBOSE
#undef DDEBUG_MSG_VERBOSE
#define DDEBUG_MSG_VERBOSE(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ )
#endif
#endif

View File

@@ -1,30 +0,0 @@
#ifndef _DDEKIT_INITCALL_H
#define _DDEKIT_INITCALL_H
#include <ddekit/ddekit.h>
#include <ddekit/attribs.h>
typedef void (*ddekit_initcall_t)(void);
struct __ddekit_initcall_s {
ddekit_initcall_t func;
int prio;
struct __ddekit_initcall_s *next;
};
void __ddekit_add_initcall(struct __ddekit_initcall_s *dis);
/* Define a function to be a DDEKit initcall.
* This is the right place to place Linux' module_init functions & Co.
*/
#define DDEKIT_INITCALL(fn) DDEKIT_CTOR(fn, 1)
#define DDEKIT_CTOR(fn, prio) \
static void __attribute__((used)) __attribute__((constructor))\
__ddekit_initcall_##fn() { \
static struct __ddekit_initcall_s dis = {(ddekit_initcall_t)fn, prio, 0}; \
__ddekit_add_initcall(&dis); }
/* Runs all registered initcalls. */
void ddekit_do_initcalls(void);
#endif

View File

@@ -1,2 +0,0 @@
#define DDEKIT_INLINE __inline__ __attribute__((always_inline))

View File

@@ -1,47 +0,0 @@
/*-
* Copyright (c) 2006 TU Dresden, 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 COPYRIGHT HOLDERS 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
* COPYRIGHT HOLDERS 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.
*/
#ifndef _DDEKIT_INTERUPT_H
#define _DDEKIT_INTERUPT_H
#include <ddekit/ddekit.h>
#include <ddekit/thread.h>
/** Attach to an interrupt */
ddekit_thread_t *ddekit_interrupt_attach( int irq, int shared,
void(*thread_init)(void *), void(*handler)(void *), void *priv);
/* Detach from a previously attached interrupt. */
void ddekit_interrupt_detach(int irq);
/* Block interrupt. */
void ddekit_interrupt_disable(int irq);
/* Enable interrupt */
void ddekit_interrupt_enable(int irq);
#endif

View File

@@ -1,33 +0,0 @@
#ifndef _DDEKIT_LOCK_H
#define _DDEKIT_LOCK_H
#include <ddekit/ddekit.h>
struct ddekit_lock;
typedef struct ddekit_lock *ddekit_lock_t;
/* Initialize a DDEKit unlocked lock. */
#define ddekit_lock_init ddekit_lock_init_unlocked
/* Initialize a DDEKit unlocked lock. */
void ddekit_lock_init_unlocked(ddekit_lock_t *mtx);
/* Initialize a DDEKit locked lock. */
void ddekit_lock_init_locked(ddekit_lock_t *mtx);
/* Uninitialize a DDEKit lock. */
void ddekit_lock_deinit(ddekit_lock_t *mtx);
/* Acquire a lock. */
void ddekit_lock_lock(ddekit_lock_t *mtx);
/* Acquire a lock, non-blocking. */
int ddekit_lock_try_lock(ddekit_lock_t *mtx);
/* Unlock function. */
void ddekit_lock_unlock(ddekit_lock_t *mtx);
/* Get lock owner. */
int ddekit_lock_owner(ddekit_lock_t *mtx);
#endif

View File

@@ -1,143 +0,0 @@
/*-
* Copyright (c) 2006 Thomas Friebel <tf13@os.inf.tu-dresden.de>
* Copyright (c) 2006 Christian Helmuth <ch12@os.inf.tu-dresden.de>
* Copyright (c) 2010 Dirk Vogt <dvogt@few.vu.nl>.
* 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 COPYRIGHT HOLDERS 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
* COPYRIGHT HOLDERS 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.
*/
#ifndef _DDEKIT_MEMORY_H
#define _DDEKIT_MEMORY_H
#include <ddekit/ddekit.h>
/*******************
** Slab facility **
*******************/
struct ddekit_slab;
/* Store user pointer in slab cache */
void ddekit_slab_set_data(struct ddekit_slab * slab, void *data);
/* Read user pointer from slab cache */
void *ddekit_slab_get_data(struct ddekit_slab * slab);
/* Allocate slab in slab cache */
void *ddekit_slab_alloc(struct ddekit_slab * slab);
/* Allocate slab in slab cache */
void ddekit_slab_free(struct ddekit_slab * slab, void *objp);
/*
* Setup page cache for all slabs
*
* pages: maximal number of memory pages
*
* If 'pages' is too low, memory pages may be given back to the memory server
* (dm_phys) and just to be allocated again later. This hits performance (but
* saves memory). Increase 'pages' to avoid this thrashing-like effect.
*
* If the maximal number of unused pages is exceeded, subsequent deallocation
* will be freed at the memory server. This page cache caches pages from all
* slabs.
*/
void ddekit_slab_setup_page_cache(unsigned pages);
/*
* Destroy slab cache
*
* slab: pointer to slab cache structure
*/
void ddekit_slab_destroy(struct ddekit_slab * slab);
/**
* Initialize slab cache
*
* \param size size of cache objects
* \param contiguous make this slab use physically contiguous memory
*
* \return pointer to new slab cache or 0 on error
*/
struct ddekit_slab * ddekit_slab_init(unsigned size, int contiguous);
/**********************
** Memory allocator **
**********************/
/*
* Allocate large memory block
*
* \param size block size
* \return pointer to new memory block
*
* Allocations via this allocator may be slow (because memory servers are
* involved) and should be used only for large (i.e., > page size) blocks. If
* allocations/deallocations are relatively dynamic this may not be what you
* want.
*
* Allocated blocks have valid virt->phys mappings and are physically
* contiguous.
*/
void *ddekit_large_malloc(int size);
/**
* Free large memory block
*
* \param p pointer to memory block
*/
void ddekit_large_free(void *p);
/** FIXME
* contig_malloc() is the lowest-level allocator interface one could implement.
* we should consider to provide vmalloc() too. */
void *ddekit_contig_malloc(unsigned long size, unsigned long low,
unsigned long high, unsigned long alignment, unsigned long boundary);
/*****************************
** Simple memory allocator **
*****************************/
/**
* Allocate memory block via simple allocator
*
* \param size block size
* \return pointer to new memory block
*
* The blocks allocated via this allocator CANNOT be used for DMA or other
* device operations, i.e., there exists no virt->phys mapping.
*/
void *ddekit_simple_malloc(unsigned size);
/**
* Free memory block via simple allocator
*
* \param p pointer to memory block
*/
void ddekit_simple_free(void *p);
#endif

View File

@@ -1,7 +0,0 @@
INCSDIR= /usr/include/ddekit/minix
INCS+= pci.h \
msg_queue.h
.include <bsd.kinc.mk>

View File

@@ -1,21 +0,0 @@
#ifndef DDEKIT_SRC_MSG_QUEUE_H
#define DDEKIT_SRC_MSG_QUEUE_H
#include <ddekit/ddekit.h>
#include <ddekit/thread.h>
#include <minix/ipc.h>
struct ddekit_minix_msg_q;
void ddekit_minix_queue_msg(message *m, int ipc_status);
void ddekit_minix_rcv
(struct ddekit_minix_msg_q * mq, message *m, int *ipc_status);
struct ddekit_minix_msg_q *ddekit_minix_create_msg_q(unsigned from,
unsigned to);
void ddekit_minix_destroy_msg_q(struct ddekit_minix_msg_q *mq);
#endif /* DDEKIT_SRC_MSG_QUEUE_H */

View File

@@ -1,4 +0,0 @@
#ifndef DDEKIT_MINIX_PCI
#define DDEKIT_MINIX_PCI
void ddekit_pci_init_only_one(int skip);
#endif

View File

@@ -1,18 +0,0 @@
#ifndef _DDEKIT_PANIC_H
#define _DDEKIT_PANIC_H
#include <ddekit/ddekit.h>
#include <stdarg.h>
/** \defgroup DDEKit_util */
/** Panic - print error message and enter the kernel debugger.
* \ingroup DDEKit_util
*/
void ddekit_panic(char *fmt, ...);
/** Print a debug message.
* \ingroup DDEKit_util
*/
void ddekit_debug(char *fmt, ...);
#endif

View File

@@ -1,210 +0,0 @@
#ifndef _DDEKIT_PCI_H
#define _DDEKIT_PCI_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/** \defgroup DDEKit_pci */
/** Our version of PCI_ANY_ID */
#define DDEKIT_PCI_ANY_ID (~0)
/** Copy of L4IO_PCIDEV_RES */
#define DDEKIT_PCIDEV_RES 12
struct ddekit_pci_dev;
/** PCI resource descriptor. Copied from generic_io.
*
* XXX!
*/
typedef struct ddekit_pci_resource {
unsigned long start;
unsigned long end;
unsigned long flags;
} ddekit_pci_res_t;
void ddekit_pci_init(void);
int ddekit_pci_get_device(int nr, int *bus, int *slot, int *func);
int ddekit_pci_read(int bus, int slot, int func, int pos, int len,
ddekit_uint32_t *val);
int ddekit_pci_write(int bus, int slot, int func, int pos, int len,
ddekit_uint32_t val);
/** Read byte from PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val read value
*
* \return 0 success
*/
int ddekit_pci_readb(int bus, int slot, int func, int pos,
ddekit_uint8_t *val);
/** Read word from PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val read value
*
* \return 0 success
*/
int ddekit_pci_readw(int bus, int slot, int func, int pos,
ddekit_uint16_t *val);
/** Read dword from PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val read value
*
* \return 0 success
*/
int ddekit_pci_readl(int bus, int slot, int func, int pos,
ddekit_uint32_t *val);
/** Write byte to PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val value to write
*
* \return 0 success
*/
int ddekit_pci_writeb(int bus, int slot, int func, int pos,
ddekit_uint8_t val);
/** Write word to PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val value to write
*
* \return 0 success
*/
int ddekit_pci_writew(int bus, int slot, int func, int pos,
ddekit_uint16_t val);
/** Write word to PCI config space.
*
* \ingroup DDEKit_pci
*
* \param bus bus ID
* \param slot slot #
* \param func function #
* \param pos offset in config space
* \retval val value to write
*
* \return 0 success
*/
int ddekit_pci_writel(int bus, int slot, int func, int pos,
ddekit_uint32_t val);
/** Find a PCI device.
*
* \ingroup DDEKit_pci
*
* \param bus pointer to bus number or \ref DDEKIT_PCI_ANY_ID
* \param slot pointer to slot number (devfn >> DEVFN_SLOTSHIFT) or \ref DDEKIT_PCI_ANY_ID
* \param func pointer to func number (devfc & DEVFN_FUNCMASK) or \ref DDEKIT_PCI_ANY_ID
* \param start search device list only behind this device (excluding it!), NULL
* searches whole device list
*
* \retval bus bus number
* \retval slot slot number
* \retval func function number
*
* \return device a valid PCI device
* \return NULL if no device found
*/
struct ddekit_pci_dev * ddekit_pci_find_device(int *bus, int *slot, int
*func, struct ddekit_pci_dev *start);
/** Enable PCI device
* \ingroup DDEKit_pci
*/
int ddekit_pci_enable_device(struct ddekit_pci_dev *dev);
/** Disable PCI device
* \ingroup DDEKit_pci
*/
int ddekit_pci_disable_device(struct ddekit_pci_dev *dev);
/** Enable bus-mastering for device.
* \ingroup DDEKit_pci
*/
void ddekit_pci_set_master(struct ddekit_pci_dev *dev);
/** Get device vendor ID.
* \ingroup DDEKit_pci
*/
unsigned short ddekit_pci_get_vendor(struct ddekit_pci_dev *dev);
/** Get device ID.
* \ingroup DDEKit_pci
*/
unsigned short ddekit_pci_get_device_id(struct ddekit_pci_dev *dev);
/** Get device subvendor ID.
* \ingroup DDEKit_pci
*/
unsigned short ddekit_pci_get_sub_vendor(struct ddekit_pci_dev *dev);
/** Get subdevice ID.
* \ingroup DDEKit_pci
*/
unsigned short ddekit_pci_get_sub_device(struct ddekit_pci_dev *dev);
/** Get device class ID.
* \ingroup DDEKit_pci
*/
unsigned ddekit_pci_get_dev_class(struct ddekit_pci_dev *dev);
/** Get device's IRQ number.
* \ingroup DDEKit_pci
*/
unsigned long ddekit_pci_get_irq(struct ddekit_pci_dev *dev);
/** Get device name.
* \ingroup DDEKit_pci
*/
char *ddekit_pci_get_name(struct ddekit_pci_dev *dev);
/** Get device's slot name.
* \ingroup DDEKit_pci
*/
char *ddekit_pci_get_slot_name(struct ddekit_pci_dev *dev);
/** Get one of the device's resources.
* \ingroup DDEKit_pci
*/
ddekit_pci_res_t *ddekit_pci_get_resource(struct ddekit_pci_dev *dev,
unsigned int idx);
int ddekit_pci_irq_enable(int bus, int slot, int func, int pin, int
*irq);
#endif

View File

@@ -1,90 +0,0 @@
/*
* \brief Virtual page-table facility
* \author Thomas Friebel <tf13@os.inf.tu-dresden.de>
* \author Christian Helmuth <ch12@os.inf.tu-dresden.de>
* \date 2006-11-03
*/
#ifndef _DDEKIT_PGTAB_H
#define _DDEKIT_PGTAB_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/* FIXME Region types may be defined by pgtab users. Do we really need them
* here? */
enum ddekit_pgtab_type
{
PTE_TYPE_OTHER, PTE_TYPE_LARGE, PTE_TYPE_UMA, PTE_TYPE_CONTIG
};
/**
* Set virtual->physical mapping for VM region
*
* \param virt virtual start address for region
* \param phys physical start address for region
* \param pages number of pages in region
* \param type pgtab type for region
*/
void ddekit_pgtab_set_region(void *virt, ddekit_addr_t phys, int pages,
int type);
/**
* Set virtual->physical mapping for VM region given a specific size in bytes.
*
* Internally, DDEKit manages regions with pages. However, DDEs do not need to tangle
* with the underlying mechanism and therefore can use this function that takes care
* of translating a size to an amount of pages.
*/
void ddekit_pgtab_set_region_with_size(void *virt, ddekit_addr_t phys,
int size, int type);
/**
* Clear virtual->physical mapping for VM region
*
* \param virt virtual start address for region
* \param type pgtab type for region
*/
void ddekit_pgtab_clear_region(void *virt, int type);
/**
* Get physical address for virtual address
*
* \param virt virtual address
*
* \return physical address
*/
ddekit_addr_t ddekit_pgtab_get_physaddr(const void *virt);
/**
* Get virtual address for physical address
*
* \param physical physical address
*
* \return virtual address
*/
ddekit_addr_t ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical);
/**
* Get type of VM region.
*
* \param virt virtual address
* \return VM region type
*/
int ddekit_pgtab_get_type(const void *virt);
/**
* Get size of VM region.
*
* \param virt virtual address
*
* \return VM region size (in bytes)
*/
int ddekit_pgtab_get_size(const void *virt);
#endif

View File

@@ -1,34 +0,0 @@
#ifndef _DDEKIT_PRINTF_H
#define _DDEKIT_PRINTF_H
#include <ddekit/ddekit.h>
#include <stdarg.h>
/** Print message.
* \ingroup DDEKit_util
*/
int ddekit_print(const char *);
/** Print message with format.
* \ingroup DDEKit_util
*/
int ddekit_printf(const char *fmt, ...);
/** Print message with format list.
* \ingroup DDEKit_util
*/
int ddekit_vprintf(const char *fmt, va_list va);
/** Log function and message.
* \ingroup DDEKit_util
*/
#define ddekit_log(doit, msg...) \
do { \
if (doit) { \
ddekit_printf("%s(): ", __func__); \
ddekit_printf(msg); \
ddekit_printf("\n"); \
} \
} while(0);
#endif

View File

@@ -1,80 +0,0 @@
#ifndef _DDEKIT_RESOURCES_H
#define _DDEKIT_RESOURCES_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/*
* request/release an isa DMA-channel
*/
int ddekit_request_dma(int nr);
int ddekit_release_dma(int nr);
/*
* request/release an io-port range starting at addr start, lenght of count
*/
int ddekit_request_io(ddekit_addr_t start, ddekit_addr_t count);
int ddekit_release_io(ddekit_addr_t start, ddekit_addr_t count);
/*
* request an IO-Memory mapping from address start to vaddr of the length count
*/
int ddekit_request_mem(ddekit_addr_t start, ddekit_addr_t count,
ddekit_addr_t *vaddr);
int ddekit_release_mem(ddekit_addr_t start, ddekit_addr_t count);
/**
* Read I/O port (byte)
*
* \param port port to read
*
* \return value read from port
*/
unsigned char ddekit_inb(ddekit_addr_t port);
/**
* Read I/O port (2-byte)
*
* \param port port to read
*
* \return value read from port
*/
unsigned short ddekit_inw(ddekit_addr_t port);
/**
* Read I/O port (4-byte)
*
* \param port port to read
*
* \return value read from port
*/
unsigned long ddekit_inl(ddekit_addr_t port);
/**
* Write I/O port (byte)
*
* \param port port to write
* \param val value to write
*/
void ddekit_outb(ddekit_addr_t port, unsigned char val);
/**
* Write I/O port (2-byte)
*
* \param port port to write
* \param val value to write
*/
void ddekit_outw(ddekit_addr_t port, unsigned short val);
/**
* Write I/O port (4-byte)
*
* \param port port to write
* \param val value to write
*/
void ddekit_outl(ddekit_addr_t port, unsigned long val);
#endif

View File

@@ -1,53 +0,0 @@
#ifndef _DDEKIT_SEMAPHORE_H
#define _DDEKIT_SEMAPHORE_H
#include <ddekit/ddekit.h>
/** \defgroup DDEKit_synchronization */
struct ddekit_sem;
typedef struct ddekit_sem ddekit_sem_t;
/** Initialize DDEKit semaphore.
*
* \ingroup DDEKit_synchronization
*
* \param value initial semaphore counter
*/
ddekit_sem_t *ddekit_sem_init(int value);
/** Uninitialize semaphore.
*
* \ingroup DDEKit_synchronization
*/
void ddekit_sem_deinit(ddekit_sem_t *sem);
/** Semaphore down method. */
void ddekit_sem_down(ddekit_sem_t *sem);
/** Semaphore down method, non-blocking.
*
* \ingroup DDEKit_synchronization
*
* \return 0 success
* \return !=0 would block
*/
int ddekit_sem_down_try(ddekit_sem_t *sem);
/** Semaphore down with timeout.
*
* \ingroup DDEKit_synchronization
*
* \return 0 success
* \return !=0 would block
*/
int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo);
/** Semaphore up method.
*
* \ingroup DDEKit_synchronization
*/
void ddekit_sem_up(ddekit_sem_t *sem);
#endif

View File

@@ -1,163 +0,0 @@
#ifndef _DDEKIT_THREAD_H
#define _DDEKIT_THREAD_H
/** \defgroup DDEKit_threads */
#include <ddekit/ddekit.h>
#include <ddekit/lock.h>
struct ddekit_thread;
typedef struct ddekit_thread ddekit_thread_t;
/** Create thread
*
* \ingroup DDEKit_threads
*
* Create a new thread running the specified thread function with the specified
* arguments. The thread is assigned the given internal name.
*
* Additionally, DDEKit threads possess a thread-local storage area where they
* may store arbitrary data.
*
* \param fun thread function
* \param arg optional argument to thread function, set to NULL if not needed
* \param name internal thread name
*/
ddekit_thread_t *ddekit_thread_create(void (*fun)(void *), void *arg,
const char *name);
/** Reference to own DDEKit thread id.
*
* \ingroup DDEKit_threads
*/
ddekit_thread_t *ddekit_thread_myself(void);
/** Initialize thread with given name.
*
* \ingroup DDEKit_threads
*
* This function may be used by threads that were not created using
* \ref ddekit_thread_create. This enables such threads to be handled as if they
* were DDEKit threads.
*/
ddekit_thread_t *ddekit_thread_setup_myself(const char *name);
/** Get TLS data for a specific thread.
*
* \ingroup DDEKit_threads
*
* \return Pointer to TLS data of this thread.
*/
void *ddekit_thread_get_data(ddekit_thread_t *thread);
/** Get TLS data for current thread.
*
* \ingroup DDEKit_threads
*
* Same as calling \ref ddekit_thread_get_data with \ref ddekit_thread_myself
* as parameter.
*
* \return Pointer to TLS data of current thread.
*/
void *ddekit_thread_get_my_data(void);
/** Set TLS data for specific thread.
*
* \ingroup DDEKit_threads
*
* \param thread DDEKit thread
* \param data pointer to thread data
*/
void ddekit_thread_set_data(ddekit_thread_t *thread, void *data);
/** Set TLS data for current thread.
*
* \ingroup DDEKit_threads
*
* \param data pointer to thread data
*/
void ddekit_thread_set_my_data(void *data);
/** Sleep for some miliseconds.
*
* \ingroup DDEKit_threads
*
* \param msecs time to sleep in ms.
*/
void ddekit_thread_msleep(unsigned long msecs);
/** Sleep for some microseconds.
*
* \ingroup DDEKit_threads
*
* \param usecs time to sleep in µs.
*/
void ddekit_thread_usleep(unsigned long usecs);
/** Sleep for some nanoseconds.
*
* \ingroup DDEKit_threads
*
* \param usecs time to sleep in ns.
*/
void ddekit_thread_nsleep(unsigned long nsecs);
/** Sleep until a lock becomes unlocked.
*
* \ingroup DDEKit_threads
*/
void ddekit_thread_sleep(ddekit_lock_t *lock);
/** Wakeup a waiting thread.
*
* \ingroup DDEKit_threads
*/
void ddekit_thread_wakeup(ddekit_thread_t *thread);
/** Terminate a thread
*
* \ingroup DDEKit_threads
*/
void ddekit_thread_exit(void) __attribute__((noreturn));
/** Terminate a thread
*
* \ingroup DDEKit_threads
*/
void ddekit_thread_terminate(ddekit_thread_t *thread);
/** Get the name, a thread registered with DDEKit.
*
* \ingroup DDEKit_threads
*/
const char *ddekit_thread_get_name(ddekit_thread_t *thread);
/** Get unique ID of a DDEKit thread.
*
* \ingroup DDEKit_threads
*
* DDEKit does not allow direct access to the thread data
* structure, since this struct contains L4-specific data types.
* However, applications might want to get some kind of ID related
* to a ddekit_thread, for instance to use it as a Linux-like PID.
*/
int ddekit_thread_get_id(ddekit_thread_t *thread);
/** Hint that this thread is done and may be scheduled somehow.
*
* \ingroup DDEKit_threads
*/
void ddekit_thread_schedule(void);
/** Hint that this thread is done and may be scheduled somehow.
*
* \ingroup DDEKit_threads
*/
void ddekit_yield(void);
/** Initialize DDEKit thread subsystem.
*
* \ingroup DDEKit_threads
*/
void ddekit_init_threads(void);
#endif

View File

@@ -1,52 +0,0 @@
#ifndef _DDEKIT_TIMER_H
#define _DDEKIT_TIMER_H
#include <ddekit/ddekit.h>
#include <ddekit/thread.h>
/** \defgroup DDEKit_timer
*
* Timer subsystem
*
* DDEKit provides a generic timer implementation that enables users
* to execute a function with some arguments after a certain period
* of time. DDEKit therefore starts a timer thread that executes these
* functions and keeps track of the currently running timers.
*/
/** Add a timer event. After the absolute timeout has expired, function fn
* is called with args as arguments.
*
* \ingroup DDEKit_timer
*
* \return >=0 valid timer ID
* \return < 0 error
*/
int ddekit_add_timer(void (*fn)(void *), void *args, unsigned long
timeout);
/** Delete timer with the corresponding timer id.
*
* \ingroup DDEKit_timer
*/
int ddekit_del_timer(int timer);
/** Check whether a timer is pending
*
* \ingroup DDEKit_timer
*
* Linux needs this.
*/
int ddekit_timer_pending(int timer);
/** Initialization function, startup timer thread
*
* \ingroup DDEKit_timer
*/
void ddekit_init_timers(void);
/** Get the timer thread.
*/
ddekit_thread_t *ddekit_get_timer_thread(void);
#endif

View File

@@ -1,22 +0,0 @@
/*
* \brief Types for ddekit (x86 version)
* \author Thomas Friebel <tf13@os.inf.tu-dresden.de>
* \author Christian Helmuth <ch12@os.inf.tu-dresden.de>
* \date 2006-11-09
*
* FIXME This is definitely arch-dependent! Move to ARCH-something
*/
#ifndef _DDEKIT_TYPES_H
#define _DDEKIT_TYPES_H
typedef signed char ddekit_int8_t;
typedef unsigned char ddekit_uint8_t;
typedef signed short int ddekit_int16_t;
typedef unsigned short int ddekit_uint16_t;
typedef signed int ddekit_int32_t;
typedef unsigned int ddekit_uint32_t;
typedef unsigned long ddekit_addr_t;
#endif

View File

@@ -1,95 +0,0 @@
#ifndef _DDEKIT_USB_H
#define _DDEKIT_USB_H
#include <ddekit/ddekit.h>
#include <ddekit/types.h>
/** isochronous transfer */
#define DDEKIT_USB_TRANSFER_ISO 0
/** interrupt transfer */
#define DDEKIT_USB_TRANSFER_INT 1
/** control transfer */
#define DDEKIT_USB_TRANSFER_CTL 2
/** bulk transfer */
#define DDEKIT_USB_TRANSFER_BLK 3
#define DDEKIT_USB_IN 1
#define DDEKIT_USB_OUT 0
struct ddekit_usb_dev;
struct ddekit_usb_urb;
struct ddekit_usb_device_id {
ddekit_uint16_t idVendor;
ddekit_uint16_t idProduct;
ddekit_uint32_t bcdDevice;
ddekit_uint8_t bDeviceClass;
ddekit_uint8_t bDeviceSubClass;
ddekit_uint8_t bDeviceProtocol;
ddekit_uint8_t bInterfaceClass;
ddekit_uint8_t bInterfaceSubClass;
ddekit_uint8_t bInterfaceProtocol;
};
struct ddekit_usb_iso_packet_desc {
ddekit_int32_t offset;
ddekit_int32_t length; /* expected length */
ddekit_int32_t actual_length;
ddekit_int32_t status;
};
typedef void (*ddekit_usb_completion_cb)(void* priv);
typedef void (*ddekit_usb_connect_cb)(struct ddekit_usb_dev *dev,
unsigned int interfaces);
typedef void (*ddekit_usb_disconnect_cb)(struct ddekit_usb_dev *dev);
typedef void *(*ddekit_usb_malloc_fn)(unsigned size);
typedef void (*ddekit_usb_free_fn)(void *ptr);
struct ddekit_usb_driver {
ddekit_usb_completion_cb completion;
ddekit_usb_connect_cb connect;
ddekit_usb_disconnect_cb disconnect;
};
struct ddekit_usb_urb {
struct ddekit_usb_dev *dev;
ddekit_int32_t type;
ddekit_int32_t endpoint;
ddekit_int32_t direction;
ddekit_int32_t status;
ddekit_int32_t interval;
ddekit_uint32_t transfer_flags;
ddekit_uint32_t size;
ddekit_uint32_t actual_length;
ddekit_int32_t number_of_packets;
ddekit_int32_t error_count;
ddekit_int32_t start_frame;
char *setup_packet;
char *data;
struct ddekit_usb_iso_packet_desc *iso_desc;
void *priv;
void *ddekit_priv;
};
int ddekit_usb_dev_set_data(struct ddekit_usb_dev *dev, void *data);
void *ddekit_usb_dev_get_data(struct ddekit_usb_dev *dev);
void ddekit_usb_get_device_id(struct ddekit_usb_dev *dev, struct
ddekit_usb_device_id *id);
int ddekit_usb_submit_urb(struct ddekit_usb_urb *d_urb);
int ddekit_usb_cancle_urb(struct ddekit_usb_urb *d_urb);
/*
* This one is only implemented for the client side. For the server side is
* has to be implemented in the DDELinux/FBSD part.
*/
int ddekit_usb_init(struct ddekit_usb_driver *drv, ddekit_usb_malloc_fn
*_m, ddekit_usb_free_fn *_f);
#endif

View File

@@ -1,4 +0,0 @@
int env_parse(const char *env, const char *fmt, int field, long *param, long min,
long max);
void env_panic(const char *env);
int env_prefix(char *env, char *prefix);

View File

@@ -1,187 +0,0 @@
/* $NetBSD: fetch.h,v 1.16 2010/01/22 13:21:09 joerg Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* 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
* in this position and unchanged.
* 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.
* 3. 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.
*
* $FreeBSD: fetch.h,v 1.26 2004/09/21 18:35:20 des Exp $
*/
#ifndef _FETCH_H_INCLUDED
#define _FETCH_H_INCLUDED
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#define _LIBFETCH_VER "libfetch/2.0"
#define URL_HOSTLEN 255
#define URL_SCHEMELEN 16
#define URL_USERLEN 256
#define URL_PWDLEN 256
typedef struct fetchIO fetchIO;
struct url {
char scheme[URL_SCHEMELEN + 1];
char user[URL_USERLEN + 1];
char pwd[URL_PWDLEN + 1];
char host[URL_HOSTLEN + 1];
int port;
char *doc;
off_t offset;
size_t length;
time_t last_modified;
};
struct url_stat {
off_t size;
time_t atime;
time_t mtime;
};
struct url_list {
size_t length;
size_t alloc_size;
struct url *urls;
};
/* Recognized schemes */
#define SCHEME_FTP "ftp"
#define SCHEME_HTTP "http"
#define SCHEME_HTTPS "https"
#define SCHEME_FILE "file"
/* Error codes */
#define FETCH_ABORT 1
#define FETCH_AUTH 2
#define FETCH_DOWN 3
#define FETCH_EXISTS 4
#define FETCH_FULL 5
#define FETCH_INFO 6
#define FETCH_MEMORY 7
#define FETCH_MOVED 8
#define FETCH_NETWORK 9
#define FETCH_OK 10
#define FETCH_PROTO 11
#define FETCH_RESOLV 12
#define FETCH_SERVER 13
#define FETCH_TEMP 14
#define FETCH_TIMEOUT 15
#define FETCH_UNAVAIL 16
#define FETCH_UNKNOWN 17
#define FETCH_URL 18
#define FETCH_VERBOSE 19
#define FETCH_UNCHANGED 20
#if defined(__cplusplus)
extern "C" {
#endif
void fetchIO_close(fetchIO *);
ssize_t fetchIO_read(fetchIO *, void *, size_t);
ssize_t fetchIO_write(fetchIO *, const void *, size_t);
/* fetchIO-specific functions */
fetchIO *fetchXGetFile(struct url *, struct url_stat *, const char *);
fetchIO *fetchGetFile(struct url *, const char *);
fetchIO *fetchPutFile(struct url *, const char *);
int fetchStatFile(struct url *, struct url_stat *, const char *);
int fetchListFile(struct url_list *, struct url *, const char *,
const char *);
/* HTTP-specific functions */
fetchIO *fetchXGetHTTP(struct url *, struct url_stat *, const char *);
fetchIO *fetchGetHTTP(struct url *, const char *);
fetchIO *fetchPutHTTP(struct url *, const char *);
int fetchStatHTTP(struct url *, struct url_stat *, const char *);
int fetchListHTTP(struct url_list *, struct url *, const char *,
const char *);
/* FTP-specific functions */
fetchIO *fetchXGetFTP(struct url *, struct url_stat *, const char *);
fetchIO *fetchGetFTP(struct url *, const char *);
fetchIO *fetchPutFTP(struct url *, const char *);
int fetchStatFTP(struct url *, struct url_stat *, const char *);
int fetchListFTP(struct url_list *, struct url *, const char *,
const char *);
/* Generic functions */
fetchIO *fetchXGetURL(const char *, struct url_stat *, const char *);
fetchIO *fetchGetURL(const char *, const char *);
fetchIO *fetchPutURL(const char *, const char *);
int fetchStatURL(const char *, struct url_stat *, const char *);
int fetchListURL(struct url_list *, const char *, const char *,
const char *);
fetchIO *fetchXGet(struct url *, struct url_stat *, const char *);
fetchIO *fetchGet(struct url *, const char *);
fetchIO *fetchPut(struct url *, const char *);
int fetchStat(struct url *, struct url_stat *, const char *);
int fetchList(struct url_list *, struct url *, const char *,
const char *);
/* URL parsing */
struct url *fetchMakeURL(const char *, const char *, int,
const char *, const char *, const char *);
struct url *fetchParseURL(const char *);
struct url *fetchCopyURL(const struct url *);
char *fetchStringifyURL(const struct url *);
void fetchFreeURL(struct url *);
/* URL listening */
void fetchInitURLList(struct url_list *);
int fetchAppendURLList(struct url_list *, const struct url_list *);
void fetchFreeURLList(struct url_list *);
char *fetchUnquotePath(struct url *);
char *fetchUnquoteFilename(struct url *);
/* Connection caching */
void fetchConnectionCacheInit(int, int);
void fetchConnectionCacheClose(void);
/* Authentication */
typedef int (*auth_t)(struct url *);
extern auth_t fetchAuthMethod;
/* Last error code */
extern int fetchLastErrCode;
#define MAXERRSTRING 256
extern char fetchLastErrString[MAXERRSTRING];
/* I/O timeout */
extern int fetchTimeout;
/* Restart interrupted syscalls */
extern volatile int fetchRestartCalls;
/* Extra verbosity */
extern int fetchDebug;
#if defined(__cplusplus)
}
#endif
#endif

View File

@@ -1,39 +0,0 @@
/* The <lib.h> header is the master header used by the library.
* All the C files in the lib subdirectories include it.
*/
#ifndef _LIB_H
#define _LIB_H
/* First come the defines. */
#include <sys/featuretest.h> /* tell headers to include NetBSD stuff. */
/* The following are so basic, all the lib files get them automatically. */
#include <minix/config.h> /* must be first */
#include <sys/types.h>
#include <limits.h>
#include <errno.h>
#include <minix/const.h>
#include <minix/com.h>
#include <minix/type.h>
#include <minix/callnr.h>
#include <minix/endpoint.h>
#include <minix/ipc.h>
struct ps_strings; /* forward declaration for minix_stack_fill. */
void minix_stack_params(const char *path, char * const *argv, char * const *envp,
size_t *stack_size, char *overflow, int *argc, int *envc);
void minix_stack_fill(const char *path, int argc, char * const *argv,
int envc, char * const *envp, size_t stack_size, char *frame,
int *vsp, struct ps_strings **psp);
int __execve(const char *_path, char *const _argv[], char *const
_envp[], int _nargs, int _nenvps);
int _syscall(endpoint_t _who, int _syscallnr, message *_msgptr);
void _loadname(const char *_name, message *_msgptr);
int _len(const char *_s);
void _begsig(int _dummy);
#endif /* _LIB_H */

View File

@@ -1,5 +0,0 @@
INCSDIR= /usr/include/libdde
INCS+= usb_server.h
.include <bsd.kinc.mk>

View File

@@ -1,7 +0,0 @@
#ifndef __LIBDDE_USB_SERVER_H__
#define __LIBDDE_USB_SERVER_H__
/*****************************************************************************
* ddekit_usb_server_init *
****************************************************************************/
void ddekit_usb_server_init();
#endif /* __LIBDDE_USB_SERVER_H__ */

View File

@@ -1,8 +0,0 @@
#ifndef _LIBUTIL_H
#define _LIBUTIL_H 1
#include <termios.h>
int openpty(int *, int *, char *, struct termios *, struct winsize *);
#endif

View File

@@ -1,27 +0,0 @@
.include <bsd.own.mk>
INCSDIR= /usr/include/minix
INCS+= paths.h param.h
INCS+= acpi.h audio_fw.h bitmap.h \
bdev.h blockdriver.h blockdriver_mt.h \
board.h btrace.h \
callnr.h chardriver.h clkconf.h com.h \
config.h const.h cpufeature.h \
debug.h devio.h devman.h dmap.h \
driver.h drivers.h drvlib.h ds.h \
endpoint.h fb.h fslib.h gpio.h gcov.h hash.h \
hgfs.h i2c.h i2cdriver.h ioctl.h input.h \
inputdriver.h ipc.h ipcconst.h \
keymap.h log.h mmio.h mthread.h minlib.h \
netdriver.h optset.h padconf.h partition.h portio.h \
priv.h procfs.h profile.h queryparam.h \
rs.h safecopies.h sched.h sef.h sffs.h \
sound.h spin.h sys_config.h sysinfo.h \
syslib.h sysutil.h timers.h type.h \
u64.h usb.h usb_ch9.h vbox.h \
vboxfs.h vboxif.h vboxtype.h vm.h \
vfsif.h vtreefs.h libminixfs.h netsock.h \
virtio.h
.include <bsd.kinc.mk>

View File

@@ -1,44 +0,0 @@
#include <sys/types.h>
#include <minix/ipc.h>
#define ACPI_REQ_GET_IRQ 1
#define ACPI_REQ_MAP_BRIDGE 2
struct acpi_request_hdr {
endpoint_t m_source; /* message header */
u32_t request;
};
/*
* Message to request dev/pin translation to IRQ by acpi using the acpi routing
* tables
*/
struct acpi_get_irq_req {
struct acpi_request_hdr hdr;
u32_t bus;
u32_t dev;
u32_t pin;
u32_t __padding[4];
};
/* response from acpi to acpi_get_irq_req */
struct acpi_get_irq_resp {
endpoint_t m_source; /* message header */
i32_t irq;
u32_t __padding[7];
};
/* message format for pci bridge mappings to acpi */
struct acpi_map_bridge_req {
struct acpi_request_hdr hdr;
u32_t primary_bus;
u32_t secondary_bus;
u32_t device;
u32_t __padding[4];
};
struct acpi_map_bridge_resp {
endpoint_t m_source; /* message header */
int err;
u32_t __padding[7];
};

View File

@@ -1,87 +0,0 @@
#ifndef AUDIO_FW_H
#define AUDIO_FW_H
#include <minix/drivers.h>
#include <minix/chardriver.h>
#include <sys/ioc_sound.h>
int drv_init(void);
int drv_init_hw(void);
int drv_reset(void);
int drv_start(int sub_dev, int DmaMode);
int drv_stop(int sub_dev);
int drv_set_dma(u32_t dma, u32_t length, int chan);
int drv_reenable_int(int chan);
int drv_int_sum(void);
int drv_int(int sub_dev);
int drv_pause(int chan);
int drv_resume(int chan);
int drv_io_ctl(unsigned long request, void * val, int * len, int sub_dev);
int drv_get_irq(char *irq);
int drv_get_frag_size(u32_t *frag_size, int sub_dev);
/* runtime status fields */
typedef struct {
int readable;
int writable;
int DmaSize;
int NrOfDmaFragments;
int MinFragmentSize;
int NrOfExtraBuffers;
int Nr; /* sub device number */
int Opened; /* sub device opened */
int DmaBusy; /* is dma busy? */
int DmaMode; /* DEV_WRITE / DEV_READ */
int DmaReadNext; /* current dma buffer */
int DmaFillNext; /* next dma buffer to fill */
int DmaLength;
int BufReadNext; /* start of extra circular buffer */
int BufFillNext; /* end of extra circular buffer */
int BufLength;
int RevivePending; /* process waiting for this dev? */
endpoint_t ReviveProcNr; /* the process to unblock */
cdev_id_t ReviveId; /* request ID */
cp_grant_id_t ReviveGrant; /* grant id associated with io */
endpoint_t SourceProcNr; /* process to send notify to (FS) */
u32_t FragSize; /* dma fragment size */
char *DmaBuf; /* the dma buffer; extra space for
page alignment */
phys_bytes DmaPhys; /* physical address of dma buffer */
char* DmaPtr; /* pointer to aligned dma buffer */
int OutOfData; /* all buffers empty? */
char *ExtraBuf; /* don't use extra buffer;just
declare a pointer to supress
error messages */
} sub_dev_t;
typedef struct {
int minor_dev_nr;
int read_chan;
int write_chan;
int io_ctl;
} special_file_t;
typedef struct {
char* DriverName;
int NrOfSubDevices;
int NrOfSpecialFiles;
} drv_t;
EXTERN drv_t drv;
EXTERN sub_dev_t sub_dev[];
EXTERN special_file_t special_file[];
/* Number of bytes you can DMA before hitting a 64K boundary: */
#define dma_bytes_left(phys) \
((unsigned) (sizeof(int) == 2 ? 0 : 0x10000) - (unsigned) ((phys) & 0xFFFF))
#define NO_CHANNEL -1
#define NO_DMA 0
#define READ_DMA 1
#define WRITE_DMA 2
#endif /* AUDIO_FW_H */

View File

@@ -1,46 +0,0 @@
#ifndef _MINIX_BDEV_H
#define _MINIX_BDEV_H
/* Common API. */
extern void bdev_driver(dev_t dev, char *label);
/* Synchronous API. */
extern int bdev_open(dev_t dev, int access);
extern int bdev_close(dev_t dev);
extern ssize_t bdev_read(dev_t dev, u64_t pos, char *buf, size_t count,
int flags);
extern ssize_t bdev_write(dev_t dev, u64_t pos, char *buf, size_t count,
int flags);
extern ssize_t bdev_gather(dev_t dev, u64_t pos, iovec_t *vec, int count,
int flags);
extern ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
int flags);
extern int bdev_ioctl(dev_t dev, int request, void *buf,
endpoint_t user_endpt);
/* Asynchronous API. */
typedef int bdev_id_t;
typedef void *bdev_param_t;
typedef void (*bdev_callback_t)(dev_t dev, bdev_id_t id, bdev_param_t param,
int result);
extern void bdev_flush_asyn(dev_t dev);
extern bdev_id_t bdev_read_asyn(dev_t dev, u64_t pos, char *buf, size_t count,
int flags, bdev_callback_t callback, bdev_param_t param);
extern bdev_id_t bdev_write_asyn(dev_t dev, u64_t pos, char *buf, size_t count,
int flags, bdev_callback_t callback, bdev_param_t param);
extern bdev_id_t bdev_gather_asyn(dev_t dev, u64_t pos, iovec_t *vec,
int count, int flags, bdev_callback_t callback, bdev_param_t param);
extern bdev_id_t bdev_scatter_asyn(dev_t dev, u64_t pos, iovec_t *vec,
int count, int flags, bdev_callback_t callback, bdev_param_t param);
extern bdev_id_t bdev_ioctl_asyn(dev_t dev, int request, void *buf,
endpoint_t user_endpt, bdev_callback_t callback, bdev_param_t param);
extern int bdev_wait_asyn(bdev_id_t id);
extern void bdev_reply_asyn(message *m);
#endif /* _MINIX_BDEV_H */

View File

@@ -1,34 +0,0 @@
#ifndef _BITMAP_H
#define _BITMAP_H
/* Bit map operations to manipulate bits of a simple mask variable. */
#define bit_set(mask, n) ((mask) |= (1 << (n)))
#define bit_unset(mask, n) ((mask) &= ~(1 << (n)))
#define bit_isset(mask, n) ((mask) & (1 << (n)))
#define bit_empty(mask) ((mask) = 0)
#define bit_fill(mask) ((mask) = ~0)
/* Definitions previously in kernel/const.h */
#define BITCHUNK_BITS (sizeof(bitchunk_t) * CHAR_BIT)
#define BITMAP_CHUNKS(nr_bits) (((nr_bits)+BITCHUNK_BITS-1)/BITCHUNK_BITS)
#define MAP_CHUNK(map,bit) (map)[((bit)/BITCHUNK_BITS)]
#define CHUNK_OFFSET(bit) ((bit)%BITCHUNK_BITS)
#define GET_BIT(map,bit) ( MAP_CHUNK(map,bit) & (1 << CHUNK_OFFSET(bit) ))
#define SET_BIT(map,bit) ( MAP_CHUNK(map,bit) |= (1 << CHUNK_OFFSET(bit) ))
#define UNSET_BIT(map,bit) ( MAP_CHUNK(map,bit) &= ~(1 << CHUNK_OFFSET(bit) ))
#if defined(CONFIG_SMP) && defined(__GNUC__)
#ifndef __ASSEMBLY__
static inline void bits_fill(bitchunk_t * chunks, unsigned bits)
{
unsigned c, cnt;
cnt = BITMAP_CHUNKS(bits);
for (c = 0; c < cnt; c++)
bit_fill(chunks[c]);
}
#endif
#endif
#endif /* _BITMAP_H */

View File

@@ -1,62 +0,0 @@
#ifndef _MINIX_BLOCKDRIVER_H
#define _MINIX_BLOCKDRIVER_H
#include <minix/driver.h>
typedef int device_id_t;
typedef int thread_id_t;
/* Types supported for the 'type' field of struct blockdriver. */
typedef enum {
BLOCKDRIVER_TYPE_DISK, /* handle partition requests */
BLOCKDRIVER_TYPE_OTHER /* do not handle partition requests */
} blockdriver_type_t;
/* Entry points into the device dependent code of block drivers. */
struct blockdriver {
blockdriver_type_t bdr_type;
int (*bdr_open)(devminor_t minor, int access);
int (*bdr_close)(devminor_t minor);
ssize_t (*bdr_transfer)(devminor_t minor, int do_write, u64_t pos,
endpoint_t endpt, iovec_t *iov, unsigned int count, int flags);
int (*bdr_ioctl)(devminor_t minor, unsigned long request, endpoint_t endpt,
cp_grant_id_t grant, endpoint_t user_endpt);
void (*bdr_cleanup)(void);
struct device *(*bdr_part)(devminor_t minor);
void (*bdr_geometry)(devminor_t minor, struct part_geom *part);
void (*bdr_intr)(unsigned int mask);
void (*bdr_alarm)(clock_t stamp);
void (*bdr_other)(message *m_ptr, int ipc_status);
int (*bdr_device)(devminor_t minor, device_id_t *id);
};
/* Functions defined by libblockdriver. These can be used for both
* singlethreaded and multithreaded drivers.
*/
void blockdriver_announce(int type);
#ifndef _BLOCKDRIVER_MT_API
/* Additional functions for the singlethreaded version. These allow the driver
* to either use the stock driver_task(), or implement its own message loop.
* To avoid accidents, these functions are not exposed when minix/driver_mt.h
* has been included previously.
*/
int blockdriver_receive_mq(message *m_ptr, int *status_ptr);
void blockdriver_process(struct blockdriver *dp, message *m_ptr, int
ipc_status);
void blockdriver_terminate(void);
void blockdriver_task(struct blockdriver *bdp);
int blockdriver_mq_queue(message *m_ptr, int status);
#endif /* !_BLOCKDRIVER_MT_API */
/* Parameters for the disk drive. */
#define SECTOR_SIZE 512 /* physical sector size in bytes */
#define SECTOR_SHIFT 9 /* for division */
#define SECTOR_MASK 511 /* and remainder */
#define CD_SECTOR_SIZE 2048 /* sector size of a CD-ROM in bytes */
/* Size of the DMA buffer buffer in bytes. */
#define DMA_BUF_SIZE (DMA_SECTORS * SECTOR_SIZE)
#endif /* _MINIX_BLOCKDRIVER_H */

View File

@@ -1,16 +0,0 @@
#ifndef _MINIX_BLOCKDRIVER_MT_H
#define _MINIX_BLOCKDRIVER_MT_H
#define BLOCKDRIVER_MT_API 1 /* do not expose the singlethreaded API */
#include <minix/blockdriver.h>
#define BLOCKDRIVER_MAX_DEVICES 32
void blockdriver_mt_task(struct blockdriver *driver_tab);
void blockdriver_mt_sleep(void);
void blockdriver_mt_wakeup(thread_id_t id);
void blockdriver_mt_terminate(void);
void blockdriver_mt_set_workers(device_id_t id, int workers);
thread_id_t blockdriver_mt_get_tid(void);
#endif /* _MINIX_BLOCKDRIVER_MT_H */

View File

@@ -1,232 +0,0 @@
#ifndef __BOARD_H__
#define __BOARD_H__
#include <string.h>
/*
Utility functions to access/parse the board_id defined in the machine
struct in include/minix/type.h.
Identifier for the board
[31:28] Architecture. (MINIX_BOARD_ARCH)
[27:24] Architecture variant (MINIX_BOARD_ARCH_VARIANT) VERSION e.g. ARMV7
[23:16] Vendor/Soc (EG TI ) (MINIX_BOARD_VENDOR)
[15:8] Board (EG Beagle bone , beagle board ) (MINIX_BOARD)
[7:0] Board variant (EG BealgeBone white v.s. BeagleBone black ) (MINIX_BOARD_VARIANT)
*/
#define MINIX_BOARD_ARCH_SHIFT (28)
#define MINIX_BOARD_ARCH_VARIANT_SHIFT (24)
#define MINIX_BOARD_VENDOR_SHIFT (16)
#define MINIX_BOARD_SHIFT (8)
#define MINIX_BOARD_VARIANT_SHIFT (0)
/* 4 bits */
#define MINIX_BOARD_ARCH_MASK \
(0XF << MINIX_BOARD_ARCH_SHIFT)
/* 4 bits */
#define MINIX_BOARD_ARCH_VARIANT_MASK \
(0XF << MINIX_BOARD_ARCH_VARIANT_SHIFT)
/* 8 bits */
#define MINIX_BOARD_VENDOR_MASK \
(0XFF << MINIX_BOARD_VENDOR_SHIFT)
/* 8 bits */
#define MINIX_BOARD_MASK \
(0XFF << MINIX_BOARD_SHIFT)
/* 8 bits */
#define MINIX_BOARD_VARIANT_MASK \
(0XFF << MINIX_BOARD_VARIANT_SHIFT)
#define MINIX_MK_BOARD_ARCH(v) \
((v << MINIX_BOARD_ARCH_SHIFT ) & MINIX_BOARD_ARCH_MASK)
#define MINIX_MK_BOARD_ARCH_VARIANT(v) \
(( v << MINIX_BOARD_ARCH_VARIANT_SHIFT) & MINIX_BOARD_ARCH_VARIANT_MASK )
#define MINIX_MK_BOARD_VENDOR(v) \
(( v << MINIX_BOARD_VENDOR_SHIFT) & MINIX_BOARD_VENDOR_MASK )
#define MINIX_MK_BOARD(v) \
(( v << MINIX_BOARD_SHIFT) & MINIX_BOARD_MASK )
#define MINIX_MK_BOARD_VARIANT(v) \
(( v << MINIX_BOARD_VARIANT_SHIFT) & MINIX_BOARD_VARIANT_MASK )
#define MINIX_BOARD_ARCH(v) \
((v & MINIX_BOARD_ARCH_MASK) >> MINIX_BOARD_ARCH_SHIFT )
#define MINIX_BOARD_ARCH_VARIANT(v) \
(( v & MINIX_BOARD_ARCH_VARIANT_MASK) >> MINIX_BOARD_ARCH_VARIANT_SHIFT)
#define MINIX_BOARD_VENDOR(v) \
(( v & MINIX_BOARD_VENDOR_MASK) >> MINIX_BOARD_VENDOR_SHIFT)
#define MINIX_BOARD(v) \
(( v & MINIX_BOARD_MASK) >> MINIX_BOARD_SHIFT)
#define MINIX_BOARD_VARIANT(v) \
(( v & MINIX_BOARD_VARIANT_MASK) >> MINIX_BOARD_VARIANT_SHIFT)
/* We want to make it possible to use masks and therefore only try to use bits */
#define MINIX_BOARD_ARCH_X86 MINIX_MK_BOARD_ARCH(1 << 0)
#define MINIX_BOARD_ARCH_ARM MINIX_MK_BOARD_ARCH(1 << 1)
#define MINIX_BOARD_ARCH_VARIANT_X86_GENERIC MINIX_MK_BOARD_ARCH_VARIANT(1<<0)
#define MINIX_BOARD_ARCH_VARIANT_ARM_ARMV6 MINIX_MK_BOARD_ARCH_VARIANT(1<<1)
#define MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 MINIX_MK_BOARD_ARCH_VARIANT(1<<2)
#define MINIX_BOARD_VENDOR_INTEL MINIX_MK_BOARD_VENDOR(1<<0)
#define MINIX_BOARD_VENDOR_TI MINIX_MK_BOARD_VENDOR(1<<1)
#define MINIX_BOARD_GENERIC MINIX_MK_BOARD(1<<0)
/* BeagleBoard XM */
#define MINIX_BOARD_BBXM MINIX_MK_BOARD(1<<1)
/* BeagleBone (Black and* white) */
#define MINIX_BOARD_BB MINIX_MK_BOARD(1<<2)
/* Only one of a kind */
#define MINIX_BOARD_VARIANT_GENERIC MINIX_MK_BOARD_VARIANT(1<<0)
/* BeagleBone White */
#define MINIX_BOARD_VARIANT_BBW MINIX_MK_BOARD_VARIANT(1<<1)
/* BeagleBone Black */
#define MINIX_BOARD_VARIANT_BBB MINIX_MK_BOARD_VARIANT(1<<2)
#define BOARD_ID_INTEL \
( MINIX_BOARD_ARCH_X86 \
| MINIX_BOARD_ARCH_VARIANT_X86_GENERIC \
| MINIX_BOARD_VENDOR_INTEL \
| MINIX_BOARD_GENERIC \
| MINIX_BOARD_VARIANT_GENERIC\
)
#define BOARD_ID_BBXM \
( MINIX_BOARD_ARCH_ARM \
| MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 \
| MINIX_BOARD_VENDOR_TI \
| MINIX_BOARD_BBXM \
| MINIX_BOARD_VARIANT_GENERIC\
)
#define BOARD_ID_BBW \
( MINIX_BOARD_ARCH_ARM \
| MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 \
| MINIX_BOARD_VENDOR_TI \
| MINIX_BOARD_BB \
| MINIX_BOARD_VARIANT_BBW\
)
#define BOARD_ID_BBB \
( MINIX_BOARD_ARCH_ARM \
| MINIX_BOARD_ARCH_VARIANT_ARM_ARMV7 \
| MINIX_BOARD_VENDOR_TI \
| MINIX_BOARD_BB \
| MINIX_BOARD_VARIANT_BBB\
)
#define BOARD_IS_BBXM(v) \
( (BOARD_ID_BBXM & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK))
/* Either one of the known BeagleBones */
#define BOARD_IS_BB(v) \
( (BOARD_ID_BBW & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK))
#define BOARD_IS_BBW(v) ( v == BOARD_ID_BBW)
#define BOARD_IS_BBB(v) ( v == BOARD_ID_BBB)
#define BOARD_FILTER_BBXM_VALUE (BOARD_ID_BBXM)
#define BOARD_FILTER_BBXM_MASK \
(MINIX_BOARD_ARCH_MASK \
| MINIX_BOARD_ARCH_VARIANT_MASK \
| MINIX_BOARD_VENDOR_MASK \
| MINIX_BOARD_MASK \
| MINIX_BOARD_VARIANT_MASK)
#define BOARD_FILTER_BB_VALUE (BOARD_ID_BBW & ~MINIX_BOARD_VARIANT_MASK)
#define BOARD_FILTER_BB_MASK \
(MINIX_BOARD_ARCH_MASK \
| MINIX_BOARD_ARCH_VARIANT_MASK \
| MINIX_BOARD_VENDOR_MASK \
| MINIX_BOARD_MASK )
struct shortname2id
{
const char name[15];
unsigned int id;
};
/* mapping from fields given by the bootloader to board id's */
static struct shortname2id shortname2id[] = {
{.name = "BBXM",.id = BOARD_ID_BBXM},
{.name = "A335BONE",.id = BOARD_ID_BBW},
{.name = "A335BNLT",.id = BOARD_ID_BBB},
};
struct board_id2name
{
unsigned int id;
const char name[40];
};
/* how to convert a BOARD id to a board name */
static struct board_id2name board_id2name[] = {
{.id = BOARD_ID_INTEL,.name = "X86-I586-GENERIC-GENERIC-GENERIC"},
{.id = BOARD_ID_BBXM,.name = "ARM-ARMV7-TI-BBXM-GENERIC"},
{.id = BOARD_ID_BBW,.name = "ARM-ARMV7-TI-BB-WHITE"},
{.id = BOARD_ID_BBB,.name = "ARM-ARMV7-TI-BB-BLACK"},
};
struct board_arch2arch
{
unsigned int board_arch;
const char arch[40];
};
/* Mapping from board_arch to arch */
static struct board_arch2arch board_arch2arch[] = {
{.board_arch = MINIX_BOARD_ARCH_ARM ,.arch = "earm"},
{.board_arch = MINIX_BOARD_ARCH_X86 ,.arch = "i386"},
};
/* returns 0 if no board was found that match that id */
static int
get_board_id_by_short_name(const char *name)
{
int x;
for (x = 0; x < sizeof(shortname2id) / sizeof(shortname2id[0]); x++) {
if (strncmp(name, shortname2id[x].name, 15) == 0) {
return shortname2id[x].id;
}
}
return 0;
}
/* returns 0 if no board was found that match that id */
static int
get_board_id_by_name(const char *name)
{
int x;
for (x = 0; x < sizeof(board_id2name) / sizeof(board_id2name[0]); x++) {
if (strncmp(name, board_id2name[x].name, 40) == 0) {
return board_id2name[x].id;
}
}
return 0;
}
/* convert a board id to a board name to use later
returns NULL if no board was found that match that id */
static const char *
get_board_name(unsigned int id)
{
int x;
for (x = 0; x < sizeof(board_id2name) / sizeof(board_id2name[0]); x++) {
if (board_id2name[x].id == id) {
return board_id2name[x].name;
}
}
return NULL;
}
/* convert a board id to a board name to use later
returns NULL if no board was found that match that id */
static const char *
get_board_arch_name(unsigned int id)
{
int x;
for (x = 0; x < sizeof(board_arch2arch) / sizeof(board_arch2arch[0]); x++) {
if (board_arch2arch[x].board_arch == (id & MINIX_BOARD_ARCH_MASK) ) {
return board_arch2arch[x].arch;
}
}
return NULL;
}
#endif

View File

@@ -1,40 +0,0 @@
#ifndef _MINIX_BTRACE_H
#define _MINIX_BTRACE_H
/* Control directives. */
enum {
BTCTL_START,
BTCTL_STOP
};
/* Request codes. */
enum {
BTREQ_OPEN,
BTREQ_CLOSE,
BTREQ_READ,
BTREQ_WRITE,
BTREQ_GATHER,
BTREQ_SCATTER,
BTREQ_IOCTL
};
/* Special result codes. */
#define BTRES_INPROGRESS (-997)
/* Block trace entry. */
typedef struct {
u32_t request; /* request code; one of BTR_xxx */
u32_t size; /* request size, ioctl request, or access */
u64_t position; /* starting disk position */
u32_t flags; /* transfer flags */
i32_t result; /* request result; OK, bytes, or error */
u32_t start_time; /* request service start time (us) */
u32_t finish_time; /* request service completion time (us) */
} btrace_entry; /* (32 bytes) */
/* This is the number of btrace_entry structures copied out at once using the
* BIOCTRACEGET ioctl call.
*/
#define BTBUF_SIZE 1024
#endif /* _MINIX_BTRACE_H */

View File

@@ -1,124 +0,0 @@
/* This header file defines the calls to PM and VFS. */
#ifndef _MINIX_CALLNR_H
#define _MINIX_CALLNR_H
/*===========================================================================*
* Calls to PM *
*===========================================================================*/
#define PM_BASE 0x000
#define IS_PM_CALL(type) (((type) & ~0xff) == PM_BASE)
/* Message type 0 is traditionally reserved. */
#define PM_EXIT (PM_BASE + 1)
#define PM_FORK (PM_BASE + 2)
#define PM_WAITPID (PM_BASE + 3)
#define PM_GETPID (PM_BASE + 4)
#define PM_SETUID (PM_BASE + 5)
#define PM_GETUID (PM_BASE + 6)
#define PM_STIME (PM_BASE + 7)
#define PM_PTRACE (PM_BASE + 8)
#define PM_SETGROUPS (PM_BASE + 9)
#define PM_GETGROUPS (PM_BASE + 10)
#define PM_KILL (PM_BASE + 11)
#define PM_SETGID (PM_BASE + 12)
#define PM_GETGID (PM_BASE + 13)
#define PM_EXEC (PM_BASE + 14)
#define PM_SETSID (PM_BASE + 15)
#define PM_GETPGRP (PM_BASE + 16)
#define PM_ITIMER (PM_BASE + 17)
#define PM_GETMCONTEXT (PM_BASE + 18)
#define PM_SETMCONTEXT (PM_BASE + 19)
#define PM_SIGACTION (PM_BASE + 20)
#define PM_SIGSUSPEND (PM_BASE + 21)
#define PM_SIGPENDING (PM_BASE + 22)
#define PM_SIGPROCMASK (PM_BASE + 23)
#define PM_SIGRETURN (PM_BASE + 24)
#define PM_SYSUNAME (PM_BASE + 25)
#define PM_GETPRIORITY (PM_BASE + 26)
#define PM_SETPRIORITY (PM_BASE + 27)
#define PM_GETTIMEOFDAY (PM_BASE + 28)
#define PM_SETEUID (PM_BASE + 29)
#define PM_SETEGID (PM_BASE + 30)
#define PM_ISSETUGID (PM_BASE + 31)
#define PM_GETSID (PM_BASE + 32)
#define PM_CLOCK_GETRES (PM_BASE + 33)
#define PM_CLOCK_GETTIME (PM_BASE + 34)
#define PM_CLOCK_SETTIME (PM_BASE + 35)
#define PM_GETRUSAGE (PM_BASE + 36)
#define PM_REBOOT (PM_BASE + 37)
#define PM_SVRCTL (PM_BASE + 38)
#define PM_SPROF (PM_BASE + 39)
#define PM_CPROF (PM_BASE + 40)
#define PM_SRV_FORK (PM_BASE + 41)
#define PM_SRV_KILL (PM_BASE + 42)
#define PM_EXEC_NEW (PM_BASE + 43)
#define PM_EXEC_RESTART (PM_BASE + 44)
#define PM_GETEPINFO (PM_BASE + 45)
#define PM_GETPROCNR (PM_BASE + 46)
#define PM_GETSYSINFO (PM_BASE + 47)
#define NR_PM_CALLS 48 /* highest number from base plus one */
/*===========================================================================*
* Calls to VFS *
*===========================================================================*/
#define VFS_BASE 0x100
#define IS_VFS_CALL(type) (((type) & ~0xff) == VFS_BASE)
#define VFS_READ (VFS_BASE + 0)
#define VFS_WRITE (VFS_BASE + 1)
#define VFS_LSEEK (VFS_BASE + 2)
#define VFS_OPEN (VFS_BASE + 3)
#define VFS_CREAT (VFS_BASE + 4)
#define VFS_CLOSE (VFS_BASE + 5)
#define VFS_LINK (VFS_BASE + 6)
#define VFS_UNLINK (VFS_BASE + 7)
#define VFS_CHDIR (VFS_BASE + 8)
#define VFS_MKDIR (VFS_BASE + 9)
#define VFS_MKNOD (VFS_BASE + 10)
#define VFS_CHMOD (VFS_BASE + 11)
#define VFS_CHOWN (VFS_BASE + 12)
#define VFS_MOUNT (VFS_BASE + 13)
#define VFS_UMOUNT (VFS_BASE + 14)
#define VFS_ACCESS (VFS_BASE + 15)
#define VFS_SYNC (VFS_BASE + 16)
#define VFS_RENAME (VFS_BASE + 17)
#define VFS_RMDIR (VFS_BASE + 18)
#define VFS_SYMLINK (VFS_BASE + 19)
#define VFS_READLINK (VFS_BASE + 20)
#define VFS_STAT (VFS_BASE + 21)
#define VFS_FSTAT (VFS_BASE + 22)
#define VFS_LSTAT (VFS_BASE + 23)
#define VFS_IOCTL (VFS_BASE + 24)
#define VFS_FCNTL (VFS_BASE + 25)
#define VFS_PIPE2 (VFS_BASE + 26)
#define VFS_UMASK (VFS_BASE + 27)
#define VFS_CHROOT (VFS_BASE + 28)
#define VFS_GETDENTS (VFS_BASE + 29)
#define VFS_SELECT (VFS_BASE + 30)
#define VFS_FCHDIR (VFS_BASE + 31)
#define VFS_FSYNC (VFS_BASE + 32)
#define VFS_TRUNCATE (VFS_BASE + 33)
#define VFS_FTRUNCATE (VFS_BASE + 34)
#define VFS_FCHMOD (VFS_BASE + 35)
#define VFS_FCHOWN (VFS_BASE + 36)
#define VFS_UTIMENS (VFS_BASE + 37)
#define VFS_VMCALL (VFS_BASE + 38)
#define VFS_GETVFSSTAT (VFS_BASE + 39)
#define VFS_STATVFS1 (VFS_BASE + 40)
#define VFS_FSTATVFS1 (VFS_BASE + 41)
#define VFS_GETRUSAGE (VFS_BASE + 42)
#define VFS_SVRCTL (VFS_BASE + 43)
#define VFS_GCOV_FLUSH (VFS_BASE + 44)
#define VFS_MAPDRIVER (VFS_BASE + 45)
#define VFS_COPYFD (VFS_BASE + 46)
#define VFS_CHECKPERMS (VFS_BASE + 47)
#define VFS_GETSYSINFO (VFS_BASE + 48)
#define NR_VFS_CALLS 49 /* highest number from base plus one */
#endif /* !_MINIX_CALLNR_H */

View File

@@ -1,36 +0,0 @@
#ifndef _MINIX_CHARDRIVER_H
#define _MINIX_CHARDRIVER_H
#include <minix/driver.h>
typedef unsigned int cdev_id_t;
/* Entry points into the device dependent code of character drivers. */
struct chardriver {
int (*cdr_open)(devminor_t minor, int access, endpoint_t user_endpt);
int (*cdr_close)(devminor_t minor);
ssize_t (*cdr_read)(devminor_t minor, u64_t position, endpoint_t endpt,
cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
ssize_t (*cdr_write)(devminor_t minor, u64_t position, endpoint_t endpt,
cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
int (*cdr_ioctl)(devminor_t minor, unsigned long request, endpoint_t endpt,
cp_grant_id_t grant, int flags, endpoint_t user_endpt, cdev_id_t id);
int (*cdr_cancel)(devminor_t minor, endpoint_t endpt, cdev_id_t id);
int (*cdr_select)(devminor_t minor, unsigned int ops, endpoint_t endpt);
void (*cdr_intr)(unsigned int mask);
void (*cdr_alarm)(clock_t stamp);
void (*cdr_other)(message *m_ptr, int ipc_status);
};
/* Functions defined by libchardriver. */
void chardriver_announce(void);
int chardriver_get_minor(message *m, devminor_t *minor);
void chardriver_process(struct chardriver *cdp, message *m_ptr,
int ipc_status);
void chardriver_terminate(void);
void chardriver_task(struct chardriver *cdp);
void chardriver_reply_task(endpoint_t endpt, cdev_id_t id, int r);
void chardriver_reply_select(endpoint_t endpt, devminor_t minor, int ops);
#endif /* _MINIX_CHARDRIVER_H */

View File

@@ -1,18 +0,0 @@
#ifndef _CLKCONF_H
#define _CLKCONF_H
/* Clock configuration */
#define CM_FCLKEN1_CORE 0xA00
#define CM_ICLKEN1_CORE 0xA10
#define CM_FCLKEN_WKUP 0xC00
#define CM_ICLKEN_WKUP 0xC10
#define CM_PER_I2C2_CLKCTRL 0x044
#define CM_PER_I2C1_CLKCTRL 0x048
#define CM_WKUP_I2C0_CLKCTRL 0x4B8
int clkconf_init();
int clkconf_set(u32_t clk, u32_t mask, u32_t value);
int clkconf_release();
#endif

View File

@@ -1,968 +0,0 @@
/* This file defines constants for use in message communication (mostly)
* between system processes.
*
* A number of protocol message request and response types are defined. For
* debugging purposes, each protocol is assigned its own unique number range.
* The following such message type ranges have been allocated:
*
* 0x00 - 0xFF Process Manager (PM) requests (see callnr.h)
* 0x100 - 0x1FF Virtual File System (VFS) requests (see callnr.h)
* 0x200 - 0x2FF Data link layer requests and responses
* 0x300 - 0x3FF Bus controller requests and responses
* 0x400 - 0x4FF Character device requests and responses
* 0x500 - 0x5FF Block device requests and responses
* 0x600 - 0x6FF Kernel calls
* 0x700 - 0x7FF Reincarnation Server (RS) requests
* 0x800 - 0x8FF Data Store (DS) requests
* 0x900 - 0x9FF Requests from PM to VFS, and responses
* 0xA00 - 0xAFF Requests from VFS to file systems (see vfsif.h)
* 0xB00 - 0xBFF Transaction IDs from VFS to file systems (see vfsif.h)
* 0xC00 - 0xCFF Virtual Memory (VM) requests
* 0xD00 - 0xDFF IPC server requests
* 0xE00 - 0xEFF Common system messages (e.g. system signals)
* 0xF00 - 0xFFF Scheduling messages
* 0x1000 - 0x10FF Notify messages
* 0x1100 - 0x11FF USB
* 0x1200 - 0x12FF Devman
* 0x1300 - 0x13FF TTY requests
* 0x1400 - 0x14FF Real Time Clock requests and responses
* 0x1500 - 0x15FF Input server messages
* 0x1600 - 0x16FF VirtualBox (VBOX) requests (see vboxif.h)
*
* Zero and negative values are widely used for OK and error responses.
*/
#ifndef _MINIX_COM_H
#define _MINIX_COM_H
/*===========================================================================*
* Process numbers of processes in the system image *
*===========================================================================*/
/* Kernel tasks. These all run in the same address space. */
#define ASYNCM ((endpoint_t) -5) /* notifies about finished async sends */
#define IDLE ((endpoint_t) -4) /* runs when no one else can run */
#define CLOCK ((endpoint_t) -3) /* alarms and other clock functions */
#define SYSTEM ((endpoint_t) -2) /* request system functionality */
#define KERNEL ((endpoint_t) -1) /* pseudo-process for IPC and scheduling */
#define HARDWARE KERNEL /* for hardware interrupt handlers */
/* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
#define MAX_NR_TASKS 1023
#define NR_TASKS 5
/* User-space processes, that is, device drivers, servers, and INIT. */
#define PM_PROC_NR ((endpoint_t) 0) /* process manager */
#define VFS_PROC_NR ((endpoint_t) 1) /* file system */
#define RS_PROC_NR ((endpoint_t) 2) /* reincarnation server */
#define MEM_PROC_NR ((endpoint_t) 3) /* memory driver (RAM disk, null, etc.) */
#define SCHED_PROC_NR ((endpoint_t) 4) /* scheduler */
#define TTY_PROC_NR ((endpoint_t) 5) /* terminal (TTY) driver */
#define DS_PROC_NR ((endpoint_t) 6) /* data store server */
#define MFS_PROC_NR ((endpoint_t) 7) /* minix root filesystem */
#define VM_PROC_NR ((endpoint_t) 8) /* memory server */
#define PFS_PROC_NR ((endpoint_t) 9) /* pipe filesystem */
#define LAST_SPECIAL_PROC_NR 10 /* An untyped version for
computation in macros.*/
#define INIT_PROC_NR ((endpoint_t) LAST_SPECIAL_PROC_NR) /* init
-- goes multiuser */
#define NR_BOOT_MODULES (INIT_PROC_NR+1)
/* Root system process and root user process. */
#define ROOT_SYS_PROC_NR RS_PROC_NR
#define ROOT_USR_PROC_NR INIT_PROC_NR
/*===========================================================================*
* Kernel notification types *
*===========================================================================*/
/* Kernel notification types. In principle, these can be sent to any process,
* so make sure that these types do not interfere with other message types.
* Notifications are prioritized because of the way they are unhold() and
* blocking notifications are delivered. The lowest numbers go first. The
* offset are used for the per-process notification bit maps.
*/
#define NOTIFY_MESSAGE 0x1000
/* FIXME the old is_notify(a) should be replaced by is_ipc_notify(status). */
#define is_ipc_notify(ipc_status) (IPC_STATUS_CALL(ipc_status) == NOTIFY)
#define is_notify(a) ((unsigned) ((a) - NOTIFY_MESSAGE) < 0x100)
#define is_ipc_asynch(ipc_status) \
(is_ipc_notify(ipc_status) || IPC_STATUS_CALL(ipc_status) == SENDA)
/*===========================================================================*
* Messages for BUS controller drivers *
*===========================================================================*/
#define BUSC_RQ_BASE 0x300 /* base for request types */
#define BUSC_RS_BASE 0x380 /* base for response types */
#define BUSC_PCI_INIT (BUSC_RQ_BASE + 0) /* First message to
* PCI driver
*/
#define BUSC_PCI_FIRST_DEV (BUSC_RQ_BASE + 1) /* Get index (and
* vid/did) of the
* first PCI device
*/
#define BUSC_PCI_NEXT_DEV (BUSC_RQ_BASE + 2) /* Get index (and
* vid/did) of the
* next PCI device
*/
#define BUSC_PCI_FIND_DEV (BUSC_RQ_BASE + 3) /* Get index of a
* PCI device based on
* bus/dev/function
*/
#define BUSC_PCI_IDS (BUSC_RQ_BASE + 4) /* Get vid/did from an
* index
*/
#define BUSC_PCI_RESERVE (BUSC_RQ_BASE + 7) /* Reserve a PCI dev */
#define BUSC_PCI_ATTR_R8 (BUSC_RQ_BASE + 8) /* Read 8-bit
* attribute value
*/
#define BUSC_PCI_ATTR_R16 (BUSC_RQ_BASE + 9) /* Read 16-bit
* attribute value
*/
#define BUSC_PCI_ATTR_R32 (BUSC_RQ_BASE + 10) /* Read 32-bit
* attribute value
*/
#define BUSC_PCI_ATTR_W8 (BUSC_RQ_BASE + 11) /* Write 8-bit
* attribute value
*/
#define BUSC_PCI_ATTR_W16 (BUSC_RQ_BASE + 12) /* Write 16-bit
* attribute value
*/
#define BUSC_PCI_ATTR_W32 (BUSC_RQ_BASE + 13) /* Write 32-bit
* attribute value
*/
#define BUSC_PCI_RESCAN (BUSC_RQ_BASE + 14) /* Rescan bus */
#define BUSC_PCI_DEV_NAME_S (BUSC_RQ_BASE + 15) /* Get the name of a
* PCI device
* (safecopy)
*/
#define BUSC_PCI_SLOT_NAME_S (BUSC_RQ_BASE + 16) /* Get the name of a
* PCI slot (safecopy)
*/
#define BUSC_PCI_SET_ACL (BUSC_RQ_BASE + 17) /* Set the ACL for a
* driver (safecopy)
*/
#define BUSC_PCI_DEL_ACL (BUSC_RQ_BASE + 18) /* Delete the ACL of a
* driver
*/
#define BUSC_PCI_GET_BAR (BUSC_RQ_BASE + 19) /* Get Base Address
* Register properties
*/
#define IOMMU_MAP (BUSC_RQ_BASE + 32) /* Ask IOMMU to map
* a segment of memory
*/
#define BUSC_I2C_RESERVE (BUSC_RQ_BASE + 64) /* reserve i2c device */
#define BUSC_I2C_EXEC (BUSC_RQ_BASE + 65) /* perform i2c action */
/*===========================================================================*
* Messages for networking layer *
*===========================================================================*/
/* Base type for data link layer requests and responses. */
#define DL_RQ_BASE 0x200
#define DL_RS_BASE 0x280
#define IS_DL_RQ(type) (((type) & ~0x7f) == DL_RQ_BASE)
#define IS_DL_RS(type) (((type) & ~0x7f) == DL_RS_BASE)
/* Message types for data link layer requests. */
#define DL_CONF (DL_RQ_BASE + 0)
#define DL_GETSTAT_S (DL_RQ_BASE + 1)
#define DL_WRITEV_S (DL_RQ_BASE + 2)
#define DL_READV_S (DL_RQ_BASE + 3)
/* Message type for data link layer replies. */
#define DL_CONF_REPLY (DL_RS_BASE + 0)
#define DL_STAT_REPLY (DL_RS_BASE + 1)
#define DL_TASK_REPLY (DL_RS_BASE + 2)
/* Bits in 'flags' field of DL replies. */
# define DL_NOFLAGS 0x00
# define DL_PACK_SEND 0x01
# define DL_PACK_RECV 0x02
/* Bits in 'DL_MODE' field of DL requests. */
# define DL_NOMODE 0x0
# define DL_PROMISC_REQ 0x1
# define DL_MULTI_REQ 0x2
# define DL_BROAD_REQ 0x4
/*===========================================================================*
* SYSTASK request types and field names *
*===========================================================================*/
/* System library calls are dispatched via a call vector, so be careful when
* modifying the system call numbers. The numbers here determine which call
* is made from the call vector.
*/
#define KERNEL_CALL 0x600 /* base for kernel calls to SYSTEM */
# define SYS_FORK (KERNEL_CALL + 0) /* sys_fork() */
# define SYS_EXEC (KERNEL_CALL + 1) /* sys_exec() */
# define SYS_CLEAR (KERNEL_CALL + 2) /* sys_clear() */
# define SYS_SCHEDULE (KERNEL_CALL + 3) /* sys_schedule() */
# define SYS_PRIVCTL (KERNEL_CALL + 4) /* sys_privctl() */
# define SYS_TRACE (KERNEL_CALL + 5) /* sys_trace() */
# define SYS_KILL (KERNEL_CALL + 6) /* sys_kill() */
# define SYS_GETKSIG (KERNEL_CALL + 7) /* sys_getsig() */
# define SYS_ENDKSIG (KERNEL_CALL + 8) /* sys_endsig() */
# define SYS_SIGSEND (KERNEL_CALL + 9) /* sys_sigsend() */
# define SYS_SIGRETURN (KERNEL_CALL + 10) /* sys_sigreturn() */
# define SYS_MEMSET (KERNEL_CALL + 13) /* sys_memset() */
# define SYS_UMAP (KERNEL_CALL + 14) /* sys_umap() */
# define SYS_VIRCOPY (KERNEL_CALL + 15) /* sys_vircopy() */
# define SYS_PHYSCOPY (KERNEL_CALL + 16) /* sys_physcopy() */
# define SYS_UMAP_REMOTE (KERNEL_CALL + 17) /* sys_umap_remote() */
# define SYS_VUMAP (KERNEL_CALL + 18) /* sys_vumap() */
# define SYS_IRQCTL (KERNEL_CALL + 19) /* sys_irqctl() */
# define SYS_INT86 (KERNEL_CALL + 20) /* sys_int86() */
# define SYS_DEVIO (KERNEL_CALL + 21) /* sys_devio() */
# define SYS_SDEVIO (KERNEL_CALL + 22) /* sys_sdevio() */
# define SYS_VDEVIO (KERNEL_CALL + 23) /* sys_vdevio() */
# define SYS_SETALARM (KERNEL_CALL + 24) /* sys_setalarm() */
# define SYS_TIMES (KERNEL_CALL + 25) /* sys_times() */
# define SYS_GETINFO (KERNEL_CALL + 26) /* sys_getinfo() */
# define SYS_ABORT (KERNEL_CALL + 27) /* sys_abort() */
# define SYS_IOPENABLE (KERNEL_CALL + 28) /* sys_enable_iop() */
# define SYS_SAFECOPYFROM (KERNEL_CALL + 31) /* sys_safecopyfrom() */
# define SYS_SAFECOPYTO (KERNEL_CALL + 32) /* sys_safecopyto() */
# define SYS_VSAFECOPY (KERNEL_CALL + 33) /* sys_vsafecopy() */
# define SYS_SETGRANT (KERNEL_CALL + 34) /* sys_setgrant() */
# define SYS_READBIOS (KERNEL_CALL + 35) /* sys_readbios() */
# define SYS_SPROF (KERNEL_CALL + 36) /* sys_sprof() */
# define SYS_CPROF (KERNEL_CALL + 37) /* sys_cprof() */
# define SYS_PROFBUF (KERNEL_CALL + 38) /* sys_profbuf() */
# define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
# define SYS_SETTIME (KERNEL_CALL + 40) /* sys_settime() */
# define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
# define SYS_DIAGCTL (KERNEL_CALL + 44) /* sys_diagctl() */
# define SYS_VTIMER (KERNEL_CALL + 45) /* sys_vtimer() */
# define SYS_RUNCTL (KERNEL_CALL + 46) /* sys_runctl() */
# define SYS_GETMCONTEXT (KERNEL_CALL + 50) /* sys_getmcontext() */
# define SYS_SETMCONTEXT (KERNEL_CALL + 51) /* sys_setmcontext() */
# define SYS_UPDATE (KERNEL_CALL + 52) /* sys_update() */
# define SYS_EXIT (KERNEL_CALL + 53) /* sys_exit() */
# define SYS_SCHEDCTL (KERNEL_CALL + 54) /* sys_schedctl() */
# define SYS_STATECTL (KERNEL_CALL + 55) /* sys_statectl() */
# define SYS_SAFEMEMSET (KERNEL_CALL + 56) /* sys_safememset() */
# define SYS_PADCONF (KERNEL_CALL + 57) /* sys_padconf() */
/* Total */
#define NR_SYS_CALLS 58 /* number of kernel calls */
#define SYS_CALL_MASK_SIZE BITMAP_CHUNKS(NR_SYS_CALLS)
/* Basic kernel calls allowed to every system process. */
#define SYS_BASIC_CALLS \
SYS_EXIT, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, SYS_VSAFECOPY, SYS_GETINFO, \
SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \
SYS_PROFBUF, SYS_DIAGCTL, SYS_STATECTL, SYS_SAFEMEMSET
/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
# define _DIO_INPUT 0x001
# define _DIO_OUTPUT 0x002
# define _DIO_DIRMASK 0x00f
# define _DIO_BYTE 0x010
# define _DIO_WORD 0x020
# define _DIO_LONG 0x030
# define _DIO_TYPEMASK 0x0f0
# define _DIO_SAFE 0x100
# define _DIO_SAFEMASK 0xf00
# define DIO_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE)
# define DIO_INPUT_WORD (_DIO_INPUT|_DIO_WORD)
# define DIO_INPUT_LONG (_DIO_INPUT|_DIO_LONG)
# define DIO_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE)
# define DIO_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD)
# define DIO_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG)
# define DIO_SAFE_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
# define DIO_SAFE_INPUT_WORD (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
# define DIO_SAFE_INPUT_LONG (_DIO_INPUT|_DIO_LONG|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
/* Field names for SYS_IRQCTL. */
# define IRQ_SETPOLICY 1 /* manage a slot of the IRQ table */
# define IRQ_RMPOLICY 2 /* remove a slot of the IRQ table */
# define IRQ_ENABLE 3 /* enable interrupts */
# define IRQ_DISABLE 4 /* disable interrupts */
# define IRQ_REENABLE 0x001 /* reenable IRQ line after interrupt */
# define IRQ_BYTE 0x100 /* byte values */
# define IRQ_WORD 0x200 /* word values */
# define IRQ_LONG 0x400 /* long values */
#define CP_FLAG_TRY 0x01 /* do not transparently map */
/* Field names for SYS_GETINFO. */
# define GET_KINFO 0 /* get kernel information structure */
# define GET_IMAGE 1 /* get system image table */
# define GET_PROCTAB 2 /* get kernel process table */
# define GET_RANDOMNESS 3 /* get randomness buffer */
# define GET_MONPARAMS 4 /* get monitor parameters */
# define GET_KENV 5 /* get kernel environment string */
# define GET_IRQHOOKS 6 /* get the IRQ table */
# define GET_PRIVTAB 8 /* get kernel privileges table */
# define GET_KADDRESSES 9 /* get various kernel addresses */
# define GET_SCHEDINFO 10 /* get scheduling queues */
# define GET_PROC 11 /* get process slot if given process */
# define GET_MACHINE 12 /* get machine information */
# define GET_LOCKTIMING 13 /* get lock()/unlock() latency timing */
# define GET_BIOSBUFFER 14 /* get a buffer for BIOS calls */
# define GET_LOADINFO 15 /* get load average information */
# define GET_IRQACTIDS 16 /* get the IRQ masks */
# define GET_PRIV 17 /* get privilege structure */
# define GET_HZ 18 /* get HZ value */
# define GET_WHOAMI 19 /* get own name, endpoint, and privileges */
# define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
# define GET_IDLETSC 21 /* get cumulative idle time stamp counter */
# define GET_CPUINFO 23 /* get information about cpus */
# define GET_REGS 24 /* get general process registers */
# define GET_RUSAGE 25 /* get resource usage */
/* Subfunctions for SYS_PRIVCTL */
#define SYS_PRIV_ALLOW 1 /* Allow process to run */
#define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
#define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
#define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
#define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
#define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
*/
#define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
#define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
#define SYS_PRIV_UPDATE_SYS 9 /* Update a sys privilege structure. */
#define SYS_PRIV_YIELD 10 /* Allow process to run and suspend */
/* Constants for exec. FIXME: these do not belong here. */
#define PMEF_AUXVECTORS 20
#define PMEF_EXECNAMELEN1 PATH_MAX
/* Flags for PR_FORK_FLAGS. */
#define PFF_VMINHIBIT 0x01 /* Don't schedule until release by VM. */
/* SYS_SAFEMEMSET */
#define SMS_DST m2_i1 /* dst endpoint */
#define SMS_GID m2_i3 /* grant id */
#define SMS_OFFSET m2_l1 /* offset within grant */
#define SMS_BYTES m2_l2 /* bytes from offset */
#define SMS_PATTERN m2_i2 /* memset() pattern */
/* Field names for SYS_VMCTL. */
#define SVMCTL_WHO m1_i1
#define SVMCTL_PARAM m1_i2 /* All SYS_VMCTL requests. */
#define SVMCTL_VALUE m1_i3
#define SVMCTL_MRG_TARGET m2_i1 /* MEMREQ_GET reply: target process */
#define SVMCTL_MRG_ADDR m2_i2 /* MEMREQ_GET reply: address */
#define SVMCTL_MRG_LENGTH m2_i3 /* MEMREQ_GET reply: length */
#define SVMCTL_MRG_FLAG m2_s1 /* MEMREQ_GET reply: flag */
#define SVMCTL_MRG_EP2 m2_l1 /* MEMREQ_GET reply: source process */
#define SVMCTL_MRG_ADDR2 m2_l2 /* MEMREQ_GET reply: source address */
#define SVMCTL_MRG_REQUESTOR m2_p1 /* MEMREQ_GET reply: requestor */
#define SVMCTL_MAP_VIR_ADDR m1_p1
#define SVMCTL_PTROOT m1_i3
#define SVMCTL_PTROOT_V m1_p1
/* Reply message for VMCTL_KERN_PHYSMAP */
#define SVMCTL_MAP_FLAGS m2_i1 /* VMMF_* */
#define SVMCTL_MAP_PHYS_ADDR m2_l1
#define SVMCTL_MAP_PHYS_LEN m2_l2
#define VMMF_UNCACHED (1L << 0)
#define VMMF_USER (1L << 1)
#define VMMF_WRITE (1L << 2)
#define VMMF_GLO (1L << 3)
/* Values for SVMCTL_PARAM. */
#define VMCTL_CLEAR_PAGEFAULT 12
#define VMCTL_GET_PDBR 13
#define VMCTL_MEMREQ_GET 14
#define VMCTL_MEMREQ_REPLY 15
#define VMCTL_NOPAGEZERO 18
#define VMCTL_I386_KERNELLIMIT 19
#define VMCTL_I386_INVLPG 25
#define VMCTL_FLUSHTLB 26
#define VMCTL_KERN_PHYSMAP 27
#define VMCTL_KERN_MAP_REPLY 28
#define VMCTL_SETADDRSPACE 29
#define VMCTL_VMINHIBIT_SET 30
#define VMCTL_VMINHIBIT_CLEAR 31
#define VMCTL_CLEARMAPCACHE 32
#define VMCTL_BOOTINHIBIT_CLEAR 33
/* Codes and field names for SYS_DIAGCTL. */
#define DIAGCTL_CODE_DIAG 1 /* Print diagnostics. */
#define DIAGCTL_CODE_STACKTRACE 2 /* Print process stack. */
#define DIAGCTL_CODE_REGISTER 3 /* Register for diagnostic signals */
#define DIAGCTL_CODE_UNREGISTER 4 /* Unregister for diagnostic signals */
#define DIAG_BUFSIZE (80*25)
/* Field names for SYS_VTIMER. */
#define VT_WHICH m2_i1 /* which timer to set/retrieve */
# define VT_VIRTUAL 1 /* the ITIMER_VIRTUAL timer */
# define VT_PROF 2 /* the ITIMER_PROF timer */
#define VT_SET m2_i2 /* 1 for setting a timer, 0 retrieval only */
#define VT_VALUE m2_l1 /* new/previous value of the timer */
#define VT_ENDPT m2_l2 /* process to set/retrieve the timer for */
/* Field names for SYS_RUNCTL. */
#define RC_ENDPT m1_i1 /* which process to stop or resume */
#define RC_ACTION m1_i2 /* set or clear stop flag */
# define RC_STOP 0 /* stop the process */
# define RC_RESUME 1 /* clear the stop flag */
#define RC_FLAGS m1_i3 /* request flags */
# define RC_DELAY 1 /* delay stop if process is sending */
/* Field names for SYS_UPDATE. */
#define SYS_UPD_SRC_ENDPT m1_i1 /* source endpoint */
#define SYS_UPD_DST_ENDPT m1_i2 /* destination endpoint */
/* Subfunctions for SYS_STATECTL */
#define SYS_STATE_CLEAR_IPC_REFS 1 /* clear IPC references */
/* Subfunctions for SYS_SCHEDCTL */
# define SCHEDCTL_FLAG_KERNEL 1 /* mark kernel scheduler and remove
* RTS_NO_QUANTUM; otherwise caller is
* marked scheduler
*/
/* Field names for SYS_PADCONF */
#define PADCONF_PADCONF m2_i1 /* pad to configure */
#define PADCONF_MASK m2_i2 /* mask to apply */
#define PADCONF_VALUE m2_i3 /* value to write */
/*===========================================================================*
* Messages for the Reincarnation Server *
*===========================================================================*/
#define RS_RQ_BASE 0x700
#define RS_UP (RS_RQ_BASE + 0) /* start system service */
#define RS_DOWN (RS_RQ_BASE + 1) /* stop system service */
#define RS_REFRESH (RS_RQ_BASE + 2) /* refresh system service */
#define RS_RESTART (RS_RQ_BASE + 3) /* restart system service */
#define RS_SHUTDOWN (RS_RQ_BASE + 4) /* alert about shutdown */
#define RS_UPDATE (RS_RQ_BASE + 5) /* update system service */
#define RS_CLONE (RS_RQ_BASE + 6) /* clone system service */
#define RS_EDIT (RS_RQ_BASE + 7) /* edit system service */
#define RS_LOOKUP (RS_RQ_BASE + 8) /* lookup server name */
#define RS_GETSYSINFO (RS_RQ_BASE + 9) /* get system information */
#define RS_INIT (RS_RQ_BASE + 20) /* service init message */
#define RS_LU_PREPARE (RS_RQ_BASE + 21) /* prepare to update message */
/*===========================================================================*
* Messages for the Data Store Server *
*===========================================================================*/
#define DS_RQ_BASE 0x800
#define DS_PUBLISH (DS_RQ_BASE + 0) /* publish data */
#define DS_RETRIEVE (DS_RQ_BASE + 1) /* retrieve data by name */
#define DS_SUBSCRIBE (DS_RQ_BASE + 2) /* subscribe to data updates */
#define DS_CHECK (DS_RQ_BASE + 3) /* retrieve updated data */
#define DS_DELETE (DS_RQ_BASE + 4) /* delete data */
#define DS_SNAPSHOT (DS_RQ_BASE + 5) /* take a snapshot */
#define DS_RETRIEVE_LABEL (DS_RQ_BASE + 6) /* retrieve label's name */
#define DS_GETSYSINFO (DS_RQ_BASE + 7) /* get system information */
/*===========================================================================*
* Messages used between PM and VFS *
*===========================================================================*/
#define VFS_PM_RQ_BASE 0x900
#define VFS_PM_RS_BASE 0x980
#define IS_VFS_PM_RQ(type) (((type) & ~0x7f) == VFS_PM_RQ_BASE)
#define IS_VFS_PM_RS(type) (((type) & ~0x7f) == VFS_PM_RS_BASE)
/* Requests from PM to VFS. */
#define VFS_PM_INIT (VFS_PM_RQ_BASE + 0) /* Process table exchange */
#define VFS_PM_SETUID (VFS_PM_RQ_BASE + 1) /* Set new user ID */
#define VFS_PM_SETGID (VFS_PM_RQ_BASE + 2) /* Set group ID */
#define VFS_PM_SETSID (VFS_PM_RQ_BASE + 3) /* Set session leader */
#define VFS_PM_EXIT (VFS_PM_RQ_BASE + 4) /* Process exits */
#define VFS_PM_DUMPCORE (VFS_PM_RQ_BASE + 5) /* Process is to dump core */
#define VFS_PM_EXEC (VFS_PM_RQ_BASE + 6) /* Forwarded exec call */
#define VFS_PM_FORK (VFS_PM_RQ_BASE + 7) /* Newly forked process */
#define VFS_PM_SRV_FORK (VFS_PM_RQ_BASE + 8) /* fork for system services */
#define VFS_PM_UNPAUSE (VFS_PM_RQ_BASE + 9) /* Interrupt process call */
#define VFS_PM_REBOOT (VFS_PM_RQ_BASE + 10) /* System reboot */
#define VFS_PM_SETGROUPS (VFS_PM_RQ_BASE + 11) /* Set groups */
/* Replies from VFS to PM */
#define VFS_PM_SETUID_REPLY (VFS_PM_RS_BASE + 1)
#define VFS_PM_SETGID_REPLY (VFS_PM_RS_BASE + 2)
#define VFS_PM_SETSID_REPLY (VFS_PM_RS_BASE + 3)
#define VFS_PM_EXIT_REPLY (VFS_PM_RS_BASE + 4)
#define VFS_PM_CORE_REPLY (VFS_PM_RS_BASE + 5)
#define VFS_PM_EXEC_REPLY (VFS_PM_RS_BASE + 6)
#define VFS_PM_FORK_REPLY (VFS_PM_RS_BASE + 7)
#define VFS_PM_SRV_FORK_REPLY (VFS_PM_RS_BASE + 8)
#define VFS_PM_UNPAUSE_REPLY (VFS_PM_RS_BASE + 9)
#define VFS_PM_REBOOT_REPLY (VFS_PM_RS_BASE + 10)
#define VFS_PM_SETGROUPS_REPLY (VFS_PM_RS_BASE + 11)
/* Standard parameters for all requests and replies, except PM_REBOOT */
# define VFS_PM_ENDPT m7_i1 /* process endpoint */
/* Additional parameters for PM_INIT */
# define VFS_PM_SLOT m7_i2 /* process slot number */
# define VFS_PM_PID m7_i3 /* process pid */
/* Additional parameters for PM_SETUID and PM_SETGID */
# define VFS_PM_EID m7_i2 /* effective user/group id */
# define VFS_PM_RID m7_i3 /* real user/group id */
/* Additional parameter for PM_SETGROUPS */
# define VFS_PM_GROUP_NO m7_i2 /* number of groups */
# define VFS_PM_GROUP_ADDR m7_p1 /* struct holding group data */
/* Additional parameters for PM_EXEC */
# define VFS_PM_PATH m7_p1 /* executable */
# define VFS_PM_PATH_LEN m7_i2 /* length of path including
* terminating null character
*/
# define VFS_PM_FRAME m7_p2 /* arguments and environment */
# define VFS_PM_FRAME_LEN m7_i3 /* size of frame */
# define VFS_PM_PS_STR m7_i5 /* ps_strings pointer */
/* Additional parameters for PM_EXEC_REPLY and PM_CORE_REPLY */
# define VFS_PM_STATUS m7_i2 /* OK or failure */
# define VFS_PM_PC m7_p1 /* program counter */
# define VFS_PM_NEWSP m7_p2 /* possibly-changed stack ptr */
# define VFS_PM_NEWPS_STR m7_i5 /* possibly-changed ps_strings ptr */
/* Additional parameters for PM_FORK and PM_SRV_FORK */
# define VFS_PM_PENDPT m7_i2 /* parent process endpoint */
# define VFS_PM_CPID m7_i3 /* child pid */
# define VFS_PM_REUID m7_i4 /* real and effective uid */
# define VFS_PM_REGID m7_i5 /* real and effective gid */
/* Additional parameters for PM_DUMPCORE */
# define VFS_PM_TERM_SIG m7_i2 /* process's termination signal */
/*===========================================================================*
* Messages used from VFS to file servers *
*===========================================================================*/
#define FS_BASE 0xA00 /* Requests sent by VFS to filesystem
* implementations. See <minix/vfsif.h>
*/
/*===========================================================================*
* Common requests and miscellaneous field names *
*===========================================================================*/
#define COMMON_RQ_BASE 0xE00
/* Field names for system signals (sent by a signal manager). */
#define SIGS_SIGNAL_RECEIVED (COMMON_RQ_BASE+0)
/* Common request to all processes: gcov data. */
#define COMMON_REQ_GCOV_DATA (COMMON_RQ_BASE+1)
/* Common fault injection ctl request to all processes. */
#define COMMON_REQ_FI_CTL (COMMON_RQ_BASE+2)
/*===========================================================================*
* Messages for VM server *
*===========================================================================*/
#define VM_RQ_BASE 0xC00
/* Calls from PM */
#define VM_EXIT (VM_RQ_BASE+0)
# define VME_ENDPOINT m1_i1
#define VM_FORK (VM_RQ_BASE+1)
# define VMF_ENDPOINT m1_i1
# define VMF_SLOTNO m1_i2
# define VMF_CHILD_ENDPOINT m1_i3 /* result */
#define VM_BRK (VM_RQ_BASE+2)
#define VM_EXEC_NEWMEM (VM_RQ_BASE+3)
# define VMEN_ENDPOINT m1_i1
# define VMEN_ARGSPTR m1_p1
# define VMEN_ARGSSIZE m1_i2
# define VMEN_FLAGS m1_i3 /* result */
# define VMEN_STACK_TOP m1_p2 /* result */
#define VM_WILLEXIT (VM_RQ_BASE+5)
# define VMWE_ENDPOINT m1_i1
/* General calls. */
#define VM_MMAP (VM_RQ_BASE+10)
#define VM_MUNMAP (VM_RQ_BASE+17)
# define VMUM_ADDR m_mmap.addr
# define VMUM_LEN m_mmap.len
/* to VM: inform VM about a region of memory that is used for
* bus-master DMA
*/
#define VM_ADDDMA (VM_RQ_BASE+12)
# define VMAD_EP m2_i1
# define VMAD_START m2_l1
# define VMAD_SIZE m2_l2
/* to VM: inform VM that a region of memory that is no longer
* used for bus-master DMA
*/
#define VM_DELDMA (VM_RQ_BASE+13)
# define VMDD_EP m2_i1
# define VMDD_START m2_l1
# define VMDD_SIZE m2_l2
/* to VM: ask VM for a region of memory that should not
* be used for bus-master DMA any longer
*/
#define VM_GETDMA (VM_RQ_BASE+14)
# define VMGD_PROCP m2_i1
# define VMGD_BASEP m2_l1
# define VMGD_SIZEP m2_l2
#define VM_MAP_PHYS (VM_RQ_BASE+15)
#define VM_UNMAP_PHYS (VM_RQ_BASE+16)
/* To VM: map in cache block by FS */
#define VM_MAPCACHEPAGE (VM_RQ_BASE+26)
/* To VM: identify cache block in FS */
#define VM_SETCACHEPAGE (VM_RQ_BASE+27)
/* To VM: clear all cache blocks for a device */
#define VM_CLEARCACHE (VM_RQ_BASE+28)
/* To VFS: fields for request from VM. */
# define VFS_VMCALL_REQ m10_i1
# define VFS_VMCALL_FD m10_i2
# define VFS_VMCALL_REQID m10_i3
# define VFS_VMCALL_ENDPOINT m10_i4
# define VFS_VMCALL_OFFSET m10_ull1
# define VFS_VMCALL_LENGTH m10_l3
/* Request codes to from VM to VFS */
#define VMVFSREQ_FDLOOKUP 101
#define VMVFSREQ_FDCLOSE 102
#define VMVFSREQ_FDIO 103
/* Calls from VFS. */
#define VM_VFS_REPLY (VM_RQ_BASE+30)
# define VMV_ENDPOINT m10_i1
# define VMV_RESULT m10_i2
# define VMV_REQID m10_i3
# define VMV_DEV m10_i4
# define VMV_INO m10_l1
# define VMV_FD m10_l2
# define VMV_SIZE_PAGES m10_l3
#define VM_REMAP (VM_RQ_BASE+33)
#define VM_SHM_UNMAP (VM_RQ_BASE+34)
#define VM_GETPHYS (VM_RQ_BASE+35)
#define VM_GETREF (VM_RQ_BASE+36)
#define VM_RS_SET_PRIV (VM_RQ_BASE+37)
# define VM_RS_NR m2_i1
# define VM_RS_BUF m2_l1
# define VM_RS_SYS m2_i2
#define VM_QUERY_EXIT (VM_RQ_BASE+38)
#define VM_NOTIFY_SIG (VM_RQ_BASE+39)
# define VM_NOTIFY_SIG_ENDPOINT m1_i1
# define VM_NOTIFY_SIG_IPC m1_i2
#define VM_INFO (VM_RQ_BASE+40)
/* VM_INFO 'what' values. */
#define VMIW_STATS 1
#define VMIW_USAGE 2
#define VMIW_REGION 3
#define VM_RS_UPDATE (VM_RQ_BASE+41)
#define VM_RS_MEMCTL (VM_RQ_BASE+42)
# define VM_RS_CTL_ENDPT m1_i1
# define VM_RS_CTL_REQ m1_i2
# define VM_RS_MEM_PIN 0 /* pin memory */
# define VM_RS_MEM_MAKE_VM 1 /* make VM instance */
#define VM_WATCH_EXIT (VM_RQ_BASE+43)
#define VM_REMAP_RO (VM_RQ_BASE+44)
/* same args as VM_REMAP */
#define VM_PROCCTL (VM_RQ_BASE+45)
#define VMPCTL_PARAM m9_l1
#define VMPCTL_WHO m9_l2
#define VMPCTL_M1 m9_l3
#define VMPCTL_LEN m9_l4
#define VMPCTL_FLAGS m9_l5
#define VMPPARAM_CLEAR 1 /* values for VMPCTL_PARAM */
#define VMPPARAM_HANDLEMEM 2
#define VM_VFS_MMAP (VM_RQ_BASE+46)
#define VM_GETRUSAGE (VM_RQ_BASE+47)
/* Total. */
#define NR_VM_CALLS 48
#define VM_CALL_MASK_SIZE BITMAP_CHUNKS(NR_VM_CALLS)
/* not handled as a normal VM call, thus at the end of the reserved rage */
#define VM_PAGEFAULT (VM_RQ_BASE+0xff)
# define VPF_ADDR m1_i1
# define VPF_FLAGS m1_i2
/* Basic vm calls allowed to every process. */
#define VM_BASIC_CALLS \
VM_BRK, VM_MMAP, VM_MUNMAP, VM_MAP_PHYS, VM_UNMAP_PHYS, VM_INFO, \
VM_GETRUSAGE
/*===========================================================================*
* Messages for IPC server *
*===========================================================================*/
#define IPC_BASE 0xD00
/* Shared Memory */
#define IPC_SHMGET (IPC_BASE+1)
#define IPC_SHMAT (IPC_BASE+2)
#define IPC_SHMDT (IPC_BASE+3)
#define IPC_SHMCTL (IPC_BASE+4)
/* Semaphore */
#define IPC_SEMGET (IPC_BASE+5)
#define IPC_SEMCTL (IPC_BASE+6)
#define IPC_SEMOP (IPC_BASE+7)
/*===========================================================================*
* Messages for Scheduling *
*===========================================================================*/
#define SCHEDULING_BASE 0xF00
#define SCHEDULING_NO_QUANTUM (SCHEDULING_BASE+1)
#define SCHEDULING_START (SCHEDULING_BASE+2)
#define SCHEDULING_STOP (SCHEDULING_BASE+3)
#define SCHEDULING_SET_NICE (SCHEDULING_BASE+4)
#define SCHEDULING_INHERIT (SCHEDULING_BASE+5)
/*===========================================================================*
* Messages for USB *
*===========================================================================*/
#define USB_BASE 0x1100
/* those are from driver to USBD */
#define USB_RQ_INIT (USB_BASE + 0) /* First message to HCD driver */
#define USB_RQ_DEINIT (USB_BASE + 1) /* Quit the session */
#define USB_RQ_SEND_URB (USB_BASE + 2) /* Send URB */
#define USB_RQ_CANCEL_URB (USB_BASE + 3) /* Cancel URB */
#define USB_REPLY (USB_BASE + 4)
/* those are from USBD to driver */
#define USB_COMPLETE_URB (USB_BASE + 6)
#define USB_ANNOUCE_DEV (USB_BASE + 7) /* Announce a new USB Device */
#define USB_WITHDRAW_DEV (USB_BASE + 8) /* Withdraw a allready anncounced
USB device*/
# define USB_GRANT_ID m4_l1
# define USB_GRANT_SIZE m4_l2
# define USB_URB_ID m4_l1
# define USB_RESULT m4_l2
# define USB_DEV_ID m4_l1
# define USB_DRIVER_EP m4_l2
# define USB_INTERFACES m4_l3
# define USB_RB_INIT_NAME m3_ca1
/*===========================================================================*
* Messages for DeviceManager (s/t like SysFS) *
*===========================================================================*/
#define DEVMAN_BASE 0x1200
#define DEVMAN_ADD_DEV (DEVMAN_BASE + 0)
#define DEVMAN_DEL_DEV (DEVMAN_BASE + 1)
#define DEVMAN_ADD_BUS (DEVMAN_BASE + 2)
#define DEVMAN_DEL_BUS (DEVMAN_BASE + 3)
#define DEVMAN_ADD_DEVFILE (DEVMAN_BASE + 4)
#define DEVMAN_DEL_DEVFILE (DEVMAN_BASE + 5)
#define DEVMAN_REQUEST (DEVMAN_BASE + 6)
#define DEVMAN_REPLY (DEVMAN_BASE + 7)
#define DEVMAN_BIND (DEVMAN_BASE + 8)
#define DEVMAN_UNBIND (DEVMAN_BASE + 9)
# define DEVMAN_GRANT_ID m4_l1
# define DEVMAN_GRANT_SIZE m4_l2
# define DEVMAN_ENDPOINT m4_l3
# define DEVMAN_DEVICE_ID m4_l2
# define DEVMAN_RESULT m4_l1
/*===========================================================================*
* Messages for TTY *
*===========================================================================*/
#define TTY_RQ_BASE 0x1300
#define TTY_FKEY_CONTROL (TTY_RQ_BASE + 1) /* control an F-key at TTY */
# define FKEY_MAP 10 /* observe function key */
# define FKEY_UNMAP 11 /* stop observing function key */
# define FKEY_EVENTS 12 /* request open key presses */
#define TTY_INPUT_UP (TTY_RQ_BASE + 2) /* input server is up */
#define TTY_INPUT_EVENT (TTY_RQ_BASE + 3) /* relayed input event */
/*===========================================================================*
* Messages for input server and drivers *
*===========================================================================*/
/* The input protocol has no real replies. All messages are one-way. */
#define INPUT_RQ_BASE 0x1500 /* from TTY to server, or server to driver */
#define INPUT_RS_BASE 0x1580 /* from input driver to input server */
#define INPUT_CONF (INPUT_RQ_BASE + 0) /* configure driver */
#define INPUT_SETLEDS (INPUT_RQ_BASE + 1) /* set keyboard LEDs */
#define INPUT_EVENT (INPUT_RS_BASE + 0) /* send input event */
/*===========================================================================*
* VFS-FS TRANSACTION IDs *
*===========================================================================*/
#define VFS_TRANSACTION_BASE 0xB00
#define VFS_TRANSID (VFS_TRANSACTION_BASE + 1)
#define IS_VFS_FS_TRANSID(type) (((type) & ~0xff) == VFS_TRANSACTION_BASE)
/*===========================================================================*
* Messages for character devices *
*===========================================================================*/
/* Base type for character device requests and responses. */
#define CDEV_RQ_BASE 0x400
#define CDEV_RS_BASE 0x480
#define IS_CDEV_RQ(type) (((type) & ~0x7f) == CDEV_RQ_BASE)
#define IS_CDEV_RS(type) (((type) & ~0x7f) == CDEV_RS_BASE)
/* Message types for character device requests. */
#define CDEV_OPEN (CDEV_RQ_BASE + 0) /* open a minor device */
#define CDEV_CLOSE (CDEV_RQ_BASE + 1) /* close a minor device */
#define CDEV_READ (CDEV_RQ_BASE + 2) /* read into a buffer */
#define CDEV_WRITE (CDEV_RQ_BASE + 3) /* write from a buffer */
#define CDEV_IOCTL (CDEV_RQ_BASE + 4) /* I/O control operation */
#define CDEV_CANCEL (CDEV_RQ_BASE + 5) /* cancel suspended request */
#define CDEV_SELECT (CDEV_RQ_BASE + 6) /* test for ready operations */
/* Message types for character device responses. */
#define CDEV_REPLY (CDEV_RS_BASE + 0) /* general reply code */
#define CDEV_SEL1_REPLY (CDEV_RS_BASE + 1) /* immediate select reply */
#define CDEV_SEL2_REPLY (CDEV_RS_BASE + 2) /* select notification reply */
/* Bits in 'CDEV_ACCESS' field of block device open requests. */
# define CDEV_R_BIT 0x01 /* open with read access */
# define CDEV_W_BIT 0x02 /* open with write access */
# define CDEV_NOCTTY 0x04 /* not to become the controlling TTY */
/* Bits in 'CDEV_FLAGS' field of block device transfer requests. */
# define CDEV_NOFLAGS 0x00 /* no flags are set */
# define CDEV_NONBLOCK 0x01 /* do not suspend I/O request */
/* Bits in 'CDEV_OPS', 'CDEV_STATUS' fields of block device select messages. */
# define CDEV_OP_RD 0x01 /* selected for read operation */
# define CDEV_OP_WR 0x02 /* selected for write operation */
# define CDEV_OP_ERR 0x04 /* selected for error operation */
# define CDEV_NOTIFY 0x08 /* notification requested */
/* Bits in 'CDEV_STATUS' field of block device open responses. */
# define CDEV_CLONED 0x20000000 /* device is cloned */
# define CDEV_CTTY 0x40000000 /* device is controlling TTY */
/*===========================================================================*
* Messages for block devices *
*===========================================================================*/
/* Base type for block device requests and responses. */
#define BDEV_RQ_BASE 0x500
#define BDEV_RS_BASE 0x580
#define IS_BDEV_RQ(type) (((type) & ~0x7f) == BDEV_RQ_BASE)
#define IS_BDEV_RS(type) (((type) & ~0x7f) == BDEV_RS_BASE)
/* Message types for block device requests. */
#define BDEV_OPEN (BDEV_RQ_BASE + 0) /* open a minor device */
#define BDEV_CLOSE (BDEV_RQ_BASE + 1) /* close a minor device */
#define BDEV_READ (BDEV_RQ_BASE + 2) /* read into a buffer */
#define BDEV_WRITE (BDEV_RQ_BASE + 3) /* write from a buffer */
#define BDEV_GATHER (BDEV_RQ_BASE + 4) /* read into a vector */
#define BDEV_SCATTER (BDEV_RQ_BASE + 5) /* write from a vector */
#define BDEV_IOCTL (BDEV_RQ_BASE + 6) /* I/O control operation */
/* Message types for block device responses. */
#define BDEV_REPLY (BDEV_RS_BASE + 0) /* general reply code */
/* Bits in 'BDEV_ACCESS' field of block device open requests. */
# define BDEV_R_BIT 0x01 /* open with read access */
# define BDEV_W_BIT 0x02 /* open with write access */
/* Bits in 'BDEV_FLAGS' field of block device transfer requests. */
# define BDEV_NOFLAGS 0x00 /* no flags are set */
# define BDEV_FORCEWRITE 0x01 /* force write to disk immediately */
# define BDEV_NOPAGE 0x02 /* eeprom: don't send page address */
/*===========================================================================*
* Messages for Real Time Clocks *
*===========================================================================*/
/* Base type for real time clock requests and responses. */
#define RTCDEV_RQ_BASE 0x1400
#define RTCDEV_RS_BASE 0x1480
#define IS_RTCDEV_RQ(type) (((type) & ~0x7f) == RTCDEV_RQ_BASE)
#define IS_RTCDEV_RS(type) (((type) & ~0x7f) == RTCDEV_RS_BASE)
/* Message types for real time clock requests. */
#define RTCDEV_GET_TIME (RTCDEV_RQ_BASE + 0) /* get time from hw clock */
#define RTCDEV_SET_TIME (RTCDEV_RQ_BASE + 1) /* set time in hw clock */
#define RTCDEV_PWR_OFF (RTCDEV_RQ_BASE + 2) /* set time to cut the power */
/* Same as GET/SET above but using grants */
#define RTCDEV_GET_TIME_G (RTCDEV_RQ_BASE + 3) /* get time from hw clock */
#define RTCDEV_SET_TIME_G (RTCDEV_RQ_BASE + 4) /* set time in hw clock */
/* Message types for real time clock responses. */
#define RTCDEV_REPLY (RTCDEV_RS_BASE + 0) /* general reply code */
/* Bits in 'lc_readclock_rtcdev.flags' field of real time clock requests. */
#define RTCDEV_NOFLAGS 0x00 /* no flags are set */
#define RTCDEV_Y2KBUG 0x01 /* Interpret 1980 as 2000 for RTC w/Y2K bug */
#define RTCDEV_CMOSREG 0x02 /* Also set the CMOS clock register bits. */
/*===========================================================================*
* Internal codes used by several services *
*===========================================================================*/
#define SUSPEND -998 /* status to suspend caller, reply later */
#endif /* !_MINIX_COM_H */

View File

@@ -1,98 +0,0 @@
#ifndef _CONFIG_H
#define _CONFIG_H
/* Minix release and version numbers. */
#define OS_NAME "Minix"
#define OS_RELEASE "3.3.0"
#define OS_CONFIG "GENERIC"
#define OS_VERSION OS_NAME " " OS_RELEASE " (" OS_CONFIG ")"
/* This file sets configuration parameters for the MINIX kernel, FS, and PM.
* It is divided up into two main sections. The first section contains
* user-settable parameters. In the second section, various internal system
* parameters are set based on the user-settable parameters.
*
* Parts of config.h have been moved to sys_config.h, which can be included
* by other include files that wish to get at the configuration data, but
* don't want to pollute the users namespace. Some editable values have
* gone there.
*
*/
#include <minix/sys_config.h>
/* Number of slots in the process table for non-kernel processes. The number
* of system processes defines how many processes with special privileges
* there can be. User processes share the same properties and count for one.
*
* These can be changed in sys_config.h.
*/
#define NR_PROCS _NR_PROCS
#define NR_SYS_PROCS _NR_SYS_PROCS
#define NR_SYS_CHUNKS BITMAP_CHUNKS(NR_SYS_PROCS)
/* Number of controller tasks (/dev/cN device classes). */
#define NR_CTRLRS 2
/* DMA_SECTORS may be increased to speed up DMA based drivers. */
#define DMA_SECTORS 1 /* DMA buffer size (must be >= 1) */
/* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the
* system can handle.
*/
#define NR_CONS 4 /* # system consoles (1 to 8) */
#define NR_RS_LINES 4 /* # rs232 terminals (0 to 3) */
#define NR_PTYS 32 /* # pseudo terminals (0 to 64) */
/* This feature enable the counting of system calls in PM and FS */
#define ENABLE_SYSCALL_STATS 0
/* Max. number of I/O ranges that can be assigned to a process */
#define NR_IO_RANGE 64
/* Max. number of device memory ranges that can be assigned to a process */
#define NR_MEM_RANGE 20
/* Max. number of IRQs that can be assigned to a process */
#define NR_IRQ 16
/* Scheduling priorities. Values must start at zero (highest
* priority) and increment.
*/
#define NR_SCHED_QUEUES 16 /* MUST equal minimum priority + 1 */
#define TASK_Q 0 /* highest, used for kernel tasks */
#define MAX_USER_Q 0 /* highest priority for user processes */
#define USER_Q ((MIN_USER_Q - MAX_USER_Q) / 2 + MAX_USER_Q) /* default
(should correspond to nice 0) */
#define MIN_USER_Q (NR_SCHED_QUEUES - 1) /* minimum priority for user
processes */
/* default scheduling quanta */
#define USER_QUANTUM 200
/* defualt user process cpu */
#define USER_DEFAULT_CPU -1 /* use the default cpu or do not change the
current one */
/*===========================================================================*
* There are no user-settable parameters after this line *
*===========================================================================*/
/* Set the FP_FORMAT type based on the machine selected, either hw or sw */
#define FP_NONE _FP_NONE /* no floating point support */
#define FP_IEEE _FP_IEEE /* conform IEEE floating point standard */
/* _MINIX_FP_FORMAT is defined in sys_config.h. */
#define FP_FORMAT _MINIX_FP_FORMAT
/* _ASKDEV and _FASTLOAD are defined in sys_config.h. */
#define ASKDEV _ASKDEV
#define FASTLOAD _FASTLOAD
/* Enable or disable system profiling. */
#define SPROFILE 0 /* statistical profiling */
#define CPROFILE 0 /* call profiling */
/* PCI configuration parameters */
#define NR_PCIBUS 40
#define NR_PCIDEV 50
#endif /* _CONFIG_H */

View File

@@ -1,164 +0,0 @@
#ifndef _MINIX_CONST_H
#define _MINIX_CONST_H
#include <machine/archconst.h>
/* The UNUSED annotation tells the compiler or lint not to complain
* about an unused variable or function parameter.
*
* A number of different annotations are used, depending on the
* compiler or checker that is looking at the code.
*
* Note that some variants rename the parameter, so if you use
* the parameter after all, you'll get a complaint about a missing
* variable.
*
* You use it like this:
*
* void foo(int UNUSED(x)){}
*/
#ifndef UNUSED
#if defined _lint
# define UNUSED(v) /*lint -e(715,818)*/ v
#elif defined(__GNUC__)
# define UNUSED(v) UNUSED_ ## v __attribute((unused))
#elif defined __LCLINT__
# define UNUSED(v) /*@unused@*/ v
#else
# define UNUSED(v) _UNUSED_ ## v
#endif
#endif
#define EXTERN extern /* used in *.h files */
#define TRUE 1 /* used for turning integers into Booleans */
#define FALSE 0 /* used for turning integers into Booleans */
#define SUPER_USER ((uid_t) 0) /* uid_t of superuser */
#include <sys/null.h> /* NULL Pointer */
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY request */
#define MAPVEC_NR 64 /* max # of entries in a SYS_VUMAP request */
#define NR_IOREQS 64 /* maximum number of entries in an iorequest */
#define VUA_READ 0x01 /* for SYS_VUMAP: read access */
#define VUA_WRITE 0x02 /* for SYS_VUMAP: write access */
/* Message passing constants. */
#define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
/* Memory related constants. */
#define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
#define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
#define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
#define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
#define MEM_GRANT 3
#define VIR_ADDR 1
#define VM_D (LOCAL_VM_SEG | VIR_ADDR)
#define VM_GRANT (LOCAL_VM_SEG | MEM_GRANT)
/* Labels used to disable code sections for different reasons. */
#define DEAD_CODE 0 /* unused code in normal configuration */
#define FUTURE_CODE 0 /* new code to be activated + tested later */
#define TEMP_CODE 1 /* active code to be removed later */
/* Miscellaneous */
#define BYTE 0377 /* mask for 8 bits */
#define READING 0 /* copy data to user */
#define WRITING 1 /* copy data from user */
#define PEEKING 2 /* retrieve FS data without copying */
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
/* Memory is allocated in clicks. */
#if defined(__i386__) || defined(__arm__)
#define CLICK_SIZE 4096 /* unit in which memory is allocated */
#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
#else
#error Unsupported arch
#endif
/* Click alignment macros. */
#define CLICK_FLOOR(n) (((vir_bytes)(n) / CLICK_SIZE) * CLICK_SIZE)
#define CLICK_CEIL(n) CLICK_FLOOR((vir_bytes)(n) + CLICK_SIZE-1)
/* Sizes of memory tables. The boot monitor distinguishes three memory areas,
* namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
* for DOS MINIX.
*/
#define NR_MEMS 16
#define CLICK2ABS(v) ((v) << CLICK_SHIFT)
#define ABS2CLICK(a) ((a) >> CLICK_SHIFT)
/* Flag bits for i_mode in the inode. */
#define I_TYPE 0170000 /* this field gives inode type */
#define I_UNIX_SOCKET 0140000 /* unix domain socket */
#define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
#define I_REGULAR 0100000 /* regular file, not dir or special */
#define I_BLOCK_SPECIAL 0060000 /* block special file */
#define I_DIRECTORY 0040000 /* file is a directory */
#define I_CHAR_SPECIAL 0020000 /* character special file */
#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
#define I_SET_STCKY_BIT 0001000 /* sticky bit */
#define ALL_MODES 0007777 /* all bits for user, group and others */
#define RWX_MODES 0000777 /* mode bits for RWX only */
#define R_BIT 0000004 /* Rwx protection bit */
#define W_BIT 0000002 /* rWx protection bit */
#define X_BIT 0000001 /* rwX protection bit */
#define I_NOT_ALLOC 0000000 /* this inode is free */
/* Some limits. */
#define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
#define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
#define UMAX_FILE_POS ((unsigned) 0x7FFFFFFF) /* largest legal file offset */
#define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
#define NO_BLOCK ((block_t) 0) /* absence of a block number */
#define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
#define NO_DEV ((dev_t) 0) /* absence of a device numb */
#define NO_LINK ((nlink_t) 0) /* absence of incoming links */
#define INVAL_UID ((uid_t) -1) /* invalid uid value */
#define INVAL_GID ((gid_t) -1) /* invalid gid value */
#define SERVARNAME "cttyline"
#define ARCHVARNAME "arch"
#define BOARDVARNAME "board"
#define SERBAUDVARNAME "cttybaud"
/* Bits for s_flags in the privilege structure. */
#define PREEMPTIBLE 0x002 /* kernel tasks are not preemptible */
#define BILLABLE 0x004 /* some processes are not billable */
#define DYN_PRIV_ID 0x008 /* privilege id assigned dynamically */
#define SYS_PROC 0x010 /* system processes have own priv structure */
#define CHECK_IO_PORT 0x020 /* check if I/O request is allowed */
#define CHECK_IRQ 0x040 /* check if IRQ can be used */
#define CHECK_MEM 0x080 /* check if (VM) mem map request is allowed */
#define ROOT_SYS_PROC 0x100 /* this is a root system process instance */
#define VM_SYS_PROC 0x200 /* this is a vm system process instance */
#define LU_SYS_PROC 0x400 /* this is a live updated sys proc instance */
#define RST_SYS_PROC 0x800 /* this is a restarted sys proc instance */
/* Values for the "verbose" boot monitor variable */
#define VERBOSEBOOT_QUIET 0
#define VERBOSEBOOT_BASIC 1
#define VERBOSEBOOT_EXTRA 2
#define VERBOSEBOOT_MAX 3
#define VERBOSEBOOTVARNAME "verbose"
/* magic value to put in struct proc entries for sanity checks. */
#define PMAGIC 0xC0FFEE1
/* MINIX_KERNFLAGS flags */
#define MKF_I386_INTEL_SYSENTER (1L << 0) /* SYSENTER available and supported */
#define MKF_I386_AMD_SYSCALL (1L << 1) /* SYSCALL available and supported */
#endif /* _MINIX_CONST_H */

View File

@@ -1,30 +0,0 @@
#ifndef _MINIX_CPUFEATURE_H
#define _MINIX_CPUFEATURE_H 1
#define _CPUF_I386_FPU 0 /* FPU-x87 FPU on Chip */
#define _CPUF_I386_PSE 1 /* Page Size Extension */
#define _CPUF_I386_PGE 2 /* Page Global Enable */
#define _CPUF_I386_APIC_ON_CHIP 3 /* APIC is present on the chip */
#define _CPUF_I386_TSC 4 /* Timestamp counter present */
#define _CPUF_I386_SSE1234_12 5 /* Support for SSE/SSE2/SSE3/SSSE3/SSE4
* Extensions and FXSR
*/
#define _CPUF_I386_FXSR 6
#define _CPUF_I386_SSE 7
#define _CPUF_I386_SSE2 8
#define _CPUF_I386_SSE3 9
#define _CPUF_I386_SSSE3 10
#define _CPUF_I386_SSE4_1 11
#define _CPUF_I386_SSE4_2 12
#define _CPUF_I386_HTT 13 /* Supports HTT */
#define _CPUF_I386_HTT_MAX_NUM 14 /* Maximal num of threads */
#define _CPUF_I386_MTRR 15
#define _CPUF_I386_SYSENTER 16 /* Intel SYSENTER instrs */
#define _CPUF_I386_SYSCALL 17 /* AMD SYSCALL instrs */
int _cpufeature(int featureno);
#endif

View File

@@ -1,22 +0,0 @@
#ifndef _MINIX_DEBUG_H
#define _MINIX_DEBUG_H 1
/* For reminders of things to be fixed. */
#define FIXME(str) { static int fixme_warned = 0; \
if(!fixme_warned) { \
printf("FIXME: %s:%d: %s\n", __FILE__, __LINE__, str);\
fixme_warned = 1; \
} \
}
#define NOT_REACHABLE do { \
panic("NOT_REACHABLE at %s:%d", __FILE__, __LINE__); \
for(;;); \
} while(0)
#define NOT_IMPLEMENTED do { \
panic("NOT_IMPLEMENTED at %s:%d", __FILE__, __LINE__); \
} while(0)
#endif /* _MINIX_DEBUG_H */

View File

@@ -1,68 +0,0 @@
/* This file provides basic types and some constants for the
* SYS_DEVIO and SYS_VDEVIO system calls, which allow user-level
* processes to perform device I/O.
*
* Created:
* Apr 08, 2004 by Jorrit N. Herder
*/
#ifndef _DEVIO_H
#define _DEVIO_H
#include <minix/sys_config.h> /* needed to include <minix/type.h> */
#include <sys/types.h> /* u8_t, u16_t, u32_t needed */
typedef u16_t port_t;
/* We have different granularities of port I/O: 8, 16, 32 bits.
* Also see <ibm/portio.h>, which has functions for bytes, words,
* and longs. Hence, we need different (port,value)-pair types.
*/
typedef struct { u16_t port; u8_t value; } pvb_pair_t;
typedef struct { u16_t port; u16_t value; } pvw_pair_t;
typedef struct { u16_t port; u32_t value; } pvl_pair_t;
/* Macro shorthand to set (port,value)-pair. */
#define pv_set(pv, p, v) do { \
u32_t _p = (p), _v = (v); \
(pv).port = _p; \
(pv).value = _v; \
if((pv).port != _p || (pv).value != _v) { \
printf("%s:%d: actual port: 0x%x != 0x%x || " \
"actual value: 0x%x != 0x%x\n", \
__FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
panic("pv_set(" #pv ", " #p ", " #v ")"); \
} \
} while(0)
#if 0 /* no longer in use !!! */
/* Define a number of flags to indicate granularity we are using. */
#define MASK_GRANULARITY 0x000F /* not in use! does not match flags */
#define PVB_FLAG 'b'
#define PVW_FLAG 'w'
#define PVL_FLAG 'l'
/* Flags indicating whether request wants to do input or output. */
#define MASK_IN_OR_OUT 0x00F0
#define DEVIO_INPUT 0x0010
#define DEVIO_OUTPUT 0x0020
#endif /* 0 */
#if 0 /* no longer used !!! */
/* Define how large the (port,value)-pair buffer in the kernel is.
* This buffer is used to copy the (port,value)-pairs in kernel space.
*/
#define PV_BUF_SIZE 64 /* creates char pv_buf[PV_BUF_SIZE] */
/* Note that SYS_VDEVIO sends a pointer to a vector of (port,value)-pairs,
* whereas SYS_DEVIO includes a single (port,value)-pair in the messages.
* Calculate maximum number of (port,value)-pairs that can be handled
* in a single SYS_VDEVIO system call with above struct definitions.
*/
#define MAX_PVB_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvb_pair_t))
#define MAX_PVW_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvw_pair_t))
#define MAX_PVL_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvl_pair_t))
#endif /* 0 */
#endif /* _DEVIO_H */

View File

@@ -1,72 +0,0 @@
#ifndef MINIX_LIBDEVMAN_H
#define MINIX_LIBDEVMAN_H
#include <minix/com.h>
#include <minix/ipc.h>
#include <minix/usb_ch9.h>
/* used for serializing */
struct devman_device_info {
int count;
int parent_dev_id;
unsigned name_offset;
unsigned subsystem_offset;
};
struct devman_device_info_entry {
unsigned type;
unsigned name_offset;
unsigned data_offset;
unsigned req_nr;
};
#ifndef DEVMAN_SERVER
struct devman_usb_bind_cb_data {
int dev_id;
int interface;
};
struct devman_usb_interface {
struct devman_dev *dev;
struct devman_usb_dev *usb_dev;
usb_interface_descriptor_t *desc;
/* used by the lib */
struct devman_usb_bind_cb_data cb_data;
};
struct devman_usb_dev {
struct devman_dev *dev;
int dev_id; /* The ID identifying the device
on server side */
usb_device_descriptor_t *desc;
int configuration; /* the configuration used for this
device */
char *manufacturer;
char *product;
char *serial;
int intf_count; /* the number of interfaces in the current
configuration */
struct devman_usb_interface interfaces[32];
/* used by the lib */
struct devman_usb_bind_cb_data cb_data;
};
typedef int (*devman_usb_bind_cb_t)(struct devman_usb_bind_cb_data *data, endpoint_t ep);
int devman_add_device(struct devman_dev *dev);
int devman_del_device(struct devman_dev *dev);
int devman_init(void);
struct devman_usb_dev* devman_usb_device_new(int dev_id);
int devman_usb_device_add(struct devman_usb_dev *dev);
int devman_usb_device_remove(struct devman_usb_dev *dev);
void devman_usb_device_delete(struct devman_usb_dev *udev);
int devman_handle_msg(message *m);
void devman_usb_init(devman_usb_bind_cb_t bind_cb, devman_usb_bind_cb_t
unbind_cb);
#endif
#endif

View File

@@ -1,94 +0,0 @@
#ifndef _DMAP_H
#define _DMAP_H
#include <minix/sys_config.h>
#include <minix/ipc.h>
/*===========================================================================*
* Major and minor device numbers *
*===========================================================================*/
/* Major device numbers. */
#define NONE_MAJOR 0 /* 0 = not used */
#define MEMORY_MAJOR 1 /* 1 = /dev/mem (memory devices) */
#define FLOPPY_MAJOR 2 /* 2 = /dev/fd0 (floppy disks) */
/* 3 = /dev/c0 */
#define TTY_MAJOR 4 /* 4 = /dev/tty00 (ttys) */
#define CTTY_MAJOR 5 /* 5 = /dev/tty */
#define PRINTER_MAJOR 6 /* 6 = /dev/lp (printer driver) */
#define INET_MAJOR 7 /* 7 = /dev/ip (inet) */
/* 8 = /dev/c1 */
#define PTY_MAJOR 9 /* 9 = /dev/ptyp0 (pty driver) */
/* 10 = /dev/c2 */
#define FILTER_MAJOR 11 /* 11 = /dev/filter (filter driver) */
/* 12 = /dev/c3 */
#define AUDIO_MAJOR 13 /* 13 = /dev/audio (audio driver) */
#define FBD_MAJOR 14 /* 14 = /dev/fbd (faulty block dev)*/
#define LOG_MAJOR 15 /* 15 = /dev/klog (log driver) */
#define RANDOM_MAJOR 16 /* 16 = /dev/random (random driver) */
#define HELLO_MAJOR 17 /* 17 = /dev/hello (hello driver) */
#define UDS_MAJOR 18 /* 18 = /dev/uds (pfs) */
#define FB_MAJOR 19 /* 18 = /dev/fb0 (fb driver) */
#define I2C0_MAJOR 20 /* 20 = /dev/i2c-1 (i2c-dev) */
#define I2C1_MAJOR 21 /* 21 = /dev/i2c-2 (i2c-dev) */
#define I2C2_MAJOR 22 /* 22 = /dev/i2c-3 (i2c-dev) */
#define EEPROMB1S50_MAJOR 23 /* 23 = /dev/eepromb1s50 (cat24c256) */
#define EEPROMB1S51_MAJOR 24 /* 24 = /dev/eepromb1s51 (cat24c256) */
#define EEPROMB1S52_MAJOR 25 /* 25 = /dev/eepromb1s52 (cat24c256) */
#define EEPROMB1S53_MAJOR 26 /* 26 = /dev/eepromb1s53 (cat24c256) */
#define EEPROMB1S54_MAJOR 27 /* 27 = /dev/eepromb1s54 (cat24c256) */
#define EEPROMB1S55_MAJOR 28 /* 28 = /dev/eepromb1s55 (cat24c256) */
#define EEPROMB1S56_MAJOR 29 /* 29 = /dev/eepromb1s56 (cat24c256) */
#define EEPROMB1S57_MAJOR 30 /* 30 = /dev/eepromb1s57 (cat24c256) */
#define EEPROMB2S50_MAJOR 31 /* 31 = /dev/eepromb2s50 (cat24c256) */
#define EEPROMB2S51_MAJOR 32 /* 32 = /dev/eepromb2s51 (cat24c256) */
#define EEPROMB2S52_MAJOR 33 /* 33 = /dev/eepromb2s52 (cat24c256) */
#define EEPROMB2S53_MAJOR 34 /* 34 = /dev/eepromb2s53 (cat24c256) */
#define EEPROMB2S54_MAJOR 35 /* 35 = /dev/eepromb2s54 (cat24c256) */
#define EEPROMB2S55_MAJOR 36 /* 36 = /dev/eepromb2s55 (cat24c256) */
#define EEPROMB2S56_MAJOR 37 /* 37 = /dev/eepromb2s56 (cat24c256) */
#define EEPROMB2S57_MAJOR 38 /* 38 = /dev/eepromb2s57 (cat24c256) */
#define EEPROMB3S50_MAJOR 39 /* 39 = /dev/eepromb3s50 (cat24c256) */
#define EEPROMB3S51_MAJOR 40 /* 40 = /dev/eepromb3s51 (cat24c256) */
#define EEPROMB3S52_MAJOR 41 /* 41 = /dev/eepromb3s52 (cat24c256) */
#define EEPROMB3S53_MAJOR 42 /* 42 = /dev/eepromb3s53 (cat24c256) */
#define EEPROMB3S54_MAJOR 43 /* 43 = /dev/eepromb3s54 (cat24c256) */
#define EEPROMB3S55_MAJOR 44 /* 44 = /dev/eepromb3s55 (cat24c256) */
#define EEPROMB3S56_MAJOR 45 /* 45 = /dev/eepromb3s56 (cat24c256) */
#define EEPROMB3S57_MAJOR 46 /* 46 = /dev/eepromb3s57 (cat24c256) */
#define TSL2550B1S39_MAJOR 47 /* 47 = /dev/tsl2550b1s39 (tsl2550) */
#define TSL2550B2S39_MAJOR 48 /* 48 = /dev/tsl2550b2s39 (tsl2550) */
#define TSL2550B3S39_MAJOR 49 /* 49 = /dev/tsl2550b3s39 (tsl2550) */
#define SHT21B1S40_MAJOR 50 /* 50 = /dev/sht21b1s40 (sht21) */
#define SHT21B2S40_MAJOR 51 /* 51 = /dev/sht21b2s40 (sht21) */
#define SHT21B3S40_MAJOR 52 /* 52 = /dev/sht21b3s40 (sht21) */
#define BMP085B1S77_MAJOR 53 /* 53 = /dev/bmp085b1s77 (bmp085) */
#define BMP085B2S77_MAJOR 54 /* 54 = /dev/bmp085b2s77 (bmp085) */
#define BMP085B3S77_MAJOR 55 /* 55 = /dev/bmp085b3s77 (bmp085) */
/* 56-63 = /dev/vnd[0-7] (vnd) */
#define INPUT_MAJOR 64 /* 64 = /dev/input (input) */
#define USB_BASE_MAJOR 65 /* 65-133 = USB major range */
#define NR_DEVICES 134 /* number of (major) devices */
/* Minor device numbers for memory driver. */
# define RAM_DEV_OLD 0 /* minor device for /dev/ram */
# define MEM_DEV 1 /* minor device for /dev/mem */
# define KMEM_DEV 2 /* minor device for /dev/kmem */
# define NULL_DEV 3 /* minor device for /dev/null */
# define BOOT_DEV 4 /* minor device for /dev/boot */
# define ZERO_DEV 5 /* minor device for /dev/zero */
# define IMGRD_DEV 6 /* minor device for /dev/imgrd */
# define RAM_DEV_FIRST 7 /* first minor device for /dev/ram* */
#define CTRLR(n) ((n)==0 ? 3 : (8 + 2*((n)-1))) /* magic formula */
/* Minor device numbers for log driver. */
# define IS_KLOG_DEV 0 /* minor device for /dev/klog */
/* Full device numbers that are special to the boot monitor and FS. */
# define DEV_RAM ((dev_t) 0x0100) /* device number of /dev/ram */
# define DEV_IMGRD ((dev_t) 0x0106) /* device number of /dev/imgrd */
#endif /* _DMAP_H */

View File

@@ -1,43 +0,0 @@
#ifndef _MINIX_DRIVER_H
#define _MINIX_DRIVER_H
/* Types and constants shared between block and character drivers. */
#define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
#define _NETBSD_SOURCE 1 /* tell headers to include MINIX stuff */
#define _SYSTEM 1 /* get negative error number in <errno.h> */
/* The following are so basic, all the *.c files get them automatically. */
#include <minix/config.h> /* MUST be first */
#include <minix/type.h>
#include <minix/ipc.h>
#include <minix/com.h>
#include <minix/callnr.h>
#include <sys/types.h>
#include <minix/const.h>
#include <minix/syslib.h>
#include <minix/sysutil.h>
#include <minix/endpoint.h>
#include <string.h>
#include <limits.h>
#include <stddef.h>
#include <errno.h>
#include <sys/param.h>
#include <minix/u64.h>
#include <minix/partition.h>
/* Base and size of a partition in bytes. */
struct device {
u64_t dv_base;
u64_t dv_size;
};
/* Generic receive function for all drivers. */
#ifndef driver_receive
#define driver_receive sef_receive_status
#endif
/* Maximum supported number of concurrently opened minor devices. */
#define MAX_NR_OPEN_DEVICES 256
#endif /* _MINIX_DRIVER_H */

View File

@@ -1,43 +0,0 @@
/* This is the master header for all device drivers. It includes some other
* files and defines the principal constants.
*/
#ifndef _INC_DRIVERS_H
#define _INC_DRIVERS_H
#define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
#define _NETBSD_SOURCE 1 /* tell headers to include MINIX stuff */
#define _SYSTEM 1 /* get negative error number in <errno.h> */
/* The following are so basic, all the *.c files get them automatically. */
#include <minix/config.h> /* MUST be first */
#include <minix/bitmap.h>
#include <minix/callnr.h>
#include <minix/com.h>
#include <minix/const.h>
#include <minix/devio.h>
#include <minix/dmap.h>
#include <minix/spin.h>
#include <minix/syslib.h>
#include <minix/sysutil.h>
#include <minix/timers.h>
#include <minix/type.h>
#include <sys/param.h>
#include <sys/types.h>
#include <machine/interrupt.h> /* IRQ vectors and miscellaneous ports */
#if defined(__i386__)
#include <machine/bios.h> /* BIOS index numbers */
#include <machine/ports.h> /* Well-known ports */
#endif
#include <errno.h>
#include <lib.h>
#include <limits.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#endif

View File

@@ -1,18 +0,0 @@
/* IBM device driver definitions Author: Kees J. Bot
* 7 Dec 1995
*/
#include <machine/partition.h>
void partition(struct blockdriver *bdr, int device, int style, int
atapi);
#define DEV_PER_DRIVE (1 + NR_PARTITIONS)
#define SUB_PER_DRIVE (NR_PARTITIONS * NR_PARTITIONS)
#define MINOR_t0 64
#define MINOR_r0 120
#define MINOR_d0p0s0 128
#define MINOR_fd0p0 (28<<2)
#define P_FLOPPY 0
#define P_PRIMARY 1
#define P_SUB 2

View File

@@ -1,74 +0,0 @@
/* Prototypes and definitions for DS interface. */
#ifndef _MINIX_DS_H
#define _MINIX_DS_H
#ifdef _MINIX_SYSTEM
#include <sys/types.h>
#include <minix/endpoint.h>
/* Flags. */
#define DSF_IN_USE 0x001 /* entry is in use */
#define DSF_PRIV_RETRIEVE 0x002 /* only owner can retrieve */
#define DSF_PRIV_OVERWRITE 0x004 /* only owner can overwrite */
#define DSF_PRIV_SNAPSHOT 0x004 /* only owner can take a snapshot */
#define DSF_PRIV_SUBSCRIBE 0x008 /* only owner can subscribe */
#define DSF_TYPE_U32 0x010 /* u32 data type */
#define DSF_TYPE_STR 0x020 /* string data type */
#define DSF_TYPE_MEM 0x040 /* memory range data type */
#define DSF_TYPE_LABEL 0x100 /* label data type */
#define DSF_MASK_TYPE 0xFF0 /* mask for type flags. */
#define DSF_MASK_INTERNAL 0xFFF /* mask for internal flags. */
#define DSF_OVERWRITE 0x01000 /* overwrite if entry exists */
#define DSF_INITIAL 0x02000 /* check subscriptions immediately */
/* DS constants. */
#define DS_MAX_KEYLEN 80 /* Max length of a key, including '\0'. */
/* DS events. */
#define DS_DRIVER_UP 1
/* ds.c */
/* U32 */
int ds_publish_u32(const char *name, u32_t val, int flags);
int ds_retrieve_u32(const char *name, u32_t *val);
int ds_delete_u32(const char *ds_name);
/* STRING */
int ds_publish_str(const char *name, char *val, int flags);
int ds_retrieve_str(const char *name, char *val, size_t len);
int ds_delete_str(const char *ds_name);
/* MEM */
int ds_publish_mem(const char *ds_name, void *vaddr, size_t length, int
flags);
int ds_retrieve_mem(const char *ds_name, char *vaddr, size_t *length);
int ds_delete_mem(const char *ds_name);
/* MAP */
int ds_publish_map(const char *ds_name, void *vaddr, size_t length, int
flags);
int ds_snapshot_map(const char *ds_name, int *nr_snapshot);
int ds_retrieve_map(const char *ds_name, char *vaddr, size_t *length,
int nr_snapshot, int flags);
int ds_delete_map(const char *ds_name);
/* LABEL */
int ds_publish_label(const char *ds_name, endpoint_t endpoint, int
flags);
int ds_retrieve_label_name(char *ds_name, endpoint_t endpoint);
int ds_retrieve_label_endpt(const char *ds_name, endpoint_t *endpoint);
int ds_delete_label(const char *ds_name);
/* Subscribe and check. */
int ds_subscribe(const char *regex, int flags);
int ds_check(char *ds_name, int *type, endpoint_t *owner_e);
#endif /* _MINIX_SYSTEM */
#endif /* _MINIX_DS_H */

View File

@@ -1,75 +0,0 @@
#ifndef _MINIX_ENDPOINT_H
#define _MINIX_ENDPOINT_H 1
#ifdef _MINIX_SYSTEM
#include <minix/sys_config.h>
#include <minix/com.h>
#include <limits.h>
#include <minix/type.h>
/*
* Endpoints are split into two parts: a process slot and a generation number.
*
* The process slot number identifies the slot in various process tables.
* It is positive or zero for user processes, and negative for kernel tasks.
* Constants dictate that with the current endpoint layout, the maximum range
* of process slot numbers is [-MAX_NR_TASKS,MAX_NR_PROCS>. The used part of
* the range is currently [-NR_TASKS,NR_PROCS> -- these two constants may be
* changed within the maximum range without changing the endpoint layout.
*
* The generation number is a per-slot number that gets increased by one every
* time a slot is reused for a new process. The generation number minimizes
* the chance that the endpoint of a dead process can (accidentially) be used
* to communicate with a different, live process. Preventing such accidents
* is essential for proper system service restartability support.
*
* The split between the two parts of the endpoint is such that when the
* generation number is zero, the endpoint number equals the process slot
* number, even for negative task numbers. This is required for the endpoint
* numbers hardcoded in <minix/com.h>, and it makes endpoint numbers easy to
* read in general.
*
* There are three special endpoint numbers: ANY, NONE, and SELF. These
* numbers are used to identify "any process", "no process at all", and
* "own process", respectively. They fall outside the normal range of
* process slot numbers, and are always of generation zero.
*/
/*
* The following constant defines the split between the two parts of the
* endpoint numbers. It can be adjusted to allow for either more processes
* or more per-process generation numbers. Changing it will change the
* endpoint number layout, and thus break binary compatibility with existing
* processes.
*/
#define _ENDPOINT_GENERATION_SHIFT 15
/* Derived constants. */
#define _ENDPOINT_GENERATION_SIZE (1 << _ENDPOINT_GENERATION_SHIFT)
/* INT_MAX is used here to prevent signedness issues with the macros below. */
#define _ENDPOINT_MAX_GENERATION (INT_MAX/_ENDPOINT_GENERATION_SIZE-1)
#define _ENDPOINT_SLOT_TOP (_ENDPOINT_GENERATION_SIZE-MAX_NR_TASKS)
/* The special endpoint numbers, and the resulting maximum slot number. */
#define ANY ((endpoint_t) (_ENDPOINT_SLOT_TOP - 1))
#define NONE ((endpoint_t) (_ENDPOINT_SLOT_TOP - 2))
#define SELF ((endpoint_t) (_ENDPOINT_SLOT_TOP - 3))
#define MAX_NR_PROCS (_ENDPOINT_SLOT_TOP - 3) /* (int)SELF */
/* Sanity check. */
#if NR_PROCS > MAX_NR_PROCS
#error "NR_PROCS exceeds MAX_NR_PROCS, increase _ENDPOINT_GENERATION_SHIFT"
#endif
/* Generation + Process slot number <-> endpoint. */
#define _ENDPOINT(g, p) \
((endpoint_t)(((g) << _ENDPOINT_GENERATION_SHIFT) + (p)))
#define _ENDPOINT_G(e) (((e)+MAX_NR_TASKS) >> _ENDPOINT_GENERATION_SHIFT)
#define _ENDPOINT_P(e) \
((((e)+MAX_NR_TASKS) & (_ENDPOINT_GENERATION_SIZE - 1)) - MAX_NR_TASKS)
#endif /* _MINIX_SYSTEM */
#endif

View File

@@ -1,38 +0,0 @@
#ifndef __MINIX_FB_H_
#define __MINIX_FB_H_
#include <minix/type.h>
struct fb_fix_screeninfo {
char id[16]; /* Identification string */
u16_t xpanstep;
u16_t ypanstep;
u16_t ywrapstep;
u32_t line_length;
phys_bytes mmio_start;
size_t mmio_len;
u16_t reserved[15];
};
struct fb_bitfield {
u32_t offset;
u32_t length;
u32_t msb_right;
};
struct fb_var_screeninfo {
u32_t xres; /* visible resolution */
u32_t yres;
u32_t xres_virtual; /* virtual resolution */
u32_t yres_virtual;
u32_t xoffset; /* offset from virtual to visible */
u32_t yoffset;
u32_t bits_per_pixel;
struct fb_bitfield red; /* bitfield in fb mem if true color */
struct fb_bitfield green;
struct fb_bitfield blue;
struct fb_bitfield transp; /* transparency */
u16_t reserved[10];
};
#endif /* __MINIX_FB_H_ */

View File

@@ -1,6 +0,0 @@
/* V1 and V2 file system disk to/from memory support functions. */
int bitmapsize(bit_t _nr_bits, int block_size);
unsigned conv2(int _norm, int _w);
long conv4(int _norm, long _x);
void new_icopy(struct inode *_rip, d2_inode *_dip, int _direction, int _norm);

View File

@@ -1,25 +0,0 @@
#include <sys/types.h>
#include <lib.h>
#include <stdlib.h>
#include <minix/syslib.h>
/* opcodes for use in gcov buffer */
#define GCOVOP_OPEN 23
#define GCOVOP_WRITE 24
#define GCOVOP_CLOSE 25
#define GCOVOP_END 26
/* More information on the GCOV Minix Wiki page. */
int gcov_flush_svr(char *buff, int buff_sz, int server_nr);
extern void __gcov_flush (void);
int do_gcov_flush_impl(message *msg);
FILE *_gcov_fopen(char *name, char *mode);
size_t _gcov_fread(void *ptr, size_t itemsize, size_t nitems,
FILE *stream);
size_t _gcov_fwrite(void *ptr, size_t itemsize, size_t nitems,
FILE *stream);
int _gcov_fclose(FILE *stream);
int _gcov_fseek(FILE *stream, long offset, int ptrname);
char *_gcov_getenv(const char *name);

View File

@@ -1,34 +0,0 @@
#ifndef __INCLUDE_GPIO_H__
#define __INCLUDE_GPIO_H__
struct gpio
{
int nr; /* GPIO number */
int mode; /* GPIO mode (input=0/output=1) */
};
#define GPIO_MODE_INPUT 0
#define GPIO_MODE_OUTPUT 1
int gpio_init(void);
/* request access to a gpio */
int gpio_claim(char *owner, int nr, struct gpio **gpio);
/* Configure the GPIO for a certain purpose */
int gpio_pin_mode(struct gpio *gpio, int mode);
/* Set the value for a GPIO */
int gpio_set(struct gpio *gpio, int value);
/* Read the current value of the GPIO */
int gpio_read(struct gpio *gpio, int *value);
/* Read and clear the value interrupt value of the GPIO */
int gpio_intr_read(struct gpio *gpio, int *value);
/* Interrupt hook */
int gpio_intr_message(message * m);
int gpio_release(void);
#endif /* __INCLUDE_GPIO_H__ */

View File

@@ -1,49 +0,0 @@
#ifndef _MINIX_HASH_H
#define _MINIX_HASH_H 1
#include <stdint.h>
/* This code is taken from:
* lookup3.c, by Bob Jenkins, May 2006, Public Domain.
* (macro names modified)
*/
#define hash_rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
#define hash_mix(a,b,c) \
{ \
a -= c; a ^= hash_rot(c, 4); c += b; \
b -= a; b ^= hash_rot(a, 6); a += c; \
c -= b; c ^= hash_rot(b, 8); b += a; \
a -= c; a ^= hash_rot(c,16); c += b; \
b -= a; b ^= hash_rot(a,19); a += c; \
c -= b; c ^= hash_rot(b, 4); b += a; \
}
#define hash_final(a,b,c) \
{ \
c ^= b; c -= hash_rot(b,14); \
a ^= c; a -= hash_rot(c,11); \
b ^= a; b -= hash_rot(a,25); \
c ^= b; c -= hash_rot(b,16); \
a ^= c; a -= hash_rot(c,4); \
b ^= a; b -= hash_rot(a,14); \
c ^= b; c -= hash_rot(b,24); \
}
#define hash_i_64(a, u, v) { \
u32_t i1 = (a), i2 = ex64lo(u), i3 = ex64hi(u); \
hash_mix(i1, i2, i3); \
hash_final(i1, i2, i3); \
(v) = i3; \
}
#define hash_32(n, v) { \
u32_t i1 = 0xa5a5a5a5, i2 = 0x12345678, i3 = n; \
hash_mix(i1, i2, i3); \
hash_final(i1, i2, i3); \
(v) = i3; \
}
#endif

View File

@@ -1,11 +0,0 @@
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
#ifndef _MINIX_HGFS_H
#define _MINIX_HGFS_H
#include <minix/sffs.h>
int hgfs_init(const struct sffs_table **tablep);
void hgfs_cleanup(void);
#endif /* _MINIX_HGFS_H */

View File

@@ -1,27 +0,0 @@
#ifndef __MINIX_I2C_H
#define __MINIX_I2C_H
/*
* Minix I2C /dev Interface.
*
* Same as NetBSD/OpenBSD interface but with a flat struct (i.e. no pointers).
* The NetBSD/OpenBSD interface can still be used on i2c device files. The
* ioctl(2) function will translate to/from the Minix version of the struct.
*/
#include <sys/types.h>
#include <dev/i2c/i2c_io.h>
#include <minix/ioctl.h>
typedef struct minix_i2c_ioctl_exec {
i2c_op_t iie_op; /* operation to perform */
i2c_addr_t iie_addr; /* address of device */
uint8_t iie_cmd[I2C_EXEC_MAX_CMDLEN]; /* pointer to command */
size_t iie_cmdlen; /* length of command */
uint8_t iie_buf[I2C_EXEC_MAX_BUFLEN]; /* pointer to data buffer */
size_t iie_buflen; /* length of data buffer */
} minix_i2c_ioctl_exec_t;
#define MINIX_I2C_IOCTL_EXEC _IOWR('I', 1, minix_i2c_ioctl_exec_t)
#endif /* __MINIX_I2C_H */

View File

@@ -1,32 +0,0 @@
/* Prototypes and definitions for i2c drivers. */
#ifndef _MINIX_I2CDRIVER_H
#define _MINIX_I2CDRIVER_H
#include <minix/endpoint.h>
#include <minix/i2c.h>
#include <minix/ipc.h>
/* Functions defined by i2cdriver.c: */
int i2cdriver_env_parse(uint32_t * bus, i2c_addr_t * address,
i2c_addr_t * valid_addrs);
void i2cdriver_announce(uint32_t bus);
endpoint_t i2cdriver_bus_endpoint(uint32_t bus);
int i2cdriver_subscribe_bus_updates(uint32_t bus);
void i2cdriver_handle_bus_update(endpoint_t * bus_endpoint, uint32_t bus,
i2c_addr_t address);
int i2cdriver_reserve_device(endpoint_t bus_endpoint, i2c_addr_t address);
int i2cdriver_exec(endpoint_t bus_endpoint, minix_i2c_ioctl_exec_t *ioctl_exec);
int i2creg_raw_read8(endpoint_t bus, i2c_addr_t addr, uint8_t * val);
int i2creg_read8(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint8_t * val);
int i2creg_read16(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint16_t * val);
int i2creg_read24(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint32_t * val);
int i2creg_raw_write8(endpoint_t bus, i2c_addr_t addr, uint8_t val);
int i2creg_write8(endpoint_t bus, i2c_addr_t addr, uint8_t reg, uint8_t val);
int i2creg_set_bits8(endpoint_t bus, i2c_addr_t addr, uint8_t reg,
uint8_t bits);
int i2creg_clear_bits8(endpoint_t bus, i2c_addr_t addr, uint8_t reg,
uint8_t bits);
#endif /* _MINIX_I2CDRIVER_H */

Some files were not shown because too many files have changed in this diff Show More