Skip to content

Commit

Permalink
asm-generic: add legacy I/O header files
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
arndb authored and Arnd Bergmann committed Jun 11, 2009
1 parent aafe4db commit ae49e80
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/asm-generic/dma.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef __ASM_GENERIC_DMA_H
#define __ASM_GENERIC_DMA_H
/*
* This file traditionally describes the i8237 PC style DMA controller.
* Most architectures don't have these any more and can get the minimal
* implementation from kernel/dma.c by not defining MAX_DMA_CHANNELS.
*
* Some code relies on seeing MAX_DMA_ADDRESS though.
*/
#define MAX_DMA_ADDRESS PAGE_OFFSET

extern int request_dma(unsigned int dmanr, const char *device_id);
extern void free_dma(unsigned int dmanr);

#endif /* __ASM_GENERIC_DMA_H */
9 changes: 9 additions & 0 deletions include/asm-generic/hw_irq.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef __ASM_GENERIC_HW_IRQ_H
#define __ASM_GENERIC_HW_IRQ_H
/*
* hw_irq.h has internal declarations for the low-level interrupt
* controller, like the original i8259A.
* In general, this is not needed for new architectures.
*/

#endif /* __ASM_GENERIC_HW_IRQ_H */
23 changes: 23 additions & 0 deletions include/asm-generic/parport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef __ASM_GENERIC_PARPORT_H
#define __ASM_GENERIC_PARPORT_H

/*
* An ISA bus may have i8255 parallel ports at well-known
* locations in the I/O space, which are scanned by
* parport_pc_find_isa_ports.
*
* Without ISA support, the driver will only attach
* to devices on the PCI bus.
*/

static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
{
#ifdef CONFIG_ISA
return parport_pc_find_isa_ports(autoirq, autodma);
#else
return 0;
#endif
}

#endif /* __ASM_GENERIC_PARPORT_H */
13 changes: 13 additions & 0 deletions include/asm-generic/serial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef __ASM_GENERIC_SERIAL_H
#define __ASM_GENERIC_SERIAL_H

/*
* This should not be an architecture specific #define, oh well.
*
* Traditionally, it just describes i8250 and related serial ports
* that have this clock rate.
*/

#define BASE_BAUD (1843200 / 16)

#endif /* __ASM_GENERIC_SERIAL_H */
22 changes: 22 additions & 0 deletions include/asm-generic/timex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef __ASM_GENERIC_TIMEX_H
#define __ASM_GENERIC_TIMEX_H

/*
* If you have a cycle counter, return the value here.
*/
typedef unsigned long cycles_t;
#ifndef get_cycles
static inline cycles_t get_cycles(void)
{
return 0;
}
#endif

/*
* Architectures are encouraged to implement read_current_timer
* and define this in order to avoid the expensive delay loop
* calibration during boot.
*/
#undef ARCH_HAS_READ_CURRENT_TIMER

#endif /* __ASM_GENERIC_TIMEX_H */
24 changes: 24 additions & 0 deletions include/asm-generic/vga.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Access to VGA videoram
*
* (c) 1998 Martin Mares <[email protected]>
*/
#ifndef __ASM_GENERIC_VGA_H
#define __ASM_GENERIC_VGA_H

/*
* On most architectures that support VGA, we can just
* recalculate addresses and then access the videoram
* directly without any black magic.
*
* Everyone else needs to ioremap the address and use
* proper I/O accesses.
*/
#ifndef VGA_MAP_MEM
#define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x)
#endif

#define vga_readb(x) (*(x))
#define vga_writeb(x, y) (*(y) = (x))

#endif /* _ASM_GENERIC_VGA_H */

0 comments on commit ae49e80

Please sign in to comment.