Skip to content

Commit ae49e80

Browse files
arndbArnd Bergmann
authored andcommitted
asm-generic: add legacy I/O header files
The dma.h, hw_irq.h, serial.h and timex.h files originally described PC-style i8237, i8259A, i8250, i8253 and i8255 chips as well as the VGA style text mode graphics. Modern architectures live happily without these specific interfaces, but a few definitions from these headers keep getting used in common code. The new generic headers are what most architectures use anyway nowadays, just implementing the minimal definitions. Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent aafe4db commit ae49e80

6 files changed

Lines changed: 106 additions & 0 deletions

File tree

‎include/asm-generic/dma.h‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef __ASM_GENERIC_DMA_H
2+
#define __ASM_GENERIC_DMA_H
3+
/*
4+
* This file traditionally describes the i8237 PC style DMA controller.
5+
* Most architectures don't have these any more and can get the minimal
6+
* implementation from kernel/dma.c by not defining MAX_DMA_CHANNELS.
7+
*
8+
* Some code relies on seeing MAX_DMA_ADDRESS though.
9+
*/
10+
#define MAX_DMA_ADDRESS PAGE_OFFSET
11+
12+
extern int request_dma(unsigned int dmanr, const char *device_id);
13+
extern void free_dma(unsigned int dmanr);
14+
15+
#endif /* __ASM_GENERIC_DMA_H */

‎include/asm-generic/hw_irq.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef __ASM_GENERIC_HW_IRQ_H
2+
#define __ASM_GENERIC_HW_IRQ_H
3+
/*
4+
* hw_irq.h has internal declarations for the low-level interrupt
5+
* controller, like the original i8259A.
6+
* In general, this is not needed for new architectures.
7+
*/
8+
9+
#endif /* __ASM_GENERIC_HW_IRQ_H */

‎include/asm-generic/parport.h‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef __ASM_GENERIC_PARPORT_H
2+
#define __ASM_GENERIC_PARPORT_H
3+
4+
/*
5+
* An ISA bus may have i8255 parallel ports at well-known
6+
* locations in the I/O space, which are scanned by
7+
* parport_pc_find_isa_ports.
8+
*
9+
* Without ISA support, the driver will only attach
10+
* to devices on the PCI bus.
11+
*/
12+
13+
static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
14+
static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
15+
{
16+
#ifdef CONFIG_ISA
17+
return parport_pc_find_isa_ports(autoirq, autodma);
18+
#else
19+
return 0;
20+
#endif
21+
}
22+
23+
#endif /* __ASM_GENERIC_PARPORT_H */

‎include/asm-generic/serial.h‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#ifndef __ASM_GENERIC_SERIAL_H
2+
#define __ASM_GENERIC_SERIAL_H
3+
4+
/*
5+
* This should not be an architecture specific #define, oh well.
6+
*
7+
* Traditionally, it just describes i8250 and related serial ports
8+
* that have this clock rate.
9+
*/
10+
11+
#define BASE_BAUD (1843200 / 16)
12+
13+
#endif /* __ASM_GENERIC_SERIAL_H */

‎include/asm-generic/timex.h‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef __ASM_GENERIC_TIMEX_H
2+
#define __ASM_GENERIC_TIMEX_H
3+
4+
/*
5+
* If you have a cycle counter, return the value here.
6+
*/
7+
typedef unsigned long cycles_t;
8+
#ifndef get_cycles
9+
static inline cycles_t get_cycles(void)
10+
{
11+
return 0;
12+
}
13+
#endif
14+
15+
/*
16+
* Architectures are encouraged to implement read_current_timer
17+
* and define this in order to avoid the expensive delay loop
18+
* calibration during boot.
19+
*/
20+
#undef ARCH_HAS_READ_CURRENT_TIMER
21+
22+
#endif /* __ASM_GENERIC_TIMEX_H */

‎include/asm-generic/vga.h‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Access to VGA videoram
3+
*
4+
* (c) 1998 Martin Mares <mj@ucw.cz>
5+
*/
6+
#ifndef __ASM_GENERIC_VGA_H
7+
#define __ASM_GENERIC_VGA_H
8+
9+
/*
10+
* On most architectures that support VGA, we can just
11+
* recalculate addresses and then access the videoram
12+
* directly without any black magic.
13+
*
14+
* Everyone else needs to ioremap the address and use
15+
* proper I/O accesses.
16+
*/
17+
#ifndef VGA_MAP_MEM
18+
#define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x)
19+
#endif
20+
21+
#define vga_readb(x) (*(x))
22+
#define vga_writeb(x, y) (*(y) = (x))
23+
24+
#endif /* _ASM_GENERIC_VGA_H */

0 commit comments

Comments
 (0)