mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-10-29 07:18:51 +01:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
6
arch/m68k/sun3/prom/Makefile
Normal file
6
arch/m68k/sun3/prom/Makefile
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Makefile for the Sun Boot PROM interface library under
|
||||
# Linux.
|
||||
#
|
||||
|
||||
obj-y := init.o console.o printf.o misc.o
|
||||
#bootstr.o init.o misc.o segment.o console.o printf.o
|
||||
169
arch/m68k/sun3/prom/console.c
Normal file
169
arch/m68k/sun3/prom/console.c
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* console.c: Routines that deal with sending and receiving IO
|
||||
* to/from the current console device using the PROM.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/openprom.h>
|
||||
#include <asm/oplib.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
/* Non blocking get character from console input device, returns -1
|
||||
* if no input was taken. This can be used for polling.
|
||||
*/
|
||||
int
|
||||
prom_nbgetchar(void)
|
||||
{
|
||||
int i = -1;
|
||||
unsigned long flags;
|
||||
|
||||
local_irq_save(flags);
|
||||
i = (*(romvec->pv_nbgetchar))();
|
||||
local_irq_restore(flags);
|
||||
return i; /* Ugh, we could spin forever on unsupported proms ;( */
|
||||
}
|
||||
|
||||
/* Non blocking put character to console device, returns -1 if
|
||||
* unsuccessful.
|
||||
*/
|
||||
int
|
||||
prom_nbputchar(char c)
|
||||
{
|
||||
unsigned long flags;
|
||||
int i = -1;
|
||||
|
||||
local_irq_save(flags);
|
||||
i = (*(romvec->pv_nbputchar))(c);
|
||||
local_irq_restore(flags);
|
||||
return i; /* Ugh, we could spin forever on unsupported proms ;( */
|
||||
}
|
||||
|
||||
/* Blocking version of get character routine above. */
|
||||
char
|
||||
prom_getchar(void)
|
||||
{
|
||||
int character;
|
||||
while((character = prom_nbgetchar()) == -1) ;
|
||||
return (char) character;
|
||||
}
|
||||
|
||||
/* Blocking version of put character routine above. */
|
||||
void
|
||||
prom_putchar(char c)
|
||||
{
|
||||
while(prom_nbputchar(c) == -1) ;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Query for input device type */
|
||||
#if 0
|
||||
enum prom_input_device
|
||||
prom_query_input_device()
|
||||
{
|
||||
unsigned long flags;
|
||||
int st_p;
|
||||
char propb[64];
|
||||
char *p;
|
||||
|
||||
switch(prom_vers) {
|
||||
case PROM_V0:
|
||||
case PROM_V2:
|
||||
default:
|
||||
switch(*romvec->pv_stdin) {
|
||||
case PROMDEV_KBD: return PROMDEV_IKBD;
|
||||
case PROMDEV_TTYA: return PROMDEV_ITTYA;
|
||||
case PROMDEV_TTYB: return PROMDEV_ITTYB;
|
||||
default:
|
||||
return PROMDEV_I_UNK;
|
||||
};
|
||||
case PROM_V3:
|
||||
case PROM_P1275:
|
||||
local_irq_save(flags);
|
||||
st_p = (*romvec->pv_v2devops.v2_inst2pkg)(*romvec->pv_v2bootargs.fd_stdin);
|
||||
__asm__ __volatile__("ld [%0], %%g6\n\t" : :
|
||||
"r" (¤t_set[smp_processor_id()]) :
|
||||
"memory");
|
||||
local_irq_restore(flags);
|
||||
if(prom_node_has_property(st_p, "keyboard"))
|
||||
return PROMDEV_IKBD;
|
||||
prom_getproperty(st_p, "device_type", propb, sizeof(propb));
|
||||
if(strncmp(propb, "serial", sizeof("serial")))
|
||||
return PROMDEV_I_UNK;
|
||||
prom_getproperty(prom_root_node, "stdin-path", propb, sizeof(propb));
|
||||
p = propb;
|
||||
while(*p) p++; p -= 2;
|
||||
if(p[0] == ':') {
|
||||
if(p[1] == 'a')
|
||||
return PROMDEV_ITTYA;
|
||||
else if(p[1] == 'b')
|
||||
return PROMDEV_ITTYB;
|
||||
}
|
||||
return PROMDEV_I_UNK;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Query for output device type */
|
||||
|
||||
#if 0
|
||||
enum prom_output_device
|
||||
prom_query_output_device()
|
||||
{
|
||||
unsigned long flags;
|
||||
int st_p;
|
||||
char propb[64];
|
||||
char *p;
|
||||
int propl;
|
||||
|
||||
switch(prom_vers) {
|
||||
case PROM_V0:
|
||||
switch(*romvec->pv_stdin) {
|
||||
case PROMDEV_SCREEN: return PROMDEV_OSCREEN;
|
||||
case PROMDEV_TTYA: return PROMDEV_OTTYA;
|
||||
case PROMDEV_TTYB: return PROMDEV_OTTYB;
|
||||
};
|
||||
break;
|
||||
case PROM_V2:
|
||||
case PROM_V3:
|
||||
case PROM_P1275:
|
||||
local_irq_save(flags);
|
||||
st_p = (*romvec->pv_v2devops.v2_inst2pkg)(*romvec->pv_v2bootargs.fd_stdout);
|
||||
__asm__ __volatile__("ld [%0], %%g6\n\t" : :
|
||||
"r" (¤t_set[smp_processor_id()]) :
|
||||
"memory");
|
||||
local_irq_restore(flags);
|
||||
propl = prom_getproperty(st_p, "device_type", propb, sizeof(propb));
|
||||
if (propl >= 0 && propl == sizeof("display") &&
|
||||
strncmp("display", propb, sizeof("display")) == 0)
|
||||
{
|
||||
return PROMDEV_OSCREEN;
|
||||
}
|
||||
if(prom_vers == PROM_V3) {
|
||||
if(strncmp("serial", propb, sizeof("serial")))
|
||||
return PROMDEV_O_UNK;
|
||||
prom_getproperty(prom_root_node, "stdout-path", propb, sizeof(propb));
|
||||
p = propb;
|
||||
while(*p) p++; p -= 2;
|
||||
if(p[0]==':') {
|
||||
if(p[1] == 'a')
|
||||
return PROMDEV_OTTYA;
|
||||
else if(p[1] == 'b')
|
||||
return PROMDEV_OTTYB;
|
||||
}
|
||||
return PROMDEV_O_UNK;
|
||||
} else {
|
||||
/* This works on SS-2 (an early OpenFirmware) still. */
|
||||
switch(*romvec->pv_stdin) {
|
||||
case PROMDEV_TTYA: return PROMDEV_OTTYA;
|
||||
case PROMDEV_TTYB: return PROMDEV_OTTYB;
|
||||
};
|
||||
}
|
||||
break;
|
||||
};
|
||||
return PROMDEV_O_UNK;
|
||||
}
|
||||
#endif
|
||||
35
arch/m68k/sun3/prom/init.c
Normal file
35
arch/m68k/sun3/prom/init.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* init.c: Initialize internal variables used by the PROM
|
||||
* library functions.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/openprom.h>
|
||||
#include <asm/oplib.h>
|
||||
|
||||
struct linux_romvec *romvec;
|
||||
enum prom_major_version prom_vers;
|
||||
unsigned int prom_rev, prom_prev;
|
||||
|
||||
/* The root node of the prom device tree. */
|
||||
int prom_root_node;
|
||||
|
||||
/* Pointer to the device tree operations structure. */
|
||||
struct linux_nodeops *prom_nodeops;
|
||||
|
||||
/* You must call prom_init() before you attempt to use any of the
|
||||
* routines in the prom library.
|
||||
* It gets passed the pointer to the PROM vector.
|
||||
*/
|
||||
|
||||
void __init prom_init(struct linux_romvec *rp)
|
||||
{
|
||||
romvec = rp;
|
||||
|
||||
/* Initialization successful. */
|
||||
return;
|
||||
}
|
||||
94
arch/m68k/sun3/prom/misc.c
Normal file
94
arch/m68k/sun3/prom/misc.c
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* misc.c: Miscellaneous prom functions that don't belong
|
||||
* anywhere else.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/sun3-head.h>
|
||||
#include <asm/idprom.h>
|
||||
#include <asm/openprom.h>
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/movs.h>
|
||||
|
||||
/* Reset and reboot the machine with the command 'bcommand'. */
|
||||
void
|
||||
prom_reboot(char *bcommand)
|
||||
{
|
||||
unsigned long flags;
|
||||
local_irq_save(flags);
|
||||
(*(romvec->pv_reboot))(bcommand);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
/* Drop into the prom, with the chance to continue with the 'go'
|
||||
* prom command.
|
||||
*/
|
||||
void
|
||||
prom_cmdline(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* Drop into the prom, but completely terminate the program.
|
||||
* No chance of continuing.
|
||||
*/
|
||||
void
|
||||
prom_halt(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
again:
|
||||
local_irq_save(flags);
|
||||
(*(romvec->pv_halt))();
|
||||
local_irq_restore(flags);
|
||||
goto again; /* PROM is out to get me -DaveM */
|
||||
}
|
||||
|
||||
typedef void (*sfunc_t)(void);
|
||||
|
||||
/* Get the idprom and stuff it into buffer 'idbuf'. Returns the
|
||||
* format type. 'num_bytes' is the number of bytes that your idbuf
|
||||
* has space for. Returns 0xff on error.
|
||||
*/
|
||||
unsigned char
|
||||
prom_get_idprom(char *idbuf, int num_bytes)
|
||||
{
|
||||
int i, oldsfc;
|
||||
GET_SFC(oldsfc);
|
||||
SET_SFC(FC_CONTROL);
|
||||
for(i=0;i<num_bytes; i++)
|
||||
{
|
||||
/* There is a problem with the GET_CONTROL_BYTE
|
||||
macro; defining the extra variable
|
||||
gets around it.
|
||||
*/
|
||||
int c;
|
||||
GET_CONTROL_BYTE(SUN3_IDPROM_BASE + i, c);
|
||||
idbuf[i] = c;
|
||||
}
|
||||
SET_SFC(oldsfc);
|
||||
return idbuf[0];
|
||||
}
|
||||
|
||||
/* Get the major prom version number. */
|
||||
int
|
||||
prom_version(void)
|
||||
{
|
||||
return romvec->pv_romvers;
|
||||
}
|
||||
|
||||
/* Get the prom plugin-revision. */
|
||||
int
|
||||
prom_getrev(void)
|
||||
{
|
||||
return prom_rev;
|
||||
}
|
||||
|
||||
/* Get the prom firmware print revision. */
|
||||
int
|
||||
prom_getprev(void)
|
||||
{
|
||||
return prom_prev;
|
||||
}
|
||||
55
arch/m68k/sun3/prom/printf.c
Normal file
55
arch/m68k/sun3/prom/printf.c
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* printf.c: Internal prom library printf facility.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
/* This routine is internal to the prom library, no one else should know
|
||||
* about or use it! It's simple and smelly anyway....
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <asm/openprom.h>
|
||||
#include <asm/oplib.h>
|
||||
|
||||
#ifdef CONFIG_KGDB
|
||||
extern int kgdb_initialized;
|
||||
#endif
|
||||
|
||||
static char ppbuf[1024];
|
||||
|
||||
void
|
||||
prom_printf(char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char ch, *bptr;
|
||||
int i;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
#ifdef CONFIG_KGDB
|
||||
ppbuf[0] = 'O';
|
||||
i = vsprintf(ppbuf + 1, fmt, args) + 1;
|
||||
#else
|
||||
i = vsprintf(ppbuf, fmt, args);
|
||||
#endif
|
||||
|
||||
bptr = ppbuf;
|
||||
|
||||
#ifdef CONFIG_KGDB
|
||||
if (kgdb_initialized) {
|
||||
printk("kgdb_initialized = %d\n", kgdb_initialized);
|
||||
putpacket(bptr, 1);
|
||||
} else
|
||||
#else
|
||||
while((ch = *(bptr++)) != 0) {
|
||||
if(ch == '\n')
|
||||
prom_putchar('\r');
|
||||
|
||||
prom_putchar(ch);
|
||||
}
|
||||
#endif
|
||||
va_end(args);
|
||||
return;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue