aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-10-28 18:20:27 +0200
committerHelge Deller <deller@gmx.de>2023-10-31 08:26:22 +0100
commitb8b8d000344efbe0ae1b8d7cf640099550850571 (patch)
treeeddd9a50f8d4408b1d74d3fad24815de5242926f
parent539ffaa1b9e7628cfacdea63d11b270acb945411 (diff)
downloadseabios-hppa-b8b8d000344efbe0ae1b8d7cf640099550850571.zip
seabios-hppa-b8b8d000344efbe0ae1b8d7cf640099550850571.tar.gz
seabios-hppa-b8b8d000344efbe0ae1b8d7cf640099550850571.tar.bz2
parisc: Fix ODE on B160L
Fully implement device tree Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--src/parisc/b160l.h22
-rw-r--r--src/parisc/hppa_hardware.h2
-rw-r--r--src/parisc/parisc.c98
3 files changed, 88 insertions, 34 deletions
diff --git a/src/parisc/b160l.h b/src/parisc/b160l.h
index b51a46f..9072120 100644
--- a/src/parisc/b160l.h
+++ b/src/parisc/b160l.h
@@ -129,7 +129,7 @@ static struct pdc_iodc iodc_data_hpa_fff8c000 = {
static struct pdc_system_map_mod_info mod_info_hpa_ffd00000 = {
.mod_addr = 0xffd00000,
.mod_pgs = 0x1,
- .add_addrs = 0x2,
+ .add_addrs = 0, // x2,
};
static struct pdc_module_path mod_path_hpa_ffd00000 = {
.path = { .flags = 0x0, .bc = { 0xff, 0xff, 0xff, 0xff, 0xff, 0x8 }, .mod = 0x10 },
@@ -150,7 +150,7 @@ static struct pdc_iodc iodc_data_hpa_ffd00000 = {
.length = 0x0000,
/* pad: 0x0000, 0x0000 */
};
-#define HPA_ffd00000_num_addr 2
+#define HPA_ffd00000_num_addr 0 // 2
#define HPA_ffd00000_add_addr 0xffd0c000, 0xffc00000,
#define HPA_ffd05000_DESCRIPTION "Merlin 160 Core RS-232"
@@ -241,7 +241,7 @@ static struct pdc_iodc iodc_data_hpa_ffd07000 = {
static struct pdc_system_map_mod_info mod_info_hpa_ffd02000 = {
.mod_addr = 0xffd02000,
.mod_pgs = 0x1,
- .add_addrs = 0x2,
+ .add_addrs = 0, // 2,
};
static struct pdc_module_path mod_path_hpa_ffd02000 = {
.path = { .flags = 0x0, .bc = { 0xff, 0xff, 0xff, 0xff, 0x8, 0x10 }, .mod = 0x0 },
@@ -262,7 +262,7 @@ static struct pdc_iodc iodc_data_hpa_ffd02000 = {
.length = 0x0000,
/* pad: 0x0000, 0x0000 */
};
-#define HPA_ffd02000_num_addr 2
+#define HPA_ffd02000_num_addr 0 // 2
#define HPA_ffd02000_add_addr 0xffd01000, 0xffd03000,
#define HPA_ffd04000_DESCRIPTION "Merlin 160 Core Audio"
@@ -409,7 +409,7 @@ static struct pdc_iodc iodc_data_hpa_f4000000 = {
static struct pdc_system_map_mod_info mod_info_hpa_f8000000 = {
.mod_addr = LASI_GFX_HPA,
.mod_pgs = 0x2000,
- .add_addrs = 0x1,
+ .add_addrs = 0, // 1,
};
static struct pdc_module_path mod_path_hpa_f8000000 = {
.path = { .flags = 0x0, .bc = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, .mod = 0x1 },
@@ -608,12 +608,6 @@ static struct pdc_iodc iodc_data_hpa_fff81000 = {
.mod_path = &mod_path_hpa_f8000000,\
.num_addr = HPA_f8000000_num_addr,\
.add_addr = { HPA_f8000000_add_addr } },\
- { .hpa = CPU_HPA,\
- .iodc = &iodc_data_hpa_fff10000,\
- .mod_info = &mod_info_hpa_fff10000,\
- .mod_path = &mod_path_hpa_fff10000,\
- .num_addr = HPA_fff10000_num_addr,\
- .add_addr = { HPA_fff10000_add_addr } },\
{ .hpa = MEMORY_HPA,\
.iodc = &iodc_data_hpa_fffbf000,\
.mod_info = &mod_info_hpa_fffbf000,\
@@ -626,4 +620,10 @@ static struct pdc_iodc iodc_data_hpa_fff81000 = {
.mod_path = &mod_path_hpa_fff81000,\
.num_addr = HPA_fff81000_num_addr,\
.add_addr = { HPA_fff81000_add_addr } },\
+ { .hpa = CPU_HPA,\
+ .iodc = &iodc_data_hpa_fff10000,\
+ .mod_info = &mod_info_hpa_fff10000,\
+ .mod_path = &mod_path_hpa_fff10000,\
+ .num_addr = HPA_fff10000_num_addr,\
+ .add_addr = { HPA_fff10000_add_addr } },\
{ 0, }
diff --git a/src/parisc/hppa_hardware.h b/src/parisc/hppa_hardware.h
index d4230da..5015cf3 100644
--- a/src/parisc/hppa_hardware.h
+++ b/src/parisc/hppa_hardware.h
@@ -28,7 +28,7 @@
#define LASI_GFX_HPA 0xf8000000
#define ARTIST_FB_ADDR 0xf9000000
#define CPU_HPA 0xfffb0000
-#define MEMORY_HPA 0xfffff000
+#define MEMORY_HPA 0xfffff000 // 0xfffa0000
#define SCSI_HPA 0xf1040000 /* emulated SCSI, needs to be in f region */
diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c
index 9c8375d..87200bd 100644
--- a/src/parisc/parisc.c
+++ b/src/parisc/parisc.c
@@ -283,6 +283,7 @@ typedef struct {
int add_addr[5];
struct pci_device *pci;
unsigned long pci_addr;
+ int index;
} hppa_device_t;
static hppa_device_t *find_hpa_device(unsigned long hpa);
@@ -324,6 +325,7 @@ static hppa_device_t *parisc_devices = machine_B160L.device_list;
LASI_GFX_HPA,\
LASI_PS2KBD_HPA, \
LASI_PS2MOU_HPA, \
+ MEMORY_HPA, \
0
static const char *hpa_name(unsigned long hpa)
@@ -627,12 +629,13 @@ static hppa_device_t *find_hpa_device(unsigned long hpa)
int i;
/* search classical HPPA devices */
- if (hpa)
- for (i = 0; i < (MAX_DEVICES-1); i++) {
- if (hpa == parisc_devices[i].hpa)
- return &parisc_devices[i];
- if (!parisc_devices[i].hpa)
- break;
+ if (hpa) {
+ for (i = 0; i < (MAX_DEVICES-1); i++) {
+ if (hpa == parisc_devices[i].hpa)
+ return &parisc_devices[i];
+ if (!parisc_devices[i].hpa)
+ break;
+ }
}
/* search PCI devices */
@@ -652,8 +655,8 @@ static void remove_from_keep_list(unsigned long hpa)
while (keep_list[i] && keep_list[i] != hpa)
i++;
while (keep_list[i]) {
+ keep_list[i] = keep_list[i+1];
++i;
- keep_list[i-1] = keep_list[i];
}
}
@@ -790,8 +793,63 @@ static int compare_module_path(struct pdc_module_path *path,
return 1;
}
-static hppa_device_t *find_hppa_device_by_path(unsigned long hpa,
- struct pdc_module_path *search,
+static hppa_device_t *add_index_all_devices(void)
+{
+ hppa_device_t *dev;
+ int i, index = 0;
+
+ for (i = 0; i < (MAX_DEVICES-1); i++) {
+ dev = parisc_devices + i;
+ if (dev->hpa) {
+ dev->index = index;
+ if (0)
+ dprintf(1, "device HPA %lx %s is index # %d\n", dev->hpa, hpa_name(dev->hpa), index);
+ index++;
+ }
+ }
+
+ /* search PCI devices */
+ for (i = 0; i < curr_pci_devices; i++) {
+ dev = hppa_pci_devices + i;
+ if (dev->hpa) {
+ dev->index = index;
+ if (0)
+ dprintf(1, "device HPA %lx %s is index # %d\n", dev->hpa, hpa_name(dev->hpa), index);
+ index++;
+ }
+ }
+
+ return NULL;
+}
+
+static hppa_device_t *find_hppa_device_by_hpa(unsigned long hpa)
+{
+ hppa_device_t *dev;
+ int i, nr = 0;
+
+ for (i = 0; i < (MAX_DEVICES-1); i++) {
+ dev = parisc_devices + i;
+ if (dev && dev->hpa == hpa) {
+ // found it.
+ return dev;
+ }
+ nr++;
+ }
+
+ /* search PCI devices */
+ for (i = 0; i < curr_pci_devices; i++) {
+ dev = hppa_pci_devices + i;
+ if (dev && dev->hpa == hpa) {
+ // found it.
+ return dev;
+ }
+ nr++;
+ }
+
+ return NULL;
+}
+
+static hppa_device_t *find_hppa_device_by_path(struct pdc_module_path *search,
unsigned long *index, int check_layers)
{
hppa_device_t *dev;
@@ -799,8 +857,6 @@ static hppa_device_t *find_hppa_device_by_path(unsigned long hpa,
for (i = 0; i < (MAX_DEVICES-1); i++) {
dev = parisc_devices + i;
- if (dev->hpa != hpa)
- continue;
if (compare_module_path(dev->mod_path, search, check_layers)) {
if (index)
@@ -833,7 +889,7 @@ static hppa_device_t *find_hppa_device_by_index(unsigned int index, int search_p
dev = parisc_devices + i;
if (!dev->hpa)
continue;
- if (index-- == 0)
+ if (dev->index == index)
return dev;
}
@@ -841,7 +897,7 @@ static hppa_device_t *find_hppa_device_by_index(unsigned int index, int search_p
if (search_pci) {
for (i = 0; i < curr_pci_devices; i++) {
dev = hppa_pci_devices + i;
- if (index-- == 0)
+ if (dev->index == index)
return dev;
}
}
@@ -891,7 +947,7 @@ static void parisc_serial_out(char c)
dprintf(1," \n");
}
hppa_device_t *dev;
- dev = find_hppa_device_by_path(addr, &PAGE0->mem_cons.dp, NULL, 0);
+ dev = find_hppa_device_by_path(&PAGE0->mem_cons.dp, NULL, 0);
if (0) {
dprintf(1,"parisc_serial_out hpa %x\n", PAGE0->mem_cons.hpa);
print_mod_path(dev->mod_path);
@@ -1409,9 +1465,10 @@ static int pdc_cache(unsigned int *arg)
machine_cache_info->dc_count, machine_cache_info->dc_loop, machine_cache_info->dc_stride);
#endif
#if 1
+ /* ODE has problems if we report no cache */
machine_cache_info->ic_size = 1024; /* no instruction cache */
machine_cache_info->dc_size = 1024; /* no data cache */
-#elif 0
+#elif 1
machine_cache_info->dc_conf = (struct pdc_cache_cf) { 0 }; // .alias=1, .sh=3, };
machine_cache_info->ic_conf = (struct pdc_cache_cf) { 0 }; // .alias=1, .sh=3, };
@@ -1502,8 +1559,6 @@ static int pdc_iodc(unsigned int *arg)
iodc_p = dev->iodc;
if (ARG4 == PDC_IODC_INDEX_DATA) {
- if (iodc_p->type == 0x0041) // Memory ?
- ARG6 = 2; // Memory modules return 2 bytes of IODC memory (result2 ret[0] = 0x6701f41 HI !!)
memcpy((void*) ARG5, iodc_p, ARG6);
c = (unsigned char *) ARG5;
// printf("SeaBIOS: PDC_IODC get: hpa = 0x%lx, HV: 0x%x 0x%x IODC_SPA=0x%x type 0x%x, \n", hpa, c[0], c[1], c[2], c[3]);
@@ -1822,7 +1877,7 @@ static int pdc_system_map(unsigned int *arg)
case PDC_TRANSLATE_PATH:
mod_path = (struct pdc_module_path *)ARG3;
- hppa_device_t *dev = find_hppa_device_by_path(0, mod_path, &hpa_index, 1); // XXX
+ hppa_device_t *dev = find_hppa_device_by_path(mod_path, &hpa_index, 1); // XXX
if (0) {
dprintf(1, "PDC_TRANSLATE_PATH dev=%p hpa=%lx ", dev, dev ? dev->hpa:0UL);
print_mod_path(mod_path);
@@ -1868,13 +1923,11 @@ static int pdc_mem_map(unsigned int *arg)
struct pdc_memory_map *memmap = (struct pdc_memory_map *) ARG2;
struct pdc_module_path *dp = (struct pdc_module_path *) ARG3;
hppa_device_t *dev;
- unsigned long index;
switch (option) {
case PDC_MEM_MAP_HPA:
-// NEEDS FIXING !!
dprintf(0, "\nSeaBIOS: PDC_MEM_MAP_HPA bus = %d, mod = %d\n", dp->path.bc[4], dp->path.mod);
- dev = find_hppa_device_by_path(memmap->hpa, (struct pdc_module_path *) dp, &index, 0); // ??
+ dev = find_hppa_device_by_hpa(memmap->hpa);
if (!dev)
return PDC_NE_MOD;
memcpy(memmap, dev->mod_info, sizeof(*memmap));
@@ -1986,7 +2039,7 @@ static int pdc_pci_index(unsigned int *arg)
memcpy((void *)ARG4, irt_table, irt_table_entries * 16);
return PDC_OK;
case PDC_PCI_PCI_PATH_TO_PCI_HPA:
- BUG_ON(1);
+ // BUG_ON(1);
result[0] = pci_hpa;
return PDC_OK;
case PDC_PCI_PCI_HPA_TO_PCI_PATH:
@@ -2881,6 +2934,7 @@ void __VISIBLE start_parisc_firmware(void)
if (0) { for (i=0; parisc_devices[i].hpa; i++)
printf("Kept #%d at 0x%lx\n", i, parisc_devices[i].hpa);
}
+ add_index_all_devices();
// Initialize stable storage
init_stable_storage();