diff options
Diffstat (limited to 'include')
104 files changed, 2792 insertions, 570 deletions
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h index 4059862d4b3d..999e85fff3ad 100644 --- a/include/asm-alpha/mmzone.h +++ b/include/asm-alpha/mmzone.h @@ -107,15 +107,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) #ifdef CONFIG_NUMA_SCHED #define NODE_SCHEDULE_DATA(nid) (&((PLAT_NODE_DATA(nid))->schedule_data)) #endif - -#ifdef CONFIG_ALPHA_WILDFIRE -/* With wildfire assume 4 CPUs per node */ -#define cputonode(cpu) ((cpu) >> 2) -#else -#define cputonode(cpu) 0 -#endif /* CONFIG_ALPHA_WILDFIRE */ - -#define numa_node_id() cputonode(smp_processor_id()) #endif /* CONFIG_NUMA */ #endif /* CONFIG_DISCONTIGMEM */ diff --git a/include/asm-alpha/topology.h b/include/asm-alpha/topology.h new file mode 100644 index 000000000000..f3c6cd7ae491 --- /dev/null +++ b/include/asm-alpha/topology.h @@ -0,0 +1,20 @@ +#ifndef _ASM_ALPHA_TOPOLOGY_H +#define _ASM_ALPHA_TOPOLOGY_H + +#ifdef CONFIG_NUMA +#ifdef CONFIG_ALPHA_WILDFIRE +/* With wildfire assume 4 CPUs per node */ +#define __cpu_to_node(cpu) ((cpu) >> 2) +#endif /* CONFIG_ALPHA_WILDFIRE */ +#endif /* CONFIG_NUMA */ + +#if !defined(CONFIG_NUMA) || !defined(CONFIG_ALPHA_WILDFIRE) +#define __cpu_to_node(cpu) (0) +#define __memblk_to_node(memblk) (0) +#define __parent_node(nid) (0) +#define __node_to_first_cpu(node) (0) +#define __node_to_cpu_mask(node) (cpu_online_map) +#define __node_to_memblk(node) (0) +#endif /* !CONFIG_NUMA || !CONFIG_ALPHA_WILDFIRE */ + +#endif /* _ASM_ALPHA_TOPOLOGY_H */ diff --git a/include/asm-arm/arch-adifcc/memory.h b/include/asm-arm/arch-adifcc/memory.h index bb0307809a40..5178f33b2bdf 100644 --- a/include/asm-arm/arch-adifcc/memory.h +++ b/include/asm-arm/arch-adifcc/memory.h @@ -52,6 +52,4 @@ #define __virt_to_bus(x) __virt_to_phys(x) #define __bus_to_virt(x) __phys_to_virt(x) -#define PHYS_TO_NID(x) 0 - #endif diff --git a/include/asm-arm/arch-anakin/keyboard.h b/include/asm-arm/arch-anakin/keyboard.h deleted file mode 100644 index 91494dc71f31..000000000000 --- a/include/asm-arm/arch-anakin/keyboard.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * linux/include/asm-arm/arch-anakin/keyboard.h - * - * Copyright (C) 2001 Aleph One Ltd. for Acunia N.V. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Changelog: - * 11-Apr-2001 TTC Created - */ -#define kbd_init_hw() do { } while (0) -#define kbd_enable_irq() do { } while (0) -#define kbd_disable_irq() do { } while (0) diff --git a/include/asm-arm/arch-anakin/memory.h b/include/asm-arm/arch-anakin/memory.h index 67bc64f31fd0..b58762157b63 100644 --- a/include/asm-arm/arch-anakin/memory.h +++ b/include/asm-arm/arch-anakin/memory.h @@ -31,6 +31,4 @@ #define __virt_to_bus__is_a_macro #define __bus_to_virt__is_a_macro -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-arc/memory.h b/include/asm-arm/arch-arc/memory.h index 9dd2d4edc2d4..3c21224b5464 100644 --- a/include/asm-arm/arch-arc/memory.h +++ b/include/asm-arm/arch-arc/memory.h @@ -50,6 +50,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) (x) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-cl7500/memory.h b/include/asm-arm/arch-cl7500/memory.h index 908d02501faf..56e1d3bfcb62 100644 --- a/include/asm-arm/arch-cl7500/memory.h +++ b/include/asm-arm/arch-cl7500/memory.h @@ -46,6 +46,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) __phys_to_virt(x) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-clps711x/hardware.h b/include/asm-arm/arch-clps711x/hardware.h index 3140431421ec..1386871e1a5a 100644 --- a/include/asm-arm/arch-clps711x/hardware.h +++ b/include/asm-arm/arch-clps711x/hardware.h @@ -65,7 +65,6 @@ #define EP7212_BASE CLPS7111_VIRT_BASE #include <asm/hardware/ep7212.h> - #endif #define SYSPLD_VIRT_BASE 0xfe000000 @@ -175,5 +174,65 @@ #define EDB_PD3_LCDBL (1<<3) -#endif +#if defined (CONFIG_ARCH_CEIVA) + +#define CEIVA_VIRT_BASE CLPS7111_VIRT_BASE +#define CEIVA_BASE CLPS7111_VIRT_BASE + +#include <asm/hardware/clps7111.h> +#include <asm/hardware/ep7212.h> + + +/* + * The two flash banks are wired to chip selects 0 and 1. This is the mapping + * for them. + * + * nCS0 and nCS1 are at 0x70000000 and 0x60000000, respectively, when running + * in jumpered boot mode. + */ +#define CEIVA_PHYS_FLASH1 CS0_PHYS_BASE /* physical */ +#define CEIVA_PHYS_FLASH2 CS1_PHYS_BASE /* physical */ + +#define CEIVA_VIRT_FLASH1 (0xfa000000) /* virtual */ +#define CEIVA_VIRT_FLASH2 (0xfb000000) /* virtual */ + +#define CEIVA_FLASH_SIZE 0x100000 +#define CEIVA_FLASH_WIDTH 2 + +#define SRAM_START 0x60000000 +#define SRAM_SIZE 0xc000 +#define SRAM_WIDTH 4 + +#define BOOTROM_START 0x70000000 +#define BOOTROM_SIZE 0x80 +#define BOOTROM_WIDTH 4 +/* + * SED1355 LCD controller + */ +#define CEIVA_PHYS_SED1355 CS2_PHYS_BASE +#define CEIVA_VIRT_SED1355 (0xfc000000) + +/* + * Relevant bits in port D, which controls power to the various parts of + * the LCD on the Ceiva Photo Max, and reset to the LCD controller. + */ + +// Reset line to SED1355 (must be high to operate) +#define CEIVA_PD1_LCDRST (1<<1) +// LCD panel enable (set to one, to enable LCD) +#define CEIVA_PD4_LCDEN (1<<4) +// Backlight (set to one, to turn on backlight +#define CEIVA_PD5_LCDBL (1<<5) + +/* + * Relevant bits in port B, which report the status of the buttons. + */ + +// White button +#define CEIVA_PB4_WHT_BTN (1<<4) +// Black button +#define CEIVA_PB0_BLK_BTN (1<<0) +#endif // #if defined (CONFIG_ARCH_CEIVA) + +#endif diff --git a/include/asm-arm/arch-clps711x/memory.h b/include/asm-arm/arch-clps711x/memory.h index e40d08e180f6..52b38ebea23b 100644 --- a/include/asm-arm/arch-clps711x/memory.h +++ b/include/asm-arm/arch-clps711x/memory.h @@ -90,8 +90,6 @@ * memory bank. For those systems, simply undefine CONFIG_DISCONTIGMEM. */ -#ifdef CONFIG_ARCH_EDB7211 - #ifdef CONFIG_DISCONTIGMEM /* * Because of the wide memory address space between physical RAM banks on the @@ -155,11 +153,5 @@ #endif /* CONFIG_DISCONTIGMEM */ -#endif /* CONFIG_ARCH_EDB7211 */ - -#ifndef PFN_TO_NID -#define PFN_TO_NID(pfn) (0) -#endif - #endif diff --git a/include/asm-arm/arch-ebsa110/memory.h b/include/asm-arm/arch-ebsa110/memory.h index 937006c01dbd..b8f8e211dac2 100644 --- a/include/asm-arm/arch-ebsa110/memory.h +++ b/include/asm-arm/arch-ebsa110/memory.h @@ -48,6 +48,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) (x) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-ebsa285/keyboard.h b/include/asm-arm/arch-ebsa285/keyboard.h deleted file mode 100644 index f47b43fe800c..000000000000 --- a/include/asm-arm/arch-ebsa285/keyboard.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa285/keyboard.h - * - * Keyboard driver definitions for EBSA285 architecture - * - * Copyright (C) 1998-2001 Russell King - * (C) 1998 Phil Blundell - */ -#define kbd_init_hw() do { } while (0) diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h index 0ab74c5bbc62..41e730ceaf0e 100644 --- a/include/asm-arm/arch-ebsa285/memory.h +++ b/include/asm-arm/arch-ebsa285/memory.h @@ -80,6 +80,4 @@ extern unsigned long __bus_to_virt(unsigned long); #define __phys_to_virt__is_a_macro #define __phys_to_virt(ppage) ((unsigned long)(ppage) + PAGE_OFFSET) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-epxa10db/memory.h b/include/asm-arm/arch-epxa10db/memory.h index 0ccec30b1927..132eab6ad9d0 100644 --- a/include/asm-arm/arch-epxa10db/memory.h +++ b/include/asm-arm/arch-epxa10db/memory.h @@ -38,8 +38,6 @@ #define PAGE_OFFSET (0xc0000000UL) #define PHYS_OFFSET (0x00000000UL) -#define PHYS_TO_NID(addr) (0) - /* * On epxa10, the dram is contiguous */ diff --git a/include/asm-arm/arch-integrator/keyboard.h b/include/asm-arm/arch-integrator/keyboard.h deleted file mode 100644 index 2ca4754586a9..000000000000 --- a/include/asm-arm/arch-integrator/keyboard.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * linux/include/asm-arm/arch-integrator/keyboard.h - * - * Copyright (C) 2000-2001 Deep Blue Solutions Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Keyboard driver definitions for the Integrator architecture - * Now using the input subsystem... - */ -#define kbd_init_hw() do { } while (0) diff --git a/include/asm-arm/arch-integrator/memory.h b/include/asm-arm/arch-integrator/memory.h index ca1ba7cd3cde..45605011117c 100644 --- a/include/asm-arm/arch-integrator/memory.h +++ b/include/asm-arm/arch-integrator/memory.h @@ -58,6 +58,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) (x - INTEGRATOR_HDR0_SDRAM_BASE + PAGE_OFFSET) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-iop310/memory.h b/include/asm-arm/arch-iop310/memory.h index c1b47276d41a..e413a04823a9 100644 --- a/include/asm-arm/arch-iop310/memory.h +++ b/include/asm-arm/arch-iop310/memory.h @@ -49,8 +49,6 @@ #define __virt_to_bus(x) (((__virt_to_phys(x)) & ~(*IOP310_SIATVR)) | ((*IOP310_SIABAR) & 0xfffffff0)) #define __bus_to_virt(x) (__phys_to_virt(((x) & ~(*IOP310_SIALR)) | ( *IOP310_SIATVR))) -#define PHYS_TO_NID(x) 0 - /* boot mem allocate global pointer for MU circular queues QBAR */ #ifdef CONFIG_IOP310_MU extern void *mu_mem; diff --git a/include/asm-arm/arch-l7200/memory.h b/include/asm-arm/arch-l7200/memory.h index 609416d245b1..a34a0f9a41bb 100644 --- a/include/asm-arm/arch-l7200/memory.h +++ b/include/asm-arm/arch-l7200/memory.h @@ -47,6 +47,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) __phys_to_virt(x) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-nexuspci/keyboard.h b/include/asm-arm/arch-nexuspci/keyboard.h deleted file mode 100644 index 341099baa05c..000000000000 --- a/include/asm-arm/arch-nexuspci/keyboard.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * linux/include/asm-arm/arch-nexuspci/keyboard.h - * - * Driver definitions for PCI card dummy keyboard. - * - * Copyright (C) 1998-2001 Russell King - * Copyright (C) 1998 Philip Blundell - */ - -#define NR_SCANCODES 128 - -#define kbd_init_hw() do { } while (0) -#define kbd_disable_irq() do { } while (0) -#define kbd_enable_irq() do { } while (0) diff --git a/include/asm-arm/arch-nexuspci/memory.h b/include/asm-arm/arch-nexuspci/memory.h index 25d23ca08be0..a7e644257805 100644 --- a/include/asm-arm/arch-nexuspci/memory.h +++ b/include/asm-arm/arch-nexuspci/memory.h @@ -43,6 +43,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) ((unsigned long)(x) + PAGE_OFFSET - BUS_OFFSET) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-pxa/idp.h b/include/asm-arm/arch-pxa/idp.h index 4fbcc3b9b84c..63932060242e 100644 --- a/include/asm-arm/arch-pxa/idp.h +++ b/include/asm-arm/arch-pxa/idp.h @@ -19,9 +19,10 @@ /* comment out following if you have a rev01 board */ #define PXA_IDP_REV02 1 -//#undef PXA_IDP_REV02 #ifdef PXA_IDP_REV02 +//Use this as well for 0017-x004 and greater pcb's: +#define PXA_IDP_REV04 1 #define IDP_FLASH_PHYS (PXA_CS0_PHYS) #define IDP_ALT_FLASH_PHYS (PXA_CS1_PHYS) @@ -38,6 +39,7 @@ #define IDP_IDE_BASE (0xf0000000) #define IDP_IDE_SIZE (1*1024*1024) +#define IDE_REG_STRIDE 4 #define IDP_ETH_BASE (IDP_IDE_BASE + IDP_IDE_SIZE) #define IDP_ETH_SIZE (1*1024*1024) @@ -111,6 +113,33 @@ * Bit masks for various registers */ +// IDP_CPLD_PCCARD_PWR +#define PCC0_PWR0 (1 << 0) +#define PCC0_PWR1 (1 << 1) +#define PCC0_PWR2 (1 << 2) +#define PCC0_PWR3 (1 << 3) +#define PCC1_PWR0 (1 << 4) +#define PCC1_PWR1 (1 << 5) +#define PCC1_PWR2 (1 << 6) +#define PCC1_PWR3 (1 << 7) + +// IDP_CPLD_PCCARD_EN +#define PCC0_RESET (1 << 6) +#define PCC1_RESET (1 << 7) +#define PCC0_ENABLE (1 << 0) +#define PCC1_ENABLE (1 << 1) + +// IDP_CPLD_PCCARDx_STATUS +#define _PCC_WRPROT (1 << 7) // 7-4 read as low true +#define _PCC_RESET (1 << 6) +#define _PCC_IRQ (1 << 5) +#define _PCC_INPACK (1 << 4) +#define PCC_BVD2 (1 << 3) +#define PCC_BVD1 (1 << 2) +#define PCC_VS2 (1 << 1) +#define PCC_VS1 (1 << 0) + +#define PCC_DETECT(x) (GPLR(7 + (x)) & GPIO_bit(7 + (x))) /* * Macros for LCD Driver @@ -129,6 +158,32 @@ #endif +/* A listing of interrupts used by external hardware devices */ + +#ifdef PXA_IDP_REV04 +#define TOUCH_PANEL_IRQ IRQ_GPIO(5) +#define IDE_IRQ IRQ_GPIO(21) +#else +#define TOUCH_PANEL_IRQ IRQ_GPIO(21) +#define IDE_IRQ IRQ_GPIO(5) +#endif + +#define TOUCH_PANEL_IRQ_EDGE IRQT_FALLING + +#define ETHERNET_IRQ IRQ_GPIO(4) +#define ETHERNET_IRQ_EDGE IRQT_RISING + +#define IDE_IRQ_EDGE IRQT_RISING + +#define PCMCIA_S0_CD_VALID IRQ_GPIO(7) +#define PCMCIA_S0_CD_VALID_EDGE IRQT_BOTHEDGE + +#define PCMCIA_S1_CD_VALID IRQ_GPIO(8) +#define PCMCIA_S1_CD_VALID_EDGE IRQT_BOTHEDGE + +#define PCMCIA_S0_RDYINT IRQ_GPIO(19) +#define PCMCIA_S1_RDYINT IRQ_GPIO(22) + /* * Macros for LED Driver @@ -173,14 +228,6 @@ inputs = (IDP_CPLD_KB_ROW & 0x7f);\ } -/* A listing of interrupts used by external hardware devices */ - -#define TOUCH_PANEL_IRQ IRQ_GPIO(21) -#define TOUCH_PANEL_IRQ_EGDE GPIO_FALLING_EDGE - -#define ETHERNET_IRQ IRQ_GPIO(4) -#define ETHERNET_IRQ_EDGE GPIO_RISING_EDGE - #else /* @@ -286,7 +333,7 @@ extern unsigned int idp_control_port_shadow; #define WRITE_IDP_CPLD_LED_CONTROL(value, mask) \ {\ - idp_cpld_led_control_shadow = ((value & mask) | (idp_cpld_led_control_shadow & ~mask));\ + idp_cpld_led_control_shadow = (((value & mask) | (idp_cpld_led_control_shadow & ~mask)));\ IDP_CPLD_LED_CONTROL = idp_cpld_led_control_shadow;\ } #define WRITE_IDP_CPLD_PERIPH_PWR(value, mask) \ @@ -346,10 +393,10 @@ extern unsigned int idp_control_port_shadow; /* A listing of interrupts used by external hardware devices */ #define TOUCH_PANEL_IRQ IRQ_GPIO(21) -#define TOUCH_PANEL_IRQ_EGDE GPIO_FALLING_EDGE +#define TOUCH_PANEL_IRQ_EGDE IRQT_FALLING #define ETHERNET_IRQ IRQ_GPIO(4) -#define ETHERNET_IRQ_EDGE GPIO_RISING_EDGE +#define ETHERNET_IRQ_EDGE IRQT_RISING /* * Bit masks for various registers diff --git a/include/asm-arm/arch-pxa/memory.h b/include/asm-arm/arch-pxa/memory.h index b137f480bab6..24e133caf425 100644 --- a/include/asm-arm/arch-pxa/memory.h +++ b/include/asm-arm/arch-pxa/memory.h @@ -34,7 +34,6 @@ * Physical DRAM offset. */ #define PHYS_OFFSET (0xa0000000UL) -#define PHYS_TO_NID(addr) (0) /* * physical vs virtual ram conversion diff --git a/include/asm-arm/arch-rpc/keyboard.h b/include/asm-arm/arch-rpc/keyboard.h deleted file mode 100644 index db187f96b1cc..000000000000 --- a/include/asm-arm/arch-rpc/keyboard.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * linux/include/asm-arm/arch-rpc/keyboard.h - * - * Copyright (C) 1998-2001 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Keyboard driver definitions for RiscPC architecture - * Now using the input subsystem... - */ -#define kbd_init_hw() do { } while (0) diff --git a/include/asm-arm/arch-rpc/memory.h b/include/asm-arm/arch-rpc/memory.h index 596effd86371..cf562f87f7b5 100644 --- a/include/asm-arm/arch-rpc/memory.h +++ b/include/asm-arm/arch-rpc/memory.h @@ -50,6 +50,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) __phys_to_virt(x) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-shark/memory.h b/include/asm-arm/arch-shark/memory.h index ff020ca2ea44..39f167176011 100644 --- a/include/asm-arm/arch-shark/memory.h +++ b/include/asm-arm/arch-shark/memory.h @@ -40,6 +40,4 @@ #define isa_virt_to_bus virt_to_bus -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-tbox/keyboard.h b/include/asm-arm/arch-tbox/keyboard.h deleted file mode 100644 index 38ff63daf621..000000000000 --- a/include/asm-arm/arch-tbox/keyboard.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * linux/include/asm-arm/arch-tbox/keyboard.h - * - * Driver definitions for Tbox dummy keyboard. - * - * Copyright (C) 1998-2001 Russell King - * Copyright (C) 1998 Philip Blundell - */ - -#define NR_SCANCODES 128 - -#define kbd_init_hw() do { } while (0) -#define kbd_disable_irq() do { } while (0) -#define kbd_enable_irq() do { } while (0) diff --git a/include/asm-arm/arch-tbox/memory.h b/include/asm-arm/arch-tbox/memory.h index ed9cfa109996..e93d0afb176f 100644 --- a/include/asm-arm/arch-tbox/memory.h +++ b/include/asm-arm/arch-tbox/memory.h @@ -41,6 +41,4 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) __phys_to_virt(x) -#define PHYS_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index 2c03e9924c4d..7ebef35ec653 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h @@ -53,7 +53,6 @@ typedef struct { void *null; } elf_fpregset_t; /* This yields a mask that user programs can use to figure out what instruction set this cpu supports. */ -extern unsigned int elf_hwcap; #define ELF_HWCAP (elf_hwcap) /* This yields a string that ld.so will use to load implementation diff --git a/include/asm-arm/hardware/sa1111.h b/include/asm-arm/hardware/sa1111.h index f00889d5976c..c334e869f8ef 100644 --- a/include/asm-arm/hardware/sa1111.h +++ b/include/asm-arm/hardware/sa1111.h @@ -611,10 +611,13 @@ struct sa1111_device { extern struct sa1111_device *sa1111; +int sa1111_check_dma_bug(dma_addr_t addr); + /* * These frob the SKPCR register. */ void sa1111_enable_device(unsigned int mask); void sa1111_disable_device(unsigned int mask); + #endif /* _ASM_ARCH_SA1111 */ diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h index 741b223b06f0..3b9c4c18c6af 100644 --- a/include/asm-arm/ide.h +++ b/include/asm-arm/ide.h @@ -26,6 +26,20 @@ #define ide_default_io_base(i) ((ide_ioreg_t)0) #define ide_default_irq(b) (0) +#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) +#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) +#define ide_check_region(from,extent) check_region((from), (extent)) +#define ide_request_region(from,extent,name) request_region((from), (extent), (name)) +#define ide_release_region(from,extent) release_region((from), (extent)) + +/* + * The following are not needed for the non-m68k ports + */ +#define ide_ack_intr(hwif) (1) +#define ide_fix_driveid(id) do {} while (0) +#define ide_release_lock(lock) do {} while (0) +#define ide_get_lock(lock, hdlr, data) do {} while (0) + #endif /* __KERNEL__ */ #endif /* __ASMARM_IDE_H */ diff --git a/include/asm-arm/kmap_types.h b/include/asm-arm/kmap_types.h new file mode 100644 index 000000000000..9ed6c333df58 --- /dev/null +++ b/include/asm-arm/kmap_types.h @@ -0,0 +1,12 @@ +#ifndef __ARM_KMAP_TYPES_H +#define __ARM_KMAP_TYPES_H + +/* + * This is the "bare minimum". AIO seems to require this. + */ +enum km_type { + KM_IRQ0, + KM_USER1 +}; + +#endif diff --git a/include/asm-arm/mach/amba_kmi.h b/include/asm-arm/mach/amba_kmi.h deleted file mode 100644 index b2ec51e8e45c..000000000000 --- a/include/asm-arm/mach/amba_kmi.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * linux/include/asm-arm/mach/amba_kmi.h - * - * Copyright (C) 2000 Deep Blue Solutions Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -struct kmi_info { - u_int base; - u_int irq; - u_char divisor; - u_char type; - u_char state; - u_char prev_rx; - u_char last_tx; - u_char resend_count; - u_short res; - u_char present; - wait_queue_head_t wait_q; - void (*rx)(struct kmi_info *, u_int val, - struct pt_regs *regs); - char name[8]; -}; - -#define KMI_KEYBOARD 0 -#define KMI_MOUSE 1 - -int register_kmi(struct kmi_info *kmi); diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h index b46474f46b74..c936883e5f0e 100644 --- a/include/asm-arm/memory.h +++ b/include/asm-arm/memory.h @@ -74,6 +74,8 @@ static inline void *phys_to_virt(unsigned long x) #define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)) #define virt_addr_valid(kaddr) ((kaddr) >= PAGE_OFFSET && (kaddr) < (unsigned long)high_memory) +#define PHYS_TO_NID(addr) (0) + #else /* * This is more complex. We have a set of mem_map arrays spread diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h index 61c44296cb9f..bb96efd98d00 100644 --- a/include/asm-arm/mmu_context.h +++ b/include/asm-arm/mmu_context.h @@ -34,13 +34,17 @@ enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu) /* * This is the actual mm switch as far as the scheduler - * is concerned. No registers are touched. + * is concerned. No registers are touched. We avoid + * calling the CPU specific function when the mm hasn't + * actually changed. */ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned int cpu) { - cpu_switch_mm(next->pgd, next); + if (prev != next) { + cpu_switch_mm(next->pgd, next); + } } static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h index c09fdafefc1d..70fcb5c4d021 100644 --- a/include/asm-arm/pci.h +++ b/include/asm-arm/pci.h @@ -12,6 +12,34 @@ struct pci_dev; +/* + * For SA-1111 these functions are "magic" and utilize bounce + * buffers as need to workaround SA-1111 DMA bugs. They are called in + * place of their pci_* counterparts when dev_is_sa1111() returns true. + */ +dma_addr_t sa1111_map_single(struct pci_dev *, void *, size_t, int); +void sa1111_unmap_single(struct pci_dev *, dma_addr_t, size_t, int); +int sa1111_map_sg(struct pci_dev *, struct scatterlist *, int, int); +void sa1111_unmap_sg(struct pci_dev *, struct scatterlist *, int, int); +void sa1111_dma_sync_single(struct pci_dev *, dma_addr_t, size_t, int); +void sa1111_dma_sync_sg(struct pci_dev *, struct scatterlist *, int, int); + +#ifdef CONFIG_SA1111 + +#define SA1111_FAKE_PCIDEV ((struct pci_dev *) 1111) + +static inline int dev_is_sa1111(const struct pci_dev *dev) +{ + return (dev == SA1111_FAKE_PCIDEV); +} + +#else + +static inline int dev_is_sa1111(const struct pci_dev *dev) { return 0; } + +#endif + + static inline void pcibios_set_master(struct pci_dev *dev) { /* No special bus mastering setup handling */ @@ -61,17 +89,9 @@ pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) { -#ifdef CONFIG_SA1111 - extern dma_addr_t sa1111_map_single(struct pci_dev *, void *, size_t, int); - - /* - * for SA1111 these functions are "magic" and relocate buffers. We - * only need to do these if hwdev is non-null; otherwise we expect - * the buffer to already be suitable for DMA. - */ - if (hwdev != NULL) + if (dev_is_sa1111(hwdev)) return sa1111_map_single(hwdev, ptr, size, direction); -#endif + consistent_sync(ptr, size, direction); return virt_to_bus(ptr); } @@ -86,12 +106,9 @@ pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction) { -#ifdef CONFIG_SA1111 - extern void sa1111_unmap_single(struct pci_dev *, dma_addr_t, size_t, int); - - if (hwdev != NULL) + if (dev_is_sa1111(hwdev)) sa1111_unmap_single(hwdev, dma_addr, size, direction); -#endif + /* nothing to do */ } @@ -99,7 +116,7 @@ pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int di * Whether pci_unmap_{single,page} is a nop depends upon the * configuration. */ -#ifdef CONFIG_PCI +#if defined(CONFIG_PCI) || defined(CONFIG_SA1111) #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME; #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME; #define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) @@ -135,6 +152,9 @@ pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int directi { int i; + if (dev_is_sa1111(hwdev)) + return sa1111_map_sg(hwdev, sg, nents, direction); + for (i = 0; i < nents; i++, sg++) { char *virt; @@ -153,6 +173,11 @@ pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int directi static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) { + if (dev_is_sa1111(hwdev)) { + sa1111_unmap_sg(hwdev, sg, nents, direction); + return; + } + /* nothing to do */ } @@ -168,6 +193,11 @@ pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direc static inline void pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction) { + if (dev_is_sa1111(hwdev)) { + sa1111_dma_sync_single(hwdev, dma_handle, size, direction); + return; + } + consistent_sync(bus_to_virt(dma_handle), size, direction); } @@ -182,6 +212,11 @@ pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int d { int i; + if (dev_is_sa1111(hwdev)) { + sa1111_dma_sync_sg(hwdev, sg, nelems, direction); + return; + } + for (i = 0; i < nelems; i++, sg++) { char *virt = page_address(sg->page) + sg->offset; consistent_sync(virt, sg->length, direction); @@ -204,6 +239,19 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) /* Return the index of the PCI controller for device PDEV. */ #define pci_controller_num(PDEV) (0) + +#if defined(CONFIG_SA1111) && !defined(CONFIG_PCI) +/* SA-1111 needs these prototypes even when !defined(CONFIG_PCI) */ + +/* kmem_cache style wrapper around pci_alloc_consistent() */ +struct pci_pool *pci_pool_create (const char *name, struct pci_dev *dev, + size_t size, size_t align, size_t allocation, int flags); +void pci_pool_destroy (struct pci_pool *pool); + +void *pci_pool_alloc (struct pci_pool *pool, int flags, dma_addr_t *handle); +void pci_pool_free (struct pci_pool *pool, void *vaddr, dma_addr_t addr); +#endif + #endif /* __KERNEL__ */ #endif diff --git a/include/asm-arm/percpu.h b/include/asm-arm/percpu.h new file mode 100644 index 000000000000..b4e32d8ec072 --- /dev/null +++ b/include/asm-arm/percpu.h @@ -0,0 +1,6 @@ +#ifndef __ARM_PERCPU +#define __ARM_PERCPU + +#include <asm-generic/percpu.h> + +#endif diff --git a/include/asm-arm/proc-armv/elf.h b/include/asm-arm/proc-armv/elf.h index c5eb263aa9a8..5b559aeb7c9e 100644 --- a/include/asm-arm/proc-armv/elf.h +++ b/include/asm-arm/proc-armv/elf.h @@ -6,10 +6,14 @@ #ifdef __KERNEL__ -/* 32-bit code is always OK. Some cpus can do 26-bit, some can't. */ -#define ELF_PROC_OK(x) \ - ((! ((x)->e_flags & EF_ARM_APCS26)) \ - || (elf_hwcap & HWCAP_26BIT)) +/* + * 32-bit code is always OK. Some cpus can do 26-bit, some can't. + */ +#define ELF_PROC_OK(x) \ + (( (elf_hwcap & HWCAP_THUMB) && ((x)->e_entry & 1) == 1) || \ + (!(elf_hwcap & HWCAP_THUMB) && ((x)->e_entry & 3) == 0) || \ + ( (elf_hwcap & HWCAP_26BIT) && (x)->e_flags & EF_ARM_APCS26) || \ + ((x)->e_flags & EF_ARM_APCS26) == 0) /* Old NetWinder binaries were compiled in such a way that the iBCS heuristic always trips on them. Until these binaries become uncommon diff --git a/include/asm-arm/proc-armv/processor.h b/include/asm-arm/proc-armv/processor.h index 0e8c4bfee6dc..853f411083db 100644 --- a/include/asm-arm/proc-armv/processor.h +++ b/include/asm-arm/proc-armv/processor.h @@ -36,7 +36,9 @@ regs->ARM_cpsr = USR_MODE; \ else \ regs->ARM_cpsr = USR26_MODE; \ - regs->ARM_pc = pc; /* pc */ \ + if (elf_hwcap & HWCAP_THUMB && pc & 1) \ + regs->ARM_cpsr |= PSR_T_BIT; \ + regs->ARM_pc = pc & ~1; /* pc */ \ regs->ARM_sp = sp; /* sp */ \ regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index 9a43b8495bcd..7f3bed11ebd1 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -25,6 +25,7 @@ #include <asm/atomic.h> #include <asm/ptrace.h> +#include <asm/procinfo.h> #include <asm/arch/memory.h> #include <asm/proc/processor.h> diff --git a/include/asm-arm/procinfo.h b/include/asm-arm/procinfo.h index 1ad4692fc5ff..c143ffa712de 100644 --- a/include/asm-arm/procinfo.h +++ b/include/asm-arm/procinfo.h @@ -46,6 +46,8 @@ struct proc_info_list { struct cpu_user_fns *user; }; +extern unsigned int elf_hwcap; + #endif /* __ASSEMBLY__ */ #define PROC_INFO_SZ 44 diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h index 1e1002711665..38f4ba0ecc67 100644 --- a/include/asm-arm/setup.h +++ b/include/asm-arm/setup.h @@ -65,14 +65,14 @@ struct tag_ramdisk { u32 start; /* starting block of floppy-based RAM disk image */ }; -/* describes where the compressed ramdisk image lives */ +/* describes where the compressed ramdisk image lives (virtual address) */ /* * this one accidentally used virtual addresses - as such, * its depreciated. */ #define ATAG_INITRD 0x54410005 -/* describes where the compressed ramdisk image lives */ +/* describes where the compressed ramdisk image lives (physical address) */ #define ATAG_INITRD2 0x54420005 struct tag_initrd { diff --git a/include/asm-arm/stat.h b/include/asm-arm/stat.h index a9e4276c35b4..9c70568d2e95 100644 --- a/include/asm-arm/stat.h +++ b/include/asm-arm/stat.h @@ -40,6 +40,8 @@ struct stat { /* This matches struct stat64 in glibc2.1, hence the absolutely * insane amounts of padding around dev_t's. + * Note: The kernel zero's the padded region because glibc might read them + * in the hope that the kernel has stretched to using larger sizes. */ struct stat64 { #if defined(__ARMEB__) diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 25b6975fbceb..698ad721f426 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -86,6 +86,13 @@ extern struct task_struct *__switch_to(struct thread_info *, struct thread_info #define clf() __clf() #define stf() __stf() +#define irqs_disabled() \ +({ \ + unsigned long flags; \ + local_save_flags(flags); \ + flags & PSR_I_BIT; \ +}) + #endif /* CONFIG_SMP */ #endif /* __KERNEL__ */ diff --git a/include/asm-arm/topology.h b/include/asm-arm/topology.h new file mode 100644 index 000000000000..accbd7cad9b5 --- /dev/null +++ b/include/asm-arm/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_ARM_TOPOLOGY_H +#define _ASM_ARM_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_ARM_TOPOLOGY_H */ diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index a1b82ca77597..32d3f3bff93b 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -15,7 +15,11 @@ #include <linux/linkage.h> +#if defined(__thumb__) +#define __NR_SYSCALL_BASE 0 +#else #define __NR_SYSCALL_BASE 0x900000 +#endif /* * This file contains the system call numbers. @@ -273,8 +277,16 @@ #define __sys1(x) __sys2(x) #ifndef __syscall +#if defined(__thumb__) +#define __syscall(name) \ + "push {r7}\n\t" \ + "mov r7, #" __sys1(__NR_##name) "\n\t" \ + "swi 0\n\t" \ + "pop {r7}" +#else #define __syscall(name) "swi\t" __sys1(__NR_##name) "\n\t" #endif +#endif #define __syscall_return(type, res) \ do { \ @@ -287,91 +299,103 @@ do { \ #define _syscall0(type,name) \ type name(void) { \ - long __res; \ + register long __res __asm__("r0"); \ __asm__ __volatile__ ( \ __syscall(name) \ - "mov %0,r0" \ - :"=r" (__res) : : "r0","lr"); \ + :"=r" (__res) \ + : \ + : "lr"); \ __syscall_return(type,__res); \ } -#define _syscall1(type,name,type1,arg1) \ -type name(type1 arg1) { \ - long __res; \ +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) { \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __res __asm__("r0"); \ __asm__ __volatile__ ( \ - "mov\tr0,%1\n\t" \ __syscall(name) \ - "mov %0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)) \ - : "r0","lr"); \ + : "=r" (__res) \ + : "r" (__r0) \ + : "lr"); \ __syscall_return(type,__res); \ } #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) { \ - long __res; \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __res __asm__("r0"); \ __asm__ __volatile__ ( \ - "mov\tr0,%1\n\t" \ - "mov\tr1,%2\n\t" \ __syscall(name) \ - "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)) \ - : "r0","r1","lr"); \ + : "=r" (__res) \ + : "r" (__r0),"r" (__r1) \ + : "lr"); \ __syscall_return(type,__res); \ } #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) { \ - long __res; \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __res __asm__("r0"); \ __asm__ __volatile__ ( \ - "mov\tr0,%1\n\t" \ - "mov\tr1,%2\n\t" \ - "mov\tr2,%3\n\t" \ __syscall(name) \ - "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)) \ - : "r0","r1","r2","lr"); \ + : "=r" (__res) \ + : "r" (__r0),"r" (__r1),"r" (__r2) \ + : "lr"); \ __syscall_return(type,__res); \ } -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ - long __res; \ - __asm__ __volatile__ ( \ - "mov\tr0,%1\n\t" \ - "mov\tr1,%2\n\t" \ - "mov\tr2,%3\n\t" \ - "mov\tr3,%4\n\t" \ - __syscall(name) \ - "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)) \ - : "r0","r1","r2","r3","lr"); \ - __syscall_return(type,__res); \ +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __r3 __asm__("r3") = (long)arg4; \ + register long __res __asm__("r0"); \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res) \ + : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3) \ + : "lr"); \ + __syscall_return(type,__res); \ } #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ - long __res; \ - __asm__ __volatile__ ( \ - "mov\tr0,%1\n\t" \ - "mov\tr1,%2\n\t" \ - "mov\tr2,%3\n\t" \ - "mov\tr3,%4\n\t" \ - "mov\tr4,%5\n\t" \ - __syscall(name) \ - "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)), \ - "r" ((long)(arg5)) \ - : "r0","r1","r2","r3","r4","lr"); \ - __syscall_return(type,__res); \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __r3 __asm__("r3") = (long)arg4; \ + register long __r4 __asm__("r4") = (long)arg5; \ + register long __res __asm__("r0"); \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res) \ + : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3),"r" (__r4) \ + : "lr"); \ + __syscall_return(type,__res); \ +} + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __r3 __asm__("r3") = (long)arg4; \ + register long __r4 __asm__("r4") = (long)arg5; \ + register long __r5 __asm__("r5") = (long)arg6; \ + register long __res __asm__("r0"); \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res) \ + : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3), "r" (__r4),"r" (__r5) \ + : "lr"); \ + __syscall_return(type,__res); \ } #ifdef __KERNEL_SYSCALLS__ diff --git a/include/asm-cris/topology.h b/include/asm-cris/topology.h new file mode 100644 index 000000000000..2ac613d32a89 --- /dev/null +++ b/include/asm-cris/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_CRIS_TOPOLOGY_H +#define _ASM_CRIS_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_CRIS_TOPOLOGY_H */ diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h new file mode 100644 index 000000000000..414f727065ef --- /dev/null +++ b/include/asm-generic/topology.h @@ -0,0 +1,51 @@ +/* + * linux/include/asm-generic/topology.h + * + * Written by: Matthew Dobson, IBM Corporation + * + * Copyright (C) 2002, IBM Corp. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to <colpatch@us.ibm.com> + */ +#ifndef _ASM_GENERIC_TOPOLOGY_H +#define _ASM_GENERIC_TOPOLOGY_H + +/* Other architectures wishing to use this simple topology API should fill + in the below functions as appropriate in their own <asm/topology.h> file. */ +#ifndef __cpu_to_node +#define __cpu_to_node(cpu) (0) +#endif +#ifndef __memblk_to_node +#define __memblk_to_node(memblk) (0) +#endif +#ifndef __parent_node +#define __parent_node(node) (0) +#endif +#ifndef __node_to_first_cpu +#define __node_to_first_cpu(node) (0) +#endif +#ifndef __node_to_cpu_mask +#define __node_to_cpu_mask(node) (cpu_online_map) +#endif +#ifndef __node_to_memblk +#define __node_to_memblk(node) (0) +#endif + +#endif /* _ASM_GENERIC_TOPOLOGY_H */ diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 00a5d7ffbed9..6d9f3cf88d66 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h @@ -14,15 +14,8 @@ #include <asm/numaq.h> #else #define pfn_to_nid(pfn) (0) -#ifdef CONFIG_NUMA -#define _cpu_to_node(cpu) 0 -#endif /* CONFIG_NUMA */ #endif /* CONFIG_X86_NUMAQ */ -#ifdef CONFIG_NUMA -#define numa_node_id() _cpu_to_node(smp_processor_id()) -#endif /* CONFIG_NUMA */ - extern struct pglist_data *node_data[]; /* diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index 131408b851bd..b1b5ae1ce148 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h @@ -125,4 +125,10 @@ #define MSR_VIA_LONGHAUL 0x110a #define MSR_VIA_BCR2 0x1147 +/* Transmeta defined MSRs */ +#define MSR_TMTA_LONGRUN_CTRL 0x80868010 +#define MSR_TMTA_LONGRUN_FLAGS 0x80868011 +#define MSR_TMTA_LRTI_READOUT 0x80868018 +#define MSR_TMTA_LRTI_VOLT_MHZ 0x8086801a + #endif /* __ASM_MSR_H */ diff --git a/include/asm-i386/numaq.h b/include/asm-i386/numaq.h index b32b28c12c73..6f52745df91c 100644 --- a/include/asm-i386/numaq.h +++ b/include/asm-i386/numaq.h @@ -41,9 +41,6 @@ #define pfn_to_pgdat(pfn) NODE_DATA(pfn_to_nid(pfn)) #define PHYSADDR_TO_NID(pa) pfn_to_nid(pa >> PAGE_SHIFT) #define MAX_NUMNODES 8 -#ifdef CONFIG_NUMA -#define _cpu_to_node(cpu) (cpu_to_logical_apicid(cpu) >> 4) -#endif /* CONFIG_NUMA */ extern int pfn_to_nid(unsigned long); extern void get_memcfg_numaq(void); #define get_memcfg_numa() get_memcfg_numaq() diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h new file mode 100644 index 000000000000..d3bdbb0c40c6 --- /dev/null +++ b/include/asm-i386/topology.h @@ -0,0 +1,96 @@ +/* + * linux/include/asm-i386/topology.h + * + * Written by: Matthew Dobson, IBM Corporation + * + * Copyright (C) 2002, IBM Corp. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to <colpatch@us.ibm.com> + */ +#ifndef _ASM_I386_TOPOLOGY_H +#define _ASM_I386_TOPOLOGY_H + +#ifdef CONFIG_X86_NUMAQ + +#include <asm/smpboot.h> + +/* Returns the number of the node containing CPU 'cpu' */ +#define __cpu_to_node(cpu) (cpu_to_logical_apicid(cpu) >> 4) + +/* Returns the number of the node containing MemBlk 'memblk' */ +#define __memblk_to_node(memblk) (memblk) + +/* Returns the number of the node containing Node 'node'. This architecture is flat, + so it is a pretty simple function! */ +#define __parent_node(node) (node) + +/* Returns the number of the first CPU on Node 'node'. + * This should be changed to a set of cached values + * but this will do for now. + */ +static inline int __node_to_first_cpu(int node) +{ + int i, cpu, logical_apicid = node << 4; + + for(i = 1; i < 16; i <<= 1) + /* check to see if the cpu is in the system */ + if ((cpu = logical_apicid_to_cpu(logical_apicid | i)) >= 0) + /* if yes, return it to caller */ + return cpu; + + BUG(); /* couldn't find a cpu on given node */ + return -1; +} + +/* Returns a bitmask of CPUs on Node 'node'. + * This should be changed to a set of cached bitmasks + * but this will do for now. + */ +static inline unsigned long __node_to_cpu_mask(int node) +{ + int i, cpu, logical_apicid = node << 4; + unsigned long mask = 0UL; + + if (sizeof(unsigned long) * 8 < NR_CPUS) + BUG(); + + for(i = 1; i < 16; i <<= 1) + /* check to see if the cpu is in the system */ + if ((cpu = logical_apicid_to_cpu(logical_apicid | i)) >= 0) + /* if yes, add to bitmask */ + mask |= 1 << cpu; + + return mask; +} + +/* Returns the number of the first MemBlk on Node 'node' */ +#define __node_to_memblk(node) (node) + +#else /* !CONFIG_X86_NUMAQ */ +/* + * Other i386 platforms should define their own version of the + * above macros here. + */ + +#include <asm-generic/topology.h> + +#endif /* CONFIG_X86_NUMAQ */ + +#endif /* _ASM_I386_TOPOLOGY_H */ diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h new file mode 100644 index 000000000000..8fcb9e6cfe45 --- /dev/null +++ b/include/asm-ia64/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_IA64_TOPOLOGY_H +#define _ASM_IA64_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_IA64_TOPOLOGY_H */ diff --git a/include/asm-m68k/topology.h b/include/asm-m68k/topology.h new file mode 100644 index 000000000000..ca173e9f26ff --- /dev/null +++ b/include/asm-m68k/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_M68K_TOPOLOGY_H +#define _ASM_M68K_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_M68K_TOPOLOGY_H */ diff --git a/include/asm-mips/topology.h b/include/asm-mips/topology.h new file mode 100644 index 000000000000..cf224a32ba6d --- /dev/null +++ b/include/asm-mips/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_MIPS_TOPOLOGY_H +#define _ASM_MIPS_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_MIPS_TOPOLOGY_H */ diff --git a/include/asm-mips64/mmzone.h b/include/asm-mips64/mmzone.h index d60ad12acd75..b7ccf0bee093 100644 --- a/include/asm-mips64/mmzone.h +++ b/include/asm-mips64/mmzone.h @@ -28,8 +28,6 @@ extern plat_pg_data_t *plat_node_data[]; #define PLAT_NODE_DATA_LOCALNR(p, n) \ (((p) >> PAGE_SHIFT) - PLAT_NODE_DATA(n)->gendata.node_start_pfn) -#define numa_node_id() cputocnode(current->processor) - #ifdef CONFIG_DISCONTIGMEM /* diff --git a/include/asm-mips64/topology.h b/include/asm-mips64/topology.h new file mode 100644 index 000000000000..fe5988686b1d --- /dev/null +++ b/include/asm-mips64/topology.h @@ -0,0 +1,8 @@ +#ifndef _ASM_MIPS64_TOPOLOGY_H +#define _ASM_MIPS64_TOPOLOGY_H + +#include <asm/mmzone.h> + +#define __cpu_to_node(cpu) (cputocnode(cpu)) + +#endif /* _ASM_MIPS64_TOPOLOGY_H */ diff --git a/include/asm-parisc/topology.h b/include/asm-parisc/topology.h new file mode 100644 index 000000000000..d8133eb0b1e7 --- /dev/null +++ b/include/asm-parisc/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_PARISC_TOPOLOGY_H +#define _ASM_PARISC_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_PARISC_TOPOLOGY_H */ diff --git a/include/asm-ppc/topology.h b/include/asm-ppc/topology.h new file mode 100644 index 000000000000..6a029bbba6e1 --- /dev/null +++ b/include/asm-ppc/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_PPC_TOPOLOGY_H +#define _ASM_PPC_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_PPC_TOPOLOGY_H */ diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h index b551f7caded2..3e737cc0724a 100644 --- a/include/asm-ppc64/mmzone.h +++ b/include/asm-ppc64/mmzone.h @@ -56,25 +56,6 @@ static inline int pa_to_nid(unsigned long pa) #define node_size(nid) (NODE_DATA(nid)->node_size) #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) -#ifdef CONFIG_NUMA - -static inline int __cpu_to_node(int cpu) -{ - int node; - - node = numa_cpu_lookup_table[cpu]; - -#ifdef DEBUG_NUMA - if (node == -1) - BUG(); -#endif - - return node; -} - -#define numa_node_id() __cpu_to_node(smp_processor_id()) -#endif /* CONFIG_NUMA */ - /* * Following are macros that each numa implmentation must define. */ diff --git a/include/asm-ppc64/topology.h b/include/asm-ppc64/topology.h new file mode 100644 index 000000000000..d70184399d76 --- /dev/null +++ b/include/asm-ppc64/topology.h @@ -0,0 +1,60 @@ +#ifndef _ASM_PPC64_TOPOLOGY_H +#define _ASM_PPC64_TOPOLOGY_H + +#include <asm/mmzone.h> + +#ifdef CONFIG_NUMA + +static inline int __cpu_to_node(int cpu) +{ + int node; + + node = numa_cpu_lookup_table[cpu]; + +#ifdef DEBUG_NUMA + if (node == -1) + BUG(); +#endif + + return node; +} + +static inline int __node_to_first_cpu(int node) +{ + int cpu; + + for(cpu = 0; cpu < NR_CPUS; cpu++) + if (numa_cpu_lookup_table[cpu] == node) + return cpu; + + BUG(); /* couldn't find a cpu on given node */ + return -1; +} + +static inline unsigned long __node_to_cpu_mask(int node) +{ + int cpu; + unsigned long mask = 0UL; + + if (sizeof(unsigned long) * 8 < NR_CPUS) + BUG(); + + for(cpu = 0; cpu < NR_CPUS; cpu++) + if (numa_cpu_lookup_table[cpu] == node) + mask |= 1 << cpu; + + return mask; +} + +#else /* !CONFIG_NUMA */ + +#define __cpu_to_node(cpu) (0) +#define __memblk_to_node(memblk) (0) +#define __parent_node(nid) (0) +#define __node_to_first_cpu(node) (0) +#define __node_to_cpu_mask(node) (cpu_online_map) +#define __node_to_memblk(node) (0) + +#endif /* CONFIG_NUMA */ + +#endif /* _ASM_PPC64_TOPOLOGY_H */ diff --git a/include/asm-s390/topology.h b/include/asm-s390/topology.h new file mode 100644 index 000000000000..613aa64019da --- /dev/null +++ b/include/asm-s390/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_S390_TOPOLOGY_H +#define _ASM_S390_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_S390_TOPOLOGY_H */ diff --git a/include/asm-s390x/topology.h b/include/asm-s390x/topology.h new file mode 100644 index 000000000000..32cfa163930c --- /dev/null +++ b/include/asm-s390x/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_S390X_TOPOLOGY_H +#define _ASM_S390X_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_S390X_TOPOLOGY_H */ diff --git a/include/asm-sh/topology.h b/include/asm-sh/topology.h new file mode 100644 index 000000000000..cff001c316fe --- /dev/null +++ b/include/asm-sh/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_SH_TOPOLOGY_H +#define _ASM_SH_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_SH_TOPOLOGY_H */ diff --git a/include/asm-sparc/topology.h b/include/asm-sparc/topology.h new file mode 100644 index 000000000000..ee5ac9c9da28 --- /dev/null +++ b/include/asm-sparc/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_SPARC_TOPOLOGY_H +#define _ASM_SPARC_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_SPARC_TOPOLOGY_H */ diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h new file mode 100644 index 000000000000..0e234e201bd6 --- /dev/null +++ b/include/asm-sparc64/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_SPARC64_TOPOLOGY_H +#define _ASM_SPARC64_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_SPARC64_TOPOLOGY_H */ diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h new file mode 100644 index 000000000000..2ea9ab1b9423 --- /dev/null +++ b/include/asm-x86_64/topology.h @@ -0,0 +1,6 @@ +#ifndef _ASM_X86_64_TOPOLOGY_H +#define _ASM_X86_64_TOPOLOGY_H + +#include <asm-generic/topology.h> + +#endif /* _ASM_X86_64_TOPOLOGY_H */ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h new file mode 100644 index 000000000000..5e39e5d0453c --- /dev/null +++ b/include/linux/cpufreq.h @@ -0,0 +1,252 @@ +/* + * linux/include/linux/cpufreq.h + * + * Copyright (C) 2001 Russell King + * (C) 2002 Dominik Brodowski <linux@brodo.de> + * + * + * $Id: cpufreq.h,v 1.26 2002/09/21 09:05:29 db Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef _LINUX_CPUFREQ_H +#define _LINUX_CPUFREQ_H + +#include <linux/config.h> +#include <linux/notifier.h> +#include <linux/threads.h> + + +/********************************************************************* + * CPUFREQ NOTIFIER INTERFACE * + *********************************************************************/ + +int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); +int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); + +#define CPUFREQ_TRANSITION_NOTIFIER (0) +#define CPUFREQ_POLICY_NOTIFIER (1) + +#define CPUFREQ_ALL_CPUS ((NR_CPUS)) + + +/********************** cpufreq policy notifiers *********************/ + +#define CPUFREQ_POLICY_POWERSAVE (1) +#define CPUFREQ_POLICY_PERFORMANCE (2) + +/* values here are CPU kHz so that hardware which doesn't run with some + * frequencies can complain without having to guess what per cent / per + * mille means. */ +struct cpufreq_policy { + unsigned int cpu; /* cpu nr or CPUFREQ_ALL_CPUS */ + unsigned int min; /* in kHz */ + unsigned int max; /* in kHz */ + unsigned int policy; /* see above */ + unsigned int max_cpu_freq; /* for information */ +}; + +#define CPUFREQ_ADJUST (0) +#define CPUFREQ_INCOMPATIBLE (1) +#define CPUFREQ_NOTIFY (2) + + +/******************** cpufreq transition notifiers *******************/ + +#define CPUFREQ_PRECHANGE (0) +#define CPUFREQ_POSTCHANGE (1) + +struct cpufreq_freqs { + unsigned int cpu; /* cpu nr or CPUFREQ_ALL_CPUS */ + unsigned int old; + unsigned int new; +}; + + +/** + * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch safe) + * @old: old value + * @div: divisor + * @mult: multiplier + * + * Needed for loops_per_jiffy and similar calculations. We do it + * this way to avoid math overflow on 32-bit machines. This will + * become architecture dependent once high-resolution-timer is + * merged (or any other thing that introduces sc_math.h). + * + * new = old * mult / div + */ +static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mult) +{ + unsigned long val, carry; + + mult /= 100; + div /= 100; + val = (old / div) * mult; + carry = old % div; + carry = carry * mult / div; + + return carry + val; +}; + + +/********************************************************************* + * DYNAMIC CPUFREQ INTERFACE * + *********************************************************************/ +#ifdef CONFIG_CPU_FREQ_DYNAMIC +/* TBD */ +#endif /* CONFIG_CPU_FREQ_DYNAMIC */ + + +/********************************************************************* + * CPUFREQ DRIVER INTERFACE * + *********************************************************************/ + +typedef void (*cpufreq_policy_t) (struct cpufreq_policy *policy); + +struct cpufreq_driver { + /* needed by all drivers */ + cpufreq_policy_t verify; + cpufreq_policy_t setpolicy; + struct cpufreq_policy *policy; +#ifdef CONFIG_CPU_FREQ_DYNAMIC + /* TBD */ +#endif + /* 2.4. compatible API */ +#ifdef CONFIG_CPU_FREQ_24_API + unsigned int cpu_min_freq; + unsigned int cpu_cur_freq[NR_CPUS]; +#endif +}; + +int cpufreq_register(struct cpufreq_driver *driver_data); +int cpufreq_unregister(void); + +void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); + + +static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) +{ + if (policy->min < min) + policy->min = min; + if (policy->max < min) + policy->max = min; + if (policy->min > max) + policy->min = max; + if (policy->max > max) + policy->max = max; + if (policy->min > policy->max) + policy->min = policy->max; + return; +} + +/********************************************************************* + * CPUFREQ 2.6. INTERFACE * + *********************************************************************/ +int cpufreq_set_policy(struct cpufreq_policy *policy); +int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); + +#ifdef CONFIG_CPU_FREQ_26_API +#ifdef CONFIG_PM +int cpufreq_restore(void); +#endif +#endif + + +#ifdef CONFIG_CPU_FREQ_24_API +/********************************************************************* + * CPUFREQ 2.4. INTERFACE * + *********************************************************************/ +int cpufreq_setmax(unsigned int cpu); +#ifdef CONFIG_PM +int cpufreq_restore(void); +#endif +int cpufreq_set(unsigned int kHz, unsigned int cpu); +unsigned int cpufreq_get(unsigned int cpu); + +/* /proc/sys/cpu */ +enum { + CPU_NR = 1, /* compatibilty reasons */ + CPU_NR_0 = 1, + CPU_NR_1 = 2, + CPU_NR_2 = 3, + CPU_NR_3 = 4, + CPU_NR_4 = 5, + CPU_NR_5 = 6, + CPU_NR_6 = 7, + CPU_NR_7 = 8, + CPU_NR_8 = 9, + CPU_NR_9 = 10, + CPU_NR_10 = 11, + CPU_NR_11 = 12, + CPU_NR_12 = 13, + CPU_NR_13 = 14, + CPU_NR_14 = 15, + CPU_NR_15 = 16, + CPU_NR_16 = 17, + CPU_NR_17 = 18, + CPU_NR_18 = 19, + CPU_NR_19 = 20, + CPU_NR_20 = 21, + CPU_NR_21 = 22, + CPU_NR_22 = 23, + CPU_NR_23 = 24, + CPU_NR_24 = 25, + CPU_NR_25 = 26, + CPU_NR_26 = 27, + CPU_NR_27 = 28, + CPU_NR_28 = 29, + CPU_NR_29 = 30, + CPU_NR_30 = 31, + CPU_NR_31 = 32, +}; + +/* /proc/sys/cpu/{0,1,...,(NR_CPUS-1)} */ +enum { + CPU_NR_FREQ_MAX = 1, + CPU_NR_FREQ_MIN = 2, + CPU_NR_FREQ = 3, +}; + +#define CTL_CPU_VARS_SPEED_MAX { \ + ctl_name: CPU_NR_FREQ_MAX, \ + data: &cpu_max_freq, \ + procname: "speed-max", \ + maxlen: sizeof(cpu_max_freq),\ + mode: 0444, \ + proc_handler: proc_dointvec, } + +#define CTL_CPU_VARS_SPEED_MIN { \ + ctl_name: CPU_NR_FREQ_MIN, \ + data: &cpu_min_freq, \ + procname: "speed-min", \ + maxlen: sizeof(cpu_min_freq),\ + mode: 0444, \ + proc_handler: proc_dointvec, } + +#define CTL_CPU_VARS_SPEED(cpunr) { \ + ctl_name: CPU_NR_FREQ, \ + procname: "speed", \ + mode: 0644, \ + proc_handler: cpufreq_procctl, \ + strategy: cpufreq_sysctl, \ + extra1: (void*) (cpunr), } + +#define CTL_TABLE_CPU_VARS(cpunr) static ctl_table ctl_cpu_vars_##cpunr[] = {\ + CTL_CPU_VARS_SPEED_MAX, \ + CTL_CPU_VARS_SPEED_MIN, \ + CTL_CPU_VARS_SPEED(cpunr), \ + { ctl_name: 0, }, } + +/* the ctl_table entry for each CPU */ +#define CPU_ENUM(s) { \ + ctl_name: (CPU_NR + s), \ + procname: #s, \ + mode: 0555, \ + child: ctl_cpu_vars_##s } + +#endif /* CONFIG_CPU_FREQ_24_API */ + +#endif /* _LINUX_CPUFREQ_H */ diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 437572e2240b..b186f69b7217 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -25,7 +25,6 @@ #define GFP_USER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) #define GFP_HIGHUSER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS | __GFP_HIGHMEM) #define GFP_KERNEL ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) -#define GFP_NFS ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) #define GFP_KSWAPD ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 30f24600ea0b..d9b8c5d9b55c 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -90,7 +90,6 @@ .thread = INIT_THREAD, \ .fs = &init_fs, \ .files = &init_files, \ - .sigmask_lock = SPIN_LOCK_UNLOCKED, \ .sig = &init_signals, \ .pending = { NULL, &tsk.pending.head, {{0}}}, \ .blocked = {{0}}, \ diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 26588de0b514..99ca09224919 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -22,25 +22,6 @@ struct irqaction { struct irqaction *next; }; - -/* Who gets which entry in bh_base. Things which will occur most often - should come first */ - -enum { - TIMER_BH = 0, - TQUEUE_BH = 1, - DIGI_BH = 2, - SERIAL_BH = 3, - RISCOM8_BH = 4, - SPECIALIX_BH = 5, - AURORA_BH = 6, - ESP_BH = 7, - IMMEDIATE_BH = 9, - CYCLADES_BH = 10, - MACSERIAL_BH = 13, - ISICOM_BH = 14 -}; - #include <asm/hardirq.h> #include <asm/softirq.h> @@ -218,23 +199,6 @@ static void name (unsigned long dummy) \ #endif /* CONFIG_SMP */ - -/* Old BH definitions */ - -extern struct tasklet_struct bh_task_vec[]; - -/* It is exported _ONLY_ for wait_on_irq(). */ -extern spinlock_t global_bh_lock; - -static inline void mark_bh(int nr) -{ - tasklet_hi_schedule(bh_task_vec+nr); -} - -extern void init_bh(int nr, void (*routine)(void)); -extern void remove_bh(int nr); - - /* * Autoprobing for irqs: * diff --git a/include/linux/mii.h b/include/linux/mii.h index dc1b22a562ea..9a5799601ee3 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -107,9 +107,11 @@ struct mii_if_info { int phy_id; int advertising; + int phy_id_mask; + int reg_num_mask; - unsigned int full_duplex : 1; - unsigned int duplex_lock : 1; + unsigned int full_duplex : 1; /* is full duplex? */ + unsigned int force_media : 1; /* is autoneg. disabled? */ struct net_device *dev; int (*mdio_read) (struct net_device *dev, int phy_id, int location); @@ -117,13 +119,20 @@ struct mii_if_info { }; struct ethtool_cmd; +struct mii_ioctl_data; extern int mii_link_ok (struct mii_if_info *mii); extern int mii_nway_restart (struct mii_if_info *mii); extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); extern void mii_check_link (struct mii_if_info *mii); -extern unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print); +extern unsigned int mii_check_media (struct mii_if_info *mii, + unsigned int ok_to_print, + unsigned int init_media); +extern int generic_mii_ioctl(struct mii_if_info *mii_if, + struct mii_ioctl_data *mii_data, int cmd, + unsigned int *duplex_changed); + /* This structure is used in all SIOCxMIIxxx ioctl calls */ diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 580c39c4dcc1..d7d12a69f505 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -24,10 +24,10 @@ #define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER #endif -typedef struct free_area_struct { +struct free_area { struct list_head free_list; unsigned long *map; -} free_area_t; +}; struct pglist_data; @@ -78,7 +78,7 @@ struct zone { /* * free areas of different sizes */ - free_area_t free_area[MAX_ORDER]; + struct free_area free_area[MAX_ORDER]; /* * wait_table -- the array holding the hash table @@ -168,6 +168,7 @@ typedef struct pglist_data { unsigned long node_size; int node_id; struct pglist_data *pgdat_next; + wait_queue_head_t kswapd_wait; } pg_data_t; extern int numnodes; @@ -248,13 +249,23 @@ static inline struct zone *next_zone(struct zone *zone) #define for_each_zone(zone) \ for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) +#ifdef CONFIG_NUMA +#define MAX_NR_MEMBLKS BITS_PER_LONG /* Max number of Memory Blocks */ +#else /* !CONFIG_NUMA */ +#define MAX_NR_MEMBLKS 1 +#endif /* CONFIG_NUMA */ + +#include <asm/topology.h> +/* Returns the number of the current Node. */ +#define numa_node_id() (__cpu_to_node(smp_processor_id())) + #ifndef CONFIG_DISCONTIGMEM #define NODE_DATA(nid) (&contig_page_data) #define NODE_MEM_MAP(nid) mem_map #define MAX_NR_NODES 1 -#else /* !CONFIG_DISCONTIGMEM */ +#else /* CONFIG_DISCONTIGMEM */ #include <asm/mmzone.h> diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index 75d86d869771..2ca3a3abce00 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -68,9 +68,9 @@ MSDOS_SB(s)->fat_bits == 16 ? BAD_FAT16 : BAD_FAT12) /* standard EOF */ -#define EOF_FAT12 0xFF8 -#define EOF_FAT16 0xFFF8 -#define EOF_FAT32 0xFFFFFF8 +#define EOF_FAT12 0xFFF +#define EOF_FAT16 0xFFFF +#define EOF_FAT32 0xFFFFFFF #define EOF_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? EOF_FAT32 : \ MSDOS_SB(s)->fat_bits == 16 ? EOF_FAT16 : EOF_FAT12) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 0970c101c197..0e32a1b9dd5e 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -211,6 +211,8 @@ extern void get_page_state(struct page_state *ret); extern struct address_space swapper_space; #define PageSwapCache(page) ((page)->mapping == &swapper_space) +struct page; /* forward declaration */ + int test_clear_page_dirty(struct page *page); static inline void clear_page_dirty(struct page *page) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index ea37fd84068d..be4d21956fc5 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1713,8 +1713,13 @@ #define PCI_DEVICE_ID_INTEL_82801BA_9 0x244b #define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c #define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e +#define PCI_DEVICE_ID_INTEL_82801E_0 0x2450 +#define PCI_DEVICE_ID_INTEL_82801E_2 0x2452 +#define PCI_DEVICE_ID_INTEL_82801E_3 0x2453 #define PCI_DEVICE_ID_INTEL_82801E_9 0x245b #define PCI_DEVICE_ID_INTEL_82801E_11 PCI_DEVICE_ID_INTEL_82801E_9 +#define PCI_DEVICE_ID_INTEL_82801E_13 0x245d +#define PCI_DEVICE_ID_INTEL_82801E_14 0x245e #define PCI_DEVICE_ID_INTEL_82801CA_0 0x2480 #define PCI_DEVICE_ID_INTEL_82801CA_2 0x2482 #define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483 @@ -1725,8 +1730,16 @@ #define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a #define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b #define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c +#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0 +#define PCI_DEVICE_ID_INTEL_82801DB_2 0x24c2 +#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 +#define PCI_DEVICE_ID_INTEL_82801DB_4 0x24c4 +#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5 +#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6 +#define PCI_DEVICE_ID_INTEL_82801DB_7 0x24c7 #define PCI_DEVICE_ID_INTEL_82801DB_9 0x24cb #define PCI_DEVICE_ID_INTEL_82801DB_11 PCI_DEVICE_ID_INTEL_82801DB_9 +#define PCI_DEVICE_ID_INTEL_82801DB_13 0x24cd #define PCI_DEVICE_ID_INTEL_82820_HB 0x2500 #define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 #define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index a5693b3f4a3f..0deab78dea6b 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h @@ -1632,9 +1632,6 @@ struct reiserfs_journal_header { /* 12 */ struct journal_params jh_journal; } ; -extern task_queue reiserfs_commit_thread_tq ; -extern wait_queue_head_t reiserfs_commit_thread_wait ; - /* biggest tunable defines are right here */ #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 6e535c5b6ebc..8a361b76cf43 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -172,7 +172,6 @@ extern unsigned long cache_decay_ticks; extern signed long FASTCALL(schedule_timeout(signed long timeout)); asmlinkage void schedule(void); -extern void flush_scheduled_tasks(void); extern int start_context_thread(void); extern int current_is_keventd(void); @@ -226,15 +225,15 @@ struct signal_struct { struct k_sigaction action[_NSIG]; spinlock_t siglock; - /* current thread group signal load-balancing target: */ - task_t *curr_target; + /* current thread group signal load-balancing target: */ + task_t *curr_target; + /* shared signal handling: */ struct sigpending shared_pending; /* thread group exit support */ int group_exit; int group_exit_code; - struct task_struct *group_exit_task; }; @@ -380,7 +379,6 @@ struct task_struct { /* namespace */ struct namespace *namespace; /* signal handlers */ - spinlock_t sigmask_lock; /* Protects signal and blocked */ struct signal_struct *sig; sigset_t blocked, real_blocked, shared_unblocked; @@ -657,7 +655,6 @@ extern void exit_mm(struct task_struct *); extern void exit_files(struct task_struct *); extern void exit_sighand(struct task_struct *); extern void __exit_sighand(struct task_struct *); -extern void remove_thread_group(struct task_struct *tsk, struct signal_struct *sig); extern void reparent_to_init(void); extern void daemonize(void); @@ -720,6 +717,45 @@ do { \ current->state = TASK_RUNNING; \ remove_wait_queue(&wq, &__wait); \ } while (0) + +#define wait_event_interruptible(wq, condition) \ +({ \ + int __ret = 0; \ + if (!(condition)) \ + __wait_event_interruptible(wq, condition, __ret); \ + __ret; \ +}) + +#define __wait_event_interruptible_timeout(wq, condition, ret) \ +do { \ + wait_queue_t __wait; \ + init_waitqueue_entry(&__wait, current); \ + \ + add_wait_queue(&wq, &__wait); \ + for (;;) { \ + set_current_state(TASK_INTERRUPTIBLE); \ + if (condition) \ + break; \ + if (!signal_pending(current)) { \ + ret = schedule_timeout(ret); \ + if (!ret) \ + break; \ + continue; \ + } \ + ret = -ERESTARTSYS; \ + break; \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ +} while (0) + +#define wait_event_interruptible_timeout(wq, condition, timeout) \ +({ \ + long __ret = timeout; \ + if (!(condition)) \ + __wait_event_interruptible_timeout(wq, condition, __ret); \ + __ret; \ +}) /* * Must be called with the spinlock in the wait_queue_head_t held. @@ -740,14 +776,6 @@ static inline void remove_wait_queue_locked(wait_queue_head_t *q, __remove_wait_queue(q, wait); } -#define wait_event_interruptible(wq, condition) \ -({ \ - int __ret = 0; \ - if (!(condition)) \ - __wait_event_interruptible(wq, condition, __ret); \ - __ret; \ -}) - #define remove_parent(p) list_del_init(&(p)->sibling) #define add_parent(p, parent) list_add_tail(&(p)->sibling,&(parent)->children) @@ -955,7 +983,7 @@ static inline void cond_resched_lock(spinlock_t * lock) /* Reevaluate whether the task has signals pending delivery. This is required every time the blocked sigset_t changes. - Athread cathreaders should have t->sigmask_lock. */ + callers must hold sig->siglock. */ extern FASTCALL(void recalc_sigpending_tsk(struct task_struct *t)); extern void recalc_sigpending(void); diff --git a/include/linux/slab.h b/include/linux/slab.h index 72b03d90f688..ed45b49325af 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -21,7 +21,6 @@ typedef struct kmem_cache_s kmem_cache_t; #define SLAB_ATOMIC GFP_ATOMIC #define SLAB_USER GFP_USER #define SLAB_KERNEL GFP_KERNEL -#define SLAB_NFS GFP_NFS #define SLAB_DMA GFP_DMA #define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHIO|__GFP_FS) diff --git a/include/linux/smb.h b/include/linux/smb.h index 5b8dce292377..9e4944b6121f 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h @@ -76,7 +76,6 @@ struct smb_nls_codepage { * Contains all relevant data on a SMB networked file. */ struct smb_fattr { - __u16 attr; unsigned long f_ino; @@ -84,12 +83,14 @@ struct smb_fattr { nlink_t f_nlink; uid_t f_uid; gid_t f_gid; + dev_t f_rdev; loff_t f_size; time_t f_atime; time_t f_mtime; time_t f_ctime; unsigned long f_blksize; unsigned long f_blocks; + int f_unix; }; enum smb_conn_state { diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index be0f419928bc..41f9cd84c0b9 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -112,19 +112,20 @@ smb_kfree(void *obj) /* NT1 protocol capability bits */ -#define SMB_CAP_RAW_MODE 0x0001 -#define SMB_CAP_MPX_MODE 0x0002 -#define SMB_CAP_UNICODE 0x0004 -#define SMB_CAP_LARGE_FILES 0x0008 -#define SMB_CAP_NT_SMBS 0x0010 -#define SMB_CAP_RPC_REMOTE_APIS 0x0020 -#define SMB_CAP_STATUS32 0x0040 -#define SMB_CAP_LEVEL_II_OPLOCKS 0x0080 -#define SMB_CAP_LOCK_AND_READ 0x0100 -#define SMB_CAP_NT_FIND 0x0200 -#define SMB_CAP_DFS 0x1000 -#define SMB_CAP_LARGE_READX 0x4000 -#define SMB_CAP_LARGE_WRITEX 0x8000 +#define SMB_CAP_RAW_MODE 0x00000001 +#define SMB_CAP_MPX_MODE 0x00000002 +#define SMB_CAP_UNICODE 0x00000004 +#define SMB_CAP_LARGE_FILES 0x00000008 +#define SMB_CAP_NT_SMBS 0x00000010 +#define SMB_CAP_RPC_REMOTE_APIS 0x00000020 +#define SMB_CAP_STATUS32 0x00000040 +#define SMB_CAP_LEVEL_II_OPLOCKS 0x00000080 +#define SMB_CAP_LOCK_AND_READ 0x00000100 +#define SMB_CAP_NT_FIND 0x00000200 +#define SMB_CAP_DFS 0x00001000 +#define SMB_CAP_LARGE_READX 0x00004000 +#define SMB_CAP_LARGE_WRITEX 0x00008000 +#define SMB_CAP_UNIX 0x00800000 /* unofficial ... */ /* diff --git a/include/linux/smbno.h b/include/linux/smbno.h index c1495bba359f..c202e2d6cb80 100644 --- a/include/linux/smbno.h +++ b/include/linux/smbno.h @@ -328,4 +328,36 @@ #define SMB_FLAGS2_32_BIT_ERROR_CODES 0x4000 #define SMB_FLAGS2_UNICODE_STRINGS 0x8000 + +/* + * UNIX stuff (from samba trans2.h) + */ +#define MIN_UNIX_INFO_LEVEL 0x200 +#define MAX_UNIX_INFO_LEVEL 0x2FF +#define SMB_FIND_FILE_UNIX 0x202 +#define SMB_QUERY_FILE_UNIX_BASIC 0x200 +#define SMB_QUERY_FILE_UNIX_LINK 0x201 +#define SMB_QUERY_FILE_UNIX_HLINK 0x202 +#define SMB_SET_FILE_UNIX_BASIC 0x200 +#define SMB_SET_FILE_UNIX_LINK 0x201 +#define SMB_SET_FILE_UNIX_HLINK 0x203 +#define SMB_QUERY_CIFS_UNIX_INFO 0x200 + +/* values which means "don't change it" */ +#define SMB_MODE_NO_CHANGE 0xFFFFFFFF +#define SMB_UID_NO_CHANGE 0xFFFFFFFF +#define SMB_GID_NO_CHANGE 0xFFFFFFFF +#define SMB_TIME_NO_CHANGE 0xFFFFFFFFFFFFFFFF +#define SMB_SIZE_NO_CHANGE 0xFFFFFFFFFFFFFFFF + +/* UNIX filetype mappings. */ +#define UNIX_TYPE_FILE 0 +#define UNIX_TYPE_DIR 1 +#define UNIX_TYPE_SYMLINK 2 +#define UNIX_TYPE_CHARDEV 3 +#define UNIX_TYPE_BLKDEV 4 +#define UNIX_TYPE_FIFO 5 +#define UNIX_TYPE_SOCKET 6 +#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF + #endif /* _SMBNO_H_ */ diff --git a/include/linux/swap.h b/include/linux/swap.h index 8844b1408788..f4acbd1e9b46 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -162,7 +162,6 @@ extern void FASTCALL(activate_page(struct page *)); extern void swap_setup(void); /* linux/mm/vmscan.c */ -extern wait_queue_head_t kswapd_wait; extern int try_to_free_pages(struct zone *, unsigned int, unsigned int); /* linux/mm/page_io.c */ diff --git a/include/linux/timer.h b/include/linux/timer.h index bb498b6ff871..f890f4f3d668 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -2,11 +2,15 @@ #define _LINUX_TIMER_H #include <linux/config.h> +#include <linux/smp.h> #include <linux/stddef.h> #include <linux/list.h> +#include <linux/spinlock.h> +#include <linux/cache.h> + +struct tvec_t_base_s; /* - * In Linux 2.4, static timers have been removed from the kernel. * Timers may be dynamically created and destroyed, and should be initialized * by a call to init_timer() upon creation. * @@ -14,22 +18,31 @@ * timeouts. You can use this field to distinguish between the different * invocations. */ -struct timer_list { +typedef struct timer_list { struct list_head list; unsigned long expires; unsigned long data; void (*function)(unsigned long); -}; - -extern void add_timer(struct timer_list * timer); -extern int del_timer(struct timer_list * timer); + struct tvec_t_base_s *base; +} timer_t; +extern void add_timer(timer_t * timer); +extern int del_timer(timer_t * timer); + #ifdef CONFIG_SMP -extern int del_timer_sync(struct timer_list * timer); +extern int del_timer_sync(timer_t * timer); +extern void sync_timers(void); +#define timer_enter(base, t) do { base->running_timer = t; mb(); } while (0) +#define timer_exit(base) do { base->running_timer = NULL; } while (0) +#define timer_is_running(base,t) (base->running_timer == t) +#define timer_synchronize(base,t) while (timer_is_running(base,t)) barrier() #else #define del_timer_sync(t) del_timer(t) +#define sync_timers() do { } while (0) +#define timer_enter(base,t) do { } while (0) +#define timer_exit(base) do { } while (0) #endif - + /* * mod_timer is a more efficient way to update the expire field of an * active timer (if the timer is inactive it will be activated) @@ -37,16 +50,20 @@ extern int del_timer_sync(struct timer_list * timer); * If the timer is known to be not pending (ie, in the handler), mod_timer * is less efficient than a->expires = b; add_timer(a). */ -int mod_timer(struct timer_list *timer, unsigned long expires); +int mod_timer(timer_t *timer, unsigned long expires); extern void it_real_fn(unsigned long); -static inline void init_timer(struct timer_list * timer) +extern void init_timers(void); +extern void run_local_timers(void); + +static inline void init_timer(timer_t * timer) { timer->list.next = timer->list.prev = NULL; + timer->base = NULL; } -static inline int timer_pending (const struct timer_list * timer) +static inline int timer_pending(const timer_t * timer) { return timer->list.next != NULL; } diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index d4729c518f22..cca0b193617b 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -1,13 +1,12 @@ /* * tqueue.h --- task queue handling for Linux. * - * Mostly based on a proposed bottom-half replacement code written by - * Kai Petzke, wpp@marie.physik.tu-berlin.de. + * Modified version of previous incarnations of task-queues, + * written by: * + * (C) 1994 Kai Petzke, wpp@marie.physik.tu-berlin.de * Modified for use in the Linux kernel by Theodore Ts'o, - * tytso@mit.edu. Any bugs are my fault, not Kai's. - * - * The original comment follows below. + * tytso@mit.edu. */ #ifndef _LINUX_TQUEUE_H @@ -18,25 +17,8 @@ #include <linux/bitops.h> #include <asm/system.h> -/* - * New proposed "bottom half" handlers: - * (C) 1994 Kai Petzke, wpp@marie.physik.tu-berlin.de - * - * Advantages: - * - Bottom halfs are implemented as a linked list. You can have as many - * of them, as you want. - * - No more scanning of a bit field is required upon call of a bottom half. - * - Support for chained bottom half lists. The run_task_queue() function can be - * used as a bottom half handler. This is for example useful for bottom - * halfs, which want to be delayed until the next clock tick. - * - * Notes: - * - Bottom halfs are called in the reverse order that they were linked into - * the list. - */ - struct tq_struct { - struct list_head list; /* linked list of active bh's */ + struct list_head list; /* linked list of active tq's */ unsigned long sync; /* must be initialized to zero */ void (*routine)(void *); /* function to call */ void *data; /* argument to function */ @@ -61,68 +43,13 @@ struct tq_struct { PREPARE_TQUEUE((_tq), (_routine), (_data)); \ } while (0) -typedef struct list_head task_queue; - #define DECLARE_TASK_QUEUE(q) LIST_HEAD(q) -#define TQ_ACTIVE(q) (!list_empty(&q)) - -extern task_queue tq_timer, tq_immediate; - -/* - * To implement your own list of active bottom halfs, use the following - * two definitions: - * - * DECLARE_TASK_QUEUE(my_tqueue); - * struct tq_struct my_task = { - * routine: (void (*)(void *)) my_routine, - * data: &my_data - * }; - * - * To activate a bottom half on a list, use: - * - * queue_task(&my_task, &my_tqueue); - * - * To later run the queued tasks use - * - * run_task_queue(&my_tqueue); - * - * This allows you to do deferred processing. For example, you could - * have a task queue called tq_timer, which is executed within the timer - * interrupt. - */ - -extern spinlock_t tqueue_lock; - -/* - * Queue a task on a tq. Return non-zero if it was successfully - * added. - */ -static inline int queue_task(struct tq_struct *bh_pointer, task_queue *bh_list) -{ - int ret = 0; - if (!test_and_set_bit(0,&bh_pointer->sync)) { - unsigned long flags; - spin_lock_irqsave(&tqueue_lock, flags); - list_add_tail(&bh_pointer->list, bh_list); - spin_unlock_irqrestore(&tqueue_lock, flags); - ret = 1; - } - return ret; -} /* Schedule a tq to run in process context */ extern int schedule_task(struct tq_struct *task); -/* - * Call all "bottom halfs" on a given list. - */ - -extern void __run_task_queue(task_queue *list); +/* finish all currently pending tasks - do not call from irq context */ +extern void flush_scheduled_tasks(void); -static inline void run_task_queue(task_queue *list) -{ - if (TQ_ACTIVE(*list)) - __run_task_queue(list); -} +#endif -#endif /* _LINUX_TQUEUE_H */ diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index 51a74dff1541..738ffcd53264 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -19,7 +19,7 @@ _INLINE_ void tty_insert_flip_char(struct tty_struct *tty, _INLINE_ void tty_schedule_flip(struct tty_struct *tty) { - queue_task(&tty->flip.tqueue, &tq_timer); + schedule_task(&tty->flip.tqueue); } #undef _INLINE_ diff --git a/include/net/sock.h b/include/net/sock.h index da47601e4290..51ce0de50c43 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -309,7 +309,8 @@ static __inline__ void sock_prot_dec_use(struct proto *prot) extern void __lock_sock(struct sock *sk); extern void __release_sock(struct sock *sk); #define lock_sock(__sk) \ -do { spin_lock_bh(&((__sk)->lock.slock)); \ +do { might_sleep(); \ + spin_lock_bh(&((__sk)->lock.slock)); \ if ((__sk)->lock.users != 0) \ __lock_sock(__sk); \ (__sk)->lock.users = 1; \ diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 29856ae3ec5a..825d1cc56625 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -127,6 +127,14 @@ #define AC97_CSR_SPECF_DATA 0x6e /* Special Feature Data */ #define AC97_CSR_BDI_STATUS 0x7a /* BDI Status */ +/* specific - Conexant */ +#define AC97_CXR_AUDIO_MISC 0x5c +#define AC97_CXR_SPDIFEN (1<<3) +#define AC97_CXR_COPYRGT (1<<2) +#define AC97_CXR_SPDIF_MASK (3<<0) +#define AC97_CXR_SPDIF_PCM 0x0 +#define AC97_CXR_SPDIF_AC3 0x2 + /* ac97->scaps */ #define AC97_SCAP_SURROUND_DAC (1<<0) /* surround L&R DACs are present */ #define AC97_SCAP_CENTER_LFE_DAC (1<<1) /* center and LFE DACs are present */ @@ -135,6 +143,7 @@ #define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */ #define AC97_AD_MULTI (1<<1) /* Analog Devices - multi codecs */ #define AC97_CS_SPDIF (1<<2) /* Cirrus Logic uses funky SPDIF */ +#define AC97_CX_SPDIF (1<<3) /* Conexant's spdif interface */ /* @@ -143,6 +152,7 @@ typedef struct _snd_ac97 ac97_t; struct _snd_ac97 { + void (*reset) (ac97_t *ac97); void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); unsigned short (*read) (ac97_t *ac97, unsigned short reg); void (*wait) (ac97_t *ac97); @@ -169,6 +179,7 @@ struct _snd_ac97 { unsigned int rates_mic_adc; unsigned int spdif_status; unsigned short regs[0x80]; /* register cache */ + unsigned int limited_regs; /* allow limited registers only */ bitmap_member(reg_accessed,0x80); /* bit flags */ union { /* vendor specific code */ struct { diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h index 5c57c10a8b5d..f1f54430f54f 100644 --- a/include/sound/asequencer.h +++ b/include/sound/asequencer.h @@ -257,7 +257,7 @@ struct sndrv_seq_ev_raw32 { struct sndrv_seq_ev_ext { unsigned int len; /* length of data */ void *ptr; /* pointer to data (note: maybe 64-bit) */ -}; +} __attribute__((packed)); /* Instrument cluster type */ typedef unsigned int sndrv_seq_instr_cluster_t; @@ -373,7 +373,7 @@ struct sndrv_seq_ev_quote { struct sndrv_seq_addr origin; /* original sender */ unsigned short value; /* optional data */ struct sndrv_seq_event *event; /* quoted event */ -}; +} __attribute__((packed)); /* sequencer event */ @@ -486,6 +486,16 @@ struct sndrv_seq_system_info { }; + /* system running information */ +struct sndrv_seq_running_info { + unsigned char client; /* client id */ + unsigned char big_endian; /* 1 = big-endian */ + unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ + unsigned char pad; /* reserved */ + unsigned char reserved[12]; +}; + + /* known client numbers */ #define SNDRV_SEQ_CLIENT_SYSTEM 0 #define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */ @@ -609,7 +619,6 @@ struct sndrv_seq_port_info { int write_use; /* R/O: subscribers for input (to this port) */ void *kernel; /* reserved for kernel use (must be NULL) */ - unsigned int flags; /* misc. conditioning */ char reserved[60]; /* for future use */ }; @@ -853,6 +862,7 @@ struct sndrv_seq_instr_cluster_get { #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info) +#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info) #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info) #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info) diff --git a/include/sound/asound.h b/include/sound/asound.h index a9133aaa887e..86685e7ae9e7 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -128,7 +128,7 @@ enum { * * *****************************************************************************/ -#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1) +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2) typedef unsigned long sndrv_pcm_uframes_t; typedef long sndrv_pcm_sframes_t; @@ -191,7 +191,19 @@ enum sndrv_pcm_format { SNDRV_PCM_FORMAT_MPEG, SNDRV_PCM_FORMAT_GSM, SNDRV_PCM_FORMAT_SPECIAL = 31, - SNDRV_PCM_FORMAT_LAST = 31, + SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */ + SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */ + SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */ + SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */ + SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */ + SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */ + SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */ + SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */ + SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */ + SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */ + SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */ + SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */ + SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE, #ifdef SNDRV_LITTLE_ENDIAN SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE, @@ -284,7 +296,7 @@ enum sndrv_pcm_hw_param { SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */ SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT, - SNDRV_PCM_HW_PARAM_SAMPLE_BITS, /* Bits per sample */ + SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */ SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */ SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */ @@ -298,8 +310,7 @@ enum sndrv_pcm_hw_param { SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */ SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */ SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */ - SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME, - SNDRV_PCM_HW_PARAM_LAST = SNDRV_PCM_HW_PARAM_LAST_INTERVAL, + SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME }; #define SNDRV_PCM_HW_PARAMS_RUNTIME (1<<0) @@ -312,20 +323,28 @@ struct sndrv_interval { empty:1; }; +#define SNDRV_MASK_MAX 256 + +struct sndrv_mask { + u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; +}; + struct sndrv_pcm_hw_params { unsigned int flags; - unsigned int masks[SNDRV_PCM_HW_PARAM_LAST_MASK - - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; + struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - + SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; + struct sndrv_mask mres[5]; /* reserved masks */ struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; - unsigned int rmask; - unsigned int cmask; + struct sndrv_interval ires[9]; /* reserved intervals */ + unsigned int rmask; /* W: requested masks */ + unsigned int cmask; /* R: changed masks */ unsigned int info; /* R: Info flags for returned setup */ unsigned int msbits; /* R: used most significant bits */ unsigned int rate_num; /* R: rate numerator */ unsigned int rate_den; /* R: rate denominator */ sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ - unsigned char reserved[64]; + unsigned char reserved[64]; /* reserved for future */ }; enum sndrv_pcm_tstamp { @@ -345,7 +364,7 @@ struct sndrv_pcm_sw_params { sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ sndrv_pcm_uframes_t silence_size; /* silence block size */ sndrv_pcm_uframes_t boundary; /* pointers wrap point */ - unsigned char reserved[64]; + unsigned char reserved[64]; /* reserved for future */ }; struct sndrv_pcm_channel_info { diff --git a/include/sound/core.h b/include/sound/core.h index 0e2285d86b4a..02ba0c0b0e91 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -243,8 +243,10 @@ void snd_hidden_vfree(void *obj); #define kfree_nocheck(obj) snd_wrapper_kfree(obj) #define vmalloc(size) snd_hidden_vmalloc(size) #define vfree(obj) snd_hidden_vfree(obj) +#define vfree_nocheck(obj) snd_wrapper_vfree(obj) #else #define kfree_nocheck(obj) kfree(obj) +#define vfree_nocheck(obj) vfree(obj) #endif void *snd_kcalloc(size_t size, int flags); char *snd_kmalloc_strdup(const char *string, int flags); diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h index 08f62c25df32..e4b0eb891e08 100644 --- a/include/sound/cs46xx.h +++ b/include/sound/cs46xx.h @@ -26,6 +26,7 @@ #include "pcm.h" #include "rawmidi.h" #include "ac97_codec.h" +#include "cs46xx_dsp_spos.h" #ifndef PCI_VENDOR_ID_CIRRUS #define PCI_VENDOR_ID_CIRRUS 0x1013 @@ -194,6 +195,81 @@ #define BA1_FRSC 0x00030038 #define BA1_OMNI_MEM 0x000E0000 + + + +/* + * The following define the offsets of the AC97 shadow registers, which appear + * as a virtual extension to the base address register zero memory range. + */ +#define AC97_REG_OFFSET_MASK 0x0000007EL +#define AC97_CODEC_NUMBER_MASK 0x00003000L + +#define BA0_AC97_RESET 0x00001000L +#define BA0_AC97_MASTER_VOLUME 0x00001002L +#define BA0_AC97_HEADPHONE_VOLUME 0x00001004L +#define BA0_AC97_MASTER_VOLUME_MONO 0x00001006L +#define BA0_AC97_MASTER_TONE 0x00001008L +#define BA0_AC97_PC_BEEP_VOLUME 0x0000100AL +#define BA0_AC97_PHONE_VOLUME 0x0000100CL +#define BA0_AC97_MIC_VOLUME 0x0000100EL +#define BA0_AC97_LINE_IN_VOLUME 0x00001010L +#define BA0_AC97_CD_VOLUME 0x00001012L +#define BA0_AC97_VIDEO_VOLUME 0x00001014L +#define BA0_AC97_AUX_VOLUME 0x00001016L +#define BA0_AC97_PCM_OUT_VOLUME 0x00001018L +#define BA0_AC97_RECORD_SELECT 0x0000101AL +#define BA0_AC97_RECORD_GAIN 0x0000101CL +#define BA0_AC97_RECORD_GAIN_MIC 0x0000101EL +#define BA0_AC97_GENERAL_PURPOSE 0x00001020L +#define BA0_AC97_3D_CONTROL 0x00001022L +#define BA0_AC97_MODEM_RATE 0x00001024L +#define BA0_AC97_POWERDOWN 0x00001026L +#define BA0_AC97_EXT_AUDIO_ID 0x00001028L +#define BA0_AC97_EXT_AUDIO_POWER 0x0000102AL +#define BA0_AC97_PCM_FRONT_DAC_RATE 0x0000102CL +#define BA0_AC97_PCM_SURR_DAC_RATE 0x0000102EL +#define BA0_AC97_PCM_LFE_DAC_RATE 0x00001030L +#define BA0_AC97_PCM_LR_ADC_RATE 0x00001032L +#define BA0_AC97_MIC_ADC_RATE 0x00001034L +#define BA0_AC97_6CH_VOL_C_LFE 0x00001036L +#define BA0_AC97_6CH_VOL_SURROUND 0x00001038L +#define BA0_AC97_RESERVED_3A 0x0000103AL +#define BA0_AC97_EXT_MODEM_ID 0x0000103CL +#define BA0_AC97_EXT_MODEM_POWER 0x0000103EL +#define BA0_AC97_LINE1_CODEC_RATE 0x00001040L +#define BA0_AC97_LINE2_CODEC_RATE 0x00001042L +#define BA0_AC97_HANDSET_CODEC_RATE 0x00001044L +#define BA0_AC97_LINE1_CODEC_LEVEL 0x00001046L +#define BA0_AC97_LINE2_CODEC_LEVEL 0x00001048L +#define BA0_AC97_HANDSET_CODEC_LEVEL 0x0000104AL +#define BA0_AC97_GPIO_PIN_CONFIG 0x0000104CL +#define BA0_AC97_GPIO_PIN_TYPE 0x0000104EL +#define BA0_AC97_GPIO_PIN_STICKY 0x00001050L +#define BA0_AC97_GPIO_PIN_WAKEUP 0x00001052L +#define BA0_AC97_GPIO_PIN_STATUS 0x00001054L +#define BA0_AC97_MISC_MODEM_AFE_STAT 0x00001056L +#define BA0_AC97_RESERVED_58 0x00001058L +#define BA0_AC97_CRYSTAL_REV_N_FAB_ID 0x0000105AL +#define BA0_AC97_TEST_AND_MISC_CTRL 0x0000105CL +#define BA0_AC97_AC_MODE 0x0000105EL +#define BA0_AC97_MISC_CRYSTAL_CONTROL 0x00001060L +#define BA0_AC97_LINE1_HYPRID_CTRL 0x00001062L +#define BA0_AC97_VENDOR_RESERVED_64 0x00001064L +#define BA0_AC97_VENDOR_RESERVED_66 0x00001066L +#define BA0_AC97_SPDIF_CONTROL 0x00001068L +#define BA0_AC97_VENDOR_RESERVED_6A 0x0000106AL +#define BA0_AC97_VENDOR_RESERVED_6C 0x0000106CL +#define BA0_AC97_VENDOR_RESERVED_6E 0x0000106EL +#define BA0_AC97_VENDOR_RESERVED_70 0x00001070L +#define BA0_AC97_VENDOR_RESERVED_72 0x00001072L +#define BA0_AC97_VENDOR_RESERVED_74 0x00001074L +#define BA0_AC97_CAL_ADDRESS 0x00001076L +#define BA0_AC97_CAL_DATA 0x00001078L +#define BA0_AC97_VENDOR_RESERVED_7A 0x0000107AL +#define BA0_AC97_VENDOR_ID1 0x0000107CL +#define BA0_AC97_VENDOR_ID2 0x0000107EL + /* * The following defines are for the flags in the host interrupt status * register. @@ -936,9 +1012,10 @@ #define SERACC_CHIP_TYPE_MASK 0x00000001 #define SERACC_CHIP_TYPE_1_03 0x00000000 #define SERACC_CHIP_TYPE_2_0 0x00000001 -#define SERACC_TWO_CODECS 0x00000002 -#define SERACC_MDM 0x00000004 -#define SERACC_HSP 0x00000008 +#define SERACC_TWO_CODECS 0x00000002 +#define SERACC_MDM 0x00000004 +#define SERACC_HSP 0x00000008 +#define SERACC_ODT 0x00000010 /* only CS4630 */ #endif /* @@ -1626,12 +1703,39 @@ #define SAVE_REG_MAX 0x10 #define POWER_DOWN_ALL 0x7f0f +/* maxinum number of AC97 codecs connected, AC97 2.0 defined 4 */ +#define MAX_NR_AC97 4 +#define CS46XX_PRIMARY_CODEC_INDEX 0 +#define CS46XX_SECONDARY_CODEC_INDEX 1 +#define CS46XX_SECONDARY_CODEC_OFFSET 0x80 +#define CS46XX_DSP_CAPTURE_CHANNEL 1 + /* * */ typedef struct _snd_cs46xx cs46xx_t; +typedef struct _snd_cs46xx_pcm_t { + unsigned char *hw_area; + dma_addr_t hw_addr; /* PCI bus address, not accessible */ + unsigned long hw_size; + + unsigned int ctl; + unsigned int shift; /* Shift count to trasform frames in bytes */ + unsigned int sw_bufsize; + unsigned int sw_data; /* Offset to next dst (or src) in sw ring buffer */ + unsigned int sw_io; + int sw_ready; /* Bytes ready to be transferred to/from hw */ + unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */ + unsigned int hw_io; /* Ring buffer hw pointer */ + int hw_ready; /* Bytes ready for play (or captured) in hw ring buffer */ + size_t appl_ptr; /* Last seen appl_ptr */ + snd_pcm_substream_t *substream; + + pcm_channel_descriptor_t * pcm_channel; +} cs46xx_pcm_t; + typedef struct { char name[24]; unsigned long base; @@ -1674,10 +1778,11 @@ struct _snd_cs46xx { int hw_ready; /* Bytes ready for play (or captured) in hw ring buffer */ size_t appl_ptr; /* Last seen appl_ptr */ snd_pcm_substream_t *substream; - } play, capt; + } capt; - ac97_t *ac97; + int nr_ac97_codecs; + ac97_t *ac97[MAX_NR_AC97]; struct pci_dev *pci; snd_card_t *card; @@ -1704,6 +1809,13 @@ struct _snd_cs46xx { #ifdef CONFIG_PM struct pm_dev *pm_dev; #endif + +#ifdef CONFIG_SND_CS46XX_NEW_DSP + dsp_spos_instance_t * dsp_spos_instance; +#else /* for compatibility */ + cs46xx_pcm_t *playback_pcm; + unsigned int play_ctl; +#endif }; int snd_cs46xx_create(snd_card_t *card, diff --git a/include/sound/cs46xx_dsp_scb_types.h b/include/sound/cs46xx_dsp_scb_types.h new file mode 100644 index 000000000000..30457420de51 --- /dev/null +++ b/include/sound/cs46xx_dsp_scb_types.h @@ -0,0 +1,936 @@ +/* + * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards + * Copyright (c) by Jaroslav Kysela <perex@suse.cz> + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * NOTE: comments are copy/paste from cwcemb80.lst + * provided by Tom Woller at Cirrus (my only + * documentation about the SP OS running inside + * the DSP) + */ + +#ifndef __CS46XX_DSP_SCB_TYPES_H__ +#define __CS46XX_DSP_SCB_TYPES_H__ + +/* This structs are used internally by the SP */ + +typedef struct _basic_dma_req_t { + /* DMA Requestor Word 0 (DCW) fields: + + 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0] + _______________________________________________________________________________________ + |S| SBT |D| DBT |wb|wb| | | LS | SS |Opt|Do|SSG|DSG| | | | | | | Dword | + |H|_____ |H|_________|S_|D |__|__|______|_______|___|ne|__ |__ |__|__|_|_|_|_|_Count -1| + */ + u32 dcw; /* DMA Control Word */ + u32 dmw; /* DMA Mode Word */ + u32 saw; /* Source Address Word */ + u32 daw; /* Destination Address Word */ +} basic_dma_req_t; + +typedef struct _scatter_gather_ext_t { + u32 npaw; /* Next-Page Address Word */ + + /* DMA Requestor Word 5 (NPCW) fields: + + 31-30 29 28 [27:16] [15:12] [11:3] [2:0] + _________________________________________________________________________________________ + |SV |LE|SE| Sample-end byte offset | | Page-map entry offset for next | | + |page|__|__| ___________________________|_________|__page, if !sample-end___________|____| + */ + u32 npcw; /* Next-Page Control Word */ + u32 lbaw; /* Loop-Begin Address Word */ + u32 nplbaw; /* Next-Page after Loop-Begin Address Word */ + u32 sgaw; /* Scatter/Gather Address Word */ +} scatter_gather_ext_t; + +typedef struct _volume_control_t { + u16 rightTarg; /* Target volume for left & right channels */ + u16 leftTarg; + + u16 rightVol; /* Current left & right channel volumes */ + u16 leftVol; +} volume_control_t; + +/* Generic stream control block (SCB) structure definition */ +typedef struct _generic_scb_t { + /* For streaming I/O, the DSP should never alter any words in the DMA + requestor or the scatter/gather extension. Only ad hoc DMA request + streams are free to alter the requestor (currently only occur in the + DOS-based MIDI controller and in debugger-inserted code). + + If an SCB does not have any associated DMA requestor, these 9 ints + may be freed for use by other tasks, but the pointer to the SCB must + still be such that the insOrd:nextSCB appear at offset 9 from the + SCB pointer. + + Basic (non scatter/gather) DMA requestor (4 ints) + */ + + /* Initialized by the host, only modified by DMA + R/O for the DSP task */ + basic_dma_req_t basic_req; /* Optional */ + + /* Scatter/gather DMA requestor extension (5 ints) + Initialized by the host, only modified by DMA + DSP task never needs to even read these. + */ + scatter_gather_ext_t sg_ext; /* Optional */ + + /* Sublist pointer & next stream control block (SCB) link. + Initialized & modified by the host R/O for the DSP task + */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + + /* Pointer to this tasks parameter block & stream function pointer + Initialized by the host R/O for the DSP task */ + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + + /* rsConfig register for stream buffer (rsDMA reg. + is loaded from basicReq.daw for incoming streams, or + basicReq.saw, for outgoing streams) + + 31 30 29 [28:24] [23:16] 15 14 13 12 11 10 9 8 7 6 5 4 [3:0] + ______________________________________________________________________________ + |DMA |D|maxDMAsize| streamNum|dir|p| | | | | | |ds |shr 1|rev Cy | mod | + |prio |_|__________|__________|___|_|__|__|__|__|_|_|___|_____|_______|_______| + 31 30 29 [28:24] [23:16] 15 14 13 12 11 10 9 8 7 6 5 4 [3:0] + + + Initialized by the host R/O for the DSP task + */ + u32 strm_rs_config; /* REQUIRED */ + // + /* On mixer input streams: indicates mixer input stream configuration + On Tees, this is copied from the stream being snooped + + Stream sample pointer & MAC-unit mode for this stream + + Initialized by the host Updated by the DSP task + */ + u32 strm_buf_ptr; /* REQUIRED */ + + /* On mixer input streams: points to next mixer input and is updated by the + mixer subroutine in the "parent" DSP task + (least-significant 16 bits are preserved, unused) + + On Tees, the pointer is copied from the stream being snooped on + initialization, and, subsequently, it is copied into the + stream being snooped. + + On wavetable/3D voices: the strmBufPtr will use all 32 bits to allow for + fractional phase accumulation + + Fractional increment per output sample in the input sample buffer + + (Not used on mixer input streams & redefined on Tees) + On wavetable/3D voices: this 32-bit word specifies the integer.fractional + increment per output sample. + */ + u32 strmPhiIncr; + + + /* Standard stereo volume control + Initialized by the host (host updates target volumes) + + Current volumes update by the DSP task + On mixer input streams: required & updated by the mixer subroutine in the + "parent" DSP task + + On Tees, both current & target volumes are copied up on initialization, + and, subsequently, the target volume is copied up while the current + volume is copied down. + + These two 32-bit words are redefined for wavetable & 3-D voices. + */ + volume_control_t vol_ctrl_t; /* Optional */ +} generic_scb_t; + + +typedef struct _spos_control_block_t { + /* WARNING: Certain items in this structure are modified by the host + Any dword that can be modified by the host, must not be + modified by the SP as the host can only do atomic dword + writes, and to do otherwise, even a read modify write, + may lead to corrupted data on the SP. + + This rule does not apply to one off boot time initialisation prior to starting the SP + */ + + + /* First element on the Hyper forground task tree */ + u16 hfg_tree_root_ptr; /* HOST */ + /* First 3 dwords are written by the host and read-only on the DSP */ + u16 hfg_stack_base; /* HOST */ + + /* Point to this data structure to enable easy access */ + u16 spos_cb_ptr; /* SP */ + u16 prev_task_tree_ptr; /* SP && HOST */ + + + /* Currently Unused */ + u16 xxinterval_timer_period; + /* Enable extension of SPOS data structure */ + u16 HFGSPB_ptr; + + + u16 xxnum_HFG_ticks_thisInterval; + /* Modified by the DSP */ + u16 xxnum_tntervals; + + + /* Set by DSP upon encountering a trap (breakpoint) or a spurious + interrupt. The host must clear this dword after reading it + upon receiving spInt1. */ + u16 spurious_int_flag; /* (Host & SP) Nature of the spurious interrupt */ + u16 trap_flag; /* (Host & SP) Nature of detected Trap */ + + + u16 unused2; + u16 invalid_IP_flag; /* (Host & SP ) Indicate detection of invalid instruction pointer */ + + + /* pointer to forground task tree header for use in next task search */ + u16 fg_task_tree_hdr_ptr; /* HOST */ + /* Data structure for controlling synchronous link update */ + u16 hfg_sync_update_ptr; /* HOST */ + + u16 begin_foreground_FCNT; /* SP */ + /* Place holder for holding sleep timing */ + u16 last_FCNT_before_sleep; /* SP */ + + u16 unused7; /* SP */ + u16 next_task_treePtr; /* SP */ + + u32 nused5; + + u16 active_flags; /* SP */ + /* State flags, used to assist control of execution of Hyper Forground */ + u16 HFG_flags; /* SP */ + + u16 unused9; + u16 unused8; + + /* Space for saving enough context so that we can set up enough + to save some more context. + */ + u32 rFE_save_for_invalid_IP; + u32 r32_save_for_spurious_int; + u32 r32_save_for_trap; + u32 r32_save_for_HFG; +} spos_control_block_t; + +/* SPB for MIX_TO_OSTREAM algorithm family */ +typedef struct _mix2_ostream_spb_t +{ + /* 16b.16b integer.frac approximation to the + number of 3 sample triplets to output each + frame. (approximation must be floor, to + insure that the fractional error is always + positive) + */ + long outTripletsPerFrame; + + /* 16b.16b integer.frac accumulated number of + output triplets since the start of group + */ + long accumOutTriplets; +} mix2_ostream_spb_t; + +/* SCB for Timing master algorithm */ +typedef struct _timing_master_scb_t { + /* First 12 dwords from generic_scb_t */ + basic_dma_req_t basic_req; /* Optional */ + scatter_gather_ext_t sg_ext; /* Optional */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + + /* Initial values are 0000:xxxx */ + u16 reserved; + u16 extra_sample_accum; + + + /* Initial values are xxxx:0000 + hi: Current CODEC output FIFO pointer + (0 to 0x0f) + lo: Flag indicating that the CODEC + FIFO is sync'd (host clears to + resynchronize the FIFO pointer + upon start/restart) + */ + u16 codec_FIFO_syncd; + u16 codec_FIFO_ptr; + + + /* Init. 8000:0005 for 44.1k + 8000:0001 for 48k + hi: Fractional sample accumulator 0.16b + lo: Number of frames remaining to be + processed in the current group of + frames + */ + u16 frac_samp_accum_qm1; + u16 TM_frms_left_in_group; + + /* Init. 0001:0005 for 44.1k + 0000:0001 for 48k + hi: Fractional sample correction factor 0.16b + to be added every frameGroupLength frames + to correct for truncation error in + nsamp_per_frm_q15 + lo: Number of frames in the group + */ + u16 frac_samp_correction_qm1; + u16 TM_frm_group_length; + + /* Init. 44.1k*65536/8k = 0x00058333 for 44.1k + 48k*65536/8k = 0x00060000 for 48k + 16b.16b integer.frac approximation to the + number of samples to output each frame. + (approximation must be floor, to insure */ + u32 nsamp_per_frm_q15; +} timing_master_scb_t; + +/* SCB for CODEC output algorithm */ +typedef struct _codec_output_scb_t { + /* First 13 dwords from generic_scb_t */ + basic_dma_req_t basic_req; /* Optional */ + scatter_gather_ext_t sg_ext; /* Optional */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + u32 strm_rs_config; /* REQUIRED */ + u32 strm_buf_ptr; /* REQUIRED */ + + /* NOTE: The CODEC output task reads samples from the first task on its + sublist at the stream buffer pointer (init. to lag DMA destination + address word). After the required number of samples is transferred, + the CODEC output task advances sub_list_ptr->strm_buf_ptr past the samples + consumed. + */ + + /* Init. 0000:0010 for SDout + 0060:0010 for SDout2 + 0080:0010 for SDout3 + hi: Base IO address of FIFO to which + the left-channel samples are to + be written. + lo: Displacement for the base IO + address for left-channel to obtain + the base IO address for the FIFO + to which the right-channel samples + are to be written. + */ + u16 left_chan_base_IO_addr; + u16 right_chan_IO_disp; + + + /* Init: 0x0080:0004 for non-AC-97 + Init: 0x0080:0000 for AC-97 + hi: Exponential volume change rate + for input stream + lo: Positive shift count to shift the + 16-bit input sample to obtain the + 32-bit output word + */ + u16 CO_scale_shift_count; + u16 CO_exp_vol_change_rate; + + /* Pointer to SCB at end of input chain */ + u16 reserved; + u16 last_sub_ptr; +} codec_output_scb_t; + +/* SCB for CODEC input algorithm */ +typedef struct _codec_input_scb_t { + /* First 13 dwords from generic_scb_t */ + basic_dma_req_t basic_req; /* Optional */ + scatter_gather_ext_t sg_ext; /* Optional */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + u32 strm_rs_config; /* REQUIRED */ + u32 strm_buf_ptr; /* REQUIRED */ + + /* NOTE: The CODEC input task reads samples from the hardware FIFO + sublist at the DMA source address word (sub_list_ptr->basic_req.saw). + After the required number of samples is transferred, the CODEC + output task advances sub_list_ptr->basic_req.saw past the samples + consumed. SPuD must initialize the sub_list_ptr->basic_req.saw + to point half-way around from the initial sub_list_ptr->strm_nuf_ptr + to allow for lag/lead. + */ + + /* Init. 0000:0010 for SDout + 0060:0010 for SDout2 + 0080:0010 for SDout3 + hi: Base IO address of FIFO to which + the left-channel samples are to + be written. + lo: Displacement for the base IO + address for left-channel to obtain + the base IO address for the FIFO + to which the right-channel samples + are to be written. + */ + u16 rightChanINdisp; + u16 left_chan_base_IN_addr; + + /* Init. ?:fffc + lo: Negative shift count to shift the + 32-bit input dword to obtain the + 16-bit sample msb-aligned (count + is negative to shift left) + */ + u16 scaleShiftCount; + u16 reserver1; + + u32 reserved2; +} codec_input_scb_t; + + +typedef struct _pcm_serial_input_scb_t { + /* First 13 dwords from generic_scb_t */ + basic_dma_req_t basic_req; /* Optional */ + scatter_gather_ext_t sg_ext; /* Optional */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + u32 strm_buf_ptr; /* REQUIRED */ + u32 strm_rs_config; /* REQUIRED */ + + /* Init. Ptr to CODEC input SCB + hi: Pointer to the SCB containing the + input buffer to which CODEC input + samples are written + lo: Flag indicating the link to the CODEC + input task is to be initialized + */ + u16 init_codec_input_link; + u16 codec_input_buf_scb; + + /* Initialized by the host (host updates target volumes) */ + volume_control_t psi_vol_ctrl; + +} pcm_serial_input_scb_t; + +typedef struct _src_task_scb_t { + u16 frames_left_in_gof; + u16 gofs_left_in_sec; + + u16 const2_thirds; + u16 num_extra_tnput_samples; + + u16 cor_per_gof; + u16 correction_per_sec; + + u16 output_buf_producer_ptr; + u16 junk_DMA_MID; + + u16 gof_length; + u16 gofs_per_sec; + + u32 input_buf_strm_config; + + u16 reserved_for_SRC_use; + u16 input_buf_consumer_ptr; + + u32 accum_phi; + + u16 exp_src_vol_change_rate; + u16 input_buf_producer_ptr; + + u16 src_next_scb; + u16 src_sub_list_ptr; + + u16 src_entry_point; + u16 src_this_sbp; + + u32 src_strm_rs_config; + u32 src_strm_buf_ptr; + + u32 phiIncr6int_26frac; + + volume_control_t src_vol_ctrl; +} src_task_scb_t; + +typedef struct _decimate_by_pow2_scb_t { + /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory + when compared to cascading decimators) + */ + u16 dec2_coef_base_ptr; + u16 dec2_coef_increment; + /* coefIncrement = 128 / decimationFactor (for our ROM filter) + coefBasePtr = 0x8000 (for our ROM filter) + */ + + u16 dec2_in_samples_per_out_triplet; + u16 dec2_extra_in_samples; + /* extraInSamples: # of accumulated, unused input samples (init. to 0) + inSamplesPerOutTriplet = 3 * decimationFactor + */ + + u16 dec2_const2_thirds; + u16 dec2_half_num_taps_mp5; + /* halfNumTapsM5: (1/2 number of taps in decimation filter) minus 5 + const2thirds: constant 2/3 in 16Q0 format (sign.15) + */ + + u16 dec2_output_buf_producer_ptr; + u16 dec2_junkdma_mid; + + u32 dec2_reserved2; + + u32 dec2_input_nuf_strm_config; + /* inputBufStrmConfig: rsConfig for the input buffer to the decimator + (buffer size = decimationFactor * 32 dwords) + */ + + u16 dec2_phi_incr; + u16 dec2_input_buf_consumer_ptr; + /* inputBufConsumerPtr: Input buffer read pointer (into SRC filter) + phiIncr = decimationFactor * 4 + */ + + u32 dec2_reserved3; + + u16 dec2_exp_vol_change_rate; + u16 dec2_input_buf_producer_ptr; + /* inputBufProducerPtr: Input buffer write pointer + expVolChangeRate: Exponential volume change rate for possible + future mixer on input streams + */ + + u16 dec2_next_scb; + u16 dec2_sub_list_ptr; + + u16 dec2_entry_point; + u16 dec2_this_spb; + + u32 dec2_strm_rs_config; + u32 dec2_strm_buf_ptr; + + u32 dec2_reserved4; + + volume_control_t dec2_vol_ctrl; /* Not used! */ +} decimate_by_pow2_scb_t; + +typedef struct _vari_decimate_scb_t { + u16 vdec_frames_left_in_gof; + u16 vdec_gofs_left_in_sec; + + u16 vdec_const2_thirds; + u16 vdec_extra_in_samples; + /* extraInSamples: # of accumulated, unused input samples (init. to 0) + const2thirds: constant 2/3 in 16Q0 format (sign.15) */ + + u16 vdec_cor_per_gof; + u16 vdec_correction_per_sec; + + u16 vdec_output_buf_producer_ptr; + u16 vdec_input_buf_consumer_ptr; + /* inputBufConsumerPtr: Input buffer read pointer (into SRC filter) */ + + u16 vdec_gof_length; + u16 vdec_gofs_per_sec; + + u32 vdec_input_buf_strm_config; + /* inputBufStrmConfig: rsConfig for the input buffer to the decimator + (buffer size = 64 dwords) */ + long vdec_coef_increment; + /* coefIncrement = - 128.0 / decimationFactor (as a 32Q15 number) */ + + long vdec_accumphi; + /* accumPhi: accumulated fractional phase increment (6.26) */ + + u16 vdec_exp_vol_change_rate; + u16 vdec_input_buf_producer_ptr; + /* inputBufProducerPtr: Input buffer write pointer + expVolChangeRate: Exponential volume change rate for possible + future mixer on input streams */ + + u16 vdec_next_scb; + u16 vdec_sub_list_ptr; + + u16 vdec_entry_point; + u16 vdec_this_spb; + + u32 vdec_strm_rs_config; + u32 vdec_strm_buf_ptr; + + u32 vdec_phi_incr_6int_26frac; + + volume_control_t vdec_vol_ctrl; +} vari_decimate_scb_t; + + +/* SCB for MIX_TO_OSTREAM algorithm family */ +typedef struct _mix2_ostream_scb_t { + /* First 13 dwords from generic_scb_t */ + basic_dma_req_t basic_req; /* Optional */ + scatter_gather_ext_t sg_ext; /* Optional */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + u32 strm_rs_config; /* REQUIRED */ + u32 strm_buf_ptr; /* REQUIRED */ + + + /* hi: Number of mixed-down input triplets + computed since start of group + lo: Number of frames remaining to be + processed in the current group of + frames + */ + u16 frames_left_in_group; + u16 accum_input_triplets; + + /* hi: Exponential volume change rate + for mixer on input streams + lo: Number of frames in the group + */ + u16 frame_group_length; + u16 exp_vol_change_rate; + + u16 const_FFFF; + u16 const_zero; +} mix2_ostream_scb_t; + + +/* SCB for S16_MIX algorithm */ +typedef struct _mix_only_scb_t { + /* First 13 dwords from generic_scb_t */ + basic_dma_req_t basic_req; /* Optional */ + scatter_gather_ext_t sg_ext; /* Optional */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + u32 strm_rs_config; /* REQUIRED */ + u32 strm_buf_ptr; /* REQUIRED */ + + u32 reserved; + volume_control_t vol_ctrl; +} mix_only_scb_t; + +/* SCB for the async. CODEC input algorithm */ +typedef struct _async_codec_input_scb_t { + u32 io_free2; + + u32 io_current_total; + u32 io_previous_total; + + u16 io_count; + u16 io_count_limit; + + u16 o_fifo_base_addr; + u16 ost_mo_format; + /* 1 = stereo; 0 = mono + xxx for ASER 1 (not allowed); 118 for ASER2 */ + + u32 ostrm_rs_config; + u32 ostrm_buf_ptr; + + u16 io_sclks_per_lr_clk; + u16 io_io_enable; + + u32 io_free4; + + u16 io_next_scb; + u16 io_sub_list_ptr; + + u16 io_entry_point; + u16 io_this_spb; + + u32 istrm_rs_config; + u32 istrm_buf_ptr; + + /* Init. 0000:8042: for ASER1 + 0000:8044: for ASER2 */ + u16 io_stat_reg_addr; + u16 iofifo_pointer; + + /* Init 1 stero:100 ASER1 + Init 0 mono:110 ASER2 + */ + u16 ififo_base_addr; + u16 ist_mo_format; + + u32 i_free; +} async_codec_input_scb_t; + + +/* SCB for the SP/DIF CODEC input and output */ +typedef struct _spdifiscb_t { + u16 status_ptr; + u16 status_start_ptr; + + u32 current_total; + u32 previous_total; + + u16 count; + u16 count_limit; + + u32 status_data; + + u16 status; + u16 free4; + + u32 free3; + + u16 free2; + u16 bit_count; + + u32 temp_status; + + u16 next_SCB; + u16 sub_list_ptr; + + u16 entry_point; + u16 this_spb; + + u32 strm_rs_config; + u32 strm_buf_ptr; + + u16 stat_reg_addr; + u16 fifo_pointer; + + u16 fifo_base_addr; + u16 st_mo_format; + + u32 Free1; +} spdifiscb_t; + + +/* SCB for the SP/DIF CODEC input and output */ +typedef struct _spdifoscb_t { + + + u32 free2; + + u32 free3[4]; + + /* Need to be here for compatibility with AsynchFGTxCode */ + u32 strm_rs_config; + + u32 strm_buf_ptr; + + u16 status; + u16 free5; + + u32 free4; + + u16 next_scb; + u16 sub_list_ptr; + + u16 entry_point; + u16 this_spb; + + u32 free6[2]; + + u16 stat_reg_addr; + u16 fifo_pointer; + + u16 fifo_base_addr; + u16 st_mo_format; + + u32 free1; +} spdifoscb_t; + + + +typedef struct _asynch_fg_rx_scb_t { + + u16 bot_buf_mask; + u16 buf_Mask; + + u16 max; + u16 min; + + u16 old_producer_pointer; + u16 hfg_scb_ptr; + + u16 delta; + u16 adjust_count; + + u32 unused2[5]; + + u16 sibling_ptr; + u16 child_ptr; + + u16 code_ptr; + u16 this_ptr; + + u32 strm_rs_config; + + u32 strm_buf_ptr; + + u32 unused_phi_incr; + + u16 righttarg; + u16 left_targ; + + u16 rightVol; + u16 leftVol; +} asynch_fg_rx_scb_t; + + + +typedef struct _asynch_fg_tx_scb_t { + u16 not_buf_mask; + u16 buf_mask; + + u16 Max; + u16 min; + + u16 unused1; + u16 hfg_scb_ptr; + + u16 delta; + u16 adjust_count; + + u32 accum_phi; + + u16 unused2; + u16 const_one_third; + + u32 unused3[3]; + + u16 sibling_ptr; + u16 child_ptr; + + u16 codePtr; + u16 this_ptr; + + u32 strm_rs_config; + + u32 strm_buf_ptr; + + u32 phi_incr; + + u16 unused_right_targ; + u16 unused_left_targ; + + u16 unused_right_vol; + u16 unused_left_vol; +} asynch_fg_tx_scb_t; + + +typedef struct _output_snoop_scb_t { + /* First 13 dwords from generic_scb_t */ + basic_dma_req_t basic_req; /* Optional */ + scatter_gather_ext_t sg_ext; /* Optional */ + u16 next_scb; /* REQUIRED */ + u16 sub_list_ptr; /* REQUIRED */ + + u16 entry_point; /* REQUIRED */ + u16 this_spb; /* REQUIRED */ + + u32 strm_rs_config; /* REQUIRED */ + u32 strm_buf_ptr; /* REQUIRED */ + + u16 init_snoop_input_link; + u16 snoop_child_input_scb; + + u32 snoop_input_buf_ptr; + + u16 reserved; + u16 input_scb; +} output_snoop_scb_t; + +typedef struct _spio_write_scb_t { + u16 address1; + u16 address2; + + u32 data1; + + u32 data2; + + u16 address3; + u16 address4; + + u32 data3; + + u32 data4; + + u16 unused1; + u16 data_ptr; + + u32 unused2[2]; + + u16 sibling_ptr; + u16 child_ptr; + + u16 entry_point; + u16 this_ptr; + + u32 unused3[5]; +} spio_write_scb_t; + +typedef struct _magic_snoop_task_t { + u32 i0; + u32 i1; + + u32 strm_buf_ptr1; + + u16 i2; + u16 snoop_scb; + + u32 i3; + u32 i4; + u32 i5; + u32 i6; + + u32 i7; + + u16 next_scb; + u16 sub_list_ptr; + + u16 entry_point; + u16 this_ptr; + + u32 strm_buf_config; + u32 strm_buf_ptr2; + + u32 i8; + + volume_control_t vdec_vol_ctrl; +} magic_snoop_task_t; +#endif /* __DSP_SCB_TYPES_H__ */ diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h new file mode 100644 index 000000000000..a1ae8ebe0bd4 --- /dev/null +++ b/include/sound/cs46xx_dsp_spos.h @@ -0,0 +1,183 @@ +/* + * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards + * Copyright (c) by Jaroslav Kysela <perex@suse.cz> + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __CS46XX_DSP_SPOS_H__ +#define __CS46XX_DSP_SPOS_H__ + +#include "cs46xx_dsp_scb_types.h" +#include "cs46xx_dsp_task_types.h" + +#define SYMBOL_CONSTANT 0x0 +#define SYMBOL_SAMPLE 0x1 +#define SYMBOL_PARAMETER 0x2 +#define SYMBOL_CODE 0x3 + +#define SEGTYPE_SP_PROGRAM 0x00000001 +#define SEGTYPE_SP_PARAMETER 0x00000002 +#define SEGTYPE_SP_SAMPLE 0x00000003 +#define SEGTYPE_SP_COEFFICIENT 0x00000004 + +#define DSP_SPOS_UU 0x0deadul /* unused */ +#define DSP_SPOS_DC 0x0badul /* dont care */ +#define DSP_SPOS_DC_DC 0x0bad0badul /* dont care */ +#define DSP_SPOS_UUUU 0xdeadc0edul /* unused */ +#define DSP_SPOS_UUHI 0xdeadul +#define DSP_SPOS_UULO 0xc0edul +#define DSP_SPOS_DCDC 0x0badf1d0ul /* dont care */ +#define DSP_SPOS_DCDCHI 0x0badul +#define DSP_SPOS_DCDCLO 0xf1d0ul + +#define DSP_MAX_TASK_NAME 60 +#define DSP_MAX_SYMBOL_NAME 100 +#define DSP_MAX_SCB_NAME 60 +#define DSP_MAX_SCB_DESC 200 +#define DSP_MAX_TASK_DESC 50 + +#define DSP_MAX_PCM_CHANNELS 32 +#define DSP_MAX_SRC_NR 6 + +struct _dsp_module_desc_t; + +typedef struct _symbol_entry_t { + u32 address; + char symbol_name[DSP_MAX_SYMBOL_NAME]; + int symbol_type; + + /* initialized by driver */ + struct _dsp_module_desc_t * module; + int deleted; +} symbol_entry_t; + +typedef struct _symbol_desc_t { + int nsymbols; + + symbol_entry_t * symbols; + + /* initialized by driver */ + int highest_frag_index; +} symbol_desc_t; + + +typedef struct _segment_desc_t { + int segment_type; + u32 offset; + u32 size; + u32 * data; +} segment_desc_t; + +typedef struct _dsp_module_desc_t { + char * module_name; + symbol_desc_t symbol_table; + int nsegments; + segment_desc_t * segments; + + /* initialized by driver */ + u32 overlay_begin_address; + u32 load_address; + int nfixups; +} dsp_module_desc_t; + +typedef struct _dsp_scb_descriptor_t { + char scb_name[DSP_MAX_SCB_NAME]; + u32 address; + int index; + + struct _dsp_scb_descriptor_t * sub_list_ptr; + struct _dsp_scb_descriptor_t * next_scb_ptr; + struct _dsp_scb_descriptor_t * parent_scb_ptr; + + symbol_entry_t * task_entry; + symbol_entry_t * scb_symbol; + + snd_info_entry_t *proc_info; + int ref_count; + + int deleted; +} dsp_scb_descriptor_t; + +typedef struct _dsp_task_descriptor_t { + char task_name[DSP_MAX_TASK_NAME]; + int size; + u32 address; + int index; +} dsp_task_descriptor_t; + +typedef struct _pcm_channel_descriptor_t { + int active; + int src_slot; + int pcm_slot; + u32 sample_rate; + u32 unlinked; + dsp_scb_descriptor_t * pcm_reader_scb; + dsp_scb_descriptor_t * src_scb; + + void * private_data; +} pcm_channel_descriptor_t; + +typedef struct _dsp_spos_instance_t { + symbol_desc_t symbol_table; /* currently availble loaded symbols in SP */ + + int nmodules; + dsp_module_desc_t * modules; /* modules loaded into SP */ + + segment_desc_t code; + + /* PCM playback */ + struct semaphore pcm_mutex; + + dsp_scb_descriptor_t * master_mix_scb; + int npcm_channels; + int nsrc_scb; + pcm_channel_descriptor_t pcm_channels[DSP_MAX_PCM_CHANNELS]; + int src_scb_slots[DSP_MAX_SRC_NR]; + + /* cache this symbols */ + symbol_entry_t * null_algorithm; /* used by PCMreaderSCB's */ + symbol_entry_t * s16_up; /* used by SRCtaskSCB's */ + + /* proc fs */ + snd_card_t * snd_card; + snd_info_entry_t * proc_dsp_dir; + snd_info_entry_t * proc_sym_info_entry; + snd_info_entry_t * proc_modules_info_entry; + snd_info_entry_t * proc_parameter_dump_info_entry; + snd_info_entry_t * proc_sample_dump_info_entry; + + /* SCB's descriptors */ + struct semaphore scb_mutex; + int nscb; + int scb_highest_frag_index; + dsp_scb_descriptor_t scbs[DSP_MAX_SCB_DESC]; + snd_info_entry_t * proc_scb_info_entry; + dsp_scb_descriptor_t * the_null_scb; + + /* Task's descriptors */ + int ntask; + dsp_task_descriptor_t tasks[DSP_MAX_TASK_DESC]; + snd_info_entry_t * proc_task_info_entry; + + /* SPDIF status */ + int spdif_status_out; + int spdif_status_in; +} dsp_spos_instance_t; + +#endif /* __DSP_SPOS_H__ */ + diff --git a/include/sound/cs46xx_dsp_task_types.h b/include/sound/cs46xx_dsp_task_types.h new file mode 100644 index 000000000000..b97a65ac01e6 --- /dev/null +++ b/include/sound/cs46xx_dsp_task_types.h @@ -0,0 +1,215 @@ +/* + * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards + * Copyright (c) by Jaroslav Kysela <perex@suse.cz> + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * NOTE: comments are copy/paste from cwcemb80.lst + * provided by Tom Woller at Cirrus (my only + * documentation about the SP OS running inside + * the DSP) + */ + +#ifndef __CS46XX_DSP_TASK_TYPES_H__ +#define __CS46XX_DSP_TASK_TYPES_H__ + +/********************************************************************************************* +Example hierarchy of stream control blocks in the SP + +hfgTree +Ptr____Call (c) + \ + -------+------ ------------- ------------- ------------- ----- +| SBlaster IF |______\| Foreground |___\| Middlegr'nd |___\| Background |___\| Nul | +| |Goto /| tree header |g /| tree header |g /| tree header |g /| SCB |r + -------------- (g) ------------- ------------- ------------- ----- + |c |c |c |c + | | | | + \/ ------------- ------------- ------------- + | Foreground |_\ | Middlegr'nd |_\ | Background |_\ + | tree |g/ | tree |g/ | tree |g/ + ------------- ------------- ------------- + |c |c |c + | | | + \/ \/ \/ + +*********************************************************************************************/ + +#define HFG_FIRST_EXECUTE_MODE 0x0001 +#define HFG_FIRST_EXECUTE_MODE_BIT 0 +#define HFG_CONTEXT_SWITCH_MODE 0x0002 +#define HFG_CONTEXT_SWITCH_MODE_BIT 1 + +#define MAX_FG_STACK_SIZE 32 // THESE NEED TO BE COMPUTED PROPERLY +#define MAX_MG_STACK_SIZE 16 +#define MAX_BG_STACK_SIZE 9 +#define MAX_HFG_STACK_SIZE 4 + +#define SLEEP_ACTIVE_INCREMENT 0 /* Enable task tree thread to go to sleep + This should only ever be used on the Background thread */ +#define STANDARD_ACTIVE_INCREMENT 1 /* Task tree thread normal operation */ +#define SUSPEND_ACTIVE_INCREMENT 2 /* Cause execution to suspend in the task tree thread + This should only ever be used on the Background thread */ + +#define HOSTFLAGS_DISABLE_BG_SLEEP 0 /* Host-controlled flag that determines whether we go to sleep + at the end of BG */ + +/* Minimal context save area for Hyper Forground */ +typedef struct _hf_save_area_t { + u32 r10_save; + u32 r54_save; + u32 r98_save; + + u16 status_save; + u16 ind_save; + + u16 rci1_save; + u16 rci0_save; + + u32 r32_save; + u32 r76_save; + u32 rsd2_save; + + u16 rsi2_save; /* See TaskTreeParameterBlock for + remainder of registers */ + u16 rsa2Save; + /* saved as part of HFG context */ +} hf_save_area_t; + + +/* Task link data structure */ +typedef struct _tree_link_t { + /* Pointer to sibling task control block */ + u16 next_scb; + /* Pointer to child task control block */ + u16 sub_ptr; + + /* Pointer to code entry point */ + u16 entry_point; + /* Pointer to local data */ + u16 this_spb; +} tree_link_t; + + +typedef struct _task_tree_data_t { + /* Initial tock count; controls task tree execution rate */ + u16 tock_count_limit; + /* Tock down counter */ + u16 tock_count; + + /* Add to ActiveCount when TockCountLimit reached: + Subtract on task tree termination */ + u16 active_tncrement; + /* Number of pending activations for task tree */ + u16 active_count; + + /* BitNumber to enable modification of correct bit in ActiveTaskFlags */ + u16 active_bit; + /* Pointer to OS location for indicating current activity on task level */ + u16 active_task_flags_ptr; + + /* Data structure for controlling movement of memory blocks:- + currently unused */ + u16 mem_upd_ptr; + /* Data structure for controlling synchronous link update */ + u16 link_upd_ptr; + + /* Save area for remainder of full context. */ + u16 save_area; + /* Address of start of local stack for data storage */ + u16 data_stack_base_ptr; + +} task_tree_data_t; + + + +typedef struct _interval_timer_data_t +{ + /* These data items have the same relative locations to those */ + u16 interval_timer_period; + u16 itd_unused; + + /* used for this data in the SPOS control block for SPOS 1.0 */ + u16 num_FG_ticks_this_interval; + u16 num_intervals; +} interval_timer_data_t; + + +/* This structure contains extra storage for the task tree + Currently, this additional data is related only to a full context save */ +typedef struct _task_tree_context_block_t { + /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for + The access to the context switch (call or interrupt), and 1 spare that + users should never use. This last may be required by the system */ + u16 stack1; + u16 stack0; + u16 stack3; + u16 stack2; + u16 stack5; + u16 stack4; + u16 stack7; + u16 stack6; + u16 stack9; + u16 stack8; + + u32 saverfe; + + /* Value may be overwriten by stack save algorithm. + Retain the size of the stack data saved here if used */ + u16 reserved1; + u16 stack_size; + u32 saverba; /* (HFG) */ + u32 saverdc; + u32 savers_config_23; /* (HFG) */ + u32 savers_DMA23; /* (HFG) */ + u32 saversa0; + u32 saversi0; + u32 saversa1; + u32 saversi1; + u32 saversa3; + u32 saversd0; + u32 saversd1; + u32 saversd3; + u32 savers_config01; + u32 savers_DMA01; + u32 saveacc0hl; + u32 saveacc1hl; + u32 saveacc0xacc1x; + u32 saveacc2hl; + u32 saveacc3hl; + u32 saveacc2xacc3x; + u32 saveaux0hl; + u32 saveaux1hl; + u32 saveaux0xaux1x; + u32 saveaux2hl; + u32 saveaux3hl; + u32 saveaux2xaux3x; + u32 savershouthl; + u32 savershoutxmacmode; +} task_tree_context_block_t; + + +typedef struct _task_tree_control_block_t { + hf_save_area_t context; + tree_link_t links; + task_tree_data_t data; + task_tree_context_block_t context_blk; + interval_timer_data_t int_timer; +} task_tree_control_block_t; + + +#endif /* __DSP_TASK_TYPES_H__ */ diff --git a/include/sound/driver.h b/include/sound/driver.h index 2a681739e66c..6a7ff07236b0 100644 --- a/include/sound/driver.h +++ b/include/sound/driver.h @@ -50,7 +50,7 @@ */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) -#if defined(__i386__) || defined(__ppc__) +#if defined(__i386__) || defined(__ppc__) || defined(__x86_64__) /* * Here a dirty hack for 2.4 kernels.. See sound/core/memory.c. */ diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index d2704f8301d1..a26031cd7bd6 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -26,6 +26,7 @@ #ifdef __KERNEL__ #include "pcm.h" +#include "pcm_sgbuf.h" #include "rawmidi.h" #include "hwdep.h" #include "ac97_codec.h" @@ -1043,7 +1044,7 @@ unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); unsigned char snd_emu10k1_sum_vol_attn(unsigned int value); /* memory allocation */ -snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, dma_addr_t addr, unsigned long size); +snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, struct snd_sg_buf *sgbuf); int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk); snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size); int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk); diff --git a/include/sound/info.h b/include/sound/info.h index ec841506e6db..576cc37de253 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -151,8 +151,8 @@ static inline int snd_info_done(void) { return 0; } static inline int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len) { return 0; } static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; } -static inline snd_info_entry_t *snd_info_create_module_entry(struct module * module, const char *name) { return NULL; } -static inline snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, const char *name) { return NULL; } +static inline snd_info_entry_t *snd_info_create_module_entry(struct module * module, const char *name, snd_info_entry_t * parent) { return NULL; } +static inline snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, const char *name, snd_info_entry_t * parent) { return NULL; } static inline void snd_info_free_entry(snd_info_entry_t * entry) { ; } static inline snd_info_entry_t *snd_info_create_device(const char *name, unsigned int number, diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 2bdb856e7606..2db0960e49a8 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -48,6 +48,7 @@ typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t; typedef struct sndrv_pcm_status snd_pcm_status_t; typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t; typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t; +typedef struct sndrv_mask snd_mask_t; #define _snd_pcm_substream_chip(substream) ((substream)->pcm->private_data) #define snd_pcm_substream_chip(substream) snd_magic_cast1(chip_t, _snd_pcm_substream_chip(substream), return -ENXIO) @@ -67,7 +68,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t; typedef struct _snd_pcm_hardware { unsigned int info; /* SNDRV_PCM_INFO_* */ - unsigned int formats; /* SNDRV_PCM_FMTBIT_* */ + u64 formats; /* SNDRV_PCM_FMTBIT_* */ unsigned int rates; /* SNDRV_PCM_RATE_* */ unsigned int rate_min; /* min rate */ unsigned int rate_max; /* max rate */ @@ -95,6 +96,7 @@ typedef struct _snd_pcm_ops { void *buf, snd_pcm_uframes_t count); int (*silence)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, snd_pcm_uframes_t count); + void *(*page)(snd_pcm_substream_t *substream, unsigned long offset); } snd_pcm_ops_t; /* @@ -148,32 +150,44 @@ typedef struct _snd_pcm_ops { SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ SNDRV_PCM_RATE_192000) -#define SNDRV_PCM_FMTBIT_S8 (1 << SNDRV_PCM_FORMAT_S8) -#define SNDRV_PCM_FMTBIT_U8 (1 << SNDRV_PCM_FORMAT_U8) -#define SNDRV_PCM_FMTBIT_S16_LE (1 << SNDRV_PCM_FORMAT_S16_LE) -#define SNDRV_PCM_FMTBIT_S16_BE (1 << SNDRV_PCM_FORMAT_S16_BE) -#define SNDRV_PCM_FMTBIT_U16_LE (1 << SNDRV_PCM_FORMAT_U16_LE) -#define SNDRV_PCM_FMTBIT_U16_BE (1 << SNDRV_PCM_FORMAT_U16_BE) -#define SNDRV_PCM_FMTBIT_S24_LE (1 << SNDRV_PCM_FORMAT_S24_LE) -#define SNDRV_PCM_FMTBIT_S24_BE (1 << SNDRV_PCM_FORMAT_S24_BE) -#define SNDRV_PCM_FMTBIT_U24_LE (1 << SNDRV_PCM_FORMAT_U24_LE) -#define SNDRV_PCM_FMTBIT_U24_BE (1 << SNDRV_PCM_FORMAT_U24_BE) -#define SNDRV_PCM_FMTBIT_S32_LE (1 << SNDRV_PCM_FORMAT_S32_LE) -#define SNDRV_PCM_FMTBIT_S32_BE (1 << SNDRV_PCM_FORMAT_S32_BE) -#define SNDRV_PCM_FMTBIT_U32_LE (1 << SNDRV_PCM_FORMAT_U32_LE) -#define SNDRV_PCM_FMTBIT_U32_BE (1 << SNDRV_PCM_FORMAT_U32_BE) -#define SNDRV_PCM_FMTBIT_FLOAT_LE (1 << SNDRV_PCM_FORMAT_FLOAT_LE) -#define SNDRV_PCM_FMTBIT_FLOAT_BE (1 << SNDRV_PCM_FORMAT_FLOAT_BE) -#define SNDRV_PCM_FMTBIT_FLOAT64_LE (1 << SNDRV_PCM_FORMAT_FLOAT64_LE) -#define SNDRV_PCM_FMTBIT_FLOAT64_BE (1 << SNDRV_PCM_FORMAT_FLOAT64_BE) -#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE (1 << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE) -#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE (1 << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE) -#define SNDRV_PCM_FMTBIT_MU_LAW (1 << SNDRV_PCM_FORMAT_MU_LAW) -#define SNDRV_PCM_FMTBIT_A_LAW (1 << SNDRV_PCM_FORMAT_A_LAW) -#define SNDRV_PCM_FMTBIT_IMA_ADPCM (1 << SNDRV_PCM_FORMAT_IMA_ADPCM) -#define SNDRV_PCM_FMTBIT_MPEG (1 << SNDRV_PCM_FORMAT_MPEG) -#define SNDRV_PCM_FMTBIT_GSM (1 << SNDRV_PCM_FORMAT_GSM) -#define SNDRV_PCM_FMTBIT_SPECIAL (1 << SNDRV_PCM_FORMAT_SPECIAL) +#define SNDRV_PCM_FMTBIT_S8 (1ULL << SNDRV_PCM_FORMAT_S8) +#define SNDRV_PCM_FMTBIT_U8 (1ULL << SNDRV_PCM_FORMAT_U8) +#define SNDRV_PCM_FMTBIT_S16_LE (1ULL << SNDRV_PCM_FORMAT_S16_LE) +#define SNDRV_PCM_FMTBIT_S16_BE (1ULL << SNDRV_PCM_FORMAT_S16_BE) +#define SNDRV_PCM_FMTBIT_U16_LE (1ULL << SNDRV_PCM_FORMAT_U16_LE) +#define SNDRV_PCM_FMTBIT_U16_BE (1ULL << SNDRV_PCM_FORMAT_U16_BE) +#define SNDRV_PCM_FMTBIT_S24_LE (1ULL << SNDRV_PCM_FORMAT_S24_LE) +#define SNDRV_PCM_FMTBIT_S24_BE (1ULL << SNDRV_PCM_FORMAT_S24_BE) +#define SNDRV_PCM_FMTBIT_U24_LE (1ULL << SNDRV_PCM_FORMAT_U24_LE) +#define SNDRV_PCM_FMTBIT_U24_BE (1ULL << SNDRV_PCM_FORMAT_U24_BE) +#define SNDRV_PCM_FMTBIT_S32_LE (1ULL << SNDRV_PCM_FORMAT_S32_LE) +#define SNDRV_PCM_FMTBIT_S32_BE (1ULL << SNDRV_PCM_FORMAT_S32_BE) +#define SNDRV_PCM_FMTBIT_U32_LE (1ULL << SNDRV_PCM_FORMAT_U32_LE) +#define SNDRV_PCM_FMTBIT_U32_BE (1ULL << SNDRV_PCM_FORMAT_U32_BE) +#define SNDRV_PCM_FMTBIT_FLOAT_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT_LE) +#define SNDRV_PCM_FMTBIT_FLOAT_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT_BE) +#define SNDRV_PCM_FMTBIT_FLOAT64_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_LE) +#define SNDRV_PCM_FMTBIT_FLOAT64_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_BE) +#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE) +#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE) +#define SNDRV_PCM_FMTBIT_MU_LAW (1ULL << SNDRV_PCM_FORMAT_MU_LAW) +#define SNDRV_PCM_FMTBIT_A_LAW (1ULL << SNDRV_PCM_FORMAT_A_LAW) +#define SNDRV_PCM_FMTBIT_IMA_ADPCM (1ULL << SNDRV_PCM_FORMAT_IMA_ADPCM) +#define SNDRV_PCM_FMTBIT_MPEG (1ULL << SNDRV_PCM_FORMAT_MPEG) +#define SNDRV_PCM_FMTBIT_GSM (1ULL << SNDRV_PCM_FORMAT_GSM) +#define SNDRV_PCM_FMTBIT_SPECIAL (1ULL << SNDRV_PCM_FORMAT_SPECIAL) +#define SNDRV_PCM_FMTBIT_S24_3LE (1ULL << SNDRV_PCM_FORMAT_S24_3LE) +#define SNDRV_PCM_FMTBIT_U24_3LE (1ULL << SNDRV_PCM_FORMAT_U24_3LE) +#define SNDRV_PCM_FMTBIT_S24_3BE (1ULL << SNDRV_PCM_FORMAT_S24_3BE) +#define SNDRV_PCM_FMTBIT_U24_3BE (1ULL << SNDRV_PCM_FORMAT_U24_3BE) +#define SNDRV_PCM_FMTBIT_S20_3LE (1ULL << SNDRV_PCM_FORMAT_S20_3LE) +#define SNDRV_PCM_FMTBIT_U20_3LE (1ULL << SNDRV_PCM_FORMAT_U20_3LE) +#define SNDRV_PCM_FMTBIT_S20_3BE (1ULL << SNDRV_PCM_FORMAT_S20_3BE) +#define SNDRV_PCM_FMTBIT_U20_3BE (1ULL << SNDRV_PCM_FORMAT_U20_3BE) +#define SNDRV_PCM_FMTBIT_S18_3LE (1ULL << SNDRV_PCM_FORMAT_S18_3LE) +#define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) +#define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) +#define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) #ifdef SNDRV_LITTLE_ENDIAN #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE @@ -217,8 +231,8 @@ struct _snd_pcm_hw_rule { }; typedef struct _snd_pcm_hw_constraints { - unsigned int masks[SNDRV_PCM_HW_PARAM_LAST_MASK - - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; + snd_mask_t masks[SNDRV_PCM_HW_PARAM_LAST_MASK - + SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; snd_interval_t intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; unsigned int rules_num; @@ -226,8 +240,8 @@ typedef struct _snd_pcm_hw_constraints { snd_pcm_hw_rule_t *rules; } snd_pcm_hw_constraints_t; -static inline unsigned int *constrs_mask(snd_pcm_hw_constraints_t *constrs, - snd_pcm_hw_param_t var) +static inline snd_mask_t *constrs_mask(snd_pcm_hw_constraints_t *constrs, + snd_pcm_hw_param_t var) { return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } @@ -648,13 +662,10 @@ static inline int hw_is_interval(int var) var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; } -typedef unsigned int snd_mask_t; -#define SND_MASK_MAX 32 - static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var) { - return (snd_mask_t*)¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; + return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params, @@ -675,9 +686,9 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_ return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var); } -#define params_access(p) (ffs(*hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) - 1) -#define params_format(p) (ffs(*hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)) - 1) -#define params_subformat(p) (ffs(*hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) - 1) +#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) +#define params_format(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)) +#define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) #define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min #define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min #define params_period_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min @@ -735,7 +746,9 @@ int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, - unsigned int mask); + u_int32_t mask); +int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, + u_int64_t mask); int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, unsigned int min, unsigned int max); int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var); @@ -759,6 +772,9 @@ int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, unsigned int cond, snd_pcm_hw_param_t var, unsigned long step); +int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, + unsigned int cond, + snd_pcm_hw_param_t var); int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond, int var, diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 4a6f827f218f..31684a78e0b2 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -36,10 +36,14 @@ extern int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, unsigned int val, int dir); /* To share the same code we have alsa-lib */ -#define snd_mask_bits(mask) (*(mask)) #define INLINE static inline #define assert(a) (void)(a) +#define SNDRV_MASK_BITS 64 /* we use so far 64bits only */ +#define SNDRV_MASK_SIZE (SNDRV_MASK_BITS / 32) +#define MASK_OFS(i) ((i) >> 5) +#define MASK_BIT(i) (1U << ((i) & 31)) + INLINE unsigned int ld2(u_int32_t v) { unsigned r = 0; @@ -72,91 +76,119 @@ INLINE size_t snd_mask_sizeof(void) INLINE void snd_mask_none(snd_mask_t *mask) { - snd_mask_bits(mask) = 0; + memset(mask, 0, sizeof(*mask)); } INLINE void snd_mask_any(snd_mask_t *mask) { - snd_mask_bits(mask) = ~0U; -} - -INLINE void snd_mask_load(snd_mask_t *mask, unsigned int msk) -{ - snd_mask_bits(mask) = msk; + memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); } INLINE int snd_mask_empty(const snd_mask_t *mask) { - return snd_mask_bits(mask) == 0; + int i; + for (i = 0; i < SNDRV_MASK_SIZE; i++) + if (mask->bits[i]) + return 0; + return 1; } INLINE unsigned int snd_mask_min(const snd_mask_t *mask) { + int i; assert(!snd_mask_empty(mask)); - return ffs(snd_mask_bits(mask)) - 1; + for (i = 0; i < SNDRV_MASK_SIZE; i++) { + if (mask->bits[i]) + return ffs(mask->bits[i]) - 1 + (i << 5); + } + return 0; } INLINE unsigned int snd_mask_max(const snd_mask_t *mask) { + int i; assert(!snd_mask_empty(mask)); - return ld2(snd_mask_bits(mask)); + for (i = SNDRV_MASK_SIZE - 1; i >= 0; i--) { + if (mask->bits[i]) + return ld2(mask->bits[i]) + (i << 5); + } + return 0; } INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val) { - assert(val <= SND_MASK_MAX); - snd_mask_bits(mask) |= (1U << val); + assert(val <= SNDRV_MASK_BITS); + mask->bits[MASK_OFS(val)] |= MASK_BIT(val); } INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val) { - assert(val <= SND_MASK_MAX); - snd_mask_bits(mask) &= ~(1U << val); + assert(val <= SNDRV_MASK_BITS); + mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); } INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to) { - assert(to <= SND_MASK_MAX && from <= to); - snd_mask_bits(mask) |= ((1U << (from - to + 1)) - 1) << from; + int i; + assert(to <= SNDRV_MASK_BITS && from <= to); + for (i = from; i <= to; i++) + mask->bits[MASK_OFS(i)] |= MASK_BIT(i); } INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to) { - assert(to <= SND_MASK_MAX && from <= to); - snd_mask_bits(mask) &= ~(((1U << (from - to + 1)) - 1) << from); + int i; + assert(to <= SNDRV_MASK_BITS && from <= to); + for (i = from; i <= to; i++) + mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); } INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) { - assert(val <= SND_MASK_MAX); - snd_mask_bits(mask) &= 1U << val; + unsigned int v; + assert(val <= SNDRV_MASK_BITS); + v = mask->bits[MASK_OFS(val)] & MASK_BIT(val); + snd_mask_none(mask); + mask->bits[MASK_OFS(val)] = v; } INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v) { - snd_mask_bits(mask) &= snd_mask_bits(v); + int i; + for (i = 0; i < SNDRV_MASK_SIZE; i++) + mask->bits[i] &= v->bits[i]; } INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v) { - return snd_mask_bits(mask) == snd_mask_bits(v); + return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); } INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v) { - snd_mask_bits(mask) = snd_mask_bits(v); + *mask = *v; } INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val) { - assert(val <= SND_MASK_MAX); - return snd_mask_bits(mask) & (1U << val); + assert(val <= SNDRV_MASK_BITS); + return mask->bits[MASK_OFS(val)] & MASK_BIT(val); } INLINE int snd_mask_single(const snd_mask_t *mask) { + int i, c = 0; assert(!snd_mask_empty(mask)); - return !(snd_mask_bits(mask) & (snd_mask_bits(mask) - 1)); + for (i = 0; i < SNDRV_MASK_SIZE; i++) { + if (! mask->bits[i]) + continue; + if (mask->bits[i] & (mask->bits[i] - 1)) + return 0; + if (c) + return 0; + c++; + } + return 1; } INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) @@ -204,7 +236,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) assert(!snd_mask_empty(mask)); if (snd_mask_max(mask) <= val) return 0; - snd_mask_reset_range(mask, val + 1, SND_MASK_MAX); + snd_mask_reset_range(mask, val + 1, SNDRV_MASK_BITS); if (snd_mask_empty(mask)) return -EINVAL; return 1; diff --git a/include/sound/pcm_sgbuf.h b/include/sound/pcm_sgbuf.h new file mode 100644 index 000000000000..79ef1914f911 --- /dev/null +++ b/include/sound/pcm_sgbuf.h @@ -0,0 +1,60 @@ +#ifndef __SOUND_PCM_SGBUF_H +#define __SOUND_PCM_SGBUF_H + +/* + * Scatter-Gather PCM access + * + * Copyright (c) by Takashi Iwai <tiwai@suse.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +struct snd_sg_page { + void *buf; + dma_addr_t addr; +}; + +struct snd_sg_buf { + int size; /* allocated byte size (= runtime->dma_bytes) */ + int pages; /* allocated pages */ + int tblsize; /* allocated table size */ + struct snd_sg_page *table; + struct pci_dev *pci; +}; + +typedef struct snd_sg_buf snd_pcm_sgbuf_t; /* for magic cast */ + +/* + * return the pages matching with the given byte size + */ +static inline unsigned int snd_pcm_sgbuf_pages(size_t size) +{ + return (size + PAGE_SIZE - 1) >> PAGE_SHIFT; +} + + +int snd_pcm_sgbuf_init(snd_pcm_substream_t *substream, struct pci_dev *pci, int tblsize); +int snd_pcm_sgbuf_delete(snd_pcm_substream_t *substream); +int snd_pcm_sgbuf_alloc(snd_pcm_substream_t *substream, size_t size); +int snd_pcm_sgbuf_free(snd_pcm_substream_t *substream); + +int snd_pcm_sgbuf_ops_copy_playback(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t hwoff, void *buf, snd_pcm_uframes_t count); +int snd_pcm_sgbuf_ops_copy_capture(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t hwoff, void *buf, snd_pcm_uframes_t count); +int snd_pcm_sgbuf_ops_silence(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t hwoff, snd_pcm_uframes_t count); +void *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); + + +#endif /* __SOUND_PCM_SGBUF_H */ diff --git a/include/sound/sb.h b/include/sound/sb.h index 2e8f23a7d79d..39c11c79adc5 100644 --- a/include/sound/sb.h +++ b/include/sound/sb.h @@ -36,6 +36,7 @@ enum sb_hw_type { SB_HW_16CSP, /* SB16 with CSP chip */ SB_HW_ALS100, /* Avance Logic ALS100 chip */ SB_HW_ALS4000, /* Avance Logic ALS4000 chip */ + SB_HW_DT019X, /* Diamond Tech. DT-019X / Avance Logic ALS-007 */ }; #define SB_OPEN_PCM 0x01 @@ -215,6 +216,24 @@ typedef struct _snd_sb sb_t; #define SB_DSP4_3DSE 0x90 +/* Registers for DT-019x / ALS-007 mixer */ +#define SB_DT019X_MASTER_DEV 0x62 +#define SB_DT019X_PCM_DEV 0x64 +#define SB_DT019X_SYNTH_DEV 0x66 +#define SB_DT019X_CD_DEV 0x68 +#define SB_DT019X_MIC_DEV 0x6a +#define SB_DT019X_SPKR_DEV 0x6a +#define SB_DT019X_LINE_DEV 0x6e +#define SB_DT019X_OUTPUT_SW1 0x3c +#define SB_DT019X_OUTPUT_SW2 0x4c +#define SB_DT019X_CAPTURE_SW 0x6c + +#define SB_DT019X_CAP_CD 0x02 +#define SB_DT019X_CAP_MIC 0x04 +#define SB_DT019X_CAP_LINE 0x06 +#define SB_DT019X_CAP_SYNTH 0x07 +#define SB_DT019X_CAP_MAIN 0x07 + /* IRQ setting bitmap */ #define SB_IRQSETUP_IRQ9 0x01 #define SB_IRQSETUP_IRQ5 0x02 diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h index fe5929fbd8c0..9bb1a80a991c 100644 --- a/include/sound/seq_virmidi.h +++ b/include/sound/seq_virmidi.h @@ -45,7 +45,7 @@ typedef struct _snd_virmidi { snd_rawmidi_substream_t *substream; } snd_virmidi_t; -#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) +#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) #define SNDRV_VIRMIDI_USE (1<<1) /* @@ -69,14 +69,16 @@ struct _snd_virmidi_dev { * ATTACH = input/output events from midi device are routed to the * attached sequencer port. sequencer port is not created * by virmidi itself. + * the input to rawmidi must be processed by passing the + * incoming events via snd_virmidi_receive() * DISPATCH = input/output events are routed to subscribers. * sequencer port is created in virmidi. */ #define SNDRV_VIRMIDI_SEQ_NONE 0 -#define SNDRV_VIRMIDI_SEQ_ATTACH 1 +#define SNDRV_VIRMIDI_SEQ_ATTACH 1 #define SNDRV_VIRMIDI_SEQ_DISPATCH 2 int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); +int snd_virmidi_receive(snd_rawmidi_t *rmidi, snd_seq_event_t *ev); #endif /* __SOUND_SEQ_VIRMIDI */ - diff --git a/include/sound/sndmagic.h b/include/sound/sndmagic.h index 106f3c7be748..145f663ebced 100644 --- a/include/sound/sndmagic.h +++ b/include/sound/sndmagic.h @@ -61,6 +61,7 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic) #define snd_pcm_proc_private_t_magic 0xa15a0104 #define snd_pcm_oss_file_t_magic 0xa15a0105 #define snd_mixer_oss_t_magic 0xa15a0106 +#define snd_pcm_sgbuf_t_magic 0xa15a0107 #define snd_info_private_data_t_magic 0xa15a0201 #define snd_ctl_file_t_magic 0xa15a0301 @@ -78,6 +79,7 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic) #define trident_t_magic 0xa15a1201 #define es1938_t_magic 0xa15a1301 #define cs46xx_t_magic 0xa15a1401 +#define cs46xx_pcm_t_magic 0xa15a1402 #define ensoniq_t_magic 0xa15a1501 #define sonicvibes_t_magic 0xa15a1601 #define mpu401_t_magic 0xa15a1701 diff --git a/include/sound/version.h b/include/sound/version.h index 8c566b8e2bd0..63fe9dadd143 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated automatically by configure. */ #define CONFIG_SND_VERSION "0.9.0rc2" -#define CONFIG_SND_DATE " (Wed Jun 19 08:56:25 2002 UTC)" +#define CONFIG_SND_DATE " (Mon Aug 05 14:24:05 2002 UTC)" diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h index 9a8672a5c174..0c24824adbfd 100644 --- a/include/sound/ymfpci.h +++ b/include/sound/ymfpci.h @@ -358,7 +358,7 @@ int snd_ymfpci_pcm(ymfpci_t *chip, int device, snd_pcm_t **rpcm); int snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t **rpcm); int snd_ymfpci_pcm_spdif(ymfpci_t *chip, int device, snd_pcm_t **rpcm); int snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t **rpcm); -int snd_ymfpci_mixer(ymfpci_t *chip); +int snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch); int snd_ymfpci_joystick(ymfpci_t *chip); int snd_ymfpci_voice_alloc(ymfpci_t *chip, ymfpci_voice_type_t type, int pair, ymfpci_voice_t **rvoice); |
