ReactOS  0.4.14-dev-342-gdc047f9
prep.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _pci_bar
 

Functions

void sync (void)
 
void PpcPrepInit (void)
 
void ide_seek (void *extension, int low, int high)
 
int ide_read (void *extension, char *buffer, int bytes)
 
void ide_setup (void *extension)
 
void print_bar (struct _pci_bar *bar)
 
void pci_setup (PCONFIGURATION_COMPONENT_DATA pci_bus, struct _pci_desc *pci_desc)
 
void pci_read_bar (struct _pci_desc *pci_desc, int bus, int dev, int fn, int bar, struct _pci_bar *bar_data)
 
void vga_setup (PCONFIGURATION_COMPONENT_DATA pci_bus, struct _pci_desc *pci_desc, struct _vga_desc *vga_desc, int bus, int dev, int fn)
 

Variables

struct _pci_desc pci1_desc
 
struct _idectl_desc ide1_desc
 
struct _vga_desc vga1_desc
 

Function Documentation

◆ ide_read()

int ide_read ( void extension,
char buffer,
int  bytes 
)

Definition at line 50 of file prep_ide.c.

50  {
51  idectl_desc *desc = (idectl_desc *)extension;
52  short *databuf = (short *)buffer;
53  int inwords;
54 
55  ide_bsy( extension );
56  SetPhysByte(desc->port+2, bytes / desc->bytespersec);
57  SetPhysByte(desc->port+3, desc->seek_sector + 1);
58  SetPhysByte(desc->port+4, desc->seek_cylinder);
59  SetPhysByte(desc->port+5, desc->seek_cylinder >> 8);
60  SetPhysByte(desc->port+6, desc->seek_head | 0xa0);
61  SetPhysByte(desc->port+7, 0x20);
62 
63  for( inwords = 0; inwords < desc->bytespersec / sizeof(short); inwords++ ) {
64  databuf[inwords] = GetPhysHalf(desc->port);
65  }
66 
67  desc->seekto += desc->bytespersec;
68  ide_seek( extension, desc->seekto, desc->seekto >> 32 );
69 
70  return bytes - (bytes % desc->bytespersec);
71 }
void ide_bsy(void *extension)
Definition: prep_ide.c:41
GLuint buffer
Definition: glext.h:5915
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
static const WCHAR desc[]
Definition: protectdata.c:36
int GetPhysHalf(paddr_t addr)
void ide_seek(void *extension, int low, int high)
Definition: prep_ide.c:17
void SetPhysByte(ULONG Addr, ULONG Data)

Referenced by PpcPrepDiskReadLogicalSectors().

◆ ide_seek()

void ide_seek ( void extension,
int  low,
int  high 
)

Definition at line 17 of file prep_ide.c.

17  {
18  idectl_desc *desc = (idectl_desc *)extension;
19  long long seekto = ((((long long)high) << 32) | (low & 0xffffffff));
20  /* order = sector, head, cylinder */
21  desc->seek_sector = seekto % desc->sectors;
22  seekto /= desc->sectors;
23  desc->seek_head = seekto % desc->heads;
24  seekto /= desc->heads;
25  desc->seek_cylinder = seekto;
26  desc->seekto = seekto;
27 }
static const WCHAR desc[]
Definition: protectdata.c:36
#define seekto(pos, errstr)
Definition: mkdosfs.c:1613
#define long
Definition: qsort.c:33

Referenced by ide_read(), and PpcPrepDiskReadLogicalSectors().

◆ ide_setup()

void ide_setup ( void extension)

Definition at line 73 of file prep_ide.c.

73  {
74  idectl_desc *desc = (idectl_desc *)extension;
75  short identbuffer[256];
76  char namebuf[41];
77  short *databuf = (short *)identbuffer, in;
78  int inwords;
79 
80  ide_rdy( extension );
81  ide_bsy( extension );
82  desc->bytespersec = 512;
83  SetPhysByte(desc->port+2, 1);
84  SetPhysByte(desc->port+3, 0);
85  SetPhysByte(desc->port+4, 0);
86  SetPhysByte(desc->port+5, 0);
87  SetPhysByte(desc->port+6, 0);
88  SetPhysByte(desc->port+7, 0xec);
89  ide_drq( extension );
90 
91  for( inwords = 0; inwords < desc->bytespersec / sizeof(short); inwords++ ) {
92  in = GetPhysHalf(desc->port);
93  databuf[inwords] = SWAP_W(in);
94  sync();
95  }
96 
97  desc->cylinders = identbuffer[1];
98  desc->heads = identbuffer[3];
99  desc->sectors = identbuffer[6];
100 
101  /* Debug: Write out hard disc model */
102 
103  strncpy(namebuf, (char *)(identbuffer+0x1b), 41);
104  printf("HARD DISC MODEL: %s c,h,s %d,%d,%d\n",
105  namebuf, desc->cylinders, desc->heads, desc->sectors);
106 }
void ide_bsy(void *extension)
Definition: prep_ide.c:41
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
static const WCHAR desc[]
Definition: protectdata.c:36
void ide_rdy(void *extension)
Definition: prep_ide.c:31
void ide_drq(void *extension)
Definition: prep_ide.c:36
int GetPhysHalf(paddr_t addr)
void sync()
Definition: prep.c:9
#define SWAP_W(x)
Definition: prep_ide.c:6
GLuint in
Definition: glext.h:9616
void SetPhysByte(ULONG Addr, ULONG Data)
#define printf
Definition: config.h:203

Referenced by PpcPrepInit().

◆ pci_read_bar()

void pci_read_bar ( struct _pci_desc pci_desc,
int  bus,
int  dev,
int  fn,
int  bar,
struct _pci_bar bar_data 
)

Definition at line 57 of file prep_pci.c.

58  {
59  bar_data->data = pci_read( desc, bus, dev, fn, 0x10 + (bar * 4), 4 );
60 }
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
unsigned long data
Definition: prep.h:7
static const WCHAR desc[]
Definition: protectdata.c:36
unsigned long pci_read(pci_desc *desc, int bus, int dev, int fn, int reg, int len)
Definition: prep_pci.c:32

Referenced by vga_setup().

◆ pci_setup()

void pci_setup ( PCONFIGURATION_COMPONENT_DATA  pci_bus,
struct _pci_desc pci_desc 
)

Definition at line 96 of file prep_pci.c.

96  {
97  unsigned char type;
98  unsigned short vendor, device, devclass;
99  int funcs, bus, dev, fn;
100 
101  pci1_desc.cfg = (pci_cfg *)0x80000cf8;
102 
103  printf("PCI Bus:\n");
104  for( bus = 0; bus < 1; bus++ ) {
105  for( dev = 0; dev < 32; dev++ ) {
106  type = pci_read(desc,bus,dev,0,PCI_HEADER_TYPE,1);
107  vendor = pci_read(desc,bus,dev,0,PCI_VENDORID,2);
108  device = pci_read(desc,bus,dev,0,PCI_DEVICEID,2);
109 
110  if(vendor == 0 || vendor == 0xffff) continue;
111  if(type & 0x80) funcs = 8; else funcs = 1;
112 
113  for( fn = 0; fn < funcs; fn++ ) {
114  devclass = pci_read(desc,bus,dev,fn,PCI_BASECLASS,1);
115  printf(" %d:%d -> vendor:device:class %x:%x:%x\n",
116  bus, dev, vendor, device, devclass);
117 
118  if( devclass == 3 ) {
119  printf("Setting up vga...\n");
120  vga_setup(pcibus,desc,&vga1_desc,bus,dev,fn);
121  printf("Done with vga\n");
122  }
123  }
124  }
125  }
126  printf("^-- end PCI\n");
127 }
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int dev
Definition: mkdosfs.c:536
void vga_setup(PCONFIGURATION_COMPONENT_DATA pci_bus, struct _pci_desc *pci_desc, struct _vga_desc *vga_desc, int bus, int dev, int fn)
Definition: prep_vga.c:13
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
#define PCI_HEADER_TYPE
Definition: prep_pci.c:93
#define PCI_BASECLASS
Definition: prep_pci.c:94
const WCHAR * vendor
Definition: db.cpp:863
static struct __wine_debug_functions funcs
Definition: debug.c:59
struct _vga_desc vga1_desc
Definition: prep_vga.c:11
unsigned long pci_read(pci_desc *desc, int bus, int dev, int fn, int reg, int len)
Definition: prep_pci.c:32
pci_cfg * cfg
Definition: prep_pci.c:10
pci_desc pci1_desc
Definition: prep_pci.c:13
#define PCI_DEVICEID
Definition: prep_pci.c:92
#define printf
Definition: config.h:203
#define PCI_VENDORID
Definition: prep_pci.c:91

◆ PpcPrepInit()

void PpcPrepInit ( void  )

Definition at line 123 of file prep.c.

124 {
126 
127  printf("Serial on\n");
128 
129  ide_setup( &ide1_desc );
130 
132 
135 
139 
142  MachVtbl.HwIdle = PcPrepHwIdle;
143 
144  printf( "FreeLDR version [%s]\n", FrLdrVersionString );
145 
146  BootMain( "" );
147 }
PCONFIGURATION_COMPONENT_DATA PpcPrepHwDetect()
Definition: prep.c:107
void PpcPrepPutChar(int ch)
Definition: prep.c:13
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
void BootMain(PSTR CmdLine)
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:77
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
const PCSTR FrLdrVersionString
Definition: freeldr.c:32
BOOLEAN PpcPrepDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: prep.c:23
int PpcPrepConsGetCh()
Definition: prep.c:42
struct _idectl_desc ide1_desc
Definition: prep_ide.c:15
void ide_setup(void *extension)
Definition: prep_ide.c:73
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VIDEODISPLAYMODE PpcPrepVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
Definition: prep.c:53
int(* ConsGetCh)(VOID)
Definition: machine.h:43
void PpcPrepVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: prep.c:58
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
MACHVTBL MachVtbl
Definition: arcemul.c:21
VOID(* HwIdle)(VOID)
Definition: machine.h:78
void PpcPrepVideoClearScreen(UCHAR Attr)
Definition: prep.c:48
BOOLEAN PpcPrepConsKbHit()
Definition: prep.c:36
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
ULONG PpcPrepGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
Definition: prep.c:67
#define printf
Definition: config.h:203

Referenced by PpcInit(), and PpcOfwInit().

◆ print_bar()

void print_bar ( struct _pci_bar bar)

Definition at line 87 of file prep_pci.c.

87  {
88  printf("BAR: %x\n", bar->data);
89 }
unsigned long data
Definition: prep.h:7
#define printf
Definition: config.h:203

Referenced by vga_setup().

◆ sync()

void sync ( void  )
inline

Definition at line 9 of file prep.c.

9 { __asm__("eieio\n\tsync"); }
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")

Referenced by chr(), ide_bsy(), ide_drq(), ide_rdy(), ide_setup(), pci_read(), pci_write(), PpcPrepPutChar(), rdy(), recv(), send(), setup(), and ios_base::sync_with_stdio().

◆ vga_setup()

void vga_setup ( PCONFIGURATION_COMPONENT_DATA  pci_bus,
struct _pci_desc pci_desc,
struct _vga_desc vga_desc,
int  bus,
int  dev,
int  fn 
)

Definition at line 13 of file prep_vga.c.

15  {
16  struct _pci_bar bar_data;
17  int i;
18 
19  for( i = 0; i < 6; i++ ) {
20  pci_read_bar( desc, bus, dev, fn, i, &bar_data );
21  print_bar( &bar_data );
22  if( (bar_data.data > 0x10000) || ((bar_data.data&1) == 1) ) {
23  vga_desc->addr = (char *)(0xc0000000 + (bar_data.data & ~0x7ff));
24 // BootInfo.dispDeviceBase = vga_desc->addr;
25  break;
26  }
27  }
28 }
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
char * addr
Definition: prep_vga.c:6
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR desc[]
Definition: protectdata.c:36
Definition: prep.h:6
void print_bar(struct _pci_bar *bar)
Definition: prep_pci.c:87
void pci_read_bar(struct _pci_desc *pci_desc, int bus, int dev, int fn, int bar, struct _pci_bar *bar_data)
Definition: prep_pci.c:57

Referenced by pci_setup().

Variable Documentation

◆ ide1_desc

struct _idectl_desc ide1_desc

Definition at line 15 of file prep_ide.c.

Referenced by PpcPrepDiskReadLogicalSectors(), and PpcPrepInit().

◆ pci1_desc

struct _pci_desc pci1_desc

Definition at line 13 of file prep_pci.c.

Referenced by pci_setup().

◆ vga1_desc

struct _vga_desc vga1_desc

Definition at line 11 of file prep_vga.c.

Referenced by pci_setup().