Minor cleanups

- whitespace
- share SysBase in bootmenu
- drop dead code in cmdhandler.c/port.c/printf.c
- use device_xname in aprint_error_dev()
This commit is contained in:
Stefan Reinauer 2022-09-05 09:47:52 +08:00
parent b9fecc6ac5
commit 1f342781f5
9 changed files with 13 additions and 113 deletions

View File

@ -374,7 +374,6 @@ decode_autoconfig(void)
printf(" SizeExt");
printf(" %s\n", config_subsizes[value & 0x0f]);
if (autoconfig_reserved(0x0c))
rc = 1;

View File

@ -34,7 +34,7 @@
#include "attach.h"
#include "scsimsg.h"
struct ExecBase *SysBase;
extern struct ExecBase *SysBase;
struct GfxBase *GfxBase;
struct Library *GadToolsBase;
struct Library *IntuitionBase;

View File

@ -411,11 +411,6 @@ CMD_SEEK_continue:
void scsipi_completion_poll(struct scsipi_channel *chan);
#if 0
__asm("_geta4: lea ___a4_init,a4 \n"
" rts");
#endif
static void
cmd_handler(void)
{
@ -431,15 +426,6 @@ cmd_handler(void)
ULONG wait_mask;
ULONG timer_mask;
uint32_t mask;
#if 0
register long devbase asm("a6");
/* Builtin compiler function to set A4 to the global data area */
geta4();
devbase = msg->devbase;
(void) devbase;
#endif
task = (struct Task *) FindTask((char *)NULL);
@ -535,7 +521,6 @@ start_cmd_handler(uint *boardnum)
{
struct Task *task;
start_msg_t msg;
// register long devbase asm("a6");
/* Prepare a startup structure with the board to initialize */
memset(&msg, 0, sizeof (msg));

View File

@ -251,7 +251,7 @@ drv_open(struct Library *dev asm("a6"), struct IORequest *ioreq asm("a1"),
printf("Open fail %d.%d\n", scsi_unit % 10, scsi_unit / 10);
dev->lib_OpenCnt--;
ioreq->io_Error = HFERR_SelTimeout;
// HFERR_SelfUnit - attempted to open our own SCSI ID
// HFERR_SelfUnit - attempted to open our own SCSI ID
ReleaseSemaphore(&entry_sem);
return;
}

5
port.c
View File

@ -25,11 +25,6 @@
#define PRINTF_CALLOUT(args...)
#endif
#if 0
/* Not sure this even works for a driver */
ulong __stack_size = 32768;
#endif
void
panic(const char *s)
{

View File

@ -43,7 +43,7 @@
* Scaled down version of printf(3).
*/
// #include "printf.h"
#include "printf.h"
#define USE_SERIAL_OUTPUT
#include "port.h"
#include <clib/debug_protos.h>
@ -566,56 +566,6 @@ int printf(const char *fmt, ...)
return (rc);
}
/**
* warnx() is a stdio compatible function which operates on a format
* string and variable argument list. Output is directed to
* the serial console.
*
* @param [in] fmt - A string describing the format of the output. This
* format string is compatible with that of printf().
* @param [in] ... - A variable list of arguments.
*
* @return None.
*/
__attribute__((format(__printf__, 1, 2)))
void warnx(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
(void) vprintf(fmt, args);
va_end(args);
putchar('\n');
}
/**
* errx() is a stdio compatible function which operates on a format
* string and variable argument list. Output is directed to
* the serial console.
*
* @param [in] rc - Ignored.
* @param [in] fmt - A string describing the format of the output. This
* format string is compatible with that of printf().
* @param [in] ... - A variable list of arguments.
*
* @return This function does not return.
*/
__attribute__((format(__printf__, 2, 3))) __attribute__((noreturn))
void errx(int rc, const char *fmt, ...)
{
(void) rc;
va_list args;
va_start(args, fmt);
(void) vprintf(fmt, args);
va_end(args);
putchar('\n');
/* This function does not return */
while (1)
;
}
#endif /* USE_SERIAL_OUTPUT */
#undef DO_PRINTF_TEST

View File

@ -163,36 +163,6 @@ int printf(const char *fmt, ...);
__attribute__((format(__scanf__, 1, 3)))
int sscanf(const char *str, char const *fmt, ...);
/**
* errx() is a stdio compatible function which operates on a format
* string and variable argument list. Output is directed to
* the serial console.
*
* @param [in] rc - Ignored.
* @param [in] fmt - A string describing the format of the output. This
* format string is compatible with that of printf().
* @param [in] ... - A variable list of arguments.
*
* @return This function does not return.
*/
__attribute__((format(__printf__, 2, 3))) __attribute__((noreturn))
void errx(int rc, const char *fmt, ...);
/**
* warnx() is a stdio compatible function which operates on a format
* string and variable argument list. Output is directed to
* the serial console.
*
* @param [in] fmt - A string describing the format of the output. This
* format string is compatible with that of printf().
* @param [in] ... - A variable list of arguments.
*
* @return None.
*/
__attribute__((format(__printf__, 1, 2)))
void warnx(const char *fmt, ...);
int putchar(int ch);
int puts(const char *str);

View File

@ -89,15 +89,16 @@ struct PartitionBlock {
static uint32_t *_block; // shared storage for 1 block
extern char real_device_name[];
void find_partitions(struct ConfigDev* cd, struct RigidDiskBlock* rdb, struct IOStdReq *ioreq, int unit)
void
find_partitions(struct ConfigDev *cd, struct RigidDiskBlock *rdb, struct IOStdReq *ioreq, int unit)
{
int cur_partition = 0;
uint8_t tmp;
uint32_t *block = _block;
if (!rdb || rdb->rdb_PartitionList == 0) {
printf("No partitions on disk.\n");
return;
printf("No partitions on disk.\n");
return;
}
uint32_t cur_block = rdb->rdb_PartitionList;
@ -110,8 +111,8 @@ next_partition:
uint32_t first = block[0];
if (first != PART_IDENTIFIER) {
printf("Not a valid partition: %d\n", first);
return;
printf("Not a valid partition: %d\n", first);
return;
}
struct PartitionBlock *pb = (struct PartitionBlock *)block;
@ -154,7 +155,7 @@ next_partition:
if (node) {
#ifdef DEBUG
printf(" GlobalVec: %08x\n", (uint32_t)node->dn_GlobalVec);
printf(" GlobalVec: %08x\n", (uint32_t)node->dn_GlobalVec);
#endif
node->dn_GlobalVec = -1; // yet unclear if needed
@ -177,7 +178,8 @@ next_partition:
return;
}
int parse_rdb(struct ConfigDev* cd, struct Library *dev)
int
parse_rdb(struct ConfigDev *cd, struct Library *dev)
{
int i, j;
struct IOStdReq ior;

View File

@ -188,11 +188,10 @@ int aprint_error_dev(device_t self, const char *fmt, ...)
int rc;
va_list args;
printf("SCSI\n");
printf("%s: ", device_xname(self));
va_start(args, fmt);
rc = vprintf(fmt, args);
va_end(args);
return (rc);
}